Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TextureStage Class Reference

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

Inheritance diagram for TextureStage:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

Public Types

enum  CombineMode {
  CM_undefined = 0, CM_replace = 1, CM_modulate = 2, CM_add = 3,
  CM_add_signed = 4, CM_interpolate = 5, CM_subtract = 6, CM_dot3_rgb = 7,
  CM_dot3_rgba = 8
}
 
enum  CombineOperand {
  CO_undefined = 0, CO_src_color = 1, CO_one_minus_src_color = 2, CO_src_alpha = 3,
  CO_one_minus_src_alpha = 4
}
 
enum  CombineSource {
  CS_undefined = 0, CS_texture = 1, CS_constant = 2, CS_primary_color = 3,
  CS_previous = 4, CS_constant_color_scale = 5, CS_last_saved_result = 6
}
 
enum  Mode {
  M_modulate = 0, M_decal = 1, M_blend = 2, M_replace = 3,
  M_add = 4, M_combine = 5, M_blend_color_scale = 6, M_modulate_glow = 7,
  M_modulate_gloss = 8, M_normal = 9, M_normal_height = 10, M_glow = 11,
  M_gloss = 12, M_height = 13, M_selector = 14, M_normal_gloss = 15
}
 

Public Member Functions

 __init__ (const TextureStage copy)
 Initialize the texture stage from other. More...
 
 __init__ (str name)
 Initialize the texture stage at construction. More...
 
