changeset 1337:8b60616fca45 draft

minor change
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Sun, 08 Jan 2012 21:48:02 +0900
parents 3f95f61faef6
children 8c098a144c75
files Renderer/Engine/SceneGraphRoot.cc
diffstat 1 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Wed Dec 21 17:43:20 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Sun Jan 08 21:48:02 2012 +0900
@@ -407,7 +407,7 @@
         
         int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
         src->count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
-        src->u.array = (float*)malloc(sizeof(float) * src->count);
+        src->u.array = (float*)malloc(sizeof(float)*src->count);
         
         char *cont =(char*)xmlNodeGetContent(cur);
         //const char *id = get_property("id", cur);
@@ -431,26 +431,30 @@
 	for (int i = 0;i < s->polylist_count;i++){
 	    vcsum += s->vcount[i];
 	}
-        s->pcount = (float*)malloc(sizeof(float)*vcsum); 
+        s->pcount = (float*)malloc(sizeof(float)*vcsum);	
         for (int i=0; pcont != NULL; i++) {
             pcont = pickup_float(pcont, s->pcount+i);
         } 
-        int vertexp[vcsum]; 
-	for (int i = 0;i < vcsum;i++){
+        int vertexp[vcsum];
+	for (int i=0;i<vcsum;i++){
 	    vertexp[i]=0;
 	}
-
-        float *vertex_table = (float*)malloc(sizeof(float)*s->vertex_float->count) ;
+	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 *vertex_table = new float[s->vertex_float->count];
+	//float *normal_table = new float[s->normal_float->count];
+	//float *texcoord_table = new 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 < limit; 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) {
@@ -528,10 +532,13 @@
             printf("vertexp = %d\n", vertexp[i]);
 	    // printf("vertex_table= %f\n", vertex_table[i]);
         } 
-
-	free(vertex_table);
-        free(normal_table);
-	free(texcoord_table);
+	free(vertexp);
+	//free(vertex_table);
+        //free(normal_table);
+	//free(texcoord_table);
+	//delete vertex_table;
+	//delete normal_table;
+	//delete texcoord_table;
 
         /* got out of polylist */
         s->polylist = 0;