Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglDepthRange Class Reference

#include <sglStatelet.hpp>

Inheritance diagram for sglDepthRange::

sglStatelet sglObject List of all members.

Public Methods

 sglDepthRange (double near_val=0.0, double far_val=1.0)
virtual ~sglDepthRange ()
void setDepthRange (double near_val, double far_val)
void getDepthRange (double &near_val, double &far_val) const
void apply (sglCurrState *curr_state) const
virtual bool getSorted () const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Detailed Description

This statelet encapsulates OpenGL's glDepthRange() function which defines an encoding for z coordinates that is preformed during the viewport transformation. The near_val and far_val parameters represent adjustments to the minimum and maximum values that can be stored in the depth buffer. The default to 0 and 1 respectively and are clamped to [0, 1]. This can be used for a number of effects including polygon offset like effects as in the following example:

   double epsilon = 1.0e-4;

   // bias the depth values closer to zero (near clip plane).
   sglDepthRange *drange = new sglDepthRange(0.0, 1.0 - epsilon);

   // bias the depth values closer to one (far clip plane).
   drange->setDepthRange(epsilon, 1.0);

Definition at line 892 of file sglStatelet.hpp.


Constructor & Destructor Documentation

sglDepthRange::sglDepthRange ( double near_val = 0.0,
double far_val = 1.0 ) [inline]
 

Constructor (also the default constructor).

Parameters:
near_val   The depth value corresponding to the near clip plane. Values are clamped to [0,1]. The default is 0.0.
far_val   The depth value corresponding to the far clip plane. Values are clamped to [0,1]. The default is 1.0.

Definition at line 901 of file sglStatelet.hpp.

sglDepthRange::~sglDepthRange ( ) [inline, virtual]
 

virtual destructor.

Definition at line 906 of file sglStatelet.hpp.


Member Function Documentation

void sglDepthRange::setDepthRange ( double near_val,
double far_val )
 

Set a new depth range

Parameters:
near_val   The depth value corresponding to the near clip plane. Values are clamped to [0,1]. The default is 0.0.
far_val   The depth value corresponding to the far clip plane. Values are clamped to [0,1]. The default is 1.0.

Referenced by sglDepthRange().

void sglDepthRange::getDepthRange ( double & near_val,
double & far_val ) const [inline]
 

Query the current depth range.

Parameters:
near_val   The depth value corresponding to the near clip plane.
far_val   The depth value corresponding to the far clip plane.

Definition at line 920 of file sglStatelet.hpp.

void sglDepthRange::apply ( sglCurrState * curr_state ) const [virtual]
 

Apply this state change to the current rendering state.

Parameters:
curr_state   Required for statelets that affect one another. For example the sglTransparency sets up depth mask and blending modes which interact with the sglBlending and sglDepthMask statelets, and the curr_state object is used to resolve these internal issues.

Reimplemented from sglStatelet.

bool sglDepthRange::getSorted ( ) const [inline, virtual]
 

Query the sorting mode for this statelet.

Returns:
true if this type of statelet should be sorted by pointer rather than using m_index to index into an array. The defualt implementation is the latter, but if a statelet can take on an inordinate number of states (e.g. a floating point parameter) then true should be returned.

Reimplemented from sglStatelet.

Definition at line 930 of file sglStatelet.hpp.

virtual void sglDepthRange::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglStatelet.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:07 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001