/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "BspConverter.h" #include "BspLoader.h" #include "LinearMath/btVector3.h" #include "LinearMath/btGeometryUtil.h" void BspConverter::convertBsp(BspLoader& bspLoader,float scaling) { { btVector3 playerStart (0.f, 0.f, 100.f); if (bspLoader.findVectorByName(&playerStart[0],"info_player_start")) { printf("found playerstart\n"); } else { if (bspLoader.findVectorByName(&playerStart[0],"info_player_deathmatch")) { printf("found deatchmatch start\n"); } } playerStart[2] += 20.f; //start a bit higher playerStart *= scaling; //progressBegin("Loading bsp"); for (int i=0;i planeEquations; int brushid = bspLoader.m_dleafbrushes[leaf.firstLeafBrush+b]; BSPBrush& brush = bspLoader.m_dbrushes[brushid]; if (brush.shaderNum!=-1) { if (bspLoader.m_dshaders[ brush.shaderNum ].contentFlags & BSPCONTENTS_SOLID) { brush.shaderNum = -1; for (int p=0;p vertices; btGeometryUtil::getVerticesFromPlaneEquations(planeEquations,vertices); bool isEntity = false; btVector3 entityTarget(0.f,0.f,0.f); addConvexVerticesCollider(vertices,isEntity,entityTarget); } } } } } #define USE_ENTITIES #ifdef USE_ENTITIES { int i; for (i=0;i=0) && (modelnr < bspLoader.m_nummodels)) { const BSPModel& model = bspLoader.m_dmodels[modelnr]; for (int n=0;n planeEquations; bool isValidBrush = false; //convert brush const BSPBrush& brush = bspLoader.m_dbrushes[model.firstBrush+n]; { for (int p=0;p vertices; btGeometryUtil::getVerticesFromPlaneEquations(planeEquations,vertices); bool isEntity=true; addConvexVerticesCollider(vertices,isEntity,targetLocation); } } } } } else { printf("unsupported trigger_push model, md3 ?\n"); } } } } } } #endif //USE_ENTITIES //progressEnd(); } }