annotate TaskManager/Test/test_render/SceneGraphRoot.cc @ 537:7014034b8d69

work dynamic_create
author aaa
date Wed, 21 Oct 2009 19:03:07 +0900
parents 997d2a73a758
children c5a411c19e7e e7551b50e0e7 9f9d51b60062
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include <SDL.h>
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include <SDL_image.h>
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 #include <libxml/parser.h>
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 #include "SceneGraphRoot.h"
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 #include "xml.h"
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 #include "sys.h"
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 #include "TextureHash.h"
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 #include "texture.h"
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 #include "SGList.h"
525
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
10 #include "Application.h"
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
12 int cnt = 0;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
13
221
d61fded0729e Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
14 SceneGraphRoot::SceneGraphRoot(float w, float h)
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 {
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
16 // SGLIST_LENGTH 決め打ちかぁ、動的生成にする場合上限決めておいた方がいいのかな
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 sg_src = new SceneGraphPtr[SGLIST_LENGTH];
221
d61fded0729e Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
18 camera = new Camera(w, h);
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
19 iterator = new SceneGraphIterator;
531
fab6f20021c9 change SceneGraphRoot's constructor
aaa
parents: 530
diff changeset
20 sglist = new SceneGraphList;
221
d61fded0729e Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
21 controller = create_controller();
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
22
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
23 sg_exec_tree = NULL;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
24 sg_draw_tree = NULL;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 sg_available_list = NULL;
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
26 sg_remove_list = NULL;
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
27
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
28 // TODO
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
29 // 今はとりあえず camera を Root にしています
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
30 // 今はそれすらもしてません
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
31 //sg_exec_tree = camera;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 SceneGraphRoot::~SceneGraphRoot(void)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 SceneGraphPtr p = sg_available_list;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 while (p) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
39 SceneGraphPtr tmp = p->next;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
40 delete p;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
41 p = tmp;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
42 cnt--;
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
43 }
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
44
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
45 p = sg_remove_list;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
46
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
47 while (p) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
48 SceneGraphPtr tmp = p->next;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
49 delete p;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
50 p = tmp;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
51 cnt--;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54 delete [] sg_src;
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
55 delete camera;
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
56 delete iterator;
221
d61fded0729e Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
57 delete controller;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
58 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
60 /**
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
61 * xml ファイルから生成された SceneGraph を sg_src に登録する。
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
62 *
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
63 * @param sg SceneGraph created by xmlfile
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
64 */
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65 void
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 SceneGraphRoot::registSceneGraph(SceneGraphPtr sg)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
67 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 for (int i = 0; i < SGLIST_LENGTH; i++) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
69 if (strcmp(sg->name, sglist_table[i]) == 0) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
70 sg->sgid = i;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
71 sg_src[i] = sg;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
72 return;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
73 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
76 fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n",
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
77 __FUNCTION__, __LINE__, sg->name);
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
78 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
80 void
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 SceneGraphRoot::addNext(SceneGraphPtr sg)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
82 {
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
83 SceneGraphPtr last = sg_available_list;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 if (!last) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
86 sg_available_list = sg;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
87 } else {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
88 while (last->next) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
89 last = last->next;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
90 }
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
91 last->next = sg;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
92 sg->prev = last;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
93 }
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
94
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
95 cnt++;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
96 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
97
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
98 /* XMLファイルからポリゴンを作成 */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
99 void
397
a4f690f44842 delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
100 SceneGraphRoot::createFromXMLfile(TaskManager *manager, const char *xmlfile)
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
101 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
102 xmlDocPtr doc;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
103 xmlNodePtr cur;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
104 SceneGraphPtr tmp;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
105
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
106 /* パース DOM生成 */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
107 doc = xmlParseFile(xmlfile);
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
108 cur = xmlDocGetRootElement(doc);
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
109
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
110 /* ?? */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
111 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
112
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
113 /* XMLのノードを一つずつ解析 */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
114 for (cur=cur->children; cur; cur=cur->next) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
115 /* 扱うのはsurfaceオンリー */
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
116 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
117 continue;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
118 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
119
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
120 /* ポリゴン(SceneGraph)生成 */
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
121 tmp = new SceneGraph(manager, cur);
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
122
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
123 registSceneGraph(tmp);
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
124 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
125
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
126 xmlFreeDoc(doc);
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
127 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
128
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
129 SceneGraphPtr
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
130 SceneGraphRoot::createSceneGraph(int id)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
131 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
132 SceneGraphPtr src;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
133 SceneGraphPtr p;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
134
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
135 if (id < 0 || id > SGLIST_LENGTH) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
136 return NULL;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
137 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
138
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
139 /* オリジナルの SceneGraph */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
140 src = sg_src[id];
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
141
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
142 /* ユーザーにはオリジナルの clone を返す */
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
143 p = src->clone();
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
144
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
145 addNext(p);
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
146
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
147 return p;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
148 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
149
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
150 #if 1
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
151 void
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
152 SceneGraphRoot::registSceneGraphList(SceneGraphPtr sg)
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
153 {
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
154 /*
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
155 SceneGraphRoot にメンバ変数 SceneGraphList を持たせておくか
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
156 SceneGraphList sglist
531
fab6f20021c9 change SceneGraphRoot's constructor
aaa
parents: 530
diff changeset
157 sg->name で検索して、有れば sg_src に追加。
fab6f20021c9 change SceneGraphRoot's constructor
aaa
parents: 530
diff changeset
158 sgid は sglist のメンバ変数 sgid で管理する感じ
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
159 */
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
160
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
161 SgStruct *s = sglist->get(sg->name);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
162 if (s != NULL) {
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
163 sg->sgid = sglist->sgid;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
164 s->id = sglist->sgid;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
165 sg_src[sg->sgid] = sg;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
166 sglist->sgid++;
531
fab6f20021c9 change SceneGraphRoot's constructor
aaa
parents: 530
diff changeset
167 return;
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
168 }
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
169
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
170 fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n",
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
171 __FUNCTION__, __LINE__, sg->name);
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
172 }
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
173
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
174 void
537
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
175 //SceneGraphRoot::createFromXMLmemory(TaskManager *manager, const char *xmlfile)
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
176 SceneGraphRoot::createFromXMLmemory(TaskManager *manager, st_mmap_t mmap_t)
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
177 {
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
178 xmlDocPtr doc;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
179 xmlNodePtr cur;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
180 SceneGraphPtr tmp;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
181
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
182 // size は取れるはず、テスト用に mmap したデータを使う
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
183 /* パース DOM生成 */
537
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
184 //doc = xmlParseFile(xmlfile);
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
185 int size = (int)mmap_t.size;
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
186 char *xmldata = (char *)mmap_t.file_mmap;
7014034b8d69 work dynamic_create
aaa
parents: 534
diff changeset
187 doc = xmlParseMemory(xmldata, size);
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
188 cur = xmlDocGetRootElement(doc);
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
189
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
190 /* ?? */
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
191 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
192
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
193 /* XMLのノードを一つずつ解析 */
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
194 for (cur=cur->children; cur; cur=cur->next) {
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
195 /* 扱うのはsurfaceオンリー */
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
196 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
197 continue;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
198 }
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
199
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
200 /* ポリゴン(SceneGraph)生成 */
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
201 tmp = new SceneGraph(manager, cur);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
202
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
203 addSceneGraphList(manager, tmp);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
204
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
205 registSceneGraphList(tmp);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
206 }
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
207
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
208 xmlFreeDoc(doc);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
209 }
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
210
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
211 /* 生成された SceneGraph のを sglist に登録 */
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
212 void
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
213 SceneGraphRoot::addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp)
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
214 {
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
215 SgStruct *sg_t = (SgStruct *)manager->allocate(sizeof(SgStruct));
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
216 sg_t->name = tmp->name;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
217 sglist->addLast(sg_t);
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
218 }
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
219
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
220 SceneGraphPtr
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
221 SceneGraphRoot::createSceneGraph(char *name)
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
222 {
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
223 SceneGraphPtr src;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
224 SceneGraphPtr p;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
225
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
226 // SceneGraphList から name を検索して id 取得
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
227 SgStruct *e = sglist->get(name);
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
228 int id = e->id;
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
229 if (id < 0) {
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
230 return NULL;
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
231 }
534
997d2a73a758 add Application/dynamic_create.cc
aaa
parents: 531
diff changeset
232
530
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
233 /* オリジナルの SceneGraph */
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
234 src = sg_src[id];
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
235
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
236 /* ユーザーにはオリジナルの clone を返す */
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
237 p = src->clone();
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
238
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
239 addNext(p);
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
240
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
241 return p;
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
242 }
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
243 #endif
18446bce1b8b add SceneGraphList
aaa
parents: 528
diff changeset
244
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
245 /**
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
246 * 何も表示しない、move,collision もしない SceneGraph を生成
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
247 * いずれ、Transform3D 的なものに回す予定
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
248 */
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
249 SceneGraphPtr
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
250 SceneGraphRoot::createSceneGraph(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
251 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
252 SceneGraphPtr p = new SceneGraph;
215
7ca6a2ef5be9 fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents: 213
diff changeset
253
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
254 addNext(p);
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
255 p->flag_drawable = 0;
215
7ca6a2ef5be9 fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents: 213
diff changeset
256
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
257 return p;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
258 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
259
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
260 void
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
261 SceneGraphRoot::speExecute(int screen_w, int screen_h)
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
262 {
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
263
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
264 SceneGraphPtr list = sg_available_list;
463
bc5b3d327083 remove run()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 450
diff changeset
265 // SceneGraphPtr t = sg_exec_tree;
bc5b3d327083 remove run()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 450
diff changeset
266 // SceneGraphPtr cur_parent = camera;
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
267
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
268 // 前フレームで描画した SceneGraph は削除
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
269 allRemove(sg_remove_list);
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
270
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
271 // 前フレームに作られた SceneGraph は描画用に移行
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
272 // 現フレームでの操作は以下の tree,list には適用されない
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
273 sg_draw_tree = sg_exec_tree;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
274 sg_remove_list = sg_available_list;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
275
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
276 // 現フレームで新しく SceneGraph がコピーされるので初期化
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
277 sg_exec_tree = NULL;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
278 sg_available_list = NULL;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
279
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
280 camera->move_execute(screen_w, screen_h);
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
281 camera->update(screen_w, screen_h);
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
282
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
283 camera->children = NULL;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
284 camera->lastChild = NULL;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
285
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
286 list->move_execute(screen_w, screen_h);
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
287 list->collision_check(screen_w, screen_h, list);
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
288
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
289 list->frame++;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
290 list = list->next;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
291
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
292 if(sg_exec_tree != NULL) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
293 return;
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
294 }
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
295
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
296 /*removeのflagをもとにtreeを形成*/
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
297 /* spe から送り返されてきた property の配列を見て生成する for()*/
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
298 /*
528
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
299 for (Property *t = (Property*)app->property[0]; is_end(t); t++){
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
300 SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
301 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
302 app->scenegraph_connector(property[0], s); // add する
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
303 }
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
304 */
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
305
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
306
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
307 // 現在、allExecute が終わった時点では
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
308 // camera->children が User SceneGraph の root になる
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
309
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
310 /**
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
311 * NULL じゃなかったら、setSceneData が呼ばれてるから
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
312 * そっちを次の Scene にする
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
313 */
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
314
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
315 sg_exec_tree = camera->children;
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
316 }
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
317
525
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
318 void
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
319 SceneGraphRoot::speExecute(int screen_w, int screen_h, Application *app)
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
320 {
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
321 // SceneGraphPtr t = sg_exec_tree;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
322 // SceneGraphPtr cur_parent = camera;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
323
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
324 // 前フレームで描画した SceneGraph は削除
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
325 allRemove(sg_remove_list);
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
326
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
327 // 前フレームに作られた SceneGraph は描画用に移行
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
328 // 現フレームでの操作は以下の tree,list には適用されない
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
329 sg_draw_tree = sg_exec_tree;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
330 sg_remove_list = sg_available_list;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
331
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
332 // 現フレームで新しく SceneGraph がコピーされるので初期化
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
333 sg_exec_tree = NULL;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
334 sg_available_list = NULL;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
335
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
336 camera->move_execute(screen_w, screen_h);
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
337 camera->update(screen_w, screen_h);
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
338
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
339 camera->children = NULL;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
340 camera->lastChild = NULL;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
341
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
342
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
343 if(sg_exec_tree != NULL) {
528
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
344 return;
525
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
345 }
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
346
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
347 /*removeのflagをもとにtreeを形成*/
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
348 /* spe から送り返されてきた property の配列を見て生成する for()*/
528
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
349 /* Application内に移動 */
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
350
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
351 app->property_ope(sg_available_list);
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
352
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
353 /*
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
354 for (Property *t = (Property *)properties[0]; is_end(t); t++){
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
355 SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
356 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
357 app->scenegraph_connector(property[0], s); // add する
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
358 }
525
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
359 */
528
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
360
541013f7015c Application ander constructing
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 525
diff changeset
361
525
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
362
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
363 // 現在、allExecute が終わった時点では
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
364 // camera->children が User SceneGraph の root になる
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
365
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
366 /**
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
367 * NULL じゃなかったら、setSceneData が呼ばれてるから
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
368 * そっちを次の Scene にする
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
369 */
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
370
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
371 sg_exec_tree = camera->children;
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
372 }
99a92f6a1c59 change Application
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 463
diff changeset
373
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
374
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 444
diff changeset
375 void
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
376 SceneGraphRoot::allExecute(int screen_w, int screen_h)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
377 {
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
378 SceneGraphPtr list = sg_available_list;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
379 SceneGraphPtr t = sg_exec_tree;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
380 SceneGraphPtr cur_parent = camera;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
381
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
382 // 前フレームで描画した SceneGraph は削除
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
383 allRemove(sg_remove_list);
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
384
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
385 // 前フレームに作られた SceneGraph は描画用に移行
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
386 // 現フレームでの操作は以下の tree,list には適用されない
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
387 sg_draw_tree = sg_exec_tree;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
388 sg_remove_list = sg_available_list;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
389
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
390 // 現フレームで新しく SceneGraph がコピーされるので初期化
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
391 sg_exec_tree = NULL;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
392 sg_available_list = NULL;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
393
221
d61fded0729e Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
394 camera->move_execute(screen_w, screen_h);
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 203
diff changeset
395 camera->update(screen_w, screen_h);
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
396
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
397 camera->children = NULL;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
398 camera->lastChild = NULL;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
399
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
400 /*まずは全部動作させる*/
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
401 while (list) {
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
402
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
403 list->move_execute(screen_w, screen_h);
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
404 list->collision_check(screen_w, screen_h, list);
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
405
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
406 list->frame++;
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
407 list = list->next;
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
408
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
409 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
410
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
411 if(sg_exec_tree != NULL) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
412 return;
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
413 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
414
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
415 /*removeのflagをもとにtreeを形成*/
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
416 while (t) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
417 SceneGraphPtr c = NULL;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
418 if (!t->isRemoved()) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
419 c = t->clone();
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
420 addNext(c);
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
421 cur_parent->addChild(c);
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
422 c->frame = t->frame;
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
423 /*親の回転、座標から、子の回転、座標を算出*/
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
424 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix);
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
425 }
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
426
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
427 if (t->children != NULL && c != NULL) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
428 cur_parent = c;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
429 t = t->children;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
430 } else if (t->brother != NULL) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
431 t = t->brother;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
432 } else {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
433 while (t) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
434 if (t->brother != NULL) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
435 t = t->brother;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
436 break;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
437 } else {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
438 if (t->parent == NULL) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
439 t = NULL;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
440 break;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
441 } else {
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
442 cur_parent = cur_parent->parent;
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
443 t = t->parent;
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
444
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
445 }
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
446 }
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
447 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
448 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
449 }
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
450
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
451
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
452
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
453 // 現在、allExecute が終わった時点では
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
454 // camera->children が User SceneGraph の root になる
339
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
455
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
456 /**
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
457 * NULL じゃなかったら、setSceneData が呼ばれてるから
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
458 * そっちを次の Scene にする
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
459 */
be8f785a82e9 change api setSceneDate
e065725@yutaka.st.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
460
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
461 sg_exec_tree = camera->children;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
462 }
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
463
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
464 void
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
465 SceneGraphRoot::allRemove(SceneGraphPtr list)
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
466 {
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
467 SceneGraphPtr p = list;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
468
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
469 while (p) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
470 SceneGraphPtr p1 = p->next;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
471 delete p;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
472 p = p1;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
473 cnt--;
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
474 }
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
475 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
476
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
477 void
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
478 SceneGraphRoot::checkRemove(void)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
479 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
480 SceneGraphPtr p = sg_available_list;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
481 SceneGraphPtr p1;
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
482
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
483 while (p) {
450
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
484 p1 = p->next;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
485 if (p->isRemoved()) {
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
486 sg_exec_tree = p->realRemoveFromTree(sg_exec_tree);
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
487 sg_available_list = p->realRemoveFromList(sg_available_list);
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
488 }
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
489 delete p;
01dc4e5be965 KeyStat fixed...
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 449
diff changeset
490 p = p1;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
491 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
492 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
493
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
494 SceneGraphPtr
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
495 SceneGraphRoot::getExecuteSceneGraph(void)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
496 {
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
497 return sg_exec_tree;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
498 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
499
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
500 SceneGraphPtr
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
501 SceneGraphRoot::getDrawSceneGraph(void)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
502 {
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
503 return sg_draw_tree;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
504 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
505
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
506 void
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
507 SceneGraphRoot::updateControllerState(void)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
508 {
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
509 controller->check();
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
510 }
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
511
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
512 void
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
513 SceneGraphRoot::setSceneData(SceneGraphPtr sg)
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
514 {
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
515 sg_exec_tree = sg;
196
932a05a7a1db add SceneGraphRoot, tools/create_sglist.pl
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
516 }
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
517
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
518 Pad*
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
519 SceneGraphRoot::getController(void)
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
520 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
521 return controller;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 196
diff changeset
522 }
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
523
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
524 SceneGraphIteratorPtr
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
525 SceneGraphRoot::getIterator(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
526 {
222
gongo@localhost.localdomain
parents: 221
diff changeset
527 iterator->set(sg_remove_list);
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
528 return iterator;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
529 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
530
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
531 SceneGraphIteratorPtr
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
532 SceneGraphRoot::getIterator(SceneGraphPtr list)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
533 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
534 iterator->set(list);
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
535 return iterator;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
536 }
219
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
537
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
538 CameraPtr
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
539 SceneGraphRoot::getCamera(void)
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
540 {
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
541 return camera;
0f1ff7b06157 allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 215
diff changeset
542 }