Untitled
Loading...
Searching...
No Matches
engine_utilities.c
Go to the documentation of this file.
1
2
3#include "core/engine_types.h"
4
5bool mn_inside_of_root_tree(MeshNode * mns, int check_id, int id)
6{
7 if (id == -1 || check_id == -1) return false;
8 MeshNode * mn = &mns[id];
9 if (mn->id == check_id) return true;
10 for (int i = 0; i < mn->child_count; i++)
11 {
12 bool inside = mn_inside_of_root_tree(mns, check_id, mn->children[i]);
13 if (inside == true) return true;
14 }
15 return false;
16
17}
18
20{
21
22
23 if (mn->parent != -1)
24 {
25 return get_root_node(mns, &mns[mn->parent]);
26 }
27
28 return mn;
29
30}
Engine specific types and defines.
bool mn_inside_of_root_tree(MeshNode *mns, int check_id, int id)
MeshNode * get_root_node(MeshNode *mns, MeshNode *mn)
size_t id
The ID inside of Globals.mesh_nodes.
int children[128]
The children to this node, a global index into Globals.mesh_nodes.
int parent
The parent to this node, a global index into Globals.mesh_nodes.
int child_count
The amount of children.
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...