changeset 1329:e5894cf1d2ca draft

minor changes.
author e095732 <e095732@ie.u-ryukyu.ac.jp>
date Tue, 20 Dec 2011 20:11:54 +0900
parents 0f41ff4ca2ab
children 615555d5bfa0
files Renderer/Engine/SceneGraphRoot.cc
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Tue Dec 20 18:54:19 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Tue Dec 20 20:11:54 2011 +0900
@@ -311,7 +311,7 @@
     if (*a) return 0;
     return a[-1] > b[-1] ? 1:-1;
 }
-
+/*
 static float
 get_point(char *id, int position, LIST_P list)
 {
@@ -327,7 +327,7 @@
        }
     }
 }
-
+*/
 /**
  * co
  */
@@ -366,12 +366,13 @@
     char *texcoord_src;
     int texcoord_offset;
     int texcoord_count;
-
+  
     float *vcount;
     float *pcount;
-
+  
     SOURCE_P normal_float;
     SOURCE_P vertex_float;
+    SOURCE_P texcoord_float;
 
     char *vertices_src;
     int polylist_count;
@@ -425,7 +426,7 @@
 
             s->texcoord_src = (char*)xmlGetProp(cur, (xmlChar*)"source");
             s->texcoord_offset = atoi((char*)xmlGetProp(cur, (xmlChar*)"offset"));
-            s->texcoord_float = most_match(s->normal_src+1, list);
+            s->texcoord_float = most_match(s->texcoord_src+1, list);
        }
 
     } else if (!xmlStrcmp(cur->name, (xmlChar*)"vcount")) {
@@ -454,13 +455,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) ;
 
         /* p separate vertex position and nomal position. */
         for (int i = 0; i < s->polylist_count; i+=2) {
             vertexp[i] = s->pcount[i];
             normal_table[i] = s->normal_float->u.array[(int)s->pcount[i+1]];
-            if (texcoord_offset < 0) {
-                i++;
+            if (s->texcoord_offset == 2) {
+	        i++;
+	        texcoord_table[i] = s->texcoord_float->u.array[(int)s->pcount[i+1]];
             }
         }
 
@@ -476,7 +479,8 @@
                     vertex_table[i] = s->vertex_float->u.array[vertexp[i]];
             }
         }
-        for (int i=0; vertex_table; i++) {
+	/*TEST*/
+        for (int i=0; vertex_table==0; i++) {
             printf("normal_table= %f\n", normal_table[i]);
             printf("vertex_table= %f\n", vertex_table[i]);
         }