Changeset 8910 in orxonox.OLD for branches/single_player_map/src/lib/graphics
- Timestamp:
- Jun 29, 2006, 4:03:42 PM (18 years ago)
- Location:
- branches/single_player_map/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc
r8907 r8910 82 82 delete this->bspFile; 83 83 } 84 84 85 85 int BspManager::load(const char* fileName, float scale) 86 86 { 87 87 // open a BSP file 88 89 88 89 90 90 this->bspFile = new BspFile(); 91 91 this->bspFile->scale = scale; 92 92 if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1) 93 return -1;94 93 return -1; 94 95 95 this->bspFile->build_tree(); 96 96 this->root = this->bspFile->get_root(); … … 98 98 99 99 this->outputFraction = 1.0f; 100 100 101 101 return 0; 102 102 } … … 998 998 } else { 999 999 // Init positions and destinations to anything useful! 1000 1000 1001 1001 } 1002 1002 … … 1045 1045 } 1046 1046 1047 plane* testPlane = this->collPlane; 1047 plane* testPlane = new plane; 1048 testPlane->x = this->collPlane->x; 1049 testPlane->y = this->collPlane->y; 1050 testPlane->z = this->collPlane->z; 1048 1051 1049 1052 1050 1053 bool xCollision = false; 1051 1054 bool zCollision = false; 1052 if(!SolidFlag) {1055 1053 1056 1054 1057 // 2nd Collision Detection … … 1060 1063 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 1061 1064 1062 if( !this->outputAllSolid !=1.0f) {1065 if(this->outputFraction < 1.0f) { 1063 1066 out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction; 1064 1067 xCollision = true; 1065 1068 testPlane = this->collPlane; 1066 1069 } 1067 if(this->outputAllSolid ) {1070 if(this->outputAllSolid || !this->outputStartsOut) { 1068 1071 SolidFlag = true; 1069 xCollision = true; 1072 xCollision = true; 1070 1073 } 1071 1074 //out.z = this->outputFraction; 1072 1075 1073 if(!SolidFlag) {1076 1074 1077 1075 1078 // 3rd Collision Detection … … 1082 1085 //out.x = this->outputFraction; 1083 1086 1084 if(this->outputFraction !=1.0f ) {1087 if(this->outputFraction < 1.0f ) { 1085 1088 out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction; 1086 1089 zCollision = true; … … 1088 1091 1089 1092 } 1090 if(this->outputAllSolid ) {1091 1092 zCollision = true;1093 if(this->outputAllSolid || !this->outputStartsOut) { 1094 SolidFlag = true; 1095 zCollision = true; 1093 1096 } 1094 }1095 }//end if1097 1098 //end if 1096 1099 /* 1097 1100 This is how you would calculate the Coordinates where worldEntity Collided with the BSP world. … … 1104 1107 if( collision) { 1105 1108 PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 1106 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y || (xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0), this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1107 } else { 1108 if(xCollision || zCollision) { 1109 1110 worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1111 } 1112 1113 } 1109 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1110 } 1111 if(xCollision) { 1112 worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1113 } 1114 if(zCollision) { 1115 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1116 } 1117 1118 1114 1119 //else worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false); 1115 1120 -
branches/single_player_map/src/lib/graphics/importer/bsp_manager.h
r8904 r8910 119 119 ::std::deque<int> opal; //!< the others here. 120 120 121 Vector out; //!< For debugging only121 Vector out; //!< Stores collision coordinates 122 122 Vector out1; //!< For debugging only 123 123 Vector out2; //!< For debugging only
Note: See TracChangeset
for help on using the changeset viewer.