changeset 1398:e19296785c07 draft

collada can move
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Sun, 05 Feb 2012 23:34:16 +0900
parents cb5bced85a14
children d6170e1200a0
files Renderer/Engine/Collada.cc Renderer/Engine/xml.cc Renderer/Test/collada.cc Renderer/Test/collada_file/sample.dae
diffstat 4 files changed, 270 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Collada.cc	Tue Jan 31 17:15:16 2012 +0900
+++ b/Renderer/Engine/Collada.cc	Sun Feb 05 23:34:16 2012 +0900
@@ -13,6 +13,17 @@
 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 {
@@ -242,12 +253,11 @@
 
     /* store float inpoint list */
     for (int i = 0; cont != NULL; i++) {
-        cont = pickup_float(cont, src->u.array+i);
+      cont = pickup_float(cont, src->u.array+i);
     }
 
     src->next = NULL;
     addSource(list, src);
-    //printf("id:%s count:%d cont:%s\n", id, count, cont);
 }
 
 
@@ -282,15 +292,23 @@
      * vertex_tableだけはpolygonを作る際にvcountが4の場合重複する点が
      * 出てくるのでサイズを2倍用意しておく
      */
+  /*    
     float *vertex_table;
     float *normal_table;
-    float *texcoord_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 */
@@ -298,173 +316,161 @@
     if (s->texcoord_offset == 2){
         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[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];
+	        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];
 
-		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_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] = 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;
+	        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;
 		count +=2;
 	    } else if (s->vcount[i]==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+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_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];
 
-		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;
+		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_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;
+
+		l+=9;j+=3;k+=3;
 		count++;
 	    }
 	}
     }else{
         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[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];
+	        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_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];
+	        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];
 
-		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;
+	        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;
 		count +=2;
 	    } else if (s->vcount[i]==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];
+	        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_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];
+		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];
 
-		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;
+		l+=6;k+=3;
 		count++;
 	    }
 	}
     }
 
-  
-  
-
 
    /**
      * (SceneGraph.cc)
@@ -478,44 +484,43 @@
     sg->name = s->name;
     sg->parent_name = "NULL";
     sg->size = count*3;
+    k = 0;
     for (int i = 0;i < sg->pp_num; i++ ){
-    PolygonPackPtr pp = sg->pp;
+        PolygonPackPtr pp = sg->pp;
 	TrianglePackPtr tri =  pp[i].tri;
 	// TrianglePack の size のチェック
         int tri_size = (count < MAX_SIZE_TRIANGLE) ? count : MAX_SIZE_TRIANGLE ;
 	pp[i].info.size = tri_size;
-    /* default texture peste */
-    if (s->images_flag==0) {
-        char *default_image = "../Test/xml_file/blend/images/ball.jpg"; 
-        get_texture_image(default_image, sg, (xmlNodePtr)NULL, manager);
-    }
-	int k = 0;
-	int m = 0;
-	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];
+	/* default texture peste */
+	if (s->images_flag==0) {
+	    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;
 	    
-	    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].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].ver3.x = vertex_table[k+6];
-	    tri[j].ver3.y = vertex_table[k+7];
-	    tri[j].ver3.z = vertex_table[k+8];
+	    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_table[k];
-	    tri[j].normal1.y = normal_table[k+1];
-	    tri[j].normal1.z = normal_table[k+2];
+	    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].normal2.x = normal_table[k+3];
-	    tri[j].normal2.y = normal_table[k+4];
-	    tri[j].normal2.z = normal_table[k+5];
+	    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].normal3.x = normal_table[k+6];
-	    tri[j].normal3.y = normal_table[k+7];
-	    tri[j].normal3.z = normal_table[k+8];
-	    
+	    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].ver1.tex_x = texcoord_table[m];
 	    tri[j].ver1.tex_y = texcoord_table[m+1];
 	    
@@ -524,16 +529,17 @@
 	    
 	    tri[j].ver3.tex_x = texcoord_table[m+4];
 	    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;
--- a/Renderer/Engine/xml.cc	Tue Jan 31 17:15:16 2012 +0900
+++ b/Renderer/Engine/xml.cc	Sun Feb 05 23:34:16 2012 +0900
@@ -17,11 +17,10 @@
   return(cont);
 }
 
