Mercurial > hg > Game > Cerium
changeset 1361:6dc0176a47d6 draft
minor changes.
author | e095732 <e095732@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Jan 2012 23:47:31 +0900 |
parents | e7a515fcd0fc |
children | 38ee695f772c |
files | Renderer/Engine/SceneGraphRoot.cc |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Thu Jan 19 22:10:47 2012 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Thu Jan 19 23:47:31 2012 +0900 @@ -366,6 +366,8 @@ polylist_count = 0; vcsum = 0; + limit = 0; + vmember = 0; } int polylist; @@ -398,6 +400,7 @@ char *tex_picname; int vcsum; int limit; + int vmember; }; static texture_list list[TABLE_SIZE]; @@ -467,6 +470,7 @@ char *pcont = (char*)xmlNodeGetContent(cur); for (int i = 0;i < s->polylist_count;i++){ s->vcsum += s->vcount[i]; + s->vmember = i; } s->limit = s->vcsum * 2; if (s->texcoord_offset == 2){ @@ -482,16 +486,20 @@ } SceneGraph* -decode_points(xmlNodePtr cur, collada_state *s, TaskManager *manager){ +decode_points(collada_state *s, TaskManager *manager){ int *vertexp; vertexp = new int[s->vcsum]; for (int i=0;i<s->vcsum;i++){ vertexp[i]=0; } + /* + * vertex_tableだけはpolygonを作る際にvcountが4の場合重複する点が + * 出てくるのでサイズを2倍用意しておく + */ float *vertex_table; float *normal_table; float *texcoord_table; - vertex_table = new float[s->vcsum]; + vertex_table = new float[(s->vcsum)*2]; normal_table = new float[s->vcsum]; texcoord_table = new float[s->vcsum]; for (int i=0;i < s->vcsum;i++){ @@ -520,7 +528,7 @@ /* make triangle */ int k=0,l=0; - for (int i=0;i<s->vcsum;i++) { + for (int i=0;i<s->vmember;i++) { if (s->vcount[i] == 4) { vertex_table[k++] = s->vertex_float->u.array[vertexp[l]]; vertex_table[k++] = s->vertex_float->u.array[vertexp[l+1]]; @@ -696,7 +704,7 @@ init_list(&list); xml_walk(cur,&s,&list,this); } - registSceneGraph(decode_points(cur,&s,manager)); + registSceneGraph(decode_points(&s,manager)); xmlFreeDoc(doc); }