Public Member Functions | Private Member Functions | Private Attributes | List of all members
rviz_map_plugin::MeshVisual Class Reference

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::DisplayContextm_displayContext
 The context that contains the display information. More...
 
Geometry m_geometry
 raw Triangle Mesh More...
 
std::vector< Normalm_geometryNormals
 raw normals More...
 
std::vector< Ogre::Imagem_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...
 

Detailed Description

Class to display mesh data in the main panel of rviz.

Definition at line 97 of file MeshVisual.hpp.

Constructor & Destructor Documentation

◆ MeshVisual()

rviz_map_plugin::MeshVisual::MeshVisual ( rviz::DisplayContext context,
size_t  displayID,
size_t  meshID,
size_t  randomID 
)

Constructor.

Parameters
contextThe context that contains the display information.
displayIDThe display id
meshIDThe mesh id
randomIDrandom number that will be used as part of the meshes UID

Definition at line 96 of file MeshVisual.cpp.

◆ ~MeshVisual()

rviz_map_plugin::MeshVisual::~MeshVisual ( )
virtual

Destructor.

Definition at line 159 of file MeshVisual.cpp.

Member Function Documentation

◆ addTexture()

bool rviz_map_plugin::MeshVisual::addTexture ( Texture texture,
uint32_t  textureIndex 
)

Extracts data from the ros-messages and adds textures to the textured mesh.

Parameters
textureTexture containing the texture information and data
textureIndexIndex of the texture

Definition at line 944 of file MeshVisual.cpp.

◆ calculateColorFromCost()

Ogre::ColourValue rviz_map_plugin::MeshVisual::calculateColorFromCost ( float  cost,
int  costColorType 
)
private

Calculates a color for a given cost value using a spectrum from red to green.

Parameters
costThe cost value (should be within the range 0 - 1)
Returns
calculated color

Definition at line 1001 of file MeshVisual.cpp.

◆ enteringColoredTriangleMesh()

void rviz_map_plugin::MeshVisual::enteringColoredTriangleMesh ( const Geometry mesh,
const vector< Color > &  vertexColors 
)
private

Definition at line 496 of file MeshVisual.cpp.

◆ enteringGeneralTriangleMesh()

void rviz_map_plugin::MeshVisual::enteringGeneralTriangleMesh ( const Geometry mesh)
private

Definition at line 464 of file MeshVisual.cpp.

◆ enteringNormals()

void rviz_map_plugin::MeshVisual::enteringNormals ( const Geometry mesh,
const vector< Normal > &  normals 
)
private

Definition at line 723 of file MeshVisual.cpp.

◆ enteringTexturedTriangleMesh()

void rviz_map_plugin::MeshVisual::enteringTexturedTriangleMesh ( const Geometry mesh,
const vector< Material > &  meshMaterials,
const vector< TexCoords > &  texCoords 
)
private

Definition at line 609 of file MeshVisual.cpp.

◆ enteringTriangleMeshWithVertexCosts() [1/2]

void rviz_map_plugin::MeshVisual::enteringTriangleMeshWithVertexCosts ( const Geometry mesh,
const vector< float > &  vertexCosts,
int  costColorType 
)
private

Definition at line 534 of file MeshVisual.cpp.

◆ enteringTriangleMeshWithVertexCosts() [2/2]

void rviz_map_plugin::MeshVisual::enteringTriangleMeshWithVertexCosts ( const Geometry mesh,
const vector< float > &  vertexCosts,
int  costColorType,
float  minCost,
float  maxCost 
)
private

Definition at line 551 of file MeshVisual.cpp.

◆ getOgrePixelFormatFromRosString()

Ogre::PixelFormat rviz_map_plugin::MeshVisual::getOgrePixelFormatFromRosString ( std::string  encoding)
private

Definition at line 970 of file MeshVisual.cpp.

◆ loadImageIntoTextureMaterial()

