Hi all,
I have a disjointed Mesh with its values broken down into Arrays.
I found out that I couldn’t reconstruct them back to a mesh with the below codes. What is missing here?
@menno @dale ?
public int[] Faces;
public float[] Vertices;
public Vector3f[] FaceNormals;
public Vector3f[] VertexNormals;
public Mesh ReconstructMesh()
{
var mesh = new Mesh();
for (int i = 0; i < Vertices.Count()/3; i++)
mesh.Vertices.Add(new Point3f(Vertices[i * 3], Vertices[i * 3 + 1], Vertices[i * 3 + 2]));
for (int i = 0; i < Faces.Count() / 3; i++)
mesh.Faces.AddFace(new MeshFace(Faces[i * 3], Faces[i * 3 + 1], Faces[i * 3 + 2]));
for (int i = 0; i < FaceNormals.Count(); i++)
mesh.FaceNormals.AddFaceNormal(FaceNormals[i]);
for (int i = 0; i < VertexNormals.Count(); i++)
mesh.Normals.Add(VertexNormals[i]);
return mesh;
}