@Override public void setLocalScaling(Vector3f scaling) { stack.vectors.push(); try { Vector3f tmp = stack.vectors.get(); tmp.sub(getLocalScaling(), scaling); if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) { super.setLocalScaling(scaling); /* if (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 bvh = new OptimizedBvh(); // rebuild the bvh... bvh.build(meshInterface, useQuantizedAabbCompression, localAabbMin, localAabbMax); } } finally { stack.vectors.pop(); } }
public void setOptimizedBvh(OptimizedBvh bvh, Vector3f scaling) { assert (this.bvh == null); assert (!ownsBvh); this.bvh = bvh; ownsBvh = false; // update the scaling without rebuilding the bvh Vector3f tmp = new Vector3f(); tmp.sub(getLocalScaling(new Vector3f()), scaling); if (tmp.lengthSquared() > BulletGlobals.SIMD_EPSILON) { super.setLocalScaling(scaling); } }