void rviz_map_plugin::MeshVisual::loadImageIntoTextureMaterial ( size_t  textureIndex)
private

Definition at line 985 of file MeshVisual.cpp.

◆ reset()

void rviz_map_plugin::MeshVisual::reset ( )

Clears whole stored data.

Definition at line 190 of file MeshVisual.cpp.

◆ setFrameOrientation()

void rviz_map_plugin::MeshVisual::setFrameOrientation ( const Ogre::Quaternion &  orientation)

Sets the orientation of the coordinate frame the message refers to.

Parameters
orientationThe orientation of the coordinate frame

Definition at line 1030 of file MeshVisual.cpp.

◆ setFramePosition()

void rviz_map_plugin::MeshVisual::setFramePosition ( const Ogre::Vector3 position)

Sets the pose of the coordinate frame the message refers to.

Parameters
positionThe pose of the coordinate frame

Definition at line 1025 of file MeshVisual.cpp.

◆ setGeometry()

bool rviz_map_plugin::MeshVisual::setGeometry ( const Geometry geometry)

Extracts data from the ros-messages and creates meshes.

Parameters
geometryGeometry containing the mesh

Definition at line 761 of file MeshVisual.cpp.

◆ setMaterials()

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.

Parameters
materialsVector containing all materials
texCoordsVector containing all texture coordinates

Definition at line 912 of file MeshVisual.cpp.

◆ setNormals()

bool rviz_map_plugin::MeshVisual::setNormals ( const std::vector< Normal > &  normals)

Passes the normal data to the mesh visual.

Parameters
normalsVector containing the normal data

Definition at line 801 of file MeshVisual.cpp.

◆ setVertexColors()

bool rviz_map_plugin::MeshVisual::setVertexColors ( const std::vector< Color > &  vertexColors)

Extracts data from the ros-messages and creates a colored mesh.

Parameters
vertexColorsVector containing the vertex color information

Definition at line 831 of file MeshVisual.cpp.

◆ setVertexCosts() [1/3]

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.

Parameters
vertexCostsVector containing the vertex cost information

◆ setVertexCosts() [2/3]

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.

Parameters
vertexCostsVector containing the vertex cost information
costColorTypecolorization method (0 = rainbow; 1 = red-green)

Definition at line 855 of file MeshVisual.cpp.

◆ setVertexCosts() [3/3]

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.

Parameters
vertexCostsVector containing the vertex cost information
costColorTypecolorization method (0 = rainbow; 1 = red-green)
minCostminimum value for colorization
maxCostmaximum value for colorization

Definition at line 883 of file MeshVisual.cpp.

◆ showFaces()

void rviz_map_plugin::MeshVisual::showFaces ( Ogre::Pass *  pass,
Ogre::ColourValue  facesColor,
float  facesAlpha,
bool  useVertexColors 
)
private

Definition at line 272 of file MeshVisual.cpp.

◆ showNormals()

void rviz_map_plugin::MeshVisual::showNormals ( Ogre::Pass *  pass,
Ogre::ColourValue  normalsColor,
float  normalsAlpha 
)
private

Definition at line 292 of file MeshVisual.cpp.

◆ showTextures()

void rviz_map_plugin::MeshVisual::showTextures ( Ogre::Pass *  pass)
private

◆ showWireframe()

void rviz_map_plugin::MeshVisual::showWireframe ( Ogre::Pass *  pass,
Ogre::ColourValue  wireframeColor,
float  wireframeAlpha 
)
private

Enables the wireframe.

Parameters
passOgre Pass
wireframeColorThe color of the wireframe
wireframeAlphaTransparency of the wireframe

Definition at line 258 of file MeshVisual.cpp.

◆ updateMaterial() [1/2]

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.

Parameters
showFacesWhen TRUE faces are visible
facesColorThe color of the faces
facesAlphaThe transparency of the faces
useVertexColorsWhen TRUE vertex colors are used
showVertexCostsWhen TRUE vertex costs are visible
showTexturesWhen TRUE textures are visible
showTexturedFacesOnlyWhen TRUE only textured faces are visible

