changeset 339:be8f785a82e9

change api setSceneDate
author e065725@yutaka.st.ie.u-ryukyu.ac.jp
date Sat, 27 Jun 2009 20:42:51 +0900
parents 2964ed8fd321
children e32846d80b4a
files TaskManager/Test/test_render/SceneGraphRoot.cpp
diffstat 1 files changed, 36 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/SceneGraphRoot.cpp	Sat Jun 27 20:30:26 2009 +0900
+++ b/TaskManager/Test/test_render/SceneGraphRoot.cpp	Sat Jun 27 20:42:51 2009 +0900
@@ -184,38 +184,41 @@
     camera->children = NULL;
     camera->lastChild = NULL;
 
-    while (t) {
-	SceneGraphPtr c = t->clone();
+    /*まずは全部動作させる*/
+    while (list) {
 
-	addNext(c);
-	cur_parent->addChild(c);
-	c->frame = t->frame;
+        list->move_execute(screen_w, screen_h);
+        list->collision_check(screen_w, screen_h, list);	
+        
+	list->frame++; 
+        list = list->next;
 
-	c->move_execute(screen_w, screen_h);
-	c->collision_check(screen_w, screen_h, list);
+    }
 
-	if (c->isRemoved()) {
-	    sg_exec_tree = c->realRemoveFromTree(cur_parent);
-	    sg_available_list = c->realRemoveFromList(sg_available_list);
-	    delete c;
-	    cnt--;
-	    t->children = NULL;
-	    t->parent = cur_parent;
-	} else {
-	    c->frame++;
-	    get_matrix(c->matrix, c->angle, c->xyz, c->parent->matrix);
-	}
+    if(sg_exec_tree != NULL) {
+      return;
+    }
 
-	if (t->children != NULL) {
+    /*removeのflagをもとにtreeを形成*/
+    while (t) {
+	SceneGraphPtr c = NULL;
+	if (!t->isRemoved()) {
+	    c = t->clone();	    
+	    addNext(c);
+	    cur_parent->addChild(c);
+	    c->frame = t->frame;
+            /*親の回転、座標から、子の回転、座標を算出*/
+            get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix);
+        } 
+
+	if (t->children != NULL && c != NULL) {
 	    cur_parent = c;
 	    t = t->children;
 	} else if (t->brother != NULL) {
-	    cur_parent = c->parent;
 	    t = t->brother;
 	} else {
 	    while (t) {
 		if (t->brother != NULL) {
-		    cur_parent = t->parent;
 		    t = t->brother;
 		    break;
 		} else {
@@ -223,15 +226,25 @@
 			t = NULL;
 			break;
 		    } else {
-			t = t->parent;
+                        cur_parent = cur_parent->parent;
+                        t = t->parent;
+			
 		    }
 		}
-	    }
+	    }	    
 	}
     }
 
+      
+
     // 現在、allExecute が終わった時点では
     // camera->children が User SceneGraph の root になる
+
+    /**
+     * NULL じゃなかったら、setSceneData が呼ばれてるから
+     * そっちを次の Scene にする
+     */
+
     sg_exec_tree = camera->children;
 }