Mercurial > hg > Members > kono > Cerium
changeset 906:348b48db317e
coord_pack is stuffed with infomation of create polygon at spe.
author | Yutaka_Kinjyo |
---|---|
date | Mon, 19 Jul 2010 23:40:53 +0900 |
parents | e622f27c2808 |
children | 62838c1cd4b0 |
files | Renderer/Engine/Makefile.def Renderer/Engine/SceneGraph.cc Renderer/Engine/polygon.cc Renderer/Engine/polygon.h |
diffstat | 4 files changed, 132 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def Sat Jul 17 15:09:48 2010 +0900 +++ b/Renderer/Engine/Makefile.def Mon Jul 19 23:40:53 2010 +0900 @@ -5,7 +5,7 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -OPT = -g -O9 # -DSPE_CREATE_POLYGON=1 +OPT = -g -O9 -DSPE_CREATE_POLYGON_CHECK #-DSPE_CREATE_POLYGON=1 CFLAGS = -g -Wall $(ABI) $(OPT) # -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I.
--- a/Renderer/Engine/SceneGraph.cc Sat Jul 17 15:09:48 2010 +0900 +++ b/Renderer/Engine/SceneGraph.cc Mon Jul 19 23:40:53 2010 +0900 @@ -151,33 +151,22 @@ //data = new float[size*3*3]; #if SPE_CREATE_POLYGON - - /* CreatePolygon を spe 側でやるために。 - size は頂点の数。speに渡す場合には、16の倍数にして - 16Kbyte以上の場合、16Kbyte毎に分割できるようにしなければならない。 - CreatePolygonFromSceneGraphTaskをspeで動かすために、speに渡すのは - TrianglePackでよい。 - polygon_pack 1つには triangle が 128 になってる。polygon_pack の - triangle 数に合わせる方が楽だよね。なんか変な気もするけど、polygon - クラスにもTrianglePackを持たす。SceneGraph は自分の polygon 数が入る - 分だけ、TrianglePackを持つ。CreatePolygonTask にはSceneGraph 側の - TrianglePack を input に、polygon_pack の TriganlePack を output とする - */ - - int tri_pack_size = sizeof(TrianglePack)*(size/3); - printf("tri_pack_size %d\n", tri_pack_size); - tri_pack = (TrianglePackPtr)manager->allocate(tri_pack_size); - texture_info = (texture_list*)manager->allocate(sizeof(texture_list)); - sg_matrix = (float*)manager->allocate(sizeof(float)*32); - matrix = sg_matrix; - real_matrix = sg_matrix + 16; - + + coord_pack_size = sizeof(float)*8*size*3; + coord_pack = (flaat*)manager->allocate(coord_pack_size); + #else coord_xyz = (float*)manager->allocate(sizeof(float)*size*3); coord_tex = (float*)manager->allocate(sizeof(float)*size*3); normal = (float*)manager->allocate(sizeof(float)*size*3); + coord_pack_size = sizeof(float)*8*size*3; // coord_pack_vertex size is 32byte. vertex num 3. + coord_pack = (float*)manager->allocate(coord_pack_size); + + int sg_matrix_size = 32; // matrix 16 + real_matrix 32. + sg_matrix = (float*)manager->allocate(sg_matrix_size); + #endif get_data(manager, surface->children);
--- a/Renderer/Engine/polygon.cc Sat Jul 17 15:09:48 2010 +0900 +++ b/Renderer/Engine/polygon.cc Mon Jul 19 23:40:53 2010 +0900 @@ -219,18 +219,56 @@ #else + char *tmp_cont = cont; + int bound = 8; // coord_vertex size is 8byte. + int offset = 0; + for(int n=0; n<size*3; n+=3) { - cont = pickup_float(cont, coord_xyz+n); - cont = pickup_float(cont, coord_xyz+n+1); - cont = pickup_float(cont, coord_xyz+n+2); + tmp_cont = pickup_float(tmp_cont, coord_xyz+n); + tmp_cont = pickup_float(tmp_cont, coord_xyz+n+1); + tmp_cont = pickup_float(tmp_cont, coord_xyz+n+2); - if (cont == NULL) + if (tmp_cont == NULL) { cout << "Analyzing obj data failed coordinate\n"; } } + tmp_cont = cont; + + for(int n=0; n<size; n++) + { + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+2); + + if (tmp_cont == NULL) + { + cout << "Analyzing obj data failed coordinate\n"; + } + } + +#if SPE_CREATE_POLYGON_CHECK + + for (int i = 0; i < size; i++) { + + if (*(coord_xyz+i*3) != *(coord_pack+i*bound+offset)) { + printf("hoge\n"); + } + + if (*(coord_xyz+i*3+1) != *(coord_pack+i*bound+offset+1)) { + printf("hoge\n"); + } + + if (*(coord_xyz+i*3+2) != *(coord_pack+i*bound+offset+2)) { + printf("hoge\n"); + } + + } + +#endif + #endif } @@ -267,19 +305,56 @@ #else + char *tmp_cont = cont; + int bound = 8; // coord_pack size is 8byte. + int offset = 5; // coord_pack (xyz(3) + tex_x,tex_y(2) + n_xyz(3)) for (int n = 0; n<size*3; n += 3) { - cont = pickup_float(cont, normal+n); - cont = pickup_float(cont, normal+n+1); - cont = pickup_float(cont, normal+n+2); + tmp_cont = pickup_float(tmp_cont, normal+n); + tmp_cont = pickup_float(tmp_cont, normal+n+1); + tmp_cont = pickup_float(tmp_cont, normal+n+2); - if (cont == NULL) + if (tmp_cont == NULL) { cout << "Analyzing obj data failed normal\n"; } } + tmp_cont = cont; + + for(int n=0; n<size; n++) + { + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+2); + + if (tmp_cont == NULL) + { + cout << "Analyzing obj data failed coordinate\n"; + } + } + +#if SPE_CREATE_POLYGON_CHECK + + for (int i = 0; i < size; i++) { + + if (*(normal+i*3) != *(coord_pack+i*bound+offset)) { + printf("hoge\n"); + } + + if (*(normal+i*3+1) != *(coord_pack+i*bound+offset+1)) { + printf("hoge\n"); + } + + if (*(normal+i*3+2) != *(coord_pack+i*bound+offset+2)) { + printf("hoge\n"); + } + + } + +#endif + #endif } @@ -325,18 +400,52 @@ #else + char *tmp_cont = cont; + int bound = 8; // coord_pack size is 8byte. + int offset = 3; // coord_pack (xyz(3) + tex_x,tex_y(2) + n_xyz(3)) + for (int n = 0; n < size*3; n += 3) { - cont = pickup_float(cont, coord_tex+n); - cont = pickup_float(cont, coord_tex+n+1); + tmp_cont = pickup_float(tmp_cont, coord_tex+n); + tmp_cont = pickup_float(tmp_cont, coord_tex+n+1); coord_tex[n+2] = 1.0; - if (cont == NULL) + if (tmp_cont == NULL) { cout << "Analyzing obj data failed texture\n"; } } + tmp_cont = cont; + + for(int n=0; n<size; n++) + { + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); + tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); + + if (tmp_cont == NULL) + { + cout << "Analyzing obj data failed coordinate\n"; + } + } + +#if SPE_CREATE_POLYGON_CHECK + + for (int i = 0; i < size; i++) { + + if (*(coord_tex+i*3) != *(coord_pack+i*bound+offset)) { + printf("hoge\n"); + } + + if (*(coord_tex+i*3+1) != *(coord_pack+i*bound+offset+1)) { + printf("hoge\n"); + } + + + } + +#endif + #endif }