# HG changeset patch # User e095732 # Date 1328513366 -32400 # Node ID d6170e1200a0bea6cf212bd67e10742bdeceb84d # Parent e19296785c07f76cd46b7bb998d7907d77bd12fa minor changes. diff -r e19296785c07 -r d6170e1200a0 Renderer/Engine/Collada.cc --- a/Renderer/Engine/Collada.cc Sun Feb 05 23:34:16 2012 +0900 +++ b/Renderer/Engine/Collada.cc Mon Feb 06 16:29:26 2012 +0900 @@ -13,17 +13,6 @@ extern int is_bmp(const char* name); extern void make_black_alpha(SDL_Surface *texture_image); -typedef struct p_info { - p_info(){ - x = 0; - y = 0; - z = 0; - } - float x; - float y; - float z; -}; - typedef struct source { char *id; union { @@ -292,180 +281,180 @@ * vertex_tableだけはpolygonを作る際にvcountが4の場合重複する点が * 出てくるのでサイズを2倍用意しておく */ - /* + float *vertex_table; float *normal_table; float *texcoord_table; + vertex_table = new float[s->vtable_size*3]; normal_table = new float[s->vtable_size*3]; texcoord_table = new float[s->vtable_size*2]; bzero(vertex_table,sizeof(float)*s->vtable_size*3); bzero(normal_table,sizeof(float)*s->vtable_size*3); bzero(texcoord_table,sizeof(float)*s->vtable_size*2); - */ - p_info *vertex_p; - p_info *normal_p; - p_info *texcoord_p; - vertex_p = new p_info[s->vtable_size]; - normal_p = new p_info[s->vtable_size]; - texcoord_p = new p_info[s->vtable_size]; - /* p separate vertex position and nomal position. */ /* make triangle */ int k=0,j=0,l=0,count=0; if (s->texcoord_offset == 2){ for (int i=0;ipolylist_count;i++) { if (s->vcount[i] == 4) { - vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; - vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+3]*3]; - vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1]; - vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2]; - vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; - vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; - vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; - - vertex_p[k+3].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; - vertex_p[k+3].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; - vertex_p[k+3].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; - vertex_p[k+4].x = s->vertex_float->u.array[(int)s->pcount[l+9]*3]; - vertex_p[k+4].y = s->vertex_float->u.array[(int)s->pcount[l+9]*3+1]; - vertex_p[k+4].z = s->vertex_float->u.array[(int)s->pcount[l+9]*3+2]; - vertex_p[k+5].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k+5].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k+5].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+3]*3]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; + vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; + vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; + vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; + vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[l+9]*3]; + vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[l+9]*3+1]; + vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[l+9]*3+2]; + vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + + normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3*2]; + normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+4]*3]; + normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+4]*3+1]; + normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+4]*3+2]; + normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+7]*3]; + normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; + normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[l+7]*3]; + normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; + normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[l+10]*3]; + normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[l+10]*3+1]; + normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[l+10]*3+2]; + normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; + + texcoord_table[j] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]; + texcoord_table[j+1] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2+1]; + texcoord_table[j+2] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]; + texcoord_table[j+3] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2+1]; + texcoord_table[j+4] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]; + texcoord_table[j+5] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1]; - normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+4]*3]; - normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+4]*3+1]; - normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+4]*3+2]; - normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+7]*3]; - normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; - normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + texcoord_table[j+6] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]; + texcoord_table[j+7] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1]; + texcoord_table[j+8] = s->texcoord_float->u.array[(int)s->pcount[l+11]*2]; + texcoord_table[j+9] = s->texcoord_float->u.array[(int)s->pcount[l+11]*2]; + texcoord_table[j+10] = s->texcoord_float->u.array[(int)s->pcount[l+14]*2]; + texcoord_table[j+11] = s->texcoord_float->u.array[(int)s->pcount[l+14]*2]; - normal_p[k+3].x = s->normal_float->u.array[(int)s->pcount[l+7]*3]; - normal_p[k+3].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; - normal_p[k+3].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; - normal_p[k+4].x = s->normal_float->u.array[(int)s->pcount[l+10]*3]; - normal_p[k+4].y = s->normal_float->u.array[(int)s->pcount[l+10]*3+1]; - normal_p[k+4].z = s->normal_float->u.array[(int)s->pcount[l+10]*3+2]; - normal_p[k+5].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k+5].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k+5].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - - texcoord_p[j].x = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]; - texcoord_p[j].y = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]+1; - texcoord_p[j+1].x = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]; - texcoord_p[j+1].y = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]+1; - texcoord_p[j+2].x = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]; - texcoord_p[j+2].y = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]+1; - texcoord_p[j+3].x = s->texcoord_float->u.array[(int)s->pcount[l+11]*2]; - texcoord_p[j+3].y = s->texcoord_float->u.array[(int)s->pcount[l+11]*2]+1; - - l+=12;j+=4;k+=6; + l+=12; + j+=12; + k+=18; count +=2; } else if (s->vcount[i]==3) { - vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; - vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+3]*3]; - vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1]; - vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2]; - vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; - vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; - vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; + vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+3]*3]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; + + normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3*2]; + normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+4]*3]; + normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+4]*3+1]; + normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+4]*3+2]; + normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+7]*3]; + normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; + normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + + texcoord_table[j] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]; + texcoord_table[j+1] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2+1]; - normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+4]*3]; - normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+4]*3+1]; - normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+4]*3+2]; - normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+7]*3]; - normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; - normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + texcoord_table[j+2] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]; + texcoord_table[j+3] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2+1]; - texcoord_p[j].x = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]; - texcoord_p[j].y = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]+1; - texcoord_p[j+1].x = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]; - texcoord_p[j+1].y = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]+1; - texcoord_p[j+2].x = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]; - texcoord_p[j+2].y = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]+1; + texcoord_table[j+4] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]; + texcoord_table[j+5] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1]; - l+=9;j+=3;k+=3; + l+=9; + j+=6; + k+=9; count++; } } }else{ for (int i=0;ipolylist_count;i++) { if (s->vcount[i] == 4) { - vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; - vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+2]*3]; - vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1]; - vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2]; - vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; - vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; - vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; - - vertex_p[k+3].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; - vertex_p[k+3].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; - vertex_p[k+3].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; - vertex_p[k+4].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; - vertex_p[k+4].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; - vertex_p[k+4].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; - vertex_p[k+5].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k+5].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k+5].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; - - normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+3]*3]; - normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+3]*3+1]; - normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+3]*3+2]; - normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+5]*3]; - normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; - normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; - - normal_p[k+3].x = s->normal_float->u.array[(int)s->pcount[l+5]*3]; - normal_p[k+3].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; - normal_p[k+3].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; - normal_p[k+4].x = s->normal_float->u.array[(int)s->pcount[l+7]*3]; - normal_p[k+4].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; - normal_p[k+4].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; - normal_p[k+5].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k+5].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k+5].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - - l+=8;k+=6; + vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+2]*3]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; + vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; + vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; + vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; + vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[l+6]*3]; + vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1]; + vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2]; + vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + + normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; + normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+3]*3]; + normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+3]*3+1]; + normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+3]*3+2]; + normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+5]*3]; + normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; + normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; + normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[l+5]*3]; + normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; + normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; + normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[l+7]*3]; + normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1]; + normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2]; + normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; + l+=8; + k+=18; count +=2; } else if (s->vcount[i]==3) { - vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3]; - vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; - vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; - vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+2]*3]; - vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1]; - vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2]; - vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; - vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; - vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; - - normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3]; - normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; - normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2]; - normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+3]*3]; - normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+3]*3+1]; - normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+3]*3+2]; - normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+5]*3]; - normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; - normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; - - l+=6;k+=3; + vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3]; + vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1]; + vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2]; + vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+2]*3]; + vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1]; + vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2]; + vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+4]*3]; + vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1]; + vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2]; + + normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3]; + normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1]; + normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3+22]; + normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+3]*3]; + normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+3]*3+1]; + normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+3]*3+2]; + normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+5]*3]; + normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1]; + normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2]; + l+=6; + k+=9; count++; } } @@ -485,6 +474,7 @@ sg->parent_name = "NULL"; sg->size = count*3; k = 0; + int m = 0; for (int i = 0;i < sg->pp_num; i++ ){ PolygonPackPtr pp = sg->pp; TrianglePackPtr tri = pp[i].tri; @@ -496,31 +486,31 @@ char *default_image = "../Test/xml_file/blend/images/ball.jpg"; get_texture_image(default_image, sg, (xmlNodePtr)NULL, manager); } - for (int j = 0; j < tri_size; j++,k+=3) { - tri[j].ver1.x = vertex_p[k].x; - tri[j].ver1.y = vertex_p[k].y; - tri[j].ver1.z = vertex_p[k].z; + for (int j = 0; j < tri_size; j++,k+=9) { + tri[j].ver1.x = vertex_table[k]; + tri[j].ver1.y = vertex_table[k+1]; + tri[j].ver1.z = vertex_table[k+2]; - tri[j].ver2.x = vertex_p[k+1].x; - tri[j].ver2.y = vertex_p[k+1].y; - tri[j].ver2.z = vertex_p[k+1].z; + tri[j].ver2.x = vertex_table[k+3]; + tri[j].ver2.y = vertex_table[k+4]; + tri[j].ver2.z = vertex_table[k+5]; - tri[j].ver3.x = vertex_p[k+2].x; - tri[j].ver3.y = vertex_p[k+2].y; - tri[j].ver3.z = vertex_p[k+2].z; - - tri[j].normal1.x = normal_p[k].x; - tri[j].normal1.y = normal_p[k].y; - tri[j].normal1.z = normal_p[k].z; + tri[j].ver3.x = vertex_table[k+6]; + tri[j].ver3.y = vertex_table[k+7]; + tri[j].ver3.z = vertex_table[k+8]; + + tri[j].normal1.x = normal_table[k]; + tri[j].normal1.y = normal_table[k+1]; + tri[j].normal1.z = normal_table[k+2]; - tri[j].normal2.x = normal_p[k+1].x; - tri[j].normal2.y = normal_p[k+1].y; - tri[j].normal2.z = normal_p[k+1].z; + tri[j].normal2.x = normal_table[k+3]; + tri[j].normal2.y = normal_table[k+4]; + tri[j].normal2.z = normal_table[k+5]; - tri[j].normal3.x = normal_p[k+2].x; - tri[j].normal3.y = normal_p[k+2].y; - tri[j].normal3.z = normal_p[k+2].z; - /* + tri[j].normal3.x = normal_table[k+6]; + tri[j].normal3.y = normal_table[k+7]; + tri[j].normal3.z = normal_table[k+8]; + tri[j].ver1.tex_x = texcoord_table[m]; tri[j].ver1.tex_y = texcoord_table[m+1]; @@ -528,18 +518,18 @@ tri[j].ver2.tex_y = texcoord_table[m+3]; tri[j].ver3.tex_x = texcoord_table[m+4]; - tri[j].ver3.tex_y = texcoord_table[m+5]; - */ + tri[j].ver3.tex_y = texcoord_table[m+5]; + } } sg->c_xyz[0] = sg->c_xyz[1] = sg->c_xyz[2] = 0; - /* + delete []vertex_table; delete []normal_table; delete []texcoord_table; - */ + /* got out of polylist */ s->polylist = 0; return sg; diff -r e19296785c07 -r d6170e1200a0 Renderer/Test/collada_file/sampleTexture.dae --- a/Renderer/Test/collada_file/sampleTexture.dae Sun Feb 05 23:34:16 2012 +0900 +++ b/Renderer/Test/collada_file/sampleTexture.dae Mon Feb 06 16:29:26 2012 +0900 @@ -5,44 +5,12 @@ Blender User Blender 2.60.0 r41098M - 2012-01-31T15:12:46 - 2012-01-31T15:12:46 + 2012-02-06T16:03:11 + 2012-02-06T16:03:11 Z_UP - - - - - - 0 0 0 1 - - - 0 0 0 1 - - - 0.512 0.512 0.512 1 - - - 0.25 0.25 0.25 1 - - - 50 - - - 1 - - - - - - 1 - - - - 1 - @@ -77,58 +45,11 @@ - - - - - - - 1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1 - - - - - - - - - - 0 0 -1 0 0 1 1 -1.49012e-7 1.49012e-7 -3.57628e-7 -1 -2.08616e-7 -1 0 0 1.19209e-7 1 1.19209e-7 - - - - - - - - - - 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 - - - - - - - - - - - - - - - 4 4 4 4 4 4 -

0 0 0 1 0 1 2 0 2 3 0 3 4 1 4 7 1 5 6 1 6 5 1 7 0 2 8 4 2 9 5 2 10 1 2 11 1 3 12 5 3 13 6 3 14 2 3 15 2 4 16 6 4 17 7 4 18 3 4 19 4 5 20 0 5 21 3 5 22 7 5 23

-
-
- 1 -
@@ -176,22 +97,6 @@
- - 0 0 0 - 0 0 1 0 - 0 1 0 0 - 1 0 0 0 - 1 1 1 - - - - - - - - - - 0 0 0 0 0 1 0