R2 Core Shaders

R2DepthBasic.h
Go to the documentation of this file.
1 #ifndef R2_DEPTH_BASIC_H
2 #define R2_DEPTH_BASIC_H
3
4 /// \file R2DepthBasic.h
5 /// \brief Basic depth-only implementation that discards fragments based on the opacity of an albedo texture and a threshold value
6
7 #include "R2DepthShaderMain.h"
8
9 uniform sampler2D R2_texture_albedo;
10 uniform float R2_alpha_discard_threshold;
11
12 bool
13 R2_depthShaderMain (
14 const R2_vertex_data_t data,
15 const R2_view_t view,
16 const R2_surface_matrices_instance_t matrices_instance)
17 {
18 vec4 surface = texture (R2_texture_albedo, data.uv);
19 return surface.w < R2_alpha_discard_threshold;
20 }
21
22 #endif // R2_DEPTH_BASIC_H
R2_vertex_data_t::uv
vec2 uv
Object-space UV.
Definition: R2SurfaceTypes.h:19
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: R2DepthBasic.h:13
R2DepthShaderMain.h
The main function that all depth shaders must implement.
R2_vertex_data_t
Interpolated vertex data that all deferred surface shaders will receive.
Definition: R2SurfaceTypes.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