R2 Core Shaders

R2MaskBatched.vert
Go to the documentation of this file.
1 /// \file R2MaskBatched.vert
2 /// \brief A vertex shader for masking batched instances.
3
4 #include "R2LogDepth.h"
5 #include "R2SurfaceTypes.h"
6 #include "R2SurfaceVertexBatched.h"
7 #include "R2View.h"
8
9 uniform R2_view_t R2_view;
10
11 out float R2_positive_eye_z;
12
13 void
14 main (void)
15 {
16 mat4x4 m_modelview =
17 (R2_view.transform_view * R2_vertex_transform_model);
18
19 vec4 position_hom =
20 vec4 (R2_vertex_position, 1.0);
21 vec4 position_eye =
22 (m_modelview * position_hom);
23 vec4 position_clip =
24 ((R2_view.transform_projection * m_modelview) * position_hom);
25 vec4 position_clip_log =
26 vec4 (
27 position_clip.xy,
28 R2_logDepthEncodeFull (position_clip.w, R2_view.depth_coefficient),
29 position_clip.w);
30
31 R2_positive_eye_z = R2_logDepthPrepareEyeZ (position_eye.z);
32 gl_Position = position_clip_log;
33 }
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
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.
R2SurfaceVertexBatched.h
Data delivered via vertex attributes to batched instances in deferred rendering.
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
R2_view_t::transform_view
mat4x4 transform_view
World-space to Eye-space matrix.
Definition: R2View.h:13