private void AddCube(BoardObject obj, int x, int y, float z) { Vector3 a = GetVertexPosition(x, y, z); Vector3 b = GetVertexPosition(x, y + 1, z); Vector3 c = GetVertexPosition(x + 1, y, z); Vector3 d = GetVertexPosition(x + 1, y + 1, z); // front obj.AddFace(a, b, c, d); Vector3 e = GetVertexPosition(x, y, z + boardSettings.boardDepth); Vector3 f = GetVertexPosition(x, y + 1, z + boardSettings.boardDepth); Vector3 g = GetVertexPosition(x + 1, y, z + boardSettings.boardDepth); Vector3 h = GetVertexPosition(x + 1, y + 1, z + boardSettings.boardDepth); // left if (IsFaceVisible(x, y, -1, 0)) { obj.AddFace(a, e, b, f); } // top if (IsFaceVisible(x, y, 0, 1)) { obj.AddFace(b, f, d, h); } // right if (IsFaceVisible(x, y, 1, 0)) { obj.AddFace(d, h, c, g); } // bottom if (IsFaceVisible(x, y, 0, -1)) { obj.AddFace(c, g, a, e); } }