Rise
The Vieneo Province
Toggle main menu visibility
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
5
namespace
CockpitLighting
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.
9
inline
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.
17
inline
CloudVolume::Point
LocalLight
(
CloudVolume::Point
light,
const
NightVisionGain::Response
& vision)
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.
26
inline
CloudVolume::Point
Ambient
(
CloudVolume::Point
cloudLight,
CloudVolume::Point
skyLight,
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
}
CloudVolume.h
NightVisionGain.h
CloudVolume::VehicleAmbient
Point VehicleAmbient(Point cloudLight, Point skyLight, float altitudeAboveTop)
Definition
CloudVolume.h:84
CloudVolume::Saturate
float Saturate(float x)
Definition
CloudVolume.h:49
CockpitLighting
Definition
CockpitLighting.h:6
CockpitLighting::DisplayStrength
float DisplayStrength(const NightVisionGain::Response &vision)
Definition
CockpitLighting.h:9
CockpitLighting::Ambient
CloudVolume::Point Ambient(CloudVolume::Point cloudLight, CloudVolume::Point skyLight, float altitudeAboveTop, const NightVisionGain::Response &vision)
Definition
CockpitLighting.h:26
CockpitLighting::LocalLight
CloudVolume::Point LocalLight(CloudVolume::Point light, const NightVisionGain::Response &vision)
Definition
CockpitLighting.h:17
CloudVolume::Point
Definition
CloudVolume.h:26
CloudVolume::Point::x
float x
Definition
CloudVolume.h:26
CloudVolume::Point::z
float z
Definition
CloudVolume.h:26
CloudVolume::Point::y
float y
Definition
CloudVolume.h:26
NightVisionGain::Response
Definition
NightVisionGain.h:7
NightVisionGain::Response::green
float green
Definition
NightVisionGain.h:8
NightVisionGain::Response::blue
float blue
Definition
NightVisionGain.h:8
NightVisionGain::Response::clouds
bool clouds
Definition
NightVisionGain.h:9
NightVisionGain::Response::red
float red
Definition
NightVisionGain.h:8
Viewscreen
CockpitLighting.h
Generated on
for Rise by
1.18.0