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 "quadtree.h" |
---|
19 | #include "quadtree_node.h" |
---|
20 | #include "material.h" |
---|
21 | |
---|
22 | using namespace std; |
---|
23 | |
---|
24 | |
---|
25 | /** |
---|
26 | * standard constructor |
---|
27 | @todo this constructor is not jet implemented - do it |
---|
28 | */ |
---|
29 | Quadtree::Quadtree (modelInfo* pModelInfo, const int treeDepth) |
---|
30 | { |
---|
31 | this->setClassID(CL_QUADTREE, "Quadtree"); |
---|
32 | this->pModelInfo = pModelInfo; |
---|
33 | this->treeDepth = treeDepth; |
---|
34 | |
---|
35 | this->materials = new Material*[4]; |
---|
36 | for(int i = 0; i < 4; ++i) |
---|
37 | { |
---|
38 | materials[i] = new Material(); |
---|
39 | materials[i]->setIllum(3); |
---|
40 | } |
---|
41 | materials[0]->setAmbient(0.0, 0.3, 0.0); |
---|
42 | materials[1]->setAmbient(0.4, 0.0, 0.2); |
---|
43 | materials[2]->setAmbient(1.0, 0.0, 0.0); |
---|
44 | materials[3]->setAmbient(5.0, 3.0, 1.0); |
---|
45 | |
---|
46 | |
---|
47 | this->rootNode = new QuadtreeNode(this->pModelInfo, this, this->treeDepth); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | /** |
---|
52 | * standard deconstructor |
---|
53 | |
---|
54 | */ |
---|
55 | Quadtree::~Quadtree () |
---|
56 | { |
---|
57 | // delete what has to be deleted here |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | /** |
---|
62 | * draws the debug quadtree boxes around the model |
---|
63 | */ |
---|
64 | void Quadtree::drawTree(int depth, int drawMode) const |
---|
65 | { |
---|
66 | this->rootNode->drawTree(depth, drawMode); |
---|
67 | } |
---|