Added preliminary cmake support for PE branch, Win32 only for now.

This commit is contained in:
erwin.coumans
2011-01-07 01:48:50 +00:00
parent 22ff43e388
commit f10846ed7a
12 changed files with 143 additions and 80 deletions

View File

@@ -42,8 +42,11 @@ typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollisionDispa
///Time of Impact, Closest Points and Penetration Depth.
class btCollisionDispatcher : public btDispatcher
{
protected:
int m_dispatcherFlags;
btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr;
btManifoldResult m_defaultManifoldResult;

View File

@@ -277,13 +277,13 @@ void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,co
nodeSubPart);
unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT||indicestype==PHY_UCHAR);
const btVector3& meshScaling = m_meshInterface->getScaling();
for (int j=2;j>=0;j--)
{
int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:indicestype==PHY_INTEGER?gfxbase[j]:((unsigned char*)gfxbase)[j];
#ifdef DEBUG_TRIANGLE_MESH

View File

@@ -88,6 +88,21 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
}
break;
}
case PHY_UCHAR:
{
for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
{
unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
}
break;
}
default:
btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
}
@@ -130,6 +145,21 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
}
break;
}
case PHY_UCHAR:
{
for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
{
unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
}
break;
}
default:
btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
}
@@ -266,6 +296,24 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s
}
break;
}
case PHY_UCHAR:
{
if (numtriangles)
{
btChunk* chunk = serializer->allocate(sizeof(btCharIndexTripletData),numtriangles);
btCharIndexTripletData* tmpIndices = (btCharIndexTripletData*)chunk->m_oldPtr;
memPtr->m_3indices8 = (btCharIndexTripletData*) serializer->getUniquePointer(tmpIndices);
for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
{
unsigned char* tri_indices= (unsigned char*)(indexbase+gfxindex*indexstride);
tmpIndices[gfxindex].m_values[0] = tri_indices[0];
tmpIndices[gfxindex].m_values[1] = tri_indices[1];
tmpIndices[gfxindex].m_values[2] = tri_indices[2];
}
serializer->finalizeChunk(chunk,"btCharIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
}
break;
}
default:
{
btAssert(0);

View File

@@ -116,6 +116,13 @@ struct btShortIntIndexTripletData
char m_pad[2];
};
struct btCharIndexTripletData
{
unsigned char m_values[3];
char m_pad;
};
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btMeshPartData
{
@@ -124,6 +131,7 @@ struct btMeshPartData
btIntIndexData *m_indices32;
btShortIntIndexTripletData *m_3indices16;
btCharIndexTripletData *m_3indices8;
btShortIntIndexData *m_indices16;//backwards compatibility

View File

@@ -19,16 +19,21 @@ subject to the following restrictions:
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransformUtil.h"
// Don't change following order of parameters
ATTRIBUTE_ALIGNED16(struct) PfxConstraintRow {
btScalar mNormal[3];
btScalar mRhs;
btScalar mJacDiagInv;
btScalar mLowerLimit;
btScalar mUpperLimit;
btScalar mAccumImpulse;
};
#if 1 //#ifdef PFX_USE_FREE_VECTORMATH
#include "physics_effects\base_level\solver\pfx_constraint_row.h"
typedef sce::PhysicsEffects::PfxConstraintRow btConstraintRow;
#else
// Don't change following order of parameters
ATTRIBUTE_ALIGNED16(struct) btConstraintRow {
btScalar m_normal[3];
btScalar m_rhs;
btScalar m_jacDiagInv;
btScalar m_lowerLimit;
btScalar m_upperLimit;
btScalar m_accumImpulse;
};
typedef btConstraintRow PfxConstraintRow;
#endif //PFX_USE_FREE_VECTORMATH
@@ -71,9 +76,9 @@ class btManifoldPoint
m_contactCFM2(0.f),
m_lifeTime(0)
{
mConstraintRow[0].mAccumImpulse = 0.f;
mConstraintRow[1].mAccumImpulse = 0.f;
mConstraintRow[2].mAccumImpulse = 0.f;
mConstraintRow[0].m_accumImpulse = 0.f;
mConstraintRow[1].m_accumImpulse = 0.f;
mConstraintRow[2].m_accumImpulse = 0.f;
}
@@ -113,7 +118,7 @@ class btManifoldPoint
PfxConstraintRow mConstraintRow[3];
btConstraintRow mConstraintRow[3];
btScalar getDistance() const

View File

@@ -146,9 +146,9 @@ public:
m_pointCache[index] = m_pointCache[lastUsedIndex];
//get rid of duplicated userPersistentData pointer
m_pointCache[lastUsedIndex].m_userPersistentData = 0;
m_pointCache[lastUsedIndex].mConstraintRow[0].mAccumImpulse = 0.f;
m_pointCache[lastUsedIndex].mConstraintRow[1].mAccumImpulse = 0.f;
m_pointCache[lastUsedIndex].mConstraintRow[2].mAccumImpulse = 0.f;
m_pointCache[lastUsedIndex].mConstraintRow[0].m_accumImpulse = 0.f;
m_pointCache[lastUsedIndex].mConstraintRow[1].m_accumImpulse = 0.f;
m_pointCache[lastUsedIndex].mConstraintRow[2].m_accumImpulse = 0.f;
m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f;
m_pointCache[lastUsedIndex].m_lateralFrictionInitialized = false;
@@ -167,9 +167,9 @@ public:
#define MAINTAIN_PERSISTENCY 1
#ifdef MAINTAIN_PERSISTENCY
int lifeTime = m_pointCache[insertIndex].getLifeTime();
btScalar appliedImpulse = m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse;
btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse;
btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse;
btScalar appliedImpulse = m_pointCache[insertIndex].mConstraintRow[0].m_accumImpulse;
btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].mConstraintRow[1].m_accumImpulse;
btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].mConstraintRow[2].m_accumImpulse;
// bool isLateralFrictionInitialized = m_pointCache[insertIndex].m_lateralFrictionInitialized;
@@ -184,9 +184,9 @@ public:
m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1;
m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2;
m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse = appliedImpulse;
m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse = appliedLateralImpulse1;
m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse = appliedLateralImpulse2;
m_pointCache[insertIndex].mConstraintRow[0].m_accumImpulse = appliedImpulse;
m_pointCache[insertIndex].mConstraintRow[1].m_accumImpulse = appliedLateralImpulse1;
m_pointCache[insertIndex].mConstraintRow[2].m_accumImpulse = appliedLateralImpulse2;
m_pointCache[insertIndex].m_lifeTime = lifeTime;