1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
extern crate siege_math;
extern crate float_cmp;
pub mod chromaticities;
pub mod colortemp;
pub mod cie1931;
pub mod srgb;
pub mod lms;
pub mod aces;
pub mod rec2020;
pub use chromaticities::*;
pub use colortemp::*;
pub use cie1931::*;
pub use srgb::*;
pub use lms::*;
pub use aces::*;
pub use rec2020::*;
pub fn color_level(irradiance: f32, white_point: f32) -> f32
{
let black_point = white_point / 100_000_f32;
if irradiance >= white_point {
1.0
}
else if irradiance <= black_point {
0.0
}
else {
(irradiance - black_point) / (white_point - black_point)
}
}