annotate TaskManager/Test/simple_pack/task/update_sgp.cpp @ 69:c9b973f0673e

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