Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre2/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 
33 
34 #include "gz/common/Event.hh"
35 #include "gz/common/Console.hh"
36 
37 namespace Ogre
38 {
39  class Material;
40  class RenderTarget;
41  class Texture;
42  class Viewport;
43 }
44 
45 namespace gz
46 {
47  namespace rendering
48  {
49  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
50  //
51  // Forward declaration
52  class Ogre2DepthCameraPrivate;
53 
55  class GZ_RENDERING_OGRE2_VISIBLE Ogre2DepthCamera :
56  public virtual BaseDepthCamera<Ogre2Sensor>,
57  public virtual Ogre2ObjectInterface
58  {
60  protected: Ogre2DepthCamera();
61 
63  public: virtual ~Ogre2DepthCamera();
64 
66  public: virtual void Init() override;
67 
68  // Documentation inherited
69  public: virtual void Destroy() override;
70 
72  public: virtual void CreateRenderTexture();
73 
76  public: virtual void CreateDepthTexture() override;
77 
80  private: void CreateWorkspaceInstance();
81 
82  // Documentation inherited
83  public: virtual void PreRender() override;
84 
86  public: virtual void PostRender() override;
87 
90  public: virtual const float *DepthData() const override;
91 
95  public: virtual gz::common::ConnectionPtr ConnectNewDepthFrame(
96  std::function<void(const float *, unsigned int, unsigned int,
97  unsigned int, const std::string &)> _subscriber) override;
98 
102  public: virtual gz::common::ConnectionPtr ConnectNewRgbPointCloud(
103  std::function<void(const float *, unsigned int, unsigned int,
104  unsigned int, const std::string &)> _subscriber) override;
105 
107  public: virtual void Render() override;
108 
111  public: virtual void SetFarClipPlane(const double _far) override;
112 
115  public: virtual void SetNearClipPlane(const double _near) override;
116 
120  public: double NearClipPlane() const override;
121 
125  public: double FarClipPlane() const override;
126 
127  // Documentation inherited.
128  public: void SetShadowsDirty() override;
129 
130  // Documentation inherited.
131  public: void AddRenderPass(const RenderPassPtr &_pass) override;
132 
133  // Documentation inherited.
134  public: virtual Ogre::Camera *OgreCamera() const override;
135 
138  protected: virtual RenderTargetPtr RenderTarget() const override;
139 
144  protected: static double LimitFOV(const double _fov);
145 
147  protected: void CreateCamera();
148 
154  private: void SetShadowsNodeDefDirty();
155 
157  protected: Ogre::Camera *ogreCamera;
158 
162 
164  private: friend class Ogre2Scene;
165  };
166  }
167  }
168 }
169 #endif