25 #if defined (__CELLOS_LV2__) && defined (__SPU__)
26 #include <spu_intrinsics.h>
30 result = spu_mul( vec0, vec1 );
31 result = spu_madd( spu_rlqwbyte( vec0, 4 ), spu_rlqwbyte( vec1, 4 ), result );
32 return spu_madd( spu_rlqwbyte( vec0, 8 ), spu_rlqwbyte( vec1, 8 ), result );
67 btVector3 vec = localDirOrg * localScaling;
69 #if defined (__CELLOS_LV2__) && defined (__SPU__)
76 int numverts = numPoints;
78 for(;v<(int)numverts-4;v+=4) {
79 vec_float4 p0 = vec_dot3(points[v ].get128(),localDir.get128());
80 vec_float4 p1 = vec_dot3(points[v+1].get128(),localDir.get128());
81 vec_float4 p2 = vec_dot3(points[v+2].get128(),localDir.get128());
82 vec_float4 p3 = vec_dot3(points[v+3].get128(),localDir.get128());
89 vec_int4 imax01 = spu_sel(i1,i0,retGt01);
92 vec_int4 imax23 = spu_sel(i3,i2,retGt23);
93 vec_uint4 retGt0123 = spu_cmpgt(pmax01,pmax23);
94 vec_float4 pmax0123 = spu_sel(pmax23,pmax01,retGt0123);
95 vec_int4 imax0123 = spu_sel(imax23,imax01,retGt0123);
96 vec_uint4 retGtMax = spu_cmpgt(v_distMax,pmax0123);
97 v_distMax = spu_sel(pmax0123,v_distMax,retGtMax);
98 v_idxMax = spu_sel(imax0123,v_idxMax,retGtMax);
100 for(;v<(int)numverts;v++) {
101 vec_float4 p = vec_dot3(points[v].get128(),localDir.get128());
103 vec_uint4 retGtMax = spu_cmpgt(v_distMax,p);
104 v_distMax = spu_sel(p,v_distMax,retGtMax);
105 v_idxMax = spu_sel(i,v_idxMax,retGtMax);
107 int ptIndex = spu_extract(v_idxMax,0);
108 const btVector3& supVec= points[ptIndex] * localScaling;
113 long ptIndex = vec.
maxDot( points, numPoints, maxDot);
115 btVector3 supVec = points[ptIndex] * localScaling;
133 #if defined( __APPLE__ ) && (defined( BT_USE_SSE )||defined( BT_USE_NEON ))
134 #if defined( BT_USE_SSE )
135 return btVector3( _mm_xor_ps( _mm_and_ps( localDir.mVec128, (__m128){-0.0f, -0.0f, -0.0f, -0.0f }), halfExtents.mVec128 ));
136 #elif defined( BT_USE_NEON )
137 return btVector3( (float32x4_t) (((uint32x4_t) localDir.mVec128 & (uint32x4_t){ 0x80000000, 0x80000000, 0x80000000, 0x80000000}) ^ (uint32x4_t) halfExtents.mVec128 ));
139 #error unknown vector arch
143 btFsels(localDir.
y(), halfExtents.y(), -halfExtents.y()),
144 btFsels(localDir.
z(), halfExtents.z(), -halfExtents.z()));
150 btVector3 dir(localDir.getX(),localDir.getY(),localDir.getZ());
152 btVector3 dots = dir.
dot3(vertices[0], vertices[1], vertices[2]);
162 btVector3 v(localDir.getX(),localDir.getY(),localDir.getZ());
163 int cylinderUpAxis = cylShape->
getUpAxis();
164 int XX(1),YY(0),ZZ(2);
166 switch (cylinderUpAxis)
196 btScalar halfHeight = halfExtents[cylinderUpAxis];
206 tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
211 tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
218 btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
222 int capsuleUpAxis = capsuleShape->getUpAxis();
224 btScalar radius = capsuleShape->getRadius();
243 pos[capsuleUpAxis] = halfHeight;
246 vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV();
247 newDot = vec.
dot(vtx);
258 pos[capsuleUpAxis] = -halfHeight;
261 vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV();
262 newDot = vec.
dot(vtx);
269 return btVector3(supVec.getX(),supVec.getY(),supVec.getZ());
287 return this->localGetSupportingVertexWithoutMargin (localDir);
371 aabbMin = center - extent;
372 aabbMax = center + extent;
382 halfExtents +=
btVector3(margin,margin,margin);
385 btVector3 extent = halfExtents.
dot3(abs_b[0], abs_b[1], abs_b[2]);
387 aabbMin = center - extent;
388 aabbMax = center + extent;
395 for (
int i=0;i<3;i++)
403 aabbMax[i] = tmp[i]+margin;
406 aabbMin[i] = tmp[i]-margin;
414 int m_upAxis = capsuleShape->
getUpAxis();
419 btVector3 extent = halfExtents.
dot3(abs_b[0], abs_b[1], abs_b[2]);
420 aabbMin = center - extent;
421 aabbMax = center + extent;
434 this->
getAabb (t, aabbMin, aabbMax);