Wed, 06 Mar 2024 23:38:17 +0100
invert the logic of converting between specialized nodes and the generic interface
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | /* |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | * Copyright 2023 Mike Becker. All rights reserved. |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | * |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | * Redistribution and use in source and binary forms, with or without |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | * modification, are permitted provided that the following conditions are met: |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | * |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | * 1. Redistributions of source code must retain the above copyright |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | * notice, this list of conditions and the following disclaimer. |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | * |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | * 2. Redistributions in binary form must reproduce the above copyright |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | * notice, this list of conditions and the following disclaimer in the |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | * documentation and/or other materials provided with the distribution. |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | * |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | * POSSIBILITY OF SUCH DAMAGE. |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | */ |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | #include "ascension/scene.h" |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
29 | #include "ascension/error.h" |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
30 | |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
31 | #include <cx/tree.h> |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
32 | |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
33 | #include <assert.h> |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
34 | |
30
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
35 | #define child_list_off_ \ |
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
36 | offsetof(AscSceneNode, children), offsetof(AscSceneNode, next) |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
37 | |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
38 | void asc_scene_init(AscScene *scene) { |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
39 | if (scene->root != NULL) { |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
40 | asc_error("Scene is already initialized."); |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
41 | return; |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
42 | } |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
43 | scene->root = asc_scene_node_empty(); |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
44 | } |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
45 | |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
46 | void asc_scene_destroy(AscScene *scene) { |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
47 | asc_scene_node_free(scene->root); |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
48 | } |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
49 | |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
50 | void asc_scene_add(AscScene *scene, AscSceneNode *node) { |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
51 | asc_scene_node_link(scene->root, node); |
32
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
52 | asc_node_update(node); |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
53 | } |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
54 | |
30
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
55 | void asc_scene_draw(AscScene const *scene) { |
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
56 | CxTreeIterator iter = cx_tree_iterator(scene->root, false, child_list_off_); |
32
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
57 | |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
58 | // skip the root node deliberately, we know it's just the container |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
59 | cxIteratorNext(iter); |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
60 | |
33
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
61 | // update the children |
30
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
62 | cx_foreach(AscSceneNode*, node, iter) { |
33
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
63 | // execute behaviors, first |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
64 | AscBehaviorNode *behavior = node->behaviors; |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
65 | while (behavior) { |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
66 | behavior->func(node); |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
67 | behavior = behavior->next; |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
68 | } |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
69 | |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
70 | // check if geometry needs update |
32
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
71 | if (node->need_update && node->update_func != NULL) { |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
72 | node->need_update = false; |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
73 | asc_transform_copy(node->transform, node->parent->transform); |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
74 | node->update_func(node); |
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
75 | } |
33
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
76 | |
32
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
77 | // TODO: don't visit the tree for drawing, visit the render groups |
30
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
78 | if (node->draw_func != NULL) { |
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
79 | node->draw_func(node); |
fceda550ebcb
apply new CxTreeIterator from ucx 3.1 preview
Mike Becker <universe@uap-core.de>
parents:
29
diff
changeset
|
80 | } |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
81 | } |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
82 | } |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
83 | |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
84 | AscSceneNode *asc_scene_node_empty(void) { |
27
4ccf4703999e
improve implementation of scene graph tree
Mike Becker <universe@uap-core.de>
parents:
21
diff
changeset
|
85 | AscSceneNode *node = calloc(1, sizeof(AscSceneNode)); |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
86 | assert(node != NULL); |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
87 | node->free_func = (asc_scene_free_func) free; |
32
86468a71dd73
add transformation matrix
Mike Becker <universe@uap-core.de>
parents:
31
diff
changeset
|
88 | asc_transform_identity(node->transform); |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
89 | return node; |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
90 | } |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
91 | |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
92 | void asc_scene_node_free(AscSceneNode *node) { |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
93 | if (node == NULL) return; |
27
4ccf4703999e
improve implementation of scene graph tree
Mike Becker <universe@uap-core.de>
parents:
21
diff
changeset
|
94 | |
4ccf4703999e
improve implementation of scene graph tree
Mike Becker <universe@uap-core.de>
parents:
21
diff
changeset
|
95 | // remove this node from its parent |
4ccf4703999e
improve implementation of scene graph tree
Mike Becker <universe@uap-core.de>
parents:
21
diff
changeset
|
96 | asc_scene_node_unlink(node); |
4ccf4703999e
improve implementation of scene graph tree
Mike Becker <universe@uap-core.de>
parents:
21
diff
changeset
|
97 | |
31
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
98 | // free the entire subtree |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
99 | CxTreeIterator iter = cx_tree_iterator(node, true, child_list_off_); |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
100 | cx_foreach(AscSceneNode*, child, iter) { |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
101 | if (!iter.exiting) continue; |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
102 | if (child->free_func != NULL) { |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
103 | child->free_func(child); |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
104 | } else { |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
105 | free(child); |
8324037e0148
use tree iterator to free scene nodes
Mike Becker <universe@uap-core.de>
parents:
30
diff
changeset
|
106 | } |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
107 | } |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
108 | } |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
109 | |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
110 | void asc_scene_node_link(AscSceneNode * restrict parent, AscSceneNode * restrict node) { |
33
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
111 | cx_tree_link( |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
112 | parent, node, |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
113 | offsetof(AscSceneNode, parent), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
114 | offsetof(AscSceneNode, children), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
115 | offsetof(AscSceneNode, prev), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
116 | offsetof(AscSceneNode, next) |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
117 | ); |
29
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
118 | } |
1d001eb694dc
bring first scene graph to live
Mike Becker <universe@uap-core.de>
parents:
27
diff
changeset
|
119 | |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
120 | void asc_scene_node_unlink(AscSceneNode *node) { |
33
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
121 | cx_tree_unlink( |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
122 | node, |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
123 | offsetof(AscSceneNode, parent), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
124 | offsetof(AscSceneNode, children), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
125 | offsetof(AscSceneNode, prev), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
126 | offsetof(AscSceneNode, next) |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
127 | ); |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
128 | } |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
129 | |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
130 | AscBehaviorNode *asc_scene_add_behavior(AscSceneNode *node, asc_scene_update_func behavior) { |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
131 | AscBehaviorNode *behavior_node = calloc(1, sizeof(AscBehaviorNode)); |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
132 | behavior_node->func = behavior; |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
133 | cx_tree_link( |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
134 | node, |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
135 | behavior_node, |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
136 | offsetof(AscBehaviorNode, parent), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
137 | offsetof(AscSceneNode, behaviors), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
138 | offsetof(AscBehaviorNode, prev), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
139 | offsetof(AscBehaviorNode, next) |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
140 | ); |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
141 | return behavior_node; |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
142 | } |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
143 | |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
144 | void asc_scene_remove_behavior(AscBehaviorNode *node) { |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
145 | cx_tree_unlink( |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
146 | node, |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
147 | offsetof(AscBehaviorNode, parent), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
148 | offsetof(AscSceneNode, behaviors), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
149 | offsetof(AscBehaviorNode, prev), |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
150 | offsetof(AscBehaviorNode, next) |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
151 | ); |
e7ddb52facd3
add behavior nodes + restructure test program
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
152 | } |