Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Types | Public Member Functions | Static Public Member Functions
TextureStage Class Reference

Defines the properties of a named stage of the multitexture pipeline. More...

Inheritance diagram for TextureStage:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

List of all members.

Public Types

enum  CombineMode {
  CMUndefined = 0, CMReplace = 1, CMModulate = 2, CMAdd = 3,
  CMAddSigned = 4, CMInterpolate = 5, CMSubtract = 6, CMDot3Rgb = 7,
  CMDot3Rgba = 8
}
enum  CombineOperand {
  COUndefined = 0, COSrcColor = 1, COOneMinusSrcColor = 2, COSrcAlpha = 3,
  COOneMinusSrcAlpha = 4
}
enum  CombineSource {
  CSUndefined = 0, CSTexture = 1, CSConstant = 2, CSPrimaryColor = 3,
  CSPrevious = 4, CSConstantColorScale = 5, CSLastSavedResult = 6
}
enum  Mode {
  MModulate = 0, MDecal = 1, MBlend = 2, MReplace = 3,
  MAdd = 4, MCombine = 5, MBlendColorScale = 6, MModulateGlow = 7,
  MModulateGloss = 8, MNormal = 9, MNormalHeight = 10, MGlow = 11,
  MGloss = 12, MHeight = 13, MSelector = 14, MNormalGloss = 15
}

Public Member Functions

 TextureStage (TextureStage copy)
 Initialize the texture stage from other.
 TextureStage (string name)
 Initialize the texture stage at construction.
int compareTo (TextureStage const other)
 Returns a number less than zero if this TextureStage sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.
int getAlphaScale ()
 See set_alpha_scale().
VBase4 getColor ()
 return the color for this stage
CombineMode getCombineAlphaMode ()
 Get combine_alpha_mode.
CombineOperand getCombineAlphaOperand0 ()
 Get operand0 of combine_alpha_mode.
CombineOperand getCombineAlphaOperand1 ()
 Get operand1 of combine_alpha_mode.
CombineOperand getCombineAlphaOperand2 ()
 Get operand2 of combine_alpha_mode.
CombineSource getCombineAlphaSource0 ()
 Get source0 of combine_alpha_mode.
CombineSource getCombineAlphaSource1 ()
 Get source1 of combine_alpha_mode.
CombineSource getCombineAlphaSource2 ()
 Get source2 of combine_alpha_mode.
CombineMode getCombineRgbMode ()
 Get the combine_rgb_mode.
CombineOperand getCombineRgbOperand0 ()
 Get operand0 of combine_rgb_mode.
CombineOperand getCombineRgbOperand1 ()
 Get operand1 of combine_rgb_mode.
CombineOperand getCombineRgbOperand2 ()
 Get operand2 of combine_rgb_mode.
CombineSource getCombineRgbSource0 ()
 Get source0 of combine_rgb_mode.
CombineSource getCombineRgbSource1 ()
 Get source1 of combine_rgb_mode.
CombineSource getCombineRgbSource2 ()
 Get source2 of combine_rgb_mode.
Mode getMode ()
 Return the mode of this stage.
string getName ()
 Returns the name of this texture stage.
int getNumCombineAlphaOperands ()
 Returns the number of meaningful operands that may be retrieved via get_combine_alpha_sourceN() and get_combine_alpha_operandN().
int getNumCombineRgbOperands ()
 Returns the number of meaningful operands that may be retrieved via get_combine_rgb_sourceN() and get_combine_rgb_operandN().
int getPriority ()
 Returns the priority associated with this stage.
int getRgbScale ()
 See set_rgb_scale().
bool getSavedResult ()
 Returns the current setting of the saved_result flag.
int getSort ()
 Returns the sort order of this texture stage.
InternalName getTexcoordName ()
 Returns the InternalName.
int getTexViewOffset ()
 Returns the current setting of the tex_view_offset.
bool involvesColorScale ()
 Returns true if the TextureStage is affected by the setting of the current ColorScaleAttrib, false otherwise.
bool isFixedFunction ()
 Returns true if the TextureStage is relevant to the classic fixed function pipeline.
bool operator!= (TextureStage const other)
bool operator< (TextureStage const other)
TextureStage operator= (TextureStage const copy)
 just copy the members of other to this
