public void GenerateGeometry(SharpGL.OpenGL gl) { HighlightCube.GenerateGeometry(gl); const float spacing = 1 + CubeSpacing; for (int z = 0; z < Size; z++) { for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) { var cube = new Cube(Colors.Black); ColourCubeFromConfiguration(cube, x, y, z); cube.GenerateGeometry(gl); var position = new Vector3(x * spacing, y * spacing, z * spacing); position += m_cubieCentre; // Centre string id = string.Format("{0},{1},{2}", x - 1, y - 1, z - 1); var cubie = new Cubie(id, cube, position); AddToConfiguration(cubie, x, y, z); m_animators.Add(new CubieAnimator(cubie)); } } } CubeConfiguration.CheckValid(); }
private void AddToConfiguration(Cubie cubie, int x, int y, int z) { var lastIndex = Size - 1; var debugString = new StringBuilder(); if (x == 0) { // TODO: BETTER WAY OF CREATING FACE SO EXTERNAL DOES NOT CARE ABOUT INDEX ORDER CubeConfiguration.Faces[FaceType.Left].Items[lastIndex - y, z] = cubie; debugString.Append("L"); } if (x == lastIndex) { CubeConfiguration.Faces[FaceType.Right].Items[lastIndex - y, lastIndex - z] = cubie; debugString.Append("R"); } if (y == 0) { CubeConfiguration.Faces[FaceType.Down].Items[lastIndex - z, x] = cubie; debugString.Append("D"); } if (y == lastIndex) { CubeConfiguration.Faces[FaceType.Upper].Items[z, x] = cubie; debugString.Append("U"); } if (z == 0) { CubeConfiguration.Faces[FaceType.Back].Items[lastIndex - y, lastIndex - x] = cubie; debugString.Append("B"); } if (z == lastIndex) { CubeConfiguration.Faces[FaceType.Front].Items[lastIndex - y, x] = cubie; debugString.Append("F"); } //Console.WriteLine(debugString.ToString()); }
public CubieAnimator(Cubie cubie) { Cubie = cubie; }