Пример #1
0
 public void Teardown()
 {
     if (voxelDataVolume.IsCreated)
     {
         voxelDataVolume.Dispose();
     }
 }
Пример #2
0
        /// <summary>
        /// Sets the chunk data of the chunk at <paramref name="chunkCoordinate"/> without checking if data already exists at <paramref name="chunkCoordinate"/>
        /// </summary>
        /// <param name="chunkCoordinate">The coordinate of the chunk</param>
        /// <param name="newData">The data to set the chunk's data to</param>
        /// <param name="dataExistsAtCoordinate">Does data already exist at <paramref name="chunkCoordinate"/></param>
        public virtual void SetDataChunkUnchecked(int3 chunkCoordinate, VoxelDataVolume <T> newData, bool dataExistsAtCoordinate)
        {
            if (dataExistsAtCoordinate)
            {
                _chunks[chunkCoordinate].CopyFrom(newData);
                newData.Dispose();
            }
            else
            {
                _chunks.Add(chunkCoordinate, newData);
            }

            if (VoxelWorld.ChunkStore.TryGetDataChunk(chunkCoordinate, out ChunkProperties chunkProperties))
            {
                chunkProperties.HasChanges = true;
            }
        }