alias_api.AlTexture
- class alias_api.AlTexture
Bases:
AlObjectBase object for representing texture data
This class encapsulates the basic functionality for checking and setting the name of a texture as well as accessing the textures that this texture refers to, and the animation on this texture. These texture objects can be obtained from the AlShader class and the AlEnvironment class.
A texture object itself may also reference other textures. For this reason the first_texture() and next_texture() methods are used.
first_texture() returns the first texture that the texture object references. next_texture() moves from a given referenced texture to the next texture in order, as related to the texture object. (See the similar methods for the AlShader/AlEnvironment classes.)
The animation on a texture can be accessed through the first_channel() and next_channel() methods. All the channels on the texture can be deleted by calling deleteAnimation().
The texture parameters can be accessed through the parameter() and set_parameter() methods. Each texture has a specific set of parameters that are valid for it that depend on its type. The full list of texture parameters can be seen in the file AlShadingFields.h. For example, all parameters specific to the water texture have names of the form FLD_SHADING_WATER_*. Parameters common to all textures have the form FLD_SHADING_COMMON_TEXTURE_*. All parameters are treated as doubles even though this may not necessarily be what they are. This was done to make the interface as simple and consistent as possible.
New AlTextures cannot be created by allocating a new AlTexture object because an AlTexture must be associated with a shader. Use the AlShader.add_texture() method to create the new AlTexture.
- add_texture(self: alias_api.AlTexture, field_name: str, texture_type: str) tuple[int, alias_api.AlTexture]
Add a texture to the field of the AlTexture.
- copy_wrapper(self: alias_api.AlTexture) alias_api.AlObject
Return an exact duplicate of this AlTexture wrapper.
- field_type(self: alias_api.AlTexture) str
Returns a string which indicates which field of the parent object(AlShader, AlTexture, AlEnvironment) that this texture is mapped to. Note that the returned strings are identical to the field names written out to SDL.The SDL manual gives a complete list of possible return
values for this function.
- fields(self: alias_api.AlTexture) list[alias_api.AlShadingFields]
return a list of all the fields used by the texture.
- filename(self: alias_api.AlTexture) str
- If the texture is a file texture, this method returns the path and name to the image file used for
the texture. If the texture is any other type, NULL is returned.
- first_texture(self: alias_api.AlTexture) alias_api.AlTexture
Return the first texture.
- mapped_fields(self: alias_api.AlTexture) list[str]
return a list of all the fields used by the texture.
- property name
Get or set the AlTexture name.
- next_texture(self: alias_api.AlTexture, cur_texture: alias_api.AlTexture) alias_api.AlTexture
return the next texture.
- parameter(self: alias_api.AlTexture, parameter_name: alias_api.AlShadingFields) tuple[int, float]
Finds the value of a given texture field.
- remove_texture(self: alias_api.AlTexture, field_name: str) int
Remove the texture from the field of the AlTexture.
- set_filename(self: alias_api.AlTexture, file_path: str) int
If the texture is a file texture, this method sets the path and name to the image file used for the texture. If the texture is any other type, sFailure is returned. Note that the string provided is duplicated, so you are responsible for the space allocated for the original copy.
- set_parameter(self: alias_api.AlTexture, parameter_name: alias_api.AlShadingFields, value: SupportsFloat) int
Changes the value of the texture field.
- texture_node(self: alias_api.AlTexture) AlTextureNode
Returns a pointer to the transformation AlTextureNode on solid textures. If the texture is not a solid texture or there is no AlTextureNode, this method returns None.
- texture_type(self: alias_api.AlTexture) str
Returns a string which indicates the ‘name’ of the texture type. Note that these strings are identical to those output to SDL.
- type(self: alias_api.AlTexture) alias_api.AlObjectType
Return the AlTexture type identifier.