protected override void OnComplete()
        {
            base.OnComplete();

            if (MyPrecalcComponent.Loaded && !m_isCancelled)
            {
                Debug.Assert(m_targetPhysics.RunningBatchTask == this);
                m_targetPhysics.OnBatchTaskComplete(m_newShapes);
            }

            foreach (var newShape in m_newShapes.Values)
            {
                if (!newShape.Base.IsZero)
                {
                    newShape.Base.RemoveReference();
                }
            }

            if (m_targetPhysics.RunningBatchTask == this)
            {
                m_targetPhysics.RunningBatchTask = null;
            }
            m_targetPhysics = null;
            CellBatch.Clear();
            m_newShapes.Clear();
            m_isCancelled = false;
            m_instancePool.Deallocate(this);
        }
Beispiel #2
0
 protected override void OnComplete()
 {
     base.OnComplete();
     if (((MySession.Static != null) == MySession.Static.GetComponent <MyPrecalcComponent>().Loaded) && !this.m_isCancelled)
     {
         this.m_targetPhysics.OnBatchTaskComplete(this.m_newShapes, this.Lod);
     }
     foreach (HkBvCompressedMeshShape shape in this.m_newShapes.Values)
     {
         HkShape shape2 = shape.Base;
         if (!shape2.IsZero)
         {
             shape.Base.RemoveReference();
         }
     }
     if (ReferenceEquals(this.m_targetPhysics.RunningBatchTask[this.Lod], this))
     {
         this.m_targetPhysics.RunningBatchTask[this.Lod] = null;
     }
     this.m_targetPhysics = null;
     this.CellBatch.Clear();
     this.m_newShapes.Clear();
     this.m_isCancelled = false;
     m_instancePool.Deallocate(this);
 }
        public static void Start(MyVoxelPhysicsBody targetPhysics, ref HashSet<Vector3I> cellBatchForSwap)
        {
            var job = m_instancePool.Allocate();

            job.m_targetPhysics = targetPhysics;
            MyUtils.Swap(ref job.CellBatch, ref cellBatchForSwap);
            Debug.Assert(targetPhysics.RunningBatchTask == null);
            targetPhysics.RunningBatchTask = job;
            MyPrecalcComponent.EnqueueBack(job, false);
        }
        public static void Start(MyVoxelPhysicsBody targetPhysics, ref HashSet <Vector3I> cellBatchForSwap)
        {
            var job = m_instancePool.Allocate();

            job.m_targetPhysics = targetPhysics;
            MyUtils.Swap(ref job.CellBatch, ref cellBatchForSwap);
            Debug.Assert(targetPhysics.RunningBatchTask == null);
            targetPhysics.RunningBatchTask = job;
            MyPrecalcComponent.EnqueueBack(job, true);
        }
Beispiel #5
0
        public static void Start(MyVoxelPhysicsBody targetPhysics, ref HashSet <Vector3I> cellBatchForSwap, int lod)
        {
            MyPrecalcJobPhysicsBatch job = m_instancePool.Allocate();

            job.Lod             = lod;
            job.m_targetPhysics = targetPhysics;
            MyUtils.Swap <HashSet <Vector3I> >(ref job.CellBatch, ref cellBatchForSwap);
            targetPhysics.RunningBatchTask[lod] = job;
            MyPrecalcComponent.EnqueueBack(job);
        }
        protected override void OnComplete()
        {
            base.OnComplete();

            if (MyPrecalcComponent.Loaded && !m_isCancelled)
            {
                Debug.Assert(m_targetPhysics.RunningBatchTask == this);
                m_targetPhysics.OnBatchTaskComplete(m_newShapes);
            }

            foreach (var newShape in m_newShapes.Values)
            {
                if (!newShape.Base.IsZero)
                    newShape.Base.RemoveReference();
            }

            if (m_targetPhysics.RunningBatchTask == this)
                m_targetPhysics.RunningBatchTask = null;
            m_targetPhysics = null;
            CellBatch.Clear();
            m_newShapes.Clear();
            m_isCancelled = false;
            m_instancePool.Deallocate(this);
        }
Beispiel #7
0
 protected override void InitVoxelMap(MatrixD worldMatrix, Vector3I size, bool useOffset = true)
 {
     base.InitVoxelMap(worldMatrix, size, useOffset);
     Physics = new MyVoxelPhysicsBody(this, 3.0f);
     Physics.Enabled = true;
 }
Beispiel #8
0
        protected override void InitVoxelMap(MatrixD worldMatrix, Vector3I size, bool useOffset = true)
        {
            base.InitVoxelMap(worldMatrix, size, useOffset);

            ((MyStorageBase)Storage).InitWriteCache(8);

            ProfilerShort.Begin("new MyVoxelPhysicsBody");
            Physics = new MyVoxelPhysicsBody(this, 3.0f, lazyPhysics: DelayRigidBodyCreation);
            Physics.Enabled = !MyFakes.DISABLE_VOXEL_PHYSICS;
            ProfilerShort.End();
        }
 protected override void InitVoxelMap(Vector3D positionMinCorner, Vector3I size, bool useOffset = true)
 {
     base.InitVoxelMap(positionMinCorner, size, useOffset);
     Physics = new MyVoxelPhysicsBody(this,1.1f);
     Physics.Enabled = true;
 }
Beispiel #10
0
        protected override void InitVoxelMap(MatrixD worldMatrix, Vector3I size, bool useOffset = true)
        {
            base.InitVoxelMap(worldMatrix, size, useOffset);

            ProfilerShort.Begin("new MyVoxelPhysicsBody");
            Physics = new MyVoxelPhysicsBody(this, 3.0f, lazyPhysics: DelayRigidBodyCreation);
            Physics.Enabled = true;
            ProfilerShort.End();
        }