Mercurial > hg > Game > Cerium
changeset 1322:2b4e3fc1c800 draft
Improve collada file reader.
author | e095732 <e095732@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 20 Dec 2011 11:24:09 +0900 |
parents | a6b11345939c |
children | 68373985b251 |
files | Renderer/Engine/SceneGraphRoot.cc |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Tue Dec 20 00:10:30 2011 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Tue Dec 20 11:24:09 2011 +0900 @@ -1,4 +1,3 @@ - #include <SDL_image.h> #include <libxml/parser.h> #include "SceneGraphRoot.h" @@ -383,7 +382,7 @@ int in_polylist=0; printf("name = %s, child:%s\n", (char *)cur->name, (char *)cur->children); - + printf("s->polylist = %d\n",s->polylist); if (!xmlStrcmp(cur->name, (xmlChar*)"polylist")) { @@ -396,7 +395,7 @@ s->pid = xmlGetProp(cur, (xmlChar*)"id"); - } else if (!xmlStrcmp(cur->name, (xmlChar*)"input")) { + } else if (!s->polylist && !xmlStrcmp(cur->name, (xmlChar*)"input")) { char *semantic = (char*)xmlGetProp(cur, (xmlChar*)"semantic"); if (!xmlStrcmp((xmlChar*)semantic, (xmlChar*)"POSITION")) { @@ -404,11 +403,10 @@ } } else if (s->polylist && !xmlStrcmp(cur->name, (xmlChar*)"input")) { - char *semantic = (char*)xmlGetProp(cur, (xmlChar*)"semantic"); + char *semantic = (char*)xmlGetProp(cur, (xmlChar*)"semantic"); if (!xmlStrcmp((xmlChar*)semantic, (xmlChar*)"VERTEX")) { - - s->vertex_src = (char*)xmlGetProp(cur, (xmlChar*)"source"); + s->vertex_src = (char*)xmlGetProp(cur, (xmlChar*)"source"); s->vertex_offset = atoi((char*)xmlGetProp(cur, (xmlChar*)"offset")); s->vertex_float = most_match(s->vertices_src, list); @@ -417,7 +415,6 @@ s->normal_src = (char*)xmlGetProp(cur, (xmlChar*)"source"); s->normal_offset = atoi((char*)xmlGetProp(cur, (xmlChar*)"offset")); - s->normal_float = most_match(s->normal_src, list); } @@ -445,8 +442,8 @@ int vertexp[s->vertex_count]; - float *vertex_table; - float *normal_table; + float *vertex_table = (float*)malloc(sizeof(float)*s->vertex_float->count) ; + float *normal_table = (float*)malloc(sizeof(float)*s->normal_float->count) ; /* p separate vertex position and nomal position. */ for (int i = 0; i < s->polylist_count; i++) {