Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/test/src/lib/graphics/spatial_separation/spatial_separation.cc @ 10611

Last change on this file since 10611 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
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 "model.h"
21#include "quadtree.h"
22#include "debug.h"
23#include "compiler.h"
24
25
26ObjectListDefinition(SpatialSeparation);
27
28/**
29 * @brief 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 (Model* model, float overlapSize)
37{
38  PRINT(3)("+---------Debug Information SpatialSeparation----------\n");
39  PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
40
41  this->registerObject(this, SpatialSeparation::_objectList);
42  /* debug vice */
43  this->createQuadtree(model);
44}
45
46
47/**
48 * @brief 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 (Model* model, Model* playerModel)
55{
56  this->registerObject(this, SpatialSeparation::_objectList);
57
58}
59
60
61/**
62 * @brief standard deconstructor
63 */
64SpatialSeparation::~SpatialSeparation ()
65{
66  if( this->quadtree)
67    delete this->quadtree;
68}
69
70
71/**
72 * @brief 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(Model* 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(Model* model, int treeDepth)
91{
92  this->treeDepth = treeDepth;
93}
94
95
96/**
97 * @brief 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(Model* model)
103{
104  this->quadtree = new Quadtree(model->getModelInfo(), 4);
105
106  return this->quadtree;
107}
108
109
110/**
111 * @brief draws all the quadtrees
112 */
113void SpatialSeparation::drawQuadtree()
114{
115  if( unlikely( this->quadtree == NULL))
116    return;
117
118  this->quadtree->drawTree();
119}
Note: See TracBrowser for help on using the repository browser.