Mercurial > hg > Game > Cerium
comparison Renderer/Engine/Collada.cc @ 1378:38c7e8b47c4b draft
minor changes.
author | e095732 <e095732@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Jan 2012 20:33:22 +0900 |
parents | ae0398dd61d2 |
children | 13065ad17328 |
comparison
equal
deleted
inserted
replaced
1377:22794a7f26a3 | 1378:38c7e8b47c4b |
---|---|
178 SOURCE_P src = NULL; | 178 SOURCE_P src = NULL; |
179 SOURCE_P cur = NULL; | 179 SOURCE_P cur = NULL; |
180 int tmplength = 0; | 180 int tmplength = 0; |
181 int strlength; | 181 int strlength; |
182 | 182 |
183 if (src == NULL){ | |
184 fprintf(stderr,"not match"); | |
185 } | |
186 for (cur=list->first ;cur!=list->end ;cur=cur->next) { | 183 for (cur=list->first ;cur!=list->end ;cur=cur->next) { |
187 for (strlength=0;id[strlength]==cur->id[strlength];strlength++); | 184 for (strlength=0;id[strlength]==cur->id[strlength];strlength++); |
188 if (tmplength < strlength) { | 185 if (tmplength < strlength) { |
189 tmplength = strlength; | 186 tmplength = strlength; |
190 src = cur; | 187 src = cur; |
191 } | 188 } |
192 } | 189 } |
190 if (src == NULL){ | |
191 fprintf(stderr,"not match"); | |
192 } | |
193 return src; | 193 return src; |
194 } | 194 } |
195 | 195 |
196 void get_texture_image(char *filename, SceneGraphPtr sg, xmlNodePtr cur, TaskManager *manager) | 196 void get_texture_image(char *filename, SceneGraphPtr sg, xmlNodePtr cur, TaskManager *manager) |
197 { | 197 { |
202 /** | 202 /** |
203 * image_name を既に Load していれば何もしない | 203 * image_name を既に Load していれば何もしない |
204 */ | 204 */ |
205 int tex_id; | 205 int tex_id; |
206 /* ball test */ | 206 /* ball test */ |
207 if (sgid_hash.sg_hash_regist(filename, tex_id) == -1) { | 207 if (sgid_hash.sg_hash_regist(/*filename*/"Ball", tex_id) == -1) { |
208 SDL_Surface *texture_image = load_image(filename, image_name); | 208 SDL_Surface *texture_image = load_image(filename, image_name); |
209 if (texture_image==0) { | 209 if (texture_image==0) { |
210 printf("Can't load image %s\n",filename); | 210 printf("Can't load image %s\n",filename); |
211 exit(0); | 211 exit(0); |
212 } | 212 } |
213 sg->texture_info->texture_id = sg->makeTapestries(manager, texture_image, tex_id); | 213 sg->texture_info->texture_id = sg->makeTapestries(manager, texture_image, tex_id); |
347 // TrianglePack の size のチェック | 347 // TrianglePack の size のチェック |
348 int tri_size = (count < MAX_SIZE_TRIANGLE) ? count : MAX_SIZE_TRIANGLE ; | 348 int tri_size = (count < MAX_SIZE_TRIANGLE) ? count : MAX_SIZE_TRIANGLE ; |
349 pp[i].info.size = tri_size; | 349 pp[i].info.size = tri_size; |
350 /* default texture peste */ | 350 /* default texture peste */ |
351 if (s->images_flag==0) { | 351 if (s->images_flag==0) { |
352 get_texture_image("default.jpg", sg, (xmlNodePtr)NULL, manager); | 352 get_texture_image("/Users/YuSUGIMOTO/Cerium/Renderer/Test/xml_file/blend/images/ball.jpg", sg, (xmlNodePtr)NULL, manager); |
353 } | 353 } |
354 int k = 0; | 354 int k = 0; |
355 int m = 0; | 355 int m = 0; |
356 int n = 0; | 356 int n = 0; |
357 for (int j = 0; j < tri_size; j++) { | 357 for (int j = 0; j < tri_size; j++) { |
408 | 408 |
409 static void | 409 static void |
410 xml_walk(xmlNodePtr cur, struct collada_state *s, LIST_P list,SceneGraphPtr sg, SceneGraphRoot *root) | 410 xml_walk(xmlNodePtr cur, struct collada_state *s, LIST_P list,SceneGraphPtr sg, SceneGraphRoot *root) |
411 { | 411 { |
412 int in_polylist=0; | 412 int in_polylist=0; |
413 printf("name = %s, child:%s\n", (char *)cur->name, (char *)cur->children); | 413 //printf("name = %s, child:%s\n", (char *)cur->name, (char *)cur->children); |
414 printf("s->polylist = %d\n",s->polylist); | 414 //printf("s->polylist = %d\n",s->polylist); |
415 if (!xmlStrcmp(cur->name, (xmlChar*)"polylist")) { | 415 if (!xmlStrcmp(cur->name, (xmlChar*)"polylist")) { |
416 s->polylist_count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); | 416 s->polylist_count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); |
417 s->polylist=1; | 417 s->polylist=1; |
418 in_polylist=1; | 418 in_polylist=1; |
419 } else if (!xmlStrcmp(cur->name, (xmlChar*)"vertices")) { | 419 } else if (!xmlStrcmp(cur->name, (xmlChar*)"vertices")) { |
420 s->vertices_id = xmlGetProp(cur, (xmlChar*)"id"); | 420 s->vertices_id = xmlGetProp(cur, (xmlChar*)"id"); |
421 } else if (!xmlStrcmp(cur->name, (xmlChar*)"library_images")) { | 421 } else if (!xmlStrcmp(cur->name, (xmlChar*)"library_images")) { |
422 s->library_images=1;// library_images is wrote at texture image name. only use one image file | 422 s->library_images=1; |
423 //library_images is wrote at texture image name. only use one image file | |
423 } else if (s->library_images && !xmlStrcmp(cur->name, (xmlChar*)"init_from")) { | 424 } else if (s->library_images && !xmlStrcmp(cur->name, (xmlChar*)"init_from")) { |
424 s->tex_picname = (char*)xmlGetProp(cur, (xmlChar*)"init_from"); | 425 s->tex_picname = (char*)xmlGetProp(cur, (xmlChar*)"init_from"); |
425 get_texture_image(s->tex_picname, sg, cur , root->tmanager); | 426 get_texture_image(s->tex_picname, sg, cur , root->tmanager); |
426 printf("------------------%s",s->tex_picname); | 427 printf("------------------%s",s->tex_picname); |
427 s->library_images=0; | 428 s->library_images=0; |