bool operator== (TextureStage const other)
 output (ostream out)
 Just a single line output.
 setAlphaScale (int alpha_scale)
 Sets an additional factor that will scale the alpha component after the texture has been applied.
 setColor (VBase4 const color)
 Set the color for this stage.
 setCombineAlpha (CombineMode mode, CombineSource source0, CombineOperand operand0)
 Specifies any of the CombineMode values that represent a one-parameter operation.
 setCombineAlpha (CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1)
 Specifies any of the CombineMode values that represent a two-parameter operation.
 setCombineAlpha (CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1, CombineSource source2, CombineOperand operand2)
 Specifies any of the CombineMode values that represent a one-parameter operation.
 setCombineRgb (CombineMode mode, CombineSource source0, CombineOperand operand0)
 Specifies any of the CombineMode values that represent a one-parameter operation.
 setCombineRgb (CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1)
 Specifies any of the CombineMode values that represent a two-parameter operation.
 setCombineRgb (CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1, CombineSource source2, CombineOperand operand2)
 Specifies any of the CombineMode values that represent a one-parameter operation.
 setMode (Mode mode)
 Set the mode of this texture stage.
 setName (string name)
 Changes the name of this texture stage.
 setPriority (int priority)
 Changes the relative importance of the texture associated with this stage relative to the other texture stages that are applied simultaneously.
 setRgbScale (int rgb_scale)
 Sets an additional factor that will scale all three r, g, b components after the texture has been applied.
 setSavedResult (bool saved_result)
 Sets the saved_result flag.
 setSort (int sort)
 Changes the order in which the texture associated with this stage is rendered relative to the other texture stages.
 setTexcoordName (InternalName name)
 Indicate which set of UV's this texture stage will use.
 setTexcoordName (string texcoord_name)
 Indicate which set of UV's this texture stage will use.
 setTexViewOffset (int tex_view_offset)
 Sets the tex_view_offset value.
bool usesColor ()
 Returns true if the TextureStage makes use of whatever color is specified in set_color(), false otherwise.
bool usesLastSavedResult ()
 Returns true if the TextureStage makes use of the CS_primary_color combine source.
bool usesPrimaryColor ()
 Returns true if the TextureStage makes use of the CS_primary_color combine source.
 write (ostream out)
 Writes the details of this stage.

Static Public Member Functions

static TypeHandle getClassType ()
static TextureStage getDefault ()
 Returns the default TextureStage that will be used for all texturing that does not name a particular stage.

Detailed Description

Defines the properties of a named stage of the multitexture pipeline.

The TextureAttrib will associated a number of these stages with Texture objects, and the GSG will render geometry by sorting all of the currently active TextureStages in order and then issuing the appropriate rendering calls to activate them.


Member Enumeration Documentation

Enumerator:
CMUndefined 
CMReplace 
CMModulate 
CMAdd 
CMAddSigned 
CMInterpolate 
CMSubtract 
CMDot3Rgb 
CMDot3Rgba 
Enumerator:
COUndefined 
COSrcColor 
COOneMinusSrcColor 
COSrcAlpha 
COOneMinusSrcAlpha 
Enumerator:
CSUndefined 
CSTexture 
CSConstant 
CSPrimaryColor 
CSPrevious 
CSConstantColorScale 
CSLastSavedResult 
enum Mode
Enumerator:
MModulate 
MDecal 
MBlend 
MReplace 
MAdd 
MCombine 
MBlendColorScale 
MModulateGlow 
MModulateGloss 
MNormal 
MNormalHeight 
MGlow 
MGloss 
MHeight 
MSelector 
MNormalGloss 

Constructor & Destructor Documentation

Initialize the texture stage from other.

TextureStage ( string  name)

Initialize the texture stage at construction.


Member Function Documentation

int compareTo ( TextureStage const  other)

Returns a number less than zero if this TextureStage sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

The sorting order is arbitrary and largely meaningless, except to differentiate different stages.

See set_alpha_scale().

static TypeHandle getClassType ( ) [static]

Reimplemented from TypedWritableReferenceCount.

return the color for this stage

Get combine_alpha_mode.

Get operand0 of combine_alpha_mode.

Get operand1 of combine_alpha_mode.

Get operand2 of combine_alpha_mode.

Get source0 of combine_alpha_mode.

Get source1 of combine_alpha_mode.

Get source2 of combine_alpha_mode.

Get the combine_rgb_mode.

Get operand0 of combine_rgb_mode.

Get operand1 of combine_rgb_mode.

Get operand2 of combine_rgb_mode.

Get source0 of combine_rgb_mode.

Get source1 of combine_rgb_mode.

Get source2 of combine_rgb_mode.

static TextureStage getDefault ( ) [static]

Returns the default TextureStage that will be used for all texturing that does not name a particular stage.

This generally handles the normal single-texture case.

Return the mode of this stage.

string getName ( )

Returns the name of this texture stage.

Returns the number of meaningful operands that may be retrieved via get_combine_alpha_sourceN() and get_combine_alpha_operandN().

Returns the number of meaningful operands that may be retrieved via get_combine_rgb_sourceN() and get_combine_rgb_operandN().

Returns the priority associated with this stage.

