Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre/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 
39 
40 #include "gz/common/Event.hh"
41 #include "gz/common/Console.hh"
42 
43 
44 namespace Ogre
45 {
46  class Material;
47  class RenderTarget;
48  class Texture;
49  class Viewport;
50 }
51 
52 namespace ignition
53 {
54  namespace rendering
55  {
56  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
57  //
58  // forward declaration
59  class OgreDepthCameraPrivate;
60 
64  class IGNITION_RENDERING_OGRE_VISIBLE OgreDepthCamera :
66  public BaseDepthCamera<OgreSensor>
67  {
69  protected: OgreDepthCamera();
70 
72  public: virtual ~OgreDepthCamera();
73 
75  public: virtual void Init() override;
76 
78  public: virtual void CreateDepthTexture() override;
79 
81  public: virtual void PostRender() override;
82 
85  public: virtual const float *DepthData() const override;
86 
90  public: virtual gz::common::ConnectionPtr ConnectNewDepthFrame(
91  std::function<void(const float *, unsigned int, unsigned int,
92  unsigned int, const std::string &)> _subscriber) override;
93 
97  public: virtual gz::common::ConnectionPtr ConnectNewRgbPointCloud(
98  std::function<void(const float *, unsigned int, unsigned int,
99  unsigned int, const std::string &)> _subscriber) override;
100 
101  // Documentation inherited.
102  public: virtual void PreRender() override;
103 
105  public: virtual void Render() override;
106 
109  public: virtual void SetFarClipPlane(const double _far) override;
110 
113  public: virtual void SetNearClipPlane(const double _near) override;
114 
118  public: double NearClipPlane() const override;
119 
123  public: double FarClipPlane() const override;
124 
125  // Documentation inherited
126  public: virtual void Destroy() override;
127 
132  protected: void UpdateRenderTarget(OgreRenderTexturePtr _target,
133  Ogre::Material *_material,
134  const std::string &_matName);
135 
138  protected: virtual RenderTargetPtr RenderTarget() const override;
139 
144  protected: static double LimitFOV(const double _fov);
145 
147  protected: void CreateCamera();
148 
150  private: void CreatePointCloudTexture();
151 
153  protected: bool newData = false;
154 
155  protected: bool captureData = false;
156 
159 
161  protected: Ogre::Viewport *depthViewport = nullptr;
162 
164  protected: Ogre::Camera *ogreCamera;
165 
169 
170  private: friend class OgreScene;
171  private: friend class OgreRayQuery;
172  };
173  }
174  }
175 }
176 #endif
Definition: gz/rendering/ogre/OgreCamera.hh:27
STL class.
STL class.
Definition: gz/rendering/ogre/OgreScene.hh:39
OgreRenderTexturePtr depthTexture
Pointer to the depth texture.
Definition: gz/rendering/ogre/OgreDepthCamera.hh:158
shared_ptr< OgreRenderTexture > OgreRenderTexturePtr
Definition: gz/rendering/ogre/OgreRenderTypes.hh:91
shared_ptr< RenderTarget > RenderTargetPtr
Shared pointer to RenderTarget.
Definition: gz/rendering/RenderTypes.hh:183
A Ray Query class used for computing ray object intersections.
Definition: gz/rendering/ogre/OgreRayQuery.hh:39
Ogre::Camera * ogreCamera
Pointer to the ogre camera.
Definition: gz/rendering/ogre/OgreDepthCamera.hh:164