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
-
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
-
enumerator CM_undefined = 0
-
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
-
enumerator CO_undefined = 0
-
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
-
enumerator CS_undefined = 0
-
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
-
enumerator M_modulate = 0
-
explicit TextureStage(std::string const &name)
-
TextureStage(TextureStage const ©)
Initialize the texture stage from other
Initialize the texture stage at construction
-
int compare_to(TextureStage const &other) const
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.
-
int get_alpha_scale(void) const
See
set_alpha_scale()
.
-
InternalName *get_binormal_name(void) const
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 TypeHandle get_class_type(void)
-
CombineMode get_combine_alpha_mode(void) const
Get combine_alpha_mode
-
CombineOperand get_combine_alpha_operand0(void) const
Get operand0 of combine_alpha_mode
-
CombineOperand get_combine_alpha_operand1(void) const
Get operand1 of combine_alpha_mode
-
CombineOperand get_combine_alpha_operand2(void) const
Get operand2 of combine_alpha_mode
-
CombineSource get_combine_alpha_source0(void) const
Get source0 of combine_alpha_mode
-
CombineSource get_combine_alpha_source1(void) const
Get source1 of combine_alpha_mode
-
CombineSource get_combine_alpha_source2(void) const
Get source2 of combine_alpha_mode
-
CombineMode get_combine_rgb_mode(void) const
Get the combine_rgb_mode
-
CombineOperand get_combine_rgb_operand0(void) const
Get operand0 of combine_rgb_mode
-
CombineOperand get_combine_rgb_operand1(void) const
Get operand1 of combine_rgb_mode
-
CombineOperand get_combine_rgb_operand2(void) const
Get operand2 of combine_rgb_mode
-
CombineSource get_combine_rgb_source0(void) const
Get source0 of combine_rgb_mode
-
CombineSource get_combine_rgb_source1(void) const
Get source1 of combine_rgb_mode
-
CombineSource get_combine_rgb_source2(void) const
Get source2 of combine_rgb_mode
-
TextureStage *get_default(void)
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.
-
std::string const &get_name(void) const
Returns the name of this texture stage
-
int get_num_combine_alpha_operands(void) const
Returns the number of meaningful operands that may be retrieved via get_combine_alpha_sourceN() and get_combine_alpha_operandN().
-
int get_num_combine_rgb_operands(void) const
Returns the number of meaningful operands that may be retrieved via get_combine_rgb_sourceN() and get_combine_rgb_operandN().
-
int get_priority(void) const
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 get_rgb_scale(void) const
See
set_rgb_scale()
.
-
bool get_saved_result(void) const
Returns the current setting of the saved_result flag. See
set_saved_result()
.
-
int get_sort(void) const
Returns the sort order of this texture stage.
-
InternalName *get_tangent_name(void) const
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”.
-
int get_tex_view_offset(void) const
Returns the current setting of the tex_view_offset. See
set_tex_view_offset()
.
-
InternalName *get_texcoord_name(void) const
See
set_texcoord_name
. The default isInternalName::get_texcoord()
.
-
bool involves_color_scale(void) const
Returns true if the
TextureStage
is affected by the setting of the currentColorScaleAttrib
, false otherwise.
-
bool is_fixed_function(void) const
Returns true if the
TextureStage
is relevant to the classic fixed function pipeline. This excludes texture stages such as normal mapping and the like.
-
void output(std::ostream &out) const
Just a single line output
-
void set_alpha_scale(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.
-
void set_combine_alpha(TextureStage::CombineMode mode, CombineSource source0, CombineOperand operand0)
-
void set_combine_alpha(TextureStage::CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1)
-
void set_combine_alpha(TextureStage::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_replace only.Specifies any of the
CombineMode
values that represent a two-parameter operation. Specifically, this is everything except for CM_replace and CM_interpolate.Specifies any of the
CombineMode
values that represent a one-parameter operation. Specifically, this is CM_interpolate only.
-
void set_combine_rgb(TextureStage::CombineMode mode, CombineSource source0, CombineOperand operand0)
-
void set_combine_rgb(TextureStage::CombineMode mode, CombineSource source0, CombineOperand operand0, CombineSource source1, CombineOperand operand1)
-
void set_combine_rgb(TextureStage::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_replace only.Specifies any of the
CombineMode
values that represent a two-parameter operation. Specifically, this is everything except for CM_replace and CM_interpolate.Specifies any of the
CombineMode
values that represent a one-parameter operation. Specifically, this is CM_interpolate only.
-
void set_mode(TextureStage::Mode mode)
Set the mode of this texture stage
-
void set_name(std::string const &name)
Changes the name of this texture stage
-
void set_priority(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.
-
void set_rgb_scale(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.
-
void set_saved_result(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.
-
void set_sort(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.
-
void set_tex_view_offset(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.
-
void set_texcoord_name(InternalName *name)
-
void set_texcoord_name(std::string const &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.
-
bool uses_color(void) const
Returns true if the
TextureStage
makes use of whatever color is specified inset_color()
, false otherwise.
-
bool uses_last_saved_result(void) const
Returns true if the
TextureStage
makes use of the CS_primary_color combine source.
-
bool uses_primary_color(void) const
Returns true if the
TextureStage
makes use of the CS_primary_color combine source.
-
void write(std::ostream &out, int indent_level = 0) const
Writes the details of this stage
-
enum CombineMode