Gazebo Rendering
API Reference
8.1.0
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
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
32
namespace
gz
33
{
34
namespace
rendering
35
{
36
inline
namespace
GZ_RENDERING_VERSION_NAMESPACE {
37
//
39
enum
GZ_RENDERING_VISIBLE
CameraProjectionType
40
{
42
CPT_PERSPECTIVE
,
44
CPT_ORTHOGRAPHIC
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
160
public
:
virtual
VisualPtr
VisualAt
(
const
gz::math::Vector2i
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
197
public
:
virtual
bool
SaveFrame
(
const
std::string
&_name) = 0;
198
201
public
:
virtual
common::ConnectionPtr
ConnectNewImageFrame
(
202
NewFrameListener _listener) = 0;
203
206
public
:
virtual
RenderWindowPtr
CreateRenderWindow
() = 0;
207
210
public
:
virtual
math::Matrix4d
ProjectionMatrix
()
const
= 0;
211
214
public
:
virtual
math::Matrix4d
ViewMatrix
()
const
= 0;
215
219
public
:
virtual
void
SetProjectionMatrix
(
const
math::Matrix4d
&_matrix)
220
= 0;
221
224
public
:
virtual
CameraProjectionType
ProjectionType
()
const
= 0;
225
234
public
:
virtual
void
SetProjectionType
(
CameraProjectionType
_type) = 0;
235
239
public
:
virtual
math::Vector2i
Project
(
const
math::Vector3d
&_pt)
const
240
= 0;
241
254
public
:
virtual
void
SetTrackTarget
(
const
NodePtr
&_target,
255
const
math::Vector3d
&_offset = math::Vector3d::Zero,
256
const
bool
_worldFrame =
false
) = 0;
257
260
public
:
virtual
NodePtr
TrackTarget
()
const
= 0;
261
266
public
:
virtual
void
SetTrackOffset
(
const
math::Vector3d
&_offset) = 0;
267
271
public
:
virtual
math::Vector3d
TrackOffset
()
const
= 0;
272
276
public
:
virtual
void
SetTrackPGain
(
const
double
_pGain) = 0;
277
280
public
:
virtual
double
TrackPGain
()
const
= 0;
281
293
public
:
virtual
void
SetFollowTarget
(
const
NodePtr
&_target,
294
const
math::Vector3d
&_offset = math::Vector3d::Zero,
295
const
bool
_worldFrame =
false
) = 0;
296
299
public
:
virtual
NodePtr
FollowTarget
()
const
= 0;
300
305
public
:
virtual
void
SetFollowOffset
(
const
math::Vector3d
&_offset) = 0;
306
310
public
:
virtual
math::Vector3d
FollowOffset
()
const
= 0;
311
315
public
:
virtual
void
SetFollowPGain
(
const
double
_pGain) = 0;
316
319
public
:
virtual
double
FollowPGain
()
const
= 0;
320
323
public
:
virtual
void
SetMaterial
(
const
MaterialPtr
&_material) = 0;
324
329
public
:
virtual
unsigned
int
RenderTextureGLId
()
const
= 0;
330
337
public
:
virtual
void
RenderTextureMetalId
(
void
*_textureIdPtr)
const
= 0;
338
343
public
:
virtual
void
PrepareForExternalSampling
() = 0;
344
347
public
:
virtual
void
AddRenderPass
(
const
RenderPassPtr
&_pass) = 0;
348
351
public
:
virtual
void
RemoveRenderPass
(
const
RenderPassPtr
&_pass) = 0;
352
354
public
:
virtual
void
RemoveAllRenderPasses
() = 0;
355
358
public
:
virtual
unsigned
int
RenderPassCount
()
const
= 0;
359
362
public
:
virtual
RenderPassPtr
RenderPassByIndex
(
unsigned
int
_index)
363
const
= 0;
364
367
public
:
virtual
void
SetShadowsDirty
() = 0;
368
};
369
}
370
}
371
}
372
#endif