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

sglPointParameters Class Reference

#include <sglStatelet.hpp>

Inheritance diagram for sglPointParameters::

sglStatelet sglObject List of all members.

Public Methods

 sglPointParameters (float dist_atten_A=1.0f, float dist_atten_B=0.0f, float dist_atten_C=0.0f, float fade_threshold=sgl::s_point_default_fade_threshold, float min_size=sgl::s_point_default_size_min, float max_size=sgl::s_point_default_size_max)
virtual ~sglPointParameters ()
void setPointParameters (float dist_atten_A, float dist_atten_B, float dist_atten_C, float fade_threshold=sgl::s_point_default_fade_threshold, float min_size=sgl::s_point_default_size_min, float max_size=sgl::s_point_default_size_max)
void getPointParameters (float &dist_atten_A, float &dist_atten_B, float &dist_atten_C, float &fade_threshold, float &min_size, float &max_size)
void apply (sglCurrState *curr_state) const
virtual bool getSorted () const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Detailed Description

This statelet works with either the GL_EXT_point_parameters extension to OpenGL (or the GL_SGIS_point_parameters in earlier versions) and encapsulates the glPointParameterfEXT() and glPointParameterfvEXT() functions to specify point parameters for point primitives or other geometries in point polygon mode.

With this extensions points are rendered with a given size (as specified by glPointSize() via the sglPointSize class) which can be attenuated with distance according to the following equation (similar to light attenuation):

    dist_atten(dist) = 1 / ( A + B * dist + C * dist^2 )
where A, B, and C, constant, linear, and quadratic constants and default to (1, 0, 0) respectively. Below a certain minimum point size the alpha component of the point's color will also start to be attenuated to continue to attenuate the point below the minimum size.

With this statelet the minimum and maximum size of the points can be set, the attenuation constants, and the fade threshold. This can be used to particles or tiny light sources commonly referred to as "light points."

Example:

   sglPointParameters *pt_param = new sglPointParameters;
   pt_param->setPointParameters(1.0f, 0.34f, 0.8f,    // set new attenuation
                                sgl::s_point_default_fade_threshold,
                                sgl::s_point_default_size_min,
                                sgl::s_point_default_size_max);

Definition at line 1633 of file sglStatelet.hpp.


Constructor & Destructor Documentation

sglPointParameters::sglPointParameters ( float dist_atten_A = 1.0f,
float dist_atten_B = 0.0f,
float dist_atten_C = 0.0f,
float fade_threshold = sgl::s_point_default_fade_threshold,
float min_size = sgl::s_point_default_size_min,
float max_size = sgl::s_point_default_size_max ) [inline]
 

Constructor (also the default constructor).

Parameters:
dist_atten_A   Constant attenuation factor, defaults to 1.0.
dist_atten_B   Linear attenuation factor, defaults to 0.0.
dist_atten_C   Quadratic attenuation factor, defaults to 0.0.
fade_threshold   When multisampled (anti-aliased) points are enabled, this parameter defines the point at which size (diameter) is no longer attenuated (above this value) and alpha component is (below this value).
min_size   The minimum derived point size (after attenuation).
max_size   The maximum derived point size (after attenuation).

Definition at line 1647 of file sglStatelet.hpp.

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

virtual destructor.

Definition at line 1662 of file sglStatelet.hpp.


Member Function Documentation

void sglPointParameters::setPointParameters ( float dist_atten_A,
float dist_atten_B,
float dist_atten_C,
float fade_threshold = sgl::s_point_default_fade_threshold,
float min_size = sgl::s_point_default_size_min,
float max_size = sgl::s_point_default_size_max ) [inline]
 

Set all the point parameters at once.

Parameters:
dist_atten_A   Constant attenuation factor
dist_atten_B   Linear attenuation factor
dist_atten_C   Quadratic attenuation factor
fade_threshold   When multisampled (anti-aliased) points are enabled, this parameter defines the point at which size (diameter) is no longer attenuated (above this value) and alpha component is (below this value).
min_size   The minimum derived point size (after attenuation).
max_size   The maximum derived point size (after attenuation).

Definition at line 1675 of file sglStatelet.hpp.

Referenced by sglPointParameters().

void sglPointParameters::getPointParameters ( float & dist_atten_A,
float & dist_atten_B,
float & dist_atten_C,
float & fade_threshold,
float & min_size,
float & max_size ) [inline]
 

Query all the point parameters.

Parameters:
dist_atten_A   On return, constant attenuation factor
dist_atten_B   On return, linear attenuation factor
dist_atten_C   On return, quadratic attenuation factor
fade_threshold   On return, contains the fade threshold size.
min_size   On return, the minimum derived point size.
max_size   On return, the maximum derived point size.

Definition at line 1702 of file sglStatelet.hpp.

void sglPointParameters::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 sglPointParameters::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 1721 of file sglStatelet.hpp.

virtual void sglPointParameters::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:09 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001