# HG changeset patch # User hiroki # Date 1264410079 -32400 # Node ID b7376415fa5f588152928abda012f4fa84aa83af # Parent fd3492a767c75c9c8b9e7c7d0aa9bd2e236bb3a0 TaskManager changeset 683, Renderer changeset 746 diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/Application.h --- a/Renderer/Engine/Application.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/Application.h Mon Jan 25 18:01:19 2010 +0900 @@ -4,13 +4,11 @@ #include "SceneGraph.h" #include "MainLoop.h" #include "viewer.h" -#include "SgChange.h" typedef void (*Move_func)(SceneGraph* node, int screen_w, int screen_h); typedef void (*Coll_func)(SceneGraph* node, int screen_w, int screen_h, SceneGraphPtr tree); class Viewer; -class SgChange; class Application { public: @@ -18,7 +16,6 @@ virtual ~Application(); virtual MainLoopPtr init(Viewer *viewer, int w, int h) = 0; - virtual MainLoopPtr init_only_sg(SgChange *sgchange, int w, int h) = 0; }; #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/Camera.cc --- a/Renderer/Engine/Camera.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/Camera.cc Mon Jan 25 18:01:19 2010 +0900 @@ -3,7 +3,6 @@ #include "Camera.h" #include "sys.h" #include "Scheduler.h" -#include "show_time.h" #include "TaskManager.h" //static SceneGraphRoot *sgroot; @@ -146,6 +145,15 @@ m_screen = new float[16]; this->set_move_collision(camera_move, camera_collision, (void *)sgroot); + + for(int i = 0; i < 16; i++) { + real_matrix[i] = 0; + if (i % 5 == 0) { + real_matrix[i] = 1; + } + } + + } Camera::~Camera(void) diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/ChangeLog --- a/Renderer/Engine/ChangeLog Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/ChangeLog Mon Jan 25 18:01:19 2010 +0900 @@ -1,28 +1,40 @@ +2009-12-19 Shinji Kono + + SgChange/viewer は大域変数使いすぎ。禁止って言ったのに。 + linda api は、federated linda 対応でないものが使われている。 + 対応したものは、どこにあるんだろう? + + 他の例題いじるのは、自分の例題を動かしてからにして欲しい。 + + まぁねぇ。Pipeline execution するのに、sgpack とかも Pipeline buffer + にするのは気づかないものなんだろうな... なくても、動かないことは + ないのか。 + + viewer.cc の大域変数を落すところから始めるべきか? + 2009-11-15 Shinji Kono - DrawSpan は, - Start DrawSpan region (allocate Z buffer) - DrawSpan / for each SpanPack - add_inData - End DrawSpan region (Write frame buffer,free Z buffer) - add_outData - みたいにしたい. + DrawSpan は, + Start DrawSpan region (allocate Z buffer) + DrawSpan / for each SpanPack + add_inData + End DrawSpan region (Write frame buffer,free Z buffer) + add_outData + みたいにしたい. - CreateSpan は,SpanPack を入れ換えているようだが, - SpanPack は,ランダムに書きだし, - PPU 側で,それをsortする. - と言う方がよい? ほぼ毎回入れ換えているんじゃないの? + CreateSpan は,SpanPack を入れ換えているようだが, + SpanPack は,ランダムに書きだし, + PPU 側で,それをsortする. + と言う方がよい? ほぼ毎回入れ換えているんじゃないの? 2009-11-14 Shinji Kono -DrawSpan の dma_write を追放。なんでこんなになっていたかは謎。 - -これで、renew Task を落とせます。 + DrawSpan の dma_write を追放。なんでこんなになっていたかは謎。 + これで、renew Task を落とせます。 2009-08-06 Shinji Kono -DrawSpan の reboot/ TASK_DRAW_SPAN2 は、使ってないのね。 - + DrawSpan の reboot/ TASK_DRAW_SPAN2 は、使ってないのね。 2009-03-29 Wataru MIYAGUNI diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/Light.cc --- a/Renderer/Engine/Light.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/Light.cc Mon Jan 25 18:01:19 2010 +0900 @@ -3,7 +3,6 @@ #include "Light.h" #include "sys.h" #include "Scheduler.h" -#include "show_time.h" #include "TaskManager.h" static void diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/Makefile.def --- a/Renderer/Engine/Makefile.def Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/Makefile.def Mon Jan 25 18:01:19 2010 +0900 @@ -5,7 +5,8 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -CFLAGS = -g -Wall $(ABI) # -O9 -DDEBUG +OPT = -g #-O2 +CFLAGS = -g -Wall $(ABI) $(OPT) # -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. # LIBS = -L$(CERIUM)/TaskManager -m$(ABIBIT) diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/RenderingGlobal.h --- a/Renderer/Engine/RenderingGlobal.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/RenderingGlobal.h Mon Jan 25 18:01:19 2010 +0900 @@ -1,1 +1,1 @@ - DATA_ID, + Light, diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/RenderingTasks.h --- a/Renderer/Engine/RenderingTasks.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/RenderingTasks.h Mon Jan 25 18:01:19 2010 +0900 @@ -2,6 +2,9 @@ SDL_INIT, FINISH, + DataLoad, + DataUpdate, + Create_SGP, Update_SGP, CreatePolygon, diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SceneGraph.cc --- a/Renderer/Engine/SceneGraph.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SceneGraph.cc Mon Jan 25 18:01:19 2010 +0900 @@ -95,7 +95,7 @@ * 何の情報も持ってない SceneGraph の生成 * 今のところ、とりあえず木構造の繋がりに使うぐらい */ -SceneGraph::SceneGraph(void) +SceneGraph::SceneGraph() { init(); finalize = &SceneGraph::finalize_copy; @@ -150,7 +150,7 @@ } void -SceneGraph::init(void) +SceneGraph::init() { next = NULL; prev = NULL; @@ -186,7 +186,7 @@ frame = 0; } -SceneGraph::~SceneGraph(void) +SceneGraph::~SceneGraph() { (this->*finalize)(); } @@ -196,7 +196,7 @@ * polygon data を削除 */ void -SceneGraph::finalize_original(void) +SceneGraph::finalize_original() { //delete [] data; free(coord_xyz); @@ -209,7 +209,7 @@ * polygon data は削除しない。オリジナルの方で削除する。 */ void -SceneGraph::finalize_copy(void) +SceneGraph::finalize_copy() { } @@ -281,7 +281,7 @@ } void -SceneGraph::tree_check(void) +SceneGraph::tree_check() { SceneGraphPtr t = this; @@ -323,7 +323,7 @@ void -SceneGraph::print_member(void) +SceneGraph::print_member() { cout << "size = " << size << endl; cout << "name = " << name << endl; @@ -506,7 +506,7 @@ void -SceneGraph::delete_data(void) +SceneGraph::delete_data() { SceneGraphPtr n = this->next, m; @@ -535,53 +535,6 @@ (*collision)(this, this->sgroot, w, h, tree); } -void -SceneGraph::all_execute(int screen_w, int screen_h) -{ - SceneGraphPtr top = this; - SceneGraphPtr t = top; - - while (t) { - t->move_execute(screen_w, screen_h); - t->collision_check(screen_w, screen_h, top); - - t->frame++; - - if (t->parent != NULL) { - get_matrix(t->matrix, t->angle, t->xyz, t->parent->matrix); - } else { - get_matrix(t->matrix, t->angle, t->xyz, NULL); - } - - if (t->children != NULL) { - t = t->children; - } else if (t->brother != NULL) { - t = t->brother; - } else { - while (t) { - if (t->brother != NULL) { - t = t->brother; - break; - } else { - if (t->parent == NULL) { - t = NULL; - break; - } else { - t = t->parent; - } - } - } - } - } -} - -void -SceneGraph::set_move_collision(SceneGraphPtr node, move_func new_move, - collision_func new_collision) -{ - node->move = new_move; - node->collision = new_collision; -} void SceneGraph::set_move_collision(move_func new_move, @@ -621,7 +574,7 @@ * @return clone SceneGraph */ SceneGraphPtr -SceneGraph::clone(void) { +SceneGraph::clone() { SceneGraphPtr p = new SceneGraph(this); return p; } @@ -640,7 +593,7 @@ } void -SceneGraph::remove(void) +SceneGraph::remove() { this->flag_remove = 1; } @@ -724,7 +677,7 @@ } int -SceneGraph::isRemoved(void) +SceneGraph::isRemoved() { return flag_remove; } @@ -776,3 +729,5 @@ { this->xyz[2] = z; } + +/* end */ diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SceneGraph.h --- a/Renderer/Engine/SceneGraph.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SceneGraph.h Mon Jan 25 18:01:19 2010 +0900 @@ -82,8 +82,6 @@ SceneGraphPtr clone(void); SceneGraphPtr clone(void *buf); SceneGraphPtr searchSceneGraph(const char *name); - void set_move_collision(SceneGraphPtr node, - move_func new_move, collision_func new_collision); void set_move_collision(move_func new_move, collision_func new_collision); void set_move_collision(move_func new_move, collision_func new_collision, void *sgroot); void remove(void); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SceneGraphRoot.cc --- a/Renderer/Engine/SceneGraphRoot.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Mon Jan 25 18:01:19 2010 +0900 @@ -25,7 +25,7 @@ sg_src = (SceneGraphPtr*) malloc(sizeof(SceneGraphPtr)*SGLIST_LENGTH); camera = new Camera(w, h, this); - light = new Light(w, h); + light = new SceneGraph; iterator = new SceneGraphIterator; controller = create_controller(); @@ -36,6 +36,14 @@ sgroot = this; + //int size = 4; + //light_vector = (float*)malloc(sizeof(float)*size); + + light->xyz[0] = 0; + light->xyz[1] = 0; + light->xyz[2] = 0; + + // TODO // 今はとりあえず camera を Root にしています // 今はそれすらもしてません @@ -405,6 +413,18 @@ list = list->next; } + get_matrix(light->matrix, light->angle, light->xyz, camera->matrix); + + light_vector[0] = 0.0f; + light_vector[1] = 0.0f; + light_vector[2] = 0.0f; + light_vector[3] = 1.0f; + + ApplyMatrix(light_vector, light->matrix); + + light_vector[0] /= light_vector[2]; + light_vector[1] /= light_vector[2]; + if(sg_exec_tree != NULL) { return; } @@ -419,6 +439,8 @@ c->frame = t->frame; /*親の回転、座標から、子の回転、座標を算出*/ get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix); + /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ + get_matrix(c->real_matrix, c->angle, c->xyz, cur_parent->real_matrix); } if (t->children != NULL && c != NULL) { @@ -538,10 +560,18 @@ return camera; } -LightPtr + +SceneGraphPtr SceneGraphRoot::getLight() { return light; } + + +float* +SceneGraphRoot::getLightVector() +{ + return light_vector; +} diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SceneGraphRoot.h --- a/Renderer/Engine/SceneGraphRoot.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SceneGraphRoot.h Mon Jan 25 18:01:19 2010 +0900 @@ -4,7 +4,6 @@ #include "SceneGraph.h" #include "SceneGraphArray.h" #include "Camera.h" -#include "Light.h" #include "SceneGraphIterator.h" #include @@ -53,13 +52,15 @@ Camera *camera; // 光源のオブジェクト - Light *light; + SceneGraphPtr light; + // 光源の疑似 xml file + float light_vector[4]; // SceneGraphIterator SceneGraphIteratorPtr iterator; - // fd of Linda taple space - int tid; + // fd of Linda taple space + int tid; /** * Functions @@ -77,7 +78,8 @@ SceneGraphIteratorPtr getIterator(); SceneGraphIteratorPtr getIterator(SceneGraphPtr list); CameraPtr getCamera(); - LightPtr getLight(); + SceneGraphPtr getLight(); + float* getLightVector(); /* Other System API */ void allExecute(int screen_w, int screen_h); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SgChange.cc --- a/Renderer/Engine/SgChange.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SgChange.cc Mon Jan 25 18:01:19 2010 +0900 @@ -12,111 +12,61 @@ #include "Pad.h" #include "Application.h" #include "lindaapi.h" +#include "global_alloc.h" -static void post2runLoop(SchedTask *s,void *viewer,void *s1); +static void post2runLoop(SchedTask *s, void *viewer, void *s1); +static void post2runDraw(SchedTask *s, void *viewer, void *s1); +static void post2runMove(SchedTask *s, void *viewer, void *s1); +static void post2rendering(SchedTask *s, void *viewer, void *s1); /* measure for FPS (Frame Per Second) */ -int start_time; -int this_time; -int frames; +extern int start_time; +extern int this_time; +extern int frames; /* Data Pack sent to Other CPUs (ex. SPE) */ -SceneGraphPack *sgpack; -PolygonPack *ppack; -SpanPackPtr spackList; -SpanPackPtr *spackList_ptr; +extern SceneGraphPack *sgpack; +extern PolygonPack *ppack; +extern SpanPackPtr spackList; +extern SpanPackPtr *spackList_ptr; -int spackList_length; -int spackList_length_align; - -/** - * - */ +extern int spackList_length; +extern int spackList_length_align; -SgChange::SgChange(int b, int w, int h, int _num) -{ - bpp = b; - width = w; - height = h; - spe_num = _num; -} - -int -SgChange::get_ticks(void) -{ - int time; - time = SDL_GetTicks(); - return time; +void +SgChange::run_init() +{ + int width = viewer->width; + int height = viewer->height; + sgroot_A = new SceneGraphRoot(width, height); + sgroot_A->tmanager = viewer->manager; + sgroot_B = new SceneGraphRoot(width, height); + sgroot_B->tmanager = viewer->manager; } -bool -SgChange::quit_check(void) -{ - SDL_Event event; - - while(SDL_PollEvent(&event)) { - if (event.type==SDL_QUIT) { - return true; - } - } - - Uint8 *keys=SDL_GetKeyState(NULL); - - if (keys[SDLK_q] == SDL_PRESSED) { - return true; - } - - return false; -} - -void -SgChange::quit(void) +HTaskPtr +SgChange::initLoop() { - SDL_Quit(); -} - -void -SgChange::swap_buffers(void) -{ - SDL_GL_SwapBuffers(); -} - - -void -SgChange::run_init(TaskManager *manager, Application *app) -{ - this->manager = manager; - - start_time = get_ticks(); - this_time = 0; - frames = 0; - - // ココ! - sgroot_A = new SceneGraphRoot(this->width, this->height); - sgroot_A->tmanager = manager; - sgroot_B = new SceneGraphRoot(this->width, this->height); - sgroot_B->tmanager = manager; - - MainLoop *mainloop = app->init_only_sg(this, this->width, this->height); - - mainloop->mainLoop(); + return viewer->initLoop(); } void SgChange::mainLoop() { - HTaskPtr task_next = manager->create_task(Dummy); - + HTaskPtr task_next = initLoop(); + task_next->set_post(&post2runLoop, (void *)this, 0); // set_post(function(this->run_loop()), NULL) task_next->spawn(); } + + static void -post2runLoop(SchedTask *s, void *viewer_, void *arg) +post2runLoop(SchedTask *s, void *sgchange_, void *arg) { - SgChange *viewer = (SgChange*)viewer_; - HTaskPtr task_next = viewer->manager->create_task(Dummy); - viewer->run_loop(task_next); + SgChange *sgchange = (SgChange*)sgchange_; + HTaskPtr task_next = sgchange->manager->create_task(Dummy); + sgchange->run_loop(task_next); psx_sync_n(); } @@ -133,34 +83,100 @@ void SgChange::run_loop(HTaskPtr task_next) { + viewer->dev->clear_screen(); + bool quit_flg; - quit_flg = quit_check(); + quit_flg = viewer->quit_check(); if (quit_flg == true) { - this_time = get_ticks(); - run_finish(); + this_time = viewer->get_ticks(); + viewer->run_finish(); return; } - sgroot_A->allExecute(width, height); - exchange_sgroot(); + viewer->dev->clean_pixels(); + + for (int i = 1; i <= spackList_length; i++) { + spackList[i-1].reinit(i*split_screen_h); + } + + //exchange_sgroot(); + + sgroot_A->updateControllerState(); + sgroot_A->allExecute(viewer->width, viewer->height); + viewer->light_xyz_stock = sgroot_A->getLightVector(); + + HTaskPtr loop_task = manager->create_task(Dummy); + loop_task->set_post(post2runLoop, (void *)this, 0); + + HTaskPtr draw_task = manager->create_task(Dummy); + draw_task->set_post(post2rendering, (void *)this, 0); + + HTaskPtr move_task = manager->create_task(Dummy); + move_task->set_post(post2runMove, (void *)this, 0); + + HTaskPtr dummy_task = manager->create_task(Dummy); + + draw_finish = dummy_task; + loop_task->wait_for(draw_finish); + loop_task->wait_for(move_task); - //printf("Sgroot = %x\n", sgroot_A); + move_task->spawn(); + draw_task->spawn(); + loop_task->spawn(); +} + +static void +post2runMove(SchedTask *s, void *viewer_, void *arg) +{ + SgChange *viewer = (SgChange *)viewer_; + HTaskPtr task_next = viewer->manager->create_task(Dummy); + viewer->run_move(task_next); +} - task_next->set_post(&post2runLoop, (void *)this, 0); +void +SgChange::run_move(HTaskPtr task_next) +{ + sgroot_A->updateControllerState(); + sgroot_A->allExecute(viewer->width, viewer->height); +} + +static void +post2rendering(SchedTask *s, void *sgchange_, void *arg) +{ + SgChange *sgchange = (SgChange *)sgchange_; + HTaskPtr task_next = sgchange->manager->create_task(Dummy); + sgchange->rendering(task_next); + +} + +void +SgChange::rendering(HTaskPtr task_next) +{ + viewer->common_rendering(task_next, sgroot_A); + + task_next->set_post(post2runDraw, (void*)this, 0); task_next->spawn(); } -void -SgChange::run_finish(void) +static void +post2runDraw(SchedTask *s, void *sgchange_, void *arg) { - if (this_time != start_time) { - printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); - } + SgChange *sgchange = (SgChange *)sgchange_; + HTaskPtr task_next = sgchange->manager->create_task(Dummy); + sgchange->run_draw(task_next); +} - delete sgroot_A; - delete sgroot_B; - quit(); +void +SgChange::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする +{ + viewer->common_draw(task_next); + + this->draw_finish->wait_for(task_next); + task_next->spawn(); + this->draw_finish->spawn(); + + frames++; } /* end */ diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SgChange.h --- a/Renderer/Engine/SgChange.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/SgChange.h Mon Jan 25 18:01:19 2010 +0900 @@ -9,51 +9,38 @@ #include "MainLoop.h" #include "Application.h" #include "SceneGraphRoot.h" +#include "viewer.h" class SceneGraphRoot; - class Application; class SgChange : public MainLoop { public: - SgChange(int bpp, int width, int height, int spenum); + Viewer *viewer; + TaskManager *manager; + + SgChange(Viewer *v) { + viewer = v; + manager = v->manager; + } virtual ~SgChange() {} - Application *app; - - TaskManager *manager; - key_stat *keyPtr; - HTaskPtr draw_dummy; SceneGraphRoot *sgroot_A; SceneGraphRoot *sgroot_B; - /* screen info */ - int width; - int height; - int bpp; - - int spe_num; - - int rgb_size[3]; - Uint32 video_flags; - Uint32 *pixels; + HTaskPtr draw_finish; - void init(); - - int get_ticks(); - bool quit_check(); - void quit(); + void run_init(); + void run_loop(HTaskPtr task_next); + void run_move(HTaskPtr task_next); + void run_draw(HTaskPtr task_next); + void rendering(HTaskPtr task_next); + HTaskPtr initLoop(); - virtual void swap_buffers(); - virtual void clean_pixels() {} - - virtual void run_init(TaskManager *manager, Application *app); - virtual void run_loop(HTaskPtr task_next); - virtual void run_finish(); virtual void exchange_sgroot(); void mainLoop(); @@ -91,16 +78,7 @@ { return sgroot_A->getLast(); } - - - - -private: - HTaskPtr initLoop(); }; -#define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK - - #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/SgMain.cc --- a/Renderer/Engine/SgMain.cc Sun Dec 06 10:23:19 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -#include "TaskManager.h" -#include "SgChange.h" -#include "Application.h" - -/* prototype */ -extern void task_initialize(); -extern Application *application(); -extern int sg_init(TaskManager *manager, int argc, char *argv[]); - -int -sg_init(TaskManager *manager, int argc, char *argv[]) -{ - int bpp = 32; - int width = 640; - int height = 480; - int spenum = 1; - - for(int i = 1; argv[i]; ++i) - { - if (strcmp(argv[i], "-bpp") == 0) { - bpp = atoi(argv[++i]); - } - if (strcmp(argv[i], "-width") == 0) { - width = atoi(argv[++i]); - } - if (strcmp(argv[i], "-height") == 0) { - height = atoi(argv[++i]); - } - if (strcmp(argv[i], "-cpu") == 0) { - spenum = atoi(argv[++i]); - } - } - - SgChange *screen = new SgChange(bpp, width, height, spenum); - screen->run_init(manager, application()); - - return 0; -} - -#if 0 - -// These are defined in Application - -int -TMmain(TaskManager *manager, int argc, char *argv[]) -{ - task_initialize(); - manager->set_TMend(TMend); - return init(manager, argc, argv); - -} - -void -TMend(TaskManager *manager) -{ - printf("test_nogl end\n"); -} - -#endif - -/* end */ diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/global_alloc.h --- a/Renderer/Engine/global_alloc.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/global_alloc.h Mon Jan 25 18:01:19 2010 +0900 @@ -8,10 +8,11 @@ */ enum global_allocate_id { - TEXTURE_ID, GLOBAL_TEXTURE_HASH, GLOBAL_TILE_LIST, KEY_STATUS, + LOAD_ID, + }; #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/main.cc --- a/Renderer/Engine/main.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/main.cc Mon Jan 25 18:01:19 2010 +0900 @@ -63,17 +63,18 @@ Viewer *screen; if (vtype == VTYPE_SDL) { - screen = new ViewerSDL(manager, bpp, width, height, spenum); + ViewerDevice *dev = new ViewerSDL(manager); + screen = new Viewer(manager, dev, bpp, width, height, spenum); } else if (vtype == VTYPE_FB) { - screen = new ViewerFB(manager, bpp, width, height, spenum); + ViewerDevice *dev = new ViewerFB(manager); + screen = new Viewer(manager, dev, bpp, width, height, spenum); }else{ - screen = new ViewerSDL(manager, bpp, width, height, spenum); + ViewerDevice *dev = new ViewerSDL(manager); + screen = new Viewer(manager, dev, bpp, width, height, spenum); } - - screen->video_init(manager); + screen->run_init(manager, application()); - return 0; } diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/polygon.h --- a/Renderer/Engine/polygon.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/polygon.h Mon Jan 25 18:01:19 2010 +0900 @@ -21,6 +21,7 @@ float angle[4]; // angle float c_xyz[4]; // center of rotation float matrix[16]; + float real_matrix[16]; float *anim; int texture_id; //texture id number struct texture_list texture_info; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/spe/ChainInit.cc --- a/Renderer/Engine/spe/ChainInit.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/spe/ChainInit.cc Mon Jan 25 18:01:19 2010 +0900 @@ -21,12 +21,13 @@ static int run(SchedTask *s,void *rbuf, void *wbuf) { + /* CHAIN_VARS* idata = (CHAIN_VARS*)s->get_input(rbuf, 0); uint32 chain_len = (unsigned long)s->get_param(0); // property は spe 上で allocate している(global) CHAIN_VARS *property = (CHAIN_VARS*)s->global_alloc(DATA_ID, sizeof(CHAIN_VARS)*chain_len); memcpy(property, idata, sizeof(CHAIN_VARS)*chain_len); - + */ return 0; } diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/spe/DrawSpan.cc --- a/Renderer/Engine/spe/DrawSpan.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/spe/DrawSpan.cc Mon Jan 25 18:01:19 2010 +0900 @@ -39,9 +39,10 @@ // static TilePtr isAvailableTile(memaddr addr); static memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); static int getTexBlock(int tx, int ty, int twidth); -static void updateBuffer(Gptr g, float zpos, int rangex, int x, int y, - int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, TilePtr tile); +static void updateBuffer(Gptr g, float zpos, int rangex, int loaclx, int localy, + int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, + TilePtr tile, int world_x, int world_y, float world_z,SchedTask *smanager); // static void reboot(SpanPackPtr spack, int cur_span_x); @@ -49,7 +50,10 @@ //static void drawDot2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); static int drawLine1(SchedTask *smanager, Gptr g, SpanPtr span, int startx, int endx, int wait_tag); // static void drawLine2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); -static int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z); + +static int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z, + SchedTask *smanager,int x, int y, float z, int world_x, int world_y, float world_z); + static float innerProduct1(float *v0, float *v1) @@ -179,8 +183,9 @@ * @param tex_addr テクスチャのアドレス(MainMemory) */ static void -updateBuffer(Gptr g, float zpos, int rangex, int x, int y, int tex_x, int tex_y, - float normal_x, float normal_y, float normal_z, TilePtr tile) +updateBuffer(Gptr g, float zpos, int rangex, int localx, int localy, int tex_x, int tex_y, + float normal_x, float normal_y, float normal_z, TilePtr tile, + int world_x, int world_y, float world_z, SchedTask *smanager) { int color = get_rgb(tex_x, tex_y, tile); @@ -193,12 +198,16 @@ /*完全に透けているか判断*/ int flag = (alpha != 0); - color = infinity_light_calc(color,normal_x,normal_y,normal_z); + color = infinity_light_calc(color,normal_x,normal_y,normal_z, + smanager,localx,localy,zpos, + world_x,world_y,world_z); - g->zRow[x + (rangex*y)] = zpos*flag + g->zRow[x + (rangex*y)]*(1-flag); - int *point = &g->linebuf[y][x] ; + g->zRow[localx + (rangex*localy)] = zpos*flag + g->zRow[localx + (rangex*localy)]*(1-flag); + int *point = &g->linebuf[localy][localx] ; *point = color*flag + *point *(1-flag); + + } /** @@ -258,7 +267,8 @@ updateBuffer(g, zpos, rangex, localx, localy, tex_localx, tex_localy, - normal_x,normal_y,normal_z,tile); + normal_x,normal_y,normal_z,tile, + span->x, span->y, zpos, smanager); } return -1; @@ -319,6 +329,10 @@ float zpos1 = span->start_z; float zpos2 = span->end_z; + //spanを右から左に見ていくうちに、zが下がるのか、上がっていくのか。 + float z_inclination = (zpos1 - zpos2) / x_len; + float world_z = zpos2; + // Tile 内での座標 int localx, localy = getLocalY(span->y-1); @@ -328,6 +342,8 @@ for (int j = je; j >= js; j--) { float tex_x, tex_y, tex_z; + world_z += z_inclination; + localx = getLocalX(x-1+j); tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); @@ -357,7 +373,8 @@ updateBuffer(g, tex_z, rangex, localx, localy, tex_localx, tex_localy, - normal_x, normal_y, normal_z, tile); + normal_x, normal_y, normal_z, tile, + span->x+j, span->y, world_z, smanager); } } @@ -365,7 +382,10 @@ } static int -infinity_light_calc(int color,float normal_x, float normal_y, float normal_z) +infinity_light_calc(int color,float normal_x, float normal_y, + float normal_z, SchedTask *smanager, int x, int y, float z, + int world_x, int world_y, float world_z) + { unsigned char rgb[4]; int light_rgb; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/spe/Makefile --- a/Renderer/Engine/spe/Makefile Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/spe/Makefile Mon Jan 25 18:01:19 2010 +0900 @@ -10,7 +10,7 @@ OBJS = $(SRCS:.cc=.o) CC = spu-g++ -CFLAGS = -O9 -Wall -g -fno-exceptions -fno-rtti #-DDEBUG +CFLAGS = -Wall -fno-exceptions -fno-rtti $(OPT)#-DDEBUG INCLUDE = -I$(TOP)/include/TaskManager -I. -I.. LIBS = -L$(TOP)/TaskManager -lspemanager @@ -22,7 +22,7 @@ all: $(TARGET) $(TARGET): $(OBJS) - $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + $(CC) $(OPT) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) clean: rm -f $(TARGET) $(OBJS) diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/spe/spe-main.cc --- a/Renderer/Engine/spe/spe-main.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/spe/spe-main.cc Mon Jan 25 18:01:19 2010 +0900 @@ -1,8 +1,10 @@ #include "../Func.h" #include "SchedTask.h" +SchedExternTask(DataLoad); +SchedExternTask(DataUpdate); + SchedExternTask(LoadTexture); -SchedExternTask(SetTexture); SchedExternTask(DrawSpan); SchedExternTask(DrawSpanEnd); SchedExternTask(DrawSpanRenew); @@ -22,8 +24,11 @@ void task_init(Scheduler *s) { + + SchedRegister( DataLoad); + SchedRegister( DataUpdate); + SchedRegister( LoadTexture); - SchedRegister( SetTexture); SchedRegister( DrawSpan); SchedRegister( ChainCal); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/sys.cc --- a/Renderer/Engine/sys.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/sys.cc Mon Jan 25 18:01:19 2010 +0900 @@ -241,3 +241,24 @@ xyz[1] += y; xyz[2] += z; } + +/** + * ベクトルに行列を乗算する + * @param[out] v vector (float[4]) + * @param[in] m matrix (float[16]) + */ +void +ApplyMatrix(float *v, float *m) +{ + float t[4]; + + t[0] = v[0]; + t[1] = v[1]; + t[2] = v[2]; + t[3] = v[3]; + + for (int i = 0; i < 4; i++) { + v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8] + t[3]*m[i+12]; + } +} + diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/sys.h --- a/Renderer/Engine/sys.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/sys.h Mon Jan 25 18:01:19 2010 +0900 @@ -20,5 +20,6 @@ void transposeMatrix(float *m0, float *m1); void unitMatrix(float *m); void transMatrix(float *m0, float *m1, float *v); +void ApplyMatrix(float *v1, float *v2); #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/task/CreatePolygonFromSceneGraph.cc --- a/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Mon Jan 25 18:01:19 2010 +0900 @@ -74,12 +74,6 @@ run(SchedTask *smanager, void *rbuf, void *wbuf) { float xyz1[4], xyz2[4], xyz3[4]; - /* - *頂点毎に法線ベクトルがある - *面毎じゃない - *なにかに使うのかな?わからないから、一応とっておく。 - *by yutaka - */ float normal1[4],normal2[4],normal3[4]; SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0); @@ -171,7 +165,6 @@ triangle->ver3.tex_x = sg->coord_tex[(i+2)*3]; triangle->ver3.tex_y = sg->coord_tex[(i+2)*3+1]; - normal1[0] = sg->normal[(i+0)*3]; normal1[1] = sg->normal[(i+0)*3+1]; normal1[2] = sg->normal[(i+0)*3+2]*-1.0f; @@ -187,7 +180,18 @@ normal3[2] = sg->normal[(i+2)*3+2]*-1.0f; normal3[3] = 1.0f; - ApplyNormalMatrix(normal1,sg->matrix); + ApplyNormalMatrix(normal1,sg->real_matrix); + ApplyNormalMatrix(normal2,sg->real_matrix); + ApplyNormalMatrix(normal3,sg->real_matrix); + + normal1[0] /= normal1[2]; + normal1[1] /= normal1[2]; + + normal2[0] /= normal2[2]; + normal2[1] /= normal2[2]; + + normal3[0] /= normal3[2]; + normal3[1] /= normal3[2]; //ここでpolygonに法線ベクトルの情報がわたった @@ -203,8 +207,6 @@ triangle->normal3.y = normal3[1]; triangle->normal3.z = normal3[2]; - - triangle->tex_info.addr = sg->texture_info.pixels; triangle->tex_info.width = sg->texture_info.t_w; triangle->tex_info.height = sg->texture_info.t_h; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/task/CreateSpan.cc --- a/Renderer/Engine/task/CreateSpan.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/task/CreateSpan.cc Mon Jan 25 18:01:19 2010 +0900 @@ -421,7 +421,7 @@ static int run(SchedTask *smanager, void *rbuf, void *wbuf) { - PolygonPack *pp = (PolygonPack*)smanager->get_input(0); + PolygonPack *pp = (PolygonPack*)smanager->get_input(rbuf, 0); PolygonPack *next_pp = (PolygonPack*)smanager->allocate(sizeof(PolygonPack)); PolygonPack *free_pp = next_pp; @@ -432,8 +432,8 @@ VertexPackPtr vMid10 = (VertexPackPtr)smanager->allocate(sizeof(VertexPack)); NormalPackPtr normal1,normal2, normal3; - SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(1); - spack = (SpanPackPtr)smanager->get_input(2); + SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(rbuf, 1); + spack = (SpanPackPtr)smanager->get_input(rbuf, 2); send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); prev_index = (long)smanager->get_param(0); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/task/DrawSpan.cc --- a/Renderer/Engine/task/DrawSpan.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/task/DrawSpan.cc Mon Jan 25 18:01:19 2010 +0900 @@ -39,9 +39,10 @@ // static TilePtr isAvailableTile(memaddr addr); static memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); static int getTexBlock(int tx, int ty, int twidth); -static void updateBuffer(Gptr g, float zpos, int rangex, int x, int y, - int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, TilePtr tile); +static void updateBuffer(Gptr g, float zpos, int rangex, int loaclx, int localy, + int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, + TilePtr tile, int world_x, int world_y, float world_z,SchedTask *smanager); // static void reboot(SpanPackPtr spack, int cur_span_x); @@ -49,7 +50,10 @@ //static void drawDot2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); static int drawLine1(SchedTask *smanager, Gptr g, SpanPtr span, int startx, int endx, int wait_tag); // static void drawLine2(SchedTask *smanager, SpanPtr span, int startx, int endx, int js, int wait_tag); -static int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z); + +static int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z, + SchedTask *smanager,int x, int y, float z, int world_x, int world_y, float world_z); + static float innerProduct1(float *v0, float *v1) @@ -179,8 +183,9 @@ * @param tex_addr テクスチャのアドレス(MainMemory) */ static void -updateBuffer(Gptr g, float zpos, int rangex, int x, int y, int tex_x, int tex_y, - float normal_x, float normal_y, float normal_z, TilePtr tile) +updateBuffer(Gptr g, float zpos, int rangex, int localx, int localy, int tex_x, int tex_y, + float normal_x, float normal_y, float normal_z, TilePtr tile, + int world_x, int world_y, float world_z, SchedTask *smanager) { int color = get_rgb(tex_x, tex_y, tile); @@ -193,12 +198,16 @@ /*完全に透けているか判断*/ int flag = (alpha != 0); - color = infinity_light_calc(color,normal_x,normal_y,normal_z); + color = infinity_light_calc(color,normal_x,normal_y,normal_z, + smanager,localx,localy,zpos, + world_x,world_y,world_z); - g->zRow[x + (rangex*y)] = zpos*flag + g->zRow[x + (rangex*y)]*(1-flag); - int *point = &g->linebuf[y][x] ; + g->zRow[localx + (rangex*localy)] = zpos*flag + g->zRow[localx + (rangex*localy)]*(1-flag); + int *point = &g->linebuf[localy][localx] ; *point = color*flag + *point *(1-flag); + + } /** @@ -258,7 +267,8 @@ updateBuffer(g, zpos, rangex, localx, localy, tex_localx, tex_localy, - normal_x,normal_y,normal_z,tile); + normal_x,normal_y,normal_z,tile, + span->x, span->y, zpos, smanager); } return -1; @@ -319,6 +329,10 @@ float zpos1 = span->start_z; float zpos2 = span->end_z; + //spanを右から左に見ていくうちに、zが下がるのか、上がっていくのか。 + float z_inclination = (zpos1 - zpos2) / x_len; + float world_z = zpos2; + // Tile 内での座標 int localx, localy = getLocalY(span->y-1); @@ -328,6 +342,8 @@ for (int j = je; j >= js; j--) { float tex_x, tex_y, tex_z; + world_z += z_inclination; + localx = getLocalX(x-1+j); tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); @@ -357,7 +373,8 @@ updateBuffer(g, tex_z, rangex, localx, localy, tex_localx, tex_localy, - normal_x, normal_y, normal_z, tile); + normal_x, normal_y, normal_z, tile, + span->x+j, span->y, world_z, smanager); } } @@ -365,7 +382,10 @@ } static int -infinity_light_calc(int color,float normal_x, float normal_y, float normal_z) +infinity_light_calc(int color,float normal_x, float normal_y, + float normal_z, SchedTask *smanager, int x, int y, float z, + int world_x, int world_y, float world_z) + { unsigned char rgb[4]; int light_rgb; @@ -423,8 +443,8 @@ Span nop_span; nop_span.length_x = 1; - // uint32 display = smanager->get_param(0); - // int screen_width = smanager->get_param(1); + // uint32 display = (long)smanager->get_param(0); + // int screen_width = (long)smanager->get_param(1); int rangex_start = (long)smanager->get_param(2); int rangex_end = (long)smanager->get_param(3); @@ -456,11 +476,9 @@ } SpanPtr resume_span = &nop_span; - int resume_span_x = 0; for (int t = 0; t < spack->info.size; t++) { SpanPtr next_span; - int next_span_x; span = &spack->span[t]; @@ -476,7 +494,6 @@ next_span = span; resume_span = next_span; - resume_span_x = next_span_x; tl_tag_flg1 ^= 1; tl_tag_flg2 ^= 1; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/task/task_init.cc --- a/Renderer/Engine/task/task_init.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/task/task_init.cc Mon Jan 25 18:01:19 2010 +0900 @@ -1,6 +1,9 @@ #include "../Func.h" #include "Scheduler.h" +SchedExternTask(DataLoad); +SchedExternTask(DataUpdate); + SchedExternTask(Create_SGP); SchedExternTask(Update_SGP); SchedExternTask(CreatePolygonFromSceneGraph); @@ -11,7 +14,6 @@ SchedExternTask(DrawBack); SchedExternTask(LoadTexture); -SchedExternTask(SetTexture); SchedExternTask(Move); SchedExternTask(Draw); @@ -34,6 +36,9 @@ void task_initialize() { + SchedRegister( DataLoad); + SchedRegister( DataUpdate); + SchedRegister( Create_SGP); SchedRegister( Update_SGP); SchedRegister(CreatePolygonFromSceneGraph); @@ -43,7 +48,6 @@ SchedRegister( DrawBack); SchedRegister( LoadTexture); - SchedRegister( SetTexture); SchedRegister( Move); SchedRegister( Draw); @@ -53,7 +57,7 @@ SchedRegister( UpdateKey); SchedRegister( InitKey); - SchedRegister( ShowTime); + //SchedRegister( ShowTime); SchedRegister( Switch); // usr diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewer.cc --- a/Renderer/Engine/viewer.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewer.cc Mon Jan 25 18:01:19 2010 +0900 @@ -12,6 +12,7 @@ #include "Pad.h" #include "Application.h" #include "lindaapi.h" +#include "global_alloc.h" static void post2runLoop(SchedTask *s,void *viewer,void *s1); static void post2runDraw(SchedTask *s,void *viewer,void *s1); @@ -43,12 +44,16 @@ * */ -Viewer::Viewer(int b, int w, int h, int _num) +Viewer::Viewer(TaskManager *m, ViewerDevice *vd, int b, int w, int h, int _num) { bpp = b; width = w; height = h; spe_num = _num; + manager = m; + dev = vd; + pixels = dev->video_init(manager, b, w, h); + } int @@ -85,12 +90,6 @@ SDL_Quit(); } -void -Viewer::swap_buffers(void) -{ - SDL_GL_SwapBuffers(); -} - void Viewer::run_init(TaskManager *manager, Application *app) @@ -101,8 +100,33 @@ this_time = 0; frames = 0; + if (spe_num == 0) spe_num = 1; + sgroot = new SceneGraphRoot(this->width, this->height); sgroot->tmanager = manager; + + int size = sizeof(float)*4; + + light_xyz = (float *)manager->allocate(size); + light_xyz[0] = 0.0f; + light_xyz[1] = 0.0f; + light_xyz[2] = 0.0f; + light_xyz[3] = 0.0f; + + HTaskPtr data_load; + data_load = manager->create_task(DataLoad); + data_load->set_param(0,(memaddr)size); + data_load->set_param(1,(memaddr)Light); + data_load->set_cpu((CPU_TYPE)((int)SPE_0)); + data_load->spawn(); + + for(int i = 1; i < spe_num; i++) { + data_load = manager->create_task(DataLoad); + data_load->set_param(0,(memaddr)size); + data_load->set_param(1,(memaddr)Light); + data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i)); + data_load->spawn(); + } MainLoop *mainloop = app->init(this, this->width, this->height); @@ -151,40 +175,14 @@ // ここは、Iterator を用意するべきだよね for (int i = 0; i < spe_num; i++) { task_tex = manager->create_task(LoadTexture); - task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); - task_next->wait_for(task_tex); - task_tex->spawn(); + task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); + task_next->wait_for(task_tex); + task_tex->spawn(); } return task_next; } -/* Loop って言っても1回しか実行されない */ -void -Viewer::speLoop() -{ - HTaskPtr task_next = initLoop(); - // key の情報を格納する領域を確保する (global_alloc(KEY_STATUS)) - HTaskPtr init_key_task = manager->create_task(InitKey); - init_key_task->set_cpu(SPE_0); - init_key_task->spawn(); - - // SPE に送信する KEY_STATUS の領域確保 - key_stat *key = (key_stat*)manager->allocate(sizeof(key_stat)); - this->keyPtr = key; - - // post2runLoop は旧バージョン用なので post2speRunLoop の様なものを別につくるべき - //task_next->set_post(post2speRunLoop, (void*)this); // set_post(function(this->run_loop()), NULL) - //task_next->spawn(); - // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ - - /* test */ - - HTaskPtr task_switch = manager->create_task(Switch); - task_switch->wait_for(task_next); - task_switch->set_post(post2runMoveDrawLoop, (void*)this, 0); - task_switch->spawn(); -} void Viewer::getKey() @@ -243,7 +241,7 @@ viewer->getKey(); HTaskPtr update_key = viewer->manager->create_task(UpdateKey); update_key->add_inData(viewer->keyPtr, sizeof(key_stat)); - update_key->set_cpu(SPE_0); + //update_key->set_cpu(SPE_0); update_key->spawn(); /* TASK_MOVE は外から引数で取ってくるべき */ @@ -272,16 +270,6 @@ } -#if 0 -static void -post2speRunLoop(void *viewer_) -{ - Viewer *viewer = (Viewer *)viewer_; - HTaskPtr task_next = viewer->manager->create_task(Dummy); - viewer->run_move(task_next); -} -#endif - void Viewer::mainLoop() { @@ -291,23 +279,35 @@ task_next->spawn(); } -#if 0 void -post2runMove(void *viewer_) +Viewer::run_loop(HTaskPtr task_next) { - Viewer *viewer = (Viewer*)viewer_; - HTaskPtr task_next = viewer->manager->create_task(Dummy); - viewer->run_move(task_next); + dev->clear_screen(); + + bool quit_flg; + quit_flg = quit_check(); + if (quit_flg == true) { + this_time = get_ticks(); + run_finish(); + return; + } + + dev->clean_pixels(); + + for (int i = 1; i <= spackList_length; i++) { + spackList[i-1].reinit(i*split_screen_h); + } + + sgroot->updateControllerState(); + sgroot->allExecute(width, height); + light_xyz_stock = sgroot->getLightVector(); + //sgroot->checkRemove(); + + // ここから下は Rendering という関数にする + rendering(task_next); } -#endif -void -Viewer::run_move(HTaskPtr task_next) -{ - sgroot->updateControllerState(); - sgroot->allExecute(width, height); -} void Viewer::run_collision() @@ -325,7 +325,7 @@ void Viewer::rendering(HTaskPtr task_next) { - common_rendering(task_next); + common_rendering(task_next, sgroot); // Barrier 同期 // run_draw() を呼ぶ post2runDraw @@ -345,32 +345,6 @@ psx_sync_n(); } -void -Viewer::run_loop(HTaskPtr task_next) -{ - bool quit_flg; - quit_flg = quit_check(); - if (quit_flg == true) { - this_time = get_ticks(); - run_finish(); - return; - } - - clean_pixels(); - - for (int i = 1; i <= spackList_length; i++) { - spackList[i-1].reinit(i*split_screen_h); - } - - //run_move(task_next); - sgroot->updateControllerState(); - sgroot->allExecute(width, height); - //sgroot->checkRemove(); - - // ここから下は Rendering という関数にする - rendering(task_next); -} - static void post2runDraw(SchedTask *s, void *viewer_, void *arg) { @@ -392,17 +366,6 @@ frames++; } -void -Viewer::run_finish(void) -{ - if (this_time != start_time) { - printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); - } - - delete sgroot; -// delete sgroot_2; - quit(); -} static void post2speRendering(SchedTask *s, void *viewer_, void *arg) @@ -415,7 +378,7 @@ void Viewer::spe_rendering(HTaskPtr task_next) { - common_rendering(task_next); + common_rendering(task_next, sgroot); this->draw_dummy->wait_for(task_next); task_next->set_post(post2speDraw, (void*)this, 0); @@ -444,7 +407,7 @@ } void -Viewer::common_rendering(HTaskPtr task_next) +Viewer::common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot) { HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); @@ -454,8 +417,9 @@ task_create_pp->set_param(1,(memaddr)ppack); task_next->wait_for(task_create_pp); - - int range_base = spe_num; + + int range_base = spe_num; + // 切り上げのつもり int range = (spackList_length + range_base - 1) / range_base; @@ -467,7 +431,7 @@ HTaskPtr task_create_sp = manager->create_task(CreateSpan); task_create_sp->set_param(0,index_start); - + /** * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲 * [ 1.. 80] [ 81..160] [161..240] @@ -477,6 +441,7 @@ * [ 1..216] [217..432] [433..648] * [649..864] [865..1080] */ + task_create_sp->set_param(1,index_start*split_screen_h + 1); task_create_sp->set_param(2,index_end*split_screen_h); @@ -488,10 +453,11 @@ task_next->wait_for(task_create_sp); task_create_sp->wait_for(task_create_pp); - task_create_sp->set_cpu(SPE_ANY); + task_create_sp->set_cpu(SPE_ANY); task_create_sp->spawn(); } + task_create_pp->spawn(); } @@ -503,6 +469,35 @@ //task_next = manager->create_task(Dummy); //task_next->set_post(post2runLoop, (void*)this); + //Light info update + + HTaskPtr data_update; + HTaskPtr data_update_wait; + int size = sizeof(float)*4; + + light_xyz[0] = light_xyz_stock[0]; + light_xyz[1] = light_xyz_stock[1]; + light_xyz[2] = light_xyz_stock[2]; + light_xyz[3] = light_xyz_stock[3]; + + data_update_wait = manager->create_task(DataUpdate); + data_update_wait->add_inData(light_xyz,size); + data_update_wait->set_param(0,size); + data_update_wait->set_param(1,Light); + data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0)); + + for (int i = 1; i < spe_num; i++) { + data_update = manager->create_task(DataUpdate); + data_update->add_inData(light_xyz,sizeof(float)*size); + data_update->set_param(0,size); + data_update->set_param(1,Light); + data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i)); + data_update_wait->wait_for(data_update); + data_update->spawn(); + } + + data_update_wait->spawn(); + ppack->clear(); for (int i = 0; i < spackList_length; i++) { SpanPack *spack = &spackList[i]; @@ -542,8 +537,9 @@ break; } - task_draw->set_cpu(SPE_ANY); + task_draw->set_cpu(SPE_ANY); task_next->wait_for(task_draw); + task_draw->wait_for(data_update_wait); task_draw->spawn(); startx += split_screen_w; @@ -554,6 +550,20 @@ } } } + +} + +void +Viewer::run_finish() +{ + dev->free_device(); + if (this_time != start_time) { + printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); + } + + delete sgroot; +// delete sgroot_2; + quit(); } /* end */ diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewer.h --- a/Renderer/Engine/viewer.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewer.h Mon Jan 25 18:01:19 2010 +0900 @@ -9,6 +9,7 @@ #include "MainLoop.h" #include "Application.h" #include "SceneGraphRoot.h" +#include "ViewerDevice.h" class SceneGraphRoot; @@ -18,10 +19,12 @@ public: - Viewer(int bpp, int width, int height, int spenum); + Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); virtual ~Viewer() {} + BASE_NEW_DELETE(Viewer); + ViewerDevice *dev; Application *app; TaskManager *manager; @@ -29,41 +32,46 @@ HTaskPtr draw_dummy; /* screen info */ - int width; - int height; int bpp; + int rgb_size[3]; int spe_num; + int width; + int height; - int rgb_size[3]; + //float light_xyz[4] __attribute__((aligned(16))); + float *light_xyz; + float *light_xyz_stock; + + Uint32 video_flags; Uint32 *pixels; SceneGraphRoot *sgroot; - virtual void video_init(TaskManager *manager) = 0; + //Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); void init(); int get_ticks(); bool quit_check(); void quit(); - - virtual void swap_buffers(); - virtual void clean_pixels() {} + HTaskPtr initLoop(); - virtual void run_init(TaskManager *manager, Application *app); - virtual void run_loop(HTaskPtr task_next); - virtual void run_draw(HTaskPtr task_next); - virtual void run_finish(); - virtual void run_move(HTaskPtr task_next); - virtual void run_collision(); - virtual void rendering(HTaskPtr task_next); - virtual void common_draw(HTaskPtr task_next); - virtual void common_rendering(HTaskPtr task_next); + void clean_pixels() {} + + void run_init(TaskManager *manager, Application *app); + void run_loop(HTaskPtr task_next); + void run_draw(HTaskPtr task_next); + void run_finish(); + void run_move(HTaskPtr task_next); + void run_collision(); + void rendering(HTaskPtr task_next); + void common_draw(HTaskPtr task_next); + void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); - virtual void spe_rendering(HTaskPtr task_next); - virtual void spe_draw(HTaskPtr task_next); - //virtual void exchange_sgroot(TaskManager *manager); + void spe_rendering(HTaskPtr task_next); + void spe_draw(HTaskPtr task_next); + // void exchange_sgroot(TaskManager *manager); void getKey(); void get_send_controll(); @@ -114,13 +122,6 @@ return sgroot->getLast(); } - - - -private: - HTaskPtr initLoop(); - void speLoop(); - }; #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewerFB.cc --- a/Renderer/Engine/viewerFB.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewerFB.cc Mon Jan 25 18:01:19 2010 +0900 @@ -1,11 +1,13 @@ #include "viewerFB.h" -#include "Func.h" #include "fb.h" +#define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK //extern void post2runLoop(void *); +ViewerFB::ViewerFB() {} +ViewerFB::~ViewerFB() {} -void -ViewerFB::video_init(TaskManager *manager) +Uint32 * +ViewerFB::video_init(TaskManager *manager, int bpp, int width, int height) { Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; @@ -14,11 +16,13 @@ exit(1); } - pixels = (Uint32*)get_fbdev_addr(); + Uint32 *pixels = (Uint32*)get_fbdev_addr(); if (pixels == 0) { - pixels = (new Uint32[width*height*32/8]); + pixels = (new Uint32[width*height*32/8]); } + + return pixels; } void @@ -27,3 +31,16 @@ //bzero(pixels, sizeof(int)*width*height); //memset(pixels, 0xFF, sizeof(int)*width*height); } + +void +ViewerFB::clear_screen() +{ +} + + +void +ViewerFB::free_device() +{ +} + + diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewerFB.h --- a/Renderer/Engine/viewerFB.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewerFB.h Mon Jan 25 18:01:19 2010 +0900 @@ -1,16 +1,19 @@ #ifndef INCLUDED_VIEWER_FB #define INCLUDED_VIEWER_FB -#include "viewer.h" +#include "ViewerDevice.h" -class ViewerFB : public Viewer { +class ViewerFB : public ViewerDevice { public: -ViewerFB(TaskManager *manager, int bpp, int width, int height, int spenum) - :Viewer(bpp, width, height, spenum) {} + ViewerFB(TaskManager *manager) {}; + ViewerFB(); + virtual ~ViewerFB(); /* override function */ - void video_init(TaskManager *manager); + Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); void clean_pixels(void); + void clear_screen(); + void free_device(); }; #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewerSDL.cc --- a/Renderer/Engine/viewerSDL.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewerSDL.cc Mon Jan 25 18:01:19 2010 +0900 @@ -1,13 +1,17 @@ #include "viewerSDL.h" #include "Func.h" #include "TaskManager.h" +#include "viewer_types.h" extern void post2runLoop(void *); -extern +#define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK -void -ViewerSDL::video_init(TaskManager *manager) +ViewerSDL::ViewerSDL() {} +ViewerSDL::~ViewerSDL() {} + +Uint32 * +ViewerSDL::video_init(TaskManager *manager, int bpp, int width, int height) { Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; Uint32 *p; @@ -31,7 +35,7 @@ screen->pitch, redMask, greenMask, blueMask, alphaMask); - pixels = p; + return p; } void @@ -42,19 +46,15 @@ } void -ViewerSDL::run_loop(HTaskPtr task_next) +ViewerSDL::clear_screen() { SDL_BlitSurface(bitmap, NULL, screen, NULL); SDL_UpdateRect(screen, 0, 0, 0, 0); - - Viewer::run_loop(task_next); } void -ViewerSDL::run_finish() +ViewerSDL::free_device() { free(bitmap->pixels); SDL_FreeSurface(bitmap); - - Viewer::run_finish(); } diff -r fd3492a767c7 -r b7376415fa5f Renderer/Engine/viewerSDL.h --- a/Renderer/Engine/viewerSDL.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Engine/viewerSDL.h Mon Jan 25 18:01:19 2010 +0900 @@ -1,21 +1,22 @@ #ifndef INCLUDED_VIEWER_SDL #define INCLUDED_VIEWER_SDL -#include "viewer.h" +#include "ViewerDevice.h" -class ViewerSDL : public Viewer { +class ViewerSDL : public ViewerDevice { public: -ViewerSDL(TaskManager* manager, int bpp, int width, int height, int spenum) - :Viewer(bpp, width, height, spenum) {} + ViewerSDL(TaskManager* manager) {}; + ViewerSDL(); + virtual ~ViewerSDL(); SDL_Surface *screen; SDL_Surface *bitmap; /* override function */ - void video_init(TaskManager *manager); + Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); void clean_pixels(); - void run_loop(HTaskPtr task_next); - void run_finish(); + void clear_screen(); + void free_device(); }; #endif diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/Chain.h --- a/Renderer/Test/Chain.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/Chain.h Mon Jan 25 18:01:19 2010 +0900 @@ -22,7 +22,6 @@ void chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h); void chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg); - MainLoopPtr init_only_sg(SgChange *sgchange, int w, int h); MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/Makefile --- a/Renderer/Test/Makefile Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/Makefile Mon Jan 25 18:01:19 2010 +0900 @@ -1,11 +1,10 @@ - all: - make -f Makefile.macosx + make -f Makefile.macosx $* linux: - make -f Makefile.linux + make -f Makefile.linux $* +cell: + make -f Makefile.cell $* -cell: - make -f Makefile.cell clean: make -f Makefile.macosx clean diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/Makefile.cell --- a/Renderer/Test/Makefile.cell Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/Makefile.cell Mon Jan 25 18:01:19 2010 +0900 @@ -11,7 +11,7 @@ .cc.o: $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -ALL = ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum dynamic viewer SgRootChange +ALL = spe-main ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum dynamic viewer SgRootChange all: $(ALL) speobject: @@ -20,7 +20,7 @@ run: $(TARGET) sudo ./$(TARGET) -width 576 -height 384 -bpp 32 run-hd: $(TARGET) - sudo /usr/sbin/ps3-video-mode -v 133 + sudo ps3-video-mode -v 133 sudo ./$(TARGET) -video fb -width 1920 -height 1080 -bpp 32 diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/Makefile.def --- a/Renderer/Test/Makefile.def Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/Makefile.def Mon Jan 25 18:01:19 2010 +0900 @@ -4,7 +4,7 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -CFLAGS = -g -Wall $(ABI) # -O -DDEBUG +CFLAGS = -g -Wall $(ABI) # -O -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I$(CERIUM)/Renderer/Engine -I. -I$(CERIUM)/include/Cerium LIBS = -L$(CERIUM)/TaskManager -L$(CERIUM)/Renderer/Engine $(ABI) diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/Makefile.macosx --- a/Renderer/Test/Makefile.macosx Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/Makefile.macosx Mon Jan 25 18:01:19 2010 +0900 @@ -10,7 +10,9 @@ .cc.o: $(CC) $(CFLAGS) -c $< -o $@ -ALL = ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum send_linda dynamic writer chain_old +ALL = ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum property_test send_linda dynamic writer chain_old SgRootChange +oFLAGS=-g -O2 +CFLAGt=-g -O2 all: $(ALL) BALL_BOUND_OBJ = ball_bound.o @@ -53,6 +55,10 @@ vacuum : $(VACUUM_OBJ) $(CC) -o $@ $? $(LIBS) +PROPERTY_OBJ = property_test.o +property_test : $(PROPERTY_OBJ) + $(CC) -o $@ $? $(LIBS) + DYNAMIC_OBJ = dynamic_create.o dynamic : $(DYNAMIC_OBJ) $(CC) -o $@ $? $(LIBS) @@ -69,6 +75,11 @@ chain_old : $(CHAIN_OBJ) $(CC) -o $@ $? $(LIBS) +SGCHANGE_OBJ = SgRootChange.o +SgRootChange : $(SGCHANGE_OBJ) + $(CC) -o $@ $? $(LIBS) + + run: $(TARGET) sudo ./$(TARGET) -width 576 -height 384 -bpp 32 diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/SgRootChange.cc --- a/Renderer/Test/SgRootChange.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/SgRootChange.cc Mon Jan 25 18:01:19 2010 +0900 @@ -4,32 +4,127 @@ #include "MainLoop.h" #include "SgRootChange.h" +static void ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h); +static void ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, SceneGraphPtr tree); +static void ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree); +static float vy = 0.0f; // y 方向速度 +static float dt = 1.0/1.0f; // frame rate + +static float e = -0.8f; // 反発係数 +static float g = 9.8f; // 重力加速度 +//static float v0 = 0.0f; // 初速は 0 + +static float h0; // 初期高さ +static float ball_radius = 100.0f; + +static float speed = 10.0f; + +static void +ball_move_idle2(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) +{ + SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + Pad *pad = sgroot->getController(); + + if (pad->circle.isHold()) { + if (pad->left.isHold()) { + node->xyz[0] -= speed; + if(node->xyz[0] < ball_radius) + node->xyz[0] = ball_radius; + } else if (pad->right.isHold()) { + node->xyz[0] += speed; + if(node->xyz[0] > screen_w - ball_radius) + node->xyz[0] = screen_w - ball_radius; + } + + if (pad->up.isHold()) { + node->xyz[1] -= speed; + } else if (pad->down.isHold()) { + node->xyz[1] += speed; + if(node->xyz[1] > screen_h - ball_radius) + node->xyz[1] = screen_h - ball_radius; + } + } else { + node->set_move_collision(ball_move, ball_collision); + } +} + +static int time = 0; + +static void +ball_move_idle(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) +{ + SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + Pad *pad = sgroot->getController(); + + if (pad->circle.isPush()) { + node->set_move_collision(ball_move_idle2, ball_collision_idle); + time = 0; + } + + time++; + + if (time > 90) { + float w = (float)random(); + + w = fmodf(w, screen_w - ball_radius*2); + node->xyz[0] = w + ball_radius; + node->xyz[1] = h0; + node->set_move_collision(ball_move, ball_collision); + time = 0; + } +} + +static void +ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) +{ + vy += g * dt; + node->xyz[1] += vy * dt; + // node->xyz[0] += 10.0f; +} + +static void +ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree) +{ +} + +static void +ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, + SceneGraphPtr tree) +{ + if (node->xyz[1] > screen_h - ball_radius) { + node->xyz[1] = screen_h - ball_radius; + + vy *= e; + if (vy > -g && vy < 0) { + vy = 0.0; + node->set_move_collision(ball_move_idle, ball_collision_idle); + } + } +} // prototype MainLoopPtr -SgRootChange::init(Viewer *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - -MainLoopPtr -SgRootChange::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ +SgRootChange::init(Viewer *viewer, int screen_w, int screen_h) +{ + SgChange *sgroot = new SgChange(viewer); SceneGraphPtr ball; - SceneGraphPtr cube; - SceneGraphRoot *sg_buff_A = sgroot->sgroot_A; - SceneGraphRoot *sg_buff_B = sgroot->sgroot_B; + sgroot->run_init(); + srandom(100); + + sgroot->createFromXMLfile("xml_file/Ball.xml"); + ball = sgroot->createSceneGraph("Ball"); + ball->set_move_collision(ball_move, ball_collision); - sg_buff_A->createFromXMLfile(sgroot->manager, "xml_file/Ball.xml"); - sg_buff_B->createFromXMLfile(sgroot->manager, "xml_file/cube.xml"); + h0 = screen_h/2; + h0 = -1000; - ball = sgroot->sgroot_A->createSceneGraph("Ball"); - cube = sgroot->sgroot_B->createSceneGraph("Cube"); + ball->xyz[0] = screen_w/2; + ball->xyz[1] = h0; + ball->xyz[2] = 30.0f; - sgroot->sgroot_A->setSceneData(ball); - sgroot->sgroot_B->setSceneData(cube); + sgroot->setSceneData(ball); return sgroot; } @@ -41,7 +136,7 @@ const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n"; -extern int sg_init(TaskManager *manager, int argc, char *argv[]); +extern int init(TaskManager *manager, int argc, char *argv[]); extern void task_initialize(); static void TMend(TaskManager *manager); @@ -50,7 +145,7 @@ { task_initialize(); manager->set_TMend(TMend); - return sg_init(manager, argc, argv); + return init(manager, argc, argv); } diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/SgRootChange.h --- a/Renderer/Test/SgRootChange.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/SgRootChange.h Mon Jan 25 18:01:19 2010 +0900 @@ -3,10 +3,10 @@ #include "SceneGraphRoot.h" #include "Application.h" #include "MainLoop.h" +#include "SgChange.h" class SgRootChange : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/ball_bound.cc --- a/Renderer/Test/ball_bound.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/ball_bound.cc Mon Jan 25 18:01:19 2010 +0900 @@ -133,12 +133,6 @@ return sgroot; } -MainLoopPtr -ball_bound::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new ball_bound(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/ball_bound.h --- a/Renderer/Test/ball_bound.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/ball_bound.h Mon Jan 25 18:01:19 2010 +0900 @@ -3,9 +3,9 @@ #include "SceneGraphRoot.h" #include "Application.h" #include "MainLoop.h" +#include "viewer.h" class ball_bound : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/boss1_action.cc --- a/Renderer/Test/boss1_action.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/boss1_action.cc Mon Jan 25 18:01:19 2010 +0900 @@ -209,12 +209,6 @@ } } -MainLoopPtr -boss1_action::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new boss1_action(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/boss1_action.h --- a/Renderer/Test/boss1_action.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/boss1_action.h Mon Jan 25 18:01:19 2010 +0900 @@ -10,7 +10,6 @@ class boss1_action : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; static const float player_speed = 10.0f; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/chain_old.cc --- a/Renderer/Test/chain_old.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/chain_old.cc Mon Jan 25 18:01:19 2010 +0900 @@ -161,13 +161,6 @@ return sgroot; } -MainLoopPtr -Chain::init_only_sg(SgChange *sgchange, int w, int h) -{ - return sgchange; -} - - extern Application * application() { return new Chain(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/direction.cc --- a/Renderer/Test/direction.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/direction.cc Mon Jan 25 18:01:19 2010 +0900 @@ -95,12 +95,6 @@ return sgroot; } -MainLoopPtr -direction::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new direction(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/direction.h --- a/Renderer/Test/direction.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/direction.h Mon Jan 25 18:01:19 2010 +0900 @@ -6,6 +6,6 @@ class direction : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); + }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/dynamic_create.cc --- a/Renderer/Test/dynamic_create.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/dynamic_create.cc Mon Jan 25 18:01:19 2010 +0900 @@ -213,12 +213,6 @@ return sgroot; } -MainLoopPtr -dynamic_create::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new dynamic_create(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/dynamic_create.h --- a/Renderer/Test/dynamic_create.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/dynamic_create.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,5 +7,4 @@ class dynamic_create : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/gaplant.cc --- a/Renderer/Test/gaplant.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/gaplant.cc Mon Jan 25 18:01:19 2010 +0900 @@ -33,12 +33,6 @@ return sgroot; } -MainLoopPtr -gaplant::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new gaplant(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/gaplant.h --- a/Renderer/Test/gaplant.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/gaplant.h Mon Jan 25 18:01:19 2010 +0900 @@ -10,6 +10,5 @@ class gaplant : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/ieshoot.cc --- a/Renderer/Test/ieshoot.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/ieshoot.cc Mon Jan 25 18:01:19 2010 +0900 @@ -218,12 +218,6 @@ return sgroot; } -MainLoopPtr -ieshoot::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new ieshoot(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/ieshoot.h --- a/Renderer/Test/ieshoot.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/ieshoot.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,6 +7,5 @@ class ieshoot : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/node.cc --- a/Renderer/Test/node.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/node.cc Mon Jan 25 18:01:19 2010 +0900 @@ -73,12 +73,6 @@ return sgroot; } -MainLoopPtr -node::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new node(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/node.h --- a/Renderer/Test/node.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/node.h Mon Jan 25 18:01:19 2010 +0900 @@ -6,6 +6,5 @@ class node : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/panel.cc --- a/Renderer/Test/panel.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/panel.cc Mon Jan 25 18:01:19 2010 +0900 @@ -40,12 +40,6 @@ return sgroot; } -MainLoopPtr -panel::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new panel(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/panel.h --- a/Renderer/Test/panel.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/panel.h Mon Jan 25 18:01:19 2010 +0900 @@ -6,6 +6,5 @@ class panel : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/send_linda.cc --- a/Renderer/Test/send_linda.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/send_linda.cc Mon Jan 25 18:01:19 2010 +0900 @@ -214,12 +214,6 @@ return sgr; } -MainLoopPtr -send_linda::init_only_sg(SgChange *sgchange, int w, int h) -{ - return sgchange; -} - extern Application * application() { return new send_linda(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/send_linda.h --- a/Renderer/Test/send_linda.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/send_linda.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,6 +7,5 @@ class send_linda : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *sgroot, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/universe.cc --- a/Renderer/Test/universe.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/universe.cc Mon Jan 25 18:01:19 2010 +0900 @@ -68,12 +68,6 @@ return sgroot; } -MainLoopPtr -universe::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new universe(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/universe.h --- a/Renderer/Test/universe.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/universe.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,6 +7,5 @@ class universe : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/untitled.cc --- a/Renderer/Test/untitled.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/untitled.cc Mon Jan 25 18:01:19 2010 +0900 @@ -148,12 +148,6 @@ return sgroot; } -MainLoopPtr -untitled::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new untitled(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/untitled.h --- a/Renderer/Test/untitled.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/untitled.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,6 +7,5 @@ class untitled : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/vacuum.cc --- a/Renderer/Test/vacuum.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/vacuum.cc Mon Jan 25 18:01:19 2010 +0900 @@ -38,10 +38,10 @@ if(node->frame%ENCOUNT == ENCOUNT-1) { if(random()%2) { - add_cubecollision_object(redcube,node,screen_w,screen_h, sgroot); + add_cubecollision_object(redcube,node,screen_w,screen_h, sgroot); } else { - add_cubecollision_object(enemy,node,screen_w,screen_h, sgroot); + add_cubecollision_object(enemy,node,screen_w,screen_h, sgroot); } } @@ -182,12 +182,6 @@ return sgroot; } -MainLoopPtr -vacuum::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new vacuum(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/vacuum.h --- a/Renderer/Test/vacuum.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/vacuum.h Mon Jan 25 18:01:19 2010 +0900 @@ -10,7 +10,6 @@ class vacuum : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); }; diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/viewer.cc --- a/Renderer/Test/viewer.cc Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/viewer.cc Mon Jan 25 18:01:19 2010 +0900 @@ -141,12 +141,6 @@ return sgroot; } -MainLoopPtr -viewer::init_only_sg(SgChange *sgroot, int screen_w, int screen_h) -{ - return sgroot; -} - extern Application * application() { return new viewer(); diff -r fd3492a767c7 -r b7376415fa5f Renderer/Test/viewer.h --- a/Renderer/Test/viewer.h Sun Dec 06 10:23:19 2009 +0900 +++ b/Renderer/Test/viewer.h Mon Jan 25 18:01:19 2010 +0900 @@ -7,5 +7,4 @@ class viewer : public Application { MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); - MainLoopPtr init_only_sg(SgChange *viewer, int screen_w, int screen_h); };