MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / Blackbody

Function Blackbody

SampleFramework12/v1.00/Graphics/Spectrum.cpp:954–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

952 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824,
953 825, 826, 827, 828, 829, 830};
954void Blackbody(const float *lambda, int n, float T, float *Le) {
955 if (T <= 0) {
956 for (int i = 0; i < n; ++i) Le[i] = 0.f;
957 return;
958 }
959 const float c = 299792458.0f;
960 const float h = 6.62606957e-34f;
961 const float kb = 1.3806488e-23f;
962 for (int i = 0; i < n; ++i) {
963 // Compute emitted radiance for blackbody at wavelength _lambda[i]_
964 float l = lambda[i] * 1e-9f;
965 float lambda5 = (l * l) * (l * l) * l;
966 Le[i] = (2 * h * c * c) /
967 (lambda5 * (std::exp((h * c) / (l * kb * T)) - 1));
968 Assert_(!std::isnan(Le[i]));
969 }
970}
971
972void BlackbodyNormalized(const float *lambda, int n, float T, float *Le) {
973 Blackbody(lambda, n, T, Le);

Callers 1

BlackbodyNormalizedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected