Gazebo Rendering

API Reference

8.2.2
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"
26 #include "gz/rendering/Marker.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 
36 #ifdef _MSC_VER
37  #pragma warning(push)
38  // Suppress dll-interface warning. This should no longer be needed in
39  // gz-rendering9 as visibility changed hidden by default.
40  #pragma warning(disable:4251)
41 #endif
42 
43 namespace Ogre
44 {
45  class MovableObject;
46 }
47 
48 namespace gz
49 {
50  namespace rendering
51  {
52  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
53  //
54  // forward declarations
55  class Ogre2DynamicRenderablePrivate;
56 
57  /* \class Ogre2DynamicRenderable Ogre2DynamicRenderable.hh \
58  * gz/rendering/ogre2/Ogre2DynamicRenderable.hh
59  */
62  class GZ_RENDERING_OGRE2_VISIBLE Ogre2DynamicRenderable
63  {
66  public: explicit Ogre2DynamicRenderable(ScenePtr _scene);
67 
69  public: virtual ~Ogre2DynamicRenderable();
70 
73  public: void SetOperationType(MarkerType _opType);
74 
77  public: MarkerType OperationType() const;
78 
80  public: void Update();
81 
83  public: Ogre::MovableObject *OgreObject() const;
84 
88  public: void AddPoint(const gz::math::Vector3d &_pt,
89  const gz::math::Color &_color = gz::math::Color::White);
90 
96  public: void AddPoint(const double _x, const double _y, const double _z,
97  const gz::math::Color &_color = gz::math::Color::White);
98 
102  public: void SetPoint(unsigned int _index,
103  const gz::math::Vector3d &_value);
104 
108  public: void SetColor(unsigned int _index,
109  const gz::math::Color &_color);
110 
117  public: gz::math::Vector3d Point(unsigned int _index) const;
118 
121  public: unsigned int PointCount() const;
122 
124  public: void Clear();
125 
127  public: void Destroy();
128 
132  public: void SetMaterial(MaterialPtr _material, bool _unique = true);
133 
135  private: void CreateDynamicMesh();
136 
138  private: void UpdateBuffer();
139 
144  private: void GenerateNormals(Ogre::OperationType _opType,
145  const std::vector<math::Vector3d> &_vertices, float *_vbuffer);
146 
152  private: void GenerateColors(Ogre::OperationType _opType,
153  const std::vector<math::Vector3d> &_vertices, float *_vbuffer);
154 
156  private: void DestroyBuffer();
157 
160  };
161  }
162  }
163 }
164 
165 #ifdef _MSC_VER
166  #pragma warning(pop)
167 #endif
168 
169 #endif