Definition at line 305 of file MeshVisual.cpp.

◆ updateMaterial() [2/2]

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.

Parameters
showWireframeWhen TRUE wireframe is visible
wireframeColorThe color of the wireframe
wireframeAlphaThe transparency of the wireframe
showFacesWhen TRUE faces are visible
facesColorThe color of the faces
facesAlphaThe transparency of the faces
useVertexColorsWhen TRUE vertex colors are used
showVertexCostsWhen TRUE vertex costs are visible
showTexturesWhen TRUE textures are visible
showTexturedFacesOnlyWhen TRUE only textured faces are visible
showNormalsWhen TRUE normals are visible
normalsColorThe color of the normals
normalsAlphaThe transparency of the normals
normalsScallingFactorThe size of the normals

Definition at line 352 of file MeshVisual.cpp.

◆ updateNormals() [1/3]

void rviz_map_plugin::MeshVisual::updateNormals ( bool  showNormals,
Ogre::ColourValue  normalsColor,
float  normalsAlpha 
)

Updates the normals dynamically.

Parameters
showNormalsWhen TRUE normals are visible
normalsColorThe color of the normals
normalsAlphaThe transparency of the normals

Definition at line 423 of file MeshVisual.cpp.

◆ updateNormals() [2/3]

void rviz_map_plugin::MeshVisual::updateNormals ( bool  showNormals,
Ogre::ColourValue  normalsColor,
float  normalsAlpha,
float  scalingFactor 
)

Updates the normals dynamically.

Parameters
showNormalsWhen TRUE normals are visible
normalsColorThe color of the normals
normalsAlphaThe transparency of the normals
scalingFactorThe factor the normals have to be scaled with

Definition at line 437 of file MeshVisual.cpp.

◆ updateNormals() [3/3]

void rviz_map_plugin::MeshVisual::updateNormals ( float  scallingFactor)

Updates the size of the normals dynamically.

Parameters
scallingFactorThe factor the normals have to be scaled with

Definition at line 417 of file MeshVisual.cpp.

◆ updateWireframe()

void rviz_map_plugin::MeshVisual::updateWireframe ( bool  showWireframe,
Ogre::ColourValue  wireframeColor,
float  wireframeAlpha 
)

Updates the wireframe dynamically.

Parameters
showWireframeWhen TRUE wireframe is visible
wireframeColorThe color of the wireframe
wireframeAlphaThe transparency of the wireframe

Definition at line 444 of file MeshVisual.cpp.

Member Data Documentation

◆ m_displayContext

rviz::DisplayContext* rviz_map_plugin::MeshVisual::m_displayContext
private

The context that contains the display information.

Definition at line 324 of file MeshVisual.hpp.

◆ m_geometry

Geometry rviz_map_plugin::MeshVisual::m_geometry
private

raw Triangle Mesh

Definition at line 378 of file MeshVisual.hpp.

◆ m_geometryNormals

std::vector<Normal> rviz_map_plugin::MeshVisual::m_geometryNormals
private

raw normals

Definition at line 381 of file MeshVisual.hpp.

◆ m_images

std::vector<Ogre::Image> rviz_map_plugin::MeshVisual::m_images
private

Definition at line 351 of file MeshVisual.hpp.

◆ m_materials_enabled

bool rviz_map_plugin::MeshVisual::m_materials_enabled
private

Definition at line 316 of file MeshVisual.hpp.

◆ m_mesh

Ogre::ManualObject* rviz_map_plugin::MeshVisual::m_mesh
private

The mesh-object to display.

Definition at line 336 of file MeshVisual.hpp.

◆ m_meshGeneralMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_meshGeneralMaterial
private

The material for the general mesh.

Definition at line 357 of file MeshVisual.hpp.

◆ m_meshTexturedTrianglesMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_meshTexturedTrianglesMaterial
private

