panda3d.core.TextureStage

from panda3d.core import TextureStage
class TextureStage

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

__init__(copy: TextureStage) → None

Initialize the texture stage from other

__init__(name: str) → None

Initialize the texture stage at construction

assign(copy: TextureStage) → TextureStage
Return type

TextureStage

setName(name: str) → None

Changes the name of this texture stage

getName() → str

Returns the name of this texture stage

setSort(sort: int) → None

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.

getSort() → int

Returns the sort order of this texture stage.

setPriority(priority: int) → None

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.

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.

setTexcoordName(name: InternalName) → None

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) → None

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.

getTexcoordName() → InternalName

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

Return type

InternalName

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”.

Return type

InternalName

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”.

Return type

InternalName

setMode(mode: Mode) → None

Set the mode of this texture stage

getMode() → Mode

Return the mode of this stage

Return type

Mode

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.

setColor(color: LColor) → None

Set the color for this stage

getColor() → LColor

return the color for this stage

Return type

LColor

setRgbScale(rgb_scale: int) → None

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.

getRgbScale() → int

See setRgbScale().

setAlphaScale(alpha_scale: int) → None

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.

getAlphaScale() → int

See setAlphaScale().

setSavedResult(saved_result: bool) → None

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.

getSavedResult() → bool

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

setTexViewOffset(tex_view_offset: int) → None

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.

getTexViewOffset() → int

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

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

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) → None

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) → None

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

getCombineRgbMode() → CombineMode

Get the combine_rgb_mode

Return type

CombineMode

getNumCombineRgbOperands() → int

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

getCombineRgbSource0() → CombineSource

Get source0 of combine_rgb_mode

Return type

CombineSource

getCombineRgbOperand0() → CombineOperand

Get operand0 of combine_rgb_mode

Return type

CombineOperand

getCombineRgbSource1() → CombineSource

Get source1 of combine_rgb_mode

Return type

CombineSource

getCombineRgbOperand1() → CombineOperand

Get operand1 of combine_rgb_mode

Return type

CombineOperand

getCombineRgbSource2() → CombineSource

Get source2 of combine_rgb_mode

Return type

CombineSource

getCombineRgbOperand2() → CombineOperand

Get operand2 of combine_rgb_mode

Return type

CombineOperand

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

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) → None

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) → None

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

getCombineAlphaMode() → CombineMode

Get combine_alpha_mode

Return type

CombineMode

getNumCombineAlphaOperands() → int

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

getCombineAlphaSource0() → CombineSource

Get source0 of combine_alpha_mode

Return type

CombineSource

getCombineAlphaOperand0() → CombineOperand

Get operand0 of combine_alpha_mode

Return type

CombineOperand

getCombineAlphaSource1() → CombineSource

Get source1 of combine_alpha_mode

Return type

CombineSource

getCombineAlphaOperand1() → CombineOperand

Get operand1 of combine_alpha_mode

Return type

CombineOperand

getCombineAlphaSource2() → CombineSource

Get source2 of combine_alpha_mode

Return type

CombineSource

getCombineAlphaOperand2() → CombineOperand

Get operand2 of combine_alpha_mode

Return type

CombineOperand

involvesColorScale() → bool

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

usesColor() → bool

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

usesPrimaryColor() → bool

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

usesLastSavedResult() → bool

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

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.

write(out: ostream) → None

Writes the details of this stage

output(out: ostream) → None

Just a single line output

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.

Return type

TextureStage

static getClassType() → TypeHandle
Return type

TypeHandle

property name
Getter

Returns the name of this texture stage

Setter

Changes the name of this texture stage

Return type

string

property sort
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.

Return type

int

property priority
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.

Return type

int

property texcoord_name
Getter

See set_texcoord_name. 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.

Return type

InternalName

property tangent_name

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

Return type

InternalName

property binormal_name

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

Return type

InternalName

property mode
Getter

Return the mode of this stage

Setter

Set the mode of this texture stage

Return type

Mode

property color
Getter

return the color for this stage

Setter

Set the color for this stage

Return type

LColor

property rgb_scale
Getter

See setRgbScale().

Setter

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.

Return type

int

property alpha_scale
Getter

See setAlphaScale().

Setter

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.

Return type

int

property saved_result
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.

Return type

bool

property tex_view_offset
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.

Return type

int

property 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.

Return type

TextureStage

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