Mercurial > hg > Game > Cerium
changeset 1343:e4a65e0be060 draft
minor changes.
author | e095732 <e095732@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 13 Jan 2012 03:58:49 +0900 |
parents | a65b98e6e514 |
children | fbe51e90993a |
files | Renderer/Engine/SceneGraphRoot.cc Renderer/Test/collada.cc |
diffstat | 2 files changed, 22 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Thu Jan 12 14:08:42 2012 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Fri Jan 13 03:58:49 2012 +0900 @@ -392,6 +392,8 @@ char *vertices_src; int polylist_count; + + char *name; }; @@ -428,13 +430,13 @@ for (int i = 0;i < s->polylist_count;i++){ vcsum += s->vcount[i]; } - printf("----------vcsum-------------\n"); + //s->pcount = (float*)malloc(sizeof(float)*vcsum); s->pcount = new float[vcsum]; for (int i=0; pcont != NULL; i++) { pcont = pickup_float(pcont, s->pcount+i); } - printf("----------pcount-------------\n"); + int vertexp[vcsum]; for (int i=0;i<vcsum;i++){ vertexp[i]=0; @@ -442,15 +444,15 @@ //float *vertex_table; //float *normal_table; //float *texcoord_table; - printf("---------v--------------\n"); + float vertex_table[s->vertex_float->count]; //vertex_table = new float[s->vertex_float->count]; //float *vertex_table = (float*)malloc(sizeof(float)*s->vertex_float->count) ; - printf("---------n--------------\n"); + float normal_table[s->normal_float->count]; //normal_table = new float[s->normal_float->count]; //float *normal_table = (float*)malloc(sizeof(float)*s->normal_float->count); - printf("---------t--------------\n"); + float texcoord_table[s->texcoord_float->count]; //texcoord_table = new float[s->texcoord_float->count]; //float *texcoord_table = (float*)malloc(sizeof(float)*s->texcoord_float->count) ; @@ -459,7 +461,7 @@ if (s->texcoord_offset == 2){ limit = vcsum * 3; } - printf("---------separateq--------------\n"); + /* p separate vertex position and nomal position. */ for (int i=0,j=0; i < limit; i+=2,j++) { vertexp[j] = s->pcount[i]; @@ -469,7 +471,7 @@ i++; } } - printf("---------pcount--------------\n"); + for (int i=0;i<vcsum;i++) { if (s->vcount[i] == 4) { for (int j=0; j < s->vcount[i]; j++) { @@ -481,12 +483,15 @@ vertex_table[i] = s->vertex_float->u.array[vertexp[i]]; } } - printf("----------vcount-------------\n"); + /** + * (SceneGraph.cc) + * pickup_normal,pickup_coordinate,pickup_textureの処理に当たる + */ int count = vcsum / 3; SceneGraphPtr sg = new SceneGraph(manager); sg->pp_num = (count + MAX_SIZE_TRIANGLE - 1) / MAX_SIZE_TRIANGLE; sg->pp = (PolygonPack*)malloc(sizeof(PolygonPack)*sg->pp_num); - + for (int i = 0;i < sg->pp_num; i++ ){ PolygonPackPtr pp = sg->pp; TrianglePackPtr tri = pp[i].tri; @@ -548,14 +553,13 @@ //delete []vertex_table; //delete []normal_table; //delete []texcoord_table; - + /* got out of polylist */ s->polylist = 0; - printf("end decode"); } static void -xml_walk(xmlNodePtr cur, struct collada_state *s, LIST_P list, SceneGraphRoot *root) +xml_walk(xmlNodePtr cur, struct collada_state *s, LIST_P list,SceneGraphRoot *root) { int in_polylist=0; printf("name = %s, child:%s\n", (char *)cur->name, (char *)cur->children); @@ -599,6 +603,8 @@ in_polylist = 0; } else if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) { decode_float_array(cur,list); + } else if (!xmlStrcmp(cur->name, (xmlChar*)"node" )) { + s->name = (char*)xmlGetProp(cur, (xmlChar*)"id"); } for (cur=cur->children; cur; cur=cur->next){ xml_walk(cur,s,list,root); @@ -648,6 +654,9 @@ doc = xmlParseMemory(data, len); cur = xmlDocGetRootElement(doc); + /* ?? */ + xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D"); + /* XMLのノードを一つずつ解析 */ for (cur=cur->children; cur; cur=cur->next) { /* 扱うのはsurfaceオンリー */
--- a/Renderer/Test/collada.cc Thu Jan 12 14:08:42 2012 +0900 +++ b/Renderer/Test/collada.cc Fri Jan 13 03:58:49 2012 +0900 @@ -127,7 +127,7 @@ light->xyz[0] = screen_w / 2; light->xyz[1] = screen_h / 2; light->xyz[2] = -100; - + printf("createSceneGraph\n"); ball = sgroot->createSceneGraph(name); ball->set_move_collision(ball_move, ball_collision);