MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / sh_create

Function sh_create

StereoKitC/spherical_harmonics.cpp:32–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30///////////////////////////////////////////
31
32spherical_harmonics_t sh_create(const sh_light_t* lights, int32_t light_count) {
33 spherical_harmonics_t result = {};
34 for (int32_t i = 0; i < light_count; i++) {
35 sh_add(result, vec3_normalize(lights[i].dir_to), { lights[i].color.r, lights[i].color.g, lights[i].color.b });
36 }
37 for (int32_t i = 0; i < 9; i++) {
38 result.coefficients[i] /= (float)light_count;
39 }
40
41 // Apply windowing to prevent overshooting
42 sh_windowing(result, .01f);
43
44 return result;
45}
46
47///////////////////////////////////////////
48

Callers

nothing calls this directly

Calls 3

sh_addFunction · 0.85
vec3_normalizeFunction · 0.85
sh_windowingFunction · 0.85

Tested by

no test coverage detected