R2 Core Shaders

R2DebugVisualConstantScreen.vert
Go to the documentation of this file.
1 /// \file R2DebugVisualConstantScreen.vert
2 /// \brief A vertex shader for full-screen debug geometry
3
4 #include "R2LogDepth.h"
5 #include "R2Normals.h"
6 #include "R2SurfaceTypes.h"
7 #include "R2SurfaceVertex.h"
8 #include "R2View.h"
9
10 uniform R2_view_t R2_view;
11 uniform mat4x4 R2_transform_projection_inverse;
12
13 out R2_vertex_data_t R2_vertex_data;
14
15 void
16 main (void)
17 {
18 // The input vertices are assumed to be in clip-space already.
19 vec4 position_clip =
20 vec4 (R2_vertex_position, 1.0);
21 vec4 position_eye =
22 R2_transform_projection_inverse * position_clip;
23 vec4 position_clip_log =
24 vec4 (
25 position_clip.xy,
26 R2_logDepthEncodeFull (position_clip.w, R2_view.depth_coefficient),
27 position_clip.w);
28
29 vec4 tangent4 = R2_vertex_tangent4;
30 vec3 tangent = tangent4.xyz;
31 vec3 normal = R2_vertex_normal;
32 vec3 bitangent = R2_normalsBitangent (normal, tangent4);
33
34 float positive_eye_z =
35 R2_logDepthPrepareEyeZ (position_eye.z);
36
37 R2_vertex_data = R2_vertex_data_t (
38 position_eye,
39 position_clip,
40 positive_eye_z,
41 R2_vertex_uv,
42 normal,
43 tangent,
44 bitangent
45 );
46
47 gl_Position = position_clip_log;
48 }
R2SurfaceVertex.h
Data required by each vertex in deferred rendering, provided as vertex attributes.
R2_logDepthEncodeFull
float R2_logDepthEncodeFull(const float z, const float depth_coefficient)
Definition: R2LogDepth.h:51
R2_normalsBitangent
vec3 R2_normalsBitangent(const vec3 n, const vec4 t)
Definition: R2Normals.h:58
R2Normals.h
Functions for transforming normal vectors.
R2View.h
Types relating to the view.
R2SurfaceTypes.h
Types for deferred surface shading.
R2_vertex_data_t
Interpolated vertex data that all deferred surface shaders will receive.
Definition: R2SurfaceTypes.h:11
R2_logDepthPrepareEyeZ
float R2_logDepthPrepareEyeZ(const float z)
Definition: R2LogDepth.h:15
R2LogDepth.h
Logarithmic depth functions.
R2_view_t::depth_coefficient
float depth_coefficient
The scene&#39;s logarithmic depth coefficient.
Definition: R2View.h:11
R2_view_t
Matrices and parameters related to the view that all surface shaders will receive.
Definition: R2View.h:9