annotate TaskManager/Test/test_render/task/update_sgp.cpp @ 138:3fd24be89d02

オブジェクトを増やして複数の表示に成功。 TODO:オブジェクトの削除
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Fri, 28 Nov 2008 12:16:24 +0900
parents 6cf991f28c6c
children e1d24c951408 a59868d37093
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include <stdio.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include <string.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include <unistd.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include <math.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "scene_graph_pack.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 #include "sys.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 #include "update_sgp.hpp"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9 SchedDefineTask(Update_SGP);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11 int
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 Update_SGP::run(void *rbuf, void *wbuf)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14 SceneGraphNodePtr node;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15 SceneGraphPack *sgp = (SceneGraphPack*)get_input(rbuf, 0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 SceneGraphPack *_sgp = (SceneGraphPack*)get_output(wbuf, 0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 int screen_width = get_param(0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 int screen_height = get_param(1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 // ϤǤ󤸤ʤ
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 for (int i = 0; i < sgp->info.size && i < 3; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 node = &sgp->node[i];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 do {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 if (node->pn != -1) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 get_matrix(node->translation,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 node->angle, node->obj_pos,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 sgp->node[node->pn].translation);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 get_matrix(node->translation,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 node->angle, node->obj_pos,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 NULL);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 node = node->next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 } while (node);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 memcpy(_sgp, sgp, sizeof(SceneGraphPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 return 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 }