Gazebo Rendering

API Reference

10.1.0
Ogre2DepthCamera.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_OGRE2_OGRE2DEPTHCAMERA_HH_
19#define GZ_RENDERING_OGRE2_OGRE2DEPTHCAMERA_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
35
36#include "gz/common/Event.hh"
37#include "gz/common/Console.hh"
38
39namespace Ogre
40{
41 class Material;
42 class RenderTarget;
43 class Texture;
44 class Viewport;
45}
46
47namespace gz
48{
49 namespace rendering
50 {
51 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
52 //
53 // Forward declaration
54 class Ogre2DepthCameraPrivate;
55
57 class GZ_RENDERING_OGRE2_VISIBLE Ogre2DepthCamera :
58 public virtual BaseDepthCamera<Ogre2Sensor>,
59 public virtual Ogre2ObjectInterface
60 {
62 protected: Ogre2DepthCamera();
63
65 public: virtual ~Ogre2DepthCamera();
66
68 public: virtual void Init() override;
69
70 // Documentation inherited
71 public: virtual void Destroy() override;
72
74 public: virtual void CreateRenderTexture();
75
78 public: virtual void CreateDepthTexture() override;
79
82 private: void CreateWorkspaceInstance();
83
90 public: virtual math::Matrix4d ProjectionMatrix() const override;
91
100 public: virtual void SetProjectionMatrix(
101 const math::Matrix4d &_matrix) override;
102
103 // Documentation inherited
104 public: virtual void PreRender() override;
105
107 public: virtual void PostRender() override;
108
111 public: virtual const float *DepthData() const override;
112
117 std::function<void(const float *, unsigned int, unsigned int,
118 unsigned int, const std::string &)> _subscriber) override;
119
124 std::function<void(const float *, unsigned int, unsigned int,
125 unsigned int, const std::string &)> _subscriber) override;
126
128 public: virtual void Render() override;
129
132 public: virtual void SetFarClipPlane(const double _far) override;
133
136 public: virtual void SetNearClipPlane(const double _near) override;
137
141 public: double NearClipPlane() const override;
142
146 public: double FarClipPlane() const override;
147
148 // Documentation inherited.
149 public: void SetShadowsDirty() override;
150
151 // Documentation inherited.
152 public: void AddRenderPass(const RenderPassPtr &_pass) override;
153
154 // Documentation inherited.
155 public: virtual Ogre::Camera *OgreCamera() const override;
156
159 protected: virtual RenderTargetPtr RenderTarget() const override;
160
165 protected: static double LimitFOV(const double _fov);
166
168 protected: void CreateCamera();
169
175 private: void SetShadowsNodeDefDirty();
176
178 protected: Ogre::Camera *ogreCamera;
179
183
185 private: friend class Ogre2Scene;
186 };
187 }
188 }
189}
190#endif