Mercurial > hg > Game > Cerium
changeset 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 |
files | Renderer/Engine/Collada.cc Renderer/Test/collada.cc |
diffstat | 2 files changed, 29 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/Collada.cc Fri Jan 27 18:15:17 2012 +0900 +++ b/Renderer/Engine/Collada.cc Fri Jan 27 18:23:56 2012 +0900 @@ -204,7 +204,7 @@ /** * image_name を既に Load していれば何もしない */ - int tex_id=0; + int tex_id; /* ball test */ if (sgid_hash.sg_hash_regist(filename, tex_id) == -1) { SDL_Surface *texture_image = load_image(filename, image_name); @@ -234,10 +234,8 @@ void decode_float_array(xmlNodePtr cur,LIST_P list){ SOURCE_P src = (SOURCE_P)malloc(sizeof(SOURCE)); - char *id = (char*)xmlGetProp(cur, (xmlChar*)"id"); src->id = (char*)xmlGetProp(cur, (xmlChar*)"id"); - int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); src->count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count")); src->u.array = new float[src->count]; char *cont =(char*)xmlNodeGetContent(cur); @@ -320,37 +318,37 @@ for (int i=0;i<s->vmember;i++) { if (s->vcount[i] == 4) { vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[i]*3]; - vertex_table[k+1] = s->vertex_float->u.array[s->pcount[i]*3+1]; - vertex_table[k+2] = s->vertex_float->u.array[s->pcount[i]*3+2]; - vertex_table[k+3] = s->vertex_float->u.array[s->pcount[i+1]*3+0]; - vertex_table[k+4] = s->vertex_float->u.array[s->pcount[i+1]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[s->pcount[i+1]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[s->pcount[i+3]*3+0]; - vertex_table[k+7] = s->vertex_float->u.array[s->pcount[i+3]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[s->pcount[i+3]*3+2]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+0]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+0]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; - vertex_table[k+9] = s->vertex_float->u.array[s->pcount[i]*3]; - vertex_table[k+10] = s->vertex_float->u.array[s->pcount[i]*3+1]; - vertex_table[k+11] = s->vertex_float->u.array[s->pcount[i]*3+2]; - vertex_table[k+12] = s->vertex_float->u.array[s->pcount[i+3]*3+0]; - vertex_table[k+13] = s->vertex_float->u.array[s->pcount[i+3]*3+1]; - vertex_table[k+14] = s->vertex_float->u.array[s->pcount[i+3]*3+2]; - vertex_table[k+15] = s->vertex_float->u.array[s->pcount[i+2]*3+0]; - vertex_table[k+16] = s->vertex_float->u.array[s->pcount[i+2]*3+1]; - vertex_table[k+17] = s->vertex_float->u.array[s->pcount[i+2]*3+2]; + vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[i]*3]; + vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; + vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; + vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+0]; + vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; + vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; + vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+0]; + vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; + vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; k+=18; l+=4; size +=2; } else if (s->vcount[i]==3) { - vertex_table[k] = s->vertex_float->u.array[s->pcount[i]*3]; - vertex_table[k+1] = s->vertex_float->u.array[s->pcount[i]*3+1]; - vertex_table[k+2] = s->vertex_float->u.array[s->pcount[i]*3+2]; - vertex_table[k+3] = s->vertex_float->u.array[s->pcount[i+1]*3+0]; - vertex_table[k+4] = s->vertex_float->u.array[s->pcount[i+1]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[s->pcount[i+1]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[s->pcount[i+2]*3+0]; - vertex_table[k+7] = s->vertex_float->u.array[s->pcount[i+2]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[s->pcount[i+2]*3+2]; + vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[i]*3]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[i]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+0]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+1]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+0]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; k+=9; size++; } @@ -422,7 +420,6 @@ } sg->c_xyz[0] = sg->c_xyz[1] = sg->c_xyz[2] = 0; - delete []vertexp; delete []vertex_table; delete []normal_table; delete []texcoord_table;
--- a/Renderer/Test/collada.cc Fri Jan 27 18:15:17 2012 +0900 +++ b/Renderer/Test/collada.cc Fri Jan 27 18:23:56 2012 +0900 @@ -106,8 +106,8 @@ } } -static const char *collada_file="/Users/YuSUGIMOTO/Desktop/sample.dae"; -static const char *name="Cube"; +static const char *collada_file="collada_file/ball.dae"; +static const char *name="Ball"; MainLoopPtr ball_bound::init(Viewer *sgroot, int screen_w, int screen_h)