aboutsummaryrefslogtreecommitdiff
path: root/src/scene/node_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/scene/node_impl.h')
-rw-r--r--src/scene/node_impl.h40
1 files changed, 40 insertions, 0 deletions
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 @@
1#pragma once
2
3#include <gfx/scene/node.h>
4
5#include "types.h"
6
7#include <cstring.h>
8#include <math/mat4.h>
9
10/// Scene node.
11///
12/// The SceneNode owns its cameras, objects, lights and child nodes. These
13/// together form a strict tree hierarchy and not a more general DAG.
14typedef struct SceneNode {
15 NodeType type;
16 union {
17 anima_idx anima;
18 camera_idx camera;
19 light_idx light;
20 model_idx model;
21 object_idx object;
22 };
23 mat4 transform; // Transformation for this node and its children.
24 node_idx parent; // Parent SceneNode.
25 node_idx child; // First child SceneNode.
26 node_idx next; // Next sibling SceneNode.
27 node_idx prev; // Previous sibling SceneNode.
28} SceneNode;
29
30/// Recursively destroy a node given its index but without destroying the node
31/// resources.
32///
33/// The node and its children are removed from the scene graph.
34///
35/// This function is for the library's internal use only.
36void gfx_del_node(node_idx);
37
38/// Return a shallow clone of the scene rooted at the given node.
39/// The given node must have no siblings (must be a root node).
40SceneNode* gfx_clone_scene_shallow(const SceneNode*);