Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc @ 9869

Last change on this file since 9869 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.7 KB
RevLine 
[4790]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
[4923]11### File Specific:
[4791]12   main-programmer: Patrick Boenzli
[4790]13   co-programmer: ...
14*/
15
[4808]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SPATIAL_SEPARATION
[4790]17
18#include "spatial_separation.h"
[5075]19
[6022]20#include "model.h"
[4819]21#include "quadtree.h"
[5075]22#include "debug.h"
[5427]23#include "compiler.h"
[4790]24
25
[9869]26ObjectListDefinition(SpatialSeparation);
[4790]27
28/**
[9869]29 * @brief standard constructor
[4836]30 * @param model the model that is to be separated
31 * @param overlapSize each box will overlap for a given size
[9869]32 *
33 * The boxes are overlaping because this makes collision detection a lot simpler
34 *
[4923]35 */
[6022]36SpatialSeparation::SpatialSeparation (Model* model, float overlapSize)
[4790]37{
[4887]38  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
39  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
40
[9869]41  this->registerObject(this, SpatialSeparation::_objectList);
[4923]42  /* debug vice */
43  this->createQuadtree(model);
[4790]44}
45
[4923]46
[4810]47/**
[9869]48 * @brief standard constructor
[4836]49 * @param model the model that is to be separated
50 * @param overlapSize each box will overlap for a given size
[4790]51
[4810]52   The boxes are overlaping because this makes collision detection a lot simpler
53 */
[6022]54SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel)
[4810]55{
[9869]56  this->registerObject(this, SpatialSeparation::_objectList);
[4810]57
58}
59
60
[4790]61/**
[9869]62 * @brief standard deconstructor
[4923]63 */
[4790]64SpatialSeparation::~SpatialSeparation ()
65{
[4968]66  if( this->quadtree)
67    delete this->quadtree;
[4790]68}
[4819]69
70
71/**
[9869]72 * @brief creates a quadtree
[4923]73 * @param model the model to do a quadtree on
74 * @param minLength the minimal length of a quadtree node
75 * @return the new quadtree
[4819]76 */
[6022]77Quadtree* SpatialSeparation::createQuadtree(Model* model, float minLength)
[4819]78{
79  this->minLength = minLength;
80
81}
82
83
84/**
[9869]85 * @brief creates a quadtree
[4923]86 * @param model the model to do a quadtree on
87 * @param minLength the minimal length of a quadtree node
88 * @return the new quadtree
[4819]89 */
[6022]90Quadtree* SpatialSeparation::createQuadtree(Model* model, int treeDepth)
[4819]91{
92  this->treeDepth = treeDepth;
93}
94
95
96/**
[9869]97 * @brief creates a quadtree
[4923]98 * @param model the model to do a quadtree on
99 * @param minLength the minimal length of a quadtree node
100 * @return the new quadtree
101 */
[6022]102Quadtree* SpatialSeparation::createQuadtree(Model* model)
[4819]103{
[4922]104  this->quadtree = new Quadtree(model->getModelInfo(), 4);
[4819]105
106  return this->quadtree;
107}
108
109
[4923]110/**
[9869]111 * @brief draws all the quadtrees
[4923]112 */
[4889]113void SpatialSeparation::drawQuadtree()
114{
115  if( unlikely( this->quadtree == NULL))
116    return;
[4819]117
[4922]118  this->quadtree->drawTree();
[4889]119}
Note: See TracBrowser for help on using the repository browser.