#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*);