- Timestamp:
- Jun 13, 2005, 6:25:54 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/bv_tree.h
r4553 r4622 1 /*! 1 /*! 2 2 \file bv_tree.h 3 3 \brief Definition of a bounding volume tree … … 27 27 28 28 29 virtual void drawBV(int currentDepth, const intdepth) const = NULL;30 virtual void drawBVPolygon(int currentDepth, const intdepth) const = NULL;31 virtual void drawBVBlended(int currentDepth, const intdepth) const = NULL;29 virtual void drawBV(int depth) const = NULL; 30 virtual void drawBVPolygon(int depth) const = NULL; 31 virtual void drawBVBlended(int depth) const = NULL; 32 32 33 33 protected: -
orxonox/trunk/src/lib/collision_detection/cd_engine.cc
r4615 r4622 53 53 54 54 55 void CDEngine::drawBV(int currentDepth, const intdepth) const55 void CDEngine::drawBV(int depth) const 56 56 { 57 57 /* this would operate on worldList bases, for testing purposes, we only use one OBBTree */ 58 this->rootTree->drawBV( currentDepth,depth);58 this->rootTree->drawBV(depth); 59 59 } 60 60 61 61 62 void CDEngine::drawBVPolygon(int currentDepth, const intdepth) const62 void CDEngine::drawBVPolygon(int depth) const 63 63 {} 64 64 65 65 66 void CDEngine::drawBVBlended(int currentDepth, const intdepth) const66 void CDEngine::drawBVBlended(int depth) const 67 67 {} 68 68 -
orxonox/trunk/src/lib/collision_detection/cd_engine.h
r4615 r4622 44 44 void disable(const int options) { int temp = this->state & options; this->state ^= temp; } 45 45 46 void drawBV(int currentDepth, const intdepth) const;47 void drawBVPolygon(int currentDepth, const intdepth) const;48 void drawBVBlended(int currentDepth, const intdepth) const;46 void drawBV(int depth) const; 47 void drawBVPolygon(int depth) const; 48 void drawBVBlended(int depth) const; 49 49 50 50 void checkCollisions(); -
orxonox/trunk/src/lib/collision_detection/obb_tree.cc
r4618 r4622 26 26 27 27 28 Material* OBBTree::material = NULL;29 30 28 /** 31 29 \brief standard constructor … … 34 32 { 35 33 this->setClassID(CL_OBB_TREE, "OBBTree"); 36 material = new Material("Tree"); 37 material->setIllum(3); 38 material->setAmbient(1.0, 1.0, 1.0); 34 35 material = new Material*[3]; 36 for(int i = 0; i < 3; ++i) 37 { 38 material[i] = new Material(); 39 material[i]->setIllum(0); 40 } 41 material[0]->setAmbient(0.0, 0.3, 0.0); 42 material[1]->setAmbient(0.0, 0.0, 0.2); 43 material[2]->setAmbient(1.0, 0.0, 0.0); 39 44 } 40 45 … … 59 64 OBBTreeNode* node = new OBBTreeNode(); 60 65 this->rootNode = node; 66 this->rootNode->setTreeRef(this); 61 67 this->rootNode->spawnBVTree(depth, verticesList, length); 62 68 } … … 71 77 72 78 73 void OBBTree::drawBV(int currentDepth, const intdepth) const79 void OBBTree::drawBV(int depth) const 74 80 { 75 81 if( likely(this->rootNode != NULL)) 76 82 { 77 this->rootNode->drawBV( currentDepth);78 this->rootNode->drawBVPolygon( currentDepth);83 this->rootNode->drawBV(depth); 84 this->rootNode->drawBVPolygon(depth); 79 85 } 80 86 } 81 87 82 88 83 void OBBTree::drawBVPolygon(int currentDepth, const intdepth) const89 void OBBTree::drawBVPolygon(int depth) const 84 90 { 85 91 if( likely(this->rootNode != NULL)) 86 this->rootNode->drawBVPolygon( currentDepth);92 this->rootNode->drawBVPolygon(depth); 87 93 } 88 94 89 95 90 void OBBTree::drawBVBlended(int currentDepth, const intdepth) const96 void OBBTree::drawBVBlended(int depth) const 91 97 { 92 98 if( likely(this->rootNode != NULL)) 93 this->rootNode->drawBVBlended( currentDepth);99 this->rootNode->drawBVBlended(depth); 94 100 } 95 101 -
orxonox/trunk/src/lib/collision_detection/obb_tree.h
r4616 r4622 27 27 void collideWith(const OBBTree &tree); 28 28 29 virtual void drawBV(int currentDepth, const int depth) const; 30 virtual void drawBVPolygon(int currentDepth, const int depth) const; 31 virtual void drawBVBlended(int currentDepth, const int depth) const; 29 virtual void drawBV(int depth) const; 30 virtual void drawBVPolygon(int depth) const; 31 virtual void drawBVBlended(int depth) const; 32 33 Material* getMaterial(unsigned int depth) { return material[depth%3]; } 32 34 33 35 void debug(); 34 36 35 37 public: 36 static Material* material; 38 37 39 38 40 39 41 private: 40 42 OBBTreeNode* rootNode; //!< reference to the root node of the tree 43 Material** material; 41 44 42 45 }; -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4618 r4622 41 41 using namespace std; 42 42 43 OBBTree* OBBTreeNode::obbTree = NULL; 43 44 44 45 /** … … 391 392 void OBBTreeNode::drawBV(int depth) const 392 393 { 393 // glBegin(GL_LINE_LOOP);394 //glColor3f(1.0, 1.0, 1.0);395 //for(int i = 0; i < this->bvElement->numOfVertices; ++i)396 //{397 //glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);398 ////printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]);399 //}400 //glEnd();401 //this->drawBVPolygon( currentDepth,depth);394 glBegin(GL_TRIANGLES); 395 glColor3f(1.0, 1.0, 1.0); 396 for(int i = 0; i < this->bvElement->numOfVertices; ++i) 397 { 398 glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]); 399 //printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]); 400 } 401 glEnd(); 402 //this->drawBVPolygon(depth); 402 403 } 403 404 … … 405 406 void OBBTreeNode::drawBVPolygon(int depth) const 406 407 { 407 408 OBBTree::material->select(); 408 //OBBTree::material->select(); 409 410 this->obbTree->getMaterial(depth)->select(); 409 411 410 412 /* draw world axes */ … … 520 522 glEnd(); 521 523 522 if( this->nodeLeft != NULL && depth != 0 )523 this->nodeLeft->drawBVPolygon(depth - 1);524 if( this->nodeLeft != NULL && depth != 0 ) 525 this->nodeLeft->drawBVPolygon(depth - 1); 524 526 if( this->nodeRight != NULL && depth != 0) 525 this->nodeRight->drawBVPolygon(depth - 1);527 this->nodeRight->drawBVPolygon(depth - 1); 526 528 527 529 } -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.h
r4618 r4622 15 15 class BoundingVolume; 16 16 class OBB; 17 class OBBTree; 17 18 //struct sVec3D; 18 19 … … 29 30 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; } 30 31 inline const int getIndex() { return this->treeIndex; } 32 inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;} 31 33 32 34 virtual void collideWith(const BVTree &tree); … … 55 57 int numOfVertices; //!< number of vertices in vertices data 56 58 int depth; //!< the depth of the node in the tree 57 59 static OBBTree* obbTree; //!< reference to the obb tree 58 60 }; 59 61 -
orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
r4619 r4622 48 48 { 49 49 switch (event->type) 50 50 { 51 51 case SDL_KEYDOWN: 52 52 switch (event->key.keysym.sym) 53 53 { 54 54 case SDLK_i: 55 55 break; 56 } 57 } 56 case SDLK_1: 57 printf("alsjdf;lajsfd;lajsdf\n"); 58 break; 59 } 60 } 58 61 } 59 62 … … 66 69 void Framework::moduleDraw() const 67 70 { 68 CDEngine::getInstance()->drawBV(2 ,1);71 CDEngine::getInstance()->drawBV(2); 69 72 70 73 LightManager::getInstance()->draw(); 71 74 72 model->draw();75 //model->draw(); 73 76 } 74 77
Note: See TracChangeset
for help on using the changeset viewer.