Replaced most STL std::vector with btAlignedObjectArray.

Same interface but less features (push_back, pop_back, clear, size, [] etc).
To prepare for SIMD/SSE code: Added 		#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
This commit is contained in:
ejcoumans
2006-12-06 04:22:36 +00:00
parent 2f21514f3d
commit bf591b44ec
29 changed files with 363 additions and 72 deletions

View File

@@ -261,7 +261,7 @@ void btDiscreteDynamicsWorld::internalSingleStepSimulation(float timeStep)
dispatchInfo.m_debugDraw = getDebugDrawer();
///perform collision detection
performDiscreteCollisionDetection(dispatchInfo);
performDiscreteCollisionDetection();
calculateSimulationIslands();

View File

@@ -110,16 +110,17 @@ btRigidBody::btRigidBody( float mass,const btTransform& worldTransform,btCollisi
#endif //OBSOLETE_MOTIONSTATE_LESS
#define EXPERIMENTAL_JITTER_REMOVAL 1
//#define EXPERIMENTAL_JITTER_REMOVAL 1
#ifdef EXPERIMENTAL_JITTER_REMOVAL
//Bullet 2.20b has experimental damping code to reduce jitter just before objects fall asleep/deactivate
//doesn't work very well yet (value 0 disabled this damping)
//note there this influences deactivation thresholds!
float gClippedAngvelThresholdSqr = 0.01f;
float gClippedLinearThresholdSqr = 0.01f;
float gJitterVelocityDampingFactor = 1.f;
#endif //EXPERIMENTAL_JITTER_REMOVAL
float gJitterVelocityDampingFactor = 1.f;
void btRigidBody::predictIntegratedTransform(btScalar timeStep,btTransform& predictedTransform)
{

View File

@@ -46,13 +46,13 @@ int btSimpleDynamicsWorld::stepSimulation( float timeStep,int maxSubSteps, floa
///apply gravity, predict motion
predictUnconstraintMotion(timeStep);
btDispatcherInfo dispatchInfo;
btDispatcherInfo& dispatchInfo = getDispatchInfo();
dispatchInfo.m_timeStep = timeStep;
dispatchInfo.m_stepCount = 0;
dispatchInfo.m_debugDraw = getDebugDrawer();
///perform collision detection
performDiscreteCollisionDetection(dispatchInfo );
performDiscreteCollisionDetection();
///solve contact constraints
int numManifolds = m_dispatcher1->getNumManifolds();

View File

@@ -128,11 +128,10 @@ void btRaycastVehicle::updateWheelTransform( int wheelIndex , bool interpolatedT
void btRaycastVehicle::resetSuspension()
{
std::vector<btWheelInfo>::iterator wheelIt;
for (wheelIt = m_wheelInfo.begin();
!(wheelIt == m_wheelInfo.end());wheelIt++)
int i;
for (i=0;i<m_wheelInfo.size(); i++)
{
btWheelInfo& wheel = *wheelIt;
btWheelInfo& wheel = m_wheelInfo[i];
wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength();
wheel.m_suspensionRelativeVelocity = 0.0f;
@@ -285,23 +284,21 @@ void btRaycastVehicle::updateVehicle( btScalar step )
//
// simulate suspension
//
std::vector<btWheelInfo>::iterator wheelIt;
int i=0;
for (wheelIt = m_wheelInfo.begin();
!(wheelIt == m_wheelInfo.end());wheelIt++,i++)
for (i=0;i<m_wheelInfo.size();i++)
{
btScalar depth;
depth = rayCast( *wheelIt );
depth = rayCast( m_wheelInfo[i]);
}
updateSuspension(step);
for (wheelIt = m_wheelInfo.begin();
!(wheelIt == m_wheelInfo.end());wheelIt++)
for (i=0;i<m_wheelInfo.size();i++)
{
//apply suspension force
btWheelInfo& wheel = *wheelIt;
btWheelInfo& wheel = m_wheelInfo[i];
float suspensionForce = wheel.m_wheelsSuspensionForce;
@@ -322,10 +319,9 @@ void btRaycastVehicle::updateVehicle( btScalar step )
updateFriction( step);
for (wheelIt = m_wheelInfo.begin();
!(wheelIt == m_wheelInfo.end());wheelIt++)
for (i=0;i<m_wheelInfo.size();i++)
{
btWheelInfo& wheel = *wheelIt;
btWheelInfo& wheel = m_wheelInfo[i];
btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - getRigidBody()->getCenterOfMassPosition();
btVector3 vel = getRigidBody()->getVelocityInLocalPoint( relpos );

View File

@@ -15,7 +15,7 @@
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
#include "btVehicleRaycaster.h"
class btDynamicsWorld;
#include "LinearMath/btAlignedObjectArray.h"
#include "btWheelInfo.h"
class btVehicleTuning;
@@ -95,7 +95,7 @@ public:
return int (m_wheelInfo.size());
}
std::vector<btWheelInfo> m_wheelInfo;
btAlignedObjectArray<btWheelInfo> m_wheelInfo;
const btWheelInfo& getWheelInfo(int index) const;