Changeset 8220 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 7, 2006, 11:44:50 PM (18 years ago)
- Location:
- branches/bsp_model/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_detection/cd_engine.cc
r8218 r8220 109 109 for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) { 110 110 for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++) 111 { 112 // PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName()); 111 113 (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator); 114 } 112 115 } 113 116 } -
branches/bsp_model/src/lib/collision_reaction/collision_handle.cc
r8213 r8220 173 173 174 174 c->registerCollisionEvent(collisionEvent); 175 PRINTF(0)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName()); 175 176 } 176 177 -
branches/bsp_model/src/lib/event/event_handler.cc
r8148 r8220 353 353 else 354 354 { 355 //SDL_WM_GrabInput(SDL_GRAB_ON);355 SDL_WM_GrabInput(SDL_GRAB_ON); 356 356 SDL_ShowCursor(SDL_DISABLE); 357 357 } -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8219 r8220 83 83 this->root = this->bspFile->get_root(); 84 84 this->alreadyVisible = new bool [this->bspFile->numFaces]; 85 86 this->outputFraction = 1.0f; 85 87 } 86 88 /* … … 853 855 854 856 Vector position = worldEntity->getAbsCoor(); 855 856 857 Vector forwardDir = worldEntity->getAbsDirX(); 858 forwardDir.x =8.0*forwardDir.x; 859 forwardDir.y =8.0*forwardDir.y; 860 forwardDir.z =8.0*forwardDir.z; 861 862 Vector upDir = worldEntity->getAbsDirY(); 863 Vector dest = position; 864 dest.x += forwardDir.x; 865 dest.y += forwardDir.y; 866 dest.z += forwardDir.z; 867 Vector out = dest; 857 Vector downDir = worldEntity->getAbsDirY(); 858 Vector dest = position + downDir * -80.0f; 859 860 // Vector forwardDir = worldEntity->getAbsDirX(); 861 // forwardDir.x =8.0*forwardDir.x; 862 // forwardDir.y =8.0*forwardDir.y; 863 // forwardDir.z =8.0*forwardDir.z; 864 // 865 // Vector upDir = worldEntity->getAbsDirY(); 866 // Vector dest = position; 867 // dest.x += forwardDir.x; 868 // dest.y += forwardDir.y; 869 // dest.z += forwardDir.z; 870 // Vector out = dest; 868 871 869 872 bool collision = false; 870 873 871 Vector position1 = position + Vector(0.0,0.1,0.0); 872 Vector position2 = position + Vector(0.0,0.2,0.0); 873 Vector dest1 = position1 + forwardDir; 874 Vector dest2 = position2 + forwardDir; 875 dest = position - Vector(0.0, 20.0,0.0); 876 Vector out1; 877 Vector out2; 878 879 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 880 if(this->outputFraction == 1.0f) out1 = dest; 874 875 // Vector position1 = position + Vector(0.0,0.1,0.0); 876 // Vector position2 = position + Vector(0.0,0.2,0.0); 877 // Vector dest1 = position1 + forwardDir; 878 // Vector dest2 = position2 + forwardDir; 879 // dest = position - Vector(0.0, 20.0,0.0); 880 // Vector out1; 881 // Vector out2; 882 883 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 884 // if(this->outputFraction == 1.0f) out1 = dest; 885 // else { 886 // collision = true; 887 // out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 888 // out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 889 // out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 890 // 891 // } 892 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 893 // if(this->outputFraction == 1.0f) out2= dest; 894 // else { 895 // collision = true; 896 // out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 897 // out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 898 // out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 899 // 900 // } 901 902 this->checkCollisionRayN(this->root,0.0f, 1.0f, &position, &dest ); 903 904 if( this->outputFraction == 1.0f) 905 out = dest; 881 906 else { 907 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 882 908 collision = true; 883 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 884 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 885 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 886 887 } 888 889 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 890 if(this->outputFraction == 1.0f) out2= dest; 891 else { 892 collision = true; 893 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 894 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 895 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 896 897 } 898 899 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 900 if(this->outputFraction == 1.0f) out = dest; 901 else { 902 collision = true; 903 out.x = position.x + (dest.x -position.x) * this->outputFraction; 904 out.y = position.y + (dest.y -position.y) * this->outputFraction; 905 out.z = position.z + (dest.z -position.z) * this->outputFraction; 909 // out.x = position.x + (dest.x -position.x) * this->outputFraction; 910 // out.y = position.y + (dest.y -position.y) * this->outputFraction; 911 // out.z = position.z + (dest.z -position.z) * this->outputFraction; 912 913 out = position + (dest - position) * this->outputFraction; 906 914 907 915 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 908 this->out = out; 909 this->out1 = out1; 910 this->out2 = out2; 916 917 911 918 //this->drawDebugCube(&out1); 912 919 //this->drawDebugCube(&out2); … … 917 924 918 925 // Return the normal here: Normal's stored in this->collPlane; 919 if( collision)926 if( collision) { 920 927 worldEntity->registerCollision(worldEntity, this->parent, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 928 } 921 929 } 922 930 -
branches/bsp_model/src/story_entities/game_world.cc
r8215 r8220 428 428 // ground collision detection: BSP Model 429 429 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_00)); 430 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_01)); 430 431 } 431 432 -
branches/bsp_model/src/world_entities/bsp_entity.cc
r8219 r8220 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Claudio Botta 13 13 co-programmer: ... 14 14 */ … … 27 27 { 28 28 this->init(); 29 29 30 if (root != NULL) 30 31 this->loadParams(root); … … 37 38 BspEntity::~BspEntity () 38 39 { 39 40 if( this->bspManager) 41 delete this->bspManager; 40 42 } 41 42 void BspEntity::setName(const std::string& name)43 {44 PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());45 46 this->bspManager->load(name.c_str(), 0.1f);47 }48 49 43 50 44 … … 55 49 void BspEntity::init() 56 50 { 57 this->bspManager = new BspManager(this);58 51 this->setClassID(CL_BSP_ENTITY, "BspEntity"); 59 52 53 this->bspManager = new BspManager(this); 60 54 this->toList(OM_ENVIRON); 61 55 … … 63 57 * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) 64 58 */ 59 } 65 60 61 62 void BspEntity::setName(const std::string& name) 63 { 64 PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); 65 66 this->bspManager->load(name.c_str(), 0.1f); 66 67 } 67 68
Note: See TracChangeset
for help on using the changeset viewer.