Ignition Rendering

API Reference

4.0.0
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  //
40  class IGNITION_RENDERING_VISIBLE Camera :
41  public virtual Sensor
42  {
44  public: typedef std::function<void(const void*, unsigned int,
45  unsigned int, unsigned int, const std::string&)> NewFrameListener;
46 
48  public: virtual ~Camera() { }
49 
52  public: virtual unsigned int ImageWidth() const = 0;
53 
56  public: virtual void SetImageWidth(unsigned int _width) = 0;
57 
60  public: virtual unsigned int ImageHeight() const = 0;
61 
64  public: virtual void SetImageHeight(unsigned int _height) = 0;
65 
69  public: virtual PixelFormat ImageFormat() const = 0;
70 
73  public: virtual void SetImageFormat(PixelFormat _format) = 0;
74 
77  public: virtual unsigned int ImageMemorySize() const = 0;
78 
81  public: virtual math::Angle HFOV() const = 0;
82 
85  public: virtual void SetHFOV(const math::Angle &_angle) = 0;
86 
89  public: virtual double AspectRatio() const = 0;
90 
95  public: virtual void SetAspectRatio(const double _ratio) = 0;
96 
97  // TODO(anyone): add auto-aspect ratio
98 
101  public: virtual unsigned int AntiAliasing() const = 0;
102 
108  public: virtual void SetAntiAliasing(const unsigned int _aa) = 0;
109 
112  public: virtual double FarClipPlane() const = 0;
113 
116  public: virtual void SetFarClipPlane(const double _far) = 0;
117 
120  public: virtual double NearClipPlane() const = 0;
121 
124  public: virtual void SetNearClipPlane(const double _near) = 0;
125 
129  public: virtual void Render() = 0;
130 
135  public: virtual void PostRender() = 0;
136 
139  // \return visual for that position, null if no visual was found
140  public: virtual VisualPtr VisualAt(const ignition::math::Vector2i
141  &_mousePos) = 0;
142 
148  public: virtual void Update() = 0;
149 
155  public: virtual Image CreateImage() const = 0;
156 
163  public: virtual void Capture(Image &_image) = 0;
164 
170  public: virtual void Copy(Image &_image) const = 0;
171 
177  public: virtual bool SaveFrame(const std::string &_name) = 0;
178 
181  public: virtual common::ConnectionPtr ConnectNewImageFrame(
182  NewFrameListener _listener) = 0;
183 
186  public: virtual RenderWindowPtr CreateRenderWindow() = 0;
187 
190  public: virtual math::Matrix4d ProjectionMatrix() const = 0;
191 
194  public: virtual math::Matrix4d ViewMatrix() const = 0;
195 
208  public: virtual void SetTrackTarget(const NodePtr &_target,
209  const math::Vector3d &_offset = math::Vector3d::Zero,
210  const bool _worldFrame = false) = 0;
211 
214  public: virtual NodePtr TrackTarget() const = 0;
215 
220  public: virtual void SetTrackOffset(const math::Vector3d &_offset) = 0;
221 
225  public: virtual math::Vector3d TrackOffset() const = 0;
226 
230  public: virtual void SetTrackPGain(const double _pGain) = 0;
231 
234  public: virtual double TrackPGain() const = 0;
235 
247  public: virtual void SetFollowTarget(const NodePtr &_target,
248  const math::Vector3d &_offset = math::Vector3d::Zero,
249  const bool _worldFrame = false) = 0;
250 
253  public: virtual NodePtr FollowTarget() const = 0;
254 
259  public: virtual void SetFollowOffset(const math::Vector3d &_offset) = 0;
260 
264  public: virtual math::Vector3d FollowOffset() const = 0;
265 
269  public: virtual void SetFollowPGain(const double _pGain) = 0;
270 
273  public: virtual double FollowPGain() const = 0;
274 
277  public: virtual void SetMaterial(const MaterialPtr &_material) = 0;
278 
283  public: virtual unsigned int RenderTextureGLId() const = 0;
284 
287  public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
288 
291  public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
292 
295  public: virtual unsigned int RenderPassCount() const = 0;
296 
299  public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
300  const = 0;
301  };
302  }
303  }
304 }
305 #endif
Represents a scene sensor. The most obvious example is a camera, but it can be anything that generate...
Definition: Sensor.hh:32
STL class.
Encapsulates a raw image buffer and relevant properties.
Definition: Image.hh:36
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:45
PixelFormat
Image pixel format types.
Definition: PixelFormat.hh:32
virtual ~Camera()
Deconstructor.
Definition: Camera.hh:48
Posable camera used for rendering the scene graph.
Definition: Camera.hh:40
static const Vector3 Zero