public static void ConnectEdges_CreatesValidGeometry([ValueSource("shapeTypes")] Type shapeType) { var mesh = ShapeFactory.Instantiate(shapeType); Assume.That(mesh, Is.Not.Null); Assume.That(mesh.faceCount, Is.GreaterThan(0)); try { var face = mesh.facesInternal[0]; var previousEdgeCount = mesh.edgeCount; Assume.That(previousEdgeCount, Is.GreaterThan(0)); mesh.Connect(new Edge[] { face.edgesInternal[0], face.edgesInternal[1] }); mesh.ToMesh(); mesh.Refresh(); TestUtility.AssertMeshIsValid(mesh); Assert.That(previousEdgeCount, Is.LessThan(mesh.edgeCount)); } catch (System.Exception e) { Debug.LogError(e.ToString()); } finally { UnityEngine.Object.DestroyImmediate(mesh.gameObject); } }
public static void SubdivideFirstFace_CreatesValidMesh([ValueSource("shapeTypes")] Type shape) { var pb = ShapeFactory.Instantiate(shape); try { var faceCount = pb.faceCount; var face = pb.facesInternal.FirstOrDefault(); Subdivision.Subdivide(pb, new Face[] { face }); pb.ToMesh(); pb.Refresh(); TestUtility.AssertMeshIsValid(pb); TestUtility.AssertMeshAttributesValid(pb.mesh); Assert.That(faceCount, Is.LessThan(pb.faceCount)); } finally { UObject.DestroyImmediate(pb.gameObject); } }