merged most of the changes from the branch into trunk, except for COLLADA, libxml and glut glitches.

Still need to verify to make sure no unwanted renaming is introduced.
This commit is contained in:
ejcoumans
2006-09-27 20:43:51 +00:00
parent d1e9a885f3
commit eb23bb5c0c
263 changed files with 7528 additions and 6714 deletions

View File

@@ -16,12 +16,12 @@ subject to the following restrictions:
#include "BspConverter.h"
#include "BspLoader.h"
#include "CcdPhysicsEnvironment.h"
#include "LinearMath/SimdVector3.h"
#include "LinearMath/btVector3.h"
void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
{
{
SimdVector3 playerStart (0.f, 0.f, 100.f);
btVector3 playerStart (0.f, 0.f, 100.f);
if (bspLoader.findVectorByName(&playerStart[0],"info_player_start"))
{
@@ -53,7 +53,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
for (int b=0;b<leaf.numLeafBrushes;b++)
{
std::vector<SimdVector3> planeEquations;
std::vector<btVector3> planeEquations;
int brushid = bspLoader.m_dleafbrushes[leaf.firstLeafBrush+b];
@@ -70,7 +70,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
SimdVector3 planeEq;
btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
@@ -83,13 +83,13 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
if (isValidBrush)
{
std::vector<SimdVector3> vertices;
std::vector<btVector3> vertices;
getVerticesFromPlaneEquations(planeEquations,vertices);
printf("getVerticesFromPlaneEquations returned %i\n",(int)vertices.size());
bool isEntity = false;
SimdVector3 entityTarget(0.f,0.f,0.f);
btVector3 entityTarget(0.f,0.f,0.f);
AddConvexVerticesCollider(vertices,isEntity,entityTarget);
}
@@ -109,7 +109,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
const BSPEntity& entity = bspLoader.m_entities[i];
const char* cl = bspLoader.ValueForKey(&entity,"classname");
if ( !strcmp( cl, "trigger_push" ) ) {
SimdVector3 targetLocation(0.f,0.f,0.f);
btVector3 targetLocation(0.f,0.f,0.f);
cl = bspLoader.ValueForKey(&entity,"target");
if ( strcmp( cl, "" ) ) {
@@ -136,7 +136,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
const BSPModel& model = bspLoader.m_dmodels[modelnr];
for (int n=0;n<model.numBrushes;n++)
{
std::vector<SimdVector3> planeEquations;
std::vector<btVector3> planeEquations;
bool isValidBrush = false;
//convert brush
@@ -148,7 +148,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
SimdVector3 planeEq;
btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
@@ -160,7 +160,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
if (isValidBrush)
{
std::vector<SimdVector3> vertices;
std::vector<btVector3> vertices;
getVerticesFromPlaneEquations(planeEquations,vertices);
bool isEntity=true;
@@ -197,27 +197,27 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>& planeEquations , std::vector<SimdVector3>& verticesOut )
void BspConverter::getVerticesFromPlaneEquations(const std::vector<btVector3>& planeEquations , std::vector<btVector3>& verticesOut )
{
const int numbrushes = planeEquations.size();
// brute force:
for (int i=0;i<numbrushes;i++)
{
const SimdVector3& N1 = planeEquations[i];
const btVector3& N1 = planeEquations[i];
for (int j=i+1;j<numbrushes;j++)
{
const SimdVector3& N2 = planeEquations[j];
const btVector3& N2 = planeEquations[j];
for (int k=j+1;k<numbrushes;k++)
{
const SimdVector3& N3 = planeEquations[k];
const btVector3& N3 = planeEquations[k];
SimdVector3 n2n3; n2n3 = N2.cross(N3);
SimdVector3 n3n1; n3n1 = N3.cross(N1);
SimdVector3 n1n2; n1n2 = N1.cross(N2);
btVector3 n2n3; n2n3 = N2.cross(N3);
btVector3 n3n1; n3n1 = N3.cross(N1);
btVector3 n1n2; n1n2 = N1.cross(N2);
if ( ( n2n3.length2() > 0.0001f ) &&
( n3n1.length2() > 0.0001f ) &&
@@ -231,13 +231,13 @@ void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>&
float quotient = (N1.dot(n2n3));
if (SimdFabs(quotient) > 0.000001f)
if (btFabs(quotient) > 0.000001f)
{
quotient = -1.f / quotient;
n2n3 *= N1[3];
n3n1 *= N2[3];
n1n2 *= N3[3];
SimdVector3 potentialVertex = n2n3;
btVector3 potentialVertex = n2n3;
potentialVertex += n3n1;
potentialVertex += n1n2;
potentialVertex *= quotient;
@@ -257,12 +257,12 @@ void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>&
bool BspConverter::isInside(const std::vector<SimdVector3>& planeEquations, const SimdVector3& point, float margin)
bool BspConverter::isInside(const std::vector<btVector3>& planeEquations, const btVector3& point, float margin)
{
int numbrushes = planeEquations.size();
for (int i=0;i<numbrushes;i++)
{
const SimdVector3& N1 = planeEquations[i];
const btVector3& N1 = planeEquations[i];
float dist = float(N1.dot(point))+float(N1[3])-margin;
if (dist>0.f)
{

View File

@@ -18,7 +18,7 @@ subject to the following restrictions:
class BspLoader;
#include <vector>
#include "LinearMath/SimdVector3.h"
#include "LinearMath/btVector3.h"
///BspConverter turns a loaded bsp level into convex parts (vertices)
class BspConverter
@@ -31,11 +31,11 @@ class BspConverter
}
///Utility function to create vertices from a Quake Brush. Brute force but it works.
///Bit overkill to use QHull package
void getVerticesFromPlaneEquations(const std::vector<SimdVector3>& planeEquations , std::vector<SimdVector3>& verticesOut );
bool isInside(const std::vector<SimdVector3>& planeEquations, const SimdVector3& point, float margin);
void getVerticesFromPlaneEquations(const std::vector<btVector3>& planeEquations , std::vector<btVector3>& verticesOut );
bool isInside(const std::vector<btVector3>& planeEquations, const btVector3& point, float margin);
///this callback is called for each brush that succesfully converted into vertices
virtual void AddConvexVerticesCollider(std::vector<SimdVector3>& vertices, bool isEntity, const SimdVector3& entityTargetLocation) = 0;
virtual void AddConvexVerticesCollider(std::vector<btVector3>& vertices, bool isEntity, const btVector3& entityTargetLocation) = 0;
};

View File

@@ -18,8 +18,8 @@ subject to the following restrictions:
#include "btBulletDynamicsCommon.h"
#include "LinearMath/GenQuickprof.h"
#include "LinearMath/GenIDebugDraw.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -60,7 +60,7 @@ public:
{
}
virtual void AddConvexVerticesCollider(std::vector<SimdVector3>& vertices, bool isEntity, const SimdVector3& entityTargetLocation)
virtual void AddConvexVerticesCollider(std::vector<btVector3>& vertices, bool isEntity, const btVector3& entityTargetLocation)
{
///perhaps we can do something special with entities (isEntity)
///like adding a collision Triggering (as example)
@@ -69,12 +69,12 @@ public:
{
bool isDynamic = false;
float mass = 0.f;
SimdTransform startTransform;
btTransform startTransform;
//can use a shift
startTransform.setIdentity();
startTransform.setOrigin(SimdVector3(0,0,-10.f));
startTransform.setOrigin(btVector3(0,0,-10.f));
//this create an internal copy of the vertices
CollisionShape* shape = new ConvexHullShape(&vertices[0],vertices.size());
btCollisionShape* shape = new btConvexHullShape(&vertices[0],vertices.size());
m_demoApp->LocalCreatePhysicsObject(isDynamic, mass, startTransform,shape);
}
@@ -128,15 +128,15 @@ void BspDemo::initPhysics(char* bspfilename)
{
m_cameraUp = SimdVector3(0,0,1);
m_cameraUp = btVector3(0,0,1);
m_forwardAxis = 1;
///Setup a Physics Simulation Environment
CollisionDispatcher* dispatcher = new CollisionDispatcher();
SimdVector3 worldAabbMin(-10000,-10000,-10000);
SimdVector3 worldAabbMax(10000,10000,10000);
OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
//BroadphaseInterface* broadphase = new SimpleBroadphase();
btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
//BroadphaseInterface* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
m_physicsEnvironmentPtr->setDeactivationTime(2.f);
m_physicsEnvironmentPtr->setGravity(0,0,-10);

View File

@@ -5,16 +5,16 @@ Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
and/or modify it under the terms of the GNU bteral Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU bteral Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU bteral Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================

View File

@@ -5,16 +5,16 @@ Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
and/or modify it under the terms of the GNU bteral Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU bteral Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU bteral Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================