moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
mesh_shape.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008, Willow Garage, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Willow Garage, Inc. nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#pragma once
31
32#include <rviz_rendering/objects/shape.hpp>
33
34namespace Ogre
35{
36class ManualObject;
37}
38
39// TODO(JafarAbdi): This's taken from https://github.com/ros2/rviz for MoveIt 2 beta release -- remove when it's ported
40namespace rviz_rendering
41{
68class MeshShape : public Shape
69{
70public:
77 MeshShape(Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node = nullptr);
78 ~MeshShape() override;
79
80 /* \brief Estimate the number of vertices ahead of time. */
81 void estimateVertexCount(size_t vcount);
82
84 void beginTriangles();
85
92 void addVertex(const Ogre::Vector3& position);
93
100 void addVertex(const Ogre::Vector3& position, const Ogre::Vector3& normal);
101
108 void addVertex(const Ogre::Vector3& position, const Ogre::Vector3& normal, const Ogre::ColourValue& color);
109
111 void addNormal(const Ogre::Vector3& normal);
112
114 void addColor(const Ogre::ColourValue& color);
115
117 void addTriangle(unsigned int p1, unsigned int p2, unsigned int p3);
118
121 void endTriangles();
122
124 void clear();
125
127 Ogre::ManualObject* getManualObject()
128 {
129 return manual_object_;
130 }
131
132private:
133 // true in between calls to beginTriangles() and endTriangles()
134 bool started_;
135 Ogre::ManualObject* manual_object_;
136};
137
138} // namespace rviz_rendering
This class allows constructing Ogre shapes manually, from triangle lists.
void addColor(const Ogre::ColourValue &color)
Add color for a vertex.
void beginTriangles()
Start adding triangles to the mesh.
void addTriangle(unsigned int p1, unsigned int p2, unsigned int p3)
Add a triangle by indexing in the defined vertices.
void addVertex(const Ogre::Vector3 &position)
Add a vertex to the mesh (no normal defined). If using this function only (not using addTriangle()) i...
void clear()
Clear the mesh.
void estimateVertexCount(size_t vcount)
void endTriangles()
Notify that the set of triangles to add is complete. No more triangles can be added,...
void addNormal(const Ogre::Vector3 &normal)
Add normal for a vertex.
Ogre::ManualObject * getManualObject()
Get the manual object created for the mesh.