Changeset 4923 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 21, 2005, 4:27:06 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/cd_engine.cc
r4921 r4923 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli 13 13 co-programmer: ... … … 36 36 /** 37 37 * standard constructor 38 */38 */ 39 39 CDEngine::CDEngine () 40 40 { 41 this->setClassID(CL_CD_ENGINE, "CDEngine"); 42 43 /* testing purposes only: */ 44 //this->rootTree = new OBBTree(); 45 } 46 47 /** 48 * the singleton reference to this class 49 */ 50 CDEngine* CDEngine::singletonRef = NULL; 51 52 /** 53 * standard deconstructor 54 55 */ 56 CDEngine::~CDEngine () 57 { 58 CDEngine::singletonRef = NULL; 59 41 this->setClassID(CL_CD_ENGINE, "CDEngine"); 60 42 } 61 43 62 44 63 45 /** 64 \brief this is the collision checking function 46 * the singleton reference to this class 47 */ 48 CDEngine* CDEngine::singletonRef = NULL; 65 49 66 there are some speed improvements that can be done here. a rewrite of the list a would be appropriate to 67 be able to enhance iteration speed. 50 51 /** 52 * standard deconstructor 53 */ 54 CDEngine::~CDEngine () 55 { 56 CDEngine::singletonRef = NULL; 57 } 58 59 60 /** 61 * this is the collision checking function 62 63 there are some speed improvements that can be done here. a rewrite of the list a would be appropriate to 64 be able to enhance iteration speed. 68 65 */ 69 66 void CDEngine::checkCollisions() -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4922 r4923 17 17 18 18 #include "quadtree.h" 19 19 20 #include "quadtree_node.h" 20 21 #include "material.h" -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r4922 r4923 17 17 18 18 #include "quadtree_node.h" 19 19 20 #include "quadtree.h" 20 21 #include "material.h" … … 94 95 95 96 /** 96 * takes the rest of the initialisation process97 * takes the rest of the initialisation process 97 98 */ 98 99 void QuadtreeNode::init() … … 136 137 137 138 /** 138 139 \brief this functions builds up a hash table containing all leafs of the Quadtree in a sorted array 140 \param nodeList the nodelist array to add them 141 \param index the current index in the array 142 143 The algorithm used for this purpose is home-brown. its not to fast but and the nodes are not always in the right 144 order. this is why there will be needed a quicksort later on. 139 145 */ 140 146 void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index) … … 160 166 * gives the signal to separate the model into a quadtree 161 167 * @param treeDepth the max depth, the steps to go if treeDept == 0 leaf reached 162 */168 */ 163 169 void QuadtreeNode::separateNode(float minLength) 164 170 { … … 361 367 362 368 369 /** 370 * checks if a point is included in this quadtree 371 * @param v the vector to be checked 372 * @returns true if the vector is included 373 */ 363 374 bool QuadtreeNode::includesPoint(const Vector& v) 364 375 { … … 377 388 378 389 /** 379 * draws the debug quadtree boxes around the model390 * draws all the debug quadtree squares 380 391 */ 381 392 void QuadtreeNode::drawTree() const … … 408 419 409 420 421 /** 422 * draws only this quadtree square 423 */ 410 424 void QuadtreeNode::draw() const 411 425 { -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
r4922 r4923 1 1 /*! 2 3 * Definition of ...2 * \file proto_class.h 3 * Definition of a QuadtreeNode which represents a quad in a Quadtree 4 4 5 This struct is used to partition big land scapes into smaller ones for different reasons: 6 - for collision detection: only a subset of all triangles need to be tested vs a given body 7 - for object culling purposes: the quadtrees that are not in the field of view can be ommitted in the draw process 8 - for LOD (level of Detail). The models can be drawn using different LODs depending on the distance 9 10 This struct includes all the triangles, vertices, normal informations needed to make something usefull with 11 a terrain partition. 5 12 */ 6 13 … … 23 30 const float* pVertices, int numVertices, 24 31 Quadtree* quadtree, QuadtreeNode* parent, 25 Rectangle* rect, int treeDepth, const int maxDepth, int index); 32 Rectangle* rect, int treeDepth, const int maxDepth, int index 33 ); 26 34 QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth); 27 35 virtual ~QuadtreeNode(); 28 36 29 37 void buildHashTable(QuadtreeNode** nodeList, int* index); 30 38 bool includesPoint(const Vector& v); 31 39 float getHeight(const Vector& position); 32 Rectangle* getDimension() { return this->pDimension; } 33 34 bool includesPoint(const Vector& v); 40 inline Rectangle* getDimension() { return this->pDimension; } 35 41 36 42 void drawTree() const; … … 43 49 void separateNode(float minLength); 44 50 void separateNode(); 51 Rectangle* getDimFromModel(); 45 52 46 Rectangle* getDimFromModel();47 53 48 54 protected: … … 53 59 QuadtreeNode* nodeD; //!< reference to the node D 54 60 QuadtreeNode** nodes; //!< reference to the quadtree nodes 55 int nodeIter; //!< temp helping variable for the hashing algorithm 61 56 62 57 63 private: … … 65 71 int maxDepth; //!< the maximal depth of the tree 66 72 int indexNode; //!< the index number of the node 73 int nodeIter; //!< temp helping variable for the hashing algorithm 67 74 68 75 sTriangleExt** pTriangles; //!< reference to the triangles of the node -
orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
r4922 r4923 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli 13 13 co-programmer: ... … … 30 30 The boxes are overlaping because this makes collision detection a lot simpler 31 31 32 */32 */ 33 33 SpatialSeparation::SpatialSeparation (AbstractModel* model, float overlapSize) 34 34 { 35 PRINT(3)("\n");36 35 PRINT(3)("+---------Debug Information SpatialSeparation----------\n"); 37 36 PRINT(3)("+-| (Event) Spatial Separation process kicked on\n"); 38 37 39 40 41 38 this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation"); 39 /* debug vice */ 40 this->createQuadtree(model); 42 41 } 42 43 43 44 44 /** … … 48 48 49 49 The boxes are overlaping because this makes collision detection a lot simpler 50 51 50 */ 52 51 SpatialSeparation::SpatialSeparation (AbstractModel* model, AbstractModel* playerModel) … … 59 58 /** 60 59 * standard deconstructor 61 62 */ 60 */ 63 61 SpatialSeparation::~SpatialSeparation () 64 62 { … … 67 65 68 66 /** 69 \briefcreates a quadtree70 * @param model the model to do a quadtree on71 * @param minLength the minimal length of a quadtree node72 \return the new quadtree67 * creates a quadtree 68 * @param model the model to do a quadtree on 69 * @param minLength the minimal length of a quadtree node 70 * @return the new quadtree 73 71 */ 74 72 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, float minLength) … … 80 78 81 79 /** 82 \brief creates a quadtree83 * @param model the model to do a quadtree on84 * @param minLength the minimal length of a quadtree node85 \return the new quadtree80 * brief creates a quadtree 81 * @param model the model to do a quadtree on 82 * @param minLength the minimal length of a quadtree node 83 * @return the new quadtree 86 84 */ 87 85 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model, int treeDepth) … … 92 90 93 91 /** 94 \briefcreates a quadtree95 * @param model the model to do a quadtree on96 * @param minLength the minimal length of a quadtree node97 \return the new quadtree98 */92 * creates a quadtree 93 * @param model the model to do a quadtree on 94 * @param minLength the minimal length of a quadtree node 95 * @return the new quadtree 96 */ 99 97 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model) 100 98 { … … 105 103 106 104 107 105 /** 106 * draws all the quadtrees 107 */ 108 108 void SpatialSeparation::drawQuadtree() 109 109 {
Note: See TracChangeset
for help on using the changeset viewer.