void   btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
{
   if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON)
   {
      btTriangleMeshShape::setLocalScaling(scaling);
	  buildOptimizedBvh();
   }
}
void   btBvhTriangleMeshShape::setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& scaling)
{
   btAssert(!m_bvh);
   btAssert(!m_ownsBvh);

   m_bvh = bvh;
   m_ownsBvh = false;
   // update the scaling without rebuilding the bvh
   if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON)
   {
      btTriangleMeshShape::setLocalScaling(scaling);
   }
}
Exemplo n.º 3
0
void   btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
{
   if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON)
   {
      btTriangleMeshShape::setLocalScaling(scaling);
      if (m_ownsBvh)
      {
         m_bvh->~btOptimizedBvh();
         btAlignedFree(m_bvh);
      }
      ///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
      void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16);
      m_bvh = new(mem) btOptimizedBvh();
      //rebuild the bvh...
      m_bvh->build(m_meshInterface,m_useQuantizedAabbCompression,m_localAabbMin,m_localAabbMax);
      m_ownsBvh = true;
   }
}