Mercurial > hg > Game > Cerium
changeset 1359:842e04373d3a draft
collada reader minor update.
author | Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Jan 2012 21:22:22 +0900 |
parents | db8bba42ad80 |
children | e7a515fcd0fc |
files | Renderer/Engine/SceneGraphRoot.cc |
diffstat | 1 files changed, 20 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Thu Jan 19 21:18:11 2012 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Thu Jan 19 21:22:22 2012 +0900 @@ -401,7 +401,6 @@ }; static texture_list list[TABLE_SIZE]; -static texture_list *texture_info; void get_texpic(char *filename, SceneGraphPtr sg, xmlNodePtr cur, TaskManager *manager) { @@ -409,22 +408,19 @@ if (filename == NULL || filename[0] == 0) { return; } - /** * image_name を既に Load していれば何もしない */ int tex_id; /* ball test */ if (sgid_hash.sg_hash_regist(/*filename*/"Ball", tex_id) == -1) { - SDL_Surface *texture_image = sg->load_decode_image(filename, image_name, cur); if (texture_image==0) { printf("Can't load image %s\n",filename); exit(0); } - texture_info->texture_id = sg->makeTapestries(manager, texture_image, tex_id); - tex_id = texture_info->texture_id; - + sg->texture_info->texture_id = sg->makeTapestries(manager, texture_image, tex_id); + tex_id = sg->texture_info->texture_id; if (unlink(image_name)) { printf("unlink error\n"); } @@ -432,21 +428,18 @@ /** * 以前に Load されている Texture を共用 */ - texture_info->texture_id = tex_id; + sg->texture_info->texture_id = tex_id; } - - // こんなことすると list[] のいみあるのかなーと // 微妙に思う、自分で書き換えた感想 by gongo - texture_info->t_w = list[tex_id].t_w; - texture_info->t_h = list[tex_id].t_h;; - texture_info->pixels_orig = list[tex_id].pixels_orig; - texture_info->pixels = list[tex_id].pixels; - texture_info->scale_max = list[tex_id].scale_max; - texture_info->texture_image = list[tex_id].texture_image; - + sg->texture_info->t_w = list[tex_id].t_w; + sg->texture_info->t_h = list[tex_id].t_h;; + sg->texture_info->pixels_orig = list[tex_id].pixels_orig; + sg->texture_info->pixels = list[tex_id].pixels; + sg->texture_info->scale_max = list[tex_id].scale_max; + sg->texture_info->texture_image = list[tex_id].texture_image; } -void decode_float_array(xmlNodePtr cur,LIST_P list ){ +void decode_float_array(xmlNodePtr cur,LIST_P list){ SOURCE_P src = (SOURCE_P)malloc(sizeof(SOURCE)); char *id = (char*)xmlGetProp(cur, (xmlChar*)"id"); src->id = (char*)xmlGetProp(cur, (xmlChar*)"id"); @@ -525,16 +518,19 @@ } } + /* make triangle */ for (int i=0;i<s->vcsum;i++) { if (s->vcount[i] == 4) { - for (int j=0; j < s->vcount[i]; j++) { - vertex_table[i] = s->vertex_float->u.array[vertexp[i]]; - vertex_table[i+3] = s->vertex_float->u.array[vertexp[i+1]]; - i += 2; + for (int j=0; j < s->vcount[i]; j++) { + vertex_table[i] = s->vertex_float->u.array[vertexp[i]]; + vertex_table[i+3] = s->vertex_float->u.array[vertexp[i+1]]; + i += 2; + } + }else if (s->vcount[i]==3) { + for (int j=0; j < s->vcount[i]; j++) { + vertex_table[i] = s->vertex_float->u.array[vertexp[i]]; + } } - }else if (s->vcount[i]==3) { - vertex_table[i] = s->vertex_float->u.array[vertexp[i]]; - } } /** * (SceneGraph.cc)