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:
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
||||
|
||||
#include <BulletCollision/CollisionShapes/btPolyhedralConvexShape.h>
|
||||
|
||||
PolyhedralConvexShape::PolyhedralConvexShape()
|
||||
btPolyhedralConvexShape::btPolyhedralConvexShape()
|
||||
:m_optionalHull(0)
|
||||
{
|
||||
|
||||
@@ -23,26 +23,26 @@ PolyhedralConvexShape::PolyhedralConvexShape()
|
||||
|
||||
|
||||
|
||||
SimdVector3 PolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const
|
||||
btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
SimdVector3 supVec(0,0,0);
|
||||
btVector3 supVec(0,0,0);
|
||||
|
||||
SimdScalar maxDot(-1e30f);
|
||||
btScalar maxDot(-1e30f);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
SimdVector3 vtx;
|
||||
SimdScalar newDot;
|
||||
btVector3 vtx;
|
||||
btScalar newDot;
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
{
|
||||
@@ -59,12 +59,12 @@ SimdVector3 PolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const S
|
||||
|
||||
}
|
||||
|
||||
void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const
|
||||
void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
int i;
|
||||
|
||||
SimdVector3 vtx;
|
||||
SimdScalar newDot;
|
||||
btVector3 vtx;
|
||||
btScalar newDot;
|
||||
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(co
|
||||
for (int j=0;j<numVectors;j++)
|
||||
{
|
||||
|
||||
const SimdVector3& vec = vectors[j];
|
||||
const btVector3& vec = vectors[j];
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
{
|
||||
@@ -92,27 +92,27 @@ void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(co
|
||||
|
||||
|
||||
|
||||
void PolyhedralConvexShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
|
||||
void btPolyhedralConvexShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//not yet, return box inertia
|
||||
|
||||
float margin = GetMargin();
|
||||
|
||||
SimdTransform ident;
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
SimdVector3 aabbMin,aabbMax;
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
SimdScalar lx=2.f*(halfExtents.x()+margin);
|
||||
SimdScalar ly=2.f*(halfExtents.y()+margin);
|
||||
SimdScalar lz=2.f*(halfExtents.z()+margin);
|
||||
const SimdScalar x2 = lx*lx;
|
||||
const SimdScalar y2 = ly*ly;
|
||||
const SimdScalar z2 = lz*lz;
|
||||
const SimdScalar scaledmass = mass * 0.08333333f;
|
||||
btScalar lx=2.f*(halfExtents.x()+margin);
|
||||
btScalar ly=2.f*(halfExtents.y()+margin);
|
||||
btScalar lz=2.f*(halfExtents.z()+margin);
|
||||
const btScalar x2 = lx*lx;
|
||||
const btScalar y2 = ly*ly;
|
||||
const btScalar z2 = lz*lz;
|
||||
const btScalar scaledmass = mass * 0.08333333f;
|
||||
|
||||
inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2));
|
||||
inertia = scaledmass * (btVector3(y2+z2,x2+z2,x2+y2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user