Changeset 9174 in orxonox.OLD
- Timestamp:
- Jul 4, 2006, 10:17:57 PM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_detection/obb_tree.cc
r9172 r9174 90 90 void OBBTree::createBox(Vector start, Vector end) 91 91 { 92 this->rootNode = new OBBTreeNode(*this, NULL, 1 1);92 this->rootNode = new OBBTreeNode(*this, NULL, 1); 93 93 94 94 this->rootNode->createBox(start, end); -
branches/presentation/src/lib/collision_detection/obb_tree_node.cc
r9172 r9174 57 57 this->nodeRight = NULL; 58 58 this->bvElement = NULL; 59 60 this->flag = false; 59 61 60 62 this->triangleIndexList1 = NULL; … … 99 101 this->nodeLeft = NULL; 100 102 this->nodeRight = NULL; 103 // this->depth = 0; 101 104 102 105 this->bvElement->center = (end - start) * 0.5f; … … 104 107 this->bvElement->halfLength[1] = (end.y - start.y) * 0.5f; 105 108 this->bvElement->halfLength[2] = (end.z - start.z) * 0.5f; 109 110 this->bvElement->axis[0] = Vector(1,0,0); 111 this->bvElement->axis[1] = Vector(0,1,0); 112 this->bvElement->axis[2] = Vector(0,0,1); 113 114 115 PRINTF(0)("half length %f, %f, %f", this->bvElement->halfLength[0], this->bvElement->halfLength[1], this->bvElement->halfLength[2]); 116 PRINTF(0)("center:\n"); 117 this->bvElement->center.debug(); 118 this->flag = true; 106 119 } 107 120 … … 577 590 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) 578 591 { 592 579 593 //HACK remove this again 580 594 this->owner = nodeA; … … 693 707 void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color, bool top) const 694 708 { 709 710 if( !this->flag) 711 return; 712 713 PRINTF(0)("bv box\n"); 714 695 715 /* this function can be used to draw the triangles and/or the points only */ 696 716 if( 1 /*drawMode & DRAW_MODEL || drawMode & DRAW_ALL*/) -
branches/presentation/src/lib/collision_detection/obb_tree_node.h
r9172 r9174 80 80 81 81 WorldEntity* owner; 82 bool flag; 82 83 }; 83 84 -
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9172 r9174 63 63 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY); 64 64 65 this->range = 10 00.0f;66 this->sideLength = 10.0f;65 this->range = 10.0f; 66 this->sideLength = 2.0f; 67 67 68 68 // new obb tree 69 69 this->obbTree = new OBBTree(); 70 70 this->obbTree->createBox(Vector(0.0f, 0.0f, 0.0f), Vector(this->range, this->sideLength, this->sideLength)); 71 this->setOBBTree(this->obbTree); 71 72 } 72 73 … … 137 138 void AimingSystem::draw() const 138 139 { 139 //WorldEntity::draw();140 WorldEntity::draw(); 140 141 141 glMatrixMode(GL_MODELVIEW);142 glPushMatrix();143 144 /* translate */145 glTranslatef (this->getAbsCoor ().x,146 this->getAbsCoor ().y,147 this->getAbsCoor ().z);148 Vector tmpRot = this->getAbsDir().getSpacialAxis();149 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );150 151 this->obbTree->drawBV(1, 1);152 153 glPopMatrix();142 // glMatrixMode(GL_MODELVIEW); 143 // glPushMatrix(); 144 // 145 // /* translate */ 146 // glTranslatef (this->getAbsCoor ().x, 147 // this->getAbsCoor ().y, 148 // this->getAbsCoor ().z); 149 // Vector tmpRot = this->getAbsDir().getSpacialAxis(); 150 // glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 151 // 152 // this->obbTree->drawBV(0, 1); 153 // 154 // glPopMatrix(); 154 155 155 156 } -
branches/presentation/src/world_entities/world_entity.h
r9166 r9174 74 74 /** @returns a reference to the obb tree of this worldentity */ 75 75 inline BVTree* getOBBTree() const { return this->obbTree; }; 76 inline void setOBBTree(OBBTree* tree) { if( this->obbTree != NULL) this->obbTree = (BVTree*)tree; } 76 77 void drawBVTree(int depth, int drawMode) const; 77 78 inline AABB* getModelAABB() const { return (this->aabbNode)?this->aabbNode->getAABB():NULL;}
Note: See TracChangeset
for help on using the changeset viewer.