public Wixel GetBlock(int x, int y, int z) { WixelChunk containerChunk = GetChunk(x, y, z); if (containerChunk != null) { Wixel block = containerChunk.GetBlock( x - containerChunk.WorldPosition.x, y - containerChunk.WorldPosition.y, z - containerChunk.WorldPosition.z ); return(block); } else { Wixel airWixel = WixelRepository.GetWixelByName("Air"); return(airWixel); } }
public WixelChunkMeshData BlockData(WixelChunk chunk, int x, int y, int z, WixelChunkMeshData meshData) { if (FaceInformation.Count == 0) { return(meshData); } // Programmer's Note // ----------------- // int x/y/z is fine due to how this is being used. Vector3 worldPosition = new Vector3(x, y, z); meshData.useRenderDataForCol = true; if (!chunk.GetBlock(x, y + 1, z).IsSolid(WixelDirection.Down)) { meshData = FaceData(WixelDirection.Up, chunk, worldPosition, meshData); } if (!chunk.GetBlock(x, y - 1, z).IsSolid(WixelDirection.Up)) { meshData = FaceData(WixelDirection.Down, chunk, worldPosition, meshData); } if (!chunk.GetBlock(x, y, z + 1).IsSolid(WixelDirection.South)) { meshData = FaceData(WixelDirection.North, chunk, worldPosition, meshData); } if (!chunk.GetBlock(x, y, z - 1).IsSolid(WixelDirection.North)) { meshData = FaceData(WixelDirection.South, chunk, worldPosition, meshData); } if (!chunk.GetBlock(x + 1, y, z).IsSolid(WixelDirection.West)) { meshData = FaceData(WixelDirection.East, chunk, worldPosition, meshData); } if (!chunk.GetBlock(x - 1, y, z).IsSolid(WixelDirection.East)) { meshData = FaceData(WixelDirection.West, chunk, worldPosition, meshData); } return(meshData); }