Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void CheckAdjacentCubes(List<Cube> cubes, List<Cube> cubeToDraw)
- {
- //cubes is main list of cubes
- //cubeToDraw is the list of cubes to draw after adjacency check
- foreach (Cube cube in cubes)
- {
- foreach (Cube adjacentCube in cubes)
- {
- if (cube.World.Translation.Z + 0.5f == adjacentCube.World.Translation.Z - 0.5f)
- {
- backSide = true;
- }
- if (cube.World.Translation.Z - 0.5f == adjacentCube.World.Translation.Z + 0.5f)
- {
- frontSide = true;
- }
- if (cube.World.Translation.X + 0.5f == adjacentCube.World.Translation.X - 0.5f)
- {
- rightSide = true;
- }
- if (cube.World.Translation.X - 0.5f == adjacentCube.World.Translation.X + 0.5f)
- {
- leftSide = true;
- }
- if (cube.World.Translation.Y + 0.5f == adjacentCube.World.Translation.Y - 0.5f)
- {
- topSide = true;
- }
- if (cube.World.Translation.Y - 0.5f == adjacentCube.World.Translation.Y + 0.5f)
- {
- bottomSide = true;
- }
- }
- if (bottomSide != true || topSide != true || leftSide != true || rightSide != true || frontSide != true || backSide != true)
- {
- cubeToDraw.Add(cube);
- }
- bottomSide = false;
- topSide = false;
- leftSide = false;
- rightSide = false;
- frontSide = false;
- backSide = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment