changeset 1399:d6170e1200a0 draft

minor changes.
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Mon, 06 Feb 2012 16:29:26 +0900
parents e19296785c07
children 3152bb4429da
files Renderer/Engine/Collada.cc Renderer/Test/collada_file/sampleTexture.dae
diffstat 2 files changed, 172 insertions(+), 277 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Collada.cc	Sun Feb 05 23:34:16 2012 +0900
+++ b/Renderer/Engine/Collada.cc	Mon Feb 06 16:29:26 2012 +0900
@@ -13,17 +13,6 @@
 extern int is_bmp(const char* name);
 extern void make_black_alpha(SDL_Surface *texture_image);
 
-typedef struct p_info {
-    p_info(){
-        x = 0;
-        y = 0;
-        z = 0;
-    }
-    float x;
-    float y;
-    float z;
-};
-
 typedef struct source {
     char *id;
     union {
@@ -292,180 +281,180 @@
      * vertex_tableだけはpolygonを作る際にvcountが4の場合重複する点が
      * 出てくるのでサイズを2倍用意しておく
      */
-  /*    
+
     float *vertex_table;
     float *normal_table;
     float *texcoord_table;
+
     vertex_table = new float[s->vtable_size*3];
     normal_table = new float[s->vtable_size*3];
     texcoord_table = new float[s->vtable_size*2];
     bzero(vertex_table,sizeof(float)*s->vtable_size*3);
     bzero(normal_table,sizeof(float)*s->vtable_size*3);
     bzero(texcoord_table,sizeof(float)*s->vtable_size*2);
-  */
-    p_info *vertex_p;
-    p_info *normal_p;
-    p_info *texcoord_p;
-    vertex_p = new p_info[s->vtable_size];
-    normal_p = new p_info[s->vtable_size];
-    texcoord_p = new p_info[s->vtable_size];
-
     /* p separate vertex position and nomal position. */
     /* make triangle */
     int k=0,j=0,l=0,count=0;
     if (s->texcoord_offset == 2){
         for (int i=0;i<s->polylist_count;i++) {
 	    if (s->vcount[i] == 4) {
-	        vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-	        vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
-	        vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+3]*3];
-	        vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1];
-	        vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2];
-	        vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
-	        vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
-	        vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
-
-	        vertex_p[k+3].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
-	        vertex_p[k+3].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
-	        vertex_p[k+3].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
-		vertex_p[k+4].x = s->vertex_float->u.array[(int)s->pcount[l+9]*3];
-		vertex_p[k+4].y = s->vertex_float->u.array[(int)s->pcount[l+9]*3+1];
-	        vertex_p[k+4].z = s->vertex_float->u.array[(int)s->pcount[l+9]*3+2];
-		vertex_p[k+5].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-		vertex_p[k+5].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k+5].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+	        vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+3]*3];
+		vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1];
+		vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2];
+		vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
+		vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
+		vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
+		vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
+		vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
+		vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
+		vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[l+9]*3];
+		vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[l+9]*3+1];
+		vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[l+9]*3+2];
+		vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		
+		normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3*2];
+		normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+4]*3];
+		normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+4]*3+1];
+		normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+4]*3+2];
+		normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+7]*3];
+		normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
+		normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[l+7]*3];
+		normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
+		normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[l+10]*3];
+		normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[l+10]*3+1];
+		normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[l+10]*3+2];
+		normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
+		
+		texcoord_table[j] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2];
+		texcoord_table[j+1] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2+1];
+		texcoord_table[j+2] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2];
+		texcoord_table[j+3] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2+1];
+		texcoord_table[j+4] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2];
+		texcoord_table[j+5] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1];
 
-	        normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-	        normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-	        normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-	        normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+4]*3];
-	        normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+4]*3+1];
-	        normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+4]*3+2];
-	        normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+7]*3];
-	        normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
-	        normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		texcoord_table[j+6] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2];
+		texcoord_table[j+7] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1];
+		texcoord_table[j+8] = s->texcoord_float->u.array[(int)s->pcount[l+11]*2];
+		texcoord_table[j+9] = s->texcoord_float->u.array[(int)s->pcount[l+11]*2];
+		texcoord_table[j+10] = s->texcoord_float->u.array[(int)s->pcount[l+14]*2];
+		texcoord_table[j+11] = s->texcoord_float->u.array[(int)s->pcount[l+14]*2];
 
