Crates.io | blackbody |
lib.rs | blackbody |
version | 0.0.0 |
source | src |
created_at | 2022-01-06 11:43:22.453493 |
updated_at | 2022-01-06 11:43:22.453493 |
description | Temperature to blackbody color |
homepage | |
repository | https://github.com/hatoo/blackbody |
max_upload_size | |
id | 508922 |
size | 31,078 |
Blackbody simply provides functions that convert temperature into color. Codes are ported from pbrt-v3.
use blackbody::{temperature_to_rgb, temperature_to_xyz};
fn main() {
// Convert temperatue (Kelvin) into RGB color whose components are [0.0, 1.0].
dbg!(temperature_to_rgb(3000.0));
// Convert temperatue (Kelvin) into XYZ color whose components are [0.0, 1.0].
dbg!(temperature_to_xyz(3000.0));
}
[examples\example.rs:4] temperature_to_rgb(3000.0) = [
0.73506474,
0.3504873,
0.112983376,
]
[examples\example.rs:5] temperature_to_xyz(3000.0) = [
0.44889182,
0.4151354,
0.16
]