Class Desc

Synopsis

#include <Source/Falcor/Core/API/DepthStencilState.h>

class dlldecl Desc

Description

Depth-stencil descriptor

Methods

setDepthEnabledEnable/disable depth-test
setDepthFuncSet the depth-function
setDepthWriteMaskEnable or disable depth writes into the depth buffer
setStencilEnabledEnable/disable stencil-test
setStencilFuncSet the stencil comparison function
setStencilOpSet the stencil operation
setStencilReadMaskSet the stencil read-mask
setStencilRefSet the stencil ref value
setStencilWriteMaskSet the stencil write-mask

Source

Lines 79-136 in Source/Falcor/Core/API/DepthStencilState.h.

class dlldecl Desc
{
public:
    friend class DepthStencilState;
    /** Enable/disable depth-test
    */
    Desc& setDepthEnabled(bool enabled) { mDepthEnabled = enabled; return *this; }
    /** Set the depth-function
    */
    Desc& setDepthFunc(Func depthFunc) { mDepthFunc = depthFunc; return *this; }
    /** Enable or disable depth writes into the depth buffer
    */
    Desc& setDepthWriteMask(bool writeDepth) { mWriteDepth = writeDepth; return *this; }
    /** Enable/disable stencil-test
    */
    Desc& setStencilEnabled(bool enabled) { mStencilEnabled = enabled; return *this; }
    /** Set the stencil write-mask
    */
    Desc& setStencilWriteMask(uint8_t mask);
    /** Set the stencil read-mask
    */
    Desc& setStencilReadMask(uint8_t mask);
    /** Set the stencil comparison function
        \param face Chooses the face to apply the function to
        \param func Comparison function
    */
    Desc& setStencilFunc(Face face, Func func);
    /** Set the stencil operation
        \param face Chooses the face to apply the operation to
        \param stencilFail Stencil operation in case stencil test fails
        \param depthFail Stencil operation in case stencil test passes but depth test fails
        \param depthStencilPass Stencil operation in case stencil and depth tests pass
    */
    Desc& setStencilOp(Face face, StencilOp stencilFail, StencilOp depthFail, StencilOp depthStencilPass);
    /** Set the stencil ref value
    */
    Desc& setStencilRef(uint8_t value) { mStencilRef = value; return *this; };
protected:
    bool mDepthEnabled = true;
    bool mStencilEnabled = false;
    bool mWriteDepth = true;
    Func mDepthFunc = Func::Less;
    StencilDesc mStencilFront;
    StencilDesc mStencilBack;
    uint8_t mStencilReadMask = (uint8_t)-1;
    uint8_t mStencilWriteMask = (uint8_t)-1;
    uint8_t mStencilRef = 0;
};





Add Discussion as Guest

Log in