Пример #1
0
 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));
 }
Пример #2
0
        public Mesh CreateMesh()
        {
            var mesh = new Mesh();

            // vertices
            SetMeshVertices(mesh, vertices, vertexContent);
            // triangles
            mesh.SetTriangles(MeshStruct.GetTriangles(meshStruct.quads), 0);
            return(mesh);
        }
Пример #3
0
        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));
            }
        }
Пример #4
0
 public MeshData(Vertex[] vertices, int[][] quads, VertexContent vertexContent)
 {
     this.vertices      = vertices;
     this.meshStruct    = new MeshStruct(vertices.Length, quads);
     this.vertexContent = vertexContent;
 }