Gazebo Rendering

API Reference

8.2.1
Ogre2Camera.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 #ifndef GZ_RENDERING_OGRE2_OGRE2CAMERA_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2CAMERA_HH_
19 
20 #include <memory>
21 
27 
28 namespace Ogre
29 {
30  class Camera;
31 }
32 
33 namespace gz
34 {
35  namespace rendering
36  {
37  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
38  //
39  // forward declaration
40  class Ogre2CameraPrivate;
41  class Ogre2SelectionBuffer;
42 
44  class GZ_RENDERING_OGRE2_VISIBLE Ogre2Camera :
45  public virtual BaseCamera<Ogre2Sensor>,
46  public virtual Ogre2ObjectInterface
47  {
49  protected: Ogre2Camera();
50 
52  public: virtual ~Ogre2Camera();
53 
54  // Documentation inherited.
55  public: virtual math::Angle HFOV() const override;
56 
57  // Documentation inherited.
58  public: virtual void SetHFOV(const math::Angle &_hfov) override;
59 
60  // Documentation inherited.
61  public: virtual double AspectRatio() const override;
62 
63  // Documentation inherited.
64  public: virtual void SetAspectRatio(const double _ratio) override;
65 
66  // Documentation inherited.
67  public: virtual unsigned int AntiAliasing() const override;
68 
69  // Documentation inherited.
70  public: virtual void SetAntiAliasing(const unsigned int _aa) override;
71 
72  // Documentation inherited.
73  public: virtual void SetFarClipPlane(const double _far) override;
74 
75  // Documentation inherited.
76  public: virtual void SetNearClipPlane(const double _near) override;
77 
78  public: virtual math::Color BackgroundColor() const;
79 
80  public: virtual void SetBackgroundColor(const math::Color &_color);
81 
84  public: virtual MaterialPtr BackgroundMaterial() const;
85 
88  public: virtual void SetBackgroundMaterial(MaterialPtr _material);
89 
90  // Documentation inherited.
91  public: virtual void Render() override;
92 
93  // Documentation inherited.
94  public: virtual RenderWindowPtr CreateRenderWindow() override;
95 
96  // Documentation inherited.
97  public: virtual math::Matrix4d ProjectionMatrix() const override;
98 
99  // Documentation inherited.
100  public: virtual void SetProjectionMatrix(
101  const math::Matrix4d &_matrix) override;
102 
103  // Documentation inherited.
104  public: virtual math::Matrix4d ViewMatrix() const override;
105 
106  // Documentation inherited.
107  public: virtual void SetProjectionType(CameraProjectionType _type)
108  override;
109 
110  // Documentation inherited
111  public: virtual VisualPtr VisualAt(const gz::math::Vector2i
112  &_mousePos) override;
113 
114  // Documentation Inherited.
115  // \sa Camera::SetMaterial(const MaterialPtr &)
116  public: virtual void SetMaterial(
117  const MaterialPtr &_material) override;
118 
119  // Documentation inherited.
120  public: virtual unsigned int RenderTextureGLId() const override;
121 
122  // Documentation inherited.
123  public: virtual void RenderTextureMetalId(void *_textureIdPtr)
124  const override;
125 
126  // Documentation inherited.
127  public: virtual void PrepareForExternalSampling() override;
128 
129  // Documentation inherited.
130  public: void SetShadowsDirty() override;
131 
132  // Documentation inherited.
133  public: virtual void Destroy() override;
134 
135  // Documentation inherited.
136  public: virtual void SetVisibilityMask(uint32_t _mask) override;
137 
141 
142  // Documentation inherited.
143  public: virtual Ogre::Camera *OgreCamera() const override;
144 
145  // Documentation inherited.
146  protected: virtual RenderTargetPtr RenderTarget() const override;
147 
148  // Documentation inherited.
149  protected: virtual void Init() override;
150 
152  protected: virtual void CreateRenderTexture();
153 
156  protected: void DestroyRenderTexture();
157 
160  protected: virtual void SetSelectionBuffer();
161 
164  protected: void SyncOgreCameraAspectRatio();
165 
167  private: void CreateCamera();
168 
174  private: void SetShadowsNodeDefDirty();
175 
177  protected: Ogre::Camera *ogreCamera = nullptr;
178 
180  protected: Ogre2SelectionBuffer *selectionBuffer = nullptr;
181 
184 
187 
189  private: std::unique_ptr<Ogre2CameraPrivate> dataPtr;
190 
192  private: friend class Ogre2Scene;
193 
196  private: friend class Ogre2RayQuery;
197 
200  private: friend class Ogre2NativeWindow;
201  };
202  }
203  }
204 }
205 #endif