osg::Stencil Class Reference

Encapsulate OpenGL glStencilFunc/Op/Mask functions. More...

Inheritance diagram for osg::Stencil:

Inheritance graph
[legend]

List of all members.

Public Types

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

 Stencil ()
 Stencil (const Stencil &stencil, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.
 META_StateAttribute (osg, Stencil, 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 (Function func, int ref, unsigned int mask)
void setFunction (Function func)
Function getFunction () const
void setFunctionRef (int ref)
int getFunctionRef () const
void setFunctionMask (unsigned int mask)
unsigned int getFunctionMask () const
void setOperation (Operation sfail, Operation zfail, Operation zpass)
 set the operations to apply when the various stencil and depth tests fail or pass.
void setStencilFailOperation (Operation sfail)
 set the operation when the stencil test fails.
Operation getStencilFailOperation () const
 get the operation when the stencil test fails.
void setStencilPassAndDepthFailOperation (Operation zfail)
 set the operation when the stencil test passes but the depth test fails.
Operation getStencilPassAndDepthFailOperation () const
 get the operation when the stencil test passes but the depth test fails.
void setStencilPassAndDepthPassOperation (Operation zpass)
 set the operation when both the stencil test and the depth test pass.
Operation getStencilPassAndDepthPassOperation () const
 get the operation when both the stencil test and the depth test pass.
void setWriteMask (unsigned int mask)
unsigned int getWriteMask () const
virtual void apply (State &state) const
 apply the OpenGL state attributes.

Protected Member Functions

virtual ~Stencil ()

Protected Attributes

Function _func
int _funcRef
unsigned int _funcMask
Operation _sfail
Operation _zfail
Operation _zpass
unsigned int _writeMask


Detailed Description

Encapsulate OpenGL glStencilFunc/Op/Mask functions.

Member Enumeration Documentation

enum osg::Stencil::Function

Enumerator:
NEVER 
LESS 
EQUAL 
LEQUAL 
GREATER 
NOTEQUAL 
GEQUAL 
ALWAYS 

enum osg::Stencil::Operation

Enumerator:
KEEP 
ZERO 
REPLACE 
INCR 
DECR 
INVERT 
INCR_WRAP 
DECR_WRAP 


Constructor & Destructor Documentation

osg::Stencil::Stencil (  ) 

osg::Stencil::Stencil ( const Stencil stencil,
const CopyOp copyop = CopyOp::SHALLOW_COPY 
) [inline]

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Stencil::~Stencil (  )  [protected, virtual]


Member Function Documentation

osg::Stencil::META_StateAttribute ( osg  ,
Stencil  ,
STENCIL   
)

virtual int osg::Stencil::compare ( const StateAttribute sa  )  const [inline, virtual]

return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

Implements osg::StateAttribute.

virtual bool osg::Stencil::getModeUsage ( StateAttribute::ModeUsage  )  const [inline, virtual]

Return the modes associated with this StateAttribute.

Reimplemented from osg::StateAttribute.

void osg::Stencil::setFunction ( Function  func,
int  ref,
unsigned int  mask 
) [inline]

void osg::Stencil::setFunction ( Function  func  )  [inline]

Function osg::Stencil::getFunction (  )  const [inline]

void osg::Stencil::setFunctionRef ( int  ref  )  [inline]

int osg::Stencil::getFunctionRef (  )  const [inline]

void osg::Stencil::setFunctionMask ( unsigned int  mask  )  [inline]

unsigned int osg::Stencil::getFunctionMask (  )  const [inline]

void osg::Stencil::setOperation ( 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::Stencil::setStencilFailOperation ( Operation  sfail  )  [inline]

set the operation when the stencil test fails.

Operation osg::Stencil::getStencilFailOperation (  )  const [inline]

get the operation when the stencil test fails.

void osg::Stencil::setStencilPassAndDepthFailOperation ( Operation  zfail  )  [inline]

set the operation when the stencil test passes but the depth test fails.

Operation osg::Stencil::getStencilPassAndDepthFailOperation (  )  const [inline]

get the operation when the stencil test passes but the depth test fails.

void osg::Stencil::setStencilPassAndDepthPassOperation ( Operation  zpass  )  [inline]

set the operation when both the stencil test and the depth test pass.

Operation osg::Stencil::getStencilPassAndDepthPassOperation (  )  const [inline]

get the operation when both the stencil test and the depth test pass.

void osg::Stencil::setWriteMask ( unsigned int  mask  )  [inline]

unsigned int osg::Stencil::getWriteMask (  )  const [inline]

virtual void osg::Stencil::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.


Member Data Documentation

Function osg::Stencil::_func [protected]

int osg::Stencil::_funcRef [protected]

unsigned int osg::Stencil::_funcMask [protected]

Operation osg::Stencil::_sfail [protected]

Operation osg::Stencil::_zfail [protected]

Operation osg::Stencil::_zpass [protected]

unsigned int osg::Stencil::_writeMask [protected]


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:16 2007 for the OpenSceneGraph by doxygen 1.5.3.