Material
Abstract base class for materials.
This class provides the foundation for all material types. It defines
properties that control how objects appear when rendered, including
color, transparency, blending, depth testing, and more. Materials are
optimized for GameCube's TEV (Texture
Environment) unit and GX pipeline.
Methods
Material()
Default constructor - creates a material with default values
Material(const string& name)
Constructor with custom name
| name | Human-readable name for the material |
virtual void apply()
Applies this material's settings to the GX pipeline
virtual void update()
Updates material state (called each frame)
virtual Material* clone() const
Creates a copy of this material
virtual void copy(const Material& source)
Copies properties from another material
| source | Source material to copy from |
virtual void setupTEVStages()
Configures TEV stages for this material (GameCube requirement)
Properties
| alphaMap | Texture* | Alpha/dissolve texture for transparency |
| alphaTest | f32 | Alpha test threshold (0.0 - 1.0) |
| blendDst | u8 | Destination blend factor (GX blend factor) |
| blendDstAlpha | u8 | Destination alpha blend factor |
| blendEquation | u8 | Blend equation (GX logic op) |
| blendEquationAlpha | u8 | Alpha blend equation |
| blendSrc | u8 | Source blend factor (GX blend factor) |
| blendSrcAlpha | u8 | Source alpha blend factor |
| blending | Blending | Blending mode |
| color | Color | Base color (RGBA) |
| colorWrite | bool | Whether to write to color buffer |
| depthFunc | DepthFunc | Depth comparison function |
| depthTest | bool | Whether to perform depth testing |
| depthWrite | bool | Whether to write to depth buffer |
| emissiveMap | Texture* | Emissive map |
| envMap | Texture* | Environment map |
| id | u32 | Unique identifier |
| isMaterial | bool | Read-only flag to check if object is Material |
| lightMap | Texture* | Light map |
| map | Texture* | Main texture (will be Texture* later) |
| name | string | Optional name for the material |
| needsUpdate | bool | Whether material needs recompilation |
| normalMap | Texture* | Normal map |
| opacity | f32 | Opacity value (0.0 - 1.0) |
| polygonOffset | bool | threejs.org/docs/#Material.polygonOffset |
| polygonOffsetFactor | f32 | Polygon offset factor |
| polygonOffsetUnits | f32 | Polygon offset units |
| shadowSide | Side | Which side casts shadows |
| side | Side | Which side of faces to render |
| specularMap | Texture* | Specular map |
| tevStages | u8 | Number of TEV stages to use |
| transparent | bool | Whether material is transparent |
| useAlphaMap | bool | Whether to use alpha map for transparency |
| useHardwareLighting | bool | Whether to use GX hardware lighting |
| useTexture | bool | Whether to use texture mapping |
| uuid | string | UUID string |
| version | u32 | Version counter for updates |
| vertexColors | bool | Whether to use vertex colors |
| visible | bool | Whether material is visible |
| wireframe | bool | Whether to render as wireframe |
| wireframeLinewidth | f32 | Line width for wireframe (limited support on GameCube) |