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_SHAPE_H
31 #define OGRE_TOOLS_SHAPE_H
32 
33 #include "object.h"
34 
35 #include <OgreMaterial.h>
37 #include <OgreSharedPtr.h>
38 
39 namespace Ogre
40 {
41 class SceneManager;
42 class SceneNode;
43 class Any;
44 class Entity;
45 } // namespace Ogre
46 
47 namespace rviz
48 {
51 class Shape : public Object
52 {
53 public:
54  enum Type
55  {
61  };
62 
70  Shape(Type shape_type, Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node = nullptr);
71  ~Shape() override;
72 
74  {
75  return type_;
76  }
77 
85  void setOffset(const Ogre::Vector3& offset);
86 
87  void setColor(float r, float g, float b, float a) override;
88  void setColor(const Ogre::ColourValue& c);
89  void setPosition(const Ogre::Vector3& position) override;
90  void setOrientation(const Ogre::Quaternion& orientation) override;
91  void setScale(const Ogre::Vector3& scale) override;
92  const Ogre::Vector3& getPosition() override;
93  const Ogre::Quaternion& getOrientation() override;
94 
100  Ogre::SceneNode* getRootNode()
101  {
102  return scene_node_;
103  }
104 
108  void setUserData(const Ogre::Any& data) override;
109 
110  Ogre::Entity* getEntity()
111  {
112  return entity_;
113  }
114 
115  Ogre::MaterialPtr getMaterial()
116  {
117  return material_;
118  }
119 
120  static Ogre::Entity*
121  createEntity(const std::string& name, Type shape_type, Ogre::SceneManager* scene_manager);
122 
123 protected:
124  Ogre::SceneNode* scene_node_;
125  Ogre::SceneNode* offset_node_;
126  Ogre::Entity* entity_;
127  Ogre::MaterialPtr material_;
128  std::string material_name_;
129 
131 };
132 
133 } // namespace rviz
134 
135 #endif
rviz::Shape::getRootNode
Ogre::SceneNode * getRootNode()
Get the root scene node (pivot node) for this object.
Definition: shape.h:100
rviz::Shape::Cylinder
@ Cylinder
Definition: shape.h:58
rviz::Shape::offset_node_
Ogre::SceneNode * offset_node_
Definition: shape.h:125
Ogre
Definition: axes_display.h:35
rviz::Shape::setColor
void setColor(float r, float g, float b, float a) override
Set the color of the object. Values are in the range [0, 1].
Definition: shape.cpp:136
rviz::Shape::Shape
Shape(Type shape_type, Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node=nullptr)
Constructor.
Definition: shape.cpp:77
rviz::Shape::material_
Ogre::MaterialPtr material_
Definition: shape.h:127
rviz::Shape::getPosition
const Ogre::Vector3 & getPosition() override
Get the local position of this object.
Definition: shape.cpp:161
rviz::Shape::material_name_
std::string material_name_
Definition: shape.h:128
rviz::Shape::Cone
@ Cone
Definition: shape.h:56
rviz::Shape::Type
Type
Definition: shape.h:54
rviz::Shape::type_
Type type_
Definition: shape.h:130
rviz::Shape::~Shape
~Shape() override
Definition: shape.cpp:108
rviz::Shape::entity_
Ogre::Entity * entity_
Definition: shape.h:126
rviz
Definition: add_display_dialog.cpp:54
rviz::Shape::createEntity
static Ogre::Entity * createEntity(const std::string &name, Type shape_type, Ogre::SceneManager *scene_manager)
Definition: shape.cpp:46
rviz::Shape::setOffset
void setOffset(const Ogre::Vector3 &offset)
Set the offset for this shape.
Definition: shape.cpp:141
ogre_vector.h
rviz::Shape::getEntity
Ogre::Entity * getEntity()
Definition: shape.h:110
rviz::Shape::Sphere
@ Sphere
Definition: shape.h:59
rviz::Shape::setUserData
void setUserData(const Ogre::Any &data) override
Sets user data on all ogre objects we own.
Definition: shape.cpp:171
rviz::Shape::getMaterial
Ogre::MaterialPtr getMaterial()
Definition: shape.h:115
rviz::Shape::Mesh
@ Mesh
Definition: shape.h:60
rviz::Shape
Definition: shape.h:51
rviz::Shape::getOrientation
const Ogre::Quaternion & getOrientation() override
Get the local orientation of this object.
Definition: shape.cpp:166
rviz::Object
Base class for visible objects, providing a minimal generic interface.
Definition: object.h:47
rviz::Shape::getType
Type getType()
Definition: shape.h:73
rviz::Shape::setScale
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
Definition: shape.cpp:156
rviz::Shape::setPosition
void setPosition(const Ogre::Vector3 &position) override
Set the position of this object.
Definition: shape.cpp:146
rviz::Shape::setOrientation
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation of the object.
Definition: shape.cpp:151
rviz::Shape::scene_node_
Ogre::SceneNode * scene_node_
Definition: shape.h:124
object.h
rviz::Shape::Cube
@ Cube
Definition: shape.h:57


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:03