R2 Core Shaders

R2MaskSingle.vert
Go to the documentation of this file.
1 /// \file R2MaskSingle.vert
2 /// \brief A vertex shader for masking single instances.
3
4 #include "R2LogDepth.h"
5 #include "R2SurfaceTypes.h"
6 #include "R2SurfaceVertex.h"
7 #include "R2View.h"
8 #include "R2Viewport.h"
9
10 uniform R2_view_t R2_view;
11 uniform mat4x4 R2_transform_modelview;
12
13 out float R2_positive_eye_z;
14
15 void
16 main (void)
17 {
18 vec4 position_hom =
19 vec4 (R2_vertex_position, 1.0);
20 vec4 position_eye =
21 R2_transform_modelview * position_hom;
22 vec4 position_clip =
23 ((R2_view.transform_projection * R2_transform_modelview) * position_hom);
24 vec4 position_clip_log =
25 vec4 (
26 position_clip.xy,
27 R2_logDepthEncodeFull (position_clip.w, R2_view.depth_coefficient),
28 position_clip.w);
29
30 R2_positive_eye_z = R2_logDepthPrepareEyeZ (position_eye.z);
31 gl_Position = position_clip_log;
32 }
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_view_t::transform_projection
mat4x4 transform_projection
Eye-space to Clip-space matrix.
Definition: R2View.h:15
R2Viewport.h
Viewport types and functions.
R2View.h
Types relating to the view.
R2SurfaceTypes.h
Types for deferred surface shading.
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