mesh_shape.h
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 #ifndef OGRE_TOOLS_MESH_SHAPE_H
31 #define OGRE_TOOLS_MESH_SHAPE_H
32 
33 #include "shape.h"
34 
35 namespace Ogre
36 {
37 class ManualObject;
38 }
39 
40 namespace rviz
41 {
68 class MeshShape : public Shape
69 {
70 public:
78  MeshShape(Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node = nullptr);
79  ~MeshShape() override;
80 
81  /* \brief Estimate the number of vertices ahead of time. */
82  void estimateVertexCount(size_t vcount);
83 
85  void beginTriangles();
86 
93  void addVertex(const Ogre::Vector3& position);
94 
101  void addVertex(const Ogre::Vector3& position, const Ogre::Vector3& normal);
102 
109  void
110  addVertex(const Ogre::Vector3& position, const Ogre::Vector3& normal, const Ogre::ColourValue& color);
111 
113  void addNormal(const Ogre::Vector3& normal);
114 
116  void addColor(const Ogre::ColourValue& color);
117 
119  void addTriangle(unsigned int p1, unsigned int p2, unsigned int p3);
120 
123  void endTriangles();
124 
126  void clear();
127 
129  Ogre::ManualObject* getManualObject()
130  {
131  return manual_object_;
132  }
133 
134 private:
135  // true in between calls to beginTriangles() and endTriangles()
136  bool started_;
137  Ogre::ManualObject* manual_object_;
138 };
139 
140 } // namespace rviz
141 
142 #endif
shape.h
rviz::MeshShape::~MeshShape
~MeshShape() override
Definition: mesh_shape.cpp:54
Ogre
Definition: axes_display.h:35
rviz::MeshShape::endTriangles
void endTriangles()
Notify that the set of triangles to add is complete. No more triangles can be added,...
Definition: mesh_shape.cpp:119
rviz::MeshShape::addVertex
void addVertex(const Ogre::Vector3 &position)
Add a vertex to the mesh (no normal defined). If using this function only (not using addTriangle()) i...
Definition: mesh_shape.cpp:81
rviz::MeshShape::getManualObject
Ogre::ManualObject * getManualObject()
Get the manual object created for the mesh.
Definition: mesh_shape.h:129
rviz::MeshShape::started_
bool started_
Definition: mesh_shape.h:136
rviz::MeshShape::clear
void clear()
Clear the mesh.
Definition: mesh_shape.cpp:141
rviz::MeshShape
This class allows constructing Ogre shapes manually, from triangle lists.
Definition: mesh_shape.h:68
rviz
Definition: add_display_dialog.cpp:54
rviz::MeshShape::addTriangle
void addTriangle(unsigned int p1, unsigned int p2, unsigned int p3)
Add a triangle by indexing in the defined vertices.
Definition: mesh_shape.cpp:114
rviz::MeshShape::manual_object_
Ogre::ManualObject * manual_object_
Definition: mesh_shape.h:137
rviz::MeshShape::addNormal
void addNormal(const Ogre::Vector3 &normal)
Add normal for a vertex.
Definition: mesh_shape.cpp:104
rviz::Shape
Definition: shape.h:51
rviz::MeshShape::addColor
void addColor(const Ogre::ColourValue &color)
Add color for a vertex.
Definition: mesh_shape.cpp:109
rviz::MeshShape::MeshShape
MeshShape(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node=nullptr)
Constructor.
Definition: mesh_shape.cpp:45
rviz::MeshShape::estimateVertexCount
void estimateVertexCount(size_t vcount)
Definition: mesh_shape.cpp:60
rviz::MeshShape::beginTriangles
void beginTriangles()
Start adding triangles to the mesh.
Definition: mesh_shape.cpp:66


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09