DynamicLines.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GAZEBO_RENDERING_DYNAMICLINES_HH
18#define GAZEBO_RENDERING_DYNAMICLINES_HH
19
20#include <memory>
21#include <vector>
22#include <string>
23#include <ignition/math/Color.hh>
24
28#include "gazebo/util/system.hh"
29
30namespace gazebo
31{
32 namespace rendering
33 {
36
38 class DynamicLinesPrivate;
39
42 class GZ_RENDERING_VISIBLE DynamicLines : public DynamicRenderable
43 {
46 public: explicit DynamicLines(
48
50 public: virtual ~DynamicLines();
51
54 public: static std::string GetMovableType();
55
58 public: virtual const Ogre::String &getMovableType() const;
59
63 public: void AddPoint(const ignition::math::Vector3d &_pt,
64 const ignition::math::Color &_color = ignition::math::Color::White);
65
71 public: void AddPoint(const double _x, const double _y, const double _z,
72 const ignition::math::Color &_color = ignition::math::Color::White);
73
77 public: void SetPoint(const unsigned int _index,
78 const ignition::math::Vector3d &_value);
79
84 public: void SetColor(const unsigned int _index,
85 const ignition::math::Color &_color);
86
93 public: ignition::math::Vector3d Point(const unsigned int _index) const;
94
97 public: unsigned int GetPointCount() const;
98
100 public: void Clear();
101
103 public: void Update();
104
107 private: virtual void CreateVertexDeclaration();
108
111 private: virtual void FillHardwareBuffers();
112
114 private: std::vector<ignition::math::Vector3d> points;
115
117 private: bool dirty;
118
120 private: std::unique_ptr<DynamicLinesPrivate> dataPtr;
121 };
122
123 }
124}
125#endif
unsigned int GetPointCount() const
Return the total number of points in the point list.
void AddPoint(const ignition::math::Vector3d &_pt, const ignition::math::Color &_color=ignition::math::Color::White)
Add a point to the point list.
virtual const Ogre::String & getMovableType() const
Overridden function from Ogre's base class.
void SetColor(const unsigned int _index, const ignition::math::Color &_color)
Change the color of an existing point in the point list.
ignition::math::Vector3d Point(const unsigned int _index) const
Return the location of an existing point in the point list.
void AddPoint(const double _x, const double _y, const double _z, const ignition::math::Color &_color=ignition::math::Color::White)
Add a point to the point list.
DynamicLines(RenderOpType _opType=RENDERING_LINE_STRIP)
Constructor.
static std::string GetMovableType()
Get type of movable.
void Clear()
Remove all points from the point list.
virtual ~DynamicLines()
Destructor.
void SetPoint(const unsigned int _index, const ignition::math::Vector3d &_value)
Change the location of an existing point in the point list.
void Update()
Call this to update the hardware buffer after making changes.
virtual void CreateVertexDeclaration()=0
Creates the vertex declaration.
virtual void FillHardwareBuffers()=0
Fills the hardware vertex and index buffers with data.
Rendering namespace.
Definition JointMaker.hh:58
RenderOpType
Type of render operation for a drawable.
Definition RenderTypes.hh:217
@ RENDERING_LINE_STRIP
A strip of connected lines, 1 vertex per line plus 1 start vertex.
Definition RenderTypes.hh:226
Forward declarations for the common classes.
Definition Animation.hh:27