3 new constraints added : btGeneric6DofSpringConstraint, btUniversalConstraint, btHinge2Constraint

Motors for btConeTwistConstraint added (for obsolete solver only)
appConstraintDemo changed to test new constraints
Several coding-style fixes
This commit is contained in:
rponom
2009-05-21 22:10:13 +00:00
parent 8d9c445b73
commit c680791ce9
38 changed files with 989 additions and 412 deletions

View File

@@ -18,8 +18,6 @@ subject to the following restrictions:
#include "BulletMultiThreaded/btGpuUtilsSharedDefs.h"
#include "BulletMultiThreaded/btGpuUtilsSharedCode.h"
//----------------------------------------------------------------------------------------
#include "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h"

View File

@@ -13,21 +13,18 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//----------------------------------------------------------------------------------------
#include "LinearMath/btQuickprof.h"
//----------------------------------------------------------------------------------------
#include "LinearMath/btScalar.h"
#include "btGpuDemo2dSharedTypes.h"
//----------------------------------------------------------------------------------------
#include "BulletMultiThreaded/btGpuDefines.h"
#include "BulletMultiThreaded/btGpuUtilsSharedDefs.h"
#include "btGpuDemo2dSharedCode.h"
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

View File

@@ -13,7 +13,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//----------------------------------------------------------------------------------------
#define USE_FRICTION 1
#define FRICTION_BOX_GROUND_FACT 0.05f
@@ -21,14 +21,7 @@ subject to the following restrictions:
#define USE_CENTERS 1
//#include "LinearMath/btMinMax.h"
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//---------- C o n s t r a i n t s o l v e r d e m o ----------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
#define MAX_VTX_PER_OBJ 8

View File

@@ -13,11 +13,11 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//---------- C o n s t r a i n t s o l v e r d e m o ----------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
extern "C"
@@ -30,4 +30,4 @@ void BT_GPU_PREF(collisionBatchResolutionBox(void* constraints,int *batch,int nu
} // extern "C"
//----------------------------------------------------------------------------------------

View File

@@ -13,11 +13,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//---------- C o n s t r a i n t s o l v e r d e m o ----------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
struct btCudaPartProps
{
@@ -36,4 +32,4 @@ struct btCudaBoxProps
float maxZ;
};
//----------------------------------------------------------------------------------------

View File

@@ -13,7 +13,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//--------------------------------------------------------------------------
#include "btGpuDemoDynamicsWorld.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
@@ -28,7 +28,7 @@ subject to the following restrictions:
#include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"
//--------------------------------------------------------------------------
#define BT_GPU_PREF(func) btCuda_##func
@@ -40,11 +40,11 @@ subject to the following restrictions:
#include "btGpuDemo2dSharedDefs.h"
#undef BT_GPU_PREF
//--------------------------------------------------------------------------
btGpuDemoDynamicsWorld* gpCudaDemoDynamicsWorld = NULL;
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::grabNonContactConstraintData()
{
@@ -64,9 +64,9 @@ void btGpuDemoDynamicsWorld::grabNonContactConstraintData()
break;
}
}
} // btGpuDemoDynamicsWorld::grabNonContactConstraintData()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::grabContactData()
{
@@ -137,9 +137,9 @@ void btGpuDemoDynamicsWorld::grabContactData()
}
m_totalNumConstraints++;
}
} // btCudaDemoDynamicsWorld::grabContactData()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::grabP2PConstraintData(btPoint2PointConstraint* ct)
{
@@ -177,9 +177,9 @@ void btGpuDemoDynamicsWorld::grabP2PConstraintData(btPoint2PointConstraint* ct)
}
m_totalNumConstraints++;
m_numNonContactConstraints++;
} // btGpuDemoDynamicsWorld::grabP2PConstraintData()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::grabData()
{
@@ -214,9 +214,9 @@ void btGpuDemoDynamicsWorld::grabData()
grabContactData();
}
grabNonContactConstraintData();
} // btGpuDemoDynamicsWorld::grabGata()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::createBatches2()
{
@@ -268,9 +268,9 @@ void btGpuDemoDynamicsWorld::createBatches2()
m_numInBatches[stage] = numInBatch;
pBatchIds += numInBatch;
}
} // btGpuDemoDynamicsWorld::createBatches2()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::writebackData()
{
@@ -288,9 +288,9 @@ void btGpuDemoDynamicsWorld::writebackData()
v[2] = m_hAngVel[i + 1];
rb->setAngularVelocity(v);
}
} // btGpuDemoDynamicsWorld::writebackData()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::copyDataToGPU()
{
@@ -339,9 +339,9 @@ void btGpuDemoDynamicsWorld::copyDataToGPU()
}
#endif //BT_USE_CUDA
} // btGpuDemoDynamicsWorld::copyDataToGPU()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::setConstraintData(btCudaPartProps& partProps)
{
@@ -358,9 +358,9 @@ void btGpuDemoDynamicsWorld::setConstraintData(btCudaPartProps& partProps)
}
#endif //BT_USE_CUDA
} // btGpuDemoDynamicsWorld::setConstraintData()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::copyDataFromGPU()
{
@@ -369,9 +369,9 @@ void btGpuDemoDynamicsWorld::copyDataFromGPU()
btCuda_copyArrayFromDevice(m_hVel, m_dcVel, (m_numObj + 1) * sizeof(float4));
btCuda_copyArrayFromDevice(m_hAngVel, m_dcAngVel, (m_numObj + 1) * sizeof(float));
#endif //BT_USE_CUDA
} // btGpuDemoDynamicsWorld::copyDataFromGPU()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
{
@@ -384,9 +384,9 @@ void btGpuDemoDynamicsWorld::solveConstraints(btContactSolverInfo& solverInfo)
solveConstraints2(solverInfo);
}
m_totalNumConstraints = 0;
} // btGpuDemoDynamicsWorld::solveConstraints()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::solveConstraints2(btContactSolverInfo& solverInfo)
{
@@ -433,9 +433,9 @@ void btGpuDemoDynamicsWorld::solveConstraints2(btContactSolverInfo& solverInfo)
writebackData();
m_numSimStep++;
#endif //BT_USE_CUDA
} // btGpuDemoDynamicsWorld::solveConstraints2()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::solveConstraintsCPU2(btContactSolverInfo& solverInfo)
{
@@ -496,9 +496,9 @@ void btGpuDemoDynamicsWorld::solveConstraintsCPU2(btContactSolverInfo& solverInf
}
writebackData();
m_numSimStep++;
} // btGpuDemoDynamicsWorld::solveConstraintsCPU2()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::debugDrawConstraints(int selectedBatch, const float* pColorTab)
{
@@ -539,10 +539,9 @@ void btGpuDemoDynamicsWorld::debugDrawConstraints(int selectedBatch, const float
pBatchIds += numConstraints;
glEnd();
}
} // btGpuDemoDynamicsWorld::debugDrawConstraints()
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::initShapeBuffer(int maxShapeBufferSize)
{
@@ -557,9 +556,9 @@ void btGpuDemoDynamicsWorld::initShapeBuffer(int maxShapeBufferSize)
#endif //BT_USE_CUDA
m_copyShapeDataToGPU = true;
} // btGpuDemoDynamicsWorld::initShapeBuffer()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::freeShapeBuffer()
{
@@ -569,9 +568,9 @@ void btGpuDemoDynamicsWorld::freeShapeBuffer()
btCuda_freeArray(m_dShapeBuffer);
btCuda_freeArray(m_dShapeIds);
#endif //BT_USE_CUDA
} // btGpuDemoDynamicsWorld::freeShapeBuffer()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::addSphere(btVector3& pos, btScalar rad)
{
@@ -579,18 +578,15 @@ void btGpuDemoDynamicsWorld::addSphere(btVector3& pos, btScalar rad)
*pBuf = pos;
pBuf->setW(rad);
m_firstFreeShapeBufferOffset += sizeof(btVector3);
} // btGpuDemoDynamicsWorld::addSphere()
}
//--------------------------------------------------------------------------
void btGpuDemoDynamicsWorld::addMultiShereObject(int numSpheres, int objIndex)
{
m_hShapeIds[objIndex].x = m_firstFreeShapeBufferOffset;
m_hShapeIds[objIndex].y = numSpheres;
return;
} // btGpuDemoDynamicsWorld::addMultiShereObject()
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

