R2 Shaders
src
main
glsl
com
io7m
r2
shaders
sources
R2LightDirectionalSpecular.h
Go to the documentation of this file.
1
#ifndef R2_LIGHT_DIRECTIONAL_SPECULAR_H
2
#define R2_LIGHT_DIRECTIONAL_SPECULAR_H
3
4
/// \file R2LightDirectionalSpecular.h
5
/// \brief A trivial directional light with Phong specular highlights
6
7
#include "
R2LightShaderMain.h
"
8
#include "
R2LightDirectional.h
"
9
10
uniform
R2_light_directional_t
R2_light_directional;
11
12
R2_light_output_t
13
R2_deferredLightMain
(
14
const
R2_reconstructed_surface_t
surface)
15
{
16
R2_light_directional_vectors_t
vectors =
17
R2_lightDirectionalVectors
(
18
R2_light_directional, surface.
position
.xyz, surface.
normal
);
19
20
vec3 diffuse =
21
R2_lightDirectionalDiffuseTerm
(R2_light_directional, vectors);
22
23
vec3 specular =
24
R2_lightDirectionalSpecularTerm
(
25
R2_light_directional,
26
vectors,
27
surface.
specular
,
28
surface.
specular_exponent
);
29
30
return
R2_light_output_t
(diffuse, specular);
31
}
32
33
#endif // R2_LIGHT_DIRECTIONAL_SPECULAR_H
R2_lightDirectionalDiffuseTerm
vec3 R2_lightDirectionalDiffuseTerm(const R2_light_directional_t light, const R2_light_directional_vectors_t v)
Definition:
R2LightDirectional.h:59
R2_deferredLightMain
R2_light_output_t R2_deferredLightMain(const R2_reconstructed_surface_t surface)
Definition:
R2LightDirectionalSpecular.h:13
R2LightDirectional.h
Functions and types related to directional lighting.
R2_reconstructed_surface_t::position
vec4 position
The eye-space position of the surface.
Definition:
R2ReconstructedSurface.h:30
R2_light_directional_vectors_t
Vectors used when calculating directional lighting.
Definition:
R2LightDirectional.h:9
R2_reconstructed_surface_t::specular_exponent
float specular_exponent
The sampled surface specular exponent in the range [0, 256]
Definition:
R2ReconstructedSurface.h:25
R2_reconstructed_surface_t
Reconstructed surface data, taken from the G-Buffer.
Definition:
R2ReconstructedSurface.h:16
R2_reconstructed_surface_t::normal
vec3 normal
The eye-space normal vector of the surface.
Definition:
R2ReconstructedSurface.h:28
R2LightShaderMain.h
The main function that all deferred light shaders must implement.
R2_reconstructed_surface_t::specular
vec3 specular
The sampled surface specular color.
Definition:
R2ReconstructedSurface.h:23
R2_lightDirectionalSpecularTerm
vec3 R2_lightDirectionalSpecularTerm(const R2_light_directional_t light, const R2_light_directional_vectors_t v, const vec3 specular_color, const float specular_exponent)
Definition:
R2LightDirectional.h:77
R2_light_directional_t
A directional light type.
Definition:
R2LightDirectional.h:22
R2_light_output_t
The type of light values that all deferred light shaders calculate.
Definition:
R2LightOutput.h:9
R2_lightDirectionalVectors
R2_light_directional_vectors_t R2_lightDirectionalVectors(const R2_light_directional_t light, const vec3 p, const vec3 n)
Definition:
R2LightDirectional.h:40
Generated by
1.8.12