Ignition Rendering

API Reference

4.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 IGNITION_RENDERING_OGRE2_OGRE2DEPTHCAMERA_HH_
19 #define IGNITION_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 "ignition/common/Event.hh"
36 
37 namespace Ogre
38 {
39  class Material;
40  class RenderTarget;
41  class Texture;
42  class Viewport;
43 }
44 
45 namespace ignition
46 {
47  namespace rendering
48  {
49  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
50  //
51  // Forward declaration
52  class Ogre2DepthCameraPrivate;
53 
55  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2DepthCamera :
56  public BaseDepthCamera<Ogre2Sensor>
57  {
59  protected: Ogre2DepthCamera();
60 
62  public: virtual ~Ogre2DepthCamera();
63 
65  public: virtual void Init() override;
66 
67  // Documentation inherited
68  public: virtual void Destroy() override;
69 
71  public: virtual void CreateRenderTexture();
72 
75  public: virtual void CreateDepthTexture() override;
76 
77  // Documentation inherited
78  public: virtual void PreRender() override;
79 
81  public: virtual void PostRender() override;
82 
85  public: virtual const float *DepthData() const override;
86 
90  public: virtual ignition::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 ignition::common::ConnectionPtr ConnectNewRgbPointCloud(
98  std::function<void(const float *, unsigned int, unsigned int,
99  unsigned int, const std::string &)> _subscriber) override;
100 
102  public: virtual void Render() override;
103 
106  public: virtual void SetFarClipPlane(const double _far) override;
107 
110  public: virtual void SetNearClipPlane(const double _near) override;
111 
115  public: double NearClipPlane() const override;
116 
120  public: double FarClipPlane() const override;
121 
122  // Documentation inherited.
123  public: void AddRenderPass(const RenderPassPtr &_pass) override;
124 
127  protected: virtual RenderTargetPtr RenderTarget() const override;
128 
133  protected: static double LimitFOV(const double _fov);
134 
136  protected: void CreateCamera();
137 
139  protected: Ogre::Camera *ogreCamera;
140 
144 
145  private: friend class Ogre2Scene;
146  };
147  }
148  }
149 }
150 #endif
Depth camera used to render depth data into an image buffer.
Definition: Ogre2DepthCamera.hh:55
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:45
STL class.
Represents a render-target to which cameras can render images.
Definition: RenderTarget.hh:37
Definition: BaseCamera.hh:40
Definition: OgreCamera.hh:27
Ogre::Camera * ogreCamera
Pointer to the ogre camera.
Definition: Ogre2DepthCamera.hh:139