Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/2d-recalc/src/lib/graphics/spatial_separation/spatial_separation.cc @ 5711

Last change on this file since 5711 was 5075, checked in by bensch, 19 years ago

orxonox/trunk: redirected all printf-output to the shell
This is just for testing purposes, and will be changed again in the future (perhaps)

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
24using namespace std;
25
26
27/**
28 *  standard constructor
29 * @param model the model that is to be separated
30 * @param overlapSize each box will overlap for a given size
31
32   The boxes are overlaping because this makes collision detection a lot simpler
33
34 */
35SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize)
36{
37  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
38  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
39
40  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
41  /* debug vice */
42  this->createQuadtree(model);
43}
44
45
46/**
47 *  standard constructor
48 * @param model the model that is to be separated
49 * @param overlapSize each box will overlap for a given size
50
51   The boxes are overlaping because this makes collision detection a lot simpler
52 */
53SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel)
54{
55  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
56
57}
58
59
60/**
61 *  standard deconstructor
62 */
63SpatialSeparation::~SpatialSeparation ()
64{
65  if( this->quadtree)
66    delete this->quadtree;
67}
68
69
70/**
71 *  creates a quadtree
72 * @param model the model to do a quadtree on
73 * @param minLength the minimal length of a quadtree node
74 * @return the new quadtree
75 */
76Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength)
77{
78  this->minLength = minLength;
79
80}
81
82
83/**
84 *  brief creates a quadtree
85 * @param model the model to do a quadtree on
86 * @param minLength the minimal length of a quadtree node
87 * @return the new quadtree
88 */
89Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth)
90{
91  this->treeDepth = treeDepth;
92}
93
94
95/**
96 *  creates a quadtree
97 * @param model the model to do a quadtree on
98 * @param minLength the minimal length of a quadtree node
99 * @return the new quadtree
100 */
101Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model)
102{
103  this->quadtree = new Quadtree(model->getModelInfo(), 4);
104
105  return this->quadtree;
106}
107
108
109/**
110 *  draws all the quadtrees
111 */
112void SpatialSeparation::drawQuadtree()
113{
114  if( unlikely( this->quadtree == NULL))
115    return;
116
117  this->quadtree->drawTree();
118}
119
120
121
122
123
124
125
126
127
128
129
130
Note: See TracBrowser for help on using the repository browser.