patrykcieslak / stonefish

Stonefish - an advanced C++ simulation library designed for (but not limited to) marine robotics.
https://stonefish.readthedocs.io/
GNU General Public License v3.0
115 stars 31 forks source link

Huge speed-up for loading meshes with loadObj function. #51

Open ferreram opened 2 months ago

ferreram commented 2 months ago

Added hash function for Vertex / TexturableVertex. Fix errors in TexturableVertex struct (uv init with glm::vec3 & tangent data not checked for equality operator). Simplify default constructor of Vertex / TexturableVertex & equality operator of those & Face struct.

patrykcieslak commented 1 month ago

Hello @ferreram ! I appreciate your contribution but sadly something is not working well :( When I tried to merge it to the master and run some simulations, the meshes are messed up completely (see screenshot). I export meshes using Blender as triangulated and with normals and UV coordinates. obj_loading_errors

ferreram commented 1 month ago

Hi @patrykcieslak. Sorry for the inconvenience, I forgot a minus one to access vector elements from the IDs of vertices / normals / uvs in the obj files. It should properly work now.

Please, note that the speed-up is mostly significant on big models.

My results from running a few tests: