Mercurial > hg > Game > Cerium
changeset 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 | 3a04b2e24df1 |
files | Renderer/Engine/SceneGraph.cc Renderer/Engine/SceneGraphRoot.cc Renderer/Engine/xml.cc TaskManager/Makefile.def |
diffstat | 4 files changed, 52 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraph.cc Fri Dec 02 18:57:10 2011 +0900 +++ b/Renderer/Engine/SceneGraph.cc Sun Dec 04 18:50:53 2011 +0900 @@ -215,13 +215,19 @@ if (size % 3 != 0) { printf("vertex size is error. size %% 3 = %lld\n", size % 3); } + /* * MAX_SIZE_TRIANGLE:128 */ + if (size > 0) { - /* size/3 : 三角形の数? + + /* + * size/3 : 三角形の数 * MAX_SIZE_TRIANGLE : 128 + * polygon の数から、PolygonPackの数を決定する */ + pp_num = (size/3 + MAX_SIZE_TRIANGLE - 1) / MAX_SIZE_TRIANGLE; pp = (PolygonPack*)manager->allocate(sizeof(PolygonPack)*pp_num); } else {
--- 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
--- a/Renderer/Engine/xml.cc Fri Dec 02 18:57:10 2011 +0900 +++ b/Renderer/Engine/xml.cc Sun Dec 04 18:50:53 2011 +0900 @@ -58,6 +58,22 @@ { // ignore } + + else if (*cont == '\0') + { + // NULL end + + /* ここの条件は collada の仕様に合わせたもの。 + * 自前の blender script から吐き出される xml形式では、 + * 文字の終わりをNULLでは判断せず、エラー処理としていた + * ので必要ではなかった。よって、自前 blender script の + * xml形式の時、途中で NULL が来た場合、エラー処理され + * なくなる。NULL を返すので、呼び出し側で判断する + */ + + *index = sign * (val_int + val_dec) * exp; + return(NULL); + } else { fprintf(stderr,"Pick up float failed : %c(%d)\n",*cont,*cont);
--- a/TaskManager/Makefile.def Fri Dec 02 18:57:10 2011 +0900 +++ b/TaskManager/Makefile.def Sun Dec 04 18:50:53 2011 +0900 @@ -29,8 +29,8 @@ ABIBIT = 64 -# OPT = -g -O0 -DMAIL_QUEUE -DNOT_CHECK #-DTASK_LIST_MAIL #-DEARLY_TOUCH -DUSE_CACHE -OPT = -O9 -DMAIL_QUEUE -DNOT_CHECK #-DTASK_LIST_MAIL #-DEARLY_TOUCH -DUSE_CACHE +OPT = -g -O0 -DMAIL_QUEUE -DNOT_CHECK #-DTASK_LIST_MAIL #-DEARLY_TOUCH -DUSE_CACHE +#OPT = -O9 -DMAIL_QUEUE -DNOT_CHECK #-DTASK_LIST_MAIL #-DEARLY_TOUCH -DUSE_CACHE