public void DegenerateCuboid() { Mesh m = PrimitiveShapes.Cuboid( new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0)); Assert.AreEqual(8, m.Vertices.Count()); Assert.AreEqual(24, m.HalfEdges.Count()); Assert.AreEqual(6, m.Faces.Count()); }
public void Cuboid() { Mesh m = PrimitiveShapes.Cuboid( new Vector3(1, 0, 0), new Vector3(2, 0, 0), new Vector3(3, 0, 0), new Vector3(4, 0, 0), new Vector3(5, 0, 0), new Vector3(6, 0, 0), new Vector3(7, 0, 0), new Vector3(8, 0, 0)); Assert.AreEqual(8, m.Vertices.Count()); Assert.AreEqual(24, m.HalfEdges.Count()); Assert.AreEqual(6, m.Faces.Count()); }
public void TriangulateCuboid() { Mesh m = PrimitiveShapes.Cuboid( new Vector3(1, 0, 0), new Vector3(2, 0, 0), new Vector3(3, 0, 0), new Vector3(4, 0, 0), new Vector3(5, 0, 0), new Vector3(6, 0, 0), new Vector3(7, 0, 0), new Vector3(8, 0, 0)); m.SubdivideAllFaces(Mesh.SubdivideOperation.Triangulate); Assert.AreEqual(8, m.Vertices.Count()); Assert.AreEqual(36, m.HalfEdges.Count()); Assert.AreEqual(12, m.Faces.Count()); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { IsMouseVisible = true; mesh = PrimitiveShapes.Cuboid(5, 2, 3, new Mesh(null, a => new ProceduralFace(a))); projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, GraphicsDevice.Viewport.AspectRatio, 0.1f, 100); view = Matrix.CreateLookAt(new Vector3(0, 0, -15), Vector3.Zero, Vector3.Up); world = Matrix.CreateScale(1); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 800; graphics.ApplyChanges(); //mesh.Faces.Skip(2).Cast<ProceduralFace>().First().Development = new GableRoof(mesh, null); mesh.Faces.Skip(5).Cast <ProceduralFace>().First().Development = new HouseWall(mesh, null); base.Initialize(); }