trianglemesh_visual.cpp
Go to the documentation of this file.
1 #include <OGRE/OgreSubEntity.h>
2 #include <OGRE/OgreRenderOperation.h>
3 #include <OGRE/OgreTextureManager.h>
4 #include <OGRE/OgreHardwarePixelBuffer.h>
5 
6 #include <rviz/display_context.h>
7 #include <rviz/frame_manager.h>
8 
9 #include <stdint.h>
10 
11 #include "trianglemesh_visual.h"
12 
13 
14 namespace rviz_mesh_plugin
15 {
16 
18  rviz::DisplayContext* context,
19  size_t displayID,
20  size_t meshID,
21  size_t randomID)
22  : m_displayContext(context),
23  m_prefix(displayID),
24  m_postfix(meshID),
25  m_random(randomID),
26  m_vertex_normals_enabled(false),
27  m_vertex_colors_enabled(false),
28  m_triangle_colors_enabled(false),
29  m_texture_coords_enabled(false),
30  m_textureCounter(0),
31  m_normalsScalingFactor(1)
32  {
33 
34  ROS_INFO("Creating TriangleMeshVisual %lu_TriangleMesh_%lu_%lu",m_prefix, m_postfix, m_random);
35 
36  // get or create the scene node
37  Ogre::SceneManager* sceneManager = m_displayContext->getSceneManager();
38  Ogre::SceneNode* rootNode = sceneManager->getRootSceneNode();
39 
40  std::stringstream strstream;
41  strstream << "TriangleMeshScene" << m_random;
42  std::string sceneId = strstream.str();
43  if (sceneManager->hasSceneNode(sceneId)){
44  //ROS_INFO("Attaching to scene: %s", sceneId);
45  m_sceneNode = (Ogre::SceneNode*)(rootNode->getChild(sceneId));
46  }else{
47  //ROS_INFO("Creating new scene: %s", sceneId);
48  m_sceneNode = rootNode->createChildSceneNode(sceneId);
49  }
50 
51  // create manual object and attach it to the scene node
52  std::stringstream sstm;
53  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random;
54  m_mesh = sceneManager->createManualObject(sstm.str());
55  m_mesh->setDynamic(false);
56  m_sceneNode->attachObject(m_mesh);
57  }
58 
60  {
61  ROS_INFO("Destroying TriangleMeshVisual %lu_TriangleMesh_%lu_%lu",m_prefix, m_postfix, m_random);
62 
63  std::stringstream sstm;
64  reset();
65  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random;
66  m_displayContext->getSceneManager()->destroyManualObject(sstm.str());
67  m_displayContext->getSceneManager()->destroySceneNode(m_sceneNode);
68  sstm.str("");
69  sstm.flush();
70  }
71 
73  {
74 
75  ROS_INFO("Resetting TriangleMeshVisual %lu_TriangleMesh_%lu_%lu",m_prefix, m_postfix, m_random);
76 
77 
78  std::stringstream sstm;
79 
80  for (size_t i = 0; i < m_textureCounter; i++)
81  {
82  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "Texture_" << i;
83  Ogre::TextureManager::getSingleton().unload(sstm.str());
84  Ogre::TextureManager::getSingleton().remove(sstm.str());
85  sstm.str("");
86  sstm.clear();
87  }
88 
89  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "Material_" << 0;
90  Ogre::MaterialManager::getSingleton().unload(sstm.str());
91  Ogre::MaterialManager::getSingleton().remove(sstm.str());
92  sstm.str("");
93  sstm.clear();
94 
95  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "Material_" << 1;
96  Ogre::MaterialManager::getSingleton().unload(sstm.str());
97  Ogre::MaterialManager::getSingleton().remove(sstm.str());
98  sstm.str("");
99  sstm.clear();
100 
101  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "NormalMaterial";
102  Ogre::MaterialManager::getSingleton().unload(sstm.str());
103  Ogre::MaterialManager::getSingleton().remove(sstm.str());
104  sstm.str("");
105  sstm.clear();
106 
107  m_textureCounter = 0;
108  m_fakeTextures.clear();
109  m_hasTextures = false;
110  m_mesh->clear();
111  sstm.str("");
112  sstm.flush();
113  m_meshGeneralMaterial.setNull();
115  m_normalMaterial.setNull();
116  }
117 
119  Ogre::Pass* pass,
120  Ogre::ColourValue wireframeColor,
121  float wireframeAlpha
122  ){
123  pass->setAmbient(
124  Ogre::ColourValue(
125  wireframeColor.r,
126  wireframeColor.g,
127  wireframeColor.b,
128  wireframeAlpha
129  )
130  );
131  pass->setDiffuse(
132  Ogre::ColourValue(
133  wireframeColor.r,
134  wireframeColor.g,
135  wireframeColor.b,
136  wireframeAlpha
137  )
138  );
139 
140  if (wireframeAlpha < 1.0){
141  pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
142  pass->setDepthWriteEnabled(false);
143  }
144  pass->setPolygonMode(Ogre::PM_WIREFRAME);
145  pass->setCullingMode(Ogre::CULL_NONE);
146  }
147 
149  Ogre::Pass* pass,
150  Ogre::ColourValue facesColor,
151  float facesAlpha,
152  bool useVertexColors
153  ){
154 
155  pass->setDiffuse(
156  Ogre::ColourValue(
157  facesColor.r,
158  facesColor.g,
159  facesColor.b,
160  facesAlpha
161  )
162  );
163  pass->setSelfIllumination(facesColor.r, facesColor.g, facesColor.b);
164 
165 
166  if(useVertexColors){
167  pass->setLightingEnabled(false);
168  }
169 
170  if (facesAlpha < 1.0)
171  {
172  pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
173  pass->setDepthWriteEnabled(false);
174  }
175  pass->setPolygonMode(Ogre::PM_SOLID);
176  pass->setCullingMode(Ogre::CULL_NONE);
177  }
178 
180  Ogre::Pass* pass,
181  Ogre::ColourValue normalsColor,
182  float normalsAlpha
183  ){
184 
185  pass->setSelfIllumination(normalsColor.r, normalsColor.g, normalsColor.b);
186  pass->setDiffuse(
187  Ogre::ColourValue(
188  normalsColor.r,
189  normalsColor.g,
190  normalsColor.b,
191  normalsAlpha
192  )
193  );
194  if (normalsAlpha < 1.0)
195  {
196  pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
197  pass->setDepthWriteEnabled(false);
198  }
199  pass->setPolygonMode(Ogre::PM_SOLID);
200  pass->setCullingMode(Ogre::CULL_NONE);
201  }
202 
204  Ogre::Pass* pass){
205  //TODO
206  }
207 
209  bool showWireframe,
210  Ogre::ColourValue wireframeColor,
211  float wireframeAlpha,
212  bool showFaces,
213  Ogre::ColourValue facesColor,
214  float facesAlpha,
215  bool useVertexColors,
216  bool useTriangleColors,
217  bool showTextures,
218  bool showNormals,
219  Ogre::ColourValue normalsColor,
220  float normalsAlpha,
221  float normalsScalingFactor)
222  {
223  // remove all passes
224  if (!m_meshGeneralMaterial.isNull()){
225  m_meshGeneralMaterial->getTechnique(0)->removeAllPasses();
226  }
227 
228  if(!m_meshColoredTrianglesMaterial.isNull()){
229  m_meshColoredTrianglesMaterial->getTechnique(0)->removeAllPasses();
230  }
231 
232  if (!m_normalMaterial.isNull()){
233  m_normalMaterial->getTechnique(0)->removeAllPasses();
234  }
235 
236  bool triangleColorsEnabled = m_triangle_colors_enabled && useTriangleColors;
237 
238  // if the material exists and the triangle colors are not enabled
239  // because, if the triangle colors are are enabled we have to use the
240  // mesh with the "vertex for each triangle" structure and
241  // the m_meshColoredTrianglesMaterial otherwise we can use this
242  // general mesh with the m_meshGeneralMaterial
243  if (!m_meshGeneralMaterial.isNull() && !triangleColorsEnabled){
244  Ogre::Technique* tech = m_meshGeneralMaterial->getTechnique(0);
245 
246  if (showFaces){
247  this->showFaces(tech->createPass(), facesColor, facesAlpha, useVertexColors);
248  }
249 
250  if (showWireframe){
251  this->showWireframe(tech->createPass(), wireframeColor, wireframeAlpha);
252  }
253 
254  if (showTextures && m_hasTextures){
255  this->showTextures(tech->createPass());
256  }
257  }
258 
259  if (!m_meshColoredTrianglesMaterial.isNull() && triangleColorsEnabled){
260  Ogre::Technique* tech = m_meshColoredTrianglesMaterial->getTechnique(0);
261 
262  if (showFaces){
263  this->showFaces(tech->createPass(), facesColor, facesAlpha, true);
264  }
265 
266  if (showWireframe){
267  this->showWireframe(tech->createPass(), wireframeColor, wireframeAlpha);
268  }
269 
270  if (showTextures && m_hasTextures){
271  this->showTextures(tech->createPass());
272  }
273  }
274 
275  if(!m_normalMaterial.isNull()){
276  if (showNormals){
277  Ogre::Technique* tech = m_normalMaterial->getTechnique(0);
278  this->showNormals(tech->createPass(), normalsColor, normalsAlpha);
279  updateNormals(normalsScalingFactor);
280  }
281  }
282  }
283 
284 void TriangleMeshVisual::updateNormals(float ScalingFactor)
285 {
286  Ogre::VertexData* vertexData;
287  const Ogre::VertexElement* vertexElement;
288  Ogre::HardwareVertexBufferSharedPtr vertexBuffer;
289  unsigned char* vertexChar;
290  float* vertexFloat;
291 
292  vertexData = m_mesh->getSection(m_mesh->getNumSections() - 1)->getRenderOperation()->vertexData;
293  vertexElement = vertexData->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
294  vertexBuffer = vertexData->vertexBufferBinding->getBuffer(vertexElement->getSource());
295  vertexChar = static_cast<unsigned char*>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
296 
297  size_t halfVertexCount = vertexData->vertexCount/2;
298  Ogre::Vector3* vertices = new Ogre::Vector3[halfVertexCount];
299  Ogre::Vector3* normals = new Ogre::Vector3[halfVertexCount];
300 
301  for(size_t i = 0, vIndex = 0, nIndex = 0; i < vertexData->vertexCount; i++, vertexChar += vertexBuffer->getVertexSize())
302  {
303  vertexElement->baseVertexPointerToElement(vertexChar, &vertexFloat);
304  Ogre::Vector3 tempVector(vertexFloat[0], vertexFloat[1], vertexFloat[2]);
305 
306  if (i % 2 == 0)
307  {
308  vertices[vIndex] = tempVector;
309  vIndex++;
310  }
311 
312  else
313  {
314  normals[nIndex] = (tempVector - vertices[nIndex]) / m_normalsScalingFactor;
315  nIndex++;
316  }
317  }
318  vertexBuffer->unlock();
319 
320  m_mesh->beginUpdate(m_mesh->getNumSections() - 1);
321  for (size_t i = 0; i < halfVertexCount; i++)
322  {
323  m_mesh->position(vertices[i].x, vertices[i].y, vertices[i].z);
324  m_mesh->position(vertices[i].x + ScalingFactor * normals[i].x,
325  vertices[i].y + ScalingFactor * normals[i].y,
326  vertices[i].z + ScalingFactor * normals[i].z);
327  }
328  m_mesh->end();
329  delete [] vertices;
330  delete [] normals;
331  m_normalsScalingFactor = ScalingFactor;
332 }
333 
334 
335 
336 void TriangleMeshVisual::enteringColoredTriangleMesh(const mesh_msgs::TriangleMesh& mesh){
337 
339  return;
340  }
341 
342  std::stringstream sstm;
343  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "Material_" << 1;
344 
346  Ogre::MaterialManager::getSingleton().create(
347  sstm.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true
348  );
349 
350  // start entering data
351  m_mesh->begin(sstm.str(), Ogre::RenderOperation::OT_TRIANGLE_LIST);
352 
353  // write vertices for each triangle
354  // to enable a coloring for each triangle
355 
356  // write triangle colors as vertex colours
357  // write vertex normals(if enabled)
358 
359  size_t triangle_vertex_cnt = 0;
360  for(size_t i = 0; i < mesh.triangles.size(); i++){
361  // write three triangle vertices
362  for(size_t j = 0; j < 3; j++){
363  int vertex_index = mesh.triangles[i].vertex_indices[j];
364  // write vertex positions
365  m_mesh->position(
366  mesh.vertices[vertex_index].x,
367  mesh.vertices[vertex_index].y,
368  mesh.vertices[vertex_index].z
369  );
370  // write triangle colors
371  m_mesh->colour(
372  mesh.triangle_colors[i].r,
373  mesh.triangle_colors[i].g,
374  mesh.triangle_colors[i].b,
375  mesh.triangle_colors[i].a
376  );
377  // write vertex normals, if enabled
379  m_mesh->normal(
380  mesh.vertex_normals[vertex_index].x,
381  mesh.vertex_normals[vertex_index].y,
382  mesh.vertex_normals[vertex_index].z
383  );
384  }
385  }
386  // write the three trianlge vertex indices
387  m_mesh->triangle(
388  triangle_vertex_cnt,
389  triangle_vertex_cnt+1,
390  triangle_vertex_cnt+2
391  );
392  triangle_vertex_cnt += 3;
393  }
394 
395  // finish entering data
396  m_mesh->end();
397 }
398 
399 void TriangleMeshVisual::enteringGeneralTriangleMesh(const mesh_msgs::TriangleMesh& mesh){
400 
401  std::stringstream sstm;
402 
403  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "Material_" << 0;
404 
406  Ogre::MaterialManager::getSingleton().create(
407  sstm.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true
408  );
409 
410  // start entering data
411  m_mesh->begin(sstm.str(), Ogre::RenderOperation::OT_TRIANGLE_LIST);
412 
413  // write vertices
414  // write color(if enabled)
415  // write exture coords(if enabled)
416  // write vertex normals(if enabled)
417  for (size_t i = 0; i < mesh.vertices.size(); i++)
418  {
419  // write vertex
420  m_mesh->position(mesh.vertices[i].x, mesh.vertices[i].y, mesh.vertices[i].z);
421 
422  // write vertex color, if enabled
424  m_mesh->colour(
425  mesh.vertex_colors[i].r,
426  mesh.vertex_colors[i].g,
427  mesh.vertex_colors[i].b,
428  mesh.vertex_colors[i].a
429  );
430  }
431 
432  // write texture coord, if enabled
434  m_mesh->textureCoord(
435  mesh.vertex_texture_coords[i].x,
436  mesh.vertex_texture_coords[i].y,
437  mesh.vertex_texture_coords[i].z
438  );
439  }
440 
441  // write vertex normals, if enabled
443  m_mesh->normal(
444  mesh.vertex_normals[i].x,
445  mesh.vertex_normals[i].y,
446  mesh.vertex_normals[i].z
447  );
448  }
449  }
450 
451  // write triangles
452  for (size_t i = 0; i < mesh.triangles.size(); i++)
453  {
454  m_mesh->triangle(
455  mesh.triangles[i].vertex_indices[0],
456  mesh.triangles[i].vertex_indices[1],
457  mesh.triangles[i].vertex_indices[2]
458  );
459  }
460 
461  // finish entering data
462  m_mesh->end();
463 
464 }
465 
466 void TriangleMeshVisual::enteringNormals(const mesh_msgs::TriangleMesh& mesh){
467 
469  return;
470  }
471 
472  std::stringstream sstm;
473  sstm << m_prefix << "_TriangleMesh_" << m_postfix << "_" << m_random << "NormalMaterial";
474  m_normalMaterial = Ogre::MaterialManager::getSingleton().create(sstm.str(),
475  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
476 
477  // Create pointNormals
478  m_mesh->begin(sstm.str(), Ogre::RenderOperation::OT_LINE_LIST);
479 
480  // Vertices
481  for (size_t i = 0; i < mesh.vertex_normals.size(); i++)
482  {
483  m_mesh->position(mesh.vertices[i].x, mesh.vertices[i].y, mesh.vertices[i].z);
484  m_mesh->position(
485  mesh.vertices[i].x + m_normalsScalingFactor * mesh.vertex_normals[i].x,
486  mesh.vertices[i].y + m_normalsScalingFactor * mesh.vertex_normals[i].y,
487  mesh.vertices[i].z + m_normalsScalingFactor * mesh.vertex_normals[i].z);
488  // add line to index buffer
489  m_mesh->index(2*i);
490  m_mesh->index(2*i+1);
491  }
492  m_mesh->end();
493 
494 }
495 
496 void TriangleMeshVisual::setMessage(const mesh_msgs::TriangleMeshStamped::ConstPtr& mesh_msg)
497 {
498  reset();
499 
500  // for a better legibility of the code
501  const mesh_msgs::TriangleMesh& mesh = mesh_msg->mesh;
502 
503  // default: vertex colors are optional and therefore disabled
504  m_vertex_colors_enabled = false;
505 
506  // default: triangle colors are optional and therefore disabled
508 
509  // default: textures and texture_coords are optional and therefore disabled
510  m_texture_coords_enabled = false;
511 
512  // default: vertex normals are optional and therefore disabled
513  m_vertex_normals_enabled = false;
514 
515  // check if there are enough vertices given
516  if (mesh.vertices.size() < 3){
517  ROS_WARN("Received not enough vertices, can't create mesh!");
518  return;
519  }
520 
521  // defines the buffer sizes
522  int vertex_count = mesh.vertices.size();
523  int index_count = mesh.triangles.size() * 3;
524 
525 
526  // vertex colors
527  // check if there are vertex colors for each vertex
528  if(mesh.vertex_colors.size() == mesh.vertices.size()){
529  ROS_INFO("Received %lu vertex colors.", mesh.vertex_colors.size());
531  }
532  else if(mesh.vertex_colors.size() > 0){
533  ROS_WARN("Received not as much vertex colors as vertices, ignoring the vertex colors!");
534  }
535 
536  // triangle colors
537  // check if there are vertex colors for each vertex
538  if(mesh.triangle_colors.size() == mesh.triangles.size()){
539  ROS_INFO("Received %lu triangle colors.", mesh.triangle_colors.size());
541 
542  // space for the extra mesh
543  vertex_count += 3 * mesh.triangles.size();
544  index_count += 3 * mesh.triangles.size();
545  }
546  else if(mesh.triangle_colors.size() > 0){
547  ROS_WARN("Received not as much triangle colors as triangles, ignoring the triangle colors!");
548  }
549 
550  // texture coords
551  // check if there are texture coords for each vertex
552  if(mesh.vertex_texture_coords.size() == mesh.vertices.size()){
553  ROS_INFO("Received %lu texture coords.", mesh.vertex_texture_coords.size());
554  m_texture_coords_enabled = true; // enable texture coords
555  }
556  else if(mesh.vertex_texture_coords.size() > 0){
557  ROS_WARN("Received not as much texture coords as vertices, ignoring texture coords!");
558  }
559 
560  // vertex normals
561  // check if there are vertex normals for each vertex
562  if(mesh.vertex_normals.size() == mesh.vertices.size()){
563  ROS_INFO("Received %lu vertex normals.", mesh.vertex_normals.size());
565  // space for the normals in the buffer
566  vertex_count += mesh.vertices.size();
567  index_count += mesh.vertices.size() * 2;
568  }
569  else if(mesh.vertex_normals.size() > 0){
570  ROS_WARN("Received not as much vertex normals as vertices, ignoring vertex normals!");
571  }
572 
573  // avoid memory reallocation
574  m_mesh->estimateVertexCount(vertex_count);
575  m_mesh->estimateIndexCount(index_count);
576 
577  // entering a general triangle mesh into the internal buffer
579 
580  // entering a special mesh for colored triangles into the internal buffer
583  }
584 
585  // entering the normals into the internal buffer
587  enteringNormals(mesh);
588  }
589 }
590 
591 void TriangleMeshVisual::setFramePosition(const Ogre::Vector3& position)
592 {
593  m_sceneNode->setPosition(position);
594 }
595 
596 void TriangleMeshVisual::setFrameOrientation(const Ogre::Quaternion& orientation)
597 {
598  m_sceneNode->setOrientation(orientation);
599 }
600 
601 } // end namespace rviz_mesh_plugin
rviz_mesh_plugin::TriangleMeshVisual::m_normalMaterial
Ogre::MaterialPtr m_normalMaterial
The material of the normals.
Definition: trianglemesh_visual.h:197
rviz_mesh_plugin::TriangleMeshVisual::m_triangle_colors_enabled
bool m_triangle_colors_enabled
Definition: trianglemesh_visual.h:169
rviz_mesh_plugin::TriangleMeshVisual::m_mesh
Ogre::ManualObject * m_mesh
The mesh-object to display.
Definition: trianglemesh_visual.h:188
rviz_mesh_plugin::TriangleMeshVisual::m_texture_coords_enabled
bool m_texture_coords_enabled
Definition: trianglemesh_visual.h:170
rviz_mesh_plugin::TriangleMeshVisual::TriangleMeshVisual
TriangleMeshVisual(rviz::DisplayContext *context, size_t displayID, size_t meshID, size_t randomID)
Constructor.
Definition: trianglemesh_visual.cpp:17
rviz_mesh_plugin::TriangleMeshVisual::showWireframe
void showWireframe(Ogre::Pass *pass, Ogre::ColourValue wireframeColor, float wireframeAlpha)
Definition: trianglemesh_visual.cpp:118
rviz_mesh_plugin::TriangleMeshVisual::m_hasTextures
bool m_hasTextures
Is the mesh textured?
Definition: trianglemesh_visual.h:203
rviz_mesh_plugin::TriangleMeshVisual::m_prefix
size_t m_prefix
First ID of the created mesh.
Definition: trianglemesh_visual.h:179
rviz_mesh_plugin::TriangleMeshVisual::m_displayContext
rviz::DisplayContext * m_displayContext
The context that contains the display information.
Definition: trianglemesh_visual.h:176
rviz_mesh_plugin::TriangleMeshVisual::m_meshGeneralMaterial
Ogre::MaterialPtr m_meshGeneralMaterial
The material for the general mesh.
Definition: trianglemesh_visual.h:191
rviz_mesh_plugin::TriangleMeshVisual::showTextures
void showTextures(Ogre::Pass *pass)
Definition: trianglemesh_visual.cpp:203
rviz_mesh_plugin::TriangleMeshVisual::enteringNormals
void enteringNormals(const mesh_msgs::TriangleMesh &mesh)
Definition: trianglemesh_visual.cpp:466
rviz_mesh_plugin::TriangleMeshVisual::m_vertex_colors_enabled
bool m_vertex_colors_enabled
Definition: trianglemesh_visual.h:168
frame_manager.h
trianglemesh_visual.h
rviz_mesh_plugin::TriangleMeshVisual::setFrameOrientation
void setFrameOrientation(const Ogre::Quaternion &orientation)
Sets the orientation of the coordinate frame the message refers to.
Definition: trianglemesh_visual.cpp:596
rviz_mesh_plugin::TriangleMeshVisual::reset
void reset()
Clears whole stored data.
Definition: trianglemesh_visual.cpp:72
rviz::DisplayContext::getSceneManager
virtual Ogre::SceneManager * getSceneManager() const=0
rviz_mesh_plugin::TriangleMeshVisual::m_meshColoredTrianglesMaterial
Ogre::MaterialPtr m_meshColoredTrianglesMaterial
The material for the colored triangle mesh.
Definition: trianglemesh_visual.h:194
rviz_mesh_plugin::TriangleMeshVisual::m_textureCounter
size_t m_textureCounter
Counter for textures.
Definition: trianglemesh_visual.h:200
rviz_mesh_plugin::TriangleMeshVisual::m_postfix
size_t m_postfix
Second ID of the created mesh.
Definition: trianglemesh_visual.h:182
rviz_mesh_plugin::TriangleMeshVisual::enteringGeneralTriangleMesh
void enteringGeneralTriangleMesh(const mesh_msgs::TriangleMesh &mesh)
Definition: trianglemesh_visual.cpp:399
rviz_mesh_plugin::TriangleMeshVisual::m_normalsScalingFactor
float m_normalsScalingFactor
Factor the normal-size is multiplied with.
Definition: trianglemesh_visual.h:209
rviz_mesh_plugin::TriangleMeshVisual::m_sceneNode
Ogre::SceneNode * m_sceneNode
Ogre Scenenode.
Definition: trianglemesh_visual.h:173
rviz_mesh_plugin::TriangleMeshVisual::setFramePosition
void setFramePosition(const Ogre::Vector3 &position)
Sets the pose of the coordinate frame the message refers to.
Definition: trianglemesh_visual.cpp:591
rviz_mesh_plugin::TriangleMeshVisual::m_vertex_normals_enabled
bool m_vertex_normals_enabled
Definition: trianglemesh_visual.h:167
rviz_mesh_plugin::TriangleMeshVisual::showNormals
void showNormals(Ogre::Pass *pass, Ogre::ColourValue normalsColor, float normalsAlpha)
Definition: trianglemesh_visual.cpp:179
ROS_WARN
#define ROS_WARN(...)
rviz_mesh_plugin::TriangleMeshVisual::setMessage
void setMessage(const mesh_msgs::TriangleMeshStamped::ConstPtr &meshMsg)
Extracts data from the ros-messages and creates meshes.
Definition: trianglemesh_visual.cpp:496
rviz::DisplayContext
rviz_mesh_plugin::TriangleMeshVisual::m_fakeTextures
std::map< size_t, Ogre::ColourValue > m_fakeTextures
Map of fake textures (size = 1x1 = only a color)
Definition: trianglemesh_visual.h:206
rviz_mesh_plugin
Definition: face_selection_tool.h:117
rviz_mesh_plugin::TriangleMeshVisual::enteringColoredTriangleMesh
void enteringColoredTriangleMesh(const mesh_msgs::TriangleMesh &mesh)
Definition: trianglemesh_visual.cpp:336
rviz_mesh_plugin::TriangleMeshVisual::updateMaterial
void updateMaterial(bool showWireframe, Ogre::ColourValue wireframeColor, float wireframeAlpha, bool showFaces, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors, bool useTriangleColors, bool showTextures, bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha, float normalsScallingFactor)
Updates the visible parts of the mesh depending on input from the rviz display.
Definition: trianglemesh_visual.cpp:208
rviz_mesh_plugin::TriangleMeshVisual::m_random
size_t m_random
Random ID of the created mesh.
Definition: trianglemesh_visual.h:185
rviz_mesh_plugin::TriangleMeshVisual::updateNormals
void updateNormals(float scallingFactor)
Updates the size of the normals dynamically.
Definition: trianglemesh_visual.cpp:284
ROS_INFO
#define ROS_INFO(...)
rviz_mesh_plugin::TriangleMeshVisual::showFaces
void showFaces(Ogre::Pass *pass, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors)
Definition: trianglemesh_visual.cpp:148
rviz_mesh_plugin::TriangleMeshVisual::~TriangleMeshVisual
virtual ~TriangleMeshVisual()
Destructor.
Definition: trianglemesh_visual.cpp:59
display_context.h


rviz_mesh_plugin
Author(s): Sebastian Pütz , Henning Deeken , Marcel Mrozinski , Kristin Schmidt , Jan Philipp Vogtherr
autogenerated on Fri Feb 12 2021 04:03:57