The material for the textured triangle mesh.

Definition at line 360 of file MeshVisual.hpp.

◆ m_normalMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_normalMaterial
private

The material of the normals.

Definition at line 363 of file MeshVisual.hpp.

◆ m_normals

Ogre::ManualObject* rviz_map_plugin::MeshVisual::m_normals
private

The manual object to display normals.

Definition at line 339 of file MeshVisual.hpp.

◆ m_normalsScalingFactor

float rviz_map_plugin::MeshVisual::m_normalsScalingFactor
private

Factor the normal-size is multiplied with.

Definition at line 375 of file MeshVisual.hpp.

◆ m_noTexCluMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_noTexCluMaterial
private

The materials of the not textured clusters.

Definition at line 366 of file MeshVisual.hpp.

◆ m_noTexCluMesh

Ogre::ManualObject* rviz_map_plugin::MeshVisual::m_noTexCluMesh
private

The manual object to display the not textured parts of the textured mesh.

Definition at line 348 of file MeshVisual.hpp.

◆ m_postfix

size_t rviz_map_plugin::MeshVisual::m_postfix
private

Second ID of the created mesh.

Definition at line 330 of file MeshVisual.hpp.

◆ m_prefix

size_t rviz_map_plugin::MeshVisual::m_prefix
private

First ID of the created mesh.

Definition at line 327 of file MeshVisual.hpp.

◆ m_random

size_t rviz_map_plugin::MeshVisual::m_random
private

Random ID of the created mesh.

Definition at line 333 of file MeshVisual.hpp.

◆ m_sceneNode

Ogre::SceneNode* rviz_map_plugin::MeshVisual::m_sceneNode
private

Ogre Scenenode.

Definition at line 321 of file MeshVisual.hpp.

◆ m_texture_coords_enabled

bool rviz_map_plugin::MeshVisual::m_texture_coords_enabled
private

Definition at line 317 of file MeshVisual.hpp.

◆ m_texturedMesh

Ogre::ManualObject* rviz_map_plugin::MeshVisual::m_texturedMesh
private

The manual object to display the textured mesh.

Definition at line 345 of file MeshVisual.hpp.

◆ m_texturedMeshMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_texturedMeshMaterial
private

Definition at line 354 of file MeshVisual.hpp.

◆ m_textureMaterials

std::vector<Ogre::MaterialPtr> rviz_map_plugin::MeshVisual::m_textureMaterials
private

The materials of the textures.

Definition at line 372 of file MeshVisual.hpp.

◆ m_textures_enabled

bool rviz_map_plugin::MeshVisual::m_textures_enabled
private

Definition at line 318 of file MeshVisual.hpp.

◆ m_vertex_colors_enabled

bool rviz_map_plugin::MeshVisual::m_vertex_colors_enabled
private

Definition at line 314 of file MeshVisual.hpp.

◆ m_vertex_costs_enabled

bool rviz_map_plugin::MeshVisual::m_vertex_costs_enabled
private

Definition at line 315 of file MeshVisual.hpp.

◆ m_vertex_normals_enabled

bool rviz_map_plugin::MeshVisual::m_vertex_normals_enabled
private

Definition at line 313 of file MeshVisual.hpp.

◆ m_vertexCostMaterial

Ogre::MaterialPtr rviz_map_plugin::MeshVisual::m_vertexCostMaterial
private

The material of the mesh with vertex costs.

Definition at line 369 of file MeshVisual.hpp.

◆ m_vertexCostsMesh

Ogre::ManualObject* rviz_map_plugin::MeshVisual::m_vertexCostsMesh
private

The manual object to display the mesh with vertex costs.

Definition at line 342 of file MeshVisual.hpp.


The documentation for this class was generated from the following files:


rviz_map_plugin
Author(s): Sebastian Pütz , Kristin Schmidt , Jan Philipp Vogtherr , Malte kleine Piening
autogenerated on Sun Jan 21 2024 04:06:25