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>
38 #include <OgreVector3.h>
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;
116  V_Chain chains_;
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;
126  V_uint32 num_elements_;
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
Ogre::MaterialPtr material_
uint32_t elements_in_current_chain_
Ogre::ColourValue color_
An object that displays a multi-segment line strip rendered as billboards.
std::vector< uint32_t > V_uint32
Ogre::MaterialPtr getMaterial()
std::vector< Ogre::BillboardChain * > V_Chain
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
Base class for visible objects, providing a minimal generic interface.
Definition: object.h:50
void setUserData(const Ogre::Any &) override
We have no objects that we can set user data on.
uint32_t max_points_per_line_
r
double max(double a, double b)
Ogre::SceneNode * scene_node_


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