Gazebo Rendering

API Reference

9.0.0~pre2
OgreDepthCamera.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 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
18#ifndef GZ_RENDERING_OGRE_OGREDEPTHCAMERA_HH_
19#define GZ_RENDERING_OGRE_OGREDEPTHCAMERA_HH_
20
21#ifdef _WIN32
22 // Ensure that Winsock2.h is included before Windows.h, which can get
23 // pulled in by anybody (e.g., Boost).
24 #include <Winsock2.h>
25#endif
26
27#include <memory>
28#include <string>
29
30#include <gz/math/Matrix4.hh>
31
42
43#include "gz/common/Event.hh"
44#include "gz/common/Console.hh"
45
46
47namespace Ogre
48{
49 class Material;
50 class RenderTarget;
51 class Texture;
52 class Viewport;
53}
54
55namespace gz
56{
57 namespace rendering
58 {
59 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
60 //
61 // forward declaration
62 class OgreDepthCameraPrivate;
63
68 class GZ_RENDERING_OGRE_VISIBLE OgreDepthCamera :
69 public virtual BaseDepthCamera<OgreSensor>,
70 public virtual OgreObjectInterface
71 {
73 protected: OgreDepthCamera();
74
76 public: virtual ~OgreDepthCamera();
77
79 public: virtual void Init() override;
80
82 public: virtual void CreateDepthTexture() override;
83
86 protected: void DestroyDepthTexture();
87
88 // Documentation inherited.
89 public: virtual math::Matrix4d ProjectionMatrix() const override;
90
91 // Documentation inherited.
92 public: virtual void SetProjectionMatrix(
93 const math::Matrix4d &_matrix) override;
94
96 public: virtual void PostRender() override;
97
100 public: virtual const float *DepthData() const override;
101
106 std::function<void(const float *, unsigned int, unsigned int,
107 unsigned int, const std::string &)> _subscriber) override;
108
113 std::function<void(const float *, unsigned int, unsigned int,
114 unsigned int, const std::string &)> _subscriber) override;
115
116 // Documentation inherited.
117 public: virtual void PreRender() override;
118
120 public: virtual void Render() override;
121
124 public: virtual void SetFarClipPlane(const double _far) override;
125
128 public: virtual void SetNearClipPlane(const double _near) override;
129
133 public: double NearClipPlane() const override;
134
138 public: double FarClipPlane() const override;
139
140 // Documentation inherited
141 public: virtual void Destroy() override;
142
143 // Documentation inherited.
144 public: virtual Ogre::Camera *Camera() const override;
145
151 Ogre::Material *_material,
152 const std::string &_matName);
153
156 protected: virtual RenderTargetPtr RenderTarget() const override;
157
162 protected: static double LimitFOV(const double _fov);
163
165 protected: void CreateCamera();
166
168 private: void CreatePointCloudTexture();
169
172 protected: void DestroyPointCloudTexture();
173
175 protected: bool newData = false;
176
177 protected: bool captureData = false;
178
181
183 protected: Ogre::Viewport *depthViewport = nullptr;
184
186 protected: Ogre::Camera *ogreCamera;
187
191
192 private: friend class OgreScene;
193 private: friend class OgreRayQuery;
194 };
195 }
196 }
197}
198#endif