Mercurial > hg > Game > Cerium
comparison Renderer/Engine/Collada.cc @ 1391:1ea6e4eb2b0a draft
remove error.
author | e095732 <e095732@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 27 Jan 2012 18:23:56 +0900 |
parents | b4f6539fecf6 |
children | 555d2a31cf0c |
comparison
equal
deleted
inserted
replaced
1390:b4f6539fecf6 | 1391:1ea6e4eb2b0a |
---|---|
202 return; | 202 return; |
203 } | 203 } |
204 /** | 204 /** |
205 * image_name を既に Load していれば何もしない | 205 * image_name を既に Load していれば何もしない |
206 */ | 206 */ |
207 int tex_id=0; | 207 int tex_id; |
208 /* ball test */ | 208 /* ball test */ |
209 if (sgid_hash.sg_hash_regist(filename, tex_id) == -1) { | 209 if (sgid_hash.sg_hash_regist(filename, tex_id) == -1) { |
210 SDL_Surface *texture_image = load_image(filename, image_name); | 210 SDL_Surface *texture_image = load_image(filename, image_name); |
211 if (texture_image==0) { | 211 if (texture_image==0) { |
212 printf("Can't load image %s\n",filename); | 212 printf("Can't load image %s\n",filename); |
232 sg->texture_info->texture_image = list[tex_id].texture_image; | 232 sg->texture_info->texture_image = list[tex_id].texture_image; |
233 } | 233 } |
234 | 234 |
235 void decode_float_array(xmlNodePtr cur,LIST_P list){ | 235 void decode_float_array(xmlNodePtr cur,LIST_P list){ |
236 SOURCE_P src = (SOURCE_P)malloc(sizeof(SOURCE)); | 236 SOURCE_P src = (SOURCE_P)malloc(sizeof(SOURCE)); |
237 char *id = (char*)xmlGetProp(cur, (xmlChar*)"id"); | |
238 src->id = (char*)xmlGetProp(cur, (xmlChar*)"id"); | 237 src->id = (char*)xmlGetProp(cur, (xmlChar*)"id"); |
239 | 238 |
240 int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); | |
241 src->count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); | 239 src->count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); |
242 src->u.array = new float[src->count]; | 240 src->u.array = new float[src->count]; |
243 char *cont =(char*)xmlNodeGetContent(cur); | 241 char *cont =(char*)xmlNodeGetContent(cur); |
244 | 242 |
245 /* store float inpoint list */ | 243 /* store float inpoint list */ |
318 /* make triangle */ | 316 /* make triangle */ |
319 int k=0,l=0,size=0; | 317 int k=0,l=0,size=0; |
320 for (int i=0;i<s->vmember;i++) { | 318 for (int i=0;i<s->vmember;i++) { |
321 if (s->vcount[i] == 4) { | 319 if (s->vcount[i] == 4) { |
322 vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[i]*3]; | 320 vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[i]*3]; |
323 vertex_table[k+1] = s->vertex_float->u.array[s->pcount[i]*3+1]; | 321 vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; |
324 vertex_table[k+2] = s->vertex_float->u.array[s->pcount[i]*3+2]; | 322 vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; |
325 vertex_table[k+3] = s->vertex_float->u.array[s->pcount[i+1]*3+0]; | 323 vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+0]; |
326 vertex_table[k+4] = s->vertex_float->u.array[s->pcount[i+1]*3+1]; | 324 vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+1]; |
327 vertex_table[k+5] = s->vertex_float->u.array[s->pcount[i+1]*3+2]; | 325 vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+2]; |
328 vertex_table[k+6] = s->vertex_float->u.array[s->pcount[i+3]*3+0]; | 326 vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+0]; |
329 vertex_table[k+7] = s->vertex_float->u.array[s->pcount[i+3]*3+1]; | 327 vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; |
330 vertex_table[k+8] = s->vertex_float->u.array[s->pcount[i+3]*3+2]; | 328 vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; |
331 | 329 |
332 vertex_table[k+9] = s->vertex_float->u.array[s->pcount[i]*3]; | 330 vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[i]*3]; |
333 vertex_table[k+10] = s->vertex_float->u.array[s->pcount[i]*3+1]; | 331 vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; |
334 vertex_table[k+11] = s->vertex_float->u.array[s->pcount[i]*3+2]; | 332 vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; |
335 vertex_table[k+12] = s->vertex_float->u.array[s->pcount[i+3]*3+0]; | 333 vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+0]; |
336 vertex_table[k+13] = s->vertex_float->u.array[s->pcount[i+3]*3+1]; | 334 vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; |
337 vertex_table[k+14] = s->vertex_float->u.array[s->pcount[i+3]*3+2]; | 335 vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; |
338 vertex_table[k+15] = s->vertex_float->u.array[s->pcount[i+2]*3+0]; | 336 vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+0]; |
339 vertex_table[k+16] = s->vertex_float->u.array[s->pcount[i+2]*3+1]; | 337 vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; |
340 vertex_table[k+17] = s->vertex_float->u.array[s->pcount[i+2]*3+2]; | 338 vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; |
341 k+=18; | 339 k+=18; |
342 l+=4; | 340 l+=4; |
343 size +=2; | 341 size +=2; |
344 } else if (s->vcount[i]==3) { | 342 } else if (s->vcount[i]==3) { |
345 vertex_table[k] = s->vertex_float->u.array[s->pcount[i]*3]; | 343 vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[i]*3]; |
346 vertex_table[k+1] = s->vertex_float->u.array[s->pcount[i]*3+1]; | 344 vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; |
347 vertex_table[k+2] = s->vertex_float->u.array[s->pcount[i]*3+2]; | 345 vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; |
348 vertex_table[k+3] = s->vertex_float->u.array[s->pcount[i+1]*3+0]; | 346 vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+0]; |
349 vertex_table[k+4] = s->vertex_float->u.array[s->pcount[i+1]*3+1]; | 347 vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+1]; |
350 vertex_table[k+5] = s->vertex_float->u.array[s->pcount[i+1]*3+2]; | 348 vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+2]; |
351 vertex_table[k+6] = s->vertex_float->u.array[s->pcount[i+2]*3+0]; | 349 vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+0]; |
352 vertex_table[k+7] = s->vertex_float->u.array[s->pcount[i+2]*3+1]; | 350 vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; |
353 vertex_table[k+8] = s->vertex_float->u.array[s->pcount[i+2]*3+2]; | 351 vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; |
354 k+=9; | 352 k+=9; |
355 size++; | 353 size++; |
356 } | 354 } |
357 } | 355 } |
358 | 356 |
420 } | 418 } |
421 | 419 |
422 } | 420 } |
423 sg->c_xyz[0] = sg->c_xyz[1] = sg->c_xyz[2] = 0; | 421 sg->c_xyz[0] = sg->c_xyz[1] = sg->c_xyz[2] = 0; |
424 | 422 |
425 delete []vertexp; | |
426 delete []vertex_table; | 423 delete []vertex_table; |
427 delete []normal_table; | 424 delete []normal_table; |
428 delete []texcoord_table; | 425 delete []texcoord_table; |
429 | 426 |
430 /* got out of polylist */ | 427 /* got out of polylist */ |