Mercurial > hg > Members > kono > Cerium
changeset 531:fab6f20021c9
change SceneGraphRoot's constructor
author | aaa |
---|---|
date | Wed, 21 Oct 2009 01:51:00 +0900 |
parents | 18446bce1b8b |
children | cd2985cd3461 997d2a73a758 |
files | TaskManager/Test/test_render/SceneGraphList.h TaskManager/Test/test_render/SceneGraphRoot.cc TaskManager/Test/test_render/SceneGraphRoot.h |
diffstat | 3 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/SceneGraphList.h Wed Oct 21 00:56:51 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphList.h Wed Oct 21 01:51:00 2009 +0900 @@ -5,22 +5,19 @@ #include "SgStruct.h" class SceneGraphList : SgStruct { -public: - SgStruct* pool; +public: SgStruct* first; SgStruct* last; int sgid; - SceneGraphList (SgStruct* ms) { + SceneGraphList () { first = last = this; next = prev = this; - pool = ms; sgid = 0; } - + ~SceneGraphList () { - free(pool); - } + } void addFirst(SgStruct* e); void addLast(SgStruct* e); @@ -28,7 +25,7 @@ SgStruct* getLast(); int remove(SgStruct* e); SgStruct* poll(); - SgStruct* get(char *name); + SgStruct* get(char *name); }; #endif
--- a/TaskManager/Test/test_render/SceneGraphRoot.cc Wed Oct 21 00:56:51 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphRoot.cc Wed Oct 21 01:51:00 2009 +0900 @@ -16,6 +16,7 @@ sg_src = new SceneGraphPtr[SGLIST_LENGTH]; camera = new Camera(w, h); iterator = new SceneGraphIterator; + sglist = new SceneGraphList; controller = create_controller(); sg_exec_tree = NULL; @@ -152,17 +153,14 @@ /* SceneGraphRoot にメンバ変数 SceneGraphList を持たせておくか SceneGraphList sglist + sg->name で検索して、有れば sg_src に追加。 + sgid は sglist のメンバ変数 sgid で管理する感じ */ if (sglist->get(sg->name)) { - - } - - while (sglist) { - if (strcmp(sg->name, sglist_table[i]) == 0) { - sg->sgid = i; - sg_src[i] = sg; - return; - } + sg->sgid = sgid; + sg_src[sgid] = sg; + sg->sgid++; + return; } fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n",
--- a/TaskManager/Test/test_render/SceneGraphRoot.h Wed Oct 21 00:56:51 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphRoot.h Wed Oct 21 01:51:00 2009 +0900 @@ -6,6 +6,7 @@ #include "Camera.h" #include "SceneGraphIterator.h" #include "Application.h" +#include "SceneGraphList.h" class SceneGraphRoot { public: @@ -14,6 +15,10 @@ ~SceneGraphRoot(void); /* Variables */ + + // sgid と name を持った SgStruct のリスト + SceneGraphList *sglist; + // xml から読み込んだ、オリジナルの SceneGraph SceneGraphPtr *sg_src;