Light
Light ⟵ Object3D
Abstract base class for lights. All other light types inherit from this.
This class provides the foundation for all light types in the engine. It defines properties that control how lights illuminate objects, including color, intensity, and basic light behavior. Lights are designed to work with the GameCube's GX system.
Methods
Light()
Default constructor - creates a white light with full intensity
Light(const Color& color)
Constructor with hex color
| color | Color value (e.g., Color(0xffffff) for white) |
Light(const Color& color, f32 lightIntensity)
Constructor with hex color and intensity
| color | Color value (e.g., Color(0xffffff) for white) | |
| lightIntensity | Light intensity value (0.0 - 1.0) |
virtual void apply()
Applies this light's settings to the GX pipeline
virtual void update()
Updates light state (called each frame)
virtual Light* clone() const
Creates a copy of this light
virtual void copy(const Light& source)
Copies properties from another light
| source | Source light to copy from |
virtual void copy(const Object3D& object, bool recursive) override
Copies properties from another Object3D
| object | Source object to copy from | |
| recursive | Whether to copy all child objects as well | true |
virtual Object3D* clone(bool recursive) const override
Creates a copy of this object
| recursive | Whether to clone all child objects as well | true |
virtual void dispose()
Frees GPU-related resources
void updateGXState()
Updates GX pipeline state based on light properties
void setupGXLight()
Sets up the GX light object
Properties
| isLight | bool | Read |
| name | string | Optional name for the light |
| id | u32 | Unique identifier |
| uuid | string | UUID string |
| color | Color | Color of the light (RGBA) |
| intensity | f32 | Light intensity (0.0 |
| lightSlot | u8 | Which GX light slot this light uses |
| enabled | bool | Whether the light is active |
| needsUpdate | bool | Whether light needs recompilation |
| version | u32 | Version counter for updates |