-	        normal_p[k+3].x = s->normal_float->u.array[(int)s->pcount[l+7]*3];
-	        normal_p[k+3].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
-	        normal_p[k+3].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
-	        normal_p[k+4].x = s->normal_float->u.array[(int)s->pcount[l+10]*3];
-	        normal_p[k+4].y = s->normal_float->u.array[(int)s->pcount[l+10]*3+1];
-	        normal_p[k+4].z = s->normal_float->u.array[(int)s->pcount[l+10]*3+2];
-	        normal_p[k+5].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-	        normal_p[k+5].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-	        normal_p[k+5].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-		
-		texcoord_p[j].x = s->texcoord_float->u.array[(int)s->pcount[l+2]*2];
-		texcoord_p[j].y = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]+1;
-		texcoord_p[j+1].x = s->texcoord_float->u.array[(int)s->pcount[l+5]*2];
-		texcoord_p[j+1].y = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]+1;
-		texcoord_p[j+2].x = s->texcoord_float->u.array[(int)s->pcount[l+8]*2];
-		texcoord_p[j+2].y = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]+1;
-		texcoord_p[j+3].x = s->texcoord_float->u.array[(int)s->pcount[l+11]*2];
-		texcoord_p[j+3].y = s->texcoord_float->u.array[(int)s->pcount[l+11]*2]+1;
-
-		l+=12;j+=4;k+=6;
+		l+=12;
+		j+=12;
+		k+=18;
 		count +=2;
 	    } else if (s->vcount[i]==3) {
-	        vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-	        vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
-	        vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+3]*3];
-	        vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1];
-	        vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2];
-	        vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
-	        vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
-	        vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
+	        vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+3]*3];
+		vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+1];
+		vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+3]*3+2];
+		vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
+		vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
+		vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
+		
+		normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3*2];
+		normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+4]*3];
+		normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+4]*3+1];
+		normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+4]*3+2];
+		normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+7]*3];
+		normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
+		normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		
+		texcoord_table[j] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2];
+		texcoord_table[j+1] = s->texcoord_float->u.array[(int)s->pcount[l+2]*2+1];
 
-		normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-		normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-		normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-		normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+4]*3];
-		normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+4]*3+1];
-		normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+4]*3+2];
-		normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+7]*3];
-		normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
-		normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		texcoord_table[j+2] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2];
+		texcoord_table[j+3] = s->texcoord_float->u.array[(int)s->pcount[l+5]*2+1];
 
-		texcoord_p[j].x = s->texcoord_float->u.array[(int)s->pcount[l+2]*2];
-		texcoord_p[j].y = s->texcoord_float->u.array[(int)s->pcount[l+2]*2]+1;
-		texcoord_p[j+1].x = s->texcoord_float->u.array[(int)s->pcount[l+5]*2];
-		texcoord_p[j+1].y = s->texcoord_float->u.array[(int)s->pcount[l+5]*2]+1;
-		texcoord_p[j+2].x = s->texcoord_float->u.array[(int)s->pcount[l+8]*2];
-		texcoord_p[j+2].y = s->texcoord_float->u.array[(int)s->pcount[l+8]*2]+1;
+		texcoord_table[j+4] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2];
+		texcoord_table[j+5] = s->texcoord_float->u.array[(int)s->pcount[l+8]*2+1];
 
