Castor3D  ..
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Castor3D::DepthStencilState Class Referenceabstract

Depth and stencil buffers configurations class. More...

+ Inheritance diagram for Castor3D::DepthStencilState:
+ Collaboration diagram for Castor3D::DepthStencilState:

Classes

struct  stSTENCIL
 Stencil function and operations description. More...
 

Public Member Functions

C3D_API DepthStencilState (Engine &p_engine)
 Constructor. More...
 
virtual C3D_API ~DepthStencilState ()
 Destructor. More...
 
virtual C3D_API bool Initialise ()=0
 Initialises the states. More...
 
virtual C3D_API void Cleanup ()=0
 Cleans the states. More...
 
virtual C3D_API bool Apply ()=0
 Applies the states. More...
 
void SetDepthTest (bool p_enable)
 Defines the depth test status. More...
 
bool GetDepthTest () const
 Retrieves the depth test status. More...
 
void SetDepthFunc (eDEPTH_FUNC p_func)
 Defines the depth function. More...
 
eDEPTH_FUNC GetDepthFunc () const
 Retrieves the depth function. More...
 
void SetDepthRange (double p_near, double p_far)
 Defines the depth range. More...
 
double GetDepthNear () const
 Retrieves the depth near value. More...
 
double GetDepthFar () const
 Retrieves the depth far value. More...
 
void SetDepthMask (eWRITING_MASK p_eMask)
 Defines the depth writing mask. More...
 
eWRITING_MASK GetDepthMask () const
 Retrieves the depth writing mask. More...
 
void SetStencilTest (bool p_enable)
 Defines the stencil test status. More...
 
bool GetStencilTest () const
 Retrieves the stencil test status. More...
 
void SetStencilReadMask (uint32_t p_uiMask)
 Defines the stencil read mask. More...
 
uint32_t GetStencilReadMask () const
 Retrieves the stencil read mask. More...
 
void SetStencilWriteMask (uint32_t p_uiMask)
 Defines the stencil write mask. More...
 
uint32_t GetStencilWriteMask () const
 Retrieves the stencil write mask. More...
 
void SetStencilFrontRef (uint32_t p_ref)
 Defines the stencil reference value for front faces. More...
 
uint32_t GetStencilFrontRef () const
 Retrieves the stencil reference value for front faces. More...
 
void SetStencilFrontFunc (eSTENCIL_FUNC p_func)
 Defines the stencil function for front faces. More...
 
eSTENCIL_FUNC GetStencilFrontFunc () const
 Retrieves the stencil function for front faces. More...
 
void SetStencilFrontFailOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil test failed, for front faces. More...
 
eSTENCIL_OP GetStencilFrontFailOp () const
 Retrieves the operation when stencil test failed, for front faces. More...
 
void SetStencilFrontDepthFailOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil test passes but depth test failed, for front faces. More...
 
eSTENCIL_OP GetStencilFrontDepthFailOp () const
 Retrieves the operation when stencil test passes but depth test failed, for front faces. More...
 
void SetStencilFrontPassOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil stencil and depth tests passed, for front faces. More...
 
eSTENCIL_OP GetStencilFrontPassOp () const
 Retrieves the operation when stencil and depth tests passed, for front faces. More...
 
void SetStencilBackRef (uint32_t p_ref)
 Defines the stencil reference value for back faces. More...
 
uint32_t GetStencilBackRef () const
 Retrieves the stencil reference value for back faces. More...
 
void SetStencilBackFunc (eSTENCIL_FUNC p_func)
 Defines the stencil function for front back. More...
 
eSTENCIL_FUNC GetStencilBackFunc () const
 Retrieves the stencil function for back faces. More...
 
void SetStencilBackFailOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil test failed, for back faces. More...
 
eSTENCIL_OP GetStencilBackFailOp () const
 Retrieves the operation when stencil test failed, for back faces. More...
 
void SetStencilBackDepthFailOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil test passes but depth test failed, for back faces. More...
 
eSTENCIL_OP GetStencilBackDepthFailOp () const
 Retrieves the operation when stencil test passes but depth test failed, for back faces. More...
 
void SetStencilBackPassOp (eSTENCIL_OP p_eOp)
 Defines the operation when stencil stencil and depth tests passed, for back faces. More...
 
eSTENCIL_OP GetStencilBackPassOp () const
 Retrieves the operation when stencil and depth tests passed, for back faces. More...
 

Protected Member Functions

C3D_API void CreateCurrent ()
 Creates the state used to save the current state. More...
 
