Several changes to sync Bullet trunk with PlayStation 3 spubullet version

Still needs some cross-platform fixes
This commit is contained in:
erwin.coumans
2010-07-08 17:02:38 +00:00
parent 76a58e1f4e
commit fbc17731ec
63 changed files with 10363 additions and 522 deletions

View File

@@ -17,7 +17,7 @@ subject to the following restrictions:
#ifndef GEN_MINMAX_H
#define GEN_MINMAX_H
#include "btScalar.h"
#include "LinearMath/btScalar.h"
template <class T>
SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b)
@@ -32,7 +32,7 @@ SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b)
}
template <class T>
SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub)
SIMD_FORCE_INLINE const T& btClamped(const T& a, const T& lb, const T& ub)
{
return a < lb ? lb : (ub < a ? ub : a);
}
@@ -56,7 +56,7 @@ SIMD_FORCE_INLINE void btSetMax(T& a, const T& b)
}
template <class T>
SIMD_FORCE_INLINE void GEN_clamp(T& a, const T& lb, const T& ub)
SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub)
{
if (a < lb)
{

View File

@@ -57,6 +57,11 @@ public:
return m_freeCount;
}
int getUsedCount() const
{
return m_maxElements - m_freeCount;
}
void* allocate(int size)
{
// release mode fix
@@ -96,6 +101,15 @@ public:
return m_elemSize;
}
unsigned char* getPoolAddress()
{
return m_pool;
}
const unsigned char* getPoolAddress() const
{
return m_pool;
}
};

View File

@@ -93,7 +93,7 @@ inline int btGetVersion()
#else
#if defined (__CELLOS_LV2__)
#define SIMD_FORCE_INLINE inline
#define SIMD_FORCE_INLINE inline __attribute__((always_inline))
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64)))
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
@@ -101,7 +101,14 @@ inline int btGetVersion()
#include <assert.h>
#endif
#ifdef BT_DEBUG
#define btAssert assert
#ifdef __SPU__
#include <spu_printf.h>
#define printf spu_printf
#define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}}
#else
#define btAssert assert
#endif
#else
#define btAssert(x)
#endif

View File

@@ -667,23 +667,32 @@ SIMD_FORCE_INLINE void btUnSwapVector3Endian(btVector3& vector)
vector = swappedVec;
}
SIMD_FORCE_INLINE void btPlaneSpace1 (const btVector3& n, btVector3& p, btVector3& q)
template <class T>
SIMD_FORCE_INLINE void btPlaneSpace1 (const T& n, T& p, T& q)
{
if (btFabs(n.z()) > SIMDSQRT12) {
if (btFabs(n[2]) > SIMDSQRT12) {
// choose p in y-z plane
btScalar a = n[1]*n[1] + n[2]*n[2];
btScalar k = btRecipSqrt (a);
p.setValue(0,-n[2]*k,n[1]*k);
p[0] = 0;
p[1] = -n[2]*k;
p[2] = n[1]*k;
// set q = n x p
q.setValue(a*k,-n[0]*p[2],n[0]*p[1]);
q[0] = a*k;
q[1] = -n[0]*p[2];
q[2] = n[0]*p[1];
}
else {
// choose p in x-y plane
btScalar a = n.x()*n.x() + n.y()*n.y();
btScalar a = n[0]*n[0] + n[1]*n[1];
btScalar k = btRecipSqrt (a);
p.setValue(-n.y()*k,n.x()*k,0);
p[0] = -n[1]*k;
p[1] = n[0]*k;
p[2] = 0;
// set q = n x p
q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k);
q[0] = -n[2]*p[1];
q[1] = n[2]*p[0];
q[2] = a*k;
}
}