TextureAttrib
-
class TextureAttrib
Bases:
RenderAttrib
Indicates the set of
TextureStages
and their associated Textures that should be applied to (or removed from) a node.Inheritance diagram
-
ConstPointerTo<RenderAttrib> add_off_stage(TextureStage *stage, int override = 0) const
Returns a new
TextureAttrib
, just like this one, but with the indicated stage added to the list of stages turned off by this attrib.
-
ConstPointerTo<RenderAttrib> add_on_stage(TextureStage *stage, Texture *tex, int override = 0) const
-
ConstPointerTo<RenderAttrib> add_on_stage(TextureStage *stage, Texture *tex, SamplerState const &sampler, int override = 0) const
Returns a new
TextureAttrib
, just like this one, but with the indicated stage added to the list of stages turned on by this attrib.
-
int find_on_stage(TextureStage const *stage) const
Returns the index number of the indicated
TextureStage
within the list of on_stages, or -1 if the indicated stage is not listed.
-
static int get_class_slot(void)
-
static TypeHandle get_class_type(void)
-
int get_ff_tc_index(int n) const
For each
TextureStage
listed inget_on_ff_stage()
, this returns a unique index number for the texture coordinate name used by thatTextureStage
. It is guaranteed to remain the same index number for each texcoord name (for a given set ofTextureStages
), even if the texture render order changes.
-
int get_num_off_stages(void) const
Returns the number of stages that are turned off by the attribute.
-
int get_num_on_ff_stages(void) const
Returns the number of on-stages that are relevant to the classic fixed function pipeline. This excludes texture stages such as normal maps.
-
int get_num_on_stages(void) const
Returns the number of stages that are turned on by the attribute.
-
TextureStage *get_off_stage(int n) const
Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.
-
TextureStage *get_on_ff_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order, including only those relevant to the classic fixed function pipeline. This excludes texture stages such as normal maps.
-
SamplerState const &get_on_sampler(TextureStage *stage) const
Returns the sampler associated with the indicated stage, or the one associated with its texture if no custom stage has been specified. It is an error to call this if the stage does not exist.
-
TextureStage *get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
-
int get_on_stage_override(TextureStage *stage) const
Returns the override value associated with the indicated stage.
-
Texture *get_on_texture(TextureStage *stage) const
Returns the texture associated with the indicated stage, or NULL if no texture is associated.
-
Texture *get_texture(void) const
If the
TextureAttrib
is not an ‘off’TextureAttrib
, returns the base-level texture that is associated. Otherwise, return NULL.
-
bool has_all_off(void) const
Returns true if this attrib turns off all stages (although it may also turn some on).
-
bool has_off_stage(TextureStage *stage) const
Returns true if the indicated stage is turned off by the attrib, false otherwise.
-
bool has_on_stage(TextureStage *stage) const
Returns true if the indicated stage is turned on by the attrib, false otherwise.
-
bool is_identity(void) const
Returns true if this is an identity attrib: it does not change the set of stages in use.
-
bool is_off(void) const
Returns true if the
TextureAttrib
is an ‘off’TextureAttrib
, indicating that it should disable texturing.If multitexture is in effect, a
TextureAttrib
may not be strictly “on” or “off”; therefore, to get a more precise answer to this question, you should consider usinghas_all_off()
orget_num_off_stages()
orhas_off_stage()
instead.
-
static ConstPointerTo<RenderAttrib> make(Texture *tex)
-
static ConstPointerTo<RenderAttrib> make(void)
These methods are used to create a simple, single-textured layer. For multitexture, use the multitexture interfaces, further below.
The following methods define the new multitexture mode for
TextureAttrib
. EachTextureAttrib
can add or remove individual texture stages from the complete set of textures that are to be applied; this is similar to the mechanism ofLightAttrib
.Constructs a new
TextureAttrib
object suitable for rendering the indicated texture onto geometry, using the defaultTextureStage
.Constructs a new
TextureAttrib
object that does nothing.
-
static ConstPointerTo<RenderAttrib> make_all_off(void)
Constructs a new
TextureAttrib
object that turns off all stages (and hence disables texturing).
-
static ConstPointerTo<RenderAttrib> make_default(void)
Returns a
RenderAttrib
that corresponds to whatever the standard default properties for render attributes of this type ought to be.
-
static ConstPointerTo<RenderAttrib> make_off(void)
Constructs a new
TextureAttrib
object suitable for rendering untextured geometry.
-
ConstPointerTo<RenderAttrib> remove_off_stage(TextureStage *stage) const
Returns a new
TextureAttrib
, just like this one, but with the indicated stage removed from the list of stages turned off by this attrib.
-
ConstPointerTo<RenderAttrib> remove_on_stage(TextureStage *stage) const
Returns a new
TextureAttrib
, just like this one, but with the indicated stage removed from the list of stages turned on by this attrib.
-
ConstPointerTo<RenderAttrib> replace_texture(Texture *tex, Texture *new_tex) const
Returns a new
TextureAttrib
, just like this one, but with all references to the given texture replaced with the new texture.New in version 1.10.4.
-
ConstPointerTo<RenderAttrib> unify_texture_stages(TextureStage *stage) const
Returns a new
TextureAttrib
, just like this one, but with any includedTextureAttribs
that happen to have the same name as the given object replaced with the object.
-
ConstPointerTo<RenderAttrib> add_off_stage(TextureStage *stage, int override = 0) const