diff TaskManager/Test/test_render/universe.cpp @ 228:5bb12a76a335 draft

remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Thu, 12 Feb 2009 16:31:38 +0900
parents 0351818cf0fe
children ce86b0186a4a
line wrap: on
line diff
--- a/TaskManager/Test/test_render/universe.cpp	Wed Feb 11 11:09:39 2009 +0900
+++ b/TaskManager/Test/test_render/universe.cpp	Thu Feb 12 16:31:38 2009 +0900
@@ -2,8 +2,6 @@
 #include "SceneGraphRoot.h"
 #include "SGList.h"
 
-int moonrem = 0;
-
 static void
 earth_collision(SceneGraphPtr node, int screen_w, int screen_h,
 	       SceneGraphPtr tree)
@@ -20,32 +18,15 @@
 moon_move(SceneGraphPtr node, int screen_w, int screen_h)
 {
     node->angle[0] += 3.0f;
-#if 0
-    if (node->angle[0] > 360.0f) {
-	node->remove();
-	//node->angle[0] = 0.0f;
-	moonrem = 1;
-    }
-#endif
 }
 
 
 static void
 earth_move(SceneGraphPtr node, int screen_w, int screen_h)
 {
-    return;
-
     node->angle[1] += 1.0f;
     if (node->angle[1] > 360.0f) {
 	node->angle[1] = 0.0f;
-#if 0
-	if (moonrem) {
-	    SceneGraphPtr moon = sgroot->createSceneGraph(Moon);
-	    moon->set_move_collision(moon_move, moon_collision);
-	    node->addChild(moon);
-	    moonrem = 0;
-	}
-#endif
     }
 
     node->xyz[0] += node->stack_xyz[0];
@@ -63,7 +44,7 @@
 universe_init(void)
 {
     SceneGraphPtr earth;
-    //SceneGraphPtr moon;
+    SceneGraphPtr moon;
 
     sgroot->createFromXMLfile("xml_file/universe.xml");
 
@@ -72,16 +53,14 @@
 
     // SceneGraph の move と collision を設定
     earth->set_move_collision(earth_move, earth_collision);
-    earth->xyz[0] = 960.0f;
-    earth->xyz[1] = 540.0f;
     earth->stack_xyz[0] = 3.0f;
     earth->stack_xyz[1] = 3.0f;
-
-    //moon = sgroot->createSceneGraph(Moon);
-    //moon->set_move_collision(moon_move, moon_collision);
+    
+    moon = sgroot->createSceneGraph(Moon);
+    moon->set_move_collision(moon_move, moon_collision);
     
     // SceneGraph 同士の親子関係を設定 (今回は 親 earth、子 moon)
-    //earth->addChild(moon);
+    earth->addChild(moon);
 
     // SceneGraphRoot に、使用する SceneGraph を設定する
     // このとき、ユーザーが記述した SceneGraph の root を渡す。