public MeshData(Mesh mesh) { vertexContent = GetVertexContent(mesh); vertices = GetMeshVertices(mesh, vertexContent); if (MeshStruct.CheckQuads(mesh.triangles) != -1) { throw new UnityException("Can't create MeshData: Mesh has no quads topology. Try to 'Keep Quads' on mesh importing."); } meshStruct = new MeshStruct(mesh.vertexCount, MeshStruct.GetQuads(mesh.triangles)); }
public Mesh CreateMesh() { var mesh = new Mesh(); // vertices SetMeshVertices(mesh, vertices, vertexContent); // triangles mesh.SetTriangles(MeshStruct.GetTriangles(meshStruct.quads), 0); return(mesh); }
public static int GetEdgePointKey(int vi, int vj, MeshStruct meshStruct) { int qi = meshStruct.FindQuad(vi, vj); int qj = meshStruct.FindQuad(vj, vi); if (qi > qj) // quad index may be -1 (if hole) { return((qi << 3) | (meshStruct.GetIndexInQuad(qi, vi) << 1)); } else { return((qj << 3) | (meshStruct.GetIndexInQuad(qj, vj) << 1)); } }
public MeshData(Vertex[] vertices, int[][] quads, VertexContent vertexContent) { this.vertices = vertices; this.meshStruct = new MeshStruct(vertices.Length, quads); this.vertexContent = vertexContent; }