Texture
Represents a texture that can be applied to surfaces in the 3D
scene.
This class manages texture data, wrapping modes, filtering, and UV
transformations. Textures are used to add visual detail to 3D objects
and can be loaded from various image formats supported by the GameCube
hardware. Currently there is support for *.tpl files. The files that you
put inside the texture or data folder are getting automaticly converted
before compile time.
- Texture wrapping and filtering modes
- UV transformation (offset, repeat, rotation)
- Mipmap generation
- GameCube-specific texture format support
Methods
Texture()
Default constructor - creates a texture with default settings
Texture(void* image, Format format, Type type)
Constructor with image data and format specifications
| image | Pointer to image data | nullptr |
| format | Texture format | RGBAFormat |
| type | Data type | UnsignedByteType |
Texture* clone() const
Creates a copy of this texture
void copy(const Texture& other)
Copies properties from another texture
| other | Source texture |
void updateMatrix()
Updates the texture's UV transformation matrix
void createGXTexture()
Creates GX texture object from image data
void setOrigin(f32 x, f32 y)
Sets texture origin offset
| x | X offset for texture positioning | 0.0f |
| y | Y offset for texture positioning | 0.0f |
Properties
| anisotropy | u32 | Anisotropic filtering level |
| center | Vector3 | Rotation center point |
| channel | u32 | UV attribute channel (0-3) |
| colorSpace | u32 | Color space specification |
| enabled | bool | Active/inactive |
| flipY | bool | Flip texture vertically |
| format | u32 | Texture format |
| generateMipmaps | bool | Generate mipmaps automatically |
| gxTexObj | GXTexObj | GameCube texture object |
| gxTexObjValid | bool | Whether GX texture object is valid |
| id | u32 | Unique identifier |
| image | void* | Image data pointer |
| internalFormat | u32 | GPU internal format |
| isTexture | bool | Read-only tag |
| magFilter | u32 | Magnification filter |
| mapping | u32 | UV mapping type |
| matrix | Mtx | UV transformation matrix |
| matrixAutoUpdate | bool | Auto-update UV transformation matrix |
| minFilter | u32 | Minification filter |
| mipmaps | vector<void*> | Array of mipmap data |
| name | string | Optional display name |
| needsUpdate | bool | Flag to trigger texture update |
| offset | Vector2 | UV offset (0.0 to 1.0) |
| onUpdate | Callback | Update callback function |
| premultiplyAlpha | bool | Premultiply alpha channel |
| repeat | Vector2 | UV repeat factors |
| rotation | f32 | Rotation in radians |
| source | void* | Data source reference |
| tplFormat | u32 | Real texture format from TPL |
| tplHeight | u16 | Real texture height from TPL |
| tplInfoValid | bool | Whether TPL info is valid |
| tplWidth | u16 | Real texture width from TPL |
| type_ | u32 | Data type (avoiding name conflict) |
| unpackAlignment | u32 | Pixel row alignment |
| userData | void* | Custom user data |
| uuid | string | UUID string |
| version | u32 | Bumps on change |
| wrapS | u32 | Horizontal wrapping mode |
| wrapT | u32 | Vertical wrapping mode |