1 #ifndef R2_LIGHT_POSITIONAL_H 2 #define R2_LIGHT_POSITIONAL_H 51 vec3 position_diff = p - light.
position;
55 float distance = length (position_diff);
84 return 1.0 - clamp (exponential, 0.0, 1.0);
87 #endif // R2_LIGHT_POSITIONAL_H vec3 color
The light color. The components are assumed to be in the range [0, 1].
float R2_lightPositionalAttenuation(const R2_light_positional_t light, const float distance)
Vectors used when calculating positional lighting.
vec3 surface_to_light
Direction from surface to light source (referred to as L in most texts)
float inverse_falloff
The inverse falloff value (1.0 / falloff).
float intensity
The light intensity.
float inverse_range
The inverse light range (1.0 / range).
float distance
The distance between the surface and light source.
R2_light_positional_vectors_t R2_lightPositionalVectors(const R2_light_positional_t light, const vec3 p, const vec3 n)
vec3 light_to_surface
Direction from light source to surface (referred to as -L in most texts)
vec3 observer_to_surface
Direction from observer to surface (referred to as V in most texts)
vec3 normal
The surface normal (referred to as N in most texts)
vec3 position
The eye-space light position.