Changeset 8213 in orxonox.OLD
- Timestamp:
- Jun 7, 2006, 9:06:41 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_detection/cd_engine.cc
r8186 r8213 19 19 #include "obb_tree.h" 20 20 #include "debug.h" 21 22 #include "class_list.h" 21 23 22 24 #include "model.h" … … 97 99 void CDEngine::checkCollisionGround(std::list<WorldEntity*>& list1) 98 100 { 99 if( likely( this->terrain != NULL))100 {101 Quadtree* q = dynamic_cast<Terrain*>(this->terrain)->ssp->getQuadtree();102 // QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());103 }104 105 if( likely( this->bspManager != NULL))106 {107 std::list<WorldEntity*>::iterator iterator;108 PRINTF(3)("checking for collisions\n");109 101 110 iterator = list1.begin(); 111 while (iterator != list1.end()) 112 { 113 bspManager->checkCollision(*iterator); 114 iterator++; 115 } 102 std::list<WorldEntity*>::iterator entityIterator; 103 std::list<BaseObject*>::const_iterator bspIterator; 104 const std::list<BaseObject*>* list = ClassList::getList(CL_BSP_MODEL); 105 106 // for all bsp managers check all entities 107 for( bspIterator = list->begin(); bspIterator != list->end(); bspIterator++) { 108 for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++) 109 static_cast<BspManager*>(*bspIterator)->checkCollision(*entityIterator); 116 110 } 117 111 } -
branches/bsp_model/src/lib/collision_reaction/collision_handle.cc
r8190 r8213 24 24 25 25 #include "cr_object_damage.h" 26 #include "cr_physics_ground_walk.h" 26 27 27 28 using namespace std; … … 42 43 this->bDispatched = false; 43 44 44 if( this->type == CREngine::CR_PHYSICS_STEP_BACK) 45 this->bContinuousPoll = false; 46 else 47 this->bContinuousPoll = true; 48 49 if( this->type == CREngine::CR_OBJECT_DAMAGE) 50 this->bStopOnFirstCollision = true; 51 else 52 this->bStopOnFirstCollision = false; 45 this->collisionReaction = NULL; 46 this->bContinuousPoll = true; 47 this->bStopOnFirstCollision = false; 48 53 49 54 50 switch( type) 55 51 { 52 case CREngine::CR_PHYSICS_STEP_BACK: 53 // this->collisionReaction = new CRPhysicsGroundWalk(); 54 this->bContinuousPoll = true; 55 break; 56 case CREngine::CR_PHYSICS_GROUND_WALK: 57 this->collisionReaction = new CRPhysicsGroundWalk(); 58 break; 56 59 case CREngine::CR_OBJECT_DAMAGE: 57 60 this->collisionReaction = new CRObjectDamage(); 61 this->bStopOnFirstCollision = true; 58 62 break; 59 63 default: … … 69 73 { 70 74 // delete what has to be deleted here 75 if( this->collisionReaction != NULL) 76 delete this->collisionReaction; 71 77 } 72 78 -
branches/bsp_model/src/lib/collision_reaction/cr_engine.cc
r8190 r8213 124 124 { 125 125 std::vector<CollisionHandle*>::iterator it; 126 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 127 { 128 if( *it == collisionHandle) 129 { 126 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) { 127 if( *it == collisionHandle) { 130 128 this->collisionHandles.erase(it); 131 129 delete collisionHandle; -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8204 r8213 77 77 void BspManager::load(const char* fileName, float scale) 78 78 { 79 //this->setClassID(CL_BSP_MODEL, "BspManager");79 this->setClassID(CL_BSP_MODEL, "BspManager"); 80 80 // open a BSP file 81 81 this->bspFile = new BspFile(); -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
r8195 r8213 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: bottac@ee.ethz.ch 13 13 14 14 Inspired by: 15 15 Rendering Q3 Maps by Morgan McGuire http://graphics.cs.brown.edu/games/quake/quake3.html 16 16 Unofficial Quake 3 Map Specs by Kekoa Proudfoot http://graphics.stanford.edu/~kekoa/q3/ 17 17 18 18 Collision detection adapted from: 19 19 Quake 3 Collision Detection by Nathan Ostgard http://www.devmaster.net/articles/quake3collision/ … … 22 22 #include <vector> 23 23 #include <deque> 24 25 #include "base_object.h" 24 26 25 27 // FORWARD DECLARATIONS … … 41 43 }; 42 44 43 class BspManager 45 class BspManager : public BaseObject 44 46 { 45 47 public: 46 48 // Constructors 47 49 BspManager(); 48 50 49 51 BspManager(const char* fileName, float scale = 0.4f); 50 52 void load(const char* fileName, float scale); … … 53 55 const void draw(); 54 56 const void tick(float time); 55 void draw_debug_face(int Face); 57 void draw_debug_face(int Face); 56 58 void draw_face(int Face); 57 59 void draw_patch(face* Face); 58 60 59 61 60 62 void checkCollision(WorldEntity* worldEntity); /*!< WorldEntities use this function to check wheter they collided with the BSPEntity. … … 65 67 BspTreeNode* getLeaf(BspTreeNode* node, Vector* cam) ; //!< Traverses the tree 66 68 void checkCollision(BspTreeNode* node, Vector* cam); //!< Obsolete. Use this function for debugging only! 67 void checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 69 void checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 68 70 void checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 69 71 void TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs ); … … 74 76 bool isAlreadyVisible(int Face); 75 77 void addFace(int Face); 76 78 77 79 // Data 78 80 BspFile* bspFile; … … 83 85 plane* collPlane; 84 86 int lastTex; 85 87 86 88 //obsolete: global variables for collision detection 87 89 bool outputStartsOut; … … 90 92 Vector traceMins; //!< Mins of current bbox 91 93 Vector traceMaxs; //!< Maxs of current bbox 92 Vector traceExtents; /*!< Stores the maximum of the absolute value of each axis in the box. 94 Vector traceExtents; /*!< Stores the maximum of the absolute value of each axis in the box. 93 95 For example, if traceMins was (-100,-3,-15) and traceMaxs was (55,22,7), traceExtents */ 94 95 96 97 96 98 bool * alreadyVisible; 97 99 // Deques to store the visible faces … … 100 102 101 103 Vector out; //!< For debugging only 102 Vector out1; //!< For debugging only 104 Vector out1; //!< For debugging only 103 105 Vector out2; //!< For debugging only 104 106 };
Note: See TracChangeset
for help on using the changeset viewer.