Mercurial > hg > Game > Cerium
comparison TaskManager/Test/simple_render/task/update_sgp.cpp @ 109:028ffc9c0375 draft
Cerium cvs version
author | gongo@gendarme.local |
---|---|
date | Wed, 12 Nov 2008 17:39:33 +0900 |
parents | 663bc2a213f5 |
children | 768452fab95e |
comparison
equal
deleted
inserted
replaced
108:6f3b3dd3c095 | 109:028ffc9c0375 |
---|---|
1 #include <stdio.h> | |
1 #include <string.h> | 2 #include <string.h> |
3 #include <unistd.h> | |
2 #include <math.h> | 4 #include <math.h> |
5 #include "viewer.h" | |
3 #include "scene_graph_pack.h" | 6 #include "scene_graph_pack.h" |
4 #include "sys.h" | 7 #include "sys.h" |
5 using namespace std; | 8 using namespace std; |
6 | 9 |
7 #include "error.h" | 10 #include "error.h" |
9 int | 12 int |
10 update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp) | 13 update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp) |
11 { | 14 { |
12 SceneGraphNodePtr node; | 15 SceneGraphNodePtr node; |
13 float y_angle; | 16 float y_angle; |
17 | |
18 // 本当はここでやるもんじゃないんだが。。。 | |
19 static float dest_x = 0.3f; | |
20 static float dest_y = 0.5f; | |
14 | 21 |
15 __debug("[%s]\n", __FUNCTION__); | 22 __debug("[%s]\n", __FUNCTION__); |
16 | 23 |
17 for (int i = 0; i < sgp->info.size; i++) { | 24 for (int i = 0; i < sgp->info.size; i++) { |
18 //(*my_func[node->move])(node); | 25 //(*my_func[node->move])(node); |
26 if (y_angle > 360.0f) y_angle = 0.0f; | 33 if (y_angle > 360.0f) y_angle = 0.0f; |
27 node->angle[1] = y_angle; | 34 node->angle[1] = y_angle; |
28 //node->obj_pos[0] += 0.5f; | 35 //node->obj_pos[0] += 0.5f; |
29 //node->obj_pos[1] += 0.5f; | 36 //node->obj_pos[1] += 0.5f; |
30 //node->obj_pos[2] += 0.5f; | 37 //node->obj_pos[2] += 0.5f; |
38 | |
39 //node->obj_pos[0] += dest_x; | |
40 node->obj_pos[0] = 360.0f; | |
41 if ((int)node->obj_pos[0] > Viewer::width || | |
42 (int)node->obj_pos[0] < 0) { | |
43 dest_x = -dest_x; | |
44 } | |
45 | |
46 node->obj_pos[1] += dest_y; | |
47 if ((int)node->obj_pos[1] > Viewer::height || | |
48 (int)node->obj_pos[1] < 0) { | |
49 dest_y = -dest_y; | |
50 } | |
31 | 51 |
32 if (node->pn != -1) { | 52 if (node->pn != -1) { |
33 get_matrix(node->translation, | 53 get_matrix(node->translation, |
34 node->angle, node->obj_pos, | 54 node->angle, node->obj_pos, |
35 sgp->node[node->pn].translation); | 55 sgp->node[node->pn].translation); |