# HG changeset patch # User Yutaka_Kinjyo # Date 1279568736 -32400 # Node ID 2683838396c6043d75728bf069a9307514172c69 # Parent 830bcfbde3bcc2715e94769940fd1f57f9015ca7 fix.. diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/Camera.cc --- a/Renderer/Engine/Camera.cc Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/Camera.cc Tue Jul 20 04:45:36 2010 +0900 @@ -148,10 +148,6 @@ #if SPE_CREATE_POLYGON - sg_matrix = (float*)malloc(sizeof(float)*32); - matrix = sg_matrix; - real_matrix = sg_matrix + 16; - #endif for(int i = 0; i < 16; i++) { diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/Makefile.def --- a/Renderer/Engine/Makefile.def Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/Makefile.def Tue Jul 20 04:45:36 2010 +0900 @@ -5,7 +5,7 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -OPT = -g -DSPE_CREATE_POLYGON_CHECK #-DSPE_CREATE_POLYGON=1 +OPT = -g -DSPE_CREATE_POLYGON_CHECK -DSPE_CREATE_POLYGON=1 CFLAGS = -g -Wall $(ABI) $(OPT) # -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/SceneGraph.cc --- a/Renderer/Engine/SceneGraph.cc Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/SceneGraph.cc Tue Jul 20 04:45:36 2010 +0900 @@ -101,14 +101,6 @@ init(); finalize = &SceneGraph::finalize_copy; -#if SPE_CREATE_POLYGON - - sg_matrix = (float*)malloc(sizeof(float)*32); - matrix = sg_matrix; - real_matrix = sg_matrix + 16; - -#endif - this->name = "NULLPO"; } @@ -243,11 +235,10 @@ #if SPE_CREATE_POLYGON - free(tri_pack); - free(sg_matrix); - //free(matrix); - //free(real_matrix); - free(texture_info); + free(coord_pack); + free(coord_xyz); + free(coord_tex); + free(normal); #else @@ -552,19 +543,6 @@ texture_id = tex_id; } - -#if SPE_CREATE_POLYGON - - - texture_info->t_w = list[texture_id].t_w; - texture_info->t_h = list[texture_id].t_h;; - texture_info->pixels_orig = list[texture_id].pixels_orig; - texture_info->pixels = list[texture_id].pixels; - texture_info->scale_max = list[texture_id].scale_max; - - -#else - // こんなことすると list[] のいみあるのかなーと // 微妙に思う、自分で書き換えた感想 by gongo texture_info.t_w = list[texture_id].t_w; @@ -572,8 +550,6 @@ texture_info.pixels_orig = list[texture_id].pixels_orig; texture_info.pixels = list[texture_id].pixels; texture_info.scale_max = list[texture_id].scale_max; - -#endif } diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/polygon.cc --- a/Renderer/Engine/polygon.cc Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/polygon.cc Tue Jul 20 04:45:36 2010 +0900 @@ -190,35 +190,6 @@ void Polygon::pickup_coordinate(char *cont) { -#if SPE_CREATE_POLYGON - - TrianglePackPtr cur = tri_pack; - - for(int n=0; nver1.x); - cont = pickup_float(cont, &cur->ver1.y); - cont = pickup_float(cont, &cur->ver1.z); - - cont = pickup_float(cont, &cur->ver2.x); - cont = pickup_float(cont, &cur->ver2.y); - cont = pickup_float(cont, &cur->ver2.z); - - cont = pickup_float(cont, &cur->ver3.x); - cont = pickup_float(cont, &cur->ver3.y); - cont = pickup_float(cont, &cur->ver3.z); - - cur = cur + 1; - - if (cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#else - char *tmp_cont = cont; int bound = 8; // coord_vertex size is 8byte. int offset = 0; @@ -269,42 +240,11 @@ #endif -#endif - } void Polygon::pickup_normal(char *cont) { -#if SPE_CREATE_POLYGON - - TrianglePackPtr cur = tri_pack; - - for(int n=0; nnormal1.x); - cont = pickup_float(cont, &cur->normal1.y); - cont = pickup_float(cont, &cur->normal1.z); - - cont = pickup_float(cont, &cur->normal2.x); - cont = pickup_float(cont, &cur->normal2.y); - cont = pickup_float(cont, &cur->normal2.z); - - cont = pickup_float(cont, &cur->normal3.x); - cont = pickup_float(cont, &cur->normal3.y); - cont = pickup_float(cont, &cur->normal3.z); - - cur = cur + 1; - - if (cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#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)) @@ -355,8 +295,6 @@ #endif -#endif - } void Polygon::pickup_model(char *cont) @@ -374,32 +312,6 @@ void Polygon::pickup_texture(char *cont) { -#if SPE_CREATE_POLYGON - - TrianglePackPtr cur = tri_pack; - - for(int n=0; nver1.tex_x); - cont = pickup_float(cont, &cur->ver1.tex_y); - - cont = pickup_float(cont, &cur->ver2.tex_x); - cont = pickup_float(cont, &cur->ver2.tex_y); - - cont = pickup_float(cont, &cur->ver3.tex_x); - cont = pickup_float(cont, &cur->ver3.tex_y); - - cur = cur + 1; - - if (cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#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)) @@ -446,8 +358,6 @@ #endif -#endif - } char *get_pixel(int tx, int ty, SDL_Surface *texture_image) diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/task/CreatePolygonFromSceneGraph.cc --- a/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Tue Jul 20 04:45:36 2010 +0900 @@ -15,7 +15,6 @@ #define PP_LOAD 12 #define PP_STORE 13 -#if !SPE_CREATE_POLYGON /** * ベクトルに行列を乗算する * @param[out] v vector (float[4]) @@ -49,7 +48,6 @@ v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8]; } } -#endif /** @@ -76,7 +74,6 @@ run(SchedTask *smanager, void *rbuf, void *wbuf) { -#if !SPE_CREATE_POLYGON float xyz1[4], xyz2[4], xyz3[4]; float normal1[4],normal2[4],normal3[4]; @@ -249,8 +246,6 @@ free(pp); free(send_pp); - -#endif return 0; } diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/viewer.cc --- a/Renderer/Engine/viewer.cc Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/viewer.cc Tue Jul 20 04:45:36 2010 +0900 @@ -441,42 +441,6 @@ frames++; } -#if SPE_CREATE_POLYGON - -void -Viewer::create_pp_task(SceneGraphPtr sg, PolygonPackPtr pp_cur, HTaskPtr create_pp_wait, - int &pp_index, int &sg_index, int tri_num) -{ - - HTaskPtr create_pp = manager->create_task(CreatePolygon); - create_pp->set_inData(0, &sg->tri_pack[sg_index], sizeof(TrianglePack)*tri_num); - create_pp->set_inData(1, sg->texture_info, sizeof(texture_list)); - create_pp->set_inData(2, sg->sg_matrix, sizeof(float)*32); //わーい、マジックナンバー - create_pp->set_outData(0, &pp_cur->tri[pp_index], sizeof(TrianglePack)*tri_num); - create_pp->set_param(0, (memaddr)tri_num); - //create_pp->set_cpu(SPE_ANY); - create_pp_wait->wait_for(create_pp); - create_pp->spawn(); - - pp_index += tri_num; - sg_index += tri_num; -} - -#endif - -struct MatrixList { - - float *matrix; - MatrixList *next; - -}; - -struct MatrixListInfo { - int id; - MatrixList *first; - MatrixList *last; - MatrixListInfo *next; -}; // 完全にMac仕様。。sg_matrix を allocate してやらないといけないよ。 void @@ -610,7 +574,7 @@ } void -check_matrix(MatrixListInfo *matrix_info,SceneGraphPtr sg) { +Viewer::check_matrix(MatrixListInfo *matrix_info,SceneGraphPtr sg) { for (MatrixListInfo* t = matrix_info; t != NULL; t = t->next) { for (MatrixList* u = t->first; u != NULL; u = u->next) { @@ -620,9 +584,8 @@ } -//HTaskPtr void -create_pp_task(SceneGraphPtr sg, TaskManager *manager, int spe_num, HTaskPtr task_next, +Viewer::create_pp_task(SceneGraphPtr sg, TaskManager *manager, int spe_num, HTaskPtr task_next, MatrixListInfo *matrix_info) { @@ -656,8 +619,6 @@ { #if SPE_CREATE_POLYGON - -#else SceneGraphPtr sg = sgroot->getDrawSceneGraph(); @@ -669,6 +630,8 @@ #endif + +#else HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); @@ -679,6 +642,8 @@ task_next->wait_for(task_create_pp); +#endif + int range_base = spe_num; // 切り上げのつもり @@ -720,8 +685,6 @@ task_create_pp->spawn(); -#endif - } HTaskPtr diff -r 830bcfbde3bc -r 2683838396c6 Renderer/Engine/viewer.h --- a/Renderer/Engine/viewer.h Tue Jul 20 04:05:07 2010 +0900 +++ b/Renderer/Engine/viewer.h Tue Jul 20 04:45:36 2010 +0900 @@ -10,6 +10,7 @@ #include "Application.h" #include "SceneGraphRoot.h" #include "ViewerDevice.h" +#include "matrix.h" class SceneGraphRoot; @@ -71,6 +72,10 @@ void common_draw(HTaskPtr task_next); void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); + void create_pp_task(SceneGraphPtr sg, TaskManager *manager, int spe_num, HTaskPtr task_next, + MatrixListInfo *matrix_info); + void check_matrix(MatrixListInfo *matrix_info,SceneGraphPtr sg); + void spe_rendering(HTaskPtr task_next); void spe_draw(HTaskPtr task_next); // void exchange_sgroot(TaskManager *manager);