changeset 562:a5fda4e51498

name search
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 22 Oct 2009 22:22:31 +0900
parents 71b3363c16bf
children b21a013051a2
files Renderer/Engine/SceneGraphRoot.cc Renderer/Engine/SceneGraphRoot.h Renderer/Engine/viewer.h Renderer/Test/Makefile.macosx Renderer/Test/back_action.cc Renderer/Test/ball_bound.cc Renderer/Test/boss1_action.cc Renderer/Test/direction.cc Renderer/Test/gaplant.cc
diffstat 9 files changed, 267 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -6,20 +6,23 @@
 #include "sys.h"
 #include "TextureHash.h"
 #include "texture.h"
-#include <stdlib.h>
+//#include "SGList.h"
+#include "Application.h"
 
-static int cnt = 0;
+int cnt = 0;
+static const int SGLIST_LENGTH = 138;
+
 
 SceneGraphRoot *sgroot;
 
-#define SGLIST_INIT_LENGTH 128
-
 SceneGraphRoot::SceneGraphRoot(float w, float h)
 {
-    sg_src = (SceneGraphPtr)malloc(sizeof(SceneGraphPtr)*SGLIST_INIT_LENGTH );
-    sg_src_length = SGLIST_INIT_LENGTH ;
+    // SGLIST_LENGTH 決め打ちかぁ、動的生成にする場合上限決めておいた方がいいのかな
+    //
+    sg_src = new SceneGraphPtr[SGLIST_LENGTH];
     camera = new Camera(w, h);
     iterator = new SceneGraphIterator;
+    sglist = new SceneGraphList;
     controller = create_controller();
 
     sg_exec_tree = NULL;
@@ -27,11 +30,12 @@
     sg_available_list = NULL;
     sg_remove_list = NULL;
 
+    sgroot = this;
+
     // TODO
     //   今はとりあえず camera を Root にしています
     //   今はそれすらもしてません
     //sg_exec_tree = camera;
-    sgroot = this;
 }
 
 SceneGraphRoot::~SceneGraphRoot()
@@ -54,7 +58,7 @@
 		cnt--;
     }
 
-    free(sg_src);
+    delete [] sg_src;
     delete camera;
     delete iterator;
     delete controller;
@@ -65,26 +69,21 @@
  *
  * @param sg SceneGraph created by xmlfile
  */
-
-extern const char *sglist_table[];
-
 void
 SceneGraphRoot::registSceneGraph(SceneGraphPtr sg)
 {
-    for (int i = 0; i < sg_src_length && sglist_table[i]; i++) {
-	if (strcmp(sg->name, sglist_table[i]) == 0) {
-	    sg->sgid = i;
-	    if (i>= sg_src_length) {	    
-		sg_src_length += sizeof(SceneGraphPtr)*SGLIST_INIT_LENGTH ;
-		sg_src = (SceneGraphPtr)realloc(sg_src, sg_src_length);
-	    }
-	    sg_src[i] = sg;
-	    return;
-	}
+#if 0
+    for (int i = 0; i < SGLIST_LENGTH; i++) {
+		if (strcmp(sg->name, sglist_table[i]) == 0) {
+			sg->sgid = i;
+			sg_src[i] = sg;
+			return;
+		}
     }
 
     fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n",
 			__FUNCTION__, __LINE__, sg->name);
+#endif
 }
 
 void
@@ -112,7 +111,7 @@
     xmlDocPtr doc;
     xmlNodePtr cur;
     SceneGraphPtr tmp;
-    
+
     /* パース DOM生成 */
     doc = xmlParseFile(xmlfile);
     cur = xmlDocGetRootElement(doc);
@@ -122,18 +121,20 @@
 
     /* XMLのノードを一つずつ解析  */
     for (cur=cur->children; cur; cur=cur->next) {
-		/* 扱うのはsurfaceオンリー  */
-		if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
-			continue;
-		}
+	/* 扱うのはsurfaceオンリー  */
+	if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
+	    continue;
+	}
 
