Gazebo Rendering

API Reference

9.0.0
Ogre2DynamicRenderable.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 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 GZ_RENDERING_OGRE2_OGRE2DYNAMICRENDERABLE_HH_
18#define GZ_RENDERING_OGRE2_OGRE2DYNAMICRENDERABLE_HH_
19
20#include <memory>
21#include <string>
22#include <vector>
23
24#include "gz/rendering/ogre2/Export.hh"
27
28#ifdef _MSC_VER
29 #pragma warning(push, 0)
30#endif
31#include <OgreHlmsPso.h>
32#ifdef _MSC_VER
33 #pragma warning(pop)
34#endif
35
36namespace Ogre
37{
38 class MovableObject;
39}
40
41namespace gz
42{
43 namespace rendering
44 {
45 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
46 //
47 // forward declarations
48 class Ogre2DynamicRenderablePrivate;
49
50 /* \class Ogre2DynamicRenderable Ogre2DynamicRenderable.hh \
51 * gz/rendering/ogre2/Ogre2DynamicRenderable.hh
52 */
55 class GZ_RENDERING_OGRE2_VISIBLE Ogre2DynamicRenderable
56 {
59 public: explicit Ogre2DynamicRenderable(ScenePtr _scene);
60
62 public: virtual ~Ogre2DynamicRenderable();
63
66 public: void SetOperationType(MarkerType _opType);
67
70 public: MarkerType OperationType() const;
71
73 public: void Update();
74
76 public: Ogre::MovableObject *OgreObject() const;
77
81 public: void AddPoint(const gz::math::Vector3d &_pt,
83
89 public: void AddPoint(const double _x, const double _y, const double _z,
91
95 public: void SetPoint(unsigned int _index,
96 const gz::math::Vector3d &_value);
97
101 public: void SetColor(unsigned int _index,
102 const gz::math::Color &_color);
103
110 public: gz::math::Vector3d Point(unsigned int _index) const;
111
114 public: unsigned int PointCount() const;
115
117 public: void Clear();
118
120 public: void Destroy();
121
125 public: void SetMaterial(MaterialPtr _material, bool _unique = true);
126
128 private: void CreateDynamicMesh();
129
131 private: void UpdateBuffer();
132
137 private: void GenerateNormals(Ogre::OperationType _opType,
138 const std::vector<math::Vector3d> &_vertices, float *_vbuffer);
139
145 private: void GenerateColors(Ogre::OperationType _opType,
146 const std::vector<math::Vector3d> &_vertices, float *_vbuffer);
147
149 private: void DestroyBuffer();
150
153 };
154 }
155 }
156}
157#endif