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

sglTexCombinerParams Class Reference

#include <sglTexCombinerParams.hpp>

Inheritance diagram for sglTexCombinerParams::

sglObject List of all members.

Public Types

enum  ArgEnum {
  eARG0 = 0,
  eARG1,
  eARG2
}
enum  SourceEnum {
  eTEXTURE = GL_TEXTURE,
  eCONSTANT = GL_CONSTANT,
  ePRIMARY_COLOR = GL_PRIMARY_COLOR,
  ePREVIOUS = GL_PREVIOUS
}

Public Methods

 sglTexCombinerParams ()
virtual ~sglTexCombinerParams ()
 sglTexCombinerParams (const sglTexCombinerParams &rhs)
sglTexCombinerParams& operator= (const sglTexCombinerParams &rhs)
void setRGBFunc (RGB::FuncEnum func)
RGB::FuncEnum getRGBFunc () const
void setAlphaFunc (Alpha::FuncEnum func)
Alpha::FuncEnum getAlphaFunc () const
void setRGBScale (float scale)
float getRGBScale () const
void setAlphaScale (float scale)
float getAlphaScale () const
void setRGBParameter (ArgEnum arg, SourceEnum src, RGB::OperandEnum op)
void getRGBParameter (ArgEnum arg, SourceEnum &src, RGB::OperandEnum &op) const
void setAlphaParameter (ArgEnum arg, SourceEnum src, Alpha::OperandEnum op)
void getAlphaParameter (ArgEnum arg, SourceEnum &src, Alpha::OperandEnum &op) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Friends

class  sglTexEnv

Detailed Description

This object contains all the information required to define the functions used by the sglTexEnv::eCOMBINE mode.

Example 1: To emulate the eBLEND mode,

   sglTexEnv *tenv = new sglTexEnv;
   tenv->setBlendColor(1.0f, 0.7f, 0.0f, 1.0f);
   tenv->setMode(sglTexEnv::eCOMBINE);
   combiner_params = new sglTexCombinerParams();
   combiner_params->setRGBFunc(sglTexCombinerParams::RGB::eINTERPOLATE);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG0,
                                    sglTexCombinerParams::eCONSTANT,
                                    sglTexCombinerParams::RGB::eSRC_COLOR);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG1,
                                    sglTexCombinerParams::ePREVIOUS,
                                    sglTexCombinerParams::RGB::eSRC_COLOR);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG2,
                                    sglTexCombinerParams::eTEXTURE,
                                    sglTexCombinerParams::RGB::eSRC_COLOR);
   combiner_params->setAlphaFunc(sglTexCombinerParams::Alpha::eMODULATE);
   combiner_params->setAlphaParameter(
      sglTexCombinerParams::eARG0,
      sglTexCombinerParams::ePREVIOUS,
      sglTexCombinerParams::Alpha::eSRC_ALPHA);
   combiner_params->setAlphaParameter(
      sglTexCombinerParams::eARG1,
      sglTexCombinerParams::eTEXTURE,
      sglTexCombinerParams::Alpha::eSRC_ALPHA);
   tenv->setCombinerParams(combiner_params);

Example 2: To emulate the eDECAL mode,

   sglTexEnv *tenv = new sglTexEnv;
   tenv->setMode(sglTexEnv::eCOMBINE);
   combiner_params = new sglTexCombinerParams();
   combiner_params->setRGBFunc(sglTexCombinerParams::RGB::eINTERPOLATE);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG0,
                                    sglTexCombinerParams::eTEXTURE,
                                    sglTexCombinerParams::RGB::eSRC_COLOR);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG1,
                                    sglTexCombinerParams::ePREVIOUS,
                                    sglTexCombinerParams::RGB::eSRC_COLOR);
   combiner_params->setRGBParameter(sglTexCombinerParams::eARG2,
                                    sglTexCombinerParams::eTEXTURE,
                                    sglTexCombinerParams::RGB::eSRC_ALPHA);
   combiner_params->setAlphaFunc(sglTexCombinerParams::Alpha::eREPLACE);
   combiner_params->setAlphaParameter(
      sglTexCombinerParams::eARG0,
      sglTexCombinerParams::ePREVIOUS,
      sglTexCombinerParams::Alpha::eSRC_ALPHA);
   tenv->setCombinerParams(combiner_params);

Definition at line 94 of file sglTexCombinerParams.hpp.


Member Enumeration Documentation

enum sglTexCombinerParams::SourceEnum
 

Tokens to specify the source for each argument of the texture functions.

