$darkmode
Macros | |
| #define | M_PI 3.14159265358979323846 |
| #define | Y00 0.28209479177387814347f /* 0.5 * sqrt(1/pi) */ |
| #define | Y1n1 0.48860251190291992159f /* -sqrt(3/4pi) * y */ |
| #define | Y10 0.48860251190291992159f /* sqrt(3/4pi) * z */ |
| #define | Y11 0.48860251190291992159f /* -sqrt(3/4pi) * x */ |
| #define | Y2n2 1.09254843059207907054f /* 0.5 * sqrt(15/pi) * xy */ |
| #define | Y2n1 1.09254843059207907054f /* -0.5 * sqrt(15/pi) * yz */ |
| #define | Y20 0.31539156525251999825f /* 0.25 * sqrt(5/pi) * (3z^2 - 1) */ |
| #define | Y21 1.09254843059207907054f /* -0.5 * sqrt(15/pi) * xz */ |
| #define | Y22 0.54627421529603953527f /* 0.25 * sqrt(15/pi) * (x^2 - y^2) */ |
| #define | A0 3.14159265359f /* PI */ |
| #define | A1 2.09439510239f /* 2PI/3 */ |
| #define | A2 0.78539816339f /* PI/4 */ |
Functions | |
| void | sh_zero (SH9 *sh_ptr) |
| Initialize SH coefficients to zero. More... | |
| void | sh_project_directional (const vec3 dir, const vec3 color, SH9 *out_sh) |
| Projects a directional light into SH coefficients. More... | |
| void | sh_eval_irradiance (const vec3 normal, const SH9 *sh_ptr, vec3 out_color) |
| Evaluates the irradiance from SH coefficients in a given direction. More... | |
| #define A0 3.14159265359f /* PI */ |
| #define A1 2.09439510239f /* 2PI/3 */ |
| #define A2 0.78539816339f /* PI/4 */ |
| #define M_PI 3.14159265358979323846 |
| #define Y00 0.28209479177387814347f /* 0.5 * sqrt(1/pi) */ |
| #define Y10 0.48860251190291992159f /* sqrt(3/4pi) * z */ |
| #define Y11 0.48860251190291992159f /* -sqrt(3/4pi) * x */ |
| #define Y1n1 0.48860251190291992159f /* -sqrt(3/4pi) * y */ |
| #define Y20 0.31539156525251999825f /* 0.25 * sqrt(5/pi) * (3z^2 - 1) */ |
| #define Y21 1.09254843059207907054f /* -0.5 * sqrt(15/pi) * xz */ |
| #define Y22 0.54627421529603953527f /* 0.25 * sqrt(15/pi) * (x^2 - y^2) */ |
| #define Y2n1 1.09254843059207907054f /* -0.5 * sqrt(15/pi) * yz */ |
| #define Y2n2 1.09254843059207907054f /* 0.5 * sqrt(15/pi) * xy */ |
| void sh_eval_irradiance | ( | const vec3 | normal, |
| const SH9 * | sh_ptr, | ||
| vec3 | out_color | ||
| ) |
Evaluates the irradiance from SH coefficients in a given direction.
| normal | Normalized surface normal. |
| sh_ptr | Pointer to the SH structure. |
| out_color | Output color (vec3). |
| void sh_project_directional | ( | const vec3 | dir, |
| const vec3 | color, | ||
| SH9 * | out_sh | ||
| ) |
Projects a directional light into SH coefficients.
| dir | Normalized direction vector pointing TOWARDS the light source. |
| color | Linear RGB color/intensity of the light. |
| out_sh | Pointer to the SH structure to accumulate into. |
| void sh_zero | ( | SH9 * | sh_ptr | ) |
Initialize SH coefficients to zero.