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
Ogre::ManualObject * getManualObject()
Get the manual object created for the mesh.
Definition: mesh_shape.h:129
Ogre::ManualObject * manual_object_
Definition: mesh_shape.h:137
This class allows constructing Ogre shapes manually, from triangle lists.
Definition: mesh_shape.h:68


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat May 27 2023 02:06:24