The geometry system is responsible for loading and unloading geometry, as well as reference counting.
More...
Go to the source code of this file.
|
b8 | geometry_system_initialize (u64 *memory_requirement, void *state, void *config) |
| Initializes the geometry system. Should be called twice; once to get the memory requirement (passing state=0), and a second time passing an allocated block of memory to actually initialize the system. More...
|
|
void | geometry_system_shutdown (void *state) |
| Shuts down the geometry system. More...
|
|
KAPI geometry * | geometry_system_acquire_by_id (u32 id) |
| Acquires an existing geometry by id. More...
|
|
KAPI geometry * | geometry_system_acquire_from_config (geometry_config config, b8 auto_release) |
| Registers and acquires a new geometry using the given config. More...
|
|
KAPI void | geometry_system_config_dispose (geometry_config *config) |
| Frees resources held by the provided configuration. More...
|
|
KAPI void | geometry_system_release (geometry *geometry) |
| Releases a reference to the provided geometry. More...
|
|
KAPI geometry * | geometry_system_get_default (void) |
| Obtains a pointer to the default geometry. More...
|
|
KAPI geometry * | geometry_system_get_default_2d (void) |
| Obtains a pointer to the default geometry. More...
|
|
KAPI geometry_config | geometry_system_generate_plane_config (f32 width, f32 height, u32 x_segment_count, u32 y_segment_count, f32 tile_x, f32 tile_y, const char *name, const char *material_name) |
| Generates configuration for plane geometries given the provided parameters. NOTE: vertex and index arrays are dynamically allocated and should be freed upon object disposal. Thus, this should not be considered production code. More...
|
|
KAPI geometry_config | geometry_system_generate_cube_config (f32 width, f32 height, f32 depth, f32 tile_x, f32 tile_y, const char *name, const char *material_name) |
|
The geometry system is responsible for loading and unloading geometry, as well as reference counting.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 1.0
- Date
- 2022-01-11
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2022
◆ DEFAULT_GEOMETRY_NAME
#define DEFAULT_GEOMETRY_NAME "default" |
The name of the default geometry.
◆ geometry_config
Represents the configuration for a geometry.
◆ geometry_system_config
The geometry system configuration.
◆ geometry_system_acquire_by_id()
Acquires an existing geometry by id.
- Parameters
-
id | The geometry identifier to acquire by. |
- Returns
- A pointer to the acquired geometry or nullptr if failed.
◆ geometry_system_acquire_from_config()
Registers and acquires a new geometry using the given config.
- Parameters
-
config | The geometry configuration. |
auto_release | Indicates if the acquired geometry should be unloaded when its reference count reaches 0. |
- Returns
- A pointer to the acquired geometry or nullptr if failed.
◆ geometry_system_config_dispose()
Frees resources held by the provided configuration.
- Parameters
-
config | A pointer to the configuration to be disposed. |
◆ geometry_system_generate_cube_config()
- Parameters
-
width | |
height | |
depth | |
tile_x | |
tile_y | |
name | |
material_name | |
- Returns
- geometry_config
◆ geometry_system_generate_plane_config()
KAPI geometry_config geometry_system_generate_plane_config |
( |
f32 |
width, |
|
|
f32 |
height, |
|
|
u32 |
x_segment_count, |
|
|
u32 |
y_segment_count, |
|
|
f32 |
tile_x, |
|
|
f32 |
tile_y, |
|
|
const char * |
name, |
|
|
const char * |
material_name |
|
) |
| |
Generates configuration for plane geometries given the provided parameters. NOTE: vertex and index arrays are dynamically allocated and should be freed upon object disposal. Thus, this should not be considered production code.
- Parameters
-
width | The overall width of the plane. Must be non-zero. |
height | The overall height of the plane. Must be non-zero. |
x_segment_count | The number of segments along the x-axis in the plane. Must be non-zero. |
y_segment_count | The number of segments along the y-axis in the plane. Must be non-zero. |
tile_x | The number of times the texture should tile across the plane on the x-axis. Must be non-zero. |
tile_y | The number of times the texture should tile across the plane on the y-axis. Must be non-zero. |
name | The name of the generated geometry. |
material_name | The name of the material to be used. |
- Returns
- A geometry configuration which can then be fed into geometry_system_acquire_from_config().
◆ geometry_system_get_default()
Obtains a pointer to the default geometry.
- Returns
- A pointer to the default geometry.
◆ geometry_system_get_default_2d()
Obtains a pointer to the default geometry.
- Returns
- A pointer to the default geometry.
◆ geometry_system_initialize()
b8 geometry_system_initialize |
( |
u64 * |
memory_requirement, |
|
|
void * |
state, |
|
|
void * |
config |
|
) |
| |
Initializes the geometry system. Should be called twice; once to get the memory requirement (passing state=0), and a second time passing an allocated block of memory to actually initialize the system.
- Parameters
-
memory_requirement | A pointer to hold the memory requirement as it is calculated. |
state | A block of memory to hold the state or, if gathering the memory requirement, 0. |
config | The configuration (geometry_system_config) for this system. |
- Returns
- True on success; otherwise false.
◆ geometry_system_release()
Releases a reference to the provided geometry.
- Parameters
-
geometry | The geometry to be released. |
◆ geometry_system_shutdown()
void geometry_system_shutdown |
( |
void * |
state | ) |
|
Shuts down the geometry system.
- Parameters
-
state | The state block of memory. |