R2 Core Shaders

R2Billboarded.vert
Go to the documentation of this file.
1 /// \file R2Billboarded.vert
2 /// \brief A vertex shader for billboarded 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 /// Eye-space scale
11 layout(location = 1) in float R2_vertex_scale;
12
13 uniform R2_view_t R2_view;
14
15 out vec4 R2_billboard_scale_eye;
16
17 void
18 main (void)
19 {
20 vec4 scale =
21 vec4 (R2_vertex_scale, R2_vertex_scale, R2_vertex_scale, 1.0);
22
23 vec4 position_hom =
24 vec4 (R2_vertex_world_position, 1.0);
25 vec4 position_eye =
26 R2_view.transform_view * position_hom;
27
28 gl_Position = position_eye;
29 R2_billboard_scale_eye = scale;
30 }
layout
layout(location=0) in vec3 R2_vertex_world_position
World-space position.
R2View.h
Types relating to the view.
R2LogDepth.h
Logarithmic depth functions.
R2_view_t
Matrices and parameters related to the view that all surface shaders will receive.
Definition: R2View.h:9