예제 #1
0
void GameEngine::KeyboardEvent(System::Event &event)
{
  _camera->KeyboardEvent(event);
  if (event.type == System::Event::KeyPressed)
    {
      if (event.key.code == System::Key::Space)
	{
	  Octree *oct = _entity->data->As<Octree>();
	  if (oct->DrawOutlines() == false)
	    oct->DrawOutlines(true);
	  else
	    oct->DrawOutlines(false);
	}
    }
}
예제 #2
0
void GameEngine::Generate(Entity *node, Graphic::Object *obj)
{
  Vector2f	size(40, 40);
  Octree	*oct = new Octree(Box3f(Vector3f(0,0,0),Vector3f(50,50,50)));
  Box3f		box;

  node->data = oct;
  std::list<std::pair<Box3f,ISceneNode*> > listToInsert;
  for (unsigned int i = 0; i < size[0]; ++i)
    {
      for (unsigned int j = 0; j < size[1]; ++j)
        {
          Graphic::Object *newObj = obj->Clone()->As<Graphic::Object>();
          newObj->Matrix.Translation(i,j,0);
          newObj->GetReelBox(box);
          listToInsert.push_front(std::pair<Box3f,ISceneNode*>(box, newObj));
        }
    }
  obj->Matrix.Translation(42,42,42);
  obj->GetReelBox(box);
  listToInsert.push_front(std::pair<Box3f,ISceneNode*>(box, obj));

  oct->Insert(listToInsert, 16);
  oct->DrawOutlines(true);
}