C3D_API void DestroyCurrent ()
 Destroys the state used to save the current state. More...
 
virtual C3D_API DepthStencilStateSPtr DoCreateCurrent ()=0
 Creates the state used to save the current state. More...
 

Protected Attributes

bool m_changed
 Tells it has changed. More...
 
bool m_bDepthTest
 Tells whether the depth test is activated or not. More...
 
eDEPTH_FUNC m_eDepthFunc
 The depth test function. More...
 
double m_dDepthNear
 The near plane for depth test. More...
 
double m_dDepthFar
 The far plane for depth test. More...
 
eWRITING_MASK m_eDepthMask
 Depth writing mask. More...
 
bool m_bStencilTest
 Tells whether the stencil test is activated or not. More...
 
uint32_t m_uiStencilReadMask
 The stencil read mask. More...
 
uint32_t m_uiStencilWriteMask
 The stencil write mask. More...
 
stSTENCIL m_stStencilFront
 Front buffer stencil function. More...
 
stSTENCIL m_stStencilBack
 Back buffer stencil function. More...
 
DepthStencilStateSPtr m_currentState
 Shared_pointer to the internal global state, to use reference counting for this static member. More...
 

Static Protected Attributes

static DepthStencilStateWPtr m_wCurrentState
 The internal global state used to commit only the changed states. More...
 

Detailed Description

Depth and stencil buffers configurations class.

Author
Sylvain DOREMUS
Version
0.7.0
Date
02/06/2013

Constructor & Destructor Documentation

◆ DepthStencilState()

C3D_API Castor3D::DepthStencilState::DepthStencilState ( Engine p_engine)

Constructor.

Parameters
[in]p_engineThe engine.

◆ ~DepthStencilState()

virtual C3D_API Castor3D::DepthStencilState::~DepthStencilState ( )
virtual

Destructor.

Member Function Documentation

◆ Apply()

virtual C3D_API bool Castor3D::DepthStencilState::Apply ( )
pure virtual

Applies the states.

◆ Cleanup()

virtual C3D_API void Castor3D::DepthStencilState::Cleanup ( )
pure virtual

Cleans the states.

◆ CreateCurrent()

C3D_API void Castor3D::DepthStencilState::CreateCurrent ( )
protected

Creates the state used to save the current state.

◆ DestroyCurrent()

C3D_API void Castor3D::DepthStencilState::DestroyCurrent ( )
protected

Destroys the state used to save the current state.

◆ DoCreateCurrent()

virtual C3D_API DepthStencilStateSPtr Castor3D::DepthStencilState::DoCreateCurrent ( )
protectedpure virtual

Creates the state used to save the current state.

◆ GetDepthFar()

double Castor3D::DepthStencilState::GetDepthFar ( ) const
inline

Retrieves the depth far value.

Returns
The value

References m_dDepthFar.

◆ GetDepthFunc()

eDEPTH_FUNC Castor3D::DepthStencilState::GetDepthFunc ( ) const
inline

Retrieves the depth function.

Returns
The function

References m_eDepthFunc.

◆ GetDepthMask()

eWRITING_MASK Castor3D::DepthStencilState::GetDepthMask ( ) const
inline

Retrieves the depth writing mask.

Returns
The mask

References m_eDepthMask.

◆ GetDepthNear()

double Castor3D::DepthStencilState::GetDepthNear ( ) const
inline

Retrieves the depth near value.

Returns
The value

References m_dDepthNear.

◆ GetDepthTest()

bool Castor3D::DepthStencilState::GetDepthTest ( ) const
inline

Retrieves the depth test status.

Returns
The status

References m_bDepthTest.

◆ GetStencilBackDepthFailOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilBackDepthFailOp ( ) const
inline

Retrieves the operation when stencil test passes but depth test failed, for back faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_eDepthFailOp, and m_stStencilBack.

◆ GetStencilBackFailOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilBackFailOp ( ) const
inline

Retrieves the operation when stencil test failed, for back faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_eFailOp, and m_stStencilBack.

◆ GetStencilBackFunc()

eSTENCIL_FUNC Castor3D::DepthStencilState::GetStencilBackFunc ( ) const
inline

Retrieves the stencil function for back faces.

Returns
The function

References Castor3D::DepthStencilState::stSTENCIL::m_eFunc, and m_stStencilBack.

◆ GetStencilBackPassOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilBackPassOp ( ) const
inline

Retrieves the operation when stencil and depth tests passed, for back faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_ePassOp, and m_stStencilBack.

