Changeset 7005 in orxonox.OLD for branches/current_cd/src/lib/collision_detection
- Timestamp:
- Feb 3, 2006, 9:34:57 AM (19 years ago)
- Location:
- branches/current_cd/src/lib/collision_detection
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/current_cd/src/lib/collision_detection/cd_engine.cc
r6921 r7005 133 133 std::list<WorldEntity*>::const_iterator entity; 134 134 for (entity = drawList.begin(); entity != drawList.end(); entity++) 135 (*entity)->drawBVTree( 1, 226);135 (*entity)->drawBVTree(3, 226); 136 136 } 137 137 … … 141 141 void CDEngine::debugDraw(int depth, int drawMode) 142 142 { 143 if(this-> rootTree != NULL)144 this->rootTree->drawBV(depth, drawMode);143 // if(this-> rootTree != NULL) 144 // this->rootTree->drawBV(depth, drawMode); 145 145 } -
branches/current_cd/src/lib/collision_detection/obb_tree.cc
r6922 r7005 31 31 * standard constructor 32 32 */ 33 OBBTree::OBBTree(int depth, const modelInfo* modelInf )33 OBBTree::OBBTree(int depth, const modelInfo* modelInf, WorldEntity* owner) 34 34 : BVTree() 35 35 { … … 37 37 this->init(); 38 38 this->spawnBVTree(*modelInf); 39 this->owner = owner; 39 40 } 40 41 -
branches/current_cd/src/lib/collision_detection/obb_tree.h
r6922 r7005 15 15 class OBBTreeNode; 16 16 class PNode; 17 class WorldEntity; 17 18 18 19 //! A class for representing an obb tree … … 21 22 22 23 public: 23 OBBTree(int depth, const modelInfo* modInfo );24 OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity); 24 25 virtual ~OBBTree(); 25 26 void init(); … … 35 36 /** returns the root node of the bounding volume tree @return reference to the root node */ 36 37 inline OBBTreeNode* getRootNode() const { return this->rootNode; } 38 inline WorldEntity* getOwner() const { return this->owner; } 37 39 38 40 void debug(); … … 42 44 int id; //!< the next id of a obb tree node 43 45 int depth; //!< the depth of the tree to generate 46 WorldEntity* owner; //!< owner 44 47 }; 45 48 -
branches/current_cd/src/lib/collision_detection/obb_tree_node.cc
r6922 r7005 66 66 if( OBBTreeNode_sphereObj == NULL) 67 67 OBBTreeNode_sphereObj = gluNewQuadric(); 68 69 this->owner = NULL; 68 70 69 71 /* debug ids */ … … 565 567 566 568 567 bool OBBTreeNode::overlapTest(const OBB& boxA, const OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB) 568 { 569 bool OBBTreeNode::overlapTest(OBB& boxA, OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB) 570 { 571 //HACK remove this again 572 this->owner = nodeA; 569 573 // if( boxB == NULL || boxA == NULL) 570 574 // return false; … … 677 681 678 682 /* FIXME: there is no collision mark set now */ 679 //boxA.bCollided = true; /* use this ONLY(!!!!) for drawing operations */680 //boxB.bCollided = true;683 boxA.bCollided = true; /* use this ONLY(!!!!) for drawing operations */ 684 boxB.bCollided = true; 681 685 682 686 … … 689 693 690 694 695 696 697 698 699 700 /** 701 * 702 * draw the BV tree - debug mode 703 */ 691 704 void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color, bool top) const 692 705 { 693 694 695 706 /* this function can be used to draw the triangles and/or the points only */ 696 707 if( drawMode & DRAW_MODEL || drawMode & DRAW_ALL) … … 778 789 depth = 0; 779 790 780 if( !(drawMode & DRAW_SINGLE && depth != 0))781 { 782 PRINTF(0)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode); 791 if( depth == 0 /*!(drawMode & DRAW_SINGLE && depth != 0)*/) 792 { 793 783 794 784 795 Vector cen = this->bvElement->center; … … 794 805 glColor4f(color.x, color.y, color.z, .5); 795 806 } 807 808 // debug out 809 if( this->obbTree->getOwner() != NULL) 810 { 811 PRINTF(0)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getName(), this->obbTree->getOwner()->getClassName()); 812 } 813 else 814 PRINTF(0)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode); 815 796 816 797 817 /* draw bounding box */ … … 902 922 } 903 923 904 905 924 if( drawMode & DRAW_BV_BLENDED) 906 925 glColor3f(color.x, color.y, color.z); 907 926 } 908 909 927 } 910 928 -
branches/current_cd/src/lib/collision_detection/obb_tree_node.h
r6922 r7005 48 48 void forkBox(OBB& box); 49 49 50 bool overlapTest( const OBB& boxA, constOBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB);50 bool overlapTest(OBB& boxA, OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB); 51 51 52 52 … … 76 76 int triangleIndexLength1; //!< len vert data obbox1 77 77 int triangleIndexLength2; //!< len vert data obbox2 78 79 WorldEntity* owner; 78 80 }; 79 81
Note: See TracChangeset
for help on using the changeset viewer.