Gazebo Rendering

API Reference

9.0.0~pre2
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
84 // Documentation inherited.
85 public: virtual math::Matrix4d ProjectionMatrix() const override;
86
87 // Documentation inherited.
88 public: virtual void SetProjectionMatrix(
89 const math::Matrix4d &_matrix) override;
90
91 // Documentation inherited
92 public: virtual void PreRender() override;
93
95 public: virtual void PostRender() override;
96
99 public: virtual const float *DepthData() const override;
100
105 std::function<void(const float *, unsigned int, unsigned int,
106 unsigned int, const std::string &)> _subscriber) override;
107
112 std::function<void(const float *, unsigned int, unsigned int,
113 unsigned int, const std::string &)> _subscriber) override;
114
116 public: virtual void Render() override;
117
120 public: virtual void SetFarClipPlane(const double _far) override;
121
124 public: virtual void SetNearClipPlane(const double _near) override;
125
129 public: double NearClipPlane() const override;
130
134 public: double FarClipPlane() const override;
135
136 // Documentation inherited.
137 public: void SetShadowsDirty() override;
138
139 // Documentation inherited.
140 public: void AddRenderPass(const RenderPassPtr &_pass) override;
141
142 // Documentation inherited.
143 public: virtual Ogre::Camera *OgreCamera() const override;
144
147 protected: virtual RenderTargetPtr RenderTarget() const override;
148
153 protected: static double LimitFOV(const double _fov);
154
156 protected: void CreateCamera();
157
163 private: void SetShadowsNodeDefDirty();
164
166 protected: Ogre::Camera *ogreCamera;
167
171
173 private: friend class Ogre2Scene;
174 };
175 }
176 }
177}
178#endif