src/scene_node.c

changeset 204
be5cf64b5c29
parent 189
2c063b225183
equal deleted inserted replaced
203:1883bdc4fb20 204:be5cf64b5c29
77 asc_scene_node_destroy(child); 77 asc_scene_node_destroy(child);
78 cxFreeDefault(child); 78 cxFreeDefault(child);
79 } 79 }
80 } 80 }
81 81
82 void asc_scene_node_calculate_transform(AscSceneNode *node) {
83 asc_transform temp, temp2;
84
85 // move the point of origin
86 asc_transform_translate3f(temp, asc_vec3f_neg(node->origin));
87
88 // apply the rotation
89 asc_transform_apply(node->transform, node->rotation, temp);
90
91 // apply the scale
92 asc_transform_scale3f(temp, node->scale);
93 asc_transform_apply(temp2, temp, node->transform);
94
95 // apply the translation
96 asc_transform_translate3f(temp, node->position);
97 asc_transform_apply(node->transform, temp, temp2);
98 }
99
82 void asc_scene_node_name(AscSceneNode *node, const char *name) { 100 void asc_scene_node_name(AscSceneNode *node, const char *name) {
83 cx_strfree(&node->name); 101 cx_strfree(&node->name);
84 if (name == NULL) { 102 if (name == NULL) {
85 node->name.ptr = NULL; 103 node->name.ptr = NULL;
86 node->name.length = 0; 104 node->name.length = 0;

mercurial