move parts of collision pipeline to shared header files (work-in-progress)
This commit is contained in:
@@ -10,12 +10,30 @@
|
||||
#define b3Dot3F4 b3Dot
|
||||
#define b3Cross3 b3Cross
|
||||
#define b3MakeFloat4 b3MakeVector3
|
||||
inline b3Vector3 b3Normalized(const b3Vector3& vec)
|
||||
{
|
||||
return vec.normalized();
|
||||
}
|
||||
|
||||
inline b3Float4 b3FastNormalized3(b3Float4ConstArg v)
|
||||
{
|
||||
return v.normalized();
|
||||
}
|
||||
|
||||
inline b3Float4 b3MaxFloat4 (const b3Float4& a, const b3Float4& b)
|
||||
{
|
||||
b3Float4 tmp = a;
|
||||
tmp.setMax(b);
|
||||
return tmp;
|
||||
}
|
||||
inline b3Float4 b3MinFloat4 (const b3Float4& a, const b3Float4& b)
|
||||
{
|
||||
b3Float4 tmp = a;
|
||||
tmp.setMin(b);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
typedef float4 b3Float4;
|
||||
@@ -33,6 +51,11 @@
|
||||
float4 b1 = b3MakeFloat4(v1.xyz,0.f);
|
||||
return cross(a1, b1);
|
||||
}
|
||||
#define b3MinFloat4 min
|
||||
#define b3MaxFloat4 max
|
||||
|
||||
#define b3Normalized(a) normalize(a)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#ifndef B3_INT4_H
|
||||
#define B3_INT4_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "Bullet3Common/b3Scalar.h"
|
||||
|
||||
|
||||
B3_ATTRIBUTE_ALIGNED16(struct) b3UnsignedInt4
|
||||
{
|
||||
B3_DECLARE_ALIGNED_ALLOCATOR();
|
||||
@@ -51,5 +54,15 @@ B3_FORCE_INLINE b3UnsignedInt4 b3MakeUnsignedInt4(unsigned int x, unsigned int y
|
||||
return v;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#define b3UnsignedInt4 uint4
|
||||
#define b3Int4 int4
|
||||
#define b3MakeInt4 (int4)
|
||||
#define b3MakeUnsignedInt4 (uint4)
|
||||
|
||||
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //B3_INT4_H
|
||||
|
||||
@@ -8,9 +8,19 @@ struct MyTest
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define b3AtomicInc(a) ((*a)++)
|
||||
|
||||
inline int b3AtomicAdd (volatile int *p, int val)
|
||||
{
|
||||
int oldValue = *p;
|
||||
int newValue = oldValue+val;
|
||||
*p = newValue;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
#define __global
|
||||
#else
|
||||
#define b3AtomicInc atomic_inc
|
||||
#define b3AtomicAdd atomic_add
|
||||
#define b3Fabs fabs
|
||||
#define b3Sqrt native_sqrt
|
||||
#define b3Sin native_sin
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
#define b3Quat b3Quaternion
|
||||
#define b3QuatConstArg const b3Quaternion&
|
||||
inline b3Quat b3QuatInverse(b3QuatConstArg orn)
|
||||
{
|
||||
return orn.inverse();
|
||||
}
|
||||
|
||||
inline b3Float4 b3TransformPoint(b3Float4ConstArg point, b3Float4ConstArg translation, b3QuatConstArg orientation)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user