billboard_line.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_BILLBOARD_LINE_H
31 #define OGRE_TOOLS_BILLBOARD_LINE_H
32 
33 #include "object.h"
34 
35 #include <stdint.h>
36 
37 #include <vector>
39 #include <OgreColourValue.h>
40 #include <OgreMaterial.h>
41 #include <OgreSharedPtr.h>
42 
43 namespace Ogre
44 {
45 class SceneManager;
46 class SceneNode;
47 class Quaternion;
48 class Any;
49 class BillboardChain;
50 } // namespace Ogre
51 
52 namespace rviz
53 {
58 class BillboardLine : public Object
59 {
60 public:
67  BillboardLine(Ogre::SceneManager* manager, Ogre::SceneNode* parent_node = nullptr);
68  ~BillboardLine() override;
69 
70  void clear();
71  void newLine();
72  void addPoint(const Ogre::Vector3& point);
73  void addPoint(const Ogre::Vector3& point, const Ogre::ColourValue& color);
74 
75  void setLineWidth(float width);
76 
77  void setMaxPointsPerLine(uint32_t max);
78  void setNumLines(uint32_t num);
79 
80  // overrides from Object
81  void setOrientation(const Ogre::Quaternion& orientation) override;
82  void setPosition(const Ogre::Vector3& position) override;
83  void setScale(const Ogre::Vector3& scale) override;
84  void setColor(float r, float g, float b, float a) override;
85  const Ogre::Vector3& getPosition() override;
86  const Ogre::Quaternion& getOrientation() override;
87 
92  Ogre::SceneNode* getSceneNode()
93  {
94  return scene_node_;
95  }
96 
100  void setUserData(const Ogre::Any& /*data*/) override
101  {
102  }
103 
104  Ogre::MaterialPtr getMaterial()
105  {
106  return material_;
107  }
108 
109 private:
110  void setupChains();
111  Ogre::BillboardChain* createChain();
112 
113  Ogre::SceneNode* scene_node_;
114 
115  typedef std::vector<Ogre::BillboardChain*> V_Chain;
117  Ogre::MaterialPtr material_;
118 
119  Ogre::ColourValue color_;
120  float width_;
121 
122  uint32_t current_line_;
123 
124  // Ogre 1.4 doesn't have getNumChainElements()
125  typedef std::vector<uint32_t> V_uint32;
127  uint32_t total_elements_;
128 
129  uint32_t num_lines_;
132 
133  uint32_t current_chain_;
135 };
136 
137 } // namespace rviz
138 
139 #endif
rviz::BillboardLine::clear
void clear()
Definition: billboard_line.cpp:105
rviz::BillboardLine::getSceneNode
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
Definition: billboard_line.h:92
rviz::BillboardLine
An object that displays a multi-segment line strip rendered as billboards.
Definition: billboard_line.h:58
rviz::BillboardLine::current_chain_
uint32_t current_chain_
Definition: billboard_line.h:133
rviz::BillboardLine::chains_
V_Chain chains_
Definition: billboard_line.h:116
rviz::BillboardLine::setScale
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
Definition: billboard_line.cpp:266
rviz::BillboardLine::setLineWidth
void setLineWidth(float width)
Definition: billboard_line.cpp:237
Ogre
Definition: axes_display.h:35
rviz::BillboardLine::newLine
void newLine()
Definition: billboard_line.cpp:201
rviz::BillboardLine::V_uint32
std::vector< uint32_t > V_uint32
Definition: billboard_line.h:125
rviz::BillboardLine::setPosition
void setPosition(const Ogre::Vector3 &position) override
Set the position of this object.
Definition: billboard_line.cpp:256
rviz::BillboardLine::elements_in_current_chain_
uint32_t elements_in_current_chain_
Definition: billboard_line.h:134
rviz::BillboardLine::setOrientation
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation of the object.
Definition: billboard_line.cpp:261
rviz::BillboardLine::scene_node_
Ogre::SceneNode * scene_node_
Definition: billboard_line.h:113
rviz::BillboardLine::current_line_
uint32_t current_line_
Definition: billboard_line.h:122
rviz::BillboardLine::setupChains
void setupChains()
Definition: billboard_line.cpp:125
rviz::BillboardLine::total_elements_
uint32_t total_elements_
Definition: billboard_line.h:127
rviz::BillboardLine::setMaxPointsPerLine
void setMaxPointsPerLine(uint32_t max)
Definition: billboard_line.cpp:169
rviz::BillboardLine::getPosition
const Ogre::Vector3 & getPosition() override
Get the local position of this object.
Definition: billboard_line.cpp:301
rviz::BillboardLine::BillboardLine
BillboardLine(Ogre::SceneManager *manager, Ogre::SceneNode *parent_node=nullptr)
Constructor.
Definition: billboard_line.cpp:48
rviz::BillboardLine::color_
Ogre::ColourValue color_
Definition: billboard_line.h:119
rviz::BillboardLine::width_
float width_
Definition: billboard_line.h:120
rviz::BillboardLine::max_points_per_line_
uint32_t max_points_per_line_
Definition: billboard_line.h:130
rviz::BillboardLine::num_lines_
uint32_t num_lines_
Definition: billboard_line.h:129
rviz::BillboardLine::getMaterial
Ogre::MaterialPtr getMaterial()
Definition: billboard_line.h:104
rviz::BillboardLine::lines_per_chain_
uint32_t lines_per_chain_
Definition: billboard_line.h:131
rviz
Definition: add_display_dialog.cpp:54
rviz::BillboardLine::setUserData
void setUserData(const Ogre::Any &) override
We have no objects that we can set user data on.
Definition: billboard_line.h:100
rviz::BillboardLine::material_
Ogre::MaterialPtr material_
Definition: billboard_line.h:117
ogre_vector.h
rviz::BillboardLine::createChain
Ogre::BillboardChain * createChain()
Definition: billboard_line.cpp:91
rviz::BillboardLine::setNumLines
void setNumLines(uint32_t num)
Definition: billboard_line.cpp:187
rviz::BillboardLine::getOrientation
const Ogre::Quaternion & getOrientation() override
Get the local orientation of this object.
Definition: billboard_line.cpp:306
rviz::BillboardLine::V_Chain
std::vector< Ogre::BillboardChain * > V_Chain
Definition: billboard_line.h:115
rviz::BillboardLine::num_elements_
V_uint32 num_elements_
Definition: billboard_line.h:126
rviz::Object
Base class for visible objects, providing a minimal generic interface.
Definition: object.h:47
rviz::BillboardLine::~BillboardLine
~BillboardLine() override
Definition: billboard_line.cpp:77
rviz::BillboardLine::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: billboard_line.cpp:271
object.h
rviz::BillboardLine::addPoint
void addPoint(const Ogre::Vector3 &point)
Definition: billboard_line.cpp:208


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