Mercurial > hg > Game > Cerium
changeset 157:7bc603ec6111 draft
fix
author | gongo@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 04 Dec 2008 15:51:47 +0900 |
parents | 16c3cbbbfc50 |
children | 4d792df6ebf2 |
files | TaskManager/Test/test_render/Makefile.def TaskManager/Test/test_render/spe/Load_Texture.cpp TaskManager/Test/test_render/task/CreatePolygon.cpp TaskManager/Test/test_render/task/Load_Texture.cpp TaskManager/Test/test_render/universe.cpp TaskManager/Test/test_render/viewer.cpp |
diffstat | 6 files changed, 84 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/Makefile.def Thu Dec 04 14:25:00 2008 +0900 +++ b/TaskManager/Test/test_render/Makefile.def Thu Dec 04 15:51:47 2008 +0900 @@ -3,15 +3,15 @@ # include/library path # ex: macosx #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium -CERIUM = /Users/gongo/Source/hg/Cerium +#CERIUM = /Users/gongo/Source/hg/Cerium # ex: linux/ps3 -#CERIUM = /home/gongo/Cerium +CERIUM = /home/gongo/Cerium #CERIUM = ../../.. CC = g++ -CFLAGS = -O0 -g -Wall# -DDEBUG +CFLAGS = -O9 -g -Wall# -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. LIBS = -L$(CERIUM)/TaskManager \ No newline at end of file
--- a/TaskManager/Test/test_render/spe/Load_Texture.cpp Thu Dec 04 14:25:00 2008 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cpp Thu Dec 04 15:51:47 2008 +0900 @@ -4,29 +4,10 @@ #include "texture.h" #include "Func.h" -/** - * 決めうちじゃなくて、 - * create_task の時に param で渡せばおk - */ -#define height 128 -#define width 128 - -// byteperpixel = 3 width = 128 dma_height= 32 -#define LOAD_SIZE 3*128*32 -#define MAX_LOAD_SIZE 16384 -#define USE_ARRAY 3 - SchedDefineTask(LoadTexture); int LoadTexture::run(void *rbuf , void *wbuf) { - int addrNum = smanager->get_param(0); - int addrSize = addrNum*sizeof(void*); - void **list = (void**)global_alloc(TEXTURE2_ID, addrSize); - - void **addrList = (void**)smanager->get_input(0); - memcpy(list, addrList, addrSize); - return 0; }
--- a/TaskManager/Test/test_render/task/CreatePolygon.cpp Thu Dec 04 14:25:00 2008 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygon.cpp Thu Dec 04 15:51:47 2008 +0900 @@ -79,8 +79,9 @@ } else { next_node = NULL; } + + for (int n = 0, nt = 0; n < node->size*3; n+=9, nt+=6) { - for (int n = 0, nt = 0; n < node->size*3; n+=9, nt+=6) { if (pp->info.size >= MAX_SIZE_TRIANGLE) { PolygonPackPtr next; @@ -105,6 +106,7 @@ sizeof(PolygonPack), PP_LOAD); smanager->dma_wait(PP_LOAD); pp->init(); + } TrianglePack *triangle = &pp->tri[pp->info.size++]; @@ -121,7 +123,7 @@ xyz3[1] = node->vertex[n+6+1]; xyz3[2] = node->vertex[n+6+2]*-1; xyz3[3] = 1; - + rotate(xyz1, node->translation); rotate(xyz2, node->translation); rotate(xyz3, node->translation); @@ -144,9 +146,15 @@ triangle->ver3.tex_x = node->texture[nt+4]; triangle->ver3.tex_y = node->texture[nt+4+1]; +#if 1 triangle->tex_addr = node->tex_addr; triangle->tex_width = node->tex_width; triangle->tex_height = node->tex_height; +#else + triangle->tex_addr = node->texture_info.pixels; + triangle->tex_width = node->texture_info.t_w; + triangle->tex_height = node->texture_info.t_h; +#endif } smanager->dma_wait(SG_NODE_LOAD); @@ -177,4 +185,4 @@ free(free_sgp); return 0; -} +}
--- a/TaskManager/Test/test_render/task/Load_Texture.cpp Thu Dec 04 14:25:00 2008 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.cpp Thu Dec 04 15:51:47 2008 +0900 @@ -4,29 +4,10 @@ #include "texture.h" #include "Func.h" -/** - * 決めうちじゃなくて、 - * create_task の時に param で渡せばおk - */ -#define height 128 -#define width 128 - -// byteperpixel = 3 width = 128 dma_height= 32 -#define LOAD_SIZE 3*128*32 -#define MAX_LOAD_SIZE 16384 -#define USE_ARRAY 3 - SchedDefineTask(LoadTexture); int LoadTexture::run(void *rbuf , void *wbuf) { - int addrNum = smanager->get_param(0); - int addrSize = addrNum*sizeof(void*); - void **list = (void**)global_alloc(TEXTURE2_ID, addrSize); - - void **addrList = (void**)smanager->get_input(0); - memcpy(list, addrList, addrSize); - return 0; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/universe.cpp Thu Dec 04 15:51:47 2008 +0900 @@ -0,0 +1,66 @@ +#include <stdlib.h> +#include "SceneGraph.h" +#include "xml_file/universe.h" + +static void +cube_collision(SceneGraphPtr node, int screen_w, int screen_h, + SceneGraphPtr tree) +{ +} + +static void +cube_move2(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 1.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +static void +cube_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[1] += 1.0f; + if (node->angle[1] > 360.0f) { + node->angle[1] = 0.0f; + } + + node->xyz[0] += node->stack_xyz[0]; + if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { + node->stack_xyz[0] = -node->stack_xyz[0]; + } + + node->xyz[1] += node->stack_xyz[1]; + if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + node->stack_xyz[1] = -node->stack_xyz[1]; + } +} + +static void +moon_move(SceneGraphPtr node, int screen_w, int screen_h) +{ + node->angle[0] += 1.0f; + if (node->angle[0] > 360.0f) { + node->angle[0] = 0.0f; + } +} + +void +universe_init(void) +{ + SceneGraph::createFromXMLfile("xml_file/universe.xml"); + Earth->set_move_collision(cube_move, cube_collision); + Earth->stack_xyz[0] = 3.0f; + Earth->stack_xyz[1] = 3.0f; + Moon->set_move_collision(moon_move, cube_collision); +}
--- a/TaskManager/Test/test_render/viewer.cpp Thu Dec 04 14:25:00 2008 +0900 +++ b/TaskManager/Test/test_render/viewer.cpp Thu Dec 04 15:51:47 2008 +0900 @@ -111,7 +111,6 @@ Viewer::run_init(char *xml, int sg_number) { HTaskPtr task_next; - HTaskPtr task_init_tex; start_time = get_ticks(); this_time = 0; @@ -145,7 +144,6 @@ } scene_graph->controller = create_controller(); - sgpack = (SceneGraphPack*)manager->malloc(sizeof(SceneGraphPack)); sgpack->init(); @@ -191,44 +189,6 @@ __texture = (void*)manager->malloc(tex_blocksize); memcpy(__texture, scene_graph->texture_image->pixels, tex_blocksize); -#if 0 - 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; - tile_num = (tile_num + 15)&(~15); - void **tex_addrList = (void**)manager->malloc(sizeof(void*)*tile_num); - - { - int t = 0; - - for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL) { - for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL) { - for (int j = 0; j < TEXTURE_SPLIT_PIXEL; j++) { - for (int i = 0; i < TEXTURE_SPLIT_PIXEL; i++) { - tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)]; - } - } - } - } - - t = 0; - - for (int i = 0, t = 0; i < tex_width*tex_height; i += tile_size, t++) { - tex_addrList[t] = (void*)&tex_dest[i]; - } - } - - for (int i = 0; i < spe_num; i++) { - task_init_tex = manager->create_task(TASK_INIT_TEXTURE); - task_init_tex->add_inData(tex_addrList, sizeof(void*)*tile_num); - task_init_tex->add_param(tile_num); - task_init_tex->set_cpu(SPE_ANY); - task_next->wait_for(task_init_tex); - task_init_tex->spawn(); - } -#endif - task_next->spawn(); } @@ -258,6 +218,7 @@ task_next->set_post(post2runDraw, NULL); #if 0 + // SceneGraphPack の update HTaskPtr task_update_sgp = NULL; task_update_sgp = manager->create_task(TASK_UPDATE_SGP); task_update_sgp->add_inData(sgpack, sizeof(SceneGraphPack)); @@ -272,10 +233,12 @@ #endif #if 0 + // SceneGraphPack(配列) -> PolygonPack task_create_pp = manager->create_task(TASK_CREATE_PP); task_create_pp->add_inData(sgpack, sizeof(SceneGraphPack)); task_create_pp->add_param((uint32)ppack); #else + // SceneGraph(木構造) -> PolygonPack task_create_pp = manager->create_task(TASK_CREATE_PP2); task_create_pp->add_param((uint32)scene_graph_viewer); task_create_pp->add_param((uint32)ppack); @@ -339,12 +302,10 @@ 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; - //if (end_y != 128) continue; - while (startx < this->width) { if (spack->info.size > 0) { // Draw SpanPack