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

Function GenerateSGFittedIrradianceTable

BakingLab/BakingLab.cpp:963–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961}
962
963static void GenerateSGFittedIrradianceTable(float sharpness, const wchar* filePath)
964{
965 std::string output;
966
967 SG sgLight;
968 sgLight.Amplitude = 1.0f;
969 sgLight.Axis = Float3(0.0f, 0.0f, 1.0f);
970 sgLight.Sharpness = sharpness;
971
972 const uint64 NumPoints = 50;
973 for(uint64 pointIdx = 0; pointIdx < NumPoints; ++pointIdx)
974 {
975 float theta = Pi * pointIdx / (NumPoints - 1.0f);
976 Float3 normal = Float3(std::sin(theta), 0.0f, std::cos(theta));
977
978 float irradiance = SGIrradianceFitted(sgLight, normal).x;
979
980 output += MakeAnsiString("%f,%f\n", theta, irradiance);
981 }
982
983 WriteStringAsFile(filePath, output);
984}
985
986int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
987{

Callers

nothing calls this directly

Calls 6

Float3Class · 0.85
sinFunction · 0.85
cosFunction · 0.85
SGIrradianceFittedFunction · 0.85
MakeAnsiStringFunction · 0.85
WriteStringAsFileFunction · 0.85

Tested by

no test coverage detected