removeDuplicates function
Implementation
Vertex removeDuplicates(List<Vector3> fromVertices,List<Triangle> fromIndices){
List<Triangle> toIndices = [];
List<Vector3> toVertices = fromVertices.toSet().toList();
for(int i = 0; i < fromIndices.length;i++){
List<int> vertexes = [];
List<int> normals = [];
List<int> texture = [];
for(int j = 0; j < fromIndices[i].vertexes.length; j++){
for(int k = 0; k < toVertices.length;k++){
if(fromVertices[fromIndices[i].vertexes[j]] == toVertices[k]){
vertexes.add(k);
texture.add(k);
normals.add(k);
}
}
}
toIndices.add(
Triangle(vertexes,normals,texture)
);
}
return Vertex(
vertex: toVertices,
indicies: toIndices
);
}