Changeset 9172 in orxonox.OLD for branches/presentation/src
- Timestamp:
- Jul 4, 2006, 9:45:39 PM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_detection/obb_tree.cc
r8316 r9172 41 41 42 42 43 /** 44 * standard constructor 45 */ 46 OBBTree::OBBTree() 47 : BVTree() 48 {} 49 43 50 44 51 void OBBTree::init() … … 78 85 79 86 this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles); 87 } 88 89 90 void OBBTree::createBox(Vector start, Vector end) 91 { 92 this->rootNode = new OBBTreeNode(*this, NULL, 11); 93 94 this->rootNode->createBox(start, end); 80 95 } 81 96 -
branches/presentation/src/lib/collision_detection/obb_tree.h
r7711 r9172 23 23 public: 24 24 OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity); 25 OBBTree(); 25 26 virtual ~OBBTree(); 26 27 void init(); … … 28 29 virtual void spawnBVTree(const modelInfo& modelInf); 29 30 virtual void flushTree(); 31 32 void createBox(Vector start, Vector end); 30 33 31 34 virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2); -
branches/presentation/src/lib/collision_detection/obb_tree_node.cc
r9008 r9172 90 90 delete this->bvElement; 91 91 } 92 93 94 95 void OBBTreeNode::createBox(Vector start, Vector end) 96 { 97 98 this->bvElement = new OBB(); 99 this->nodeLeft = NULL; 100 this->nodeRight = NULL; 101 102 this->bvElement->center = (end - start) * 0.5f; 103 this->bvElement->halfLength[0] = (end.x - start.x) * 0.5f; 104 this->bvElement->halfLength[1] = (end.y - start.y) * 0.5f; 105 this->bvElement->halfLength[2] = (end.z - start.z) * 0.5f; 106 } 107 92 108 93 109 … … 682 698 if( depth == 0/*!(drawMode & DRAW_SINGLE && depth != 0)*/) 683 699 { 684 if( 1/*drawMode & DRAW_POINTS*/)700 if( 0 /*drawMode & DRAW_POINTS*/) 685 701 { 686 702 glBegin(GL_POINTS); -
branches/presentation/src/lib/collision_detection/obb_tree_node.h
r7732 r9172 31 31 32 32 virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length); 33 void createBox(Vector start, Vector end); 33 34 34 35 virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); -
branches/presentation/src/world_entities/creatures/fps_player.cc
r9168 r9172 243 243 this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * f, 0.0)); 244 244 245 this->aimingSystem->toList(/*OM_LIST(this->getOMListNumber() + 1)*/ OM_ GROUP_00);245 this->aimingSystem->toList(/*OM_LIST(this->getOMListNumber() + 1)*/ OM_COMMON); 246 246 } 247 247 } … … 399 399 400 400 this->setOnGround(false); 401 401 this->aimingSystem->flushList(); 402 402 } 403 403 -
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9168 r9172 1 /*1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 36 36 AimingSystem::AimingSystem (WorldEntity* entity) 37 37 { 38 this->owner = entity; 39 38 40 this->init(); 39 41 } … … 55 57 this->setName("AimingSystem"); 56 58 57 this->loadModel("models/guns/targeting_system_body.obj"); 59 //this->loadModel("models/guns/targeting_system_body2.obj"); 60 // this->loadModel("models/ships/fighter.obj"); 58 61 59 62 // registering default reactions: 60 63 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY); 64 65 this->range = 1000.0f; 66 this->sideLength = 10.0f; 67 68 // new obb tree 69 this->obbTree = new OBBTree(); 70 this->obbTree->createBox(Vector(0.0f, 0.0f, 0.0f), Vector(this->range, this->sideLength, this->sideLength)); 61 71 } 62 72 … … 69 79 WorldEntity* AimingSystem::getNearestTarget() 70 80 { 81 82 // PRINTF(0)("size: %i\n", this->selectionList.size()); 83 84 71 85 if( this->selectionList.size() == 0) 72 86 return NULL; 73 else if( this->selectionList.size() == 1) 74 return this->selectionList.back(); 87 75 88 76 89 WorldEntity* nearestEntity = NULL; … … 91 104 if( nearestEntity != this->owner) 92 105 return nearestEntity; 93 else return NULL; 106 else 107 return NULL; 94 108 } 95 109 … … 123 137 void AimingSystem::draw() const 124 138 { 125 WorldEntity::draw();139 // WorldEntity::draw(); 126 140 127 if( this->getOBBTree () != NULL) 128 this->getOBBTree()->drawBV(0, 1); 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(); 154 129 155 } -
branches/presentation/src/world_entities/weapons/aiming_system.h
r9168 r9172 16 16 class BVTree; 17 17 class Model; 18 class OBBTree; 18 19 19 20 … … 28 29 29 30 WorldEntity* getNearestTarget(); 31 void flushList() { this->selectionList.clear(); } 30 32 31 33 void setRange(float range){this->range = range;}; … … 39 41 private: 40 42 float range; //!< 43 float sideLength; 41 44 std::vector<WorldEntity*> selectionList; //!< the selections 42 45 43 46 WorldEntity* owner; //!< the owner of the targeting system 44 47 48 OBBTree* obbTree; 49 45 50 }; 46 51
Note: See TracChangeset
for help on using the changeset viewer.