diff Renderer/Engine/SceneGraphRoot.cc @ 1299:f0e805c09ed6 draft

minor fix xml_walk and pickup_float, not work yet.
author Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
date Sun, 04 Dec 2011 18:50:53 +0900
parents bb8b7f179f31
children ab9b7d21b32b
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Fri Dec 02 18:57:10 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Sun Dec 04 18:50:53 2011 +0900
@@ -276,6 +276,7 @@
    }
    return "";
 }*/
+
 typedef struct source {
     char *id;
     int count;
@@ -304,40 +305,45 @@
 xml_walk( SceneGraphRoot* self, xmlNodePtr cur, LIST_P list)
 {
 
-        /*get float array.*/
-	printf("name = %s, child:%s\n", cur->name, cur->children);
-	if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
+    /*get float array.*/
+    printf("name = %s, child:%s\n", (char *)cur->name, (char *)cur->children);
+    if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
 
         SOURCE_P src = (SOURCE_P)malloc(sizeof(SOURCE));
-
-	    char *id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+        
+        char *id = (char*)xmlGetProp(cur, (xmlChar*)"id");
         src->id = (char*)xmlGetProp(cur, (xmlChar*)"id");
-
-	    int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
+        
+        int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
         src->count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
         src->array = (float*)malloc(sizeof(float) * src->count);
+        
+        char *cont =(char*)xmlNodeGetContent(cur);
+        //const char *id = get_property("id", cur);
+        //int count = atoi(get_property("count", cur));
 
-	    char *cont =(char*)xmlNodeGetContent(cur);
-	    //const char *id = get_property("id", cur);
-	    //int count = atoi(get_property("count", cur));
         for (int i = 0; cont != NULL; i++) {
-            cont = pickup_float(cont, src->array+1);
+
+            //cont = pickup_float(cont, src->array+1);
+            // ここ+1じゃなくて、+iじゃない?
+            cont = pickup_float(cont, src->array+i);
         }
 
+
         src->next = NULL;
         addSource(list, src);
-	    printf("id:%s count:%d cont:%s\n", id, count, cont);
-
-	    if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
+        printf("id:%s count:%d cont:%s\n", id, count, cont);
+        
+        if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
             char *p = (char*)xmlNodeGetContent(cur);
             printf("p:%s", p);
-	    }
-	
-	}
-	for (cur=cur->children; cur; cur=cur->next){
-            xml_walk(self, cur, list);
-	}
-
+        }
+        
+    }
+    
+    for (cur=cur->children; cur; cur=cur->next){
+        xml_walk(self, cur, list);
+    }    
 }
 
 void