TriMesh questions

help

#1

Hi! First, thanks for a great set of libraries and happy new year.

What are the reasons for and differences between ncollide3d::shape::TriMesh,
ncollide3d::procedural::TriMesh, and kiss::resource::Mesh?

Is there any function I have overlooked in the documentation that coverts
between them?

Finally, I would like to go from a Point3 on the surface of a TriMesh and
returns the correctly interpolated UV point there. Is there any interface which
I have overlooked for doing this? It looks like project_point_with_location()
might be involved. It will then return a
ncollide3d::shape::TrianglePointLocation but then I don’t see any code for
interpolating UV. I can implement this interpolation myself, but I’d prefer to
use “built-in” functionality.


#2

Hi!

All three triangle meshes have their own specificities. The ncollide3d::shape::TriMesh contains data for efficient collision detection, ncollide3d::procedural::TriMesh is a more lightweight triangle mesh representation with some utilities of manipulating, e.g., its normals, and kiss::resource::Mesh is a mesh stored on the GPU.

There is currently no function to easily convert between the two TriMesh from ncollide (thoug this will be added in the next release). It is possible to indirectly convert a ncollide3d::procedural::TriMesh to a kiss3d::resourse::Mesh by adding it to the window.

Unfortunately UV interpolation is only implemented for ray-casting on a mesh. For point-projection you will have to interpolate the UV manually using the barycentric coordinates provided by the TrianglePointLocation. You may open an issue on the ncollide’s github repository to suggest adding this.