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