int compareTo (const TextureStage 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. More...
 
int getAlphaScale ()
 See set_alpha_scale(). More...
 
InternalName getBinormalName ()
 Returns the set of binormals this texture stage will use. More...
 
LColor getColor ()
 return the color for this stage More...
 
TextureStage::CombineMode getCombineAlphaMode ()
 Get combine_alpha_mode. More...
 
TextureStage::CombineOperand getCombineAlphaOperand0 ()
 Get operand0 of combine_alpha_mode. More...
 
TextureStage::CombineOperand getCombineAlphaOperand1 ()
 Get operand1 of combine_alpha_mode. More...
 
TextureStage::CombineOperand getCombineAlphaOperand2 ()
 Get operand2 of combine_alpha_mode. More...
 
TextureStage::CombineSource getCombineAlphaSource0 ()
 Get source0 of combine_alpha_mode. More...
 
TextureStage::CombineSource getCombineAlphaSource1 ()
 Get source1 of combine_alpha_mode. More...
 
TextureStage::CombineSource getCombineAlphaSource2 ()
 Get source2 of combine_alpha_mode. More...
 
TextureStage::CombineMode getCombineRgbMode ()
 Get the combine_rgb_mode. More...
 
TextureStage::CombineOperand getCombineRgbOperand0 ()
 Get operand0 of combine_rgb_mode. More...
 
TextureStage::CombineOperand getCombineRgbOperand1 ()
 Get operand1 of combine_rgb_mode. More...
 
TextureStage::CombineOperand getCombineRgbOperand2 ()
 Get operand2 of combine_rgb_mode. More...
 
TextureStage::CombineSource getCombineRgbSource0 ()
 Get source0 of combine_rgb_mode. More...
 
TextureStage::CombineSource getCombineRgbSource1 ()
 Get source1 of combine_rgb_mode. More...
 
TextureStage::CombineSource getCombineRgbSource2 ()
 Get source2 of combine_rgb_mode. More...
 
TextureStage::Mode getMode ()
 Return the mode of this stage. More...
 
str getName ()
 Returns the name of this texture stage. More...
 
int getNumCombineAlphaOperands ()
 Returns the number of meaningful operands that may be retrieved via get_combine_alpha_sourceN() and get_combine_alpha_operandN(). More...
 
int getNumCombineRgbOperands ()
 Returns the number of meaningful operands that may be retrieved via get_combine_rgb_sourceN() and get_combine_rgb_operandN(). More...
 
int getPriority ()
 Returns the priority associated with this stage. More...
 
int getRgbScale ()
 See set_rgb_scale(). More...
 
bool getSavedResult ()
 Returns the current setting of the saved_result flag. More...
 
int getSort ()
 Returns the sort order of this texture stage. More...
 
InternalName getTangentName ()
 Returns the set of tangents this texture stage will use. More...
 
InternalName getTexcoordName ()
 See set_texcoord_name. More...
 
int getTexViewOffset ()
 Returns the current setting of the tex_view_offset. More...
 
bool involvesColorScale ()
 Returns true if the TextureStage is affected by the setting of the current ColorScaleAttrib, false otherwise. More...
 
bool isFixedFunction ()
 Returns true if the TextureStage is relevant to the classic fixed function pipeline. More...
 
bool operator != (const TextureStage other)
 
bool operator< (const TextureStage other)
 
TextureStage operator= (const TextureStage copy)
 
bool operator== (const TextureStage other)
 
 output (Ostream out)
 Just a single line output. More...
 
 setAlphaScale (int alpha_scale)
 Sets an additional factor that will scale the alpha component after the texture has been applied. More...
 
 setColor (const LColor color)
 Set the color for this stage. More...
 
 setCombineAlpha (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0)
 Specifies any of the CombineMode values that represent a one-parameter operation. More...
 
 setCombineAlpha (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0, TextureStage::CombineSource source1, TextureStage::CombineOperand operand1)
 Specifies any of the CombineMode values that represent a two-parameter operation. More...
 
 setCombineAlpha (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0, TextureStage::CombineSource source1, TextureStage::CombineOperand operand1, TextureStage::CombineSource source2, TextureStage::CombineOperand operand2)
 Specifies any of the CombineMode values that represent a one-parameter operation. More...
 
 setCombineRgb (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0)
 Specifies any of the CombineMode values that represent a one-parameter operation. More...
 
 setCombineRgb (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0, TextureStage::CombineSource source1, TextureStage::CombineOperand operand1)
 Specifies any of the CombineMode values that represent a two-parameter operation. More...
 
 setCombineRgb (TextureStage::CombineMode mode, TextureStage::CombineSource source0, TextureStage::CombineOperand operand0, TextureStage::CombineSource source1, TextureStage::CombineOperand operand1, TextureStage::CombineSource source2, TextureStage::CombineOperand operand2)
 Specifies any of the CombineMode values that represent a one-parameter operation. More...
 
 setMode (TextureStage::Mode mode)
 Set the mode of this texture stage. More...
 
 setName (str name)
 Changes the name of this texture stage. More...
 
 setPriority (int priority)
 Changes the relative importance of the texture associated with this stage relative to the other texture stages that are applied simultaneously. More...
 
 setRgbScale (int rgb_scale)
 Sets an additional factor that will scale all three r, g, b components after the texture has been applied. More...
 
 setSavedResult (bool saved_result)
 Sets the saved_result flag. More...
 
 setSort (int sort)
 Changes the order in which the texture associated with this stage is rendered relative to the other texture stages. More...
 
 setTexcoordName (InternalName name)
 Indicate which set of UV's this texture stage will use. More...
 
 setTexcoordName (str texcoord_name)
 Indicate which set of UV's this texture stage will use. More...
 
 setTexViewOffset (int tex_view_offset)
 Sets the tex_view_offset value. More...
 
bool usesColor ()
 Returns true if the TextureStage makes use of whatever color is specified in set_color(), false otherwise. More...
 
bool usesLastSavedResult ()
 Returns true if the TextureStage makes use of the CS_primary_color combine source. More...
 
bool usesPrimaryColor ()
 Returns true if the TextureStage makes use of the CS_primary_color combine source. More...
 
 write (Ostream out)
 Writes the details of this stage. More...
 
- Public Member Functions inherited from TypedWritable
object __reduce__ ()
 
object __reduce_persist__ (object pickler)
 
VectorUchar encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encodeToBamStream (VectorUchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
 fillin (DatagramIterator scan, BamReader manager)
 This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
 
UpdateSeq getBamModified ()
 Returns the current bam_modified counter. More...
 
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

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. More...
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypedWritableReferenceCount decodeFromBamStream (VectorUchar data, BamReader reader)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritable
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Public Attributes

int alpha_scale
 See set_alpha_scale(). More...
 
InternalName binormal_name
 Returns the set of binormals this texture stage will use. More...
 
LColor color
 return the color for this stage More...
 
TextureStage default
 Returns the default TextureStage that will be used for all texturing that does not name a particular stage. More...
 
TextureStage::Mode mode
 Return the mode of this stage. More...
 
const String name
 Returns the name of this texture stage. More...
 
int priority
 Returns the priority associated with this stage. More...
 
int rgb_scale
 See set_rgb_scale(). More...
 
bool saved_result
 Returns the current setting of the saved_result flag. More...
 
int sort
 Returns the sort order of this texture stage. More...
 
InternalName tangent_name
 Returns the set of tangents this texture stage will use. More...
 
int tex_view_offset
 Returns the current setting of the tex_view_offset. More...
 
InternalName texcoord_name
 See set_texcoord_name. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

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

◆ CombineMode

Enumerator
CM_undefined 
CM_replace 
CM_modulate 
CM_add 
CM_add_signed 
CM_interpolate 
CM_subtract 
CM_dot3_rgb 

The following are valid only for combine_rgb, not combine_alpha.

CM_dot3_rgba 

◆ CombineOperand

Enumerator
CO_undefined 
CO_src_color 
CO_one_minus_src_color 
CO_src_alpha 
CO_one_minus_src_alpha 

◆ CombineSource

Enumerator
CS_undefined 
CS_texture 
CS_constant 
CS_primary_color 
CS_previous 
CS_constant_color_scale 
CS_last_saved_result 

◆ Mode

enum Mode
Enumerator
M_modulate 
M_decal 
M_blend 
M_replace 
M_add 
M_combine 
M_blend_color_scale 
M_modulate_glow 

When fixed-function, equivalent to modulate.

M_modulate_gloss 

When fixed-function, equivalent to modulate.

M_normal 
M_normal_height 
M_glow 

Rarely used: modulate_glow is more efficient.

M_gloss 

Rarely used: modulate_gloss is more efficient.

M_height 

Rarely used: normal_height is more efficient.

M_selector 
M_normal_gloss 

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const TextureStage  copy)

Initialize the texture stage from other.

◆ __init__() [2/2]

__init__ ( str  name)

Initialize the texture stage at construction.

◆ compareTo()

int compareTo ( const TextureStage  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.

◆ getAlphaScale()

int getAlphaScale ( )

See set_alpha_scale().

◆ getBinormalName()

InternalName getBinormalName ( )

Returns the set of binormals this texture stage will use.

This is the same as get_binormal_name(), except that the first part is "binormal".

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getColor()

LColor getColor ( )

return the color for this stage

◆ getCombineAlphaMode()

TextureStage::CombineMode getCombineAlphaMode ( )

Get combine_alpha_mode.

◆ getCombineAlphaOperand0()

TextureStage::CombineOperand getCombineAlphaOperand0 ( )

Get operand0 of combine_alpha_mode.

◆ getCombineAlphaOperand1()

TextureStage::CombineOperand getCombineAlphaOperand1 ( )

Get operand1 of combine_alpha_mode.

◆ getCombineAlphaOperand2()

TextureStage::CombineOperand getCombineAlphaOperand2 ( )

Get operand2 of combine_alpha_mode.

◆ getCombineAlphaSource0()

TextureStage::CombineSource getCombineAlphaSource0 ( )

Get source0 of combine_alpha_mode.

◆ getCombineAlphaSource1()

TextureStage::CombineSource getCombineAlphaSource1 ( )

Get source1 of combine_alpha_mode.

◆ getCombineAlphaSource2()

TextureStage::CombineSource getCombineAlphaSource2 ( )

Get source2 of combine_alpha_mode.

◆ getCombineRgbMode()

TextureStage::CombineMode getCombineRgbMode ( )

Get the combine_rgb_mode.

◆ getCombineRgbOperand0()

TextureStage::CombineOperand getCombineRgbOperand0 ( )

Get operand0 of combine_rgb_mode.

◆ getCombineRgbOperand1()

TextureStage::CombineOperand getCombineRgbOperand1 ( )

Get operand1 of combine_rgb_mode.

◆ getCombineRgbOperand2()

TextureStage::CombineOperand getCombineRgbOperand2 ( )

Get operand2 of combine_rgb_mode.

◆ getCombineRgbSource0()

TextureStage::CombineSource getCombineRgbSource0 ( )

Get source0 of combine_rgb_mode.

◆ getCombineRgbSource1()

TextureStage::CombineSource getCombineRgbSource1 ( )

Get source1 of combine_rgb_mode.

◆ getCombineRgbSource2()

TextureStage::CombineSource getCombineRgbSource2 ( )

Get source2 of combine_rgb_mode.

◆ getDefault()

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.

◆ getMode()

TextureStage::Mode getMode ( )

Return the mode of this stage.

◆ getName()

str getName ( )

Returns the name of this texture stage.

◆ getNumCombineAlphaOperands()

int getNumCombineAlphaOperands ( )

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

◆ getNumCombineRgbOperands()

int getNumCombineRgbOperands ( )

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

◆ getPriority()

int getPriority ( )

Returns the priority associated with this stage.

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

◆ getRgbScale()

int getRgbScale ( )

See set_rgb_scale().

◆ getSavedResult()

bool getSavedResult ( )

Returns the current setting of the saved_result flag.

See set_saved_result().

◆ getSort()

int getSort ( )

Returns the sort order of this texture stage.

◆ getTangentName()

InternalName getTangentName ( )

Returns the set of tangents this texture stage will use.

This is the same as get_texcoord_name(), except that the first part is "tangent".

◆ getTexcoordName()

InternalName getTexcoordName ( )

See set_texcoord_name.

The default is InternalName::get_texcoord().

◆ getTexViewOffset()

int getTexViewOffset ( )

Returns the current setting of the tex_view_offset.

See set_tex_view_offset().

◆ involvesColorScale()

bool involvesColorScale ( )

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

◆ isFixedFunction()

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.

◆ operator !=()

bool operator != ( const TextureStage  other)

◆ operator<()

bool operator< ( const TextureStage  other)

◆ operator=()

TextureStage operator= ( const TextureStage  copy)

◆ operator==()

bool operator== ( const TextureStage  other)

◆ output()

output ( Ostream  out)

Just a single line output.

◆ setAlphaScale()

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()

setColor ( const LColor  color)

Set the color for this stage.

◆ setCombineAlpha() [1/3]

setCombineAlpha ( TextureStage::CombineMode  mode,
TextureStage::CombineSource  source0,
TextureStage::CombineOperand  operand0 
)

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

Specifically, this is CM_replace only.

◆ setCombineAlpha() [2/3]

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

Specifically, this is everything except for CM_replace and CM_interpolate.

◆ setCombineAlpha() [3/3]

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

Specifically, this is CM_interpolate only.

◆ setCombineRgb() [1/3]

setCombineRgb ( TextureStage::CombineMode  mode,
TextureStage::CombineSource  source0,
TextureStage::CombineOperand  operand0 
)

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

Specifically, this is CM_replace only.

◆ setCombineRgb() [2/3]

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

Specifically, this is everything except for CM_replace and CM_interpolate.

◆ setCombineRgb() [3/3]

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

Specifically, this is CM_interpolate only.

◆ setMode()

setMode ( TextureStage::Mode  mode)

Set the mode of this texture stage.

◆ setName()

setName ( str  name)

Changes the name of this texture stage.

◆ setPriority()

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()

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()

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()

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.

◆ setTexcoordName() [1/2]

setTexcoordName ( InternalName  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.

◆ setTexcoordName() [2/2]

setTexcoordName ( str  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()

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.

◆ usesColor()

bool usesColor ( )

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

◆ usesLastSavedResult()

bool usesLastSavedResult ( )

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

◆ usesPrimaryColor()

bool usesPrimaryColor ( )

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

◆ write()

write ( Ostream  out)

Writes the details of this stage.

Member Data Documentation

◆ alpha_scale

int alpha_scale

See set_alpha_scale().

◆ binormal_name

InternalName binormal_name

Returns the set of binormals this texture stage will use.

This is the same as get_binormal_name(), except that the first part is "binormal".

◆ color

LColor color

return the color for this stage

◆ default

TextureStage default

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.

◆ mode

Return the mode of this stage.

◆ name

const String name

Returns the name of this texture stage.

◆ priority

int priority

Returns the priority associated with this stage.

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

◆ rgb_scale

int rgb_scale

See set_rgb_scale().

◆ saved_result

bool saved_result

Returns the current setting of the saved_result flag.

See set_saved_result().

◆ sort

int sort

Returns the sort order of this texture stage.

◆ tangent_name

InternalName tangent_name

Returns the set of tangents this texture stage will use.

This is the same as get_texcoord_name(), except that the first part is "tangent".

◆ tex_view_offset

int tex_view_offset

Returns the current setting of the tex_view_offset.

See set_tex_view_offset().

◆ texcoord_name

InternalName texcoord_name

See set_texcoord_name.

The default is InternalName::get_texcoord().