Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre/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 
63  public: virtual void PostRender() override;
64 
65  // Documentation inherited
66  public: virtual void Destroy() override;
67 
70  public: unsigned int EnvTextureSize() const;
71 
74  public: void SetEnvTextureSize(int _size);
75 
80  public: bool SetBackgroundColor(const math::Color &_color);
81 
86  public: math::Vector3d Project3d(const math::Vector3d &_pt) const
87  override;
88 
92  public: std::vector<Ogre::Camera *> OgreEnvCameras() const;
93 
99  public: void SetUniformVariables(Ogre::Pass *_pass,
100  float _ratio, float _hfov);
101 
102  // Documentation inherited.
103  public: virtual void PreRender() override;
104 
106  public: virtual void Render() override;
107 
108  // Documentation inherited
109  public: common::ConnectionPtr ConnectNewWideAngleFrame(
110  std::function<void(const unsigned char *, unsigned int, unsigned int,
111  unsigned int, const std::string &)> _subscriber) override;
112 
113  // Documentation inherited.
114  public: virtual void SetVisibilityMask(uint32_t _mask) override;
115 
117  protected: void CreateWideAngleTexture() override;
118 
120  protected: void CreateCamera();
121 
123  protected: void CreateEnvCameras();
124 
129  protected: void notifyMaterialRender(Ogre::uint32 _pass_id,
130  Ogre::MaterialPtr &_material) override;
131 
134  protected: virtual RenderTargetPtr RenderTarget() const override;
135 
136  private: friend class OgreScene;
137 
140  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
142  };
143  }
144  }
145 }
146 #endif