# HG changeset patch # User e095732 # Date 1327997453 -32400 # Node ID ad841dcdbe675f4c5c72d61a3305c3b1071953dd # Parent 971d737a329a75ee10e249a114485c85f741759d collada moved. But only cube. diff -r 971d737a329a -r ad841dcdbe67 Renderer/Engine/Collada.cc --- a/Renderer/Engine/Collada.cc Mon Jan 30 21:48:37 2012 +0900 +++ b/Renderer/Engine/Collada.cc Tue Jan 31 17:10:53 2012 +0900 @@ -50,7 +50,7 @@ vmember = 0; vtable_size =0; - images_flag=0; + images_flag=0; } int polylist; int library_images; @@ -292,180 +292,192 @@ bzero(normal_table,sizeof(float)*s->vtable_size*3); bzero(texcoord_table,sizeof(float)*s->vtable_size*2); - /** - * s->vcsum と s->vertex_float->countの値が違うので大きい方をとりあえず使っておく - */ - - /* - if (s->texcoord_offset == 2){ - for (int i=0,j=0; i < s->limit; i+=3,j++) { - normal_table[j] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[j+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[j+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3+2]; - texcoord_table[j] = s->texcoord_float->u.array[(int)s->pcount[i+2]*2]; - texcoord_table[j+1] = s->texcoord_float->u.array[(int)s->pcount[i+2]*2+1]; - } - } else{ - for (int i=0,j=0; i < s->limit; i+=2,j++) { - normal_table[j] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[j+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[j+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3+2]; - } - } - */ - /* p separate vertex position and nomal position. */ /* make triangle */ - int k=0,size=0; + int k=0,j=0,l=0,count=0; if (s->texcoord_offset == 2){ - for (int i=0;ivmember;i++) { + for (int i=0;ipolylist_count;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[(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+3]*3]; - vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+6]*3]; - vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+2]; - vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[i+6]*3]; - vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+1]; - vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+2]; - vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[i+9]*3]; - vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[i+9]*3+1]; - vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[i+9]*3+2]; - vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[i]*3]; - vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; - vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[i]*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]; - normal_table[k] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3*2]; - normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[i+4]*3]; - normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[i+4]*3+1]; - normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[i+4]*3+2]; - normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[i+10]*3]; - normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[i+10]*3]; - normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[i+10]*3]; - normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; + 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]; + 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]; + l+=12; + j+=8; k+=18; - size +=2; + count +=2; } else if (s->vcount[i]==3) { - 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+3]*3]; - vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+3]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+6]*3]; - vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+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[i+1]*3]; - normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3*2]; - normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[i+4]*3]; - normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[i+4]*3+1]; - normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[i+4]*3+2]; - normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - + 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]; + 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]; + l+=9; + j+=6; k+=9; - size++; + count++; } } }else{ - for (int i=0;ivmember;i++) { + for (int i=0;ipolylist_count;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[(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+2]*3]; - vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+4]*3]; - vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+4]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+4]*3+2]; - vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[i+4]*3]; - vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[i+4]*3+1]; - vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[i+4]*3+2]; - vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[i+6]*3]; - vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+1]; - vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[i+6]*3+2]; - vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[i]*3]; - vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[i]*3+1]; - vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[i]*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+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[i+1]*3]; - normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3*2]; - normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[i+3]*3]; - normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[i+3]*3+1]; - normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[i+3]*3+2]; - normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[i+7]*3]; - normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; - normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[i+1]*3]; + 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]; + printf ("%f, %f, %f\n",vertex_table[k],vertex_table[k+1],vertex_table[k+2]); + printf ("%f, %f, %f\n",vertex_table[k+3],vertex_table[k+4],vertex_table[k+5]); + printf ("%f, %f, %f\n",vertex_table[k+6],vertex_table[k+7],vertex_table[k+8]); + printf ("%f, %f, %f\n",vertex_table[k+9],vertex_table[k+10],vertex_table[k+11]); + printf ("%f, %f, %f\n",vertex_table[k+12],vertex_table[k+13],vertex_table[k+14]); + printf ("%f, %f, %f\n",vertex_table[k+15],vertex_table[k+16],vertex_table[k+17]); + l+=8; k+=18; - size +=2; + count +=2; } else if (s->vcount[i]==3) { - 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+2]*3]; - vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+1]; - vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[i+2]*3+2]; - vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[i+4]*3]; - vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[i+4]*3+1]; - vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[i+4]*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+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[i+1]*3]; - normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[i+1]*3+1]; - normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[i+1]*3*2]; - normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[i+3]*3]; - normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[i+3]*3+1]; - normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[i+3]*3+2]; - normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; - normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[i+5]*3]; + 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]; + + printf ("%f, %f, %f\n",vertex_table[k],vertex_table[k+1],vertex_table[k+2]); + printf ("%f, %f, %f\n",vertex_table[k+3],vertex_table[k+4],vertex_table[k+5]); + printf ("%f, %f, %f\n",vertex_table[k+6],vertex_table[k+7],vertex_table[k+8]); + l+=6; k+=9; - size++; + count++; } } } + + + + /** * (SceneGraph.cc) * pickup_normal,pickup_coordinate,pickup_textureの処理 - * vcsumは頂点の数,countは面の数 + * sg->sizeは頂点の数,countは面の数 */ - int count = size / 3; //polygonの作成 sg->pp_num = (count + MAX_SIZE_TRIANGLE - 1) / MAX_SIZE_TRIANGLE; sg->pp = new PolygonPack[sg->pp_num]; sg->name = s->name; sg->parent_name = "NULL"; - sg->size = size; + sg->size = count*3; for (int i = 0;i < sg->pp_num; i++ ){ PolygonPackPtr pp = sg->pp; TrianglePackPtr tri = pp[i].tri; @@ -479,40 +491,39 @@ } int k = 0; int m = 0; - int n = 0; - for (int j = 0; j < tri_size; j++) { - tri[j].normal1.x = normal_table[k++]; - tri[j].normal1.y = normal_table[k++]; - tri[j].normal1.z = normal_table[k++]; + for (int j = 0; j < tri_size; j++,k+=9,m+=6) { + 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].normal2.x = normal_table[k++]; - tri[j].normal2.y = normal_table[k++]; - tri[j].normal2.z = normal_table[k++]; + 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].normal3.x = normal_table[k++]; - tri[j].normal3.y = normal_table[k++]; - tri[j].normal3.z = normal_table[k++]; - - tri[j].ver1.tex_x = texcoord_table[m++]; - tri[j].ver1.tex_y = texcoord_table[m++]; + 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].ver2.tex_x = texcoord_table[m++]; - tri[j].ver2.tex_y = texcoord_table[m++]; + 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].ver3.tex_x = texcoord_table[m++]; - tri[j].ver3.tex_y = texcoord_table[m++]; + 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.x = vertex_table[n++]; - tri[j].ver1.y = vertex_table[n++]; - tri[j].ver1.z = vertex_table[n++]; + tri[j].ver1.tex_x = texcoord_table[m]; + tri[j].ver1.tex_y = texcoord_table[m+1]; - tri[j].ver2.x = vertex_table[n++]; - tri[j].ver2.y = vertex_table[n++]; - tri[j].ver2.z = vertex_table[n++]; + tri[j].ver2.tex_x = texcoord_table[m+2]; + tri[j].ver2.tex_y = texcoord_table[m+3]; - tri[j].ver3.x = vertex_table[n++]; - tri[j].ver3.y = vertex_table[n++]; - tri[j].ver3.z = vertex_table[n++]; + tri[j].ver3.tex_x = texcoord_table[m+4]; + tri[j].ver3.tex_y = texcoord_table[m+5]; } diff -r 971d737a329a -r ad841dcdbe67 Renderer/Test/ball_bound.cc --- a/Renderer/Test/ball_bound.cc Mon Jan 30 21:48:37 2012 +0900 +++ b/Renderer/Test/ball_bound.cc Tue Jan 31 17:10:53 2012 +0900 @@ -115,8 +115,13 @@ // random な値が欲しいなら、man random に方法が書いてあります。 srandom(100); +<<<<<<< local + sgroot->createFromXMLfile("xml_file/Ball.xml"); + // sgroot->createFromXMLfile("/Users/YuSUGIMOTO/Desktop/sample.xml"); +======= sgroot->createFromXMLfile("./xml_file/Ball.xml"); //sgroot->createFromXMLfile("/Users/YuSUGIMOTO/Desktop/sample.xml"); +>>>>>>> other sgroot->OnLightSysSwitch(); diff -r 971d737a329a -r ad841dcdbe67 Renderer/Test/collada.cc --- a/Renderer/Test/collada.cc Mon Jan 30 21:48:37 2012 +0900 +++ b/Renderer/Test/collada.cc Tue Jan 31 17:10:53 2012 +0900 @@ -106,7 +106,7 @@ } } -static const char *collada_file="collada_file/sample.dae";//"collada_file/ball.dae"; +static const char *collada_file="collada_file/sample.dae"; static const char *name="Cube"; MainLoopPtr diff -r 971d737a329a -r ad841dcdbe67 Renderer/Test/collada_file/sample.dae --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Test/collada_file/sample.dae Tue Jan 31 17:10:53 2012 +0900 @@ -0,0 +1,64 @@ + + + + + Blender User + Blender 2.60.0 r41098M + + 2012-01-30T16:03:05 + 2012-01-30T16:03:05 + + Z_UP + + + + + + 123.6893 123.6893 -123.6893 123.6893 -123.6893 -123.6893 -123.6893 -123.6893 -123.6893 -123.6893 123.6894 -123.6893 123.6894 123.6893 123.6893 123.6893 -123.6894 123.6893 -123.6894 -123.6893 123.6893 -123.6893 123.6893 123.6893 + + + + + + + + + + 0 0 -1 0 0 1 1 -3.0841e-7 0 -1.85046e-7 -1 0 -1 2.00466e-7 -1.38784e-7 2.77569e-7 1 2.77569e-7 + + + + + + + + + + + + + + + 4 4 4 4 4 4 +

