comparison old/simple_render/task/update_sgp.cpp @ 507:735f76483bb2

Reorganization..
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 12 Oct 2009 09:39:35 +0900
parents TaskManager/Test/simple_render/task/update_sgp.cpp@f64d75473f95
children
comparison
equal deleted inserted replaced
506:1d4a8a86f26b 507:735f76483bb2
1 #include <stdio.h>
2 #include <string.h>
3 #include <unistd.h>
4 #include <math.h>
5 #include "viewer.h"
6 #include "scene_graph_pack.h"
7 #include "sys.h"
8 using namespace std;
9
10 #include "error.h"
11
12 int
13 update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp)
14 {
15 SceneGraphNodePtr node;
16 float y_angle;
17
18 // 本当はここでやるもんじゃないんだが。。。
19 static float dest_x = 0.3f;
20 static float dest_y = 0.5f;
21
22 __debug("[%s]\n", __FUNCTION__);
23
24 for (int i = 0; i < sgp->info.size; i++) {
25 //(*my_func[node->move])(node);
26 //(*my_func[node->interaction])(node, sgp);
27
28 node = &sgp->node[i];
29
30 // 本当は、ここは上の my_func で行う
31 y_angle = node->angle[1];
32 y_angle += 1.0f;
33 if (y_angle > 360.0f) y_angle = 0.0f;
34 node->angle[1] = y_angle;
35 //node->obj_pos[0] += 0.5f;
36 //node->obj_pos[1] += 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 }
51
52 if (node->pn != -1) {
53 get_matrix(node->translation,
54 node->angle, node->obj_pos,
55 sgp->node[node->pn].translation);
56 } else {
57 get_matrix(node->translation,
58 node->angle, node->obj_pos,
59 NULL);
60 }
61 }
62
63 // まあこれは多分駄目なんだけど。
64 // in/out と update は分ける必要ある?
65 // それはユーザ側で in/out になるように書かせるもの?
66 memcpy(_sgp, sgp, sizeof(SceneGraphPack));
67
68 return sizeof(SceneGraphPack);
69 //return 0;
70 }