Exemplo n.º 1
0
        internal void OnCellRequest(MyCellCoord cell, bool highPriority, Func <int> priorityFunction, Action <Color> debugDraw)
        {
            ProfilerShort.Begin("OnCellRequest");

            try
            {
                var workId = cell.PackId64();
                MyPrecalcJobRender job;
                if (m_renderWorkTracker.TryGet(workId, out job))
                {
                    if (!highPriority)
                    { // low priority work, no need to do anything
                        return;
                    }

                    if (job.IsHighPriority)
                    { // both are high priorities, so just invalidate previous one
                        m_renderWorkTracker.Invalidate(workId);
                        return;
                    }

                    // high priority arrived while there was one with low priority ... just cancel lower one
                    m_renderWorkTracker.Cancel(workId);
                }

                MyPrecalcJobRender.Start(new MyPrecalcJobRender.Args()
                {
                    Storage           = m_voxelMap.Storage,
                    ClipmapId         = ClipmapId,
                    Cell              = cell,
                    WorkId            = workId,
                    RenderWorkTracker = m_renderWorkTracker,
                    IsHighPriority    = highPriority,
                    Priority          = priorityFunction,
                    DebugDraw         = debugDraw,
                });
            }
            finally
            {
                ProfilerShort.End();
            }
        }
        internal void OnCellRequestCancelled(MyCellCoord cell)
        {
            var workId = cell.PackId64();

            m_renderWorkTracker.Cancel(workId);
        }
 internal void OnMeshMergeCancelled(uint clipmapId, ulong workId)
 {
     m_mergeWorkTracker.Cancel(workId);
 }