Original Post
I have a mesh file which im extracting data from that contains a list of vertices to be drawn, but this list contains at least 30% duplicates, as the triangles/faces are sharing vertices, so im wondering how i can go through the list, and copy all non duplicates to a second container, such that all the vertices in the second container are different. Now for this i could use an std::set, but the other part of the problem is that i dont want the second list to have any sort of automatic sorting, becuase i'll be taken the position of any any added vertex. Here is the rough code So it goes through the data vector from start to end, and then adds to optimzeddata, only if that value is not already in optimzeddata, either way, it returns the position of the new/existing value. ie //data 1,2,3 3,4,5 6,6,6 6,6,6 1,2,3 //optimized data 1,2,3 3,4,5 6,6,6 //index 0 1 2 2 0
vector <vertex> data;
vector <vertex> OptimizedData
readFile(data);//fill data from file
//remove duplicates
for (all data)
index = AddToVectorIfNotDuplicate(data[0], &OptimizedData);