Gazebo Rendering

API Reference

8.2.0
OgreWideAngleCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 #ifndef GZ_RENDERING_OGRE_WIDEANGLECAMERA_HH_
18 #define GZ_RENDERING_OGRE_WIDEANGLECAMERA_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <gz/utils/ImplPtr.hh>
25 
31 
32 namespace Ogre
33 {
34  class Material;
35  class RenderTarget;
36  class Viewport;
37 }
38 
39 namespace gz
40 {
41  namespace rendering
42  {
43  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
44  //
46  class GZ_RENDERING_OGRE_VISIBLE OgreWideAngleCamera :
47  public BaseWideAngleCamera<OgreSensor>,
48  protected Ogre::CompositorInstance::Listener
49  {
51  protected: OgreWideAngleCamera();
52 
54  public: virtual ~OgreWideAngleCamera();
55 
56  // Documentation inherited
57  public: virtual void Init() override;
58 
60  public: virtual void CreateRenderTexture();
61 
64  protected: void DestroyRenderTexture();
65 
67  public: virtual void PostRender() override;
68 
69  // Documentation inherited
70  public: virtual void Destroy() override;
71 
72  // Documentation inherited
73  public: void AddRenderPass(const RenderPassPtr &_pass) override;
74 
75  // Documentation inherited
76  public: void RemoveRenderPass(const RenderPassPtr &_pass) override;
77 
78  // Documentation inherited
79  public: void RemoveAllRenderPasses() override;
80 
82  protected: void UpdateRenderPassChain();
83 
86  public: unsigned int EnvTextureSize() const;
87 
90  public: void SetEnvTextureSize(int _size);
91 
96  public: bool SetBackgroundColor(const math::Color &_color);
97 
102  public: math::Vector3d Project3d(const math::Vector3d &_pt) const
103  override;
104 
109 
115  public: void SetUniformVariables(Ogre::Pass *_pass,
116  float _ratio, float _hfov);
117 
118  // Documentation inherited.
119  public: virtual void PreRender() override;
120 
122  public: virtual void Render() override;
123 
124  // Documentation inherited.
125  public: void Copy(Image &_image) const override;
126 
127  // Documentation inherited
129  std::function<void(const unsigned char *, unsigned int, unsigned int,
130  unsigned int, const std::string &)> _subscriber) override;
131 
132  // Documentation inherited.
133  public: virtual void SetVisibilityMask(uint32_t _mask) override;
134 
136  protected: void CreateWideAngleTexture() override;
137 
139  protected: void CreateCamera();
140 
142  protected: void CreateEnvCameras();
143 
148  protected: void notifyMaterialRender(Ogre::uint32 _pass_id,
149  Ogre::MaterialPtr &_material) override;
150 
153  protected: virtual RenderTargetPtr RenderTarget() const override;
154 
155  private: friend class OgreScene;
156 
159  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
161  };
162  }
163  }
164 }
165 #endif