Mercurial > hg > Game > Cerium
annotate TaskManager/Test/test_render/SceneGraph.cpp @ 238:443c7ae1c7a7 draft
warning clean
author | admin@mcbk.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 29 May 2009 13:43:52 +0900 |
parents | a314d8cd2082 |
children | c4918a1fb6c9 |
rev | line source |
---|---|
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
1 #include <iostream> |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
2 #include <SDL.h> |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
3 #include <SDL_opengl.h> |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
4 #include <SDL_image.h> |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
5 #include <libxml/parser.h> |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
6 #include "SceneGraph.h" |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
7 #include "xml.h" |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
8 #include "sys.h" |
141 | 9 #include "TextureHash.h" |
10 #include "texture.h" | |
148
74341c8bf935
Span への Texture List の渡し。じゃっかん texture がバグってるので
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
142
diff
changeset
|
11 #include "TaskManager.h" |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
12 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
13 using namespace std; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
14 |
195 | 15 SceneGraphPtr scene_graph = NULL; |
16 SceneGraphPtr scene_graph_viewer = NULL; | |
17 | |
18 static TextureHash texture_hash; | |
19 struct texture_list list[TABLE_SIZE]; | |
20 | |
21 // TextureHash.cpp | |
22 extern int id_count; | |
23 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
24 extern int decode(char *cont, FILE *outfile); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
25 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
26 static void |
138 | 27 no_move(SceneGraphPtr self, int screen_w, int screen_h) {} |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
28 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
29 static void |
138 | 30 no_collision(SceneGraphPtr self, int screen_w, int screen_h, |
31 SceneGraphPtr tree) {} | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
32 |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
33 /** |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
34 * 事前に計算したテクスチャの最大縮小率 scale まで、 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
35 * テクスチャを 1/2 縮小していく。 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
36 * このとき、テクスチャは TEXTURE_SPLIT_PIXELx2 のブロック (Tile) で分割し、 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
37 * これらを連続したメモリ領域に格納していく。 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
38 * 以下の (1), (2), (3) を Tapestry と呼ぶ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
39 * |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
40 * 例 scale = 4 の場合 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
41 * |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
42 * Tapestry(1) 1/1 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
43 * +---+---+---+---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
44 * | 0 | 1 | 2 | 3 | |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
45 * +---+---+---+---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
46 * | 4 | 5 | 6 | 7 | (2) 1/2 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
47 * +---+---+---+---+ +---+---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
48 * | 8 | 9 | 10| 11| | 16| 17| (3) 1/4 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
49 * +---+---+---+---+ +---+---+ +---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
50 * | 12| 13| 14| 15| | 18| 19| | 20| |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
51 * +---+---+---+---+ +---+---+ +---| |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
52 * |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
53 * (1) (2) (3) |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
54 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
55 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | * | * | 14| 15| 16| 17| 18| 19| 20| |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
56 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
57 * |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
58 * @param[in] tex_w Width of orignal texture |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
59 * @param[in] tex_h Height of orignal texture |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
60 * @param[in] tex_src Original texture |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
61 * @param[in] all_pixel_num Tapestry の合計 pixel 数 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
62 * @param[in] scale テクスチャの最大縮小率 (= 2^n) |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
63 * @return (1) のアドレス |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
64 */ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
65 static uint32* |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
66 makeTapestry(int tex_w, int tex_h, uint32 *tex_src, |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
67 int all_pixel_num, int scale_cnt) |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
68 { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
69 uint32 *tex_dest; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
70 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
71 int t = 0; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
72 int diff = TEXTURE_SPLIT_PIXEL; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
73 int p_diff = 1; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
74 |
217 | 75 tex_dest = (uint32*)manager->allocate(sizeof(int)*all_pixel_num); |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
76 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
77 while (scale_cnt) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
78 for (int y = 0; y < tex_h; y += diff) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
79 for (int x = 0; x < tex_w; x += diff) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
80 for (int j = 0; j < diff; j += p_diff) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
81 for (int i = 0; i < diff; i += p_diff) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
82 tex_dest[t++] |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
83 = tex_src[(x+i) + tex_w*(y+j)]; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
84 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
85 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
86 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
87 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
88 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
89 diff <<= 1; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
90 p_diff <<= 1; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
91 scale_cnt >>= 1; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
92 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
93 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
94 return tex_dest; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
95 } |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
96 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
97 |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
98 /** |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
99 * 何の情報も持ってない SceneGraph の生成 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
100 * 今のところ、とりあえず木構造の繋がりに使うぐらい |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
101 */ |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
102 SceneGraph::SceneGraph(void) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
103 { |
140 | 104 init(); |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
105 finalize = &SceneGraph::finalize_copy; |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
106 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
107 this->name = "NULLPO"; |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
108 } |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
109 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
110 /** |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
111 * orig のコピーとして SceneGraph を生成する |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
112 */ |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
113 SceneGraph::SceneGraph(SceneGraphPtr orig) |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
114 { |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
115 init(); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
116 memcpy(this, orig, sizeof(SceneGraph)); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
117 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
118 // コピーしない |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
119 //flag_remove = 0; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
120 //flag_drawable = 1; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
121 next = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
122 prev = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
123 last = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
124 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
125 parent = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
126 brother = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
127 children = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
128 lastChild = NULL; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
129 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
130 finalize = &SceneGraph::finalize_copy; |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
131 |
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
218
diff
changeset
|
132 |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
133 frame = 0; |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
134 } |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
135 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
136 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
137 /* construct polygon from xmlNode. */ |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
138 SceneGraph::SceneGraph(xmlNodePtr surface) |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
139 { |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
140 init(); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
141 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
142 size = atoi((char *)xmlGetProp(surface,(xmlChar *)"size")); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
143 name = (char *)xmlGetProp(surface,(xmlChar *)"name"); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
144 parent_name = (char *)xmlGetProp(surface,(xmlChar *)"parent"); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
145 |
228
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
146 //data = new float[size*3*3]; |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
147 coord_xyz = (float*)manager->allocate(sizeof(float)*size*3); |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
148 coord_tex = (float*)manager->allocate(sizeof(float)*size*3); |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
149 normal = (float*)manager->allocate(sizeof(float)*size*3); |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
150 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
151 get_data(surface->children); |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
152 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
153 finalize = &SceneGraph::finalize_original; |
140 | 154 } |
155 | |
156 void | |
157 SceneGraph::init(void) | |
158 { | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
159 next = NULL; |
195 | 160 prev = NULL; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
161 last = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
162 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
163 parent = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
164 brother = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
165 children = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
166 lastChild = NULL; |
138 | 167 |
168 stack_xyz[0] = 0.0f; | |
169 stack_xyz[2] = 0.0f; | |
170 stack_xyz[1] = 0.0f; | |
171 stack_angle[0] = 0.0f; | |
172 stack_angle[1] = 0.0f; | |
173 stack_angle[2] = 0.0f; | |
174 | |
203 | 175 size = 0; |
228
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
176 //data = NULL; |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
177 coord_xyz = NULL; |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
178 normal = NULL; |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
179 coord_tex = NULL; |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
180 |
141 | 181 texture_id = -1; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
182 move = no_move; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
183 collision = no_collision; |
142 | 184 |
195 | 185 flag_remove = 0; |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
186 flag_drawable = 1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
187 sgid = -1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
188 |
142 | 189 frame = 0; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
190 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
191 |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
192 SceneGraph::~SceneGraph(void) |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
193 { |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
194 (this->*finalize)(); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
195 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
196 |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
197 /** |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
198 * xml ファイルから生成されたオリジナル SceneGraph なので |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
199 * polygon data を削除 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
200 */ |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
201 void |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
202 SceneGraph::finalize_original(void) |
140 | 203 { |
228
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
204 //delete [] data; |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
205 free(coord_xyz); |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
206 free(coord_tex); |
5bb12a76a335
remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
224
diff
changeset
|
207 free(normal); |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
208 } |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
209 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
210 /** |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
211 * SceneGraph ID から生成された、コピー SceneGraph なので |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
212 * polygon data は削除しない。オリジナルの方で削除する。 |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
213 */ |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
214 void |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
215 SceneGraph::finalize_copy(void) |
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
216 { |
140 | 217 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
218 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
219 /* XMLファイルからポリゴンを作成 */ |
140 | 220 void |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
178
diff
changeset
|
221 SceneGraph::createFromXMLfile(const char *xmlfile) |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
222 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
223 xmlDocPtr doc; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
224 xmlNodePtr cur; |
238 | 225 SceneGraphPtr root = NULL, tmp = NULL, parent; |
140 | 226 |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
227 /* パース DOM生成 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
228 doc = xmlParseFile(xmlfile); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
229 cur = xmlDocGetRootElement(doc); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
230 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
231 /* ?? */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
232 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D"); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
233 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
234 /* XMLのノードを一つずつ解析 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
235 for (cur=cur->children; cur; cur=cur->next) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
236 /* 扱うのはsurfaceオンリー */ |
224
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
237 //if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
238 // continue; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
239 //} |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
240 if (!xmlStrcmp(cur->name,(xmlChar*)"surface")) { |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
241 /* ポリゴン(SceneGraph)生成 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
242 tmp = new SceneGraph(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
243 if ( tmp->parent_name==NULL || 0==strcmp(tmp->parent_name, "NULL")) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
244 /* このsurfaceがroot */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
245 root = tmp; |
140 | 246 scene_graph = tmp; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
247 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
248 /* 親はこのsurfaceより前に定義されているものとする (していい?) */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
249 // ここで parent_name を用いるのは間違っていて、 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
250 // *cur->properties->children から探すべきらしい kono |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
251 parent = root->searchSceneGraph(tmp->parent_name); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
252 if (parent==NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
253 fprintf(stderr, "[%s] No such parent %s\n", |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
254 tmp->name, tmp->parent_name); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
255 root->addChild(tmp); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
256 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
257 parent->addChild(tmp); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
258 } |
140 | 259 |
260 scene_graph->add_next(tmp); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
261 } |
224
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
262 }else if (!xmlStrcmp(cur->name,(xmlChar*)"image")) { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
263 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
264 char *cont; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
265 char image_name[20] = "/tmp/image_XXXXXX"; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
266 char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
267 int fd = mkstemp(image_name); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
268 FILE *outfile = fdopen(fd, "wb"); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
269 if(NULL == outfile) |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
270 { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
271 cout << "error open file\n"; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
272 } |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
273 cont = (char *)xmlNodeGetContent(cur); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
274 decode(cont, outfile); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
275 fclose(outfile); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
276 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
277 int tex_id = texture_hash.hash_regist(filename); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
278 if (tex_id < 0) |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
279 { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
280 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
281 texture_image = IMG_Load(image_name); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
282 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
283 /** |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
284 * image を 32bit(RGBA) に変換する |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
285 */ |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
286 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
287 SDL_Surface *tmpImage |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
288 = SDL_CreateRGBSurface(SDL_HWSURFACE, texture_image->w, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
289 texture_image->h, 32, redMask, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
290 greenMask, blueMask, alphaMask); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
291 SDL_Surface *converted; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
292 converted = SDL_ConvertSurface(texture_image, tmpImage->format, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
293 SDL_HWSURFACE); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
294 if (converted != NULL) { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
295 SDL_FreeSurface(texture_image); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
296 texture_image = converted; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
297 } |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
298 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
299 uint32 *tapestry; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
300 int scale = 1; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
301 int tex_w = texture_image->w; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
302 int tex_h = texture_image->h; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
303 int all_pixel_num = 0; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
304 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
305 /** |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
306 * テクスチャの w or h が 8 pixel で分割できる間、 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
307 * 1/2 の縮小画像を作る。 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
308 * ここでは、最大の scale (1/scale) を見つける |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
309 * |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
310 * (ex) |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
311 * (128,128) => 64,64 : 32,32: 16,16 : 8,8 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
312 * scale = 16 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
313 * (128, 64) => 64,32 : 32,16: 16,8 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
314 * scale = 8 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
315 */ |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
316 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
317 while (tex_w % TEXTURE_SPLIT_PIXEL == 0 && |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
318 tex_h % TEXTURE_SPLIT_PIXEL == 0) { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
319 all_pixel_num += tex_w*tex_h; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
320 tex_w >>= 1; /* tex_w /= 2 */ |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
321 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
322 tex_h >>= 1; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
323 scale <<= 1; /* scale *= 2 */ |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
324 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
325 } |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
326 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
327 scale >>= 1; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
328 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
329 tapestry = makeTapestry(texture_image->w, texture_image->h, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
330 (uint32*)texture_image->pixels, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
331 all_pixel_num, |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
332 scale); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
333 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
334 list[id_count-1].t_w = texture_image->w; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
335 list[id_count-1].t_h = texture_image->h; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
336 list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
337 list[id_count-1].pixels = tapestry; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
338 list[id_count-1].scale_max = scale; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
339 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
340 tmp->texture_id = id_count-1; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
341 tmp->texture_info.t_w = texture_image->w; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
342 tmp->texture_info.t_h = texture_image->h; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
343 tmp->texture_info.pixels_orig = (Uint32*)texture_image->pixels; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
344 tmp->texture_info.pixels = tapestry; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
345 tmp->texture_info.scale_max = scale; |
233 | 346 |
224
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
347 if (unlink(image_name)) |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
348 { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
349 cout << "unlink error\n"; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
350 } |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
351 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
352 } else { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
353 /** |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
354 * 以前に Load されている Texture を共用 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
355 */ |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
356 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
357 tmp->texture_id = tex_id; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
358 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
359 // こんなことすると list[] のいみあるのかなーと |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
360 // 微妙に思う、自分で書き換えた感想 by gongo |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
361 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
362 tmp->texture_info.t_w = list[tex_id].t_w; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
363 tmp->texture_info.t_h = list[tex_id].t_h;; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
364 tmp->texture_info.pixels_orig = list[tex_id].pixels_orig; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
365 tmp->texture_info.pixels = list[tex_id].pixels; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
366 tmp->texture_info.scale_max = list[tex_id].scale_max; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
367 |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
368 } |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
369 }else { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
370 continue; |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
371 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
372 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
373 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
374 xmlFreeDoc(doc); |
140 | 375 |
376 //return root; | |
377 scene_graph_viewer = root; | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
378 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
379 |
201 | 380 |
381 /** | |
382 * add Children | |
383 * 親の登録と、brother のリストへ加える | |
384 * | |
385 * @param child new child | |
386 */ | |
195 | 387 SceneGraphPtr |
388 SceneGraph::addChild(SceneGraphPtr child) | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
389 { |
142 | 390 /* childrenのリストの最後に加える (brother として)*/ |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
391 if (this->lastChild != NULL) { |
201 | 392 SceneGraphPtr last = this->lastChild; |
393 last->brother = child; | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
394 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
395 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
396 this->lastChild = child; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
397 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
398 if (this->children == NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
399 this->children = child; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
400 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
401 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
402 child->parent = this; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
403 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
404 return child; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
405 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
406 |
201 | 407 |
408 /** | |
409 * add Brother | |
410 * addChild() でも brother の操作をしないといけないので、そっちに回す | |
411 * | |
412 * @param bro new Brother | |
413 */ | |
195 | 414 SceneGraphPtr |
415 SceneGraph::addBrother(SceneGraphPtr bro) | |
138 | 416 { |
139 | 417 if (this->parent) { |
418 parent->addChild(bro); | |
201 | 419 } else { |
420 fprintf(stderr, "error : SceneGraph::%s : %s doesn't have parent\n", | |
421 __FUNCTION__, this->name); | |
139 | 422 } |
423 | |
138 | 424 return bro; |
425 } | |
426 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
427 /* thisの子や子孫にnameのものが存在すればそいつを返す なければNULL. */ |
195 | 428 SceneGraphPtr |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
429 SceneGraph::searchSceneGraph(char *name) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
430 { |
195 | 431 SceneGraphPtr tmp; |
432 SceneGraphPtr result; | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
433 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
434 /* 本人か */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
435 if( 0==strcmp(this->name, name) ) return this; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
436 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
437 /* 子供から再帰的に探す */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
438 for(tmp = this->children; tmp; tmp = tmp->next) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
439 if ((result=tmp->searchSceneGraph(name)) != NULL) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
440 return result; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
441 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
442 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
443 /* 無かったら NULL. */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
444 return NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
445 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
446 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
447 void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
448 SceneGraph::tree_check(void) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
449 { |
195 | 450 SceneGraphPtr t = this; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
451 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
452 while(t) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
453 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
454 cout << "my_name : " << t->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
455 if(t->children != NULL) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
456 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
457 cout << "--move children : " << t->children->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
458 t = t->children; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
459 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
460 else if(t->brother != NULL) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
461 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
462 cout << "--move brother : " << t->brother->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
463 t = t->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
464 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
465 else |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
466 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
467 while(t) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
468 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
469 if(t->brother != NULL) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
470 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
471 cout << "--move brother : " << t->brother->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
472 t = t->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
473 break; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
474 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
475 else |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
476 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
477 if(t->parent) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
478 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
479 cout << "--move parent : " << t->parent->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
480 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
481 t = t->parent; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
482 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
483 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
484 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
485 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
486 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
487 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
488 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
489 void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
490 SceneGraph::print_member(void) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
491 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
492 cout << "size = " << size << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
493 cout << "name = " << name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
494 cout << "parent_name = " << parent_name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
495 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
496 if (parent != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
497 cout << "parent->name = " << parent->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
498 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
499 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
500 if (children != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
501 cout << "children->name = " << children->name << endl; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
502 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
503 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
504 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
505 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
506 /* |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
507 * surface nodeからポリゴンの情報を読み出す 再帰しない |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
508 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
509 void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
510 SceneGraph::get_data(xmlNodePtr cur) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
511 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
512 char *cont; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
513 //char *image_name; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
514 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
515 for(;cur;cur=cur->next) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
516 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
517 if(!xmlStrcmp(cur->name,(xmlChar*)"coordinate")) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
518 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
519 cont = (char *)xmlNodeGetContent(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
520 pickup_coordinate(cont); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
521 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
522 else if(!xmlStrcmp(cur->name,(xmlChar*)"normal")) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
523 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
524 cont = (char *)xmlNodeGetContent(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
525 pickup_normal(cont); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
526 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
527 else if(!xmlStrcmp(cur->name,(xmlChar*)"model")) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
528 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
529 cont = (char *)xmlNodeGetContent(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
530 pickup_model(cont); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
531 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
532 else if(!xmlStrcmp(cur->name,(xmlChar*)"texture")) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
533 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
534 cont = (char *)xmlNodeGetContent(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
535 pickup_texture(cont); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
536 } |
224
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
537 else if(!xmlStrcmp(cur->name,(xmlChar*)"imageflag")) |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
538 { |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
539 char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
540 texture_hash.hash_regist(filename); |
d9f6ba033dc5
SceneGraph.cpp xmlcreate
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
219
diff
changeset
|
541 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
542 else if(!xmlStrcmp(cur->name,(xmlChar*)"image")) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
543 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
544 char image_name[20] = "/tmp/image_XXXXXX"; |
141 | 545 char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
546 int fd = mkstemp(image_name); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
547 FILE *outfile = fdopen(fd, "wb"); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
548 if(NULL == outfile) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
549 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
550 cout << "error open file\n"; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
551 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
552 cont = (char *)xmlNodeGetContent(cur); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
553 //decode(cont, image_name); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
554 decode(cont, outfile); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
555 fclose(outfile); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
556 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
557 /** |
141 | 558 * image_name を既に Load していれば何もしない |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
559 */ |
141 | 560 int tex_id = texture_hash.hash_regist(filename); |
561 if (tex_id < 0) { | |
562 | |
563 texture_image = IMG_Load(image_name); | |
564 | |
565 /** | |
566 * image を 32bit(RGBA) に変換する | |
567 */ | |
568 SDL_Surface *tmpImage | |
569 = SDL_CreateRGBSurface(SDL_HWSURFACE, texture_image->w, | |
570 texture_image->h, 32, redMask, | |
571 greenMask, blueMask, alphaMask); | |
572 SDL_Surface *converted; | |
573 converted = SDL_ConvertSurface(texture_image, tmpImage->format, | |
574 SDL_HWSURFACE); | |
575 if (converted != NULL) { | |
576 SDL_FreeSurface(texture_image); | |
577 texture_image = converted; | |
578 } | |
579 | |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
580 uint32 *tapestry; |
174
2c7d9057dd5d
getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents:
173
diff
changeset
|
581 int scale = 1; |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
582 int tex_w = texture_image->w; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
583 int tex_h = texture_image->h; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
584 int all_pixel_num = 0; |
173 | 585 |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
586 /** |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
587 * テクスチャの w or h が 8 pixel で分割できる間、 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
588 * 1/2 の縮小画像を作る。 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
589 * ここでは、最大の scale (1/scale) を見つける |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
590 * |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
591 * (ex) |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
592 * (128,128) => 64,64 : 32,32: 16,16 : 8,8 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
593 * scale = 16 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
594 * (128, 64) => 64,32 : 32,16: 16,8 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
595 * scale = 8 |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
596 */ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
597 while (tex_w % TEXTURE_SPLIT_PIXEL == 0 && |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
598 tex_h % TEXTURE_SPLIT_PIXEL == 0) { |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
599 all_pixel_num += tex_w*tex_h; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
600 tex_w >>= 1; /* tex_w /= 2 */ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
601 tex_h >>= 1; |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
602 scale <<= 1; /* scale *= 2 */ |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
603 } |
173 | 604 |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
605 scale >>= 1; |
173 | 606 |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
607 tapestry = makeTapestry(texture_image->w, texture_image->h, |
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
608 (uint32*)texture_image->pixels, |
201 | 609 all_pixel_num, scale); |
148
74341c8bf935
Span への Texture List の渡し。じゃっかん texture がバグってるので
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
142
diff
changeset
|
610 |
173 | 611 list[id_count-1].t_w = texture_image->w; |
612 list[id_count-1].t_h = texture_image->h; | |
149
f85ad3769897
SceneGraph.cpp での texture_list fix
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
148
diff
changeset
|
613 list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; |
178
4efb799779d7
add makeTapestry in SceneGraph.cpp
gongo@localhost.localdomain
parents:
174
diff
changeset
|
614 list[id_count-1].pixels = tapestry; |
174
2c7d9057dd5d
getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents:
173
diff
changeset
|
615 list[id_count-1].scale_max = scale; |
233 | 616 |
141 | 617 texture_id = id_count-1; |
161
18c42658e0e7
texture の座標がマイナスになったあと、それを 0 にし忘れてた
gongo@localhost.localdomain
parents:
150
diff
changeset
|
618 |
174
2c7d9057dd5d
getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents:
173
diff
changeset
|
619 if (unlink(image_name)) |
141 | 620 { |
621 cout << "unlink error\n"; | |
622 } | |
623 } else { | |
624 /** | |
625 * 以前に Load されている Texture を共用 | |
626 */ | |
627 texture_id = tex_id; | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
628 } |
203 | 629 |
630 // こんなことすると list[] のいみあるのかなーと | |
631 // 微妙に思う、自分で書き換えた感想 by gongo | |
632 texture_info.t_w = list[texture_id].t_w; | |
633 texture_info.t_h = list[texture_id].t_h;; | |
634 texture_info.pixels_orig = list[texture_id].pixels_orig; | |
635 texture_info.pixels = list[texture_id].pixels; | |
636 texture_info.scale_max = list[texture_id].scale_max; | |
141 | 637 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
638 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
639 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
640 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
641 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
642 void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
643 SceneGraph::delete_data(void) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
644 { |
140 | 645 SceneGraphPtr n = this->next, m; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
646 |
140 | 647 //n = this; |
648 //delete [] n->data; | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
649 |
140 | 650 if (next) { |
651 while (n) { | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
652 m = n->next; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
653 delete n; |
140 | 654 n = m; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
655 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
656 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
657 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
658 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
659 void |
138 | 660 SceneGraph::move_execute(int w, int h) |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
661 { |
138 | 662 (*move)(this, w, h); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
663 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
664 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
665 void |
195 | 666 SceneGraph::collision_check(int w, int h, SceneGraphPtr tree) |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
667 { |
138 | 668 (*collision)(this, w, h, tree); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
669 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
670 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
671 void |
138 | 672 SceneGraph::all_execute(int screen_w, int screen_h) |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
673 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
674 SceneGraphPtr top = this; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
675 SceneGraphPtr t = top; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
676 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
677 while (t) { |
138 | 678 t->move_execute(screen_w, screen_h); |
679 t->collision_check(screen_w, screen_h, top); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
680 |
142 | 681 t->frame++; |
682 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
683 if (t->parent != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
684 get_matrix(t->matrix, t->angle, t->xyz, t->parent->matrix); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
685 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
686 get_matrix(t->matrix, t->angle, t->xyz, NULL); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
687 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
688 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
689 if (t->children != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
690 t = t->children; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
691 } else if (t->brother != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
692 t = t->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
693 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
694 while (t) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
695 if (t->brother != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
696 t = t->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
697 break; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
698 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
699 if (t->parent == NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
700 t = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
701 break; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
702 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
703 t = t->parent; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
704 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
705 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
706 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
707 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
708 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
709 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
710 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
711 void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
712 SceneGraph::set_move_collision(SceneGraphPtr node, move_func new_move, |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
713 collision_func new_collision) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
714 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
715 node->move = new_move; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
716 node->collision = new_collision; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
717 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
718 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
719 void |
142 | 720 SceneGraph::set_move_collision(move_func new_move, |
721 collision_func new_collision) | |
722 { | |
723 this->move = new_move; | |
724 this->collision = new_collision; | |
725 } | |
726 | |
727 void | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
728 SceneGraph::add_next(SceneGraphPtr next) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
729 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
730 /* next のリストの最後に加える */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
731 if (this->next != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
732 SceneGraphPtr tmp = this->last; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
733 tmp->next = next; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
734 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
735 this->next = next; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
736 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
737 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
738 this->last = next; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
739 } |
138 | 740 |
229 | 741 /** |
742 * SceneGraph の clone | |
743 * @return clone SceneGraph | |
744 */ | |
195 | 745 SceneGraphPtr |
138 | 746 SceneGraph::clone(void) { |
215
59f4129a9562
fix SceneGraph Constructor, Destructor
gongo@gendarme.local
parents:
212
diff
changeset
|
747 SceneGraphPtr p = new SceneGraph(this); |
138 | 748 return p; |
749 } | |
195 | 750 |
229 | 751 /** |
752 * SceneGraph の clone | |
753 * 予め allocate されてる領域への placement new を行う | |
754 * | |
755 * @param buf clone 領域 | |
756 * @return clone SceneGraph | |
757 */ | |
758 SceneGraphPtr | |
759 SceneGraph::clone(void *buf) { | |
760 SceneGraphPtr p = new(buf) SceneGraph(this); | |
761 return p; | |
762 } | |
763 | |
195 | 764 void |
765 SceneGraph::remove(void) | |
766 { | |
767 this->flag_remove = 1; | |
768 } | |
769 | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
770 /** |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
771 * tree から node を削除する |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
772 * |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
773 * @param tree SceneGraphTree |
201 | 774 * @return node削除後の SceneGraphTree |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
775 */ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
776 SceneGraphPtr |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
777 SceneGraph::realRemoveFromTree(SceneGraphPtr tree) |
195 | 778 { |
779 SceneGraphPtr node = this; | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
780 SceneGraphPtr parent = node->parent; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
781 SceneGraphPtr ret = tree; |
195 | 782 |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
783 if (parent) { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
784 SceneGraphPtr brother = parent->children; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
785 SceneGraphPtr p, p1 = NULL; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
786 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
787 p = brother; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
788 if (p) { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
789 if (p == node) { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
790 parent->children = NULL; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
791 parent->lastChild = NULL; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
792 } else { |
201 | 793 p1 = p->brother; |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
794 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
795 while (p1 && p1 != node) { |
201 | 796 p1 = p1->brother; |
797 p = p->brother; | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
798 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
799 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
800 if (p1) { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
801 p->brother = p1->brother; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
802 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
803 // node が最後尾なら、lastChild を変更 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
804 if (parent->lastChild == p1) { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
805 parent->lastChild = p; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
806 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
807 } else { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
808 // Can't find remove node |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
809 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
810 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
811 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
812 } else { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
813 // 親が居ない = tree root なので |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
814 // NULL を返す |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
815 ret = NULL; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
816 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
817 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
818 return ret; |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
819 } |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
820 |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
821 /** |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
822 * list から node を削除する |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
823 * |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
824 * @param list SceneGraphList |
201 | 825 * @return node削除後の SceneGraphList |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
826 */ |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
827 SceneGraphPtr |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
828 SceneGraph::realRemoveFromList(SceneGraphPtr list) |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
829 { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
830 SceneGraphPtr node = this; |
195 | 831 SceneGraphPtr prev = node->prev; |
832 SceneGraphPtr next = node->next; | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
833 SceneGraphPtr ret = list; |
195 | 834 |
835 if (prev) { | |
836 prev->next = next; | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
837 } else { |
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
838 ret = next; |
195 | 839 } |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
840 |
195 | 841 if (next) { |
842 next->prev = prev; | |
843 } | |
844 | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
845 return ret; |
195 | 846 } |
847 | |
848 int | |
849 SceneGraph::isRemoved(void) | |
850 { | |
851 return flag_remove; | |
852 } | |
212 | 853 |
854 /** | |
855 * 平行移動 | |
856 * | |
857 * @param x Ttranslate in the x direction | |
858 * @param y Ttranslate in the y direction | |
859 * @param z Ttranslate in the z direction | |
860 */ | |
861 void | |
862 SceneGraph::translate(float x, float y, float z) | |
863 { | |
864 this->xyz[0] = x; | |
865 this->xyz[1] = y; | |
866 this->xyz[2] = z; | |
867 } | |
868 | |
869 /** | |
870 * x 軸方向への平行移動 | |
871 * | |
872 * @param x Ttranslate in the x direction | |
873 */ | |
874 void | |
875 SceneGraph::translateX(float x) | |
876 { | |
877 this->xyz[0] = x; | |
878 } | |
879 | |
880 /** | |
881 * y 軸方向への平行移動 | |
882 * | |
883 * @param y Ttranslate in the y direction | |
884 */ | |
885 void | |
886 SceneGraph::translateY(float y) | |
887 { | |
888 this->xyz[1] = y; | |
889 } | |
890 | |
891 /** | |
892 * z 軸方向への平行移動 | |
893 * | |
894 * @param z Ttranslate in the z direction | |
895 */ | |
896 void | |
897 SceneGraph::translateZ(float z) | |
898 { | |
899 this->xyz[2] = z; | |
900 } |