Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/lib/graphics/spatial_separation/spatial_separation.cc @ 6014

Last change on this file since 6014 was 5427, checked in by bensch, 19 years ago

orxonox/trunk: some minor include stuff

File size: 2.7 KB
Line 
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
11### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_SPATIAL_SEPARATION
17
18#include "spatial_separation.h"
19
20#include "abstract_model.h"
21#include "quadtree.h"
22#include "debug.h"
23#include "compiler.h"
24
25using namespace std;
26
27
28/**
29 *  standard constructor
30 * @param model the model that is to be separated
31 * @param overlapSize each box will overlap for a given size
32
33   The boxes are overlaping because this makes collision detection a lot simpler
34
35 */
36SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
37{
38  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
39  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
40
41  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
42  /* debug vice */
43  this->createQuadtree(model);
44}
45
46
47/**
48 *  standard constructor
49 * @param model the model that is to be separated
50 * @param overlapSize each box will overlap for a given size
51
52   The boxes are overlaping because this makes collision detection a lot simpler
53 */
54SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel)
55{
56  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
57
58}
59
60
61/**
62 *  standard deconstructor
63 */
64SpatialSeparation::~SpatialSeparation ()
65{
66  if( this->quadtree)
67    delete this->quadtree;
68}
69
70
71/**
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
76 */
77Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength)
78{
79  this->minLength = minLength;
80
81}
82
83
84/**
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
89 */
90Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth)
91{
92  this->treeDepth = treeDepth;
93}
94
95
96/**
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 */
102Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
103{
104  this->quadtree = new Quadtree(model->getModelInfo(), 4);
105
106  return this->quadtree;
107}
108
109
110/**
111 *  draws all the quadtrees
112 */
113void SpatialSeparation::drawQuadtree()
114{
115  if( unlikely( this->quadtree == NULL))
116    return;
117
118  this->quadtree->drawTree();
119}
120
121
122
123
124
125
126
127
128
129
130
131
Note: See TracBrowser for help on using the repository browser.