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 get_binormal_name(), except that the first part is “binormal”.

property color LColor

return/Set the color for this stage

compare_to(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.

get_alpha_scale() int

See set_alpha_scale().

get_binormal_name() InternalName

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

static get_class_type() TypeHandle
get_color() LColor

return the color for this stage

get_combine_alpha_mode() CombineMode

Get combine_alpha_mode

get_combine_alpha_operand0() CombineOperand

Get operand0 of combine_alpha_mode

get_combine_alpha_operand1() CombineOperand

Get operand1 of combine_alpha_mode

get_combine_alpha_operand2() CombineOperand

Get operand2 of combine_alpha_mode

get_combine_alpha_source0() CombineSource

Get source0 of combine_alpha_mode

get_combine_alpha_source1() CombineSource

Get source1 of combine_alpha_mode

get_combine_alpha_source2() CombineSource

Get source2 of combine_alpha_mode

get_combine_rgb_mode() CombineMode

Get the combine_rgb_mode

get_combine_rgb_operand0() CombineOperand

Get operand0 of combine_rgb_mode

get_combine_rgb_operand1() CombineOperand

Get operand1 of combine_rgb_mode

get_combine_rgb_operand2() CombineOperand

Get operand2 of combine_rgb_mode

get_combine_rgb_source0() CombineSource

Get source0 of combine_rgb_mode

get_combine_rgb_source1() CombineSource

Get source1 of combine_rgb_mode

get_combine_rgb_source2() CombineSource

Get source2 of combine_rgb_mode

static get_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.

get_mode() Mode

Return the mode of this stage

get_name() str

Returns the name of this texture stage

get_num_combine_alpha_operands() int

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

get_num_combine_rgb_operands() int

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

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

get_rgb_scale() int

See set_rgb_scale().

get_saved_result() bool

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

get_sort() int

Returns the sort order of this texture stage.

get_tangent_name() InternalName

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

get_tex_view_offset() int

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

get_texcoord_name() InternalName

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

involves_color_scale() bool

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

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

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

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.

set_alpha_scale(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.

set_color(color: LColor)

Set the color for this stage

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

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

set_combine_alpha(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.

set_combine_alpha(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.

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

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

set_combine_rgb(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.

set_combine_rgb(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.

set_mode(mode: Mode)

Set the mode of this texture stage

set_name(name: str)

Changes the name of this texture stage

set_priority(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 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.

set_rgb_scale(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.

set_saved_result(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.

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

set_tex_view_offset(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.

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

set_texcoord_name(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 set_priority(), 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 get_texcoord_name(), except that the first part is “tangent”.

property tex_view_offset int
Getter

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

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 set_texcoord_name(). The default is InternalName.get_texcoord().

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.

uses_color() bool

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

uses_last_saved_result() bool

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

uses_primary_color() bool

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

write(out: ostream, indent_level: int)

Writes the details of this stage