TextureStage

from panda3d.core import TextureStage
class TextureStage

Bases:

Bases: TypedWritableReferenceCount

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.

Inheritance diagram

Inheritance diagram of TextureStage

enum CombineMode
enumerator CM_undefined = 0
enumerator CM_replace = 1
enumerator CM_modulate = 2
enumerator CM_add = 3
enumerator CM_add_signed = 4
enumerator CM_interpolate = 5
enumerator CM_subtract = 6
enumerator CM_dot3_rgb = 7

The following are valid only for combine_rgb, not combine_alpha.

enumerator CM_dot3_rgba = 8
enum CombineOperand
enumerator CO_undefined = 0
enumerator CO_src_color = 1
enumerator CO_one_minus_src_color = 2
enumerator CO_src_alpha = 3
enumerator CO_one_minus_src_alpha = 4
enum CombineSource
enumerator CS_undefined = 0
enumerator CS_texture = 1
enumerator CS_constant = 2
enumerator CS_primary_color = 3
enumerator CS_previous = 4
enumerator CS_constant_color_scale = 5
enumerator CS_last_saved_result = 6
enum Mode
enumerator M_modulate = 0
enumerator M_decal = 1
enumerator M_blend = 2
enumerator M_replace = 3
enumerator M_add = 4
enumerator M_combine = 5
enumerator M_blend_color_scale = 6
enumerator M_modulate_glow = 7

When fixed-function, equivalent to modulate.

enumerator M_modulate_gloss = 8

When fixed-function, equivalent to modulate.

enumerator M_normal = 9
enumerator M_normal_height = 10
enumerator M_glow = 11

Rarely used: modulate_glow is more efficient.

enumerator M_gloss = 12

Rarely used: modulate_gloss is more efficient.

enumerator M_height = 13

Rarely used: normal_height is more efficient.

enumerator M_selector = 14
enumerator M_normal_gloss = 15
enumerator M_emission = 16
__eq__(other: TextureStage) bool
__init__(copy: TextureStage)

Initialize the texture stage from other

__init__(name: str)

Initialize the texture stage at construction

__lt__(other: TextureStage) bool
__ne__(other: TextureStage) bool
property alpha_scale int

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.

assign(copy: TextureStage) TextureStage
property binormal_name InternalName

Returns the set of binormals this texture stage will use. This is the same as getBinormalName(), except that the first part is “binormal”.

property color LColor

return/Set the color for this stage

compareTo(other: TextureStage) int

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.

property default TextureStage

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.

getAlphaScale() int

See setAlphaScale().

getBinormalName() InternalName

Returns the set of binormals this texture stage will use. This is the same as getBinormalName(), except that the first part is “binormal”.

static getClassType() TypeHandle
getColor() LColor

return the color for this stage

getCombineAlphaMode() CombineMode

Get combine_alpha_mode

getCombineAlphaOperand0() CombineOperand

Get operand0 of combine_alpha_mode

getCombineAlphaOperand1() CombineOperand

Get operand1 of combine_alpha_mode

getCombineAlphaOperand2() CombineOperand

Get operand2 of combine_alpha_mode

getCombineAlphaSource0() CombineSource

Get source0 of combine_alpha_mode

getCombineAlphaSource1() CombineSource

Get source1 of combine_alpha_mode

getCombineAlphaSource2() CombineSource

Get source2 of combine_alpha_mode

getCombineRgbMode() CombineMode

Get the combine_rgb_mode

getCombineRgbOperand0() CombineOperand

Get operand0 of combine_rgb_mode

getCombineRgbOperand1() CombineOperand

Get operand1 of combine_rgb_mode

getCombineRgbOperand2() CombineOperand

Get operand2 of combine_rgb_mode

getCombineRgbSource0() CombineSource

Get source0 of combine_rgb_mode

getCombineRgbSource1() CombineSource

Get source1 of combine_rgb_mode

getCombineRgbSource2() CombineSource

Get source2 of combine_rgb_mode

static getDefault() TextureStage

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

Return the mode of this stage

getName() str

Returns the name of this texture stage

getNumCombineAlphaOperands() int

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

getNumCombineRgbOperands() int

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

getPriority() int

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

See setRgbScale().

getSavedResult() bool

Returns the current setting of the saved_result flag. See setSavedResult().

getSort() int

Returns the sort order of this texture stage.

getTangentName() InternalName

Returns the set of tangents this texture stage will use. This is the same as getTexcoordName(), except that the first part is “tangent”.

getTexViewOffset() int

Returns the current setting of the tex_view_offset. See setTexViewOffset().

getTexcoordName() InternalName

See setTexcoordName(). The default is InternalName.getTexcoord().

involvesColorScale() bool

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

isFixedFunction() bool

Returns true if the TextureStage is relevant to the classic fixed function pipeline. This excludes texture stages such as normal mapping and the like.

property mode Mode
Getter

Return the mode of this stage

Setter

Set the mode of this texture stage

property name string

Returns/Changes the name of this texture stage

output(out: ostream)

Just a single line output

property priority int
Getter

Returns the priority associated with this stage.

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

Setter

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 setSort(), 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.

property rgb_scale int

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.

property saved_result bool
Getter

Returns the current setting of the saved_result flag. See setSavedResult().

Setter

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.

setAlphaScale(alpha_scale: int)

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(color: LColor)

Set the color for this stage

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

Specifies any of the CombineMode values that represent a one-parameter operation. Specifically, this is CM_replace only.

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

Specifies any of the CombineMode values that represent a two-parameter operation. Specifically, this is everything except for CM_replace and CM_interpolate.

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

Specifies any of the CombineMode values that represent a one-parameter operation. Specifically, this is CM_interpolate only.

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

Specifies any of the CombineMode values that represent a one-parameter operation. Specifically, this is CM_replace only.

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

Specifies any of the CombineMode values that represent a two-parameter operation. Specifically, this is everything except for CM_replace and CM_interpolate.

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

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(name: str)

Changes the name of this texture stage

setPriority(priority: int)

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 setSort(), 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(rgb_scale: int)

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(saved_result: bool)

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(sort: int)

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 setPriority(), which is used to select the most important textures for rendering when some must be omitted because of hardware limitations.

setTexViewOffset(tex_view_offset: int)

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.

setTexcoordName(name: InternalName)

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(texcoord_name: str)

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.

property sort int
Getter

Returns the sort order of this texture stage.

Setter

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 setPriority(), which is used to select the most important textures for rendering when some must be omitted because of hardware limitations.

property tangent_name InternalName

Returns the set of tangents this texture stage will use. This is the same as getTexcoordName(), except that the first part is “tangent”.

property tex_view_offset int
Getter

Returns the current setting of the tex_view_offset. See setTexViewOffset().

Setter

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.

property texcoord_name InternalName
Getter

See setTexcoordName(). The default is InternalName.getTexcoord().

Setter

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.

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.

usesColor() bool

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

usesLastSavedResult() bool

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

usesPrimaryColor() bool

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

write(out: ostream)

Writes the details of this stage

write(out: ostream, indent_level: int)

Writes the details of this stage