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

@@ -15,11 +15,11 @@ subject to the following restrictions:
#include "btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/SimdQuaternion.h"
#include "LinearMath/btQuaternion.h"
#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
ConvexTriangleMeshShape ::ConvexTriangleMeshShape (StridingMeshInterface* meshInterface)
btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface)
:m_stridingMesh(meshInterface)
{
}
@@ -29,27 +29,27 @@ ConvexTriangleMeshShape ::ConvexTriangleMeshShape (StridingMeshInterface* meshIn
///It's not nice to have all this virtual function overhead, so perhaps we can also gather the points once
///but then we are duplicating
class LocalSupportVertexCallback: public InternalTriangleIndexCallback
class LocalSupportVertexCallback: public btInternalTriangleIndexCallback
{
SimdVector3 m_supportVertexLocal;
btVector3 m_supportVertexLocal;
public:
SimdScalar m_maxDot;
SimdVector3 m_supportVecLocal;
btScalar m_maxDot;
btVector3 m_supportVecLocal;
LocalSupportVertexCallback(const SimdVector3& supportVecLocal)
LocalSupportVertexCallback(const btVector3& supportVecLocal)
: m_supportVertexLocal(0.f,0.f,0.f),
m_maxDot(-1e30f),
m_supportVecLocal(supportVecLocal)
{
}
virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex)
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
{
for (int i=0;i<3;i++)
{
SimdScalar dot = m_supportVecLocal.dot(triangle[i]);
btScalar dot = m_supportVecLocal.dot(triangle[i]);
if (dot > m_maxDot)
{
m_maxDot = dot;
@@ -58,7 +58,7 @@ public:
}
}
SimdVector3 GetSupportVertexLocal()
btVector3 GetSupportVertexLocal()
{
return m_supportVertexLocal;
}
@@ -69,30 +69,30 @@ public:
SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
{
SimdVector3 supVec(0.f,0.f,0.f);
btVector3 supVec(0.f,0.f,0.f);
SimdVector3 vec = vec0;
SimdScalar lenSqr = vec.length2();
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
if (lenSqr < 0.0001f)
{
vec.setValue(1,0,0);
} else
{
float rlen = 1.f / SimdSqrt(lenSqr );
float rlen = 1.f / btSqrt(lenSqr );
vec *= rlen;
}
LocalSupportVertexCallback supportCallback(vec);
SimdVector3 aabbMax(1e30f,1e30f,1e30f);
btVector3 aabbMax(1e30f,1e30f,1e30f);
m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
supVec = supportCallback.GetSupportVertexLocal();
return supVec;
}
void ConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const
void btConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
//use 'w' component of supportVerticesOut?
{
@@ -107,9 +107,9 @@ void ConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
for (int j=0;j<numVectors;j++)
{
const SimdVector3& vec = vectors[j];
const btVector3& vec = vectors[j];
LocalSupportVertexCallback supportCallback(vec);
SimdVector3 aabbMax(1e30f,1e30f,1e30f);
btVector3 aabbMax(1e30f,1e30f,1e30f);
m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
supportVerticesOut[j] = supportCallback.GetSupportVertexLocal();
}
@@ -118,13 +118,13 @@ void ConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertex(const SimdVector3& vec)const
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec)const
{
SimdVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
if ( GetMargin()!=0.f )
{
SimdVector3 vecnorm = vec;
btVector3 vecnorm = vec;
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
vecnorm.setValue(-1.f,-1.f,-1.f);
@@ -144,8 +144,8 @@ SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertex(const SimdVector3&
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
//Please note that you can debug-draw ConvexTriangleMeshShape with the Raytracer Demo
int ConvexTriangleMeshShape::GetNumVertices() const
//Please note that you can debug-draw btConvexTriangleMeshShape with the Raytracer Demo
int btConvexTriangleMeshShape::GetNumVertices() const
{
//cache this?
assert(0);
@@ -153,34 +153,34 @@ int ConvexTriangleMeshShape::GetNumVertices() const
}
int ConvexTriangleMeshShape::GetNumEdges() const
int btConvexTriangleMeshShape::GetNumEdges() const
{
assert(0);
return 0;
}
void ConvexTriangleMeshShape::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const
void btConvexTriangleMeshShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
{
assert(0);
}
void ConvexTriangleMeshShape::GetVertex(int i,SimdPoint3& vtx) const
void btConvexTriangleMeshShape::GetVertex(int i,btPoint3& vtx) const
{
assert(0);
}
int ConvexTriangleMeshShape::GetNumPlanes() const
int btConvexTriangleMeshShape::GetNumPlanes() const
{
return 0;
}
void ConvexTriangleMeshShape::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const
void btConvexTriangleMeshShape::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
{
assert(0);
}
//not yet
bool ConvexTriangleMeshShape::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const
bool btConvexTriangleMeshShape::IsInside(const btPoint3& pt,btScalar tolerance) const
{
assert(0);
return false;
@@ -188,7 +188,7 @@ bool ConvexTriangleMeshShape::IsInside(const SimdPoint3& pt,SimdScalar tolerance
void ConvexTriangleMeshShape::setLocalScaling(const SimdVector3& scaling)
void btConvexTriangleMeshShape::setLocalScaling(const btVector3& scaling)
{
m_stridingMesh->setScaling(scaling);
}