View File

@@ -13,12 +13,12 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//----------------------------------------------------------------------------------------
#ifndef BT_CUDA_DEMO_DYNAMICS_WORLD_H
#define BT_CUDA_DEMO_DYNAMICS_WORLD_H
//----------------------------------------------------------------------------------------
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
@@ -46,15 +46,9 @@ subject to the following restrictions:
#undef BT_GPU_PREF
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
#include "btGpuDemo2dSharedTypes.h"
//----------------------------------------------------------------------------------------
#define CUDA_DEMO_DYNAMICS_WORLD_MAX_BATCHES 20
@@ -130,10 +124,10 @@ protected:
btVector3 m_worldMin;
btVector3 m_worldMax;
//-------------------------------
int* m_hConstraintUsed;
//-------------------------------
// shape buffer
int m_maxShapeBufferSize;
int m_firstFreeShapeBufferOffset;
@@ -146,7 +140,7 @@ protected:
void freeShapeBuffer();
void sendShapeDataToGpu();
//-------------------------------
int m_numNonContactConstraints;
void grabNonContactConstraintData();
void grabP2PConstraintData(btPoint2PointConstraint* ct);

View File

@@ -13,7 +13,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
//--------------------------------------------------------------------------
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
@@ -21,7 +21,7 @@ subject to the following restrictions:
#include "btGpuDemoDynamicsWorld.h"
//--------------------------------------------------------------------------
void btGpuDemoPairCache::processAllOverlappingPairs(btOverlapCallback* callback, btDispatcher* dispatcher)
{
@@ -41,9 +41,9 @@ void btGpuDemoPairCache::processAllOverlappingPairs(btOverlapCallback* callback,
}
}
gpCudaDemoDynamicsWorld->setTotalNumConstraints(numContConstraints);
} // btGpuDemoPairCache::processAllOverlappingPairs()
}
//--------------------------------------------------------------------------
// this will be called for each overlapping pair if collision detection uses pairCache other than btGpuDemoPairCache
// IMPORTANT : m_numConstraints in gpCudaDemoDynamicsWorld is set to 0 at start of simulation step
@@ -74,6 +74,3 @@ void cudaDemoNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher
}
} // cudaDemoNearCallback()
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------