R2 Shaders
Data Structures | Functions
R2LightAmbient.h File Reference

Functions and types related to ambient lighting. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  R2_light_ambient_t
 A ambient light type. More...
 

Functions

vec3 R2_lightAmbientTerm (const R2_light_ambient_t light, const vec2 uv)
 

Detailed Description

Functions and types related to ambient lighting.

Definition in file R2LightAmbient.h.

Function Documentation

§ R2_lightAmbientTerm()

vec3 R2_lightAmbientTerm ( const R2_light_ambient_t  light,
const vec2  uv 
)

Calculate the "diffuse" term for a ambient light. "Diffuse" in this case appears to be slight misnomer, because the light is supposed to be providing an ambient term. However, the R2 package treats ambient light as simply low intensity non-directional diffuse light.

Parameters
lightThe light parameters
uvThe screen position in UV coordinates (used for sampling from the occlusion map)
Returns
The diffuse term

Definition at line 29 of file R2LightAmbient.h.

32 {
33  float occ = texture (light.occlusion, uv).x;
34  return light.color * (light.intensity * occ);
35 }
vec3 color
The light color. The components are assumed to be in the range [0, 1].
sampler2D occlusion
The occlusion map.
float intensity
The light intensity.