Rise
The Vieneo Province
Loading...
Searching...
No Matches
CockpitLighting.h
Go to the documentation of this file.
1#pragma once
2#include "CloudVolume.h"
3#include "NightVisionGain.h"
4
6{
7// Displays need only a restrained optical treatment, not the surface-light gain.
8// Fade continuously with the existing response; no altitude or timing state.
9inline float DisplayStrength(const NightVisionGain::Response& vision)
10{
11 return vision.clouds ? 1.f-1.f/(std::max)(1.f,vision.green) : 0.f;
12}
13
14// Glass retains its existing local-lamp response. Opaque cockpit surfaces
15// instead mix raw lamp/ambient light in FixedFunction before applying NVG,
16// so independently clipped contributions cannot erase the red cabin cast.
18{
19 if (!vision.clouds) return light;
20 return {CloudVolume::Saturate(light.x*vision.red),
21 CloudVolume::Saturate(light.y*vision.green),CloudVolume::Saturate(light.z*vision.blue)};
22}
23
24// Glass fill: cloud light already contains optical gain; sky light does not.
25// Opaque NVG cockpit surfaces use VehicleAmbient with raw inputs instead.
27 float altitudeAboveTop, const NightVisionGain::Response& vision)
28{
29 if (vision.clouds)
30 {
31 skyLight.x *= vision.red;
32 skyLight.y *= vision.green;
33 skyLight.z *= vision.blue;
34 }
35 auto light=CloudVolume::VehicleAmbient(cloudLight,skyLight,altitudeAboveTop);
36 if (vision.clouds)
37 light={CloudVolume::Saturate(light.x),CloudVolume::Saturate(light.y),CloudVolume::Saturate(light.z)};
38 return light;
39}
40}
Point VehicleAmbient(Point cloudLight, Point skyLight, float altitudeAboveTop)
Definition CloudVolume.h:84
float Saturate(float x)
Definition CloudVolume.h:49
float DisplayStrength(const NightVisionGain::Response &vision)
CloudVolume::Point Ambient(CloudVolume::Point cloudLight, CloudVolume::Point skyLight, float altitudeAboveTop, const NightVisionGain::Response &vision)
CloudVolume::Point LocalLight(CloudVolume::Point light, const NightVisionGain::Response &vision)