20typedef float (* C3D_LightLutFunc)(
float x,
float param);
21typedef float (* C3D_LightLutFuncDA)(
float dist,
float arg0,
float arg1);
23static inline float quadratic_dist_attn(
float dist,
float linear,
float quad)
25 return 1.0f / (1.0f + linear*dist + quad*dist*dist);
28static inline float spot_step(
float angle,
float cutoff)
30 return angle >= cutoff ? 1.0f : 0.0f;
65#define LightLut_Phong(lut, shininess) LightLut_FromFunc((lut), powf, (shininess), false)
72#define LightLut_Spotlight(lut, angle) LightLut_FromFunc((lut), spot_step, cosf(angle), true)
82#define LightLutDA_Quadratic(lut, from, to, linear, quad) LightLutDA_Create((lut), quadratic_dist_attn, (from), (to), (linear), (quad))
void LightLut_FromFunc(C3D_LightLut *lut, C3D_LightLutFunc func, float param, bool negative)
Generates lighting lookup table using specified callback function.
void LightLut_FromArray(C3D_LightLut *lut, float *data)
Generates lighting lookup table from pre-computed float array.
void LightLutDA_Create(C3D_LightLutDA *lut, C3D_LightLutFuncDA func, float from, float to, float arg0, float arg1)
Generates distance attenuation lookup table using specified callback function.