예제 #1
0
 public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelGeometry.CellData cache, Vector3I voxelStart)
 {
     Type = type;
     VoxelMap = voxelMap;
     Cache = cache;
     VoxelStart = voxelStart;
 }
        protected override void UnloadData()
        {
            UnloadCache();

            m_cellsPreallocated = null;
            m_priority = null;
            m_priorityArray = null;
            if (m_dataCellsQueue != null)
            {
                m_dataCellsQueue.Clear();
            }
            m_helperLodCachedDataCell = null;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public override void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyVoxelCacheRender.LoadData");

            MySandboxGame.Log.WriteLine("MyVoxelCacheRender.LoadData() - START");
            MySandboxGame.Log.IncreaseIndent();

            m_capacity = MyVoxelConstants.RENDER_CELL_CACHE_SIZE;
            m_cellsByCoordinate = new Dictionary<Int64, LinkedListNode<MyVoxelCacheCellRender>>(m_capacity);
            m_priority = new LinkedList<MyVoxelCacheCellRender>();
            m_priorityArray = new LinkedListNode<MyVoxelCacheCellRender>[m_capacity];
            m_cellsPreallocated = new MyVoxelCacheCellRender[m_capacity];
            m_helperLodCachedDataCell = new MyVoxelGeometry.CellData();
            m_dataCellsQueue = new List<MyVoxelGeometry.CellData>(MyVoxelConstants.RENDER_CELL_SIZE_IN_GEOMETRY_CELLS_TOTAL);
            for (int i = 0; i < m_capacity; i++)
            {
                m_cellsPreallocated[i] = new MyVoxelCacheCellRender();
                m_priorityArray[i] = new LinkedListNode<MyVoxelCacheCellRender>(m_cellsPreallocated[i]);
                m_priority.AddLast(m_priorityArray[i]);
            }
            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyVoxelCacheRender.LoadData() - END");
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

            LoadCache();
        }