R2 Core Shaders

R2LightAmbientSingle.vert
Go to the documentation of this file.
1 /// \file R2LightAmbientSingle.vert
2 /// \brief A vertex shader for full-screen single-instance ambient lights
3
4 #include "R2LogDepth.h"
5 #include "R2LightVertex.h"
6 #include "R2LightMatrices.h"
7
8 uniform float R2_light_depth_coefficient;
9 uniform R2_light_matrices_t R2_light_matrices;
10
11 out float R2_light_volume_positive_eye_z;
12
13 void
14 main (void)
15 {
16 // The input vertices are assumed to be in clip-space already.
17 vec4 position_clip =
18 vec4 (R2_vertex_position, 1.0);
19 vec4 position_eye =
20 R2_light_matrices.transform_projection_inverse * position_clip;
21 vec4 position_clip_log =
22 vec4 (
23 position_clip.xy,
24 R2_logDepthEncodeFull (position_clip.w, R2_light_depth_coefficient),
25 position_clip.w);
26
27 R2_light_volume_positive_eye_z = R2_logDepthPrepareEyeZ (position_eye.z);
28 gl_Position = position_clip_log;
29 }
R2_logDepthEncodeFull
float R2_logDepthEncodeFull(const float z, const float depth_coefficient)
Definition: R2LogDepth.h:51
R2LightMatrices.h
Matrices required by standard light types.
R2LightVertex.h
Data required by each vertex in deferred light rendering, provided as vertex attributes.
R2_light_matrices_t
Input matrices for light volumes.
Definition: R2LightMatrices.h:9
R2_light_matrices_t::transform_projection_inverse
mat4x4 transform_projection_inverse
Clip-space to eye-space matrix.
Definition: R2LightMatrices.h:15
R2_logDepthPrepareEyeZ
float R2_logDepthPrepareEyeZ(const float z)
Definition: R2LogDepth.h:15
R2LogDepth.h
Logarithmic depth functions.