Mercurial > hg > Game > Cerium
changeset 444:afbc6ec42c7f draft
test_render is not working...
author | game@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 25 Sep 2009 05:54:33 +0900 |
parents | 3ff80f695e9d |
children | efe8584a7b5a |
files | TaskManager/Test/test_render/Application.cc TaskManager/Test/test_render/Application.h TaskManager/Test/test_render/SceneGraph.h TaskManager/Test/test_render/SceneGraphRoot.cc TaskManager/Test/test_render/viewer.h |
diffstat | 5 files changed, 67 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/Application.cc Fri Sep 25 04:53:02 2009 +0900 +++ b/TaskManager/Test/test_render/Application.cc Fri Sep 25 05:54:33 2009 +0900 @@ -1,80 +1,80 @@ #include "Application.h" #include "SceneGraph.h" -void -Application::set_move_func(move_func new_move) -{ - this->move = new_move; -} +// void +// Application::set_move_func(move_func new_move) +// { +// this->move = new_move; +// } -void -Application::set_move_coll(coll_func new_coll) -{ - this->coll = new_coll; -} +// void +// Application::set_move_coll(coll_func new_coll) +// { +// this->coll = new_coll; +// } void Application::set_move_taskid(int id) { this->move_taskid = id; } -void -Application::apply_property(PropertyPtr p, SceneGraphPtr sgptr) -{ - sgptr->xyz[0] = p->xyz[0]; - sgptr->xyz[1] = p->xyz[1]; - sgptr->xyz[2] = p->xyz[2]; +// void +// Application::apply_property(PropertyPtr p, SceneGraphPtr sgptr) +// { +// sgptr->xyz[0] = p->xyz[0]; +// sgptr->xyz[1] = p->xyz[1]; +// sgptr->xyz[2] = p->xyz[2]; - sgptr->angle[0] = p->angle[0]; - sgptr->angle[1] = p->angle[1]; - sgptr->angle[2] = p->angle[2]; +// sgptr->angle[0] = p->angle[0]; +// sgptr->angle[1] = p->angle[1]; +// sgptr->angle[2] = p->angle[2]; - sgptr->frame++; +// sgptr->frame++; -} +// } SceneGraphPtr -Application::scenegraph_factory(PropertyPtr p) +Application::scenegraph_factory(void *p, int size) { - SceneGraphPtr sgptr = p->scenegraph; - apply_property(p, sgptr); + //SceneGraphPtr sgptr = p->scenegraph; + //apply_property(p, sgptr); - return sgptr; + return NULL; } SceneGraphPtr -Application::scenegraph_connector(PropertyPtr p, SceneGraphPtr sg, +Application::scenegraph_connector(void *p, int size, SceneGraphPtr sg, SceneGraphPtr sg_available_list) { - SceneGraphPtr last = sg_available_list; +// SceneGraphPtr last = sg_available_list; - if (!last) { - sg_available_list = sg; - } else { - while (last->next) { - last = last->next; - } - last->next = sg; - sg->prev = last; - } +// if (!last) { +// sg_available_list = sg; +// } else { +// while (last->next) { +// last = last->next; +// } +// last->next = sg; +// sg->prev = last; +// } - PropertyPtr p_curent = (PropertyPtr)sg->propertyPtr; - PropertyPtr p_parent = p[p_curent->parent_id]; - SceneGraphPtr s_parent = p_parent->scenegraph; +// PropertyPtr p_curent = (PropertyPtr)sg->propertyPtr; +// PropertyPtr p_parent = p[p_curent->parent_id]; +// SceneGraphPtr s_parent = p_parent->scenegraph; - /* childrenのリストの最後に加える (brother として)*/ - if (s_parent->lastChild != NULL) { - SceneGraphPtr last = s_parent->lastChild; - last->brother = sg; - } +// /* childrenのリストの最後に加える (brother として)*/ +// if (s_parent->lastChild != NULL) { +// SceneGraphPtr last = s_parent->lastChild; +// last->brother = sg; +// } - s_parent->lastChild = sg; +// s_parent->lastChild = sg; - if (s_parent->children == NULL) { - s_parent->children = sg; - } +// if (s_parent->children == NULL) { +// s_parent->children = sg; +// } - sg->parent = s_parent; - +// sg->parent = s_parent; + return NULL; }
--- a/TaskManager/Test/test_render/Application.h Fri Sep 25 04:53:02 2009 +0900 +++ b/TaskManager/Test/test_render/Application.h Fri Sep 25 05:54:33 2009 +0900 @@ -1,3 +1,6 @@ +class Application; +typedef Application *ApplicationPtr; + #ifndef INCLUDED_APPLICATION #define INCLUDED_APPLICATION @@ -9,7 +12,7 @@ class Application { public: Application(); - ~Application(); + virtual ~Application(); void *propertyPtr; int property_size; @@ -19,13 +22,11 @@ // SceneGraphPtr scenegraph_factory(PropertyPtr p); // SceneGraphPtr scenegraph_connector(PropertyPtr p,SceneGraphPtr s); SceneGraphPtr scenegraph_factory(void *p, int size); - SceneGraphPtr scenegraph_connector(void *p, int size, SceneGraphPtr s); - abstract void init(TaskManager *manager, int w, int h); + SceneGraphPtr scenegraph_connector(void *p, int size, SceneGraphPtr s, SceneGraphPtr sg_available_list); + virtual void init(TaskManager *manager, int w, int h); int move_taskid; move_func move; coll_func coll; }; -typedef Application *Application; - #endif
--- a/TaskManager/Test/test_render/SceneGraph.h Fri Sep 25 04:53:02 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.h Fri Sep 25 05:54:33 2009 +0900 @@ -1,17 +1,19 @@ + #ifndef INCLUDED_SCENE_GRAPH #define INCLUDED_SCENE_GRAPH #include "polygon.h" #include "Pad.h" #include "TaskManager.h" -class SceneGraph; +#include <libxml/parser.h> + +class SceneGraph : public Polygon { + +typedef SceneGraph* SceneGraphPtr; typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h, - SceneGraph* tree); -typedef SceneGraph* SceneGraphPtr; - -class SceneGraph : public Polygon { + SceneGraph* tree); public: SceneGraph(void); SceneGraph(TaskManager *manager, xmlNodePtr surface); @@ -101,6 +103,9 @@ #endif +class SceneGraph; +typedef SceneGraph* SceneGraphPtr; + // 帯域変数を使うのは禁止なので削除すること // オリジナル (Linked List) extern SceneGraphPtr scene_graph;
--- a/TaskManager/Test/test_render/SceneGraphRoot.cc Fri Sep 25 04:53:02 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphRoot.cc Fri Sep 25 05:54:33 2009 +0900 @@ -160,57 +160,6 @@ } void -SceneGraphRoot::speExecute(Application application, int screen_w, int screen_h) -{ - - SceneGraphPtr list = sg_available_list; - SceneGraphPtr t = sg_exec_tree; - SceneGraphPtr cur_parent = camera; - - // 前フレームで描画した SceneGraph は削除 - allRemove(sg_remove_list); - - // 前フレームに作られた SceneGraph は描画用に移行 - // 現フレームでの操作は以下の tree,list には適用されない - sg_draw_tree = sg_exec_tree; - sg_remove_list = sg_available_list; - - // 現フレームで新しく SceneGraph がコピーされるので初期化 - sg_exec_tree = NULL; - sg_available_list = NULL; - - camera->move_execute(screen_w, screen_h); - camera->update(screen_w, screen_h); - - camera->children = NULL; - camera->lastChild = NULL; - - void *property = application->move_execute(screen_w, screen_h); - application->collision_check(screen_w, screen_h, list); - - //list->frame++; - //list = list->next; - - if(sg_exec_tree != NULL) { - return; - } - - /*removeのflagをもとにtreeを形成*/ - /* spe から送り返されてきた property の配列を見て生成する for()*/ - - for (Property *t = property[0]; is_end(t); t++) { - SceneGraphPtr s = application->scenegraph_factory(t); // SceneGraphNode を作る - t->scenegraph = s; // property list には SceneGraphへのポインタが入っている - application->scenegraph_connector(property[0], s, sg_available_list); // add する - } - - // 現在、allExecute が終わった時点では - // camera->children が User SceneGraph の root になる - sg_exec_tree = camera->children; -} - - -void SceneGraphRoot::allExecute(int screen_w, int screen_h) { SceneGraphPtr list = sg_available_list;