void MakeCube(float cubeScale, Vector3 cubePos, Vector3Int pos, VoxelData data) { for (int i = 0; i < 6; i++) { if (data.GetNeighbor(pos, (Direction)i) == 0) { MakeFace((Direction)i, cubeScale, cubePos, data.GetCell(pos)); } } }
void MakeCube(float cubeScale, Vector3 cubePos, int x, int z, VoxelData data) { for (int i = 0; i < 6; i++) { if (data.GetNeighbor(x, z, (Direction)i) == 0) { MakeFace((Direction)i, cubeScale, cubePos); } } }
private void MakeCube(float cubeScale, Vector3 cubePosition, Vector3Int index, VoxelData data) { for (int i = 0; i < 6; i++) { if (data.GetNeighbor(index, (Direction)i) == 0) { MakeFace((Direction)i, cubeScale, cubePosition, (BlockType)data.Grid[index.x, index.y, index.z]); } } }
void MakeCube(float cubeScale, Vector3 cubePos, int x, int z, VoxelData data) { // Iterates through 6 sides of the cube for (int i = 0; i < 6; i++) { if (data.GetNeighbor(x, z, (Direction)i) == 0) { // The increment i is driving the direction of the cube's face MakeFace((Direction)i, cubeScale, cubePos); } } }
//Create a voxel cubewith the correct scale at the given location based on the data void MakeCube(int chunkSize, Vector3 chunkPos, float tempScale, Vector3 cubePos, int x, int y, int z, VoxelData data) { cubePos.x += chunkPos.x * chunkSize; cubePos.y += chunkPos.y * chunkSize; cubePos.z += chunkPos.z * chunkSize; //Check all 6 sides for (int i = 0; i < 6; i++) { //If there is no neighbor in the direction of that size create a cube face if (data.GetNeighbor(chunkSize, chunkPos, x, y, z, (Direction)i) == 0) { //Create a cube face MakeFace((Direction)i, tempScale, cubePos, data.GetCell(chunkPos, x, y, z)); } } }