changeset 1396:ad841dcdbe67 draft

collada moved. But only cube.
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Tue, 31 Jan 2012 17:10:53 +0900
parents 971d737a329a
children cb5bced85a14
files Renderer/Engine/Collada.cc Renderer/Test/ball_bound.cc Renderer/Test/collada.cc Renderer/Test/collada_file/sample.dae Renderer/Test/collada_file/sampleTexture.dae SceneGraph/BlenderScript/readme.txt
diffstat 6 files changed, 359 insertions(+), 273 deletions(-) [+]
line wrap: on
line diff
--- 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;i<s->vmember;i++) {
+        for (int i=0;i<s->polylist_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;i<s->vmember;i++) {
+        for (int i=0;i<s->polylist_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];	    
 
 	}
 	
--- 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();
 
--- 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 
--- /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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
+  <asset>
+    <contributor>
+      <author>Blender User</author>
+      <authoring_tool>Blender 2.60.0 r41098M</authoring_tool>
+    </contributor>
+    <created>2012-01-30T16:03:05</created>
+    <modified>2012-01-30T16:03:05</modified>
+    <unit name="meter" meter="1"/>
+    <up_axis>Z_UP</up_axis>
+  </asset>
+  <library_geometries>
+    <geometry id="Cube_001-mesh">
+      <mesh>
+        <source id="Cube_001-mesh-positions">
+          <float_array id="Cube_001-mesh-positions-array" count="24">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</float_array>
+          <technique_common>
+            <accessor source="#Cube_001-mesh-positions-array" count="8" stride="3">
+              <param name="X" type="float"/>
+              <param name="Y" type="float"/>
+              <param name="Z" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <source id="Cube_001-mesh-normals">
+          <float_array id="Cube_001-mesh-normals-array" count="18">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</float_array>
+          <technique_common>
+            <accessor source="#Cube_001-mesh-normals-array" count="6" stride="3">
+              <param name="X" type="float"/>
+              <param name="Y" type="float"/>
+              <param name="Z" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <vertices id="Cube_001-mesh-vertices">
+          <input semantic="POSITION" source="#Cube_001-mesh-positions"/>
+        </vertices>
+        <polylist count="6">
+          <input semantic="VERTEX" source="#Cube_001-mesh-vertices" offset="0"/>
+          <input semantic="NORMAL" source="#Cube_001-mesh-normals" offset="1"/>
+          <vcount>4 4 4 4 4 4 </vcount>
+          <p>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</p>
+        </polylist>
+      </mesh>
+      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
+    </geometry>
+  </library_geometries>
+  <library_visual_scenes>
+    <visual_scene id="Scene" name="Scene">
+      <node id="Cube" type="NODE">
+        <translate sid="location">-0.7460098 4.750315 5.224323</translate>
+        <rotate sid="rotationZ">0 0 1 0</rotate>
+        <rotate sid="rotationY">0 1 0 0</rotate>
+        <rotate sid="rotationX">1 0 0 0</rotate>
+        <scale sid="scale">1 1 1</scale>
+        <instance_geometry url="#Cube_001-mesh"/>
+      </node>
+    </visual_scene>
+  </library_visual_scenes>
+  <scene>
+    <instance_visual_scene url="#Scene"/>
+  </scene>
+</COLLADA>
\ No newline at end of file
--- 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 @@
       <author>Blender User</author>
       <authoring_tool>Blender 2.60.0 r41098M</authoring_tool>
     </contributor>
-    <created>2011-11-02T00:19:27</created>
-    <modified>2011-11-02T00:19:27</modified>
+    <created>2012-01-31T15:12:46</created>
+    <modified>2012-01-31T15:12:46</modified>
     <unit name="meter" meter="1"/>
     <up_axis>Z_UP</up_axis>
   </asset>
-  <library_cameras>
-    <camera id="Camera-camera" name="Camera">
-      <optics>
-        <technique_common>
-          <perspective>
-            <xfov sid="xfov">49.13434</xfov>
-            <aspect_ratio>1.777778</aspect_ratio>
-            <znear sid="znear">0.1</znear>
-            <zfar sid="zfar">100</zfar>
-          </perspective>
-        </technique_common>
-      </optics>
-    </camera>
-  </library_cameras>
-  <library_lights>
-    <light id="Lamp-light" name="Lamp">
-      <technique_common>
-        <point>
-          <color sid="color">1 1 1</color>
-          <constant_attenuation>1</constant_attenuation>
-          <linear_attenuation>0</linear_attenuation>
-          <quadratic_attenuation>0.00111109</quadratic_attenuation>
-        </point>
-      </technique_common>
-      <extra>
-        <technique profile="blender">
-          <adapt_thresh>0.000999987</adapt_thresh>
-          <area_shape>0</area_shape>
-          <area_size>1</area_size>
-          <area_sizey>1</area_sizey>
-          <area_sizez>1</area_sizez>
-          <atm_distance_factor>1</atm_distance_factor>
-          <atm_extinction_factor>1</atm_extinction_factor>
-          <atm_turbidity>2</atm_turbidity>
-          <att1>0</att1>
-          <att2>1</att2>
-          <backscattered_light>1</backscattered_light>
-          <bias>1</bias>
-          <blue>1</blue>
-          <buffers>1</buffers>
-          <bufflag>0</bufflag>
-          <bufsize>2880</bufsize>
-          <buftype>2</buftype>
-          <clipend>30.002</clipend>
-          <clipsta>1.000799</clipsta>
-          <compressthresh>0.04999995</compressthresh>
-          <dist sid="blender_dist">29.99998</dist>
-          <energy sid="blender_energy">1</energy>
-          <falloff_type>2</falloff_type>
-          <filtertype>0</filtertype>
-          <flag>0</flag>
-          <gamma sid="blender_gamma">1</gamma>
-          <green>1</green>
-          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
-          <horizon_brightness>1</horizon_brightness>
-          <mode>8192</mode>
-          <ray_samp>1</ray_samp>
-          <ray_samp_method>1</ray_samp_method>
-          <ray_samp_type>0</ray_samp_type>
-          <ray_sampy>1</ray_sampy>
-          <ray_sampz>1</ray_sampz>
-          <red>1</red>
-          <samp>3</samp>
-          <shadhalostep>0</shadhalostep>
-          <shadow_b sid="blender_shadow_b">0</shadow_b>
-          <shadow_g sid="blender_shadow_g">0</shadow_g>
-          <shadow_r sid="blender_shadow_r">0</shadow_r>
-          <shadspotsize>45</shadspotsize>
-          <sky_colorspace>0</sky_colorspace>
-          <sky_exposure>1</sky_exposure>
-          <skyblendfac>1</skyblendfac>
-          <skyblendtype>1</skyblendtype>
-          <soft>3</soft>
-          <spotblend>0.15</spotblend>
-          <spotsize>75</spotsize>
-          <spread>1</spread>
-          <sun_brightness>1</sun_brightness>
-          <sun_effect_type>0</sun_effect_type>
-          <sun_intensity>1</sun_intensity>
-          <sun_size>1</sun_size>
-          <type>0</type>
+  <library_effects>
+    <effect id="Material_001-effect">
+      <profile_COMMON>
+        <technique sid="common">
+          <phong>
+            <emission>
+              <color sid="emission">0 0 0 1</color>
+            </emission>
+            <ambient>
+              <color sid="ambient">0 0 0 1</color>
+            </ambient>
+            <diffuse>
+              <color sid="diffuse">0.512 0.512 0.512 1</color>
+            </diffuse>
+            <specular>
+              <color sid="specular">0.25 0.25 0.25 1</color>
+            </specular>
+            <shininess>
+              <float sid="shininess">50</float>
+            </shininess>
+            <index_of_refraction>
+              <float sid="index_of_refraction">1</float>
+            </index_of_refraction>
+          </phong>
         </technique>
-      </extra>
-    </light>
-  </library_lights>
-  <library_effects>
+        <extra>
+          <technique profile="GOOGLEEARTH">
+            <double_sided>1</double_sided>
+          </technique>
+        </extra>
+      </profile_COMMON>
+      <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
+    </effect>
     <effect id="Material-effect">
       <profile_COMMON>
         <technique sid="common">
@@ -130,11 +77,58 @@
     </effect>
   </library_effects>
   <library_materials>
+    <material id="Material_001-material" name="Material.001">
+      <instance_effect url="#Material_001-effect"/>
+    </material>
     <material id="Material-material" name="Material">
       <instance_effect url="#Material-effect"/>
     </material>
   </library_materials>
   <library_geometries>
+    <geometry id="Cube-mesh-mesh">
+      <mesh>
+        <source id="Cube-mesh-mesh-positions">
+          <float_array id="Cube-mesh-mesh-positions-array" count="24">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</float_array>
+          <technique_common>
+            <accessor source="#Cube-mesh-mesh-positions-array" count="8" stride="3">
+              <param name="X" type="float"/>
+              <param name="Y" type="float"/>
+              <param name="Z" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <source id="Cube-mesh-mesh-normals">
+          <float_array id="Cube-mesh-mesh-normals-array" count="18">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</float_array>
+          <technique_common>
+            <accessor source="#Cube-mesh-mesh-normals-array" count="6" stride="3">
+              <param name="X" type="float"/>
+              <param name="Y" type="float"/>
+              <param name="Z" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <source id="Cube-mesh-mesh-map-0">
+          <float_array id="Cube-mesh-mesh-map-0-array" count="48">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</float_array>
+          <technique_common>
+            <accessor source="#Cube-mesh-mesh-map-0-array" count="24" stride="2">
+              <param name="S" type="float"/>
+              <param name="T" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <vertices id="Cube-mesh-mesh-vertices">
+          <input semantic="POSITION" source="#Cube-mesh-mesh-positions"/>
+        </vertices>
+        <polylist material="Material_0011" count="6">
+          <input semantic="VERTEX" source="#Cube-mesh-mesh-vertices" offset="0"/>
+          <input semantic="NORMAL" source="#Cube-mesh-mesh-normals" offset="1"/>
+          <input semantic="TEXCOORD" source="#Cube-mesh-mesh-map-0" offset="2" set="0"/>
+          <vcount>4 4 4 4 4 4 </vcount>
+          <p>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</p>
+        </polylist>
+      </mesh>
+      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
+    </geometry>
     <geometry id="Cube-mesh">
       <mesh>
         <source id="Cube-mesh-positions">
@@ -182,6 +176,22 @@
   </library_geometries>
   <library_visual_scenes>
     <visual_scene id="Scene" name="Scene">
+      <node id="Cube_001" type="NODE">
+        <translate sid="location">0 0 0</translate>
+        <rotate sid="rotationZ">0 0 1 0</rotate>
+        <rotate sid="rotationY">0 1 0 0</rotate>
+        <rotate sid="rotationX">1 0 0 0</rotate>
+        <scale sid="scale">1 1 1</scale>
+        <instance_geometry url="#Cube-mesh-mesh">
+          <bind_material>
+            <technique_common>
+              <instance_material symbol="Material_0011" target="#Material_001-material">
+                <bind_vertex_input semantic="UVTex" input_semantic="TEXCOORD" input_set="0"/>
+              </instance_material>
+            </technique_common>
+          </bind_material>
+        </instance_geometry>
+      </node>
       <node id="Cube" type="NODE">
         <translate sid="location">0 0 0</translate>
         <rotate sid="rotationZ">0 0 1 0</rotate>
@@ -198,22 +208,6 @@
           </bind_material>
         </instance_geometry>
       </node>
-      <node id="Lamp" type="NODE">
-        <translate sid="location">4.076245 1.005454 5.903862</translate>
-        <rotate sid="rotationZ">0 0 1 106.9363</rotate>
-        <rotate sid="rotationY">0 1 0 3.163707</rotate>
-        <rotate sid="rotationX">1 0 0 37.26105</rotate>
-        <scale sid="scale">1 1 1</scale>
-        <instance_light url="#Lamp-light"/>
-      </node>
-      <node id="Camera" type="NODE">
-        <translate sid="location">7.481132 -6.50764 5.343665</translate>
-        <rotate sid="rotationZ">0 0 1 46.69194</rotate>
-        <rotate sid="rotationY">0 1 0 0.619768</rotate>
-        <rotate sid="rotationX">1 0 0 63.5593</rotate>
-        <scale sid="scale">1 1 1</scale>
-        <instance_camera url="#Camera-camera"/>
-      </node>
     </visual_scene>
   </library_visual_scenes>
   <scene>
--- /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!