panda3d.core.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

Inheritance diagram of TextureAttrib

static make() → RenderAttrib

The following methods define the new multitexture mode for TextureAttrib. Each TextureAttrib can add or remove individual texture stages from the complete set of textures that are to be applied; this is similar to the mechanism of LightAttrib.

Return type

RenderAttrib

static make(tex: Texture) → RenderAttrib

Constructs a new TextureAttrib object suitable for rendering the indicated texture onto geometry, using the default TextureStage.

Return type

RenderAttrib

static makeOff() → RenderAttrib

Constructs a new TextureAttrib object suitable for rendering untextured geometry.

Return type

RenderAttrib

static makeDefault() → RenderAttrib

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

Return type

RenderAttrib

isOff() → bool

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 using hasAllOff() or getNumOffStages() or hasOffStage() instead.

getTexture() → Texture

If the TextureAttrib is not an ‘off’ TextureAttrib, returns the base-level texture that is associated. Otherwise, return NULL.

Return type

Texture

static makeAllOff() → RenderAttrib

Constructs a new TextureAttrib object that turns off all stages (and hence disables texturing).

Return type

RenderAttrib

getNumOnStages() → int

Returns the number of stages that are turned on by the attribute.

getOnStage(n: int) → TextureStage

Returns the nth stage turned on by the attribute, sorted in render order.

Return type

TextureStage

getNumOnFfStages() → int

Returns the number of on-stages that are relevant to the classic fixed function pipeline. This excludes texture stages such as normal maps.

getOnFfStage(n: int) → TextureStage

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.

Return type

TextureStage

getFfTcIndex(n: int) → int

For each TextureStage listed in getOnFfStage(), this returns a unique index number for the texture coordinate name used by that TextureStage. It is guaranteed to remain the same index number for each texcoord name (for a given set of TextureStages), even if the texture render order changes.

hasOnStage(stage: TextureStage) → bool

Returns true if the indicated stage is turned on by the attrib, false otherwise.

getOnTexture(stage: TextureStage) → Texture

Returns the texture associated with the indicated stage, or NULL if no texture is associated.

Return type

Texture

getOnSampler(stage: TextureStage) → SamplerState

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.

Return type

SamplerState

getOnStageOverride(stage: TextureStage) → int

Returns the override value associated with the indicated stage.

findOnStage(stage: TextureStage) → int

Returns the index number of the indicated TextureStage within the list of on_stages, or -1 if the indicated stage is not listed.

getNumOffStages() → int

Returns the number of stages that are turned off by the attribute.

getOffStage(n: int) → TextureStage

Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.

Return type

TextureStage

hasOffStage(stage: TextureStage) → bool

Returns true if the indicated stage is turned off by the attrib, false otherwise.

hasAllOff() → bool

Returns true if this attrib turns off all stages (although it may also turn some on).

isIdentity() → bool

Returns true if this is an identity attrib: it does not change the set of stages in use.

addOnStage(stage: TextureStage, tex: Texture, sampler: SamplerState, override: int) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with the indicated stage added to the list of stages turned on by this attrib.

Return type

RenderAttrib

addOnStage(stage: TextureStage, tex: Texture, override: int) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with the indicated stage added to the list of stages turned on by this attrib.

Return type

RenderAttrib

removeOnStage(stage: TextureStage) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with the indicated stage removed from the list of stages turned on by this attrib.

Return type

RenderAttrib

addOffStage(stage: TextureStage, override: int) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with the indicated stage added to the list of stages turned off by this attrib.

Return type

RenderAttrib

removeOffStage(stage: TextureStage) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with the indicated stage removed from the list of stages turned off by this attrib.

Return type

RenderAttrib

unifyTextureStages(stage: TextureStage) → RenderAttrib

Returns a new TextureAttrib, just like this one, but with any included TextureAttribs that happen to have the same name as the given object replaced with the object.

Return type

RenderAttrib

replaceTexture(tex: Texture, new_tex: Texture) → RenderAttrib

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.

Return type

RenderAttrib

static getClassSlot() → int
static getClassType() → TypeHandle
Return type

TypeHandle

getOnStages() → list
getOnFfStages() → list
getOffStages() → list
property on_stages

Returns the nth stage turned on by the attribute, sorted in render order.

Return type

Sequence[TextureStage]

property textures

Returns the texture associated with the indicated stage, or NULL if no texture is associated.

Return type

Mapping[Texture]

property samplers

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.

Return type

Mapping[SamplerState]

property off_stages

Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.

Return type

Sequence[TextureStage]

property class_slot
Return type

int