Cogs.Rendering
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Public Attributes | List of all members
Cogs::DepthStencilState Struct Reference

Encapsulates state for depth buffer usage and stencil buffer usage in a state object. More...

#include <DepthStencilState.h>

Public Types

enum  DepthFunction {
  Never = 0 , Less , LessOrEqual , Equal ,
  GreaterOrEqual , Greater , NotEqual , Always
}
 Depth functions to apply when determining object visibility based on its depth test. More...
 

Static Public Member Functions

static DepthStencilState DefaultState ()
 Constructs a depth stencil state object initialized with the default values.
 

Public Attributes

bool depthEnabled
 If depth testing is enabled/disabled. Default is true.
 
bool writeEnabled
 If writes to the depth buffer are enabled/disabled. Default is true.
 
DepthFunction depthFunction
 The depth function to use for depth testing.
 

Detailed Description

Encapsulates state for depth buffer usage and stencil buffer usage in a state object.

This can be used to control how objects being drawn affect the contents of depth/stencil buffers, and which rules to apply when figuring out if an object should be drawn based on its depth values.

Member Enumeration Documentation

◆ DepthFunction

Depth functions to apply when determining object visibility based on its depth test.

Example: Object A is rendered at depth 0.5 The depth function is set to Greater Object B is rendered at depth 0.6 Visibility = depth(B) Greater depth(A) = True

Enumerator
Never 

Never evaluates to true. When using this, all objects will fail depth testing.

Less 

Less depth.

LessOrEqual 

Less or equal depth.

Equal 

Equal depth.

GreaterOrEqual 

Greater or equal depth.

Greater 

Greater depth.

NotEqual 

Depth not equal evaluates to true.

Always 

Always evaluates to true.

Member Function Documentation

◆ DefaultState()

static DepthStencilState Cogs::DepthStencilState::DefaultState ( )
inlinestatic

Constructs a depth stencil state object initialized with the default values.

References Less.

Member Data Documentation

◆ depthEnabled

bool Cogs::DepthStencilState::depthEnabled

If depth testing is enabled/disabled. Default is true.

Referenced by std::hash< Cogs::DepthStencilState >::operator()(), and std::equal_to< Cogs::DepthStencilState >::operator()().

◆ depthFunction

DepthFunction Cogs::DepthStencilState::depthFunction

The depth function to use for depth testing.

The depth of an object being drawn is compared to the contents of the depth buffer using this function. If the result of the depth test is true, the object is sent to the rasterization state, else no rasterization is performed.

Referenced by std::hash< Cogs::DepthStencilState >::operator()(), and std::equal_to< Cogs::DepthStencilState >::operator()().

◆ writeEnabled

bool Cogs::DepthStencilState::writeEnabled

If writes to the depth buffer are enabled/disabled. Default is true.

Referenced by std::hash< Cogs::DepthStencilState >::operator()(), and std::equal_to< Cogs::DepthStencilState >::operator()().


The documentation for this struct was generated from the following file: