# HG changeset patch # User gongo@charles.cr.ie.u-ryukyu.ac.jp # Date 1227847914 -32400 # Node ID c948f4ebde626cdb121a421b163beffc0553c1bc # Parent 3fd24be89d02f44ef8e30a9cc6328b60b03ad042 fix diff -r 3fd24be89d02 -r c948f4ebde62 TaskManager/Test/test_render/SceneGraph.cpp --- a/TaskManager/Test/test_render/SceneGraph.cpp Fri Nov 28 12:16:24 2008 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.cpp Fri Nov 28 13:51:54 2008 +0900 @@ -152,6 +152,10 @@ this->brother = bro; } + if (this->parent) { + parent->addChild(bro); + } + return bro; } diff -r 3fd24be89d02 -r c948f4ebde62 TaskManager/Test/test_render/node.cpp --- a/TaskManager/Test/test_render/node.cpp Fri Nov 28 12:16:24 2008 +0900 +++ b/TaskManager/Test/test_render/node.cpp Fri Nov 28 13:51:54 2008 +0900 @@ -1,7 +1,8 @@ +#include #include "SceneGraph.h" #include "xml_file/universe.h" #include "xml_file/cube.h" - +#include "xml_file/snake576x384.h" static void earth_move(SceneGraphPtr node, int screen_w, int screen_h) @@ -87,14 +88,17 @@ node->xyz[1] += node->stack_xyz[1]; if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { + srandom(random()); + SceneGraphPtr p = node->clone(); p->position_init(); node->addBrother(p); scene_graph->set_move_collision(p, cube_move2, cube_collision); - p->stack_xyz[0] = 0.5f; - p->stack_xyz[1] = 0.5f; + p->stack_xyz[0] = (float)(random() % 5); + p->stack_xyz[1] = (float)(random() % 5); //p->xyz[0] = screen_w/2; //p->xyz[1] = screen_h/2; + p->xyz[2] = node->xyz[2]+1000.0f; node->stack_xyz[1] = -node->stack_xyz[1]; } @@ -104,11 +108,12 @@ node_init(void) { #if 0 - scene_graph->set_move_collision(Earth, earth_move, earth_collision); - scene_graph->set_move_collision(Moon, moon_move, moon_collision); + //scene_graph->set_move_collision(Earth, earth_move, earth_collision); + //scene_graph->set_move_collision(Moon, moon_move, moon_collision); + //scene_graph->set_move_collision(Plain, cube_move, cube_collision); #else scene_graph->set_move_collision(Cube, cube_move, cube_collision); - Cube->stack_xyz[0] = 0.5f; - Cube->stack_xyz[1] = 0.5f; + Cube->stack_xyz[0] = 2.0f; + Cube->stack_xyz[1] = 2.0f; #endif }