changeset 771:720720e4e8df

fix Test/property_chain
author hiroki
date Sun, 14 Feb 2010 18:56:08 +0900
parents aed3d2501c38
children e53ae444ac6f
files Renderer/Test/property_chain.cc
diffstat 1 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Test/property_chain.cc	Sun Feb 14 04:18:38 2010 +0900
+++ b/Renderer/Test/property_chain.cc	Sun Feb 14 18:56:08 2010 +0900
@@ -53,7 +53,7 @@
 static void set_relation(SceneGraphPtr parent, SceneGraphPtr child);
 
 static void
-init_chain(Property *p, int index) {
+init_chain(Property *p) {
     for (int i = 0; i < 3; i++) {
 	p->xyz[i] = 0;
 	p->angle[i] = 0;
@@ -62,7 +62,7 @@
 	p->v_xyz[i] = 0;
     }
 
-    p->property_index = index;
+    p->property_index = 0;
     p->parent_index = 0;
     p->have_parent = 0;
     p->can_move = TRUE;
@@ -183,6 +183,8 @@
 
     Property *p = (Property *)parent->property;
     Property *c = (Property *)child->property;
+    p->children = (memaddr)child;
+    c->parent = (memaddr)parent;
     c->parent_index = p->property_index;
     c->have_parent = 1;
 
@@ -204,7 +206,7 @@
 
     // property の初期化 application ごとに固有
     for(int i = 0; i < PROPERTY_LENGTH; i++) {
-	init_chain(property[i], i);
+	init_chain(property[i]);
     }
 
     SceneGraphPtr root_chain, chain;
@@ -213,38 +215,27 @@
     root_chain->xyz[0] = screen_w / 2;
     root_chain->xyz[1] = 0.0f;
     root_chain->set_move_collision(move, colliison);
-
+    set_property(&property[0], root_chain, 0);
     
     for (int i = 1; i < PROPERTY_LENGTH; i++) {
 	chain = sgroot->createSceneGraph("CHAIN");
 	chain->xyz[0] = 0;
 	chain->xyz[1] = chain_width * i;
 	chain->angle[1] = -90 * (i % 2);
-
 	root_chain->addChild(chain);
-	// この段階じゃ set_relation はダメか
+	set_property(&property[i], chain, i);
 	set_relation(root_chain, chain);
     }
-    
-    
 
-    SceneGraphPtr moon;
-    moon = sgroot->createSceneGraph("Moon");
-
-    earth->addChild(moon);
-
-    // root の set_property は一通り SceneGraph を作成してから実行
-    // addChild したら set_relation しないとだめ、あんまりにもだめ
-    set_property(&property[root_obj_index], earth, 0);
-    set_property(&property[1], moon, 1);
-    set_relation(earth, moon);
+    // root の set_property は SceneGraph を作成してから実行
+    // addChild したら set_relation しないとだめ、あんまりにもあんまり
 
     /*
       apply_property は post_func の createSceneGraphFromProperty 中で使う
       apply_property は sgroot に持たせてもいいと思います○
     */
     
-    sgroot->setSceneData(earth);
+    sgroot->setSceneData(root_chain);
 
     return sgroot;
 }