Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4914 was 4914, checked in by patrick, 19 years ago

orxonox/trunk: the hashing function now works perfect

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