18 #ifndef _XFORM_GRAPH_H_
19 #define _XFORM_GRAPH_H_
#define KAPI
Import/export qualifier.
Definition: defines.h:205
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:19
KAPI khandle hierarchy_graph_root_add(hierarchy_graph *graph)
Adds a new node to the root of the graph. Returns the handle to the new node.
KAPI b8 hierarchy_graph_child_get_by_index(const hierarchy_graph *graph, khandle parent_node_handle, u32 index, khandle *out_handle)
Attempts to get a handle to a child node of the given parent node, at the provided index.
KAPI vec3 hierarchy_graph_world_scale_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the world scale for the given node. Returns {1, 1, 1} if xform (or node itself) does not exis...
struct hierarchy_graph hierarchy_graph
KAPI quat hierarchy_graph_world_rotation_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the world rotation for the given node. Returns identity quaternion if xform (or node itself) ...
KAPI khandle hierarchy_graph_parent_handle_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the handle of the parent of the node provided. Will return an invalid handle if the node does...
KAPI khandle hierarchy_graph_child_add_with_xform(hierarchy_graph *graph, khandle parent_node_handle, khandle xform_handle)
Adds a new node to the given parent node within the graph and assigns the given xform handle to it....
KAPI khandle hierarchy_graph_parent_xform_handle_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the xform handle of the parent of node provided. Will return an invalid handle if the node,...
KAPI u32 hierarchy_graph_child_count_get(const hierarchy_graph *graph, khandle parent_node_handle)
Attempts to get the number of child nodes of the given parent node.
KAPI b8 hierarchy_graph_create(hierarchy_graph *out_graph)
Creates a new hierarchy graph, used to manage parent-child relationships with any kind of resource vi...
KAPI khandle hierarchy_graph_root_add_with_xform(hierarchy_graph *graph, khandle xform_handle)
Adds a new node to the root of the graph and assigns the given xform handle to it....
KAPI void hierarchy_graph_node_remove(hierarchy_graph *graph, khandle *node_handle, b8 release_xform)
Removes the given node from the hierarchy. This automatically handles reorganization of the hierarchy...
KAPI void hierarchy_graph_update(hierarchy_graph *graph)
Performs internal update routines on the hierarchy, which includes rebuilding the internal view tree.
KAPI vec3 hierarchy_graph_world_position_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the world position for the given node. Returns a zero vector if xform (or node itself) does n...
KAPI khandle hierarchy_graph_child_add(hierarchy_graph *graph, khandle parent_node_handle)
Adds a new node to the given parent node within the graph. Returns the handle to the new node.
struct hierarchy_graph_view_node hierarchy_graph_view_node
struct hierarchy_graph_view hierarchy_graph_view
KAPI khandle hierarchy_graph_xform_handle_get(const hierarchy_graph *graph, khandle node_handle)
Obtains the xform handle of the node provided. Will return an invalid handle if the node (or an xform...
KAPI void hierarchy_graph_destroy(hierarchy_graph *graph)
Destroys the given hierarchy graph, releasing all resources. FIXME: This should also optionally relea...
KAPI b8 hierarchy_graph_xform_local_matrix_get(const hierarchy_graph *graph, khandle node_handle, mat4 *out_matrix)
Attempts to get the local transformation matrix for the given hierarchy node, if it exists and has a ...
A global handle system for Kohi. Handles are used to obtain various resources using a unique handle i...
Contains various math types required for the engine.
Engine-level current frame-specific data.
Definition: frame_data.h:11
Definition: hierarchy_graph.h:26
u32 parent_index
Definition: hierarchy_graph.h:31
khandle xform_handle
Definition: hierarchy_graph.h:28
u32 * children
Definition: hierarchy_graph.h:34
khandle node_handle
Definition: hierarchy_graph.h:27
Definition: hierarchy_graph.h:37
hierarchy_graph_view_node * nodes
Definition: hierarchy_graph.h:39
u32 * root_indices
Definition: hierarchy_graph.h:41
Definition: hierarchy_graph.h:50
khandle * node_handles
Definition: hierarchy_graph.h:53
b8 * dirty_flags
Definition: hierarchy_graph.h:61
hierarchy_graph_view view
Definition: hierarchy_graph.h:70
u32 nodes_allocated
Definition: hierarchy_graph.h:51
u8 * levels
Definition: hierarchy_graph.h:59
u32 * parent_indices
Definition: hierarchy_graph.h:55
khandle * xform_handles
Definition: hierarchy_graph.h:67
A handle is a unique identifier used a system in the engine to avoid using raw pointers where possibl...
Definition: khandle.h:25
a 4x4 matrix, typically used to represent object transformations.
Definition: math_types.h:195
A 3-element vector.
Definition: math_types.h:49
A 4-element vector.
Definition: math_types.h:89