Applied FSelUsage.patch, thanks a lot Marten Svanfeldt, Starbreeze Studios
This commit is contained in:
@@ -37,15 +37,11 @@ public:
|
|||||||
|
|
||||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||||
{
|
{
|
||||||
|
|
||||||
btVector3 halfExtents = getHalfExtents();
|
btVector3 halfExtents = getHalfExtents();
|
||||||
|
|
||||||
btVector3 supVertex;
|
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||||
supVertex = btPoint3(vec.x() < btScalar(0.0) ? -halfExtents.x() : halfExtents.x(),
|
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||||
vec.y() < btScalar(0.0) ? -halfExtents.y() : halfExtents.y(),
|
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||||
vec.z() < btScalar(0.0) ? -halfExtents.z() : halfExtents.z());
|
|
||||||
|
|
||||||
return supVertex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual inline btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
virtual inline btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||||
@@ -54,9 +50,9 @@ public:
|
|||||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||||
halfExtents -= margin;
|
halfExtents -= margin;
|
||||||
|
|
||||||
return btVector3(vec.x() < btScalar(0.0) ? -halfExtents.x() : halfExtents.x(),
|
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||||
vec.y() < btScalar(0.0) ? -halfExtents.y() : halfExtents.y(),
|
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||||
vec.z() < btScalar(0.0) ? -halfExtents.z() : halfExtents.z());
|
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||||
@@ -69,9 +65,9 @@ public:
|
|||||||
for (int i=0;i<numVectors;i++)
|
for (int i=0;i<numVectors;i++)
|
||||||
{
|
{
|
||||||
const btVector3& vec = vectors[i];
|
const btVector3& vec = vectors[i];
|
||||||
supportVerticesOut[i].setValue(vec.x() < btScalar(0.0) ? -halfExtents.x() : halfExtents.x(),
|
supportVerticesOut[i].setValue(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||||
vec.y() < btScalar(0.0) ? -halfExtents.y() : halfExtents.y(),
|
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||||
vec.z() < btScalar(0.0) ? -halfExtents.z() : halfExtents.z());
|
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -291,3 +287,4 @@ public:
|
|||||||
|
|
||||||
#endif //OBB_BOX_MINKOWSKI_H
|
#endif //OBB_BOX_MINKOWSKI_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ subject to the following restrictions:
|
|||||||
#define SIMD_QUADWORD_H
|
#define SIMD_QUADWORD_H
|
||||||
|
|
||||||
#include "btScalar.h"
|
#include "btScalar.h"
|
||||||
|
#include "btSimdMinMax.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///btQuadWord is base-class for vectors, points
|
///btQuadWord is base-class for vectors, points
|
||||||
@@ -104,32 +103,18 @@ class btQuadWord
|
|||||||
|
|
||||||
SIMD_FORCE_INLINE void setMax(const btQuadWord& other)
|
SIMD_FORCE_INLINE void setMax(const btQuadWord& other)
|
||||||
{
|
{
|
||||||
if (other.m_x > m_x)
|
btSetMax(m_x, other.m_x);
|
||||||
m_x = other.m_x;
|
btSetMax(m_y, other.m_y);
|
||||||
|
btSetMax(m_z, other.m_z);
|
||||||
if (other.m_y > m_y)
|
btSetMax(m_unusedW, other.m_unusedW);
|
||||||
m_y = other.m_y;
|
|
||||||
|
|
||||||
if (other.m_z > m_z)
|
|
||||||
m_z = other.m_z;
|
|
||||||
|
|
||||||
if (other.m_unusedW > m_unusedW)
|
|
||||||
m_unusedW = other.m_unusedW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMD_FORCE_INLINE void setMin(const btQuadWord& other)
|
SIMD_FORCE_INLINE void setMin(const btQuadWord& other)
|
||||||
{
|
{
|
||||||
if (other.m_x < m_x)
|
btSetMin(m_x, other.m_x);
|
||||||
m_x = other.m_x;
|
btSetMin(m_y, other.m_y);
|
||||||
|
btSetMin(m_z, other.m_z);
|
||||||
if (other.m_y < m_y)
|
btSetMin(m_unusedW, other.m_unusedW);
|
||||||
m_y = other.m_y;
|
|
||||||
|
|
||||||
if (other.m_z < m_z)
|
|
||||||
m_z = other.m_z;
|
|
||||||
|
|
||||||
if (other.m_unusedW < m_unusedW)
|
|
||||||
m_unusedW = other.m_unusedW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ subject to the following restrictions:
|
|||||||
#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
|
#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#define BT_USE_VMX128
|
#define BT_USE_VMX128
|
||||||
|
|
||||||
|
#include <ppcintrinsics.h>
|
||||||
|
#define BT_HAVE_NATIVE_FSEL
|
||||||
|
#define btFsel(a,b,c) __fsel((a),(b),(c))
|
||||||
#else
|
#else
|
||||||
#define BT_USE_SSE
|
#define BT_USE_SSE
|
||||||
#endif
|
#endif
|
||||||
@@ -177,5 +181,12 @@ SIMD_FORCE_INLINE btScalar btDegrees(btScalar x) { return x * SIMD_DEGS_PER_RAD;
|
|||||||
|
|
||||||
#define BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
|
#define BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
|
||||||
|
|
||||||
|
#ifndef btFsel
|
||||||
|
SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c)
|
||||||
|
{
|
||||||
|
return a >= 0 ? b : c;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#define btFsels(a,b,c) (btScalar)btFsel(a,b,c)
|
||||||
|
|
||||||
#endif //SIMD___SCALAR_H
|
#endif //SIMD___SCALAR_H
|
||||||
|
|||||||
@@ -38,4 +38,39 @@ SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) {
|
|||||||
if (a < b) a = b;
|
if (a < b) a = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specialize on float/double for platforms that have btFsel natively
|
||||||
|
#ifdef BT_HAVE_NATIVE_FSEL
|
||||||
|
SIMD_FORCE_INLINE float btMin( float a, float b) {
|
||||||
|
return (float)btFsel((a-b), b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE float btMax( float a, float b) {
|
||||||
|
return (float)btFsel((a-b), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE void btSetMin(float& a, float b) {
|
||||||
|
a = (float)btFsel((a-b), b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE void btSetMax(float& a, float b) {
|
||||||
|
a = (float)btFsel((a-b), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE double btMin( double a, double b) {
|
||||||
|
return btFsel((a-b), b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE double btMax( double a, double b) {
|
||||||
|
return btFsel((a-b), a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE void btSetMin(double& a, double b) {
|
||||||
|
a = btFsel((a-b), b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMD_FORCE_INLINE void btSetMax(double& a, double b) {
|
||||||
|
a = btFsel((a-b), a, b);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user