$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
sh_math.h File Reference
#include <cglm/cglm.h>
Include dependency graph for sh_math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SH9
 

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...
 

Function Documentation

◆ sh_eval_irradiance()

void sh_eval_irradiance ( const vec3  normal,
const SH9 sh_ptr,
vec3  out_color 
)

Evaluates the irradiance from SH coefficients in a given direction.

Parameters
normalNormalized surface normal.
sh_ptrPointer to the SH structure.
out_colorOutput color (vec3).

◆ sh_project_directional()

void sh_project_directional ( const vec3  dir,
const vec3  color,
SH9 out_sh 
)

Projects a directional light into SH coefficients.

Parameters
dirNormalized direction vector pointing TOWARDS the light source.
colorLinear RGB color/intensity of the light.
out_shPointer to the SH structure to accumulate into.

◆ sh_zero()

void sh_zero ( SH9 sh_ptr)

Initialize SH coefficients to zero.