private static void CreateFace() { if (Selection.objects.Length == 3) { var vertices = Utilities.Get3FromSelection <Vertex>(); if (vertices.Item1 != null && vertices.Item2 != null && vertices.Item3 != null) { var vertexArray = new[] { vertices.Item1, vertices.Item2, vertices.Item3 }; Utilities.ConnectUnconnectedVertices(vertexArray); vertexArray = vertexArray.OrderBy(v => v.Index).ToArray(); Face3.Create(vertices.Item1.GeometryEditor, new Triangle(vertexArray[0], vertexArray[1], vertexArray[2])); } } else if (Selection.objects.Length == 4) { var vertices = Utilities.Get4FromSelection <Vertex>(); if (vertices.Item1 != null && vertices.Item2 != null && vertices.Item3 != null && vertices.Item4 != null) { var vertexArray = new[] { vertices.Item1, vertices.Item2, vertices.Item3, vertices.Item4 }; Utilities.ConnectUnconnectedVertices(vertexArray); vertexArray = vertexArray.OrderBy(v => v.Index).ToArray(); Face4.Create(vertices.Item1.GeometryEditor, new Triangle(vertexArray[0], vertexArray[1], vertexArray[2]), new Triangle(vertexArray[3], vertexArray[2], vertexArray[1])); } } }
/// <summary> /// Initializes a new instance of the <see cref="libtr.TR2.RoomData"/> struct. /// </summary> /// <param name="vertices">The vertices.</param> /// <param name="rectangles">The textured rectangles.</param> /// <param name="triangles">The textured triangles.</param> /// <param name="sprites">The sprites.</param> public RoomData ( RoomVertex [] vertices, Face4 [] rectangles, Face3 [] triangles, RoomSprite [] sprites) : this () { VertexCount = (Int16) vertices.Length; RectangleCount = (Int16) rectangles.Length; TriangleCount = (Int16) triangles.Length; SpriteCount = (Int16) sprites.Length; Vertices = vertices; Rectangles = rectangles; Triangles = triangles; Sprites = sprites; }
public static bool TryParse(string line, out IFace face) { if (Face3.TryParse(line, out face)) { return(true); } if (Face4.TryParse(line, out face)) { return(true); } return(false); }
private static void CombineFaces() { var selection = Utilities.Get2FromSelection <Face3>(); var face1 = selection.Item1; var face2 = selection.Item2; if (face1 != null && face2 != null) { Vertex vertex4 = null; foreach (var vertex in face2.Vertices) { if (vertex != face1.Vertices[0] && vertex != face1.Vertices[1] && vertex != face1.Vertices[2]) { vertex4 = vertex; break; } } Face4.Create(face1.GeometryEditor, new Triangle(face1.Vertices[0], face1.Vertices[1], face1.Vertices[2]), new Triangle(vertex4, face1.Vertices[2], face1.Vertices[1])); Object.DestroyImmediate(face1); Object.DestroyImmediate(face2); } }