DynamicLines.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 /* Desc: Dynamic line generator
18  * Author: Nate Koenig
19  * Date: 28 June 2007
20  */
21 
22 #ifndef DYNAMICLINES_HH
23 #define DYNAMICLINES_HH
24 
25 #include <vector>
26 #include <string>
27 
29 #include "gazebo/math/Vector3.hh"
32 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
36  namespace rendering
37  {
40 
44  {
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 math::Vector3 &_pt,
64  const common::Color &_color = common::Color::White);
65 
71  public: void AddPoint(double _x, double _y, double _z,
72  const common::Color &_color = common::Color::White);
73 
77  public: void SetPoint(unsigned int _index, const math::Vector3 &_value);
78 
82  public: void SetColor(unsigned int _index, const common::Color &_color);
83 
87  public: const math::Vector3& GetPoint(unsigned int _index) const;
88 
91  public: unsigned int GetPointCount() const;
92 
94  public: void Clear();
95 
97  public: void Update();
98 
101  private: virtual void CreateVertexDeclaration();
102 
105  private: virtual void FillHardwareBuffers();
106 
108  private: std::vector<math::Vector3> points;
109 
111  private: bool dirty;
112 
114  private: std::vector<common::Color> colors;
115  };
117  }
118 }
119 #endif
Class for drawing lines that can change.
Definition: DynamicLines.hh:43
static const Color White
(1, 1, 1)
Definition: Color.hh:39
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Abstract base class providing mechanisms for dynamically growing hardware buffers.
Definition: DynamicRenderable.hh:35
RenderOpType
Type of render operation for a drawable.
Definition: RenderTypes.hh:197
#define GZ_RENDERING_VISIBLE
Definition: system.hh:241
A strip of connected lines, 1 vertex per line plus 1 start vertex.
Definition: RenderTypes.hh:207
Defines a color.
Definition: Color.hh:36