Gazebo Rendering

API Reference

9.0.0
Ogre2WideAngleCamera.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 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_OGRE2_WIDEANGLECAMERA_HH_
18#define GZ_RENDERING_OGRE2_WIDEANGLECAMERA_HH_
19
20#include <memory>
21#include <string>
22
23#include <gz/utils/ImplPtr.hh>
24
26#include "gz/rendering/ogre2/Export.hh"
29
30namespace gz
31{
32 namespace rendering
33 {
34 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
35 //
37 class GZ_RENDERING_OGRE2_VISIBLE Ogre2WideAngleCamera :
38 public BaseWideAngleCamera<Ogre2Sensor>
39 {
42
44 public: virtual ~Ogre2WideAngleCamera() override;
45
46 // Documentation inherited
47 public: virtual void Init() override;
48
50 public: virtual void CreateRenderTexture();
51
54 protected: void DestroyRenderTexture();
55
57 public: virtual void PostRender() override;
58
59 // Documentation inherited
60 public: virtual void Destroy() override;
61
64 public: void DestroyTextures();
65
66 // Documentation inherited
67 public: void AddRenderPass(const RenderPassPtr &_pass) override;
68
69 // Documentation inherited
70 public: void RemoveRenderPass(const RenderPassPtr &_pass) override;
71
72 // Documentation inherited
73 public: void RemoveAllRenderPasses() override;
74
77 public: uint32_t EnvTextureSize() const;
78
81 public: void SetEnvTextureSize(uint32_t _size);
82
87 public: math::Vector3d Project3d(const math::Vector3d &_pt) const
88 override;
89
96 public: Ogre::Ray CameraToViewportRay(const math::Vector2d &_screenPos,
97 uint32_t _faceIdx);
98
99 // Documentation inherited.
100 public: virtual void PreRender() override;
101
103 public: virtual void Render() override;
104
105 // Documentation inherited.
106 public: void Copy(Image &_image) const override;
107
108 // Documentation inherited
110 std::function<void(const unsigned char *, unsigned int, unsigned int,
111 unsigned int, const std::string &)> _subscriber) override;
112
115 public: void SetBackgroundMaterial(MaterialPtr _material);
116
120
125
129
131 protected: void CreateStitchWorkspace();
132
134 protected: void DestroyStitchWorkspace();
135
139 protected: bool HasTempStitchTexture() const;
140
144 protected: bool NeedsTempStitchTexture() const;
145
150 protected: uint32_t TempStitchTextureChannel() const;
151
155 protected: std::string WorkspaceDefinitionName(uint32_t _faceIdx) const;
156
159 protected: void CreateWorkspaceDefinition(bool _withMsaa);
160
163 protected: void CreateFacesWorkspaces(bool _withMsaa);
164
166 protected: void DestroyFacesWorkspaces();
167
170 protected: void UpdateRenderPasses();
171
173 protected: void CreateWideAngleTexture() override;
174
176 protected: void CreateCamera();
177
180 protected: virtual RenderTargetPtr RenderTarget() const override;
181
186 protected: void SetupMSAA(Ogre::CompositorManager2 *_ogreCompMgr,
187 uint8_t _msaa);
188
190 private: void UpdateBackgroundMaterial();
191
198 private: void RetrieveCubePassSceneDefs(
199 Ogre::CompositorManager2 *_ogreCompMgr, bool _withMsaa);
200
203 private: void PrepareForCubemapFacePass(Ogre::CompositorPass *_pass);
204
207 private: void PrepareForFinalPass(Ogre::Pass *_pass);
208
211 GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
213
214 private: friend class Ogre2Scene;
215 private: friend class Ogre2WideAngleCameraWorkspaceListenerPrivate;
216 };
217 }
218 }
219}
220#endif