-		/* ポリゴン(SceneGraph)生成  */
-		tmp = new SceneGraph(manager, cur);
+	/* ポリゴン(SceneGraph)生成  */
+	tmp = new SceneGraph(manager, cur);	
 
-		registSceneGraph(tmp);
+	addSceneGraphList(manager, tmp);
+	registSceneGraphList(tmp);
     }
 
     xmlFreeDoc(doc);
+
 }
 
 SceneGraphPtr
@@ -142,12 +143,12 @@
     SceneGraphPtr src;
     SceneGraphPtr p;
 
-    if (id < 0 || id > sg_src_length) {
+    if (id < 0 || id > SGLIST_LENGTH) {
 		return NULL;
     }
 
     /* オリジナルの SceneGraph */
-    src = sg_src+id;
+    src = sg_src[id];
 
     /* ユーザーにはオリジナルの clone を返す */
     p = src->clone();
@@ -157,6 +158,102 @@
     return p;
 }
 
+void
+SceneGraphRoot::registSceneGraphList(SceneGraphPtr sg)
+{
+    /*
+      SceneGraphRoot にメンバ変数 SceneGraphList を持たせておくか
+      SceneGraphList sglist
+      sg->name で検索して、有れば sg_src に追加。
+      sgid は sglist のメンバ変数 sgid で管理する感じ
+     */    
+
+    SgStruct *s = sglist->get(sg->name);
+    if (s != NULL) {
+	sg->sgid = sglist->sgid;
+	s->id = sglist->sgid;
+	sg_src[sg->sgid] = sg;
+	sglist->sgid++;
+	return;
+    }
+
+    fprintf(stderr, "error: (%s:%3d) Can't find Scene \"%s\"\n",
+			__FUNCTION__, __LINE__, sg->name);
+}
+
+void
+SceneGraphRoot::createFromXMLmemory(TaskManager *manager, char *data, int len)
+{
+    xmlDocPtr doc;
+    xmlNodePtr cur;
+    
+    // size は取れるはず、テスト用に mmap したデータを使う
+    /* パース DOM生成 */
+
+    doc = xmlParseMemory(data, len);
+    cur = xmlDocGetRootElement(doc);
+
+    /* ??  */
+    xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
+
+    /* XMLのノードを一つずつ解析  */
+    for (cur=cur->children; cur; cur=cur->next) {
+	/* 扱うのはsurfaceオンリー  */
+	if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
+	    continue;
+	}
+
+	/* ポリゴン(SceneGraph)生成  */
+	SceneGraphPtr tmp = new SceneGraph(manager, cur);	
+	
+	addSceneGraphList(manager, tmp);
+	
+	registSceneGraphList(tmp);
+    }
+    
+    xmlFreeDoc(doc);
+}
+
+/* 生成された SceneGraph のを sglist に登録 */
+void
+SceneGraphRoot::addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp)
+{
+    SgStruct *sg_t = (SgStruct *)manager->allocate(sizeof(SgStruct));
+    sg_t->name = tmp->name;
+    sglist->addLast(sg_t);
+}
+
+SceneGraphPtr
+SceneGraphRoot::createSceneGraph(const char *name)
+{
+    SceneGraphPtr src;
+    SceneGraphPtr p;
+
+    // SceneGraphList から name を検索して id 取得
+    SgStruct *e = sglist->get(name);
+    int id = e->id;
+    if (id < 0) {
+	return NULL;
+    }
+    
+    /* オリジナルの SceneGraph */
+    src = sg_src[id];
+
+    /* ユーザーにはオリジナルの clone を返す */
+    p = src->clone();
+
+    addNext(p);
+
+    return p;
+}
+
+int
+SceneGraphRoot::getSgid(const char *name)
+{
+    SgStruct *e = sglist->get(name);
+    return e->id;
+}
+
 /**
  * 何も表示しない、move,collision もしない SceneGraph を生成
  * いずれ、Transform3D 的なものに回す予定
@@ -211,14 +308,69 @@
     /*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); // add する
-	  }
+    for (Property *t = (Property*)app->property[0]; is_end(t); t++){
+	SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
+	t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
+	app->scenegraph_connector(property[0], s); // add する
+    } 
+    */   
+    
+
+    // 現在、allExecute が終わった時点では
+    // camera->children が User SceneGraph の root になる
+
+    /**
+     * NULL じゃなかったら、setSceneData が呼ばれてるから
+     * そっちを次の Scene にする
+     */
+
+    sg_exec_tree = camera->children;
+}
+
+void
+SceneGraphRoot::speExecute(int screen_w, int screen_h, Application *app)
+{
+    // 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;
+    
+
+    if(sg_exec_tree != NULL) {
+	return;
+    }
+
+    /*removeのflagをもとにtreeを形成*/
+    /* spe から送り返されてきた property の配列を見て生成する for()*/
+    /* Application内に移動 */
+
+    // app->property_ope(sg_available_list);
+
+    /* 
+    for (Property *t = (Property *)properties[0]; is_end(t); t++){
+	SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
+	t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
+	app->scenegraph_connector(property[0], s); // add する
+    }  
     */
-
-      
+    
+    
 
     // 現在、allExecute が終わった時点では
     // camera->children が User SceneGraph の root になる
--- a/Renderer/Engine/SceneGraphRoot.h	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Engine/SceneGraphRoot.h	Thu Oct 22 22:22:31 2009 +0900
@@ -5,6 +5,18 @@
 #include "SceneGraphArray.h"
 #include "Camera.h"
 #include "SceneGraphIterator.h"
+// #include "Application.h"
+#include "SceneGraphList.h"
+#include "SgStruct.h"
+// #include "TaskManager.h"
+#include <sys/types.h>
+
+typedef struct {
+    caddr_t file_mmap;
+    off_t size;
+} st_mmap_t;
+
+class Application;
 
 class SceneGraphRoot {
 public:
@@ -13,8 +25,13 @@
     ~SceneGraphRoot();
 
     /* Variables */
+    TaskManager *tmanager;
+    
+    // sgid と name を持った SgStruct のリスト
+    SceneGraphList *sglist;
+
     // xml から読み込んだ、オリジナルの SceneGraph
-    SceneGraphPtr sg_src;
+    SceneGraphPtr *sg_src;
     int sg_src_length;
 
     // move, collision 用の SceneGraph (tree)
@@ -48,8 +65,14 @@
      */
     /* User API */
     void createFromXMLfile(TaskManager *manager, const char *);
+    //void createFromXMLmemory(TaskManager *manager, const char *xml);
+    //void createFromXMLmemory(TaskManager *manager, st_mmap_t mmap_t);
+    void createFromXMLmemory(TaskManager *manager, char *data, int len);
     SceneGraphPtr createSceneGraph(int id);
     SceneGraphPtr createSceneGraph();
+    SceneGraphPtr createSceneGraph(const char *name);
+    int getSgid(const char *name);
+
     void setSceneData(SceneGraphPtr sg);
     Pad *getController();
     SceneGraphIteratorPtr getIterator();
@@ -64,19 +87,22 @@
     void updateControllerState();
 
     void speExecute(int screen_w, int screen_h);
+    void speExecute(int screen_w, int screen_h, Application *app);
 
     /* System API */
     void registSceneGraph(SceneGraphPtr sg);
+    void registSceneGraphList(SceneGraphPtr sg);
+    void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp);
     void addNext(SceneGraphPtr sg);
     void allRemove(SceneGraphPtr list);
 };
 
 typedef SceneGraphRoot *SceneGraphRootPtr;
 
