changeset 1291:1486f2d17e4a draft

can read float_array in collada file.
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Thu, 01 Dec 2011 23:55:04 +0900
parents 48a65461ed84 (diff) b194cb2d44bb (current diff)
children 3fa46ff7824e
files
diffstat 1 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Tue Nov 29 18:02:07 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -1,4 +1,4 @@
-#include <SDL.h>
+
 #include <SDL_image.h>
 #include <libxml/parser.h>
 #include "SceneGraphRoot.h"
@@ -241,7 +241,7 @@
     xmlFreeDoc(doc);
 }
 
-static const char*
+/*static const char*
 get_property(const char *name, xmlNodePtr cur){
    xmlAttr *p=cur->properties; 
    if (p==0) return "";
@@ -255,20 +255,32 @@
        }
    }
    return "";
-}
+}*/
 
 static void 
 xml_walk( SceneGraphRoot* self, xmlNodePtr cur)
 {
-	printf("name = %s\n", cur->name);
-	if(xmlStrcmp(cur->name,(xmlChar*)"float_array") != 0){
-	    const char *id = get_property("id", cur);
-	    int count = atoi(get_property("count", cur));
-	    printf("id:%s count:%d\n", id, count);
+	 /*get float array.*/
+	printf("name = %s, child:%s\n", cur->name, cur->children);
+	if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
+
+	    char *cont =(char*)xmlNodeGetContent(cur);
+	    //const char *id = get_property("id", cur);
+
+	    char *id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+	    //int count = atoi(get_property("count", cur));
+
+	    int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
+	    
+	    printf("id:%s count:%d cont:%s\n", id, count, cont);
+
+	    if (cur->children == "(null)") {
+	        return;
+	    }
 	
 	}
 	for (cur=cur->children; cur; cur=cur->next){
-		xml_walk(self, cur);
+            xml_walk(self, cur);
 	}
 }	
 
@@ -277,8 +289,9 @@
 {
 	/*make parse dom*/
 	xmlDocPtr doc;
-	xmlNodePtr cur,cur_images,cur_effects,cur_geometries,cur_visual_scenes;
-	SceneGraphPtr tmp;
+	xmlNodePtr cur;
+	//,cur_images,cur_effects,cur_geometries,cur_visual_scenes;
+	//SceneGraphPtr tmp;
 
 	doc = xmlParseFile(xmlColladafile);
 	cur = xmlDocGetRootElement(doc);