R2 Core Shaders

R2DepthBasicStippled.h
Go to the documentation of this file.
1 #ifndef R2_DEPTH_BASIC_STIPPLED_H
2 #define R2_DEPTH_BASIC_STIPPLED_H
3
4 /// \file R2DepthBasicStippled.h
5 /// \brief Basic depth-only implementation that discards fragments based on the opacity of an albedo texture, a threshold value, and stippling
6
7 #include "R2DepthShaderMain.h"
8 #include "R2Viewport.h"
9 #include "R2Stipple.h"
10
11 uniform sampler2D R2_texture_albedo;
12 uniform float R2_alpha_discard_threshold;
13
14 uniform R2_stipple_t R2_stipple;
15 uniform R2_viewport_t R2_viewport;
16
17 bool
18 R2_depthShaderMain (
19 const R2_vertex_data_t data,
20 const R2_view_t view,
21 const R2_surface_matrices_instance_t matrices_instance)
22 {
23 vec4 surface = texture (R2_texture_albedo, data.uv);
24
25 return R2_stippleRun(R2_stipple, R2_viewport, gl_FragCoord.xy)
26 || surface.w < R2_alpha_discard_threshold;
27 }
28
29 #endif // R2_DEPTH_BASIC_STIPPLED_H
R2_vertex_data_t::uv
vec2 uv
Object-space UV.
Definition: R2SurfaceTypes.h:19
R2Stipple.h
Stippling types and functions.
R2Viewport.h
Viewport types and functions.
R2_viewport_t
The type of viewports.
Definition: R2Viewport.h:9
R2DepthShaderMain.h
The main function that all depth shaders must implement.
R2_depthShaderMain
bool R2_depthShaderMain(const R2_vertex_data_t data, const R2_view_t view, const R2_surface_matrices_instance_t matrices_instance)
Definition: R2DepthBasicStippled.h:18
R2_vertex_data_t
Interpolated vertex data that all deferred surface shaders will receive.
Definition: R2SurfaceTypes.h:11
R2_stipple_t
The type of stippling parameters.
Definition: R2Stipple.h:11
R2_surface_matrices_instance_t
Matrices related to the rendered instance that all deferred surface shaders will receive.
Definition: R2SurfaceTypes.h:44
R2_view_t
Matrices and parameters related to the view that all surface shaders will receive.
Definition: R2View.h:9