-#endif
 
 // 大域変数は無くすこと
-// move に Controller を渡せば必要ないはず...
-extern SceneGraphRootPtr sgroot;
+extern SceneGraphRoot *sgroot;
+
+#endif
 
 /* end */
--- a/Renderer/Engine/viewer.h	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Engine/viewer.h	Thu Oct 22 22:22:31 2009 +0900
@@ -10,6 +10,8 @@
 #include "Application.h"
 #include "SceneGraphRoot.h"
 
+class SceneGraphRoot;
+
 class Application;
 
 class Viewer : public MainLoop {
@@ -82,6 +84,16 @@
 	return sgroot->createSceneGraph(id);
     }
 
+    SceneGraph * createSceneGraph(const char *id)
+    {
+	return sgroot->createSceneGraph(id);
+    }
+
+    int getSgid(const char *id)
+    {
+	return sgroot->getSgid(id);
+    }
+
     SceneGraph * createSceneGraph()
     {
 	return sgroot->createSceneGraph();
--- a/Renderer/Test/Makefile.macosx	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/Makefile.macosx	Thu Oct 22 22:22:31 2009 +0900
@@ -14,39 +14,20 @@
 
 
 BALL_BOUND_OBJ = ball_bound.o
-BALL_BOUND_XML = xml_file/Ball.xml
-ball_bound : $(BALL_BOUND_OBJ) $(BALL_BOUND_XML).o 
-	$(CC) -o $@ $< $(BALL_BOUND_XML).o  $(LIBS)
-ball_bound.cc : $(BALL_BOUND_XML).h 
-$(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h : $(BALL_BOUND_XML)
-	perl $(TOOL)/create_sglist.pl -o $@ $(BALL_BOUND_XML)
+ball_bound : $(BALL_BOUND_OBJ) 
+	$(CC) -o $@ $?   $(LIBS)
 
 BOSS_OBJ = boss1_action.o
-BOSS_XMLS = xml_file/boss1.xml xml_file/player1.xml xml_file/p_shot.xml xml_file/blast.xml
-BOSS_XML = xml_file/boss1.xml 
-boss1_action : $(BOSS_OBJ) xml_file/boss1.xml.o 
-	$(CC) -o $@ $< xml_file/boss1.xml.o  $(LIBS)
-boss1_action.cc : $(BOSS_XML).h
-xml_file/boss1.xml.h : $(BOSS_XMLS)
-	perl $(TOOL)/create_sglist.pl -o $@ $(BOSS_XMLS) 
+boss1_action : $(BOSS_OBJ) 
+	$(CC) -o $@ $?   $(LIBS)
 
 DIRECTION_OBJ = direction.o
-DIRECTION_XML = xml_file/direction.xml 
-DIRECTION_XMLS = $(DIRECTION_XML) 
-direction : $(DIRECTION_OBJ) xml_file/direction.xml.o 
-	$(CC) -o $@ $<  xml_file/direction.xml.o  $(LIBS)
-direction.cc : xml_file/direction.xml.h 
-xml_file/direction.xml.h : $(DIRECTION_XMLS)
-	perl $(TOOL)/create_sglist.pl -o $@ $(DIRECTION_XMLS) 
+direction : $(DIRECTION_OBJ) 
+	$(CC) -o $@ $?    $(LIBS)
 
 GAPLAN_OBJ = gaplant.o gaplant_action.o back_action.o ball_action.o
-GAPLAN_XML = xml_file/gap_plane_test.xml 
-GAPLAN_XMLS = $(GAPLAN_XML) xml_file/Ball.xml
-gaplant : $(GAPLAN_OBJ) xml_file/gap_plane_test.xml.o 
+gaplant : $(GAPLAN_OBJ) 
 	$(CC) -o $@ $?    $(LIBS)
-gaplant.cc : xml_file/gap_plane_test.xml.h
-xml_file/gap_plane_test.xml.h : $(GAPLAN_XMLS)
-	perl $(TOOL)/create_sglist.pl -o $@ $(GAPLAN_XMLS) 
 
 
 run: $(TARGET)
--- a/Renderer/Test/back_action.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/back_action.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -10,7 +10,7 @@
     Pad *pad = sgroot->getController();
 
     if (pad->triangle.isPush()) {
-	SceneGraphPtr ball = sgroot->createSceneGraph(Ball);
+	SceneGraphPtr ball = sgroot->createSceneGraph("Ball");
 	ball->xyz[0] = -100;
 	ball->set_move_collision(ball_move, ball_coll);
 	node->addChild(ball);
--- a/Renderer/Test/ball_bound.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/ball_bound.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -2,7 +2,6 @@
 #include <stdlib.h>
 #include "SceneGraphRoot.h"
 #include "MainLoop.h"
-#include "xml_file/Ball.xml.h"
 #include "ball_bound.h"
 
 
@@ -116,7 +115,7 @@
 
     sgroot->createFromXMLfile("xml_file/Ball.xml");
 
-    ball = sgroot->createSceneGraph(Ball);
+    ball = sgroot->createSceneGraph("Ball");
     ball->set_move_collision(ball_move, ball_collision);
 
     h0 = screen_h/2;
--- a/Renderer/Test/boss1_action.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/boss1_action.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -1,7 +1,6 @@
 #include "SceneGraphRoot.h"
 #include "MainLoop.h"
 #include "boss1_action.h"
-#include "xml_file/boss1.xml.h"
 
 /*
 static void
@@ -116,7 +115,7 @@
   }
   
   if (pad->circle.isPush()) {
-    SceneGraphPtr shot = sgroot->createSceneGraph(P_SHOT1);
+    SceneGraphPtr shot = sgroot->createSceneGraph("P_SHOT1");
     shot->set_move_collision(shot_move, shot_collision);
     shot->xyz[0] = node->xyz[0];
     shot->xyz[1] = node->xyz[1] - player_radius;
@@ -124,6 +123,8 @@
   }    
 }
 
+static int boss1sgid;
+
 static void
 player_collision(SceneGraphPtr node, int screen_w, int screen_h,
 		 SceneGraphPtr tree)
@@ -136,8 +137,8 @@
   SceneGraphIteratorPtr it = sgroot->getIterator(tree);
   
   
-  for (; it->hasNext(BOSS1);) {
-    it->next(BOSS1);
+  for (; it->hasNext(boss1sgid);) {
+    it->next(boss1sgid);
     SceneGraphPtr enemy = it->get();
     
     //各変数の初期化
@@ -181,8 +182,8 @@
   SceneGraphIteratorPtr it = sgroot->getIterator(tree);
   
   
-  for (; it->hasNext(BOSS1);) {
-    it->next(BOSS1);
+  for (; it->hasNext(boss1sgid);) {
+    it->next(boss1sgid);
     SceneGraphPtr enemy = it->get();
     
     x_distant = node->xyz[0] - enemy->xyz[0];
@@ -193,7 +194,7 @@
     
     //円同士のcollision
     if(distance <  boss_radius_y) {
-      SceneGraphPtr blast = sgroot->createSceneGraph(BLAST1);
+      SceneGraphPtr blast = sgroot->createSceneGraph("BLAST1");
       
       blast->set_move_collision(blast_move, null_collision);
       blast->xyz[0] = node->xyz[0];
@@ -211,11 +212,12 @@
 
 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";
 
+static int blast8;
 
 static void
 blast_move(SceneGraphPtr node, int screen_w, int screen_h)
 {
-  if(node->sgid > BLAST8) {
+  if(node->sgid > blast8) {
     SceneGraphPtr blast = sgroot->createSceneGraph(node->sgid - 1);
     blast->set_move_collision(blast_move, null_collision);
     blast->xyz[0] = node->xyz[0];
@@ -223,7 +225,7 @@
     node->addBrother(blast);
   }
   
-  if (node->sgid == BLAST8) {
+  if (node->sgid == blast8) {
     node->flag_drawable = 1;
   }
   
@@ -241,18 +243,22 @@
   sgroot->createFromXMLfile("xml_file/player1.xml");
   sgroot->createFromXMLfile("xml_file/p_shot.xml");
   sgroot->createFromXMLfile("xml_file/blast.xml");
-  
+ 
+  blast8 = sgroot->getSgid("BLAST8");
+ 
   //rootとなるSceneGraphを生成
   SceneGraphPtr root = sgroot->createSceneGraph();
   
   //自機の初期化
-  SceneGraphPtr player = sgroot->createSceneGraph(PLAYER);
+  SceneGraphPtr player = sgroot->createSceneGraph("PLAYER");
   player->xyz[0] = screen_w/2;
   player->xyz[1] = screen_h - player_radius;
   root->addChild(player);
 
   //ボスの初期化
-  SceneGraphPtr boss1 = sgroot->createSceneGraph(BOSS1);
+  SceneGraphPtr boss1 = sgroot->createSceneGraph("BOSS1");
+  boss1sgid = boss1->sgid;
+
   boss1->xyz[0] = screen_w/2;
   boss1->xyz[1] = boss_radius_y;
   //  boss1->xyz[2] = first_boss1_depth;
@@ -260,9 +266,9 @@
   root->addChild(boss1);
 
   //ボスの左右パーツを追加
-  SceneGraphPtr left_parts = sgroot->createSceneGraph(BOSS1_L);
+  SceneGraphPtr left_parts = sgroot->createSceneGraph("BOSS1_L");
   boss1->addChild(left_parts);
-  SceneGraphPtr right_parts = sgroot->createSceneGraph(BOSS1_R);
+  SceneGraphPtr right_parts = sgroot->createSceneGraph("BOSS1_R");
   boss1->addChild(right_parts);
 
   //各機体の動きと当たり判定をセット
--- a/Renderer/Test/direction.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/direction.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -1,6 +1,5 @@
 #include "SceneGraphRoot.h"
 #include "direction.h"
-#include "xml_file/direction.xml.h"
 
 static void
 x_move(SceneGraphPtr node, int w, int h)
@@ -72,9 +71,9 @@
 
     sgroot->createFromXMLfile("xml_file/direction.xml");
 
-    dx = sgroot->createSceneGraph(Dirx);
-    dy = sgroot->createSceneGraph(Diry);
-    dz = sgroot->createSceneGraph(Dirz);
+    dx = sgroot->createSceneGraph("Dirx");
+    dy = sgroot->createSceneGraph("Diry");
+    dz = sgroot->createSceneGraph("Dirz");
     back = sgroot->createSceneGraph();
     
     back->addChild(dx);
--- a/Renderer/Test/gaplant.cc	Thu Oct 22 19:31:09 2009 +0900
+++ b/Renderer/Test/gaplant.cc	Thu Oct 22 22:22:31 2009 +0900
@@ -1,5 +1,4 @@
 #include "SceneGraphRoot.h"
-#include "xml_file/gap_plane_test.xml.h"
 #include "gaplant_action.h"
 #include "gaplant.h"
 #include "back_action.h"
@@ -20,8 +19,9 @@
     gaplant->angle[1] = 0;
     gaplant->angle[2] = 0;
     gaplant->set_move_collision(gaplant_move, gaplant_coll);
- 
-    for (int i = arm_L_D; i <= foot_L_A; i++) {
+
+    int foot =  sgroot->getSgid("foot_L_A");
+    for (int i = sgroot->getSgid("arm_L_D"); i <= foot; i++) {
 	SceneGraphPtr p = sgroot->createSceneGraph(i);
 	gaplant->addChild(p);
     }