MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / GenerateSGInnerProductIrradianceTable

Function GenerateSGInnerProductIrradianceTable

BakingLab/BakingLab.cpp:939–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939static void GenerateSGInnerProductIrradianceTable(float sharpness, const wchar* filePath)
940{
941 std::string output;
942
943 SG sgLight;
944 sgLight.Amplitude = 1.0f;
945 sgLight.Axis = Float3(0.0f, 0.0f, 1.0f);
946 sgLight.Sharpness = sharpness;
947
948 const uint64 NumPoints = 50;
949 for(uint64 pointIdx = 0; pointIdx < NumPoints; ++pointIdx)
950 {
951 float theta = Pi * pointIdx / (NumPoints - 1.0f);
952 Float3 normal = Float3(std::sin(theta), 0.0f, std::cos(theta));
953
954 SG cosineLobe = CosineLobeSG(normal);
955 float irradiance = Max(SGInnerProduct(sgLight, cosineLobe).x, 0.0f);
956
957 output += MakeAnsiString("%f,%f\n", theta, irradiance);
958 }
959
960 WriteStringAsFile(filePath, output);
961}
962
963static void GenerateSGFittedIrradianceTable(float sharpness, const wchar* filePath)
964{

Callers

nothing calls this directly

Calls 8

Float3Class · 0.85
sinFunction · 0.85
cosFunction · 0.85
CosineLobeSGFunction · 0.85
MaxFunction · 0.85
SGInnerProductFunction · 0.85
MakeAnsiStringFunction · 0.85
WriteStringAsFileFunction · 0.85

Tested by

no test coverage detected