◆ GetStencilBackRef()

uint32_t Castor3D::DepthStencilState::GetStencilBackRef ( ) const
inline

Retrieves the stencil reference value for back faces.

Returns
The reference value

References Castor3D::DepthStencilState::stSTENCIL::m_ref, and m_stStencilBack.

◆ GetStencilFrontDepthFailOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilFrontDepthFailOp ( ) const
inline

Retrieves the operation when stencil test passes but depth test failed, for front faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_eDepthFailOp, and m_stStencilFront.

◆ GetStencilFrontFailOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilFrontFailOp ( ) const
inline

Retrieves the operation when stencil test failed, for front faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_eFailOp, and m_stStencilFront.

◆ GetStencilFrontFunc()

eSTENCIL_FUNC Castor3D::DepthStencilState::GetStencilFrontFunc ( ) const
inline

Retrieves the stencil function for front faces.

Returns
The function

References Castor3D::DepthStencilState::stSTENCIL::m_eFunc, and m_stStencilFront.

◆ GetStencilFrontPassOp()

eSTENCIL_OP Castor3D::DepthStencilState::GetStencilFrontPassOp ( ) const
inline

Retrieves the operation when stencil and depth tests passed, for front faces.

Returns
The operation

References Castor3D::DepthStencilState::stSTENCIL::m_ePassOp, and m_stStencilFront.

◆ GetStencilFrontRef()

uint32_t Castor3D::DepthStencilState::GetStencilFrontRef ( ) const
inline

Retrieves the stencil reference value for front faces.

Returns
The reference value

References Castor3D::DepthStencilState::stSTENCIL::m_ref, and m_stStencilFront.

◆ GetStencilReadMask()

uint32_t Castor3D::DepthStencilState::GetStencilReadMask ( ) const
inline

Retrieves the stencil read mask.

Returns
The mask

References m_uiStencilReadMask.

◆ GetStencilTest()

bool Castor3D::DepthStencilState::GetStencilTest ( ) const
inline

Retrieves the stencil test status.

Returns
The status

References m_bStencilTest.

◆ GetStencilWriteMask()

uint32_t Castor3D::DepthStencilState::GetStencilWriteMask ( ) const
inline

Retrieves the stencil write mask.

Returns
The mask

References m_uiStencilWriteMask.

◆ Initialise()

virtual C3D_API bool Castor3D::DepthStencilState::Initialise ( )
pure virtual

Initialises the states.

◆ SetDepthFunc()

void Castor3D::DepthStencilState::SetDepthFunc ( eDEPTH_FUNC  p_func)
inline

Defines the depth function.

Parameters
[in]p_funcThe function

References m_changed, and m_eDepthFunc.

◆ SetDepthMask()

void Castor3D::DepthStencilState::SetDepthMask ( eWRITING_MASK  p_eMask)
inline

Defines the depth writing mask.

Parameters
[in]p_eMaskThe mask

References m_changed, and m_eDepthMask.

◆ SetDepthRange()

void Castor3D::DepthStencilState::SetDepthRange ( double  p_near,
double  p_far 
)
inline

Defines the depth range.

Parameters
[in]p_nearThe near bound
[in]p_farThe far bound

References m_changed, m_dDepthFar, and m_dDepthNear.

◆ SetDepthTest()

void Castor3D::DepthStencilState::SetDepthTest ( bool  p_enable)
inline

Defines the depth test status.

Parameters
[in]p_enableThe new status

References m_bDepthTest, and m_changed.

◆ SetStencilBackDepthFailOp()

void Castor3D::DepthStencilState::SetStencilBackDepthFailOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil test passes but depth test failed, for back faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eDepthFailOp, and m_stStencilBack.

◆ SetStencilBackFailOp()

void Castor3D::DepthStencilState::SetStencilBackFailOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil test failed, for back faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eFailOp, and m_stStencilBack.

◆ SetStencilBackFunc()

void Castor3D::DepthStencilState::SetStencilBackFunc ( eSTENCIL_FUNC  p_func)
inline

Defines the stencil function for front back.

Parameters
[in]p_funcThe function

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eFunc, and m_stStencilBack.

◆ SetStencilBackPassOp()

void Castor3D::DepthStencilState::SetStencilBackPassOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil stencil and depth tests passed, for back faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_ePassOp, and m_stStencilBack.

◆ SetStencilBackRef()

void Castor3D::DepthStencilState::SetStencilBackRef ( uint32_t  p_ref)
inline

Defines the stencil reference value for back faces.

