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
base
BaseParticleEmitter.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 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
18
#ifndef GZ_RENDERING_BASE_BASEPARTICLEEMITTER_HH_
19
#define GZ_RENDERING_BASE_BASEPARTICLEEMITTER_HH_
20
21
#include <string>
22
#include "
gz/rendering/base/BaseScene.hh
"
23
#include "
gz/rendering/base/BaseNode.hh
"
24
#include "
gz/rendering/ParticleEmitter.hh
"
25
26
namespace
gz
27
{
28
namespace
rendering
29
{
30
inline
namespace
GZ_RENDERING_VERSION_NAMESPACE {
31
//
32
/* \class BaseParticleEmitter BaseParticleEmitter.hh \
33
* gz/rendering/base/BaseParticleEmitter.hh
34
*/
36
template
<
class
T>
37
class
BaseParticleEmitter
:
38
public
virtual
ParticleEmitter
,
39
public
virtual
T
40
{
42
protected
:
BaseParticleEmitter
();
43
45
public
:
virtual
~BaseParticleEmitter
();
46
47
// Documentation inherited
48
public
:
virtual
void
Init
()
override
;
49
50
// Documentation inherited
51
public
:
virtual
void
PreRender
()
override
;
52
54
public
:
virtual
void
Reset
();
55
56
// Documentation inherited.
57
public
:
virtual
EmitterType
Type
()
const override
;
58
59
// Documentation inherited.
60
public
:
virtual
void
SetType
(
const
EmitterType
_type)
override
;
61
62
// Documentation inherited.
63
public
:
virtual
gz::math::Vector3d
EmitterSize
()
const override
;
64
65
// Documentation inherited.
66
public
:
virtual
void
SetEmitterSize
(
67
const
gz::math::Vector3d
&_size)
override
;
68
69
// Documentation inherited.
70
public
:
virtual
double
Rate
()
const override
;
71
72
// Documentation inherited.
73
public
:
virtual
void
SetRate
(
double
_rate)
override
;
74
75
// Documentation inherited.
76
public
:
virtual
double
Duration
()
const override
;
77
78
// Documentation inherited.
79
public
:
virtual
void
SetDuration
(
double
_duration)
override
;
80
81
// Documentation inherited.
82
public
:
virtual
bool
Emitting
()
const override
;
83
84
// Documentation inherited.
85
public
:
virtual
void
SetEmitting
(
bool
_enable)
override
;
86
87
// Documentation inherited.
88
public
:
virtual
gz::math::Vector3d
ParticleSize
()
const override
;
89
90
// Documentation inherited.
91
public
:
virtual
void
SetParticleSize
(
92
const
gz::math::Vector3d
&_size)
override
;
93
94
// Documentation inherited.
95
public
:
virtual
double
Lifetime
()
const override
;
96
97
// Documentation inherited.
98
public
:
virtual
void
SetLifetime
(
double
_lifetime)
override
;
99
100
// Documentation inherited.
101
public
:
virtual
MaterialPtr
Material
()
const override
;
102
103
// Documentation inherited.
104
public
:
virtual
void
SetMaterial
(
const
MaterialPtr
&_material)
override
;
105
106
// Documentation inherited.
107
public
:
virtual
double
MinVelocity
()
const override
;
108
109
// Documentation inherited.
110
public
:
virtual
double
MaxVelocity
()
const override
;
111
112
// Documentation inherited.
113
public
:
virtual
void
SetVelocityRange
(
double
_minVelocity,
114
double
_maxVelocity)
override
;
115
116
// Documentation inherited.
117
public
:
virtual
gz::math::Color
ColorStart
()
const override
;
118
119
// Documentation inherited.
120
public
:
virtual
gz::math::Color
ColorEnd
()
const override
;
121
122
// Documentation inherited.
123
public
:
virtual
void
SetColorRange
(
124
const
gz::math::Color
&_colorStart,
125
const
gz::math::Color
&_colorEnd)
override
;
126
127
// Documentation inherited.
128
public
:
virtual
double
ScaleRate
()
const override
;
129
130
// Documentation inherited.
131
public
:
virtual
void
SetScaleRate
(
double
_scaleRate)
override
;
132
133
// Documentation inherited.
134
public
:
virtual
std::string
ColorRangeImage
()
const override
;
135
136
// Documentation inherited.
137
public
:
virtual
void
SetColorRangeImage
(
138
const
std::string
&_image)
override
;
139
140
// Documentation inherited.
141
public
:
virtual
float
ParticleScatterRatio
()
const override
;
142
143
// Documentation inherited.
144
public
:
virtual
void
SetParticleScatterRatio
(
float
_ratio)
override
;
145
147
protected
:
EmitterType
type =
EM_POINT
;
148
150
protected
:
gz::math::Vector3d
emitterSize =
151
gz::math::Vector3d::One
;
152
154
protected
:
double
rate = 10;
155
157
protected
:
double
duration = 0;
158
160
protected
:
bool
emitting =
false
;
161
163
protected
:
gz::math::Vector3d
particleSize = {1, 1, 1};
164
166
protected
:
double
lifetime = 5;
167
169
protected
:
MaterialPtr
material =
nullptr
;
170
172
protected
:
double
minVelocity = 1;
173
175
protected
:
double
maxVelocity = 1;
176
178
protected
:
gz::math::Color
colorStart =
179
gz::math::Color::White
;
180
182
protected
:
gz::math::Color
colorEnd =
183
gz::math::Color::White
;
184
186
protected
:
double
scaleRate = 1;
187
189
protected
:
std::string
colorRangeImage =
""
;
190
198
protected
:
float
particleScatterRatio = 0.65f;
199
201
private
:
friend
class
BaseScene
;
202
};
203
205
template
<
class
T>
206
BaseParticleEmitter<T>::BaseParticleEmitter
()
207
{
208
}
209
211
template
<
class
T>
212
BaseParticleEmitter<T>::~BaseParticleEmitter
()
213
{
214
}
215
217
template
<
class
T>
218
void
BaseParticleEmitter<T>::Init
()
219
{
220
T::Init();
221
}
222
224
template
<
class
T>
225
void
BaseParticleEmitter<T>::Reset
()
226
{
227
}
228
230
template
<
class
T>
231
void
BaseParticleEmitter<T>::PreRender
()
232
{
233
}
234
236
template
<
class
T>
237
EmitterType
BaseParticleEmitter<T>::Type
()
const
238
{
239
return
this->type;
240
}
241
243
template
<
class
T>
244
void
BaseParticleEmitter<T>::SetType
(
const
EmitterType
_type)
245
{
246
this->type = _type;
247
}
248
250
template
<
class
T>
251
gz::math::Vector3d
BaseParticleEmitter<T>::EmitterSize
()
const
252
{
253
return
this->emitterSize;
254
}
255
257
template
<
class
T>
258
void
BaseParticleEmitter<T>::SetEmitterSize
(
259
const
gz::math::Vector3d
&_size)
260
{
261
this->emitterSize = _size;
262
}
263
265
template
<
class
T>
266
double
BaseParticleEmitter<T>::Rate
()
const
267
{
268
return
this->rate;
269
}
270
272
template
<
class
T>
273
void
BaseParticleEmitter<T>::SetRate
(
double
_rate)
274
{
275
this->rate = _rate;
276
}
277
279
template
<
class
T>
280
double
BaseParticleEmitter<T>::Duration
()
const
281
{
282
return
this->duration;
283
}
284
286
template
<
class
T>
287
void
BaseParticleEmitter<T>::SetDuration
(
double
_duration)
288
{
289
this->duration = _duration;
290
}
291
293
template
<
class
T>
294
bool
BaseParticleEmitter<T>::Emitting
()
const
295
{
296
return
this->emitting;
297
}
298
300
template
<
class
T>
301
void
BaseParticleEmitter<T>::SetEmitting
(
bool
_enable)
302
{
303
this->emitting = _enable;
304
}
305
307
template
<
class
T>
308
gz::math::Vector3d
BaseParticleEmitter<T>::ParticleSize
()
const
309
{
310
return
this->particleSize;
311
}
312
314
template
<
class
T>
315
void
BaseParticleEmitter<T>::SetParticleSize
(
316
const
gz::math::Vector3d
&_size)
317
{
318
this->particleSize = _size;
319
}
320
322
template
<
class
T>
323
double
BaseParticleEmitter<T>::Lifetime
()
const
324
{
325
return
this->lifetime;
326
}
327
329
template
<
class
T>
330
void
BaseParticleEmitter<T>::SetLifetime
(
double
_lifetime)
331
{
332
this->lifetime = _lifetime;
333
}
334
336
template
<
class
T>
337
MaterialPtr
BaseParticleEmitter<T>::Material
()
const
338
{
339
return
this->material;
340
}
341
343
template
<
class
T>
344
void
BaseParticleEmitter<T>::SetMaterial
(
const
MaterialPtr
&_material)
345
{
346
this->material = _material;
347
}
348
350
template
<
class
T>
351
double
BaseParticleEmitter<T>::MinVelocity
()
const
352
{
353
return
this->minVelocity;
354
}
355
357
template
<
class
T>
358
double
BaseParticleEmitter<T>::MaxVelocity
()
const
359
{
360
return
this->maxVelocity;
361
}
362
364
template
<
class
T>
365
void
BaseParticleEmitter<T>::SetVelocityRange
(
double
_minVelocity,
366
double
_maxVelocity)
367
{
368
this->minVelocity = _minVelocity;
369
this->maxVelocity = _maxVelocity;
370
}
371
373
template
<
class
T>
374
gz::math::Color
BaseParticleEmitter<T>::ColorStart
()
const
375
{
376
return
this->colorStart;
377
}
378
380
template
<
class
T>
381
gz::math::Color
BaseParticleEmitter<T>::ColorEnd
()
const
382
{
383
return
this->colorEnd;
384
}
385
387
template
<
class
T>
388
void
BaseParticleEmitter<T>::SetColorRange
(
389
const
gz::math::Color
&_colorStart,
390
const
gz::math::Color
&_colorEnd)
391
{
392
this->colorStart = _colorStart;
393
this->colorEnd = _colorEnd;
394
}
395
397
template
<
class
T>
398
double
BaseParticleEmitter<T>::ScaleRate
()
const
399
{
400
return
this->scaleRate;
401
}
402
404
template
<
class
T>
405
void
BaseParticleEmitter<T>::SetScaleRate
(
double
_scaleRate)
406
{
407
this->scaleRate = _scaleRate;
408
}
409
411
template
<
class
T>
412
std::string
BaseParticleEmitter<T>::ColorRangeImage
()
const
413
{
414
return
this->colorRangeImage;
415
}
416
418
template
<
class
T>
419
void
BaseParticleEmitter<T>::SetColorRangeImage
(
const
std::string
&_image)
420
{
421
this->colorRangeImage = _image;
422
}
423
425
template
<
class
T>
426
float
BaseParticleEmitter<T>::ParticleScatterRatio
()
const
427
{
428
return
this->particleScatterRatio;
429
}
430
432
template
<
class
T>
433
void
BaseParticleEmitter<T>::SetParticleScatterRatio
(
float
_ratio)
434
{
435
if
(_ratio > 0.0f)
436
this->particleScatterRatio = _ratio;
437
}
438
}
439
}
440
}
441
#endif