Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/collision_detection/obb_tree.cc @ 4581

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

orxonox/trunk: axis get drawn, still strange values, debug

File size: 2.4 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_COLLISION
17
18#include "obb_tree.h"
19#include "obb_tree_node.h"
20#include "obb.h"
21#include "debug.h"
22#include "compiler.h"
23
24using namespace std;
25
26
27/**
28   \brief standard constructor
29*/
30OBBTree::OBBTree ()
31{
32   this->setClassID(CL_OBB_TREE, "OBBTree");
33
34}
35
36
37/**
38   \brief standard deconstructor
39
40*/
41OBBTree::~OBBTree ()
42{
43  // delete what has to be deleted here
44}
45
46
47void OBBTree::spawnBVTree(int depth, sVec3D *verticesList, const int length)
48{
49  if( unlikely(this->rootNode != NULL))
50    {
51      PRINTF(2)("The BVTree has already been spawned, flushing and respawning again...\n");
52      this->flushTree();
53    }
54  OBBTreeNode* node = new OBBTreeNode();
55  this->rootNode = node;
56  this->rootNode->spawnBVTree(depth, verticesList, length);
57}
58
59
60void OBBTree:: flushTree()
61{}
62
63
64void OBBTree::collideWith(const OBBTree &tree)
65{}
66
67
68void OBBTree::drawBV(int currentDepth, const int depth) const
69{
70  if( likely(this->rootNode != NULL))
71  {
72    this->rootNode->drawBV(currentDepth, depth);
73    this->rootNode->drawBVPolygon(currentDepth, depth);
74  }
75}
76
77
78void OBBTree::drawBVPolygon(int currentDepth, const int depth) const
79{
80  if( likely(this->rootNode != NULL))
81    this->rootNode->drawBVPolygon(currentDepth, depth);
82}
83
84
85void OBBTree::drawBVBlended(int currentDepth, const int depth) const
86{
87  if( likely(this->rootNode != NULL))
88    this->rootNode->drawBVBlended(currentDepth, depth);
89}
90
91
92void OBBTree::debug()
93{
94  PRINT(0)("\n==============================| OBBTree::debug() |===\n");
95  PRINT(0)("=  Spawning Tree: Start\n");
96
97  /* generate some test vertices */
98  sVec3D* vertList = new sVec3D[3];
99  sVec3D data[]  = {{0.0, 0.0, 0.0},{10.0, -5.0, 0.0},{10.0, 5.0, 0.0}};
100
101  for(int i = 0; i < 3; ++i)
102    {
103      vertList[i][0] = data[i][0];
104      vertList[i][1] = data[i][1];
105      vertList[i][2] = data[i][2];
106    }
107
108  this->spawnBVTree(1, vertList, 3);
109
110  PRINT(0)("=  Spawning Tree: Finished\n");
111  PRINT(0)("=======================================================\n");
112
113}
Note: See TracBrowser for help on using the repository browser.