Class to display mesh data in the main panel of rviz. More...
#include <MeshVisual.hpp>
Public Member Functions | |
bool | addTexture (Texture &texture, uint32_t textureIndex) |
Extracts data from the ros-messages and adds textures to the textured mesh. More... | |
MeshVisual (rviz::DisplayContext *context, size_t displayID, size_t meshID, size_t randomID) | |
Constructor. More... | |
void | reset () |
Clears whole stored data. More... | |
void | setFrameOrientation (const Ogre::Quaternion &orientation) |
Sets the orientation of the coordinate frame the message refers to. More... | |
void | setFramePosition (const Ogre::Vector3 &position) |
Sets the pose of the coordinate frame the message refers to. More... | |
bool | setGeometry (const Geometry &geometry) |
Extracts data from the ros-messages and creates meshes. More... | |
bool | setMaterials (const vector< Material > &materials, const vector< TexCoords > &texCoords) |
Extracts data from the ros-messages and creates a textured mesh. More... | |
bool | setNormals (const std::vector< Normal > &normals) |
Passes the normal data to the mesh visual. More... | |
bool | setVertexColors (const std::vector< Color > &vertexColors) |
Extracts data from the ros-messages and creates a colored mesh. More... | |
bool | setVertexCosts (const std::vector< float > &vertexCosts) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs. More... | |
bool | setVertexCosts (const std::vector< float > &vertexCosts, int costColorType) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs. More... | |
bool | setVertexCosts (const std::vector< float > &vertexCosts, int costColorType, float minCost, float maxCost) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs. More... | |
void | updateMaterial (bool showFaces, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors, bool showVertexCosts, bool showTextures, bool showTexturedFacesOnly) |
Updates the visible parts of the mesh depending on input from the rviz display. More... | |
void | updateMaterial (bool showWireframe, Ogre::ColourValue wireframeColor, float wireframeAlpha, bool showFaces, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors, bool showVertexCosts, bool showTextures, bool showTexturedFacesOnly, bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha, float normalsScallingFactor) |
Updates the visible parts of the mesh depending on input from the rviz display. More... | |
void | updateNormals (bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha) |
Updates the normals dynamically. More... | |
void | updateNormals (bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha, float scalingFactor) |
Updates the normals dynamically. More... | |
void | updateNormals (float scallingFactor) |
Updates the size of the normals dynamically. More... | |
void | updateWireframe (bool showWireframe, Ogre::ColourValue wireframeColor, float wireframeAlpha) |
Updates the wireframe dynamically. More... | |
virtual | ~MeshVisual () |
Destructor. More... | |
Private Member Functions | |
Ogre::ColourValue | calculateColorFromCost (float cost, int costColorType) |
Calculates a color for a given cost value using a spectrum from red to green. More... | |
void | enteringColoredTriangleMesh (const Geometry &mesh, const vector< Color > &vertexColors) |
void | enteringGeneralTriangleMesh (const Geometry &mesh) |
void | enteringNormals (const Geometry &mesh, const vector< Normal > &normals) |
void | enteringTexturedTriangleMesh (const Geometry &mesh, const vector< Material > &meshMaterials, const vector< TexCoords > &texCoords) |
void | enteringTriangleMeshWithVertexCosts (const Geometry &mesh, const vector< float > &vertexCosts, int costColorType) |
void | enteringTriangleMeshWithVertexCosts (const Geometry &mesh, const vector< float > &vertexCosts, int costColorType, float minCost, float maxCost) |
Ogre::PixelFormat | getOgrePixelFormatFromRosString (std::string encoding) |
void | loadImageIntoTextureMaterial (size_t textureIndex) |
void | showFaces (Ogre::Pass *pass, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors) |
void | showNormals (Ogre::Pass *pass, Ogre::ColourValue normalsColor, float normalsAlpha) |
void | showTextures (Ogre::Pass *pass) |
void | showWireframe (Ogre::Pass *pass, Ogre::ColourValue wireframeColor, float wireframeAlpha) |
Enables the wireframe. More... | |
Private Attributes | |
rviz::DisplayContext * | m_displayContext |
The context that contains the display information. More... | |
Geometry | m_geometry |
raw Triangle Mesh More... | |
std::vector< Normal > | m_geometryNormals |
raw normals More... | |
std::vector< Ogre::Image > | m_images |
bool | m_materials_enabled |
Ogre::ManualObject * | m_mesh |
The mesh-object to display. More... | |
Ogre::MaterialPtr | m_meshGeneralMaterial |
The material for the general mesh. More... | |
Ogre::MaterialPtr | m_meshTexturedTrianglesMaterial |
The material for the textured triangle mesh. More... | |
Ogre::MaterialPtr | m_normalMaterial |
The material of the normals. More... | |
Ogre::ManualObject * | m_normals |
The manual object to display normals. More... | |
float | m_normalsScalingFactor |
Factor the normal-size is multiplied with. More... | |
Ogre::MaterialPtr | m_noTexCluMaterial |
The materials of the not textured clusters. More... | |
Ogre::ManualObject * | m_noTexCluMesh |
The manual object to display the not textured parts of the textured mesh. More... | |
size_t | m_postfix |
Second ID of the created mesh. More... | |
size_t | m_prefix |
First ID of the created mesh. More... | |
size_t | m_random |
Random ID of the created mesh. More... | |
Ogre::SceneNode * | m_sceneNode |
Ogre Scenenode. More... | |
bool | m_texture_coords_enabled |
Ogre::ManualObject * | m_texturedMesh |
The manual object to display the textured mesh. More... | |
Ogre::MaterialPtr | m_texturedMeshMaterial |
std::vector< Ogre::MaterialPtr > | m_textureMaterials |
The materials of the textures. More... | |
bool | m_textures_enabled |
bool | m_vertex_colors_enabled |
bool | m_vertex_costs_enabled |
bool | m_vertex_normals_enabled |
Ogre::MaterialPtr | m_vertexCostMaterial |
The material of the mesh with vertex costs. More... | |
Ogre::ManualObject * | m_vertexCostsMesh |
The manual object to display the mesh with vertex costs. More... | |
Class to display mesh data in the main panel of rviz.
Definition at line 97 of file MeshVisual.hpp.
rviz_map_plugin::MeshVisual::MeshVisual | ( | rviz::DisplayContext * | context, |
size_t | displayID, | ||
size_t | meshID, | ||
size_t | randomID | ||
) |
Constructor.
context | The context that contains the display information. |
displayID | The display id |
meshID | The mesh id |
randomID | random number that will be used as part of the meshes UID |
Definition at line 96 of file MeshVisual.cpp.
|
virtual |
Destructor.
Definition at line 159 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::addTexture | ( | Texture & | texture, |
uint32_t | textureIndex | ||
) |
Extracts data from the ros-messages and adds textures to the textured mesh.
texture | Texture containing the texture information and data |
textureIndex | Index of the texture |
Definition at line 944 of file MeshVisual.cpp.
|
private |
Calculates a color for a given cost value using a spectrum from red to green.
cost | The cost value (should be within the range 0 - 1) |
Definition at line 1001 of file MeshVisual.cpp.
|
private |
Definition at line 496 of file MeshVisual.cpp.
|
private |
Definition at line 464 of file MeshVisual.cpp.
|
private |
Definition at line 723 of file MeshVisual.cpp.
|
private |
Definition at line 609 of file MeshVisual.cpp.
|
private |
Definition at line 534 of file MeshVisual.cpp.
|
private |
Definition at line 551 of file MeshVisual.cpp.
|
private |
Definition at line 970 of file MeshVisual.cpp.
|
private |
Definition at line 985 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::reset | ( | ) |
Clears whole stored data.
Definition at line 190 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::setFrameOrientation | ( | const Ogre::Quaternion & | orientation | ) |
Sets the orientation of the coordinate frame the message refers to.
orientation | The orientation of the coordinate frame |
Definition at line 1030 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::setFramePosition | ( | const Ogre::Vector3 & | position | ) |
Sets the pose of the coordinate frame the message refers to.
position | The pose of the coordinate frame |
Definition at line 1025 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setGeometry | ( | const Geometry & | geometry | ) |
Extracts data from the ros-messages and creates meshes.
geometry | Geometry containing the mesh |
Definition at line 761 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setMaterials | ( | const vector< Material > & | materials, |
const vector< TexCoords > & | texCoords | ||
) |
Extracts data from the ros-messages and creates a textured mesh.
materials | Vector containing all materials |
texCoords | Vector containing all texture coordinates |
Definition at line 912 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setNormals | ( | const std::vector< Normal > & | normals | ) |
Passes the normal data to the mesh visual.
normals | Vector containing the normal data |
Definition at line 801 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setVertexColors | ( | const std::vector< Color > & | vertexColors | ) |
Extracts data from the ros-messages and creates a colored mesh.
vertexColors | Vector containing the vertex color information |
Definition at line 831 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setVertexCosts | ( | const std::vector< float > & | vertexCosts | ) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs.
vertexCosts | Vector containing the vertex cost information |
bool rviz_map_plugin::MeshVisual::setVertexCosts | ( | const std::vector< float > & | vertexCosts, |
int | costColorType | ||
) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs.
vertexCosts | Vector containing the vertex cost information |
costColorType | colorization method (0 = rainbow; 1 = red-green) |
Definition at line 855 of file MeshVisual.cpp.
bool rviz_map_plugin::MeshVisual::setVertexCosts | ( | const std::vector< float > & | vertexCosts, |
int | costColorType, | ||
float | minCost, | ||
float | maxCost | ||
) |
Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs.
vertexCosts | Vector containing the vertex cost information |
costColorType | colorization method (0 = rainbow; 1 = red-green) |
minCost | minimum value for colorization |
maxCost | maximum value for colorization |
Definition at line 883 of file MeshVisual.cpp.
|
private |
Definition at line 272 of file MeshVisual.cpp.
|
private |
Definition at line 292 of file MeshVisual.cpp.
|
private |
|
private |
Enables the wireframe.
pass | Ogre Pass |
wireframeColor | The color of the wireframe |
wireframeAlpha | Transparency of the wireframe |
Definition at line 258 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateMaterial | ( | bool | showFaces, |
Ogre::ColourValue | facesColor, | ||
float | facesAlpha, | ||
bool | useVertexColors, | ||
bool | showVertexCosts, | ||
bool | showTextures, | ||
bool | showTexturedFacesOnly | ||
) |
Updates the visible parts of the mesh depending on input from the rviz display.
showFaces | When TRUE faces are visible |
facesColor | The color of the faces |
facesAlpha | The transparency of the faces |
useVertexColors | When TRUE vertex colors are used |
showVertexCosts | When TRUE vertex costs are visible |
showTextures | When TRUE textures are visible |
showTexturedFacesOnly | When TRUE only textured faces are visible |
Definition at line 305 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateMaterial | ( | bool | showWireframe, |
Ogre::ColourValue | wireframeColor, | ||
float | wireframeAlpha, | ||
bool | showFaces, | ||
Ogre::ColourValue | facesColor, | ||
float | facesAlpha, | ||
bool | useVertexColors, | ||
bool | showVertexCosts, | ||
bool | showTextures, | ||
bool | showTexturedFacesOnly, | ||
bool | showNormals, | ||
Ogre::ColourValue | normalsColor, | ||
float | normalsAlpha, | ||
float | normalsScallingFactor | ||
) |
Updates the visible parts of the mesh depending on input from the rviz display.
showWireframe | When TRUE wireframe is visible |
wireframeColor | The color of the wireframe |
wireframeAlpha | The transparency of the wireframe |
showFaces | When TRUE faces are visible |
facesColor | The color of the faces |
facesAlpha | The transparency of the faces |
useVertexColors | When TRUE vertex colors are used |
showVertexCosts | When TRUE vertex costs are visible |
showTextures | When TRUE textures are visible |
showTexturedFacesOnly | When TRUE only textured faces are visible |
showNormals | When TRUE normals are visible |
normalsColor | The color of the normals |
normalsAlpha | The transparency of the normals |
normalsScallingFactor | The size of the normals |
Definition at line 352 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateNormals | ( | bool | showNormals, |
Ogre::ColourValue | normalsColor, | ||
float | normalsAlpha | ||
) |
Updates the normals dynamically.
showNormals | When TRUE normals are visible |
normalsColor | The color of the normals |
normalsAlpha | The transparency of the normals |
Definition at line 423 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateNormals | ( | bool | showNormals, |
Ogre::ColourValue | normalsColor, | ||
float | normalsAlpha, | ||
float | scalingFactor | ||
) |
Updates the normals dynamically.
showNormals | When TRUE normals are visible |
normalsColor | The color of the normals |
normalsAlpha | The transparency of the normals |
scalingFactor | The factor the normals have to be scaled with |
Definition at line 437 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateNormals | ( | float | scallingFactor | ) |
Updates the size of the normals dynamically.
scallingFactor | The factor the normals have to be scaled with |
Definition at line 417 of file MeshVisual.cpp.
void rviz_map_plugin::MeshVisual::updateWireframe | ( | bool | showWireframe, |
Ogre::ColourValue | wireframeColor, | ||
float | wireframeAlpha | ||
) |
Updates the wireframe dynamically.
showWireframe | When TRUE wireframe is visible |
wireframeColor | The color of the wireframe |
wireframeAlpha | The transparency of the wireframe |
Definition at line 444 of file MeshVisual.cpp.
|
private |
The context that contains the display information.
Definition at line 324 of file MeshVisual.hpp.
|
private |
raw Triangle Mesh
Definition at line 378 of file MeshVisual.hpp.
|
private |
raw normals
Definition at line 381 of file MeshVisual.hpp.
|
private |
Definition at line 351 of file MeshVisual.hpp.
|
private |
Definition at line 316 of file MeshVisual.hpp.
|
private |
The mesh-object to display.
Definition at line 336 of file MeshVisual.hpp.
|
private |
The material for the general mesh.
Definition at line 357 of file MeshVisual.hpp.
|
private |
The material for the textured triangle mesh.
Definition at line 360 of file MeshVisual.hpp.
|
private |
The material of the normals.
Definition at line 363 of file MeshVisual.hpp.
|
private |
The manual object to display normals.
Definition at line 339 of file MeshVisual.hpp.
|
private |
Factor the normal-size is multiplied with.
Definition at line 375 of file MeshVisual.hpp.
|
private |
The materials of the not textured clusters.
Definition at line 366 of file MeshVisual.hpp.
|
private |
The manual object to display the not textured parts of the textured mesh.
Definition at line 348 of file MeshVisual.hpp.
|
private |
Second ID of the created mesh.
Definition at line 330 of file MeshVisual.hpp.
|
private |
First ID of the created mesh.
Definition at line 327 of file MeshVisual.hpp.
|
private |
Random ID of the created mesh.
Definition at line 333 of file MeshVisual.hpp.
|
private |
Ogre Scenenode.
Definition at line 321 of file MeshVisual.hpp.
|
private |
Definition at line 317 of file MeshVisual.hpp.
|
private |
The manual object to display the textured mesh.
Definition at line 345 of file MeshVisual.hpp.
|
private |
Definition at line 354 of file MeshVisual.hpp.
|
private |
The materials of the textures.
Definition at line 372 of file MeshVisual.hpp.
|
private |
Definition at line 318 of file MeshVisual.hpp.
|
private |
Definition at line 314 of file MeshVisual.hpp.
|
private |
Definition at line 315 of file MeshVisual.hpp.
|
private |
Definition at line 313 of file MeshVisual.hpp.
|
private |
The material of the mesh with vertex costs.
Definition at line 369 of file MeshVisual.hpp.
|
private |
The manual object to display the mesh with vertex costs.
Definition at line 342 of file MeshVisual.hpp.