I have a method that is trying to load a new mesh. When I do, I want to check if the new mesh is the same as the old mesh and if so, i simply return the old mesh. What is the best/fastest way to check two VertexData objects to see if they are the same?
“The same” could be rather complex. The vertex buffer is a list of arrays that define the structure of your mesh. indices, positions, normals, uvs, all (probably) loaded together with the mesh object. The mesh might also have materials, textures, skeletons, animations.
As I don’t know your use case, a straight-forward answer would be - iterate over the positions and indices data and compare them one by one. This is probably not the most efficient way of doing it. And it is prone to interesting mistakes. If the meshes are somehow generated, then you can’t compare the positions (as they are floats), you will need to check a range. that’s gonna degrade performance for sure.
Maybe try explaining your use case - are those two meshes different on the server? do they have a different URL? What is your definition of “the same”?