Gazebo Rendering

API Reference

10.1.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 GZ_RENDERING_CAMERA_HH_
18#define GZ_RENDERING_CAMERA_HH_
19
20#include <string>
21
22#include <gz/common/Event.hh>
23#include <gz/math/Matrix4.hh>
24
25#include "gz/rendering/config.hh"
26#include "gz/rendering/Image.hh"
30#include "gz/rendering/Scene.hh"
31
32namespace gz
33{
34 namespace rendering
35 {
36 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
37 //
39 enum GZ_RENDERING_VISIBLE CameraProjectionType
40 {
45 };
46
49 class GZ_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
83 public: virtual void SetImageFormat(PixelFormat _format,
84 bool _reinterpretable = false) = 0;
85
88 public: virtual unsigned int ImageMemorySize() const = 0;
89
92 public: virtual math::Angle HFOV() const = 0;
93
96 public: virtual void SetHFOV(const math::Angle &_hfov) = 0;
97
105 public: virtual double AspectRatio() const = 0;
106
115 public: virtual void SetAspectRatio(const double _ratio) = 0;
116
117 // TODO(anyone): add auto-aspect ratio
118
121 public: virtual unsigned int AntiAliasing() const = 0;
122
128 public: virtual void SetAntiAliasing(const unsigned int _aa) = 0;
129
132 public: virtual double FarClipPlane() const = 0;
133
136 public: virtual void SetFarClipPlane(const double _far) = 0;
137
140 public: virtual double NearClipPlane() const = 0;
141
144 public: virtual void SetNearClipPlane(const double _near) = 0;
145
149 public: virtual void Render() = 0;
150
155 public: virtual void PostRender() = 0;
156
159 // \return visual for that position, null if no visual was found
161 &_mousePos) = 0;
162
168 public: virtual void Update() = 0;
169
175 public: virtual Image CreateImage() const = 0;
176
183 public: virtual void Capture(Image &_image) = 0;
184
190 public: virtual void Copy(Image &_image) const = 0;
191
202 public: bool CopyTo(const PixelBuffer &_buffer) const;
203
209 public: virtual bool SaveFrame(const std::string &_name) = 0;
210
214 NewFrameListener _listener) = 0;
215
218 public: virtual RenderWindowPtr CreateRenderWindow() = 0;
219
222 public: virtual math::Matrix4d ProjectionMatrix() const = 0;
223
226 public: virtual math::Matrix4d ViewMatrix() const = 0;
227
231 public: virtual void SetProjectionMatrix(const math::Matrix4d &_matrix)
232 = 0;
233
236 public: virtual CameraProjectionType ProjectionType() const = 0;
237
246 public: virtual void SetProjectionType(CameraProjectionType _type) = 0;
247
251 public: virtual math::Vector2i Project(const math::Vector3d &_pt) const
252 = 0;
253
266 public: virtual void SetTrackTarget(const NodePtr &_target,
267 const math::Vector3d &_offset = math::Vector3d::Zero,
268 const bool _worldFrame = false) = 0;
269
272 public: virtual NodePtr TrackTarget() const = 0;
273
278 public: virtual void SetTrackOffset(const math::Vector3d &_offset) = 0;
279
283 public: virtual math::Vector3d TrackOffset() const = 0;
284
288 public: virtual void SetTrackPGain(const double _pGain) = 0;
289
292 public: virtual double TrackPGain() const = 0;
293
305 public: virtual void SetFollowTarget(const NodePtr &_target,
306 const math::Vector3d &_offset = math::Vector3d::Zero,
307 const bool _worldFrame = false) = 0;
308
311 public: virtual NodePtr FollowTarget() const = 0;
312
317 public: virtual void SetFollowOffset(const math::Vector3d &_offset) = 0;
318
322 public: virtual math::Vector3d FollowOffset() const = 0;
323
327 public: virtual void SetFollowPGain(const double _pGain) = 0;
328
331 public: virtual double FollowPGain() const = 0;
332
335 public: virtual void SetMaterial(const MaterialPtr &_material) = 0;
336
341 public: virtual unsigned int RenderTextureGLId() const = 0;
342
349 public: virtual void RenderTextureMetalId(void *_textureIdPtr) const = 0;
350
355 public: virtual void PrepareForExternalSampling() = 0;
356
359 public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
360
363 public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
364
366 public: virtual void RemoveAllRenderPasses() = 0;
367
370 public: virtual unsigned int RenderPassCount() const = 0;
371
374 public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
375 const = 0;
376
379 public: virtual void SetShadowsDirty() = 0;
380 };
381 }
382 }
383}
384
385#endif