Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/viewer.cpp @ 137:6cf991f28c6c
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
author | gongo@gendarme.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 28 Nov 2008 10:07:48 +0900 |
parents | 435e0d24db39 |
children | 3fd24be89d02 |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/viewer.cpp Thu Nov 27 16:20:11 2008 +0900 +++ b/TaskManager/Test/test_render/viewer.cpp Fri Nov 28 10:07:48 2008 +0900 @@ -1,6 +1,7 @@ #include "viewer.h" #include "viewer_types.h" -#include "polygon.h" +#include "SceneGraph.h" +#include "scene_graph_pack.h" #include "sys.h" #include "Func.h" #include "error.h" @@ -14,7 +15,7 @@ int this_time; int frames; -Polygon *polygon; +SceneGraph *scene_graph; /* Data Pack */ SceneGraphPack *sgpack; @@ -74,19 +75,22 @@ SDL_GL_SwapBuffers(); } +extern void node_init(void); + void Viewer::run_init(char *xml) { HTaskPtr task_next; - HTaskPtr task_sgp; HTaskPtr task_init_tex; start_time = get_ticks(); this_time = 0; frames = 0; - polygon = Polygon::createFromXMLfile(xml); - polygon->viewer = this; + scene_graph = SceneGraph::createFromXMLfile(xml); + //polygon->viewer = this; + + node_init(); sgpack = (SceneGraphPack*)manager->malloc(sizeof(SceneGraphPack)); sgpack->init(); @@ -114,21 +118,25 @@ task_next = manager->create_task(TASK_DUMMY); task_next->set_post(&post2runLoop, NULL); +#if 0 + // 諸事情で、今は SceneGraphPack を作らずに + // そのまま SceneGraph でやっています + HTaskPtr task_sgp; task_sgp = manager->create_task(TASK_CREATE_SGP); - task_sgp->add_inData(polygon, sizeof(Polygon)); - //task_sgp->add_outData(sgpack, sizeof(SceneGraphPack)); + task_sgp->add_param((uint32)scene_graph); task_sgp->add_param((uint32)sgpack); task_next->wait_for(task_sgp); task_sgp->spawn(); +#endif - int tex_width = polygon->texture_image->w; - int tex_height = polygon->texture_image->h; + int tex_width = scene_graph->texture_image->w; + int tex_height = scene_graph->texture_image->h; int tex_blocksize = tex_width*tex_height*4; __texture = (void*)manager->malloc(tex_blocksize); - memcpy(__texture, polygon->texture_image->pixels, tex_blocksize); + memcpy(__texture, scene_graph->texture_image->pixels, tex_blocksize); - uint32 *tex_src = (uint32*)polygon->texture_image->pixels; + uint32 *tex_src = (uint32*)scene_graph->texture_image->pixels; uint32 *tex_dest = (uint32*)manager->malloc(tex_blocksize); int tile_size = TEXTURE_SPLIT_PIXEL*TEXTURE_SPLIT_PIXEL; int tile_num = tex_width*tex_height/tile_size; @@ -170,7 +178,6 @@ void Viewer::run_loop(void) { - HTaskPtr task_update_sgp = NULL; HTaskPtr task_create_pp = NULL; HTaskPtr task_create_sp = NULL; HTaskPtr task_next; @@ -193,17 +200,28 @@ task_next = manager->create_task(TASK_DUMMY); task_next->set_post(post2runDraw, NULL); +#if 0 + HTaskPtr task_update_sgp = NULL; task_update_sgp = manager->create_task(TASK_UPDATE_SGP); task_update_sgp->add_inData(sgpack, sizeof(SceneGraphPack)); task_update_sgp->add_outData(sgpack, sizeof(SceneGraphPack)); task_update_sgp->add_param(width); task_update_sgp->add_param(height); task_next->wait_for(task_update_sgp); + task_update_sgp->spawn(); +#else + scene_graph->all_execute(); +#endif +#if 0 task_create_pp = manager->create_task(TASK_CREATE_PP); task_create_pp->add_inData(sgpack, sizeof(SceneGraphPack)); task_create_pp->add_param((uint32)ppack); - //task_create_pp->set_cpu(SPE_ANY); +#else + task_create_pp = manager->create_task(TASK_CREATE_PP2); + task_create_pp->add_param((uint32)scene_graph); + task_create_pp->add_param((uint32)ppack); +#endif task_next->wait_for(task_create_pp); int range_base = spe_num; @@ -242,7 +260,6 @@ task_create_sp->spawn(); } - task_update_sgp->spawn(); task_create_pp->spawn(); task_next->spawn(); } @@ -258,14 +275,13 @@ ppack->clear(); - unsigned int diff = 0; for (int i = 0; i < spackList_length; i++) { SpanPack *spack = &spackList[i]; int startx = 1; int endx = split_screen_w; int start_y = spack->info.y_top - split_screen_h + 1; - int end_y = spack->info.y_top; + //int end_y = spack->info.y_top; int rangey = (start_y + split_screen_h - 1 > this->height) ? this->height - start_y + 1 : split_screen_h; @@ -314,8 +330,8 @@ printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); } - polygon->delete_data(); - delete polygon; + scene_graph->delete_data(); + delete scene_graph; free(__texture); quit();