Mercurial > hg > Game > Cerium
annotate TaskManager/Test/test_render/SceneGraphRoot.cc @ 421:6094dfd1f08c draft
comment
author | game@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 24 Sep 2009 12:35:32 +0900 |
parents | 0d2dc1869cbe |
children | 217258e3d148 |
rev | line source |
---|---|
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
1 #include <SDL.h> |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
2 #include <SDL_image.h> |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
3 #include <libxml/parser.h> |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
4 #include "SceneGraphRoot.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
5 #include "xml.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
6 #include "sys.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
7 #include "TextureHash.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
8 #include "texture.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
9 #include "SGList.h" |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
10 |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
11 int cnt = 0; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
12 |
221 | 13 SceneGraphRoot::SceneGraphRoot(float w, float h) |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
14 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
15 sg_src = new SceneGraphPtr[SGLIST_LENGTH]; |
221 | 16 camera = new Camera(w, h); |
201 | 17 iterator = new SceneGraphIterator; |
221 | 18 controller = create_controller(); |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
19 |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
20 sg_exec_tree = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
21 sg_draw_tree = NULL; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
22 sg_available_list = NULL; |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
23 sg_remove_list = NULL; |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
24 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
25 // TODO |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
26 // 今はとりあえず camera を Root にしています |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
27 // 今はそれすらもしてません |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
28 //sg_exec_tree = camera; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
29 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
30 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
31 SceneGraphRoot::~SceneGraphRoot(void) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
32 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
33 SceneGraphPtr p = sg_available_list; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
34 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
35 while (p) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
36 SceneGraphPtr tmp = p->next; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
37 delete p; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
38 p = tmp; |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
39 cnt--; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
40 } |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
41 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
42 p = sg_remove_list; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
43 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
44 while (p) { |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
45 SceneGraphPtr tmp = p->next; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
46 delete p; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
47 p = tmp; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
48 cnt--; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
49 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
50 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
51 delete [] sg_src; |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
52 delete camera; |
201 | 53 delete iterator; |
221 | 54 delete controller; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
55 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
56 |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
57 /** |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
58 * xml ファイルから生成された SceneGraph を sg_src に登録する。 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
59 * |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
60 * @param sg SceneGraph created by xmlfile |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
61 */ |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
62 void |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
63 SceneGraphRoot::registSceneGraph(SceneGraphPtr sg) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
64 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
65 for (int i = 0; i < SGLIST_LENGTH; i++) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
66 if (strcmp(sg->name, sglist_table[i]) == 0) { |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
213
diff
changeset
|
67 sg->sgid = i; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
68 sg_src[i] = sg; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
69 return; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
70 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
71 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
72 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
73 fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n", |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
74 __FUNCTION__, __LINE__, sg->name); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
75 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
76 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
77 void |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
78 SceneGraphRoot::addNext(SceneGraphPtr sg) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
79 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
80 SceneGraphPtr last = sg_available_list; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
81 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
82 if (!last) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
83 sg_available_list = sg; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
84 } else { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
85 while (last->next) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
86 last = last->next; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
87 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
88 last->next = sg; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
89 sg->prev = last; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
90 } |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
91 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
92 cnt++; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
93 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
94 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
95 /* XMLファイルからポリゴンを作成 */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
96 void |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
396
diff
changeset
|
97 SceneGraphRoot::createFromXMLfile(TaskManager *manager, const char *xmlfile) |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
98 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
99 xmlDocPtr doc; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
100 xmlNodePtr cur; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
101 SceneGraphPtr tmp; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
102 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
103 /* パース DOM生成 */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
104 doc = xmlParseFile(xmlfile); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
105 cur = xmlDocGetRootElement(doc); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
106 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
107 /* ?? */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
108 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D"); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
109 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
110 /* XMLのノードを一つずつ解析 */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
111 for (cur=cur->children; cur; cur=cur->next) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
112 /* 扱うのはsurfaceオンリー */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
113 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
114 continue; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
115 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
116 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
117 /* ポリゴン(SceneGraph)生成 */ |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
396
diff
changeset
|
118 tmp = new SceneGraph(manager, cur); |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
119 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
120 registSceneGraph(tmp); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
121 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
122 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
123 xmlFreeDoc(doc); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
124 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
125 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
126 SceneGraphPtr |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
127 SceneGraphRoot::createSceneGraph(int id) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
128 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
129 SceneGraphPtr src; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
130 SceneGraphPtr p; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
131 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
132 if (id < 0 || id > SGLIST_LENGTH) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
133 return NULL; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
134 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
135 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
136 /* オリジナルの SceneGraph */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
137 src = sg_src[id]; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
138 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
139 /* ユーザーにはオリジナルの clone を返す */ |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
140 p = src->clone(); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
141 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
142 addNext(p); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
143 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
144 return p; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
145 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
146 |
203 | 147 /** |
148 * 何も表示しない、move,collision もしない SceneGraph を生成 | |
149 * いずれ、Transform3D 的なものに回す予定 | |
150 */ | |
201 | 151 SceneGraphPtr |
152 SceneGraphRoot::createSceneGraph(void) | |
153 { | |
154 SceneGraphPtr p = new SceneGraph; | |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
213
diff
changeset
|
155 |
201 | 156 addNext(p); |
203 | 157 p->flag_drawable = 0; |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
213
diff
changeset
|
158 |
201 | 159 return p; |
160 } | |
161 | |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
162 void |
396
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
163 SceneGraphRoot::speExecute(int screen_w, int screen_h) |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
164 { |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
165 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
166 SceneGraphPtr list = sg_available_list; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
167 SceneGraphPtr t = sg_exec_tree; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
168 SceneGraphPtr cur_parent = camera; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
169 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
170 // 前フレームで描画した SceneGraph は削除 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
171 allRemove(sg_remove_list); |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
172 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
173 // 前フレームに作られた SceneGraph は描画用に移行 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
174 // 現フレームでの操作は以下の tree,list には適用されない |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
175 sg_draw_tree = sg_exec_tree; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
176 sg_remove_list = sg_available_list; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
177 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
178 // 現フレームで新しく SceneGraph がコピーされるので初期化 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
179 sg_exec_tree = NULL; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
180 sg_available_list = NULL; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
181 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
182 camera->move_execute(screen_w, screen_h); |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
183 camera->update(screen_w, screen_h); |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
184 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
185 camera->children = NULL; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
186 camera->lastChild = NULL; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
187 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
188 list->move_execute(screen_w, screen_h); |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
189 list->collision_check(screen_w, screen_h, list); |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
190 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
191 list->frame++; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
192 list = list->next; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
193 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
194 if(sg_exec_tree != NULL) { |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
195 return; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
196 } |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
197 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
198 /*removeのflagをもとにtreeを形成*/ |
421 | 199 /* spe から送り返されてきた property の配列を見て生成する for()*/ |
200 for (Property *t = property[0]; is_end(t); t++){ | |
201 SceneGraphPtr s = application->scenegraph_factory(t); // SceneGraphNode を作る | |
202 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている | |
203 application->scenegraph_connector(property[0], s); // add する | |
396
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
204 } |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
205 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
206 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
207 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
208 // 現在、allExecute が終わった時点では |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
209 // camera->children が User SceneGraph の root になる |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
210 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
211 /** |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
212 * NULL じゃなかったら、setSceneData が呼ばれてるから |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
213 * そっちを次の Scene にする |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
214 */ |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
215 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
216 sg_exec_tree = camera->children; |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
217 } |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
218 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
219 |
0b623693e6ec
don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
339
diff
changeset
|
220 void |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
221 SceneGraphRoot::allExecute(int screen_w, int screen_h) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
222 { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
223 SceneGraphPtr list = sg_available_list; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
224 SceneGraphPtr t = sg_exec_tree; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
225 SceneGraphPtr cur_parent = camera; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
226 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
227 // 前フレームで描画した SceneGraph は削除 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
228 allRemove(sg_remove_list); |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
229 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
230 // 前フレームに作られた SceneGraph は描画用に移行 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
231 // 現フレームでの操作は以下の tree,list には適用されない |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
232 sg_draw_tree = sg_exec_tree; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
233 sg_remove_list = sg_available_list; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
234 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
235 // 現フレームで新しく SceneGraph がコピーされるので初期化 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
236 sg_exec_tree = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
237 sg_available_list = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
238 |
221 | 239 camera->move_execute(screen_w, screen_h); |
206 | 240 camera->update(screen_w, screen_h); |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
241 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
242 camera->children = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
243 camera->lastChild = NULL; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
244 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
245 /*まずは全部動作させる*/ |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
246 while (list) { |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
247 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
248 list->move_execute(screen_w, screen_h); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
249 list->collision_check(screen_w, screen_h, list); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
250 |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
251 list->frame++; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
252 list = list->next; |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
253 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
254 } |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
255 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
256 if(sg_exec_tree != NULL) { |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
257 return; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
258 } |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
259 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
260 /*removeのflagをもとにtreeを形成*/ |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
261 while (t) { |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
262 SceneGraphPtr c = NULL; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
263 if (!t->isRemoved()) { |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
264 c = t->clone(); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
265 addNext(c); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
266 cur_parent->addChild(c); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
267 c->frame = t->frame; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
268 /*親の回転、座標から、子の回転、座標を算出*/ |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
269 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix); |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
270 } |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
271 |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
272 if (t->children != NULL && c != NULL) { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
273 cur_parent = c; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
274 t = t->children; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
275 } else if (t->brother != NULL) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
276 t = t->brother; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
277 } else { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
278 while (t) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
279 if (t->brother != NULL) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
280 t = t->brother; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
281 break; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
282 } else { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
283 if (t->parent == NULL) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
284 t = NULL; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
285 break; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
286 } else { |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
287 cur_parent = cur_parent->parent; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
288 t = t->parent; |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
289 |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
290 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
291 } |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
292 } |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
293 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
294 } |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
295 |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
296 |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
297 |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
298 // 現在、allExecute が終わった時点では |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
299 // camera->children が User SceneGraph の root になる |
339
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
300 |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
301 /** |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
302 * NULL じゃなかったら、setSceneData が呼ばれてるから |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
303 * そっちを次の Scene にする |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
304 */ |
ddc5b0b51086
change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents:
222
diff
changeset
|
305 |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
306 sg_exec_tree = camera->children; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
307 } |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
308 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
309 void |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
310 SceneGraphRoot::allRemove(SceneGraphPtr list) |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
311 { |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
312 SceneGraphPtr p = list; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
313 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
314 while (p) { |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
315 SceneGraphPtr p1 = p->next; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
316 delete p; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
317 p = p1; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
318 cnt--; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
319 } |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
320 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
321 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
322 void |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
323 SceneGraphRoot::checkRemove(void) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
324 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
325 SceneGraphPtr p = sg_available_list; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
326 SceneGraphPtr p1; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
327 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
328 while (p) { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
329 p1 = p->next; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
330 if (p->isRemoved()) { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
331 sg_exec_tree = p->realRemoveFromTree(sg_exec_tree); |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
332 sg_available_list = p->realRemoveFromList(sg_available_list); |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
333 } |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
334 delete p; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
335 p = p1; |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
336 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
337 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
338 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
339 SceneGraphPtr |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
340 SceneGraphRoot::getExecuteSceneGraph(void) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
341 { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
342 return sg_exec_tree; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
343 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
344 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
345 SceneGraphPtr |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
346 SceneGraphRoot::getDrawSceneGraph(void) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
347 { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
348 return sg_draw_tree; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
349 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
350 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
351 void |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
352 SceneGraphRoot::updateControllerState(void) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
353 { |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
354 controller->check(); |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
355 } |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
356 |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
357 void |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
358 SceneGraphRoot::setSceneData(SceneGraphPtr sg) |
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
359 { |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
360 sg_exec_tree = sg; |
196
ecda783a926f
add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
361 } |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
362 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
363 Pad* |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
364 SceneGraphRoot::getController(void) |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
365 { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
366 return controller; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
196
diff
changeset
|
367 } |
201 | 368 |
369 SceneGraphIteratorPtr | |
370 SceneGraphRoot::getIterator(void) | |
371 { | |
222 | 372 iterator->set(sg_remove_list); |
201 | 373 return iterator; |
374 } | |
375 | |
376 SceneGraphIteratorPtr | |
377 SceneGraphRoot::getIterator(SceneGraphPtr list) | |
378 { | |
379 iterator->set(list); | |
380 return iterator; | |
381 } | |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
382 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
383 CameraPtr |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
384 SceneGraphRoot::getCamera(void) |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
385 { |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
386 return camera; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
215
diff
changeset
|
387 } |