Mercurial > hg > Game > Cerium
changeset 1289:6fc9fd03a4fd draft
can read collada file of float_array.
author | Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 01 Dec 2011 23:40:58 +0900 |
parents | fe598e9b7f0e |
children | 48a65461ed84 |
files | Renderer/Engine/SceneGraphRoot.cc |
diffstat | 1 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Fri Nov 25 18:43:21 2011 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Thu Dec 01 23:40:58 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,28 @@ } } return ""; -} +}*/ static void xml_walk( SceneGraphRoot* self, xmlNodePtr cur) { + /*get float array.*/ 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); + 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); } for (cur=cur->children; cur; cur=cur->next){ - xml_walk(self, cur); + xml_walk(self, cur); } } @@ -277,8 +285,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);