Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre2/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 
98  protected: void DestroyRenderTexture();
99 
100  // Documentation inherited.
101  public: virtual math::Matrix4d ProjectionMatrix() const override;
102 
103  // Documentation inherited.
104  public: virtual void SetProjectionMatrix(
105  const math::Matrix4d &_matrix) override;
106 
107  // Documentation inherited.
108  public: virtual math::Matrix4d ViewMatrix() const override;
109 
110  // Documentation inherited.
111  public: virtual void SetProjectionType(CameraProjectionType _type)
112  override;
113 
114  // Documentation inherited
115  public: virtual VisualPtr VisualAt(const gz::math::Vector2i
116  &_mousePos) override;
117 
118  // Documentation Inherited.
119  // \sa Camera::SetMaterial(const MaterialPtr &)
120  public: virtual void SetMaterial(
121  const MaterialPtr &_material) override;
122 
123  // Documentation inherited.
124  public: virtual unsigned int RenderTextureGLId() const override;
125 
126  // Documentation inherited.
127  public: virtual void RenderTextureMetalId(void *_textureIdPtr)
128  const override;
129 
130  // Documentation inherited.
131  public: void SetShadowsDirty() override;
132 
133  // Documentation inherited.
134  public: virtual void Destroy() override;
135 
136  // Documentation inherited.
137  public: virtual void SetVisibilityMask(uint32_t _mask) override;
138 
141  public: Ogre2SelectionBuffer *SelectionBuffer() const;
142 
143  // Documentation inherited.
144  public: virtual Ogre::Camera *OgreCamera() const override;
145 
146  // Documentation inherited.
147  protected: virtual RenderTargetPtr RenderTarget() const override;
148 
149  // Documentation inherited.
150  protected: virtual void Init() override;
151 
153  protected: virtual void CreateRenderTexture();
154 
157  protected: virtual void SetSelectionBuffer();
158 
161  protected: void SyncOgreCameraAspectRatio();
162 
164  private: void CreateCamera();
165 
171  private: void SetShadowsNodeDefDirty();
172 
174  protected: Ogre::Camera *ogreCamera = nullptr;
175 
177  protected: Ogre2SelectionBuffer *selectionBuffer = nullptr;
178 
181 
184 
186  private: std::unique_ptr<Ogre2CameraPrivate> dataPtr;
187 
189  private: friend class Ogre2Scene;
190 
193  private: friend class Ogre2RayQuery;
194  };
195  }
196  }
197 }
198 #endif