changeset 1335:8a5f7f54433d draft

minor change collada test file .
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Wed, 21 Dec 2011 13:47:40 +0900
parents 55de7223d9a0
children 3f95f61faef6
files Renderer/Engine/SceneGraphRoot.cc Renderer/Test/collada_test/collada_test.cc
diffstat 2 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Wed Dec 21 12:34:15 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Wed Dec 21 13:47:40 2011 +0900
@@ -478,10 +478,15 @@
 
         float *vertex_table = (float*)malloc(sizeof(float)*s->vertex_float->count) ;
         float *normal_table = (float*)malloc(sizeof(float)*s->normal_float->count) ;
-	    float *texcoord_table = (float*)malloc(sizeof(float)*s->texcoord_float->count) ;
+	float *texcoord_table = (float*)malloc(sizeof(float)*s->texcoord_float->count) ;
+	
+	int limit = vcsum * 2;
+	if (s->texcoord_offset == 2){
+	    limit = vcsum * 3;
+	}
 
         /* p separate vertex position and nomal position. */
-        for (int i = 0,j=0; i < s->polylist_count; i+=2,j++) {
+        for (int i = 0,j=0; i < limit; i+=2,j++) {
 	    vertexp[j] = s->pcount[i];
             normal_table[j] = s->normal_float->u.array[(int)s->pcount[i+1]];
             if (s->texcoord_offset == 2) {
@@ -507,7 +512,7 @@
 	    // printf("vertex_table= %f\n", vertex_table[i]);
         } 
 
-        free(vertex_table);
+	free(vertex_table);
         free(normal_table);
 	free(texcoord_table);
 
@@ -577,6 +582,7 @@
 	xml_walk(cur,&s, &list);
 
     }
+
     xmlFreeDoc(doc);
 }
 
--- a/Renderer/Test/collada_test/collada_test.cc	Wed Dec 21 12:34:15 2011 +0900
+++ b/Renderer/Test/collada_test/collada_test.cc	Wed Dec 21 13:47:40 2011 +0900
@@ -286,10 +286,15 @@
         
         float *vertex_table = (float*)malloc(sizeof(float)*s->vertex_float->count) ;
         float *normal_table = (float*)malloc(sizeof(float)*s->normal_float->count) ;
-	    float *texcoord_table = (float*)malloc(sizeof(float)*s->texcoord_float->count) ;
+	float *texcoord_table = (float*)malloc(sizeof(float)*s->texcoord_float->count) ;
+
+	int limit = vcsum * 2;
+	if (s->texcoord_offset  == 2){
+       	    limit = vcsum * 3;
+	}
 
         /* p separate vertex position and nomal position. */
-        for (int i=0, j=0; i < s->polylist_count; i+=2,j++) {
+        for (int i=0, j=0; i < limit; i+=2,j++) {
             vertexp[j] = (int)pcount[i];
             normal_table[j] = s->normal_float->u.array[(int)pcount[i+1]];
             if (s->texcoord_offset == 2) {