OpenSceneGraph
3.4.0
|
Provides OpenGL two sided stencil functionality, also known as separate stencil. More...
Public Types | |
enum | Face { FRONT = 0, BACK = 1 } |
enum | Function { NEVER = GL_NEVER, LESS = GL_LESS, EQUAL = GL_EQUAL, LEQUAL = GL_LEQUAL, GREATER = GL_GREATER, NOTEQUAL = GL_NOTEQUAL, GEQUAL = GL_GEQUAL, ALWAYS = GL_ALWAYS } |
enum | Operation { KEEP = GL_KEEP, ZERO = GL_ZERO, REPLACE = GL_REPLACE, INCR = GL_INCR, DECR = GL_DECR, INVERT = GL_INVERT, INCR_WRAP = GL_INCR_WRAP, DECR_WRAP = GL_DECR_WRAP } |
Public Member Functions | |
StencilTwoSided () | |
StencilTwoSided (const StencilTwoSided &stencil, const CopyOp ©op=CopyOp::SHALLOW_COPY) | |
Copy constructor using CopyOp to manage deep vs shallow copy. | |
META_StateAttribute (osg, StencilTwoSided, STENCIL) | |
virtual int | compare (const StateAttribute &sa) const |
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. | |
virtual bool | getModeUsage (StateAttribute::ModeUsage &usage) const |
Return the modes associated with this StateAttribute. | |
void | setFunction (Face face, Function func, int ref, unsigned int mask) |
void | setFunction (Face face, Function func) |
Function | getFunction (Face face) const |
void | setFunctionRef (Face face, int ref) |
int | getFunctionRef (Face face) const |
void | setFunctionMask (Face face, unsigned int mask) |
unsigned int | getFunctionMask (Face face) const |
void | setOperation (Face face, Operation sfail, Operation zfail, Operation zpass) |
set the operations to apply when the various stencil and depth tests fail or pass. | |
void | setStencilFailOperation (Face face, Operation sfail) |
set the operation when the stencil test fails. | |
Operation | getStencilFailOperation (Face face) const |
get the operation when the stencil test fails. | |
void | setStencilPassAndDepthFailOperation (Face face, Operation zfail) |
set the operation when the stencil test passes but the depth test fails. | |
Operation | getStencilPassAndDepthFailOperation (Face face) const |
get the operation when the stencil test passes but the depth test fails. | |
void | setStencilPassAndDepthPassOperation (Face face, Operation zpass) |
set the operation when both the stencil test and the depth test pass. | |
Operation | getStencilPassAndDepthPassOperation (Face face) const |
get the operation when both the stencil test and the depth test pass. | |
void | setWriteMask (Face face, unsigned int mask) |
unsigned int | getWriteMask (Face face) const |
virtual void | apply (State &state) const |
apply the OpenGL state attributes. | |
Protected Member Functions | |
virtual | ~StencilTwoSided () |
Protected Attributes | |
Function | _func [2] |
int | _funcRef [2] |
unsigned int | _funcMask [2] |
Operation | _sfail [2] |
Operation | _zfail [2] |
Operation | _zpass [2] |
unsigned int | _writeMask [2] |
Provides OpenGL two sided stencil functionality, also known as separate stencil.
It enables to specify different stencil function for front and back facing polygons. Two sided stenciling is used usually to eliminate the need of two rendering passes when using standard stenciling functions. See also
Two sided stenciling is available since OpenGL 2.0. It is also supported by EXT_stencil_two_side extension especially on Nvidia cards. Another extension introduced by ATI is ATI_separate_stencil. However, ATI's extension is limited to have reference and mask value the same for both faces. ATI's extension is currently not supported by the current implementation.
osg::StencilTwoSided does nothing if OpenGL 2.0 or EXT_stencil_two_side are not available.
osg::StencilTwoSided::StencilTwoSided | ( | const StencilTwoSided & | stencil, |
const CopyOp & | copyop = CopyOp::SHALLOW_COPY |
||
) |
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual osg::StencilTwoSided::~StencilTwoSided | ( | ) | [protected, virtual] |
virtual void osg::StencilTwoSided::apply | ( | State & | ) | const [virtual] |
apply the OpenGL state attributes.
The render info for the current OpenGL context is passed in to allow the StateAttribute to obtain details on the the current context and state.
Reimplemented from osg::StateAttribute.
virtual int osg::StencilTwoSided::compare | ( | const StateAttribute & | sa | ) | const [virtual] |
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Implements osg::StateAttribute.
Function osg::StencilTwoSided::getFunction | ( | Face | face | ) | const [inline] |
unsigned int osg::StencilTwoSided::getFunctionMask | ( | Face | face | ) | const [inline] |
int osg::StencilTwoSided::getFunctionRef | ( | Face | face | ) | const [inline] |
virtual bool osg::StencilTwoSided::getModeUsage | ( | StateAttribute::ModeUsage & | ) | const [inline, virtual] |
Return the modes associated with this StateAttribute.
Reimplemented from osg::StateAttribute.
References osg::StateAttribute::ModeUsage::usesMode().
Operation osg::StencilTwoSided::getStencilFailOperation | ( | Face | face | ) | const [inline] |
get the operation when the stencil test fails.
Operation osg::StencilTwoSided::getStencilPassAndDepthFailOperation | ( | Face | face | ) | const [inline] |
get the operation when the stencil test passes but the depth test fails.
Operation osg::StencilTwoSided::getStencilPassAndDepthPassOperation | ( | Face | face | ) | const [inline] |
get the operation when both the stencil test and the depth test pass.
unsigned int osg::StencilTwoSided::getWriteMask | ( | Face | face | ) | const [inline] |
void osg::StencilTwoSided::setFunction | ( | Face | face, |
Function | func, | ||
int | ref, | ||
unsigned int | mask | ||
) | [inline] |
void osg::StencilTwoSided::setFunction | ( | Face | face, |
Function | func | ||
) | [inline] |
void osg::StencilTwoSided::setFunctionMask | ( | Face | face, |
unsigned int | mask | ||
) | [inline] |
void osg::StencilTwoSided::setFunctionRef | ( | Face | face, |
int | ref | ||
) | [inline] |
void osg::StencilTwoSided::setOperation | ( | Face | face, |
Operation | sfail, | ||
Operation | zfail, | ||
Operation | zpass | ||
) | [inline] |
set the operations to apply when the various stencil and depth tests fail or pass.
First parameter is to control the operation when the stencil test fails. The second parameter is to control the operation when the stencil test passes, but depth test fails. The third parameter controls the operation when both the stencil test and depth pass. Ordering of parameter is the same as if using glStencilOp(,,).
void osg::StencilTwoSided::setStencilFailOperation | ( | Face | face, |
Operation | sfail | ||
) | [inline] |
set the operation when the stencil test fails.
void osg::StencilTwoSided::setStencilPassAndDepthFailOperation | ( | Face | face, |
Operation | zfail | ||
) | [inline] |
set the operation when the stencil test passes but the depth test fails.
void osg::StencilTwoSided::setStencilPassAndDepthPassOperation | ( | Face | face, |
Operation | zpass | ||
) | [inline] |
set the operation when both the stencil test and the depth test pass.
void osg::StencilTwoSided::setWriteMask | ( | Face | face, |
unsigned int | mask | ||
) | [inline] |
Function osg::StencilTwoSided::_func[2] [protected] |
unsigned int osg::StencilTwoSided::_funcMask[2] [protected] |
int osg::StencilTwoSided::_funcRef[2] [protected] |
Operation osg::StencilTwoSided::_sfail[2] [protected] |
unsigned int osg::StencilTwoSided::_writeMask[2] [protected] |
Operation osg::StencilTwoSided::_zfail[2] [protected] |
Operation osg::StencilTwoSided::_zpass[2] [protected] |
![]() | Generated at Tue Dec 8 2015 00:14:26 for the OpenSceneGraph by doxygen 1.7.6.1. |