-		l+=9;j+=3;k+=3;
+		l+=9;
+		j+=6;
+		k+=9;
 		count++;
 	    }
 	}
     }else{
         for (int i=0;i<s->polylist_count;i++) {
 	    if (s->vcount[i] == 4) {
-	        vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-	        vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
-	        vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+2]*3];
-	        vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1];
-	        vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2];
-	        vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
-	        vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
-	        vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
-
-	        vertex_p[k+3].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
-	        vertex_p[k+3].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
-	        vertex_p[k+3].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
-		vertex_p[k+4].x = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
-		vertex_p[k+4].y = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
-	        vertex_p[k+4].z = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
-		vertex_p[k+5].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-		vertex_p[k+5].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k+5].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
-
-	        normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-	        normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-	        normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-	        normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+3]*3];
-	        normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+3]*3+1];
-	        normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+3]*3+2];
-	        normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+5]*3];
-	        normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
-	        normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
-
-	        normal_p[k+3].x = s->normal_float->u.array[(int)s->pcount[l+5]*3];
-	        normal_p[k+3].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
-	        normal_p[k+3].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
-	        normal_p[k+4].x = s->normal_float->u.array[(int)s->pcount[l+7]*3];
-	        normal_p[k+4].y = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
-	        normal_p[k+4].z = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
-	        normal_p[k+5].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-	        normal_p[k+5].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-	        normal_p[k+5].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-
-		l+=8;k+=6;
+	        vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+2]*3];
+		vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1];
+		vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2];
+		vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
+		vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
+		vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
+		vertex_table[k+9] = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
+		vertex_table[k+10] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
+		vertex_table[k+11] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
+		vertex_table[k+12] = s->vertex_float->u.array[(int)s->pcount[l+6]*3];
+		vertex_table[k+13] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+1];
+		vertex_table[k+14] = s->vertex_float->u.array[(int)s->pcount[l+6]*3+2];
+		vertex_table[k+15] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+16] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+17] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		
+		normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
+		normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+3]*3];
+		normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+3]*3+1];
+		normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+3]*3+2];
+		normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+5]*3];
+		normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
+		normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
+		normal_table[k+9] = s->normal_float->u.array[(int)s->pcount[l+5]*3];
+		normal_table[k+10] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
+		normal_table[k+11] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
+		normal_table[k+12] = s->normal_float->u.array[(int)s->pcount[l+7]*3];
+		normal_table[k+13] = s->normal_float->u.array[(int)s->pcount[l+7]*3+1];
+		normal_table[k+14] = s->normal_float->u.array[(int)s->pcount[l+7]*3+2];
+		normal_table[k+15] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+16] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+17] = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
+		l+=8;
+		k+=18;
 		count +=2;
 	    } else if (s->vcount[i]==3) {
-	        vertex_p[k].x = s->vertex_float->u.array[(int)s->pcount[l]*3];
-	        vertex_p[k].y = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
-	        vertex_p[k].z = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
-	        vertex_p[k+1].x = s->vertex_float->u.array[(int)s->pcount[l+2]*3];
-	        vertex_p[k+1].y = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1];
-	        vertex_p[k+1].z = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2];
-	        vertex_p[k+2].x = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
-	        vertex_p[k+2].y = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
-	        vertex_p[k+2].z = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
-
-		normal_p[k].x = s->normal_float->u.array[(int)s->pcount[l+1]*3];
-		normal_p[k].y = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
-		normal_p[k].z = s->normal_float->u.array[(int)s->pcount[l+1]*3+2];
-		normal_p[k+1].x = s->normal_float->u.array[(int)s->pcount[l+3]*3];
-		normal_p[k+1].y = s->normal_float->u.array[(int)s->pcount[l+3]*3+1];
-		normal_p[k+1].z = s->normal_float->u.array[(int)s->pcount[l+3]*3+2];
-		normal_p[k+2].x = s->normal_float->u.array[(int)s->pcount[l+5]*3];
-		normal_p[k+2].y = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
-		normal_p[k+2].z = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
-
-		l+=6;k+=3;
+	        vertex_table[k] = s->vertex_float->u.array[(int)s->pcount[l]*3];
+		vertex_table[k+1] = s->vertex_float->u.array[(int)s->pcount[l]*3+1];
+		vertex_table[k+2] = s->vertex_float->u.array[(int)s->pcount[l]*3+2];
+		vertex_table[k+3] = s->vertex_float->u.array[(int)s->pcount[l+2]*3];
+		vertex_table[k+4] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+1];
+		vertex_table[k+5] = s->vertex_float->u.array[(int)s->pcount[l+2]*3+2];
+		vertex_table[k+6] = s->vertex_float->u.array[(int)s->pcount[l+4]*3];
+		vertex_table[k+7] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+1];
+		vertex_table[k+8] = s->vertex_float->u.array[(int)s->pcount[l+4]*3+2];
+		
+		normal_table[k] = s->normal_float->u.array[(int)s->pcount[l+1]*3];
+		normal_table[k+1] = s->normal_float->u.array[(int)s->pcount[l+1]*3+1];
+		normal_table[k+2] = s->normal_float->u.array[(int)s->pcount[l+1]*3+22];
+		normal_table[k+3] = s->normal_float->u.array[(int)s->pcount[l+3]*3];
+		normal_table[k+4] = s->normal_float->u.array[(int)s->pcount[l+3]*3+1];
+		normal_table[k+5] = s->normal_float->u.array[(int)s->pcount[l+3]*3+2];
+		normal_table[k+6] = s->normal_float->u.array[(int)s->pcount[l+5]*3];
+		normal_table[k+7] = s->normal_float->u.array[(int)s->pcount[l+5]*3+1];
+		normal_table[k+8] = s->normal_float->u.array[(int)s->pcount[l+5]*3+2];
+		l+=6;
+		k+=9;
 		count++;
 	    }
 	}
@@ -485,6 +474,7 @@
     sg->parent_name = "NULL";
     sg->size = count*3;
     k = 0;