0 0 1 0 2 0 3 0 4 1 7 1 6 1 5 1 0 2 4 2 5 2 1 2 1 3 5 3 6 3 2 3 2 4 6 4 7 4 3 4 4 5 0 5 3 5 7 5

+
+
+ 1 +
+
+ + + + -0.7460098 4.750315 5.224323 + 0 0 1 0 + 0 1 0 0 + 1 0 0 0 + 1 1 1 + + + + + + + +
\ No newline at end of file diff -r 971d737a329a -r ad841dcdbe67 Renderer/Test/collada_file/sampleTexture.dae --- a/Renderer/Test/collada_file/sampleTexture.dae Mon Jan 30 21:48:37 2012 +0900 +++ b/Renderer/Test/collada_file/sampleTexture.dae Tue Jan 31 17:10:53 2012 +0900 @@ -5,97 +5,44 @@ Blender User Blender 2.60.0 r41098M - 2011-11-02T00:19:27 - 2011-11-02T00:19:27 + 2012-01-31T15:12:46 + 2012-01-31T15:12:46 Z_UP - - - - - - 49.13434 - 1.777778 - 0.1 - 100 - - - - - - - - - - 1 1 1 - 1 - 0 - 0.00111109 - - - - - 0.000999987 - 0 - 1 - 1 - 1 - 1 - 1 - 2 - 0 - 1 - 1 - 1 - 1 - 1 - 0 - 2880 - 2 - 30.002 - 1.000799 - 0.04999995 - 29.99998 - 1 - 2 - 0 - 0 - 1 - 1 - 1 - 1 - 8192 - 1 - 1 - 0 - 1 - 1 - 1 - 3 - 0 - 0 - 0 - 0 - 45 - 0 - 1 - 1 - 1 - 3 - 0.15 - 75 - 1 - 1 - 0 - 1 - 1 - 0 + + + + + + + 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 + @@ -130,11 +77,58 @@ + + + + + + + 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 +
@@ -182,6 +176,22 @@
+ + 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 @@ -198,22 +208,6 @@ - - 4.076245 1.005454 5.903862 - 0 0 1 106.9363 - 0 1 0 3.163707 - 1 0 0 37.26105 - 1 1 1 - - - - 7.481132 -6.50764 5.343665 - 0 0 1 46.69194 - 0 1 0 0.619768 - 1 0 0 63.5593 - 1 1 1 - - diff -r 971d737a329a -r ad841dcdbe67 SceneGraph/BlenderScript/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SceneGraph/BlenderScript/readme.txt Tue Jan 31 17:10:53 2012 +0900 @@ -0,0 +1,12 @@ +How to use "export_xml3.py" +Put "export_xml3.py" in the blender2.XX/blender.app/Contents/MacOS/2.XX/scripts/addons". + +Boot blender and click file menu and select User Preferences. + +Select "Addons" tab. + +click "PS3 Cerium (xml)"'s check box. + +click "Save As Default" + +Congratulations!