/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli co-programmer: ... */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SPATIAL_SEPARATION #include "spatial_separation.h" #include "model.h" #include "quadtree.h" #include "debug.h" #include "compiler.h" ObjectListDefinition(SpatialSeparation); /** * @brief standard constructor * @param model the model that is to be separated * @param overlapSize each box will overlap for a given size * * The boxes are overlaping because this makes collision detection a lot simpler * */ SpatialSeparation::SpatialSeparation (Model* model, float overlapSize) { PRINT(3)("+---------Debug Information SpatialSeparation----------\n"); PRINT(3)("+-| (Event) Spatial Separation process kicked on\n"); this->registerObject(this, SpatialSeparation::_objectList); /* debug vice */ this->createQuadtree(model); } /** * @brief standard constructor * @param model the model that is to be separated * @param overlapSize each box will overlap for a given size The boxes are overlaping because this makes collision detection a lot simpler */ SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel) { this->registerObject(this, SpatialSeparation::_objectList); } /** * @brief standard deconstructor */ SpatialSeparation::~SpatialSeparation () { if( this->quadtree) delete this->quadtree; } /** * @brief creates a quadtree * @param model the model to do a quadtree on * @param minLength the minimal length of a quadtree node * @return the new quadtree */ Quadtree* SpatialSeparation::createQuadtree(Model* model, float minLength) { this->minLength = minLength; } /** * @brief creates a quadtree * @param model the model to do a quadtree on * @param minLength the minimal length of a quadtree node * @return the new quadtree */ Quadtree* SpatialSeparation::createQuadtree(Model* model, int treeDepth) { this->treeDepth = treeDepth; } /** * @brief creates a quadtree * @param model the model to do a quadtree on * @param minLength the minimal length of a quadtree node * @return the new quadtree */ Quadtree* SpatialSeparation::createQuadtree(Model* model) { this->quadtree = new Quadtree(model->getModelInfo(), 4); return this->quadtree; } /** * @brief draws all the quadtrees */ void SpatialSeparation::drawQuadtree() { if( unlikely( this->quadtree == NULL)) return; this->quadtree->drawTree(); }