private void ReadDatForChunk(VoxelChunk chunk, MyStorageDataTypeFlags data)
        {
            var rangeStart = chunk.Coords << VoxelChunk.SizeBits;
            var rangeEnd   = ((chunk.Coords + 1) << VoxelChunk.SizeBits) - 1;

            MyStorageData storage = chunk.MakeData();

            MyVoxelRequestFlags flags = 0;

            ReadRangeInternal(storage, ref Vector3I.Zero, data, 0, ref rangeStart, ref rangeEnd, ref flags);

            chunk.Cached |= data;
        }
        private void WriteChunk(ref Vector3I coords, VoxelChunk chunk)
        {
            // We assume that we are locked here.
            Debug.Assert(m_storageLock.Owned);

            var start = coords << VoxelChunk.SizeBits;

            var end = ((coords + 1) << VoxelChunk.SizeBits) - 1;

            MyStorageData storage = chunk.MakeData();

            WriteRangeInternal(storage, chunk.Dirty, ref start, ref end);

            chunk.Dirty = 0;
        }
        private void ReadDatForChunk(VoxelChunk chunk, MyStorageDataTypeFlags data)
        {
            var rangeStart = chunk.Coords << VoxelChunk.SizeBits;
            var rangeEnd = ((chunk.Coords + 1) << VoxelChunk.SizeBits) - 1;

            MyStorageData storage = chunk.MakeData();

            MyVoxelRequestFlags flags = 0;

            ReadRangeInternal(storage, ref Vector3I.Zero, data, 0, ref rangeStart, ref rangeEnd, ref flags);

            chunk.Cached |= data;
            chunk.MaxLod = 0;
        }
        private void WriteChunk(ref Vector3I coords, VoxelChunk chunk)
        {
            // We assume that we are locked here.
            Debug.Assert(m_storageLock.Owned);

            var start = coords << VoxelChunk.SizeBits;

            var end = ((coords + 1) << VoxelChunk.SizeBits) - 1;

            MyStorageData storage = chunk.MakeData();
            WriteRangeInternal(storage, chunk.Dirty, ref start, ref end);

            chunk.Dirty = 0;
        }