R2 Shaders
R2DebugColorVerticesWorldPosition.vert
1 /// \file R2DebugWorldPositionColorVertices.vert
2 /// \brief A vertex shader for single instances.
3 
4 #include "R2LogDepth.h"
5 #include "R2View.h"
6 
7 /// World-space position
8 layout(location = 0) in vec3 R2_vertex_world_position;
9 
10 /// RGBA color
11 layout(location = 1) in vec4 R2_vertex_color;
12 
13 out vec4 R2_frag_color;
14 out float R2_positive_eye_z;
15 
16 uniform R2_view_t R2_view;
17 
18 void
19 main (void)
20 {
21  vec4 position_hom =
22  vec4 (R2_vertex_world_position, 1.0);
23  vec4 position_eye =
24  R2_view.transform_view * position_hom;
25  vec4 position_clip =
26  R2_view.transform_projection * position_eye;
27  vec4 position_clip_log =
28  vec4 (
29  position_clip.xy,
30  R2_logDepthEncodeFull (position_clip.w, R2_view.depth_coefficient),
31  position_clip.w);
32 
33  R2_frag_color = R2_vertex_color;
34  R2_positive_eye_z = R2_logDepthPrepareEyeZ (position_eye.z);
35  gl_Position = position_clip_log;
36 }
float R2_logDepthEncodeFull(const float z, const float depth_coefficient)
Definition: R2LogDepth.h:51
Types relating to the view.
float R2_logDepthPrepareEyeZ(const float z)
Definition: R2LogDepth.h:15
Logarithmic depth functions.
layout(location=0) out vec4 R2_out
RGBA color.
Matrices and parameters related to the view that all surface shaders will receive.
Definition: R2View.h:9