Gazebo Rendering
API Reference
8.2.1
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-rendering
include
gz
rendering
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
"
27
#include "
gz/rendering/PixelFormat.hh
"
28
#include "
gz/rendering/Sensor.hh
"
29
#include "
gz/rendering/Scene.hh
"
30
31
// overloaded-virtuals warnings appeared on Ubuntu Noble
32
// GCC-13. it is not easy to fix them without breaking ABI
33
// ignore them to preserve current ABI.
34
#if defined(__GNUC__) || defined(__clang__)
35
# pragma GCC diagnostic push
36
# pragma GCC diagnostic ignored "-Woverloaded-virtual"
37
#endif
38
39
namespace
gz
40
{
41
namespace
rendering
42
{
43
inline
namespace
GZ_RENDERING_VERSION_NAMESPACE {
44
//
46
enum
GZ_RENDERING_VISIBLE
CameraProjectionType
47
{
49
CPT_PERSPECTIVE
,
51
CPT_ORTHOGRAPHIC
52
};
53
56
class
GZ_RENDERING_VISIBLE
Camera
:
57
public
virtual
Sensor
58
{
60
public
:
typedef
std::function
<void(
const
void
*,
unsigned
int
,
61
unsigned
int
,
unsigned
int
,
const
std::string
&)>
NewFrameListener
;
62
64
public
:
virtual
~Camera
();
65
68
public
:
virtual
unsigned
int
ImageWidth
()
const
= 0;
69
72
public
:
virtual
void
SetImageWidth
(
unsigned
int
_width) = 0;
73
76
public
:
virtual
unsigned
int
ImageHeight
()
const
= 0;
77
80
public
:
virtual
void
SetImageHeight
(
unsigned
int
_height) = 0;
81
85
public
:
virtual
PixelFormat
ImageFormat
()
const
= 0;
86
90
public
:
virtual
void
SetImageFormat
(
PixelFormat
_format,
91
bool
_reinterpretable =
false
) = 0;
92
95
public
:
virtual
unsigned
int
ImageMemorySize
()
const
= 0;
96
99
public
:
virtual
math::Angle
HFOV
()
const
= 0;
100
103
public
:
virtual
void
SetHFOV
(
const
math::Angle
&_hfov) = 0;
104
112
public
:
virtual
double
AspectRatio
()
const
= 0;
113
122
public
:
virtual
void
SetAspectRatio
(
const
double
_ratio) = 0;
123
124
// TODO(anyone): add auto-aspect ratio
125
128
public
:
virtual
unsigned
int
AntiAliasing
()
const
= 0;
129
135
public
:
virtual
void
SetAntiAliasing
(
const
unsigned
int
_aa) = 0;
136
139
public
:
virtual
double
FarClipPlane
()
const
= 0;
140
143
public
:
virtual
void
SetFarClipPlane
(
const
double
_far) = 0;
144
147
public
:
virtual
double
NearClipPlane
()
const
= 0;
148
151
public
:
virtual
void
SetNearClipPlane
(
const
double
_near) = 0;
152
156
public
:
virtual
void
Render
() = 0;
157
162
public
:
virtual
void
PostRender
() = 0;
163
166
// \return visual for that position, null if no visual was found
167
public
:
virtual
VisualPtr
VisualAt
(
const
gz::math::Vector2i
168
&_mousePos) = 0;
169
175
public
:
virtual
void
Update
() = 0;
176
182
public
:
virtual
Image
CreateImage
()
const
= 0;
183
190
public
:
virtual
void
Capture
(
Image
&_image) = 0;
191
197
public
:
virtual
void
Copy
(
Image
&_image)
const
= 0;
198
204
public
:
virtual
bool
SaveFrame
(
const
std::string
&_name) = 0;
205
208
public
:
virtual
common::ConnectionPtr
ConnectNewImageFrame
(
209
NewFrameListener
_listener) = 0;
210
213
public
:
virtual
RenderWindowPtr
CreateRenderWindow
() = 0;
214
217
public
:
virtual
math::Matrix4d
ProjectionMatrix
()
const
= 0;
218
221
public
:
virtual
math::Matrix4d
ViewMatrix
()
const
= 0;
222
226
public
:
virtual
void
SetProjectionMatrix
(
const
math::Matrix4d
&_matrix)
227
= 0;
228
231
public
:
virtual
CameraProjectionType
ProjectionType
()
const
= 0;
232
241
public
:
virtual
void
SetProjectionType
(
CameraProjectionType
_type) = 0;
242
246
public
:
virtual
math::Vector2i
Project
(
const
math::Vector3d
&_pt)
const
247
= 0;
248
261
public
:
virtual
void
SetTrackTarget
(
const
NodePtr
&_target,
262
const
math::Vector3d
&_offset =
math::Vector3d::Zero
,
263
const
bool
_worldFrame =
false
) = 0;
264
267
public
:
virtual
NodePtr
TrackTarget
()
const
= 0;
268
273
public
:
virtual
void
SetTrackOffset
(
const
math::Vector3d
&_offset) = 0;
274
278
public
:
virtual
math::Vector3d
TrackOffset
()
const
= 0;
279
283
public
:
virtual
void
SetTrackPGain
(
const
double
_pGain) = 0;
284
287
public
:
virtual
double
TrackPGain
()
const
= 0;
288
300
public
:
virtual
void
SetFollowTarget
(
const
NodePtr
&_target,
301
const
math::Vector3d
&_offset =
math::Vector3d::Zero
,
302
const
bool
_worldFrame =
false
) = 0;
303
306
public
:
virtual
NodePtr
FollowTarget
()
const
= 0;
307
312
public
:
virtual
void
SetFollowOffset
(
const
math::Vector3d
&_offset) = 0;
313
317
public
:
virtual
math::Vector3d
FollowOffset
()
const
= 0;
318
322
public
:
virtual
void
SetFollowPGain
(
const
double
_pGain) = 0;
323
326
public
:
virtual
double
FollowPGain
()
const
= 0;
327
330
public
:
virtual
void
SetMaterial
(
const
MaterialPtr
&_material) = 0;
331
336
public
:
virtual
unsigned
int
RenderTextureGLId
()
const
= 0;
337
344
public
:
virtual
void
RenderTextureMetalId
(
void
*_textureIdPtr)
const
= 0;
345
350
public
:
virtual
void
PrepareForExternalSampling
() = 0;
351
354
public
:
virtual
void
AddRenderPass
(
const
RenderPassPtr
&_pass) = 0;
355
358
public
:
virtual
void
RemoveRenderPass
(
const
RenderPassPtr
&_pass) = 0;
359
361
public
:
virtual
void
RemoveAllRenderPasses
() = 0;
362
365
public
:
virtual
unsigned
int
RenderPassCount
()
const
= 0;
366
369
public
:
virtual
RenderPassPtr
RenderPassByIndex
(
unsigned
int
_index)
370
const
= 0;
371
374
public
:
virtual
void
SetShadowsDirty
() = 0;
375
};
376
}
377
}
378
}
379
380
#if defined(__GNUC__) || defined(__clang__)
381
# pragma GCC diagnostic pop
382
#endif
383
384
#endif