Gazebo Rendering

API Reference

9.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 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"
29#include "gz/rendering/Scene.hh"
30
31namespace gz
32{
33 namespace rendering
34 {
35 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
36 //
38 enum GZ_RENDERING_VISIBLE CameraProjectionType
39 {
44 };
45
48 class GZ_RENDERING_VISIBLE Camera :
49 public virtual Sensor
50 {
52 public: typedef std::function<void(const void*, unsigned int,
53 unsigned int, unsigned int, const std::string&)> NewFrameListener;
54
56 public: virtual ~Camera();
57
60 public: virtual unsigned int ImageWidth() const = 0;
61
64 public: virtual void SetImageWidth(unsigned int _width) = 0;
65
68 public: virtual unsigned int ImageHeight() const = 0;
69
72 public: virtual void SetImageHeight(unsigned int _height) = 0;
73
77 public: virtual PixelFormat ImageFormat() const = 0;
78
82 public: virtual void SetImageFormat(PixelFormat _format,
83 bool _reinterpretable = false) = 0;
84
87 public: virtual unsigned int ImageMemorySize() const = 0;
88
91 public: virtual math::Angle HFOV() const = 0;
92
95 public: virtual void SetHFOV(const math::Angle &_hfov) = 0;
96
104 public: virtual double AspectRatio() const = 0;
105
114 public: virtual void SetAspectRatio(const double _ratio) = 0;
115
116 // TODO(anyone): add auto-aspect ratio
117
120 public: virtual unsigned int AntiAliasing() const = 0;
121
127 public: virtual void SetAntiAliasing(const unsigned int _aa) = 0;
128
131 public: virtual double FarClipPlane() const = 0;
132
135 public: virtual void SetFarClipPlane(const double _far) = 0;
136
139 public: virtual double NearClipPlane() const = 0;
140
143 public: virtual void SetNearClipPlane(const double _near) = 0;
144
148 public: virtual void Render() = 0;
149
154 public: virtual void PostRender() = 0;
155
158 // \return visual for that position, null if no visual was found
160 &_mousePos) = 0;
161
167 public: virtual void Update() = 0;
168
174 public: virtual Image CreateImage() const = 0;
175
182 public: virtual void Capture(Image &_image) = 0;
183
189 public: virtual void Copy(Image &_image) const = 0;
190
196 public: virtual bool SaveFrame(const std::string &_name) = 0;
197
201 NewFrameListener _listener) = 0;
202
205 public: virtual RenderWindowPtr CreateRenderWindow() = 0;
206
209 public: virtual math::Matrix4d ProjectionMatrix() const = 0;
210
213 public: virtual math::Matrix4d ViewMatrix() const = 0;
214
218 public: virtual void SetProjectionMatrix(const math::Matrix4d &_matrix)
219 = 0;
220
223 public: virtual CameraProjectionType ProjectionType() const = 0;
224
233 public: virtual void SetProjectionType(CameraProjectionType _type) = 0;
234
238 public: virtual math::Vector2i Project(const math::Vector3d &_pt) const
239 = 0;
240
253 public: virtual void SetTrackTarget(const NodePtr &_target,
254 const math::Vector3d &_offset = math::Vector3d::Zero,
255 const bool _worldFrame = false) = 0;
256
259 public: virtual NodePtr TrackTarget() const = 0;
260
265 public: virtual void SetTrackOffset(const math::Vector3d &_offset) = 0;
266
270 public: virtual math::Vector3d TrackOffset() const = 0;
271
275 public: virtual void SetTrackPGain(const double _pGain) = 0;
276
279 public: virtual double TrackPGain() const = 0;
280
292 public: virtual void SetFollowTarget(const NodePtr &_target,
293 const math::Vector3d &_offset = math::Vector3d::Zero,
294 const bool _worldFrame = false) = 0;
295
298 public: virtual NodePtr FollowTarget() const = 0;
299
304 public: virtual void SetFollowOffset(const math::Vector3d &_offset) = 0;
305
309 public: virtual math::Vector3d FollowOffset() const = 0;
310
314 public: virtual void SetFollowPGain(const double _pGain) = 0;
315
318 public: virtual double FollowPGain() const = 0;
319
322 public: virtual void SetMaterial(const MaterialPtr &_material) = 0;
323
328 public: virtual unsigned int RenderTextureGLId() const = 0;
329
336 public: virtual void RenderTextureMetalId(void *_textureIdPtr) const = 0;
337
342 public: virtual void PrepareForExternalSampling() = 0;
343
346 public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
347
350 public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
351
353 public: virtual void RemoveAllRenderPasses() = 0;
354
357 public: virtual unsigned int RenderPassCount() const = 0;
358
361 public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
362 const = 0;
363
366 public: virtual void SetShadowsDirty() = 0;
367 };
368 }
369 }
370}
371
372#endif