Ignition Rendering

API Reference

6.3.1
Camera.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 IGNITION_RENDERING_CAMERA_HH_
18 #define IGNITION_RENDERING_CAMERA_HH_
19 
20 #include <string>
21 
22 #include <ignition/common/Event.hh>
23 #include <ignition/math/Matrix4.hh>
24 
25 #include "ignition/rendering/config.hh"
30 
31 
32 namespace ignition
33 {
34  namespace rendering
35  {
36  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
37  //
39  enum IGNITION_RENDERING_VISIBLE CameraProjectionType
40  {
45  };
46 
49  class IGNITION_RENDERING_VISIBLE Camera :
50  public virtual Sensor
51  {
53  public: typedef std::function<void(const void*, unsigned int,
54  unsigned int, unsigned int, const std::string&)> NewFrameListener;
55 
57  public: virtual ~Camera() { }
58 
61  public: virtual unsigned int ImageWidth() const = 0;
62 
65  public: virtual void SetImageWidth(unsigned int _width) = 0;
66 
69  public: virtual unsigned int ImageHeight() const = 0;
70 
73  public: virtual void SetImageHeight(unsigned int _height) = 0;
74 
78  public: virtual PixelFormat ImageFormat() const = 0;
79 
82  public: virtual void SetImageFormat(PixelFormat _format) = 0;
83 
86  public: virtual unsigned int ImageMemorySize() const = 0;
87 
90  public: virtual math::Angle HFOV() const = 0;
91 
94  public: virtual void SetHFOV(const math::Angle &_hfov) = 0;
95 
98  public: virtual double AspectRatio() const = 0;
99 
104  public: virtual void SetAspectRatio(const double _ratio) = 0;
105 
106  // TODO(anyone): add auto-aspect ratio
107 
110  public: virtual unsigned int AntiAliasing() const = 0;
111 
117  public: virtual void SetAntiAliasing(const unsigned int _aa) = 0;
118 
121  public: virtual double FarClipPlane() const = 0;
122 
125  public: virtual void SetFarClipPlane(const double _far) = 0;
126 
129  public: virtual double NearClipPlane() const = 0;
130 
133  public: virtual void SetNearClipPlane(const double _near) = 0;
134 
138  public: virtual void Render() = 0;
139 
144  public: virtual void PostRender() = 0;
145 
148  // \return visual for that position, null if no visual was found
149  public: virtual VisualPtr VisualAt(const ignition::math::Vector2i
150  &_mousePos) = 0;
151 
157  public: virtual void Update() = 0;
158 
164  public: virtual Image CreateImage() const = 0;
165 
172  public: virtual void Capture(Image &_image) = 0;
173 
179  public: virtual void Copy(Image &_image) const = 0;
180 
186  public: virtual bool SaveFrame(const std::string &_name) = 0;
187 
190  public: virtual common::ConnectionPtr ConnectNewImageFrame(
191  NewFrameListener _listener) = 0;
192 
195  public: virtual RenderWindowPtr CreateRenderWindow() = 0;
196 
199  public: virtual math::Matrix4d ProjectionMatrix() const = 0;
200 
203  public: virtual math::Matrix4d ViewMatrix() const = 0;
204 
208  public: virtual void SetProjectionMatrix(const math::Matrix4d &_matrix)
209  = 0;
210 
213  public: virtual CameraProjectionType ProjectionType() const = 0;
214 
223  public: virtual void SetProjectionType(CameraProjectionType _type) = 0;
224 
228  public: virtual math::Vector2i Project(const math::Vector3d &_pt) const
229  = 0;
230 
243  public: virtual void SetTrackTarget(const NodePtr &_target,
244  const math::Vector3d &_offset = math::Vector3d::Zero,
245  const bool _worldFrame = false) = 0;
246 
249  public: virtual NodePtr TrackTarget() const = 0;
250 
255  public: virtual void SetTrackOffset(const math::Vector3d &_offset) = 0;
256 
260  public: virtual math::Vector3d TrackOffset() const = 0;
261 
265  public: virtual void SetTrackPGain(const double _pGain) = 0;
266 
269  public: virtual double TrackPGain() const = 0;
270 
282  public: virtual void SetFollowTarget(const NodePtr &_target,
283  const math::Vector3d &_offset = math::Vector3d::Zero,
284  const bool _worldFrame = false) = 0;
285 
288  public: virtual NodePtr FollowTarget() const = 0;
289 
294  public: virtual void SetFollowOffset(const math::Vector3d &_offset) = 0;
295 
299  public: virtual math::Vector3d FollowOffset() const = 0;
300 
304  public: virtual void SetFollowPGain(const double _pGain) = 0;
305 
308  public: virtual double FollowPGain() const = 0;
309 
312  public: virtual void SetMaterial(const MaterialPtr &_material) = 0;
313 
318  public: virtual unsigned int RenderTextureGLId() const = 0;
319 
322  public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
323 
326  public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
327 
330  public: virtual unsigned int RenderPassCount() const = 0;
331 
334  public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
335  const = 0;
336 
339  public: virtual void SetShadowsDirty() = 0;
340  };
341  }
342  }
343 }
344 #endif
Represents a scene sensor. The most obvious example is a camera, but it can be anything that generate...
Definition: Sensor.hh:32
CameraProjectionType
Enum for projection types.
Definition: Camera.hh:39
Perspective projection.
Definition: Camera.hh:42
STL class.
Encapsulates a raw image buffer and relevant properties.
Definition: Image.hh:36
Orthographic projection.
Definition: Camera.hh:44
std::function< void(const void *, unsigned int, unsigned int, unsigned int, const std::string &)> NewFrameListener
Callback function for new frame render event listeners.
Definition: Camera.hh:54
PixelFormat
Image pixel format types.
Definition: PixelFormat.hh:32
virtual ~Camera()
Destructor.
Definition: Camera.hh:57
Posable camera used for rendering the scene graph.
Definition: Camera.hh:49
static const Vector3 Zero