Access to low level mesh data

asked 2019-02-06 08:29:59 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am currently writing a world plugin which is sampling surfaces in the form of .obj files and produces a set of particles on the surface to be used for fluid simulation. This method works if the .obj file is provided, but alternatively I would like to avoid going through the .obj loading by passing directly to my sampler the low level geometrical data. This would be vertices and faces of the surfaces. My problem is that when a collision or visual geometry is defined in an .sdf as a primitive shape (i.e. a sphere), I cannot find a way to extract the low level geometrical data. I have tried using the MeshManager class but the load function seems to take a filename as a parameter, and in the case of primitives there is no file that can be passed. I would like to have a way to iterate through all the collision/visual shapes in the scene and read the low level geometrical data from there, is there such a process?

Best, Manos

edit retag flag offensive close merge delete

Comments

from the worldptr you can access the models with a models vector. from the models obtain all the links that make up each model. go through all the links’ collisions and obtain their shape. The derived calsses like BoxShape SphereShape give the specific parameters that make it up like a vector3d for box and radius for sphere. Don't know if there's a better way though Links gives access to visual msgs with a Visual map data structure and within each, type and geometry and various other things.

dagiopia gravatar imagedagiopia ( 2019-02-06 14:22:55 -0500 )edit

I just realized I didn't mention the mesh part... have you tried the MeshManager Create<shape> methods? those work well.

dagiopia gravatar imagedagiopia ( 2019-02-07 07:17:05 -0500 )edit

Yes, that is what I am currently doing, using the MeshManager and reading the .sdf and going through each collision shape, but this way I have to generate meshes explicitly I was hoping that there is already access to the collision shapes meshes. Now that you are mentioning the visuals, I am also unsure of how I can get a pointer to a visual from a visual message, is there maybe a way? Thanks a lot for the help!

ManosAngelidis gravatar imageManosAngelidis ( 2019-02-07 13:07:19 -0500 )edit

I don't know any other way... still looking into it. Perhaps rendering might be useful? Do you know how shapes are described to ogre for rendering? As far as I know, everything rendered on the screen gotta be converted into triangle meshes. It would be great if someone who knows the rendering part well could join this conversation.

dagiopia gravatar imagedagiopia ( 2019-02-09 07:22:12 -0500 )edit

My problem is that the collision shapes are usually simplified versions of the triangle meshes that are going to be rendered, and since I need to sample the collision and not the visual meshes, I would need access to the meshes of the collisions, not the visuals. But still, a process to get the meshes of the visuals from the world pointer would be useful. Thanks for the answer

ManosAngelidis gravatar imageManosAngelidis ( 2019-02-09 12:57:46 -0500 )edit