Example #1
0
        public void SetOptimizedBvh(OptimizedBvh bvh, ref IndexedVector3 scaling)
        {
            Debug.Assert(m_bvh == null);
            Debug.Assert(m_ownsBvh == false);

            m_bvh     = bvh;
            m_ownsBvh = false;
            // update the scaling without rebuilding the bvh
            if ((GetLocalScaling() - scaling).LengthSquared() > MathUtil.SIMD_EPSILON)
            {
                base.SetLocalScaling(ref scaling);
            }
        }
Example #2
0
 private void BuildOptimizedBvh()
 {
     if (m_ownsBvh)
     {
         m_bvh.Cleanup();
         m_bvh = null;
     }
     ///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 OptimizedBvh();
     //rebuild the bvh...
     m_bvh.Build(m_meshInterface, m_useQuantizedAabbCompression, ref m_localAabbMin, ref m_localAabbMax);
     m_ownsBvh = true;
 }
Example #3
0
        ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
        public BvhTriangleMeshShape(StridingMeshInterface meshInterface, bool useQuantizedAabbCompression, ref IndexedVector3 bvhAabbMin, ref IndexedVector3 bvhAabbMax, bool buildBvh)
            : base(meshInterface)
        {
            m_bvh     = null;
            m_ownsBvh = false;
            m_useQuantizedAabbCompression = useQuantizedAabbCompression;
            m_shapeType = BroadphaseNativeTypes.TRIANGLE_MESH_SHAPE_PROXYTYPE;
#if !DISABLE_BVH
            if (buildBvh)
            {
                m_bvh = new OptimizedBvh();

                m_bvh.Build(meshInterface, m_useQuantizedAabbCompression, ref bvhAabbMin, ref bvhAabbMax);
                m_ownsBvh = true;
            }
#endif //DISABLE_BVH
        }