Force spuNodeCallback to be 16-byte aligned, so that we can use SIMD. Related to Issue 657

Recompute the quantization values in case the maximum/minimum extends roundtrip using quantize/unQuantize are out-of-range
(alternatively, pass in a larger quantizationMargin)
This commit is contained in:
erwin.coumans
2012-10-10 04:21:36 +00:00
parent a32efa48c1
commit 79989a8d3d
2 changed files with 19 additions and 1 deletions

View File

@@ -96,7 +96,25 @@ void btQuantizedBvh::setQuantizationValues(const btVector3& bvhAabbMin,const btV
m_bvhAabbMax = bvhAabbMax + clampValue;
btVector3 aabbSize = m_bvhAabbMax - m_bvhAabbMin;
m_bvhQuantization = btVector3(btScalar(65533.0),btScalar(65533.0),btScalar(65533.0)) / aabbSize;
m_useQuantization = true;
{
unsigned short vecIn[3];
btVector3 v;
{
quantize(vecIn,bvhAabbMin,false);
v = unQuantize(vecIn);
m_bvhAabbMin.setMin(v-clampValue);
}
{
quantize(vecIn,bvhAabbMax,true);
v = unQuantize(vecIn);
m_bvhAabbMax.setMax(v+clampValue);
}
aabbSize = m_bvhAabbMax - m_bvhAabbMin;
m_bvhQuantization = btVector3(btScalar(65533.0),btScalar(65533.0),btScalar(65533.0)) / aabbSize;
}
}

View File

@@ -291,7 +291,7 @@ SIMD_FORCE_INLINE void small_cache_read_triple( void* ls0, ppu_address_t ea0,
class spuNodeCallback : public btNodeOverlapCallback
ATTRIBUTE_ALIGNED16(class) spuNodeCallback : public btNodeOverlapCallback
{
SpuCollisionPairInput* m_wuInput;
SpuContactResult& m_spuContacts;