Enumeration values:
eTEXTURE   Input color for the given Arg comes from the current texture.
eCONSTANT   Input color for the given Arg comes from the TexEnv blend color.
ePRIMARY_COLOR   Input color for the given Arg comes from the base polygon.
ePREVIOUS   Input color for the given Arg comes from the output of the previous texture unit. For the first texture unit, ePREVIOUS behaves like ePRIMARY_COLOR.

Definition at line 185 of file sglTexCombinerParams.hpp.


Constructor & Destructor Documentation

sglTexCombinerParams::sglTexCombinerParams ( )
 

Default constructor.

sglTexCombinerParams::~sglTexCombinerParams ( ) [virtual]
 

Virtual destructor.

sglTexCombinerParams::sglTexCombinerParams ( const sglTexCombinerParams & rhs )
 

Copy constructor.


Member Function Documentation

sglTexCombinerParams & sglTexCombinerParams::operator= ( const sglTexCombinerParams & rhs )
 

Assignment operator.

void sglTexCombinerParams::setRGBFunc ( RGB::FuncEnum func )
 

Set the texture function for the RGB components.

Parameters:
func   One of the RGB::FuncEnum tokens. If eDOT3_RGB or eDOT3_RGBA is specified but is not supported through the extensions, then eMODULATE will be used instead. The default value is eMODULATE.

RGB::FuncEnum sglTexCombinerParams::getRGBFunc ( ) const [inline]
 

Query the current texture function for the RGB components.

Returns:
The RGB::FuncEnum token corresponding to the current texture function.

Definition at line 229 of file sglTexCombinerParams.hpp.

void sglTexCombinerParams::setAlphaFunc ( Alpha::FuncEnum func )
 

Set the texture function for the Alpha component.

Parameters:
func   One of the Alpha::FuncEnum tokens. The default value is eMODULATE.

Alpha::FuncEnum sglTexCombinerParams::getAlphaFunc ( ) const [inline]
 

Query the current texture function for the Alpha component.

Returns:
The Alpha::FuncEnum token corresponding to the current texture function.

Definition at line 241 of file sglTexCombinerParams.hpp.

void sglTexCombinerParams::setRGBScale ( float scale )
 

The result of the RGB texture function may be scaled by 1.0, 2.0 or 4.0.

Parameters:
scale   The scale factor to use on the RGB components. The default value is 1.0f.

float sglTexCombinerParams::getRGBScale ( ) const [inline]
 

Query the current RGB scale factor.

Returns:
The current RGB scale factor.

Definition at line 252 of file sglTexCombinerParams.hpp.

void sglTexCombinerParams::setAlphaScale ( float scale )
 

The result of the Alpha texture function may be scaled by 1.0, 2.0 or 4.0.

Parameters:
scale   The scale factor to use on the Alpha components.

float sglTexCombinerParams::getAlphaScale ( ) const [inline]
 

Query the current Alpha scale factor.

Returns:
The current Alpha scale factor. The default value is 1.0f.

Definition at line 264 of file sglTexCombinerParams.hpp.

void sglTexCombinerParams::setRGBParameter ( ArgEnum arg,
SourceEnum src,
RGB::OperandEnum op )
 

Change one of the arguments of the RGB texture function. The default values: ARG0 = eTEXTURE, eSRC_COLOR; ARG1 = ePREVIOUS, eSRC_COLOR; ARG2 = eCONSTANT, eSRC_ALPHA;

Parameters:
arg   The argument to be changed.
src   The source of the color values.
op   The component of the source.

void sglTexCombinerParams::getRGBParameter ( ArgEnum arg,
SourceEnum & src,
RGB::OperandEnum & op ) const
 

Query one of the arguments of the RGB texture function.

Parameters:
arg   The argument to be queried.
src   On return set to the source of the color values.
op   One return set to the component of the source.

void sglTexCombinerParams::setAlphaParameter ( ArgEnum arg,
SourceEnum src,
Alpha::OperandEnum op )
 

Change one of the arguments of the Alpha texture function. The default values: ARG0 = eTEXTURE, eSRC_ALPHA; ARG1 = ePREVIOUS, eSRC_ALPHA; ARG2 = eCONSTANT, eSRC_ALPHA;

Parameters:
arg   The argument to be changed.
src   The source of the color values.
op   The component of the source.

void sglTexCombinerParams::getAlphaParameter ( ArgEnum arg,
SourceEnum & src,
Alpha::OperandEnum & op ) const
 

Query one of the arguments of the Alpha texture function.

Parameters:
arg   The argument to be queried.
src   On return set to the source of the color values.
op   One return set to the component of the source.

virtual void sglTexCombinerParams::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 sglObject.


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