89
|
1 #include <string.h>
|
35
|
2 #include <math.h>
|
|
3 #include "scene_graph_pack.h"
|
|
4 #include "sys.h"
|
|
5 using namespace std;
|
|
6
|
49
|
7 #include "error.h"
|
|
8
|
35
|
9 int
|
48
|
10 update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp)
|
35
|
11 {
|
|
12 SceneGraphNodePtr node;
|
36
|
13 float y_angle;
|
35
|
14
|
85
|
15 __debug("[%s]\n", __FUNCTION__);
|
49
|
16
|
35
|
17 for (int i = 0; i < sgp->info.size; i++) {
|
|
18 //(*my_func[node->move])(node);
|
|
19 //(*my_func[node->interaction])(node, sgp);
|
|
20
|
|
21 node = &sgp->node[i];
|
|
22
|
36
|
23 // 本当は、ここは上の my_func で行う
|
|
24 y_angle = node->angle[1];
|
|
25 y_angle += 1.0f;
|
|
26 if (y_angle > 360.0f) y_angle = 0.0f;
|
|
27 node->angle[1] = y_angle;
|
48
|
28 //node->obj_pos[0] += 0.5f;
|
|
29 //node->obj_pos[1] += 0.5f;
|
|
30 //node->obj_pos[2] += 0.5f;
|
36
|
31
|
35
|
32 if (node->pn != -1) {
|
|
33 get_matrix(node->translation,
|
|
34 node->angle, node->obj_pos,
|
|
35 sgp->node[node->pn].translation);
|
|
36 } else {
|
|
37 get_matrix(node->translation,
|
|
38 node->angle, node->obj_pos,
|
|
39 NULL);
|
|
40 }
|
|
41 }
|
|
42
|
|
43 // まあこれは多分駄目なんだけど。
|
|
44 // in/out と update は分ける必要ある?
|
|
45 // それはユーザ側で in/out になるように書かせるもの?
|
89
|
46 memcpy(_sgp, sgp, sizeof(SceneGraphPack));
|
35
|
47
|
86
|
48 //return sizeof(SceneGraphPack);
|
|
49 return 0;
|
35
|
50 }
|