Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
NightVisionGain.h
Go to the documentation of this file.
1
#pragma once
2
#include <algorithm>
3
4
namespace
NightVisionGain
5
{
6
struct
Response
7
{
8
float
red
=1,
green
=1,
blue
=1;
9
bool
clouds
=
false
;
10
};
11
12
inline
Response
Calculate
(
bool
active,
bool
simulator,
float
luminance)
13
{
14
if
(!active)
return
{};
15
const
float
blend=std::clamp((.35f-luminance)/.30f,0.f,1.f);
16
// Display calibration, not a physical atmospheric or sensor coefficient.
17
// The existing .90 target must remain reachable at the cloud model's
18
// ~.0025 twilight ambient. A .001 signal floor bounds gain at 900 and
19
// lets still fainter signals fade to black without adding illumination.
20
// Preserve the simulator's original 24x response and .01 signal floor.
21
const
float
target=simulator
22
? (std::min)(24.f,.90f/(std::max)(luminance,.01f))
23
: .90f/(std::max)(luminance,.001f);
24
const
float
gain=1.f+((std::max)(1.f,target)-1.f)*blend;
25
return
{gain*(1.f-.15f*blend),gain*(1.f+.10f*blend),
26
gain*(1.f+.20f*blend),!simulator && blend>0};
27
}
28
}
NightVisionGain
Definition
NightVisionGain.h:5
NightVisionGain::Calculate
Response Calculate(bool active, bool simulator, float luminance)
Definition
NightVisionGain.h:12
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
NightVisionGain.h
Generated on
for Rise by
1.18.0