Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: merged the proxy back

merged with commandsvn merge -r9346:HEAD https://svn.orxonox.net/orxonox/branches/proxy .

no conflicts

File size: 2.6 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
26
[9406]27
[4790]28/**
[4836]29 *  standard constructor
30 * @param model the model that is to be separated
31 * @param overlapSize each box will overlap for a given size
[4810]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
[4923]41  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
42  /* debug vice */
43  this->createQuadtree(model);
[4790]44}
45
[4923]46
[4810]47/**
[4836]48 *  standard constructor
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{
56  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
57
58}
59
60
[4790]61/**
[4836]62 *  standard deconstructor
[4923]63 */
[4790]64SpatialSeparation::~SpatialSeparation ()
65{
[4968]66  if( this->quadtree)
67    delete this->quadtree;
[4790]68}
[4819]69
70
71/**
[4923]72 *  creates a quadtree
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/**
[4923]85 *  brief creates a quadtree
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/**
[4923]97 *  creates a quadtree
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/**
111 *  draws all the quadtrees
112 */
[4889]113void SpatialSeparation::drawQuadtree()
114{
115  if( unlikely( this->quadtree == NULL))
116    return;
[4819]117
[4922]118  this->quadtree->drawTree();
[4889]119}
[4819]120
121
[4842]122
123
124
125
126
127
128
129
130
131
Note: See TracBrowser for help on using the repository browser.