Kohi Game Engine
|
Go to the source code of this file.
Data Structures | |
struct | hierarchy_graph_view_node |
struct | hierarchy_graph_view |
struct | hierarchy_graph |
Typedefs | |
typedef struct hierarchy_graph_view_node | hierarchy_graph_view_node |
typedef struct hierarchy_graph_view | hierarchy_graph_view |
typedef struct hierarchy_graph | hierarchy_graph |
Functions | |
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 via the use of handles and handles to xforms. More... | |
KAPI void | hierarchy_graph_destroy (hierarchy_graph *graph) |
Destroys the given hierarchy graph, releasing all resources. FIXME: This should also optionally release xforms if requested to do so. It currently does not. More... | |
KAPI void | hierarchy_graph_update (hierarchy_graph *graph) |
Performs internal update routines on the hierarchy, which includes rebuilding the internal view tree. More... | |
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 for it) does not exist. More... | |
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 transform. More... | |
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 not exist or if it has no parent. More... | |
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, its parent, or an xform for it does not exist. More... | |
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. More... | |
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. Returns the handle to the new node. More... | |
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. More... | |
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. Returns the handle to the new node. More... | |
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. More... | |
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. More... | |
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 upon removal (i.e. children, if they exist, are moved to this node's parent or the root). Also invalidates the given handle. Optionally releases the xform. More... | |
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) does not exist. More... | |
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 not exist. More... | |
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 exist. More... | |
typedef struct hierarchy_graph hierarchy_graph |
typedef struct hierarchy_graph_view hierarchy_graph_view |
typedef struct hierarchy_graph_view_node hierarchy_graph_view_node |
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.
graph | A pointer to the graph to add the node to. |
parent_node_handle | The handle to the node to add the new child node to. |
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. Returns the handle to the new node.
graph | A pointer to the graph to add the node to. |
parent_node_handle | The handle to the node to add the new child node to. |
xform_handle | The handle to the xform to use when adding 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.
graph | A pointer to the graph to search. |
parent_node_handle | The handle to the parent 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.
graph | A pointer to the graph to search. |
parent_node_handle | The handle to the node to search. |
out_handle | A pointer to hold the found handle if successful. |
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 via the use of handles and handles to xforms.
out_graph | A pointer to hold the newly-created graph. |
KAPI void hierarchy_graph_destroy | ( | hierarchy_graph * | graph | ) |
Destroys the given hierarchy graph, releasing all resources. FIXME: This should also optionally release xforms if requested to do so. It currently does not.
graph | A pointer to the graph to be destroyed. |
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 upon removal (i.e. children, if they exist, are moved to this node's parent or the root). Also invalidates the given handle. Optionally releases the xform.
graph | A pointer to the graph to remove the node from. |
node_handle | A pointer to the handle of the node to be removed. Handle is invalidated upon completion. |
release_xform | Indicates if the associated xform (assuming there is one) should also be released. |
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 not exist or if it has no parent.
graph | A constant pointer to the graph to examine. |
node_handle | The handle to the node to examine. |
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, its parent, or an xform for it does not exist.
graph | A constant pointer to the graph to examine. |
node_handle | The handle to the node to examine. |
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.
graph | A pointer to the graph to add the node to. |
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. Returns the handle to the new node.
graph | A pointer to the graph to add the node to. |
xform_handle | The handle to the xform to use when adding the node. |
KAPI void hierarchy_graph_update | ( | hierarchy_graph * | graph | ) |
Performs internal update routines on the hierarchy, which includes rebuilding the internal view tree.
graph | A pointer to the graph to update. |
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 not exist.
graph | A constant pointer to the hierarchy graph to traverse. |
node_handle | The handle to the node to examine. |
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) does not exist.
graph | A constant pointer to the hierarchy graph to traverse. |
node_handle | The handle to the node to examine. |
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 exist.
graph | A constant pointer to the hierarchy graph to traverse. |
node_handle | The handle to the node to examine. |
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 for it) does not exist.
graph | A constant pointer to the graph to examine. |
node_handle | The handle to the node to examine. |
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 transform.
graph | A pointer to the graph to examine. |
node_handle | The handle to the node to examine. |
out_matrix | A constant pointer to hold the matrix. Required. |