示例#1
0
        public void SetVoxel(int x, int y, int z, Voxel voxel, bool notify = true)
        {
            //TODO: Writing blocks with different sizes/linking through a WriteBlock function
            var chunk = GetOrCreateChunkFromWorldPosition(x, y, z);

            VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
            chunk.SetVoxel(x, y, z, voxel, notify);
        }
示例#2
0
 public void SetVoxelInExistingChunk(int x, int y, int z, Voxel voxel)
 {
     GetNextChunk(x, y, z, false);
     if (LastChunk != null)
     {
         VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
         LastChunk.SetVoxel(x, y, z, voxel, !InBatchMode);
     }
 }
示例#3
0
        public Voxel GetVoxel(int x, int y, int z)
        {
            GetNextChunk(x, y, z, false);
            if (LastChunk != null)
            {
                VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
                return(LastChunk.GetVoxel(x, y, z));
            }

            return(new Voxel());
        }
示例#4
0
        public Voxel ReadVoxel(int x, int y, int z)
        {
            int chunkX = x, chunkY = y, chunkZ = z;

            VoxelChunk.ConvertWorldToChunk(ref chunkX, ref chunkY, ref chunkZ);
            var chunk = GetChunk(chunkX, chunkY, chunkZ);

            if (chunk != null)
            {
                VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
                return(chunk.GetVoxel(x, y, z));
            }

            return(new Voxel());
        }
示例#5
0
        public void ReadBlock(BlockQuery block, int x, int y, int z)
        {
            int chunkX = x, chunkY = y, chunkZ = z;

            VoxelChunk.ConvertWorldToChunk(ref chunkX, ref chunkY, ref chunkZ);
            var   chunk = GetChunk(chunkX, chunkY, chunkZ);
            Voxel voxel;

            if (chunk != null)
            {
                VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
                voxel = chunk.GetVoxel(x, y, z);
            }
            else
            {
                voxel = new Voxel();
            }

            //TODO: Properly query for core voxel if current voxel.IsPointer
            block.Set(voxel, chunk, x, y, z);
        }