Parameters
[in]p_refThe reference value

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_ref, and m_stStencilBack.

◆ SetStencilFrontDepthFailOp()

void Castor3D::DepthStencilState::SetStencilFrontDepthFailOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil test passes but depth test failed, for front faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eDepthFailOp, and m_stStencilFront.

◆ SetStencilFrontFailOp()

void Castor3D::DepthStencilState::SetStencilFrontFailOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil test failed, for front faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eFailOp, and m_stStencilFront.

◆ SetStencilFrontFunc()

void Castor3D::DepthStencilState::SetStencilFrontFunc ( eSTENCIL_FUNC  p_func)
inline

Defines the stencil function for front faces.

Parameters
[in]p_funcThe function

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_eFunc, and m_stStencilFront.

◆ SetStencilFrontPassOp()

void Castor3D::DepthStencilState::SetStencilFrontPassOp ( eSTENCIL_OP  p_eOp)
inline

Defines the operation when stencil stencil and depth tests passed, for front faces.

Parameters
[in]p_eOpThe operation

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_ePassOp, and m_stStencilFront.

◆ SetStencilFrontRef()

void Castor3D::DepthStencilState::SetStencilFrontRef ( uint32_t  p_ref)
inline

Defines the stencil reference value for front faces.

Parameters
[in]p_refThe reference value

References m_changed, Castor3D::DepthStencilState::stSTENCIL::m_ref, and m_stStencilFront.

◆ SetStencilReadMask()

void Castor3D::DepthStencilState::SetStencilReadMask ( uint32_t  p_uiMask)
inline

Defines the stencil read mask.

Parameters
[in]p_uiMaskThe mask

References m_changed, and m_uiStencilReadMask.

◆ SetStencilTest()

void Castor3D::DepthStencilState::SetStencilTest ( bool  p_enable)
inline

Defines the stencil test status.

Parameters
[in]p_enableThe new status

References m_bStencilTest, and m_changed.

◆ SetStencilWriteMask()

void Castor3D::DepthStencilState::SetStencilWriteMask ( uint32_t  p_uiMask)
inline

Defines the stencil write mask.

Parameters
[in]p_uiMaskThe mask

References m_changed, and m_uiStencilWriteMask.

Member Data Documentation

◆ m_bDepthTest

bool Castor3D::DepthStencilState::m_bDepthTest
protected

Tells whether the depth test is activated or not.

Referenced by GetDepthTest(), and SetDepthTest().

◆ m_bStencilTest

bool Castor3D::DepthStencilState::m_bStencilTest
protected

Tells whether the stencil test is activated or not.

Referenced by GetStencilTest(), and SetStencilTest().

◆ m_changed

bool Castor3D::DepthStencilState::m_changed
protected

◆ m_currentState

DepthStencilStateSPtr Castor3D::DepthStencilState::m_currentState
protected

Shared_pointer to the internal global state, to use reference counting for this static member.

◆ m_dDepthFar

double Castor3D::DepthStencilState::m_dDepthFar
protected

The far plane for depth test.

Referenced by GetDepthFar(), and SetDepthRange().

◆ m_dDepthNear

double Castor3D::DepthStencilState::m_dDepthNear
protected

The near plane for depth test.

Referenced by GetDepthNear(), and SetDepthRange().

◆ m_eDepthFunc

eDEPTH_FUNC Castor3D::DepthStencilState::m_eDepthFunc
protected

The depth test function.

Referenced by GetDepthFunc(), and SetDepthFunc().

◆ m_eDepthMask

eWRITING_MASK Castor3D::DepthStencilState::m_eDepthMask
protected

Depth writing mask.

Referenced by GetDepthMask(), and SetDepthMask().

◆ m_stStencilBack

stSTENCIL Castor3D::DepthStencilState::m_stStencilBack
protected

◆ m_stStencilFront

stSTENCIL Castor3D::DepthStencilState::m_stStencilFront
protected

◆ m_uiStencilReadMask

uint32_t Castor3D::DepthStencilState::m_uiStencilReadMask
protected

The stencil read mask.

Referenced by GetStencilReadMask(), and SetStencilReadMask().

◆ m_uiStencilWriteMask

uint32_t Castor3D::DepthStencilState::m_uiStencilWriteMask
protected

The stencil write mask.

Referenced by GetStencilWriteMask(), and SetStencilWriteMask().

◆ m_wCurrentState

DepthStencilStateWPtr Castor3D::DepthStencilState::m_wCurrentState
staticprotected

The internal global state used to commit only the changed states.


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