Mercurial > hg > Game > Cerium
comparison TaskManager/Test/simple_pack/task/update_sgp.cpp @ 53:0c8ae614d421
Initial revision
author | chiaki |
---|---|
date | Fri, 15 Feb 2008 20:58:50 +0900 |
parents | |
children | 768452fab95e |
comparison
equal
deleted
inserted
replaced
52:e198c3e01cec | 53:0c8ae614d421 |
---|---|
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 } |