trianglemesh_visual.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Robot Operating System code by the University of Osnabrück
5  * Copyright (c) 2015, University of Osnabrück
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  *
21  * 3. Neither the name of the copyright holder nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  *
39  *
40  * trianglemesh_visual.h
41  *
42  *
43  * authors:
44  *
45  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
46  * Henning Deeken <hdeeken@uni-osnabrueck.de>
47  * Marcel Mrozinski
48  * Nils Oesting
49  */
50 
51 #ifndef TRIANGLEMESH_VISUAL_H
52 #define TRIANGLEMESH_VISUAL_H
53 
54 #include <mesh_msgs/TriangleMeshStamped.h>
55 
56 #include <rviz/display_context.h>
57 #include <rviz/frame_manager.h>
58 
59 #include <OGRE/OgreSceneNode.h>
60 #include <OGRE/OgreSceneManager.h>
61 #include <OGRE/OgreManualObject.h>
62 #include <OGRE/OgreEntity.h>
63 #include <OGRE/OgreMaterialManager.h>
64 #include <OGRE/OgreColourValue.h>
65 
66 namespace Ogre
67 {
68 // Forward declaration
69 class Vector3;
70 class Quaternion;
71 class SceneNode;
72 class Entity;
73 
74 } // End namespace Ogre
75 
76 namespace rviz_mesh_plugin
77 {
82 {
83 public:
92  TriangleMeshVisual(rviz::DisplayContext* context, size_t displayID, size_t meshID, size_t randomID);
93 
97  virtual ~TriangleMeshVisual();
98 
102  void reset();
103 
109  void setMessage(const mesh_msgs::TriangleMeshStamped::ConstPtr& meshMsg);
110 
116  void setFramePosition(const Ogre::Vector3& position);
117 
123  void setFrameOrientation(const Ogre::Quaternion& orientation);
124 
142  void updateMaterial(bool showWireframe, Ogre::ColourValue wireframeColor, float wireframeAlpha, bool showFaces,
143  Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors, bool useTriangleColors,
144  bool showTextures, bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha,
145  float normalsScallingFactor);
146 
152  void updateNormals(float scallingFactor);
153 
154 private:
155  void showWireframe(Ogre::Pass* pass, Ogre::ColourValue wireframeColor, float wireframeAlpha);
156 
157  void showFaces(Ogre::Pass* pass, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors);
158 
159  void showNormals(Ogre::Pass* pass, Ogre::ColourValue normalsColor, float normalsAlpha);
160 
161  void showTextures(Ogre::Pass* pass);
162 
163  void enteringGeneralTriangleMesh(const mesh_msgs::TriangleMesh& mesh);
164  void enteringColoredTriangleMesh(const mesh_msgs::TriangleMesh& mesh);
165  void enteringNormals(const mesh_msgs::TriangleMesh& mesh);
166 
171 
173  Ogre::SceneNode* m_sceneNode;
174 
177 
179  size_t m_prefix;
180 
182  size_t m_postfix;
183 
185  size_t m_random;
186 
188  Ogre::ManualObject* m_mesh;
189 
191  Ogre::MaterialPtr m_meshGeneralMaterial;
192 
195 
197  Ogre::MaterialPtr m_normalMaterial;
198 
201 
204 
206  std::map<size_t, Ogre::ColourValue> m_fakeTextures;
207 
210 };
211 } // End namespace rviz_mesh_plugin
212 
213 #endif
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
Ogre
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
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_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
Vector3
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
rviz_mesh_plugin::TriangleMeshVisual
Class to display mesh data in the main panel of rviz.
Definition: trianglemesh_visual.h:81
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
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