Changeset 8864 in orxonox.OLD for branches/single_player_map/src/lib/graphics
- Timestamp:
- Jun 28, 2006, 3:51:36 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc
r8796 r8864 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/ … … 45 45 46 46 #include "aabb.h" 47 47 #include "cr_defs.h" 48 48 49 49 … … 69 69 BspManager::BspManager(const TiXmlElement* root) 70 70 { 71 72 71 72 73 73 if( root != NULL) 74 74 this->loadParams(root); 75 75 76 76 CDEngine::getInstance()->setBSPModel(this); 77 77 } */ … … 99 99 this->root = this->bspFile->get_root(); 100 100 this->alreadyVisible = new bool [this->bspFile->numFaces]; 101 101 102 102 CDEngine::getInstance()->setBSPModel(this); 103 103 } … … 962 962 upDir.z = 0.0; 963 963 Vector dest; 964 964 965 965 966 966 Vector position = worldEntity->getAbsCoor(); //+ upDir*10.0f ; … … 978 978 Vector out2; 979 979 980 980 981 981 982 982 float height = 40; 983 984 983 984 985 985 if( box != NULL) 986 986 { 987 987 position = worldEntity->getAbsCoor() + box->center; // + box->axis[1] * box->halfLength[1]; 988 988 dest = worldEntity->getAbsCoor() + box->center - box->axis[1] * box->halfLength[1] * 40.0; 989 989 990 990 position1 = worldEntity->getAbsCoor() + box->center + box->axis[0] * box->halfLength[0] * 2.0f; 991 991 dest1 = worldEntity->getAbsCoor() + box->center - box->axis[0] * box->halfLength[0] *2.0f; 992 993 992 993 994 994 position2 = worldEntity->getAbsCoor() + box->center + box->axis[2] * box->halfLength[2] * 2.0f; 995 995 dest2 = worldEntity->getAbsCoor() + box->center - box->axis[2] * box->halfLength[2] * 2.0f; 996 996 997 997 } 998 998 else 999 999 { 1000 1001 } 1002 1003 1004 1000 1001 } 1002 1003 1004 1005 1005 // 1006 1006 this->inputStart = position; … … 1025 1025 this->collPlane->z = 0.0f; 1026 1026 collision = true; 1027 } else 1027 } else 1028 1028 collision = false; 1029 1030 1029 1030 1031 1031 out = dest; 1032 1032 1033 1033 } else { 1034 1034 collision = true; … … 1046 1046 plane* testPlane = this->collPlane; 1047 1047 1048 1048 1049 1049 // 2nd Collision Detection 1050 1050 this->outputStartsOut = true; … … 1056 1056 out.x = this->outputFraction; 1057 1057 //out.z = this->outputFraction; 1058 1059 1058 1059 1060 1060 // 3rd Collision Detection 1061 1061 this->outputStartsOut = true; … … 1067 1067 //out.x = this->outputFraction; 1068 1068 out.z = this->outputFraction; 1069 1069 1070 1070 1071 1071 /* … … 1077 1077 1078 1078 // Return the normal here: Normal's stored in this->collPlane; 1079 if( collision) 1079 if( collision) 1080 1080 { 1081 1081 PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 1082 worldEntity->registerCollision( this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out);1083 } 1084 else worldEntity->registerCollision( this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest);1082 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out); 1083 } 1084 else worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest); 1085 1085 1086 1086 }
Note: See TracChangeset
for help on using the changeset viewer.