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 |
void updateGXState()
Updates GameCube graphics state for this texture
Properties
| isTexture | bool | Read |
| name | string | Optional display name |
| id | u32 | Unique identifier |
| uuid | string | UUID string |
| enabled | bool | Active/inactive |
| version | u32 | Bumps on change |
| image | void * | Image data pointer |
| mipmaps | vector<void * > | Array of mipmap data |
| mapping | u32 | UV mapping type |
| channel | u32 | UV attribute channel (0 |
| wrapS | u32 | Horizontal wrapping mode |
| wrapT | u32 | Vertical wrapping mode |
| magFilter | u32 | Magnification filter |
| minFilter | u32 | Minification filter |
| format | u32 | Texture format |
| internalFormat | u32 | GPU internal format |
| type_ | u32 | Data type (avoiding name conflict) |
| anisotropy | u32 | Anisotropic filtering level |
| offset | Vector2 | UV offset (0.0 to 1.0) |
| repeat | Vector2 | UV repeat factors |
| rotation | f32 | Rotation in radians |
| center | Vector3 | Rotation center point |
| matrixAutoUpdate | bool | Auto |
| matrix | Mtx | UV transformation matrix |
| generateMipmaps | bool | Generate mipmaps automatically |
| premultiplyAlpha | bool | Premultiply alpha channel |
| flipY | bool | Flip texture vertically |
| unpackAlignment | u32 | Pixel row alignment |
| colorSpace | u32 | Color space specification |
| onUpdate | Callback | Update callback function |
| needsUpdate | bool | Flag to trigger texture update |
| userData | void * | Custom user data |
| source | void * | Data source reference |
| gxTexObj | GXTexObj | GameCube texture object |
| gxTexObjValid | bool | Whether GX texture object is valid |
| tplFormat | u32 | Real texture format from TPL |
| tplWidth | u16 | Real texture width from TPL |
| tplHeight | u16 | Real texture height from TPL |
| tplInfoValid | bool | Whether TPL info is valid |