-
 char *pickup_float(char *cont, float *index)
 {
-  int sign=1,exp=1;
-  float shift=10,val_dec=0,val_int=0;
+  int sign=1;
+  float shift=10,val_dec=0,val_int=0,exp=1;;
 
   cont = skip_to_number(cont);
   if (cont == NULL) return(NULL);
@@ -51,8 +50,13 @@
         }
       else if (*cont == 'e' || *cont == 'E')
         {
-          //cont = pickup_exponent(&exp,cont+1);
-          if (cont == NULL) return(NULL);
+	  if (cont == NULL){ 
+	    return(NULL);
+	  }
+	  else if (*(cont+1) == '-'){
+	    for (int j=0;j<*(cont+2);j++)exp *= 0.1;
+	  //cont = pickup_exponent(&exp,cont+1);
+	  }
         }
       else if (*cont == '+' || *cont == '/' || *cont == ' ')
         {
@@ -70,7 +74,6 @@
              * xml形式の時、途中で NULL が来た場合、エラー処理され
              * なくなる。NULL を返すので、呼び出し側で判断する
              */
-            
             *index = sign * (val_int + val_dec) * exp;
             return(NULL);
         }
@@ -80,7 +83,6 @@
           return(NULL);
         }
     }
-
   *index = sign * (val_int + val_dec) * exp;
   cont++;
   return(cont);
--- a/Renderer/Test/collada.cc	Tue Jan 31 17:15:16 2012 +0900
+++ b/Renderer/Test/collada.cc	Sun Feb 05 23:34:16 2012 +0900
@@ -106,8 +106,8 @@
     }
 }
 
-static const char *collada_file="collada_file/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)
--- a/Renderer/Test/collada_file/sample.dae	Tue Jan 31 17:15:16 2012 +0900
+++ b/Renderer/Test/collada_file/sample.dae	Sun Feb 05 23:34:16 2012 +0900
@@ -5,42 +5,91 @@
       <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>
+    <created>2012-01-31T19:29:49</created>
+    <modified>2012-01-31T19:29:49</modified>
     <unit name="meter" meter="1"/>
     <up_axis>Z_UP</up_axis>
   </asset>
+  <library_effects>
+    <effect id="Material-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.64 0.64 0.64 1</color>
+            </diffuse>
+            <specular>
+              <color sid="specular">0.5 0.5 0.5 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>
+          <technique profile="GOOGLEEARTH">
+            <double_sided>1</double_sided>
+          </technique>
+        </extra>
+      </profile_COMMON>
+      <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
+    </effect>
+  </library_effects>
+  <library_materials>
+    <material id="Material-material" name="Material">
+      <instance_effect url="#Material-effect"/>
+    </material>
+  </library_materials>
   <library_geometries>
-    <geometry id="Cube_001-mesh">
+    <geometry id="Cube-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>
+        <source id="Cube-mesh-positions">
+          <float_array id="Cube-mesh-positions-array" count="24">90 90 -90 90 -89.99999 -90 -90.00002 -89.99998 -90 -89.99996 90.00003 -90 90.00005 89.99996 90 89.99994 -90.00006 90 -90.00003 -89.99997 90 -89.99999 90 90</float_array>
           <technique_common>
-            <accessor source="#Cube_001-mesh-positions-array" count="8" stride="3">
+            <accessor source="#Cube-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>
+        <source id="Cube-mesh-normals">
+          <float_array id="Cube-mesh-normals-array" count="18">0 0 -1 0 0 1 1 -2.96699e-7 0 -2.54313e-7 -1 -1.69542e-7 -1 2.75506e-7 0 2.11928e-7 1 2.11928e-7</float_array>
           <technique_common>
-            <accessor source="#Cube_001-mesh-normals-array" count="6" stride="3">
+            <accessor source="#Cube-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"/>
+        <source id="Cube-mesh-map-0">
+          <float_array id="Cube-mesh-map-0-array" count="48">1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1</float_array>
+          <technique_common>
+            <accessor source="#Cube-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-vertices">
+          <input semantic="POSITION" source="#Cube-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"/>
+        <polylist material="Material1" count="6">
+          <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
+          <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
+          <input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
           <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>
+          <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>
@@ -49,12 +98,20 @@
   <library_visual_scenes>
     <visual_scene id="Scene" name="Scene">
       <node id="Cube" type="NODE">
-        <translate sid="location">-0.7460098 4.750315 5.224323</translate>
+        <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_001-mesh"/>
+        <instance_geometry url="#Cube-mesh">
+          <bind_material>
+            <technique_common>
+              <instance_material symbol="Material1" target="#Material-material">
+                <bind_vertex_input semantic="UVTex" input_semantic="TEXCOORD" input_set="0"/>
+              </instance_material>
+            </technique_common>
+          </bind_material>
+        </instance_geometry>
       </node>
     </visual_scene>
   </library_visual_scenes>