R2 Shaders
Functions | Variables
R2LightDirectionalSpecular.h File Reference

A trivial directional light with Phong specular highlights. More...

#include "R2LightShaderMain.h"
#include "R2LightDirectional.h"
Include dependency graph for R2LightDirectionalSpecular.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

R2_light_output_t R2_deferredLightMain (const R2_reconstructed_surface_t surface)
 

Variables

uniform R2_light_directional_t R2_light_directional
 

Detailed Description

A trivial directional light with Phong specular highlights.

Definition in file R2LightDirectionalSpecular.h.

Function Documentation

§ R2_deferredLightMain()

R2_light_output_t R2_deferredLightMain ( const R2_reconstructed_surface_t  surface)

Calculate light values for the current light, based on the current contents of the G-buffer.

Parameters
surfaceReconstructed surface data taken from the G-Buffer
Returns
Calculated light values

Definition at line 13 of file R2LightDirectionalSpecular.h.

15 {
18  R2_light_directional, surface.position.xyz, surface.normal);
19 
20  vec3 diffuse =
21  R2_lightDirectionalDiffuseTerm (R2_light_directional, vectors);
22 
23  vec3 specular =
25  R2_light_directional,
26  vectors,
27  surface.specular,
28  surface.specular_exponent);
29 
30  return R2_light_output_t (diffuse, specular);
31 }
vec3 R2_lightDirectionalDiffuseTerm(const R2_light_directional_t light, const R2_light_directional_vectors_t v)
vec4 position
The eye-space position of the surface.
Vectors used when calculating directional lighting.
float specular_exponent
The sampled surface specular exponent in the range [0, 256]
vec3 normal
The eye-space normal vector of the surface.
vec3 specular
The sampled surface specular color.
vec3 R2_lightDirectionalSpecularTerm(const R2_light_directional_t light, const R2_light_directional_vectors_t v, const vec3 specular_color, const float specular_exponent)
The type of light values that all deferred light shaders calculate.
Definition: R2LightOutput.h:9
R2_light_directional_vectors_t R2_lightDirectionalVectors(const R2_light_directional_t light, const vec3 p, const vec3 n)