Grey.Vox.Region.RemoveVoxel C# (CSharp) Method

RemoveVoxel() public method

public RemoveVoxel ( int x, int y, int z ) : void
x int
y int
z int
return void
        public void RemoveVoxel(int x, int y, int z)
        {
            // Check If A Voxel Exists There
            int i = ToIndex(x, y, z);
            if(voxels[i].ID == 0) return;

            // Set The Voxel To Be Empty
            bool change = Flags.HasSomeFlags(voxels[i].Flags, Voxel.FACE_MASK);
            voxels[i] = Voxel.Empty;

            // TODO: Check Surrounding Faces
            if(x < WIDTH - 1)
                change |= RecalculateSeam(i + 1, i, Voxel.FACE_NX);
            if(x > 0)
                change |= RecalculateSeam(i - 1, i, Voxel.FACE_PX);
            if(z < DEPTH - 1)
                change |= RecalculateSeam(i + WIDTH, i, Voxel.FACE_NZ);
            if(z > 0)
                change |= RecalculateSeam(i - WIDTH, i, Voxel.FACE_PZ);
            if(y < HEIGHT - 1)
                change |= RecalculateSeam(i + PLANE_SIZE, i, Voxel.FACE_NY);
            if(y > 0)
                change |= RecalculateSeam(i - PLANE_SIZE, i, Voxel.FACE_PY);

            // TODO: Send Update To Neighboring Regions
            if(x == 0 && rNX != null) rNX.NotifyFacesChanged();
            else if(x == Region.WIDTH - 1 && rPX != null) rPX.NotifyFacesChanged();
            if(z == 0 && rNZ != null) rNZ.NotifyFacesChanged();
            else if(z == Region.DEPTH - 1 && rPZ != null) rPZ.NotifyFacesChanged();

            // TODO: Use The Change
            NotifyFacesChanged();
        }