diff options
author | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-12 12:47:07 +1000 |
---|---|---|
committer | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-12 12:47:07 +1000 |
commit | f74cf52946f4e569a26bc81105537b40be95c2c7 (patch) | |
tree | 1d000367350d0e28eb7cfbc800286a0ed30a4e6c /src/transform_hierarchy.c | |
parent | fedba7ff68924ff50022405fc9103a5acf7013fe (diff) |
wip: big makeover
Diffstat (limited to 'src/transform_hierarchy.c')
-rw-r--r-- | src/transform_hierarchy.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/transform_hierarchy.c b/src/transform_hierarchy.c index b9795bc..b08e545 100644 --- a/src/transform_hierarchy.c +++ b/src/transform_hierarchy.c @@ -11,6 +11,7 @@ #include "log.h" #include "maths.h" #include "maths_types.h" +#include "render_types.h" struct transform_hierarchy { transform_node root; @@ -49,8 +50,8 @@ void transform_hierarchy_free(transform_hierarchy* tfh) { transform_node* transform_hierarchy_root_node(transform_hierarchy* tfh) { return &tfh->root; } -transform_node* transform_hierarchy_add_node(transform_node* parent, model_handle model, - transform tf) { +transform_node* transform_hierarchy_add_node(transform_node* parent, ModelHandle model, + Transform tf) { if (!parent) { WARN("You tried to add a node to a bad parent (NULL?)"); return NULL; @@ -131,10 +132,10 @@ bool update_matrix(transform_node* node, void* _ctx_data) { if (node->tf.is_dirty) { // invalidates children - mat4 updated_local_transform = transform_to_mat(&node->tf); + Mat4 updated_local_transform = transform_to_mat(&node->tf); node->local_matrix_tf = updated_local_transform; if (node->parent) { - mat4 updated_world_transform = + Mat4 updated_world_transform = mat4_mult(node->parent->world_matrix_tf, updated_local_transform); node->world_matrix_tf = updated_world_transform; } @@ -149,7 +150,7 @@ void transform_hierarchy_propagate_transforms(transform_hierarchy* tfh) { } struct print_ctx { - core* core; + Core* core; u32 indentation_lvl; }; @@ -175,10 +176,10 @@ bool print_node(transform_node* node, void* ctx_data) { return true; } -void transform_hierarchy_debug_print(transform_node* start_node, core* core) { +void transform_hierarchy_debug_print(transform_node* start_node, Core* core) { struct print_ctx* ctx = malloc(sizeof(struct print_ctx)); ctx->core = core; ctx->indentation_lvl = 0; transform_hierarchy_dfs(start_node, print_node, true, (void*)ctx); free(ctx); -}
\ No newline at end of file +} |