16 #if defined (_WIN32) || defined (__i386__)
17 #define BT_USE_SSE_IN_API
30 #if defined (__CELLOS_LV2__) && defined (__SPU__)
31 #include <spu_intrinsics.h>
32 static inline vec_float4 vec_dot3( vec_float4 vec0, vec_float4 vec1 )
35 result = spu_mul( vec0, vec1 );
36 result = spu_madd( spu_rlqwbyte( vec0, 4 ), spu_rlqwbyte( vec1, 4 ), result );
37 return spu_madd( spu_rlqwbyte( vec0, 8 ), spu_rlqwbyte( vec1, 8 ), result );
76 btVector3 vec = localDirOrg * localScaling;
78 #if defined (__CELLOS_LV2__) && defined (__SPU__)
82 vec_float4 v_distMax = {-FLT_MAX,0,0,0};
83 vec_int4 v_idxMax = {-999,0,0,0};
85 int numverts = numPoints;
87 for(;v<(int)numverts-4;v+=4) {
88 vec_float4 p0 = vec_dot3(points[v ].get128(),localDir.get128());
89 vec_float4 p1 = vec_dot3(points[v+1].get128(),localDir.get128());
90 vec_float4 p2 = vec_dot3(points[v+2].get128(),localDir.get128());
91 vec_float4 p3 = vec_dot3(points[v+3].get128(),localDir.get128());
92 const vec_int4 i0 = {v ,0,0,0};
93 const vec_int4 i1 = {v+1,0,0,0};
94 const vec_int4 i2 = {v+2,0,0,0};
95 const vec_int4 i3 = {v+3,0,0,0};
96 vec_uint4 retGt01 = spu_cmpgt(p0,p1);
97 vec_float4 pmax01 = spu_sel(p1,p0,retGt01);
98 vec_int4 imax01 = spu_sel(i1,i0,retGt01);
99 vec_uint4 retGt23 = spu_cmpgt(p2,p3);
100 vec_float4 pmax23 = spu_sel(p3,p2,retGt23);
101 vec_int4 imax23 = spu_sel(i3,i2,retGt23);
102 vec_uint4 retGt0123 = spu_cmpgt(pmax01,pmax23);
103 vec_float4 pmax0123 = spu_sel(pmax23,pmax01,retGt0123);
104 vec_int4 imax0123 = spu_sel(imax23,imax01,retGt0123);
105 vec_uint4 retGtMax = spu_cmpgt(v_distMax,pmax0123);
106 v_distMax = spu_sel(pmax0123,v_distMax,retGtMax);
107 v_idxMax = spu_sel(imax0123,v_idxMax,retGtMax);
109 for(;v<(int)numverts;v++) {
110 vec_float4 p = vec_dot3(points[v].get128(),localDir.get128());
111 const vec_int4 i = {v,0,0,0};
112 vec_uint4 retGtMax = spu_cmpgt(v_distMax,p);
113 v_distMax = spu_sel(p,v_distMax,retGtMax);
114 v_idxMax = spu_sel(i,v_idxMax,retGtMax);
116 int ptIndex = spu_extract(v_idxMax,0);
117 const btVector3& supVec= points[ptIndex] * localScaling;
122 long ptIndex = vec.
maxDot( points, numPoints, maxDot);
124 btVector3 supVec = points[ptIndex] * localScaling;
142 #if defined( __APPLE__ ) && (defined( BT_USE_SSE )||defined( BT_USE_NEON ))
143 #if defined( BT_USE_SSE )
144 return btVector3( _mm_xor_ps( _mm_and_ps( localDir.mVec128, (__m128){-0.0f, -0.0f, -0.0f, -0.0f }), halfExtents.mVec128 ));
145 #elif defined( BT_USE_NEON )
146 return btVector3( (float32x4_t) (((uint32x4_t) localDir.mVec128 & (uint32x4_t){ 0x80000000, 0x80000000, 0x80000000, 0x80000000}) ^ (uint32x4_t) halfExtents.mVec128 ));
148 #error unknown vector arch
152 btFsels(localDir.
y(), halfExtents.
y(), -halfExtents.
y()),
153 btFsels(localDir.
z(), halfExtents.
z(), -halfExtents.
z()));
161 btVector3 dots = dir.
dot3(vertices[0], vertices[1], vertices[2]);
172 int cylinderUpAxis = cylShape->
getUpAxis();
173 int XX(1),YY(0),ZZ(2);
175 switch (cylinderUpAxis)
205 btScalar halfHeight = halfExtents[cylinderUpAxis];
215 tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
220 tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
231 int capsuleUpAxis = capsuleShape->
getUpAxis();
251 pos[capsuleUpAxis] = halfHeight;
254 newDot = vec.
dot(vtx);
265 pos[capsuleUpAxis] = -halfHeight;
268 newDot = vec.
dot(vtx);
382 aabbMin = center - extent;
383 aabbMax = center + extent;
393 halfExtents +=
btVector3(margin,margin,margin);
396 btVector3 extent = halfExtents.
dot3(abs_b[0], abs_b[1], abs_b[2]);
398 aabbMin = center - extent;
399 aabbMax = center + extent;
406 for (
int i=0;i<3;i++)
414 aabbMax[i] = tmp[i]+margin;
417 aabbMin[i] = tmp[i]-margin;
425 int m_upAxis = capsuleShape->
getUpAxis();
429 btVector3 extent = halfExtents.
dot3(abs_b[0], abs_b[1], abs_b[2]);
430 aabbMin = center - extent;
431 aabbMax = center + extent;
444 this->
getAabb (t, aabbMin, aabbMax);