R2 Shaders
Functions
R2DepthShaderMain.h File Reference

The main function that all depth shaders must implement. More...

#include "R2SurfaceTypes.h"
#include "R2View.h"
Include dependency graph for R2DepthShaderMain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool R2_depthShaderMain (const R2_vertex_data_t data, const R2_view_t view, const R2_surface_matrices_instance_t matrices_instance)
 

Detailed Description

The main function that all depth shaders must implement.

Definition in file R2DepthShaderMain.h.

Function Documentation

§ R2_depthShaderMain()

bool R2_depthShaderMain ( const R2_vertex_data_t  data,
const R2_view_t  view,
const R2_surface_matrices_instance_t  matrices_instance 
)

Calculate surface values for the current surface. Implementations of this function are expected to calculate a description of the current surface and then return true if the surface fragment should not be discarded.

Parameters
dataSurface data (typically coming from a vertex)
derivedSurface data calculated from the original vertex
viewMatrices and parameters related to the current view
matrices_instanceMatrices related to the instance to which this surface belongs
Returns
true iff the depth value should not be discarded

Definition at line 13 of file R2DepthBasic.h.

17 {
18  vec4 surface = texture (R2_texture_albedo, data.uv);
19  return surface.w < R2_alpha_discard_threshold;
20 }
vec2 uv
Object-space UV.