I am currently looking into loading an stl-file into rviz and be able to color some parts of the mesh differently than others (dynamically, depending on other input). To my understanding the way to do this would be to somehow parse the stl file and convert it to a triangle list. The triangles can then be colored independently depending on whatever the other input is.
So my question would be if there is already some kind of library out there that does exactly this, or will I have to implement it myself? (I saw some other threads talking about this kind of topic, but they always only linked to http://www.ros.org/wiki/rviz/DisplayTypes/Marker or something similar.)
In case it is relevant: I am on ros kinetic (and optionally melodic).
If you have any other type of solution to this kind of problem I'm happy to hear it.
Thanks in advance,
EDIT : Thanks to @aPonza's answer i could use the geometric_shapes package to achieve my goal of loading a mesh file and convert it to a rviz triangle list. To do this i used createMeshFromResource and then read the Data out of the Mesh object that it generated.
Reading out of the Mesh Object was a little different than i expect since it uses vertex- and index-buffers but thanks to @gvdhoorn's comment with the link to the slides i was able to grasp that concept better.
Post score: 0
Comment by ahendrix on 2018-12-13:
I think the assimp library that is already used within rviz for mesh loading can load STL files into some kind of mesh, but I'm not sure how easy it is to modify that mesh after it has been loaded.