+    int m = 0;
     for (int i = 0;i < sg->pp_num; i++ ){
         PolygonPackPtr pp = sg->pp;
 	TrianglePackPtr tri =  pp[i].tri;
@@ -496,31 +486,31 @@
 	    char *default_image = "../Test/xml_file/blend/images/ball.jpg"; 
 	   get_texture_image(default_image, sg, (xmlNodePtr)NULL, manager);
 	}
-	for (int j = 0; j < tri_size; j++,k+=3) {
-	    tri[j].ver1.x = vertex_p[k].x;
-	    tri[j].ver1.y = vertex_p[k].y;
-	    tri[j].ver1.z = vertex_p[k].z;
+	for (int j = 0; j < tri_size; j++,k+=9) {
+	    tri[j].ver1.x = vertex_table[k];
+	    tri[j].ver1.y = vertex_table[k+1];
+	    tri[j].ver1.z = vertex_table[k+2];
 	    
-	    tri[j].ver2.x = vertex_p[k+1].x;
-	    tri[j].ver2.y = vertex_p[k+1].y;
-	    tri[j].ver2.z = vertex_p[k+1].z;
+	    tri[j].ver2.x = vertex_table[k+3];
+	    tri[j].ver2.y = vertex_table[k+4];
+	    tri[j].ver2.z = vertex_table[k+5];
 	    
-	    tri[j].ver3.x = vertex_p[k+2].x;
-	    tri[j].ver3.y = vertex_p[k+2].y;
-	    tri[j].ver3.z = vertex_p[k+2].z;
-
-	    tri[j].normal1.x = normal_p[k].x;
-	    tri[j].normal1.y = normal_p[k].y;
-	    tri[j].normal1.z = normal_p[k].z;
+	    tri[j].ver3.x = vertex_table[k+6];
+	    tri[j].ver3.y = vertex_table[k+7];
+	    tri[j].ver3.z = vertex_table[k+8];
+		
+	    tri[j].normal1.x = normal_table[k];
+	    tri[j].normal1.y = normal_table[k+1];
+	    tri[j].normal1.z = normal_table[k+2];
 	    
-	    tri[j].normal2.x = normal_p[k+1].x;
-	    tri[j].normal2.y = normal_p[k+1].y;
-	    tri[j].normal2.z = normal_p[k+1].z;
+	    tri[j].normal2.x = normal_table[k+3];
+	    tri[j].normal2.y = normal_table[k+4];
+	    tri[j].normal2.z = normal_table[k+5];
 	    
-	    tri[j].normal3.x = normal_p[k+2].x;
-	    tri[j].normal3.y = normal_p[k+2].y;
-	    tri[j].normal3.z = normal_p[k+2].z;
-	    /*
+	    tri[j].normal3.x = normal_table[k+6];
+	    tri[j].normal3.y = normal_table[k+7];
+	    tri[j].normal3.z = normal_table[k+8];
+	    
 	    tri[j].ver1.tex_x = texcoord_table[m];
 	    tri[j].ver1.tex_y = texcoord_table[m+1];
 	    
@@ -528,18 +518,18 @@
 	    tri[j].ver2.tex_y = texcoord_table[m+3];
 	    
 	    tri[j].ver3.tex_x = texcoord_table[m+4];
-	    tri[j].ver3.tex_y = texcoord_table[m+5];	    
-	    */
+	    tri[j].ver3.tex_y = texcoord_table[m+5];	
+	    
 	}
 	
     }
 
     sg->c_xyz[0] = sg->c_xyz[1] = sg->c_xyz[2] = 0;
-    /*
+
     delete []vertex_table;
     delete []normal_table;
     delete []texcoord_table;
-    */
+
     /* got out of polylist */
     s->polylist = 0;
     return sg;
--- a/Renderer/Test/collada_file/sampleTexture.dae	Sun Feb 05 23:34:16 2012 +0900
+++ b/Renderer/Test/collada_file/sampleTexture.dae	Mon Feb 06 16:29:26 2012 +0900
@@ -5,44 +5,12 @@
       <author>Blender User</author>
       <authoring_tool>Blender 2.60.0 r41098M</authoring_tool>
     </contributor>
-    <created>2012-01-31T15:12:46</created>
-    <modified>2012-01-31T15:12:46</modified>
+    <created>2012-02-06T16:03:11</created>
+    <modified>2012-02-06T16:03:11</modified>
     <unit name="meter" meter="1"/>
     <up_axis>Z_UP</up_axis>
   </asset>
   <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>
-          <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">
@@ -77,58 +45,11 @@
     </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">
@@ -176,22 +97,6 @@
   </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>