This file contains the implementation of the light system, which manages all lighting objects within the engine.
More...
Go to the source code of this file.
This file contains the implementation of the light system, which manages all lighting objects within the engine.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 1.0
- Date
- 2023-03-02
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2023
◆ directional_light
A directional light, typically used to emulate sun/moon light.
◆ directional_light_data
◆ point_light
A point light, the most common light source, which radiates out from the given position.
◆ point_light_data
◆ light_system_directional_add()
Attempts to add a directional light to the system. Only one may be present at once, and is overwritten when one is passed here.
- Parameters
-
light | A pointer to the light to be added. |
- Returns
- True on success; otherwise false.
◆ light_system_directional_light_get()
Obtains a pointer to the current directional light. Can be NULL if one has not been added.
- Returns
- A pointer to the current directional light.
◆ light_system_directional_remove()
Attempts to remove the given light from the system. A pointer comparison is done, meaning the light to be removed must be the original that was added.
- Parameters
-
light | A pointer to the light to be removed. |
- Returns
- True on successful removal; otherwise false.
◆ light_system_initialize()
b8 light_system_initialize |
( |
u64 * |
memory_requirement, |
|
|
void * |
memory, |
|
|
void * |
config |
|
) |
| |
Initializes the light system. As with most systems, this should be called twice, the first time to obtain the memory requirement (where memory=0), and a second time passing allocated memory the size of memory_requirement.
- Parameters
-
memory_requirement | A pointer to hold the memory requirement. |
memory | Block of allocated memory, or 0 if requesting memory requirement. |
config | Configuration for this system. Currently unused. |
- Returns
- True on success; otherwise false.
◆ light_system_point_add()
Attempts to add a point light to the system.
- Parameters
-
light | A pointer to the light to be added. |
- Returns
- True on success; otherwise false.
◆ light_system_point_light_count()
KAPI u32 light_system_point_light_count |
( |
void |
| ) |
|
Returns the total number of point lights currently in the system.
- Returns
- The total number of point lights currently in the system.
◆ light_system_point_lights_get()
Fills in the required array of point lights within the system. Array must already exist and have at least enough space as determined by a call to light_system_point_light_count().
- Parameters
-
p_lights | An array of point lights. These lights are copies of the original. |
- Returns
- True on success; otherwise false.
◆ light_system_point_remove()
Attempts to remove the given light from the system. A pointer comparison is done, meaning the light to be removed must be the original that was added.
- Parameters
-
light | A pointer to the light to be removed. |
- Returns
- True on successful removal; otherwise false.
◆ light_system_shutdown()
void light_system_shutdown |
( |
void * |
state | ) |
|
Shuts down the light system, releasing all resources.
- Parameters
-
state | The state/memory block for the system. |