Gazebo Rendering

API Reference

6.6.4
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 
26 
27 namespace Ogre
28 {
29  class Camera;
30 }
31 
32 namespace ignition
33 {
34  namespace rendering
35  {
36  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
37  //
38  // forward declaration
39  class Ogre2CameraPrivate;
40  class Ogre2SelectionBuffer;
41 
43  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2Camera :
44  public BaseCamera<Ogre2Sensor>
45  {
47  protected: Ogre2Camera();
48 
50  public: virtual ~Ogre2Camera();
51 
52  // Documentation inherited.
53  public: virtual math::Angle HFOV() const override;
54 
55  // Documentation inherited.
56  public: virtual void SetHFOV(const math::Angle &_hfov) override;
57 
58  // Documentation inherited.
59  public: virtual double AspectRatio() const override;
60 
61  // Documentation inherited.
62  public: virtual void SetAspectRatio(const double _ratio) override;
63 
64  // Documentation inherited.
65  public: virtual unsigned int AntiAliasing() const override;
66 
67  // Documentation inherited.
68  public: virtual void SetAntiAliasing(const unsigned int _aa) override;
69 
70  // Documentation inherited.
71  public: virtual void SetFarClipPlane(const double _far) override;
72 
73  // Documentation inherited.
74  public: virtual void SetNearClipPlane(const double _near) override;
75 
76  public: virtual math::Color BackgroundColor() const;
77 
78  public: virtual void SetBackgroundColor(const math::Color &_color);
79 
82  public: virtual MaterialPtr BackgroundMaterial() const;
83 
86  public: virtual void SetBackgroundMaterial(MaterialPtr _material);
87 
88  // Documentation inherited.
89  public: virtual void Render() override;
90 
91  // Documentation inherited.
92  public: virtual RenderWindowPtr CreateRenderWindow() override;
93 
94  // Documentation inherited.
95  public: virtual math::Matrix4d ProjectionMatrix() const override;
96 
97  // Documentation inherited.
98  public: virtual void SetProjectionMatrix(
99  const math::Matrix4d &_matrix) override;
100 
101  // Documentation inherited.
102  public: virtual math::Matrix4d ViewMatrix() const override;
103 
104  // Documentation inherited.
105  public: virtual void SetProjectionType(CameraProjectionType _type)
106  override;
107 
108  // Documentation inherited
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: void SetShadowsDirty() override;
122 
123  // Documentation inherited.
124  public: virtual void Destroy() override;
125 
126  public: Ogre::Camera *OgreCamera() const;
127 
128  // Documentation inherited.
129  public: virtual void SetVisibilityMask(uint32_t _mask) override;
130 
134 
135  // Documentation inherited.
136  protected: virtual RenderTargetPtr RenderTarget() const override;
137 
138  // Documentation inherited.
139  protected: virtual void Init() override;
140 
142  protected: virtual void CreateRenderTexture();
143 
146  protected: void DestroyRenderTexture();
147 
150  protected: virtual void SetSelectionBuffer();
151 
153  private: void CreateCamera();
154 
160  private: void SetShadowsNodeDefDirty();
161 
163  protected: Ogre::Camera *ogreCamera = nullptr;
164 
166  protected: Ogre2SelectionBuffer *selectionBuffer = nullptr;
167 
170 
173 
175  private: std::unique_ptr<Ogre2CameraPrivate> dataPtr;
176 
178  private: friend class Ogre2Scene;
179 
182  private: friend class Ogre2RayQuery;
183  };
184  }
185  }
186 }
187 #endif
Definition: gz/rendering/base/BaseCamera.hh:47
Ogre2.x implementation of the camera class.
Definition: gz/rendering/ogre2/Ogre2Camera.hh:45
virtual unsigned int AntiAliasing() const override
Get the level of anti-aliasing used during rendering.
Ogre2SelectionBuffer * SelectionBuffer() const
Get the selection buffer object.
Ogre2RenderTargetPtr renderTexture
Pointer to render texture.
Definition: gz/rendering/ogre2/Ogre2Camera.hh:169
virtual void SetVisibilityMask(uint32_t _mask) override
Set visibility mask.
void DestroyRenderTexture()
Destroy render texture created by CreateRenderTexture() Note: It's not virtual.
virtual void SetBackgroundColor(const math::Color &_color)
virtual RenderTargetPtr RenderTarget() const override
Ogre::Camera * OgreCamera() const
virtual RenderWindowPtr CreateRenderWindow() override
Create a render window.
virtual math::Angle HFOV() const override
Get the camera's horizontal field-of-view.
virtual double AspectRatio() const override
Get the camera's aspect ratio.
virtual void SetFarClipPlane(const double _far) override
Set the camera's far clipping plane distance.
virtual void SetBackgroundMaterial(MaterialPtr _material)
Set the background material of this camera.
virtual void SetSelectionBuffer()
Create and set selection buffer object TODO(anyone) to be implemented.
virtual math::Color BackgroundColor() const
virtual math::Matrix4d ViewMatrix() const override
Get the view matrix for this camera.
virtual ~Ogre2Camera()
Destructor.
virtual void Destroy() override
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
virtual unsigned int RenderTextureGLId() const override
Get the OpenGL texture id associated with the render texture used by this camera. A valid id is retur...
math::Color backgroundColor
Color of background.
Definition: gz/rendering/ogre2/Ogre2Camera.hh:172
virtual void SetMaterial(const MaterialPtr &_material) override
Set a material that the camera should see on all objects.
virtual void SetAspectRatio(const double _ratio) override
Set the camera's aspect ratio. This value determines the cameras vertical field-of-view....
virtual void SetProjectionType(CameraProjectionType _type) override
Set the projection type for this camera This changes the projection matrix of the camera based on the...
virtual MaterialPtr BackgroundMaterial() const
Get the background material of this camera.
virtual VisualPtr VisualAt(const ignition::math::Vector2i &_mousePos) override
virtual void SetHFOV(const math::Angle &_hfov) override
Set the camera's horizontal field-of-view.
virtual void SetProjectionMatrix(const math::Matrix4d &_matrix) override
Set the projection matrix for this camera. This overrides the standard projection matrix computed bas...
virtual void Init() override
virtual void SetAntiAliasing(const unsigned int _aa) override
Set the level of anti-aliasing used during rendering. If a value of 0 is given, no anti-aliasing will...
virtual void SetNearClipPlane(const double _near) override
Set the camera's near clipping plane distance.
virtual void Render() override
Renders the current scene using this camera. This function assumes PreRender() has already been calle...
virtual void CreateRenderTexture()
Create a render texture for the camera for offscreen rendering.
virtual math::Matrix4d ProjectionMatrix() const override
Get the projection matrix for this camera.
A Ray Query class used for computing ray object intersections.
Definition: gz/rendering/ogre2/Ogre2RayQuery.hh:40
Ogre2.x implementation of the scene class.
Definition: gz/rendering/ogre2/Ogre2Scene.hh:59
Generates a selection buffer object for a given camera. The selection buffer is used of entity select...
Definition: gz/rendering/ogre2/Ogre2SelectionBuffer.hh:48
Definition: gz/rendering/ogre/OgreCamera.hh:28
CameraProjectionType
Enum for projection types.
Definition: gz/rendering/Camera.hh:40