public void HighlightEdge(int index) { if (index != -1) { List <Vector3> list = new List <Vector3>(); GDMesh.Edge edge = this.Controller.GDMesh.Edges[index]; list.Add(this.Controller.referencedGO.transform.TransformPoint(edge.Vertex0.Traits.position)); list.Add(this.Controller.referencedGO.transform.TransformPoint(edge.Vertex1.Traits.position)); GLDrawUtility.DrawLine(Color.green, Color.green, Color.green, list.ToArray(), false); } }
public void DrawEdges() { List <Vector3> list = new List <Vector3>(); foreach (int num in this.Controller.selection.selectedEdges) { GDMesh.Edge edge = this.Controller.GDMesh.Edges[num]; list.Add(this.Controller.referencedGO.transform.TransformPoint(edge.Vertex0.Traits.position)); list.Add(this.Controller.referencedGO.transform.TransformPoint(edge.Vertex1.Traits.position)); } GLDrawUtility.DrawLine(Color.red, Color.red, Color.red, list.ToArray(), false); }
public void TransformMesh() { if (this.transformed && !this.Controller.locked) { this.transformed = false; List <Vector3> verts = new List <Vector3>(this.Controller.mesh.vertices); if (this.Controller.selection.selectionType == MeshSelection.SelectionType.Vertex) { foreach (int num in this.Controller.selection.selectedVertices) { this.TransformVertex(this.Controller.GDMesh.relatedVertices[num].vert, this.Controller.GDMesh.relatedVertices[num][0]); foreach (int num2 in this.Controller.GDMesh.relatedVertices[num]) { this.TransformVertexReferences(this.Controller.GDMesh.relatedVertices[num].vert, num2, verts); } } } else if (this.Controller.selection.selectionType == MeshSelection.SelectionType.Triangle) { List <int> list2 = new List <int>(); foreach (int num3 in this.Controller.selection.selectedTriangles) { GDMesh.Face face = this.Controller.GDMesh.Faces[num3]; foreach (GDMesh.Vertex vertex in face.Vertices) { if (!list2.Contains(vertex.Traits.hashCode)) { this.TransformVertex(vertex, this.Controller.GDMesh.relatedVertices[vertex.Traits.hashCode][0]); foreach (int num4 in this.Controller.GDMesh.relatedVertices[vertex.Traits.hashCode]) { this.TransformVertexReferences(vertex, num4, verts); } list2.Add(vertex.Traits.hashCode); } } } } else if (this.Controller.selection.selectionType == MeshSelection.SelectionType.Edge) { List <int> list3 = new List <int>(); foreach (int num5 in this.Controller.selection.selectedEdges) { GDMesh.Edge edge = this.Controller.GDMesh.Edges[num5]; GDMesh.Vertex vert = edge.Vertex0; GDMesh.Vertex vertex3 = edge.Vertex1; if (!list3.Contains(vert.Traits.hashCode)) { this.TransformVertex(vert, this.Controller.GDMesh.relatedVertices[vert.Traits.hashCode][0]); foreach (int num6 in this.Controller.GDMesh.relatedVertices[vert.Traits.hashCode]) { this.TransformVertexReferences(vert, num6, verts); } list3.Add(vert.Traits.hashCode); } if (!list3.Contains(vertex3.Traits.hashCode)) { this.TransformVertex(vertex3, this.Controller.GDMesh.relatedVertices[vertex3.Traits.hashCode][0]); foreach (int num7 in this.Controller.GDMesh.relatedVertices[vertex3.Traits.hashCode]) { this.TransformVertexReferences(vertex3, num7, verts); } list3.Add(vertex3.Traits.hashCode); } } } else if (this.Controller.selection.selectionType == MeshSelection.SelectionType.Element) { List <int> list4 = new List <int>(); foreach (int num8 in this.Controller.selection.selectedElements) { GDMesh.Element element = this.Controller.GDMesh.elements[num8]; foreach (GDMesh.Face face2 in element.Faces) { foreach (GDMesh.Vertex vertex4 in face2.Vertices) { if (!list4.Contains(vertex4.Traits.hashCode)) { this.TransformVertex(vertex4, this.Controller.GDMesh.relatedVertices[vertex4.Traits.hashCode][0]); foreach (int num9 in this.Controller.GDMesh.relatedVertices[vertex4.Traits.hashCode]) { this.TransformVertexReferences(vertex4, num9, verts); } list4.Add(vertex4.Traits.hashCode); } } } } } this.Controller.mesh.vertices = verts.ToArray(); if (this.Controller.isSkinned) { this.Controller.referencedRenderer.sharedMesh = this.Controller.mesh; } else { this.Controller.referencedFilter.mesh = this.Controller.mesh; } this.Controller.mesh.RecalculateBounds(); this.Controller.referencedCollider.sharedMesh = null; this.Controller.referencedCollider.sharedMesh = this.Controller.mesh; } }
public static bool LineInFrustum(GDMesh.Edge e) { return(PointInFrustum(e.Vertex0) && PointInFrustum(e.Vertex1)); }