Changeset 8217 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer
- Timestamp:
- Jun 7, 2006, 9:57:13 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8216 r8217 39 39 #include "movie_player.h" 40 40 41 #include "cd_engine.h"42 43 41 #include "world_entity.h" 44 42 … … 77 75 void BspManager::load(const char* fileName, float scale) 78 76 { 79 this->setClassID(CL_BSP_MODEL, "BspManager");80 77 // open a BSP file 81 78 this->bspFile = new BspFile(); … … 85 82 this->root = this->bspFile->get_root(); 86 83 this->alreadyVisible = new bool [this->bspFile->numFaces]; 87 88 CDEngine::getInstance()->setBSPModel(this);89 90 84 } 91 85 /* … … 872 866 Vector out = dest; 873 867 874 875 876 if(!worldEntity->isA(CL_PLAYABLE)) { 877 878 879 880 } 881 else { 882 883 bool collision = false; 884 Vector position1 = position + Vector(0.0,0.1,0.0); 885 Vector position2 = position + Vector(0.0,0.2,0.0); 886 Vector dest1 = position1 + forwardDir; 887 Vector dest2 = position2 + forwardDir; 888 dest = position - Vector(0.0, 20.0,0.0); 889 Vector out1; 890 Vector out2; 891 892 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 893 if(this->outputFraction == 1.0f) out1 = dest; 894 else { 895 collision = true; 896 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 897 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 898 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 899 900 } 901 902 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 903 if(this->outputFraction == 1.0f) out2= dest; 904 else { 905 collision = true; 906 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 907 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 908 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 909 910 } 911 912 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 913 if(this->outputFraction == 1.0f) out = dest; 914 else { 915 collision = true; 916 out.x = position.x + (dest.x -position.x) * this->outputFraction; 917 out.y = position.y + (dest.y -position.y) * this->outputFraction; 918 out.z = position.z + (dest.z -position.z) * this->outputFraction; 919 920 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 921 this->out = out; 922 this->out1 = out1; 923 this->out2 = out2; 868 bool collision = false; 869 870 Vector position1 = position + Vector(0.0,0.1,0.0); 871 Vector position2 = position + Vector(0.0,0.2,0.0); 872 Vector dest1 = position1 + forwardDir; 873 Vector dest2 = position2 + forwardDir; 874 dest = position - Vector(0.0, 20.0,0.0); 875 Vector out1; 876 Vector out2; 877 878 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 879 if(this->outputFraction == 1.0f) out1 = dest; 880 else { 881 collision = true; 882 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 883 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 884 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 885 886 } 887 888 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 889 if(this->outputFraction == 1.0f) out2= dest; 890 else { 891 collision = true; 892 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 893 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 894 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 895 896 } 897 898 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 899 if(this->outputFraction == 1.0f) out = dest; 900 else { 901 collision = true; 902 out.x = position.x + (dest.x -position.x) * this->outputFraction; 903 out.y = position.y + (dest.y -position.y) * this->outputFraction; 904 out.z = position.z + (dest.z -position.z) * this->outputFraction; 905 906 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 907 this->out = out; 908 this->out1 = out1; 909 this->out2 = out2; 924 910 //this->drawDebugCube(&out1); 925 911 //this->drawDebugCube(&out2); … … 927 913 //this->drawDebugCube(&out3); 928 914 929 915 } 930 916 931 917 // Return the normal here: Normal's stored in this->collPlane; 932 933 if(collision) 934 worldEntity->registerCollision(worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 935 // worldEntity->collidesWithGround(out,out1,out2); 936 } 918 if(collision) 919 worldEntity->registerCollision(worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 920 937 921 } 938 922 -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
r8213 r8217 20 20 */ 21 21 22 #ifndef _BSP_MANAGER_H 23 #define _BSP_MANAGER_H 24 25 22 26 #include <vector> 23 27 #include <deque> 24 28 25 #include "base_object.h" 29 26 30 27 31 // FORWARD DECLARATIONS … … 43 47 }; 44 48 45 class BspManager : public BaseObject49 class BspManager 46 50 { 47 51 public: … … 106 110 }; 107 111 112 #endif /* _BSP_MANAGER_H */
Note: See TracChangeset
for help on using the changeset viewer.