Kohi Game Engine
ktransform_system.h
Go to the documentation of this file.
1 #ifndef _ktransform_SYSTEM_H_
2 #define _ktransform_SYSTEM_H_
3 
4 #include <core_resource_types.h>
5 #include <math/math_types.h>
6 
7 struct frame_data;
8 
9 typedef struct ktransform_system_config {
10  // The initial number of slots to allocate for ktransforms on startup.
13 
14 struct ktransform_system_state;
15 
16 #define KRENDERBUFFER_NAME_TRANSFORMS_GLOBAL "Kohi.StorageBuffer.TransformsGlobal"
17 
18 b8 ktransform_system_initialize(u64* memory_requirement, void* state, void* config);
19 
20 void ktransform_system_shutdown(void* state);
21 
22 b8 ktransform_system_update(struct ktransform_system_state* state, struct frame_data* p_frame_data);
23 
33 
44 
51 
61 
71 
82 
93 
102 
108 
116 
119 
127 
135 
143 
152 
160 
168 
176 
185 
193 
201 
209 
218 
227 
237 
246 KAPI void ktransform_translate_rotate(ktransform t, vec3 translation, quat rotation);
247 
252 
262 
270 
273 
281 
290 KAPI b8 ktransform_from_string(const char* str, u64 user, ktransform* out_ktransform);
291 
292 #endif
u32 ktransform
Definition: core_resource_types.h:6
#define KAPI
Import/export qualifier.
Definition: defines.h:209
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:27
_Bool b8
8-bit boolean type
Definition: defines.h:60
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:30
KAPI ktransform ktransform_parent_get(ktransform t)
KAPI void ktransform_translate(ktransform t, vec3 translation)
Applies a translation to the given ktransform. Not the same as setting.
void ktransform_system_shutdown(void *state)
KAPI void ktransform_rotate(ktransform t, quat rotation)
Applies a rotation to the given ktransform. Not the same as setting.
KAPI void ktransform_position_rotation_scale_set(ktransform t, vec3 position, quat rotation, vec3 scale)
Sets the position, rotation and scale of the given ktransform.
b8 ktransform_system_initialize(u64 *memory_requirement, void *state, void *config)
KAPI quat ktransform_rotation_get(ktransform t)
Returns the rotation of the given ktransform.
KAPI const char * ktransform_to_string(ktransform t)
Returns a string representation of the ktransform pointed to by the given handle.
KAPI vec3 ktransform_scale_get(ktransform t)
Returns the scale of the given ktransform.
b8 ktransform_system_update(struct ktransform_system_state *state, struct frame_data *p_frame_data)
KAPI void ktransform_position_set(ktransform t, vec3 position)
Sets the position of the given ktransform.
KAPI void ktransform_user_set(ktransform t, u64 user)
KAPI vec3 ktransform_position_get(ktransform t)
Returns the local position of the given ktransform.
KAPI void ktransform_scale_set(ktransform t, vec3 scale)
Sets the scale of the given ktransform.
KAPI ktransform ktransform_from_matrix(mat4 m, u64 user)
Creates a ktransform from the provided matrix.
KAPI vec3 ktransform_world_position_get(ktransform t)
Returns the world position of the given ktransform.
KAPI quat ktransform_world_rotation_get(ktransform t)
Returns the world rotation of the given ktransform.
KAPI ktransform ktransform_create(u64 user)
Creates and returns a new ktransform, using a zero vector for position, identity quaternion for rotat...
KAPI mat4 ktransform_local_get(ktransform t)
Retrieves the local ktransformation matrix from the provided ktransform. Automatically recalculates t...
KAPI void ktransform_scale(ktransform t, vec3 scale)
Applies a scale to the given ktransform. Not the same as setting.
KAPI ktransform ktransform_from_position_rotation(vec3 position, quat rotation, u64 user)
Creates a ktransform from the given position and rotation. Uses a one scale.
KAPI b8 ktransform_is_identity(ktransform t)
Indicates if the provided transform is an identity transform (i.e. zero position, identity rotation,...
KAPI mat4 ktransform_world_get(ktransform t)
Obtains the world matrix of the given ktransform.
KAPI ktransform ktransform_from_position(vec3 position, u64 user)
Creates a ktransform from the given position. Uses a zero rotation and a one scale.
KAPI ktransform ktransform_from_position_rotation_scale(vec3 position, quat rotation, vec3 scale, u64 user)
Creates a ktransform from the given position, rotation and scale.
KAPI void ktransform_translate_rotate(ktransform t, vec3 translation, quat rotation)
Applies translation and rotation to the given ktransform.
KAPI u64 ktransform_user_get(ktransform t)
KAPI void ktransform_mark_dirty(ktransform transform)
struct ktransform_system_config ktransform_system_config
KAPI vec3 ktransform_world_scale_get(ktransform t)
Returns the world scale of the given ktransform.
KAPI ktransform ktransform_clone(ktransform original, u64 user)
Creates and returns a new ktransform, using the position, rotation and scale of the provided original...
KAPI void ktransform_position_rotation_set(ktransform t, vec3 position, quat rotation)
Sets the position and rotation of the given ktransform.
KAPI b8 ktransform_parent_set(ktransform t, ktransform parent)
KAPI ktransform ktransform_from_rotation(quat rotation, u64 user)
Creates a ktransform from the given rotation. Uses a zero position and a one scale.
KAPI void ktransform_destroy(ktransform *t)
Destroys the ktransform with the given handle, and frees the handle.
KAPI b8 ktransform_from_string(const char *str, u64 user, ktransform *out_ktransform)
Creates an ktransform from the given string.
KAPI void ktransform_calculate_local(ktransform t)
KAPI void ktransform_rotation_set(ktransform t, quat rotation)
Sets the rotation of the given ktransform.
Contains various math types required for the engine.
Engine-level current frame-specific data.
Definition: frame_data.h:15
Definition: ktransform_system.h:9
u32 initial_slot_count
Definition: ktransform_system.h:11
a 4x4 matrix, typically used to represent object transformations.
Definition: math_types.h:383
A 3-element vector.
Definition: math_types.h:117
A 4-element vector.
Definition: math_types.h:229