From bd57f345ed9dbed1d81683e48199626de2ea9044 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Fri, 27 Jun 2025 10:18:39 -0700 Subject: Restructure project --- src/scene/node_impl.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/scene/node_impl.h (limited to 'src/scene/node_impl.h') diff --git a/src/scene/node_impl.h b/src/scene/node_impl.h new file mode 100644 index 0000000..c79f252 --- /dev/null +++ b/src/scene/node_impl.h @@ -0,0 +1,40 @@ +#pragma once + +#include + +#include "types.h" + +#include +#include + +/// Scene node. +/// +/// The SceneNode owns its cameras, objects, lights and child nodes. These +/// together form a strict tree hierarchy and not a more general DAG. +typedef struct SceneNode { + NodeType type; + union { + anima_idx anima; + camera_idx camera; + light_idx light; + model_idx model; + object_idx object; + }; + mat4 transform; // Transformation for this node and its children. + node_idx parent; // Parent SceneNode. + node_idx child; // First child SceneNode. + node_idx next; // Next sibling SceneNode. + node_idx prev; // Previous sibling SceneNode. +} SceneNode; + +/// Recursively destroy a node given its index but without destroying the node +/// resources. +/// +/// The node and its children are removed from the scene graph. +/// +/// This function is for the library's internal use only. +void gfx_del_node(node_idx); + +/// Return a shallow clone of the scene rooted at the given node. +/// The given node must have no siblings (must be a root node). +SceneNode* gfx_clone_scene_shallow(const SceneNode*); -- cgit v1.2.3