This is specially helpful for cards that do not support more than n stages of multi-texturing.

See set_rgb_scale().

bool getSavedResult ( )

Returns the current setting of the saved_result flag.

See set_saved_result().

int getSort ( )

Returns the sort order of this texture stage.

Returns the InternalName.

Returns the current setting of the tex_view_offset.

See set_tex_view_offset().

Returns true if the TextureStage is affected by the setting of the current ColorScaleAttrib, false otherwise.

bool isFixedFunction ( )

Returns true if the TextureStage is relevant to the classic fixed function pipeline.

This excludes texture stages such as normal mapping and the like.

bool operator!= ( TextureStage const  other)
bool operator< ( TextureStage const  other)
TextureStage operator= ( TextureStage const  copy)

just copy the members of other to this

bool operator== ( TextureStage const  other)
output ( ostream  out)

Just a single line output.

setAlphaScale ( int  alpha_scale)

Sets an additional factor that will scale the alpha component after the texture has been applied.

This is used only when the mode is CM_combine.

The only legal values are 1, 2, or 4.

setColor ( VBase4 const  color)

Set the color for this stage.

setCombineAlpha ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0 
)

Specifies any of the CombineMode values that represent a one-parameter operation.

Specifically, this is CM_replace only.

setCombineAlpha ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0,
CombineSource  source1,
CombineOperand  operand1 
)

Specifies any of the CombineMode values that represent a two-parameter operation.

Specifically, this is everything except for CM_replace and CM_interpolate.

setCombineAlpha ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0,
CombineSource  source1,
CombineOperand  operand1,
CombineSource  source2,
CombineOperand  operand2 
)

Specifies any of the CombineMode values that represent a one-parameter operation.

Specifically, this is CM_interpolate only.

setCombineRgb ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0 
)

Specifies any of the CombineMode values that represent a one-parameter operation.

Specifically, this is CM_replace only.

setCombineRgb ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0,
CombineSource  source1,
CombineOperand  operand1 
)

Specifies any of the CombineMode values that represent a two-parameter operation.

Specifically, this is everything except for CM_replace and CM_interpolate.

setCombineRgb ( CombineMode  mode,
CombineSource  source0,
CombineOperand  operand0,
CombineSource  source1,
CombineOperand  operand1,
CombineSource  source2,
CombineOperand  operand2 
)

Specifies any of the CombineMode values that represent a one-parameter operation.

Specifically, this is CM_interpolate only.

setMode ( Mode  mode)

Set the mode of this texture stage.

setName ( string  name)

Changes the name of this texture stage.

setPriority ( int  priority)

Changes the relative importance of the texture associated with this stage relative to the other texture stages that are applied simultaneously.

This is unrelated to set_sort(), which controls the order in which multiple textures are applied. The priority number is used to decide which of the requested textures are to be selected for rendering when more textures are requested than the hardware will support. The highest-priority n textures are selected for rendering, and then rendered in order by their sort factor.

setRgbScale ( int  rgb_scale)

Sets an additional factor that will scale all three r, g, b components after the texture has been applied.

This is used only when the mode is CM_combine.

The only legal values are 1, 2, or 4.

setSavedResult ( bool  saved_result)

Sets the saved_result flag.

When this is true, the output of this stage will be supplied as the "last_saved_result" source for any future stages, until the next TextureStage with a saved_result set true is encountered.

This can be used to reuse the results of this texture stage as input to more than one stage later in the pipeline.

The last texture in the pipeline (the one with the highest sort value) should not have this flag set.

setSort ( int  sort)

Changes the order in which the texture associated with this stage is rendered relative to the other texture stages.

When geometry is rendered with multiple textures, the textures are rendered in order from the lowest sort number to the highest sort number.

Also see set_priority(), which is used to select the most important textures for rendering when some must be omitted because of hardware limitations.

Indicate which set of UV's this texture stage will use.

Geometry may have any number of associated UV sets, each of which must have a unique name.

setTexcoordName ( string  texcoord_name)

Indicate which set of UV's this texture stage will use.

Geometry may have any number of associated UV sets, each of which must have a unique name.

setTexViewOffset ( int  tex_view_offset)

Sets the tex_view_offset value.

This is used only when a special multiview texture is bound to the TextureStage, and it selects the particular view of the texture that is to be used.

This value is added to the similar parameter on DisplayRegion to derive the final texture view index that is selected for rendering.

bool usesColor ( )

Returns true if the TextureStage makes use of whatever color is specified in set_color(), false otherwise.

Returns true if the TextureStage makes use of the CS_primary_color combine source.

bool usesPrimaryColor ( )

Returns true if the TextureStage makes use of the CS_primary_color combine source.

write ( ostream  out)

Writes the details of this stage.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties