Skip to content

Texture

Gaspar edited this page Jan 15, 2024 · 5 revisions

Class Texture

Represents a texture with properties like name, axes, offsets, rotation, and scales.

Attributes

Attribute Type Description Note
name str The name of the texture
u_axis Vector3 The U-axis vector of the texture
u_offset float The U-axis offset of the texture
v_axis Vector3 The V-axis vector of the texture
v_offset float The V-axis offset of the texture
rotation float The rotation angle of the texture Not used since rotation is implicit in the UV vectors. Currently it (maybe) cause problems with some map editor
u_scale float The U-axis scale of the texture
v_scale float The V-axis scale of the texture

Public Methods:

__init__(self, name, u_axis, u_offset, v_axis, v_offset, rotation, u_scale, v_scale)

Constructor method for the Texture class.

t = Texture('AAATRIGGER', Vector3(1,0,0), 0, Vector3(0,1,0), 0, 0, 0.5, 0.5)

Private Methods:


_rotate_uv_x(self, angle: float)

Rotate (in degrees) the texture around the X-axis.

only for use internally in the Face class methods


_rotate_uv_y(self, angle: float)

Rotate (in degrees) the texture around the Y-axis.

only for use internally in the Face class methods


_rotate_uv_z(self, angle: float)

Rotate (in degrees) the texture around the Z-axis.

only for use internally in the Face class methods


_rotate_uv_around_axis(self, angle: float, axis: Vector3)

Rotate (in degrees) the texture around a specified axis.

only for use internally in the Face class methods


_rotate_uv(self, transformation: Matrix3x3)

Apply a 3x3 matrix transformation to the texture axes.

only for use internally in the Face class methods


_update_offset(self, displacement: Vector3)

Update the texture offset based on a displacement vector.

only for use internally in the Face class methods


Dunder Methods:

__str__(self)

Return a string representation of the texture.

TEXTURENAME [ vx vy vz u_offset ] [ vx vy vz v_offset ] rotation u_scale v_scale


Properties:

normal(self)

Return the normal vector of the texture.

normal = t.normal