R2 Core Shaders

R2StencilSingle.vert
Go to the documentation of this file.
1 /// \file R2StencilSingle.vert
2 /// \brief Single-instance stencil vertex shader.
3
4 layout(location = 0) in vec3 R2_vertex_position; // Object-space position
5
6 /// Parameters for stencil instances
7
8 struct R2_stencil_parameters_t {
9 /// Object-space to Eye-space matrix
10 mat4x4 transform_modelview;
11 /// Eye-space to Clip-space matrix
12 mat4x4 transform_projection;
13 };
14
15 uniform R2_stencil_parameters_t R2_stencil_parameters;
16
17 void
18 main (void)
19 {
20 vec4 position_hom =
21 vec4 (R2_vertex_position, 1.0);
22 vec4 position_eye =
23 (R2_stencil_parameters.transform_modelview * position_hom);
24 vec4 position_clip =
25 ((R2_stencil_parameters.transform_projection * R2_stencil_parameters.transform_modelview) * position_hom);
26
27 gl_Position = position_clip;
28 }
layout
layout(location=0) in vec3 R2_vertex_world_position
World-space position.
R2_stencil_parameters_t::transform_modelview
mat4x4 transform_modelview
Object-space to Eye-space matrix.
Definition: R2StencilSingle.vert:10
R2_stencil_parameters_t::transform_projection
mat4x4 transform_projection
Eye-space to Clip-space matrix.
Definition: R2StencilSingle.vert:12
R2_stencil_parameters_t
Parameters for stencil instances.
Definition: R2StencilSingle.vert:8