R2 Shaders
src
main
glsl
com
io7m
r2
shaders
sources
R2LightSphericalLambert.h
Go to the documentation of this file.
1
#ifndef R2_LIGHT_SPHERICAL_LAMBERT_H
2
#define R2_LIGHT_SPHERICAL_LAMBERT_H
3
4
/// \file R2LightSphericalLambert.h
5
/// \brief A spherical light with no specular highlights
6
7
#include "
R2LightShaderMain.h
"
8
#include "
R2LightPositional.h
"
9
#include "
R2LightSpherical.h
"
10
11
uniform
R2_light_positional_t
R2_light_spherical;
12
13
R2_light_output_t
14
R2_deferredLightMain
(
15
const
R2_reconstructed_surface_t
surface)
16
{
17
R2_light_positional_vectors_t
vectors =
R2_lightPositionalVectors
(
18
R2_light_spherical, surface.
position
.xyz, surface.
normal
);
19
float
attenuation =
R2_lightPositionalAttenuation
(
20
R2_light_spherical, vectors.
distance
);
21
22
vec3 diffuse =
23
R2_lightSphericalDiffuseLambertTerm
(R2_light_spherical, vectors);
24
25
return
R2_light_output_t
(
26
diffuse * attenuation, vec3 (0.0));
27
}
28
29
#endif // R2_LIGHT_SPHERICAL_LAMBERT_H
R2_lightPositionalAttenuation
float R2_lightPositionalAttenuation(const R2_light_positional_t light, const float distance)
Definition:
R2LightPositional.h:78
R2_light_positional_vectors_t
Vectors used when calculating positional lighting.
Definition:
R2LightPositional.h:9
R2_deferredLightMain
R2_light_output_t R2_deferredLightMain(const R2_reconstructed_surface_t surface)
Definition:
R2LightSphericalLambert.h:14
R2_reconstructed_surface_t::position
vec4 position
The eye-space position of the surface.
Definition:
R2ReconstructedSurface.h:30
R2_lightSphericalDiffuseLambertTerm
vec3 R2_lightSphericalDiffuseLambertTerm(const R2_light_positional_t light, const R2_light_positional_vectors_t v)
Definition:
R2LightSpherical.h:17
R2_reconstructed_surface_t
Reconstructed surface data, taken from the G-Buffer.
Definition:
R2ReconstructedSurface.h:16
R2_light_positional_vectors_t::distance
float distance
The distance between the surface and light source.
Definition:
R2LightPositional.h:19
R2_light_positional_t
A positional light type.
Definition:
R2LightPositional.h:24
R2_reconstructed_surface_t::normal
vec3 normal
The eye-space normal vector of the surface.
Definition:
R2ReconstructedSurface.h:28
R2_lightPositionalVectors
R2_light_positional_vectors_t R2_lightPositionalVectors(const R2_light_positional_t light, const vec3 p, const vec3 n)
Definition:
R2LightPositional.h:46
R2LightShaderMain.h
The main function that all deferred light shaders must implement.
R2LightSpherical.h
Functions and types related to spherical lighting.
R2LightPositional.h
Functions and types related to positional lighting.
R2_light_output_t
The type of light values that all deferred light shaders calculate.
Definition:
R2LightOutput.h:9
Generated by
1.8.12