Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre/OgreCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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_OGRECAMERA_HH_
18 #define GZ_RENDERING_OGRE_OGRECAMERA_HH_
19 
20 #include <string>
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 OgreSelectionBuffer;
41 
42  class GZ_RENDERING_OGRE_VISIBLE OgreCamera :
43  public virtual BaseCamera<OgreSensor>,
44  public virtual OgreObjectInterface
45  {
46  protected: OgreCamera();
47 
48  public: virtual ~OgreCamera();
49 
50  // Documentation inherited.
51  public: virtual math::Angle HFOV() const override;
52 
53  // Documentation inherited.
54  public: virtual void SetHFOV(const math::Angle &_hfov) override;
55 
56  // Documentation inherited.
57  public: virtual double AspectRatio() const override;
58 
59  // Documentation inherited.
60  public: virtual void SetAspectRatio(const double _ratio) override;
61 
62  // Documentation inherited.
63  public: virtual unsigned int AntiAliasing() const override;
64 
65  // Documentation inherited.
66  public: virtual void SetAntiAliasing(const unsigned int _aa) override;
67 
68  // Documentation inherited.
69  public: virtual void SetFarClipPlane(const double _far) override;
70 
71  // Documentation inherited.
72  public: virtual void SetNearClipPlane(const double _near) override;
73 
74  public: virtual math::Color BackgroundColor() const;
75 
76  public: virtual void SetBackgroundColor(const math::Color &_color);
77 
78  // Documentation inherited.
79  public: virtual void Render() override;
80 
81  // Documentation inherited.
82  public: virtual RenderWindowPtr CreateRenderWindow() override;
83 
84  // Documentation inherited.
85  public: virtual math::Matrix4d ProjectionMatrix() const override;
86 
87  // Documentation inherited.
88  public: virtual void SetProjectionMatrix(
89  const math::Matrix4d &_matrix) override;
90 
91  // Documentation inherited.
92  public: virtual math::Matrix4d ViewMatrix() const override;
93 
94  // Documentation inherited.
95  public: virtual void SetProjectionType(CameraProjectionType _type)
96  override;
97 
98  public: void SetVFOV(double cameraVFOV) const;
99 
102  public: double NearClip() const;
103 
106  public: double FarClip() const;
107 
108  // Documentation inherited
109  public: virtual VisualPtr VisualAt(const gz::math::Vector2i
110  &_mousePos) override;
111 
112  // Documentation Inherited.
113  // \sa Camera::SetMaterial(const MaterialPtr &)
114  public: virtual void SetMaterial(
115  const MaterialPtr &_material) override;
116 
117  // Documentation inherited.
118  public: virtual unsigned int RenderTextureGLId() const override;
119 
120  // Documentation inherited.
121  public: virtual void Destroy() override;
122 
123  // Documentation inherited.
124  public: virtual void SetVisibilityMask(uint32_t _mask) override;
125 
126  // Documentation inherited.
127  public: virtual Ogre::Camera *Camera() const override;
128 
129  // Documentation inherited.
130  // public: virtual uint32_t VisibilityMask() const override;
131 
132  protected: virtual RenderTargetPtr RenderTarget() const override;
133 
134  protected: virtual void Init() override;
135 
136  protected: virtual void SetSelectionBuffer();
137 
140  protected: void SyncOgreCameraAspectRatio();
141 
142  private: void CreateCamera();
143 
144  protected: virtual void CreateRenderTexture();
145 
148  protected: void DestroyRenderTexture();
149 
150  protected: Ogre::Camera *ogreCamera = nullptr;
151 
152  protected: OgreSelectionBuffer *selectionBuffer = nullptr;
153 
155 
157 
158  private: friend class OgreScene;
159  private: friend class OgreRayQuery;
160  };
161  }
162  }
163 }
164 #endif