Panda3D
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 MemoryBase MemoryBase

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
}

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.
string encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
bool encodeToBamStream (basic_stringchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
bool encodeToBamStream (basic_stringchar data)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
int getAlphaScale ()
 See set_alpha_scale().
UpdateSeq getBamModified ()
 Returns the current bam_modified counter.
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 getRefCount ()
 Returns the current reference count.
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.
TypeHandle getType ()
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool involvesColorScale ()
 Returns true if the TextureStage is affected by the setting of the current ColorScaleAttrib, false otherwise.
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly.
bool isFixedFunction ()
 Returns true if the TextureStage is relevant to the classic fixed function pipeline.
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type.
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
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.
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
PyObject reducePersist (PyObject self, PyObject pickler)
 This special Python method is implement to provide support for the pickle module.
 ref ()
 Explicitly increments the reference count.
 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, CombineSource source1, CombineOperand operand1, CombineSource source2, CombineOperand operand2)
 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)
 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)
 Specifies any of the CombineMode values that represent a one-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 (string texcoord_name)
 Indicate which set of UV's this texture stage will use.
 setTexcoordName (InternalName name)
 Indicate which set of UV's this texture stage will use.
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool unref ()
 Explicitly decrements the reference count.
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 TypedWritableReferenceCount decodeFromBamStream (string data, BamReader reader)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
static TypedWritableReferenceCount decodeFromBamStream (string data)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
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 

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.

static TypedWritableReferenceCount decodeFromBamStream ( string  data,
BamReader  reader 
) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

static TypedWritableReferenceCount decodeFromBamStream ( string  data) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

bool encodeToBamStream ( basic_stringchar  data) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

string encodeToBamStream ( ) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.

Returns empty string on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool encodeToBamStream ( basic_stringchar  data,
BamWriter  writer 
) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

int getAlphaScale ( )

See set_alpha_scale().

UpdateSeq getBamModified ( ) [inherited]

Returns the current bam_modified counter.

This counter is normally incremented automatically whenever the object is modified.

static TypeHandle getClassType ( ) [static]

Reimplemented from TypedWritableReferenceCount.

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.

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.

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.

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

int getRefCount ( ) [inherited]

Returns the current reference count.

int getRgbScale ( )

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.

InternalName getTexcoordName ( )

Returns the InternalName.

TypeHandle getType ( ) [inherited]

Reimplemented in AnimChannelBase.

int getTypeIndex ( ) [inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

bool involvesColorScale ( )

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

bool isExactType ( TypeHandle  handle) [inherited]

Returns true if the current object is the indicated type exactly.

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 isOfType ( TypeHandle  handle) [inherited]

Returns true if the current object is or derives from the indicated type.

markBamModified ( ) [inherited]

Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.

This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.

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.

PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.

PyObject reducePersist ( PyObject  self,
PyObject  pickler 
) [inherited]

This special Python method is implement to provide support for the pickle module.

This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.

ref ( ) [inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

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.

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.

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.

bool testRefCountIntegrity ( ) [inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

bool testRefCountNonzero ( ) [inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

bool unref ( ) [inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.

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.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties