I coded a function, which takes as a input a vertex buffer. Output is a vertex buffer with removed duplications and index buffer.
It's working well, but the main problem of this function is, it's very slow. It contains three for loop and its complexity is roughly O( n^2 * log n ).
I just go though vertex array and adding index numbers, but when duplication is found, i delete it, i have to search, what index this duplication had and used it. Of course, i have to search whole vertex array again and again and search for duplication. ( i am comparing not only vertices, but normals, uvs too, they have to be same then i can mark it as duplication )
I would like to ask, if you know any technique, which is faster. I am searching the internet and i still did not find aynthing
thank you very much.