Gazebo Rendering
API Reference
9.0.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
src
gz-rendering
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
(
MaterialPtr
_material,
105
bool
_unique =
true
)
override
;
106
107
// Documentation inherited.
108
public
:
virtual
double
MinVelocity
()
const override
;
109
110
// Documentation inherited.
111
public
:
virtual
double
MaxVelocity
()
const override
;
112
113
// Documentation inherited.
114
public
:
virtual
void
SetVelocityRange
(
double
_minVelocity,
115
double
_maxVelocity)
override
;
116
117
// Documentation inherited.
118
public
:
virtual
gz::math::Color
ColorStart
()
const override
;
119
120
// Documentation inherited.
121
public
:
virtual
gz::math::Color
ColorEnd
()
const override
;
122
123
// Documentation inherited.
124
public
:
virtual
void
SetColorRange
(
125
const
gz::math::Color
&_colorStart,
126
const
gz::math::Color
&_colorEnd)
override
;
127
128
// Documentation inherited.
129
public
:
virtual
double
ScaleRate
()
const override
;
130
131
// Documentation inherited.
132
public
:
virtual
void
SetScaleRate
(
double
_scaleRate)
override
;
133
134
// Documentation inherited.
135
public
:
virtual
std::string
ColorRangeImage
()
const override
;
136
137
// Documentation inherited.
138
public
:
virtual
void
SetColorRangeImage
(
139
const
std::string
&_image)
override
;
140
141
// Documentation inherited.
142
public
:
virtual
float
ParticleScatterRatio
()
const override
;
143
144
// Documentation inherited.
145
public
:
virtual
void
SetParticleScatterRatio
(
float
_ratio)
override
;
146
148
protected
:
EmitterType
type =
EM_POINT
;
149
151
protected
:
gz::math::Vector3d
emitterSize =
152
gz::math::Vector3d::One
;
153
155
protected
:
double
rate = 10;
156
158
protected
:
double
duration = 0;
159
161
protected
:
bool
emitting =
false
;
162
164
protected
:
gz::math::Vector3d
particleSize = {1, 1, 1};
165
167
protected
:
double
lifetime = 5;
168
170
protected
:
MaterialPtr
material =
nullptr
;
171
173
protected
:
double
minVelocity = 1;
174
176
protected
:
double
maxVelocity = 1;
177
179
protected
:
gz::math::Color
colorStart =
180
gz::math::Color::White
;
181
183
protected
:
gz::math::Color
colorEnd =
184
gz::math::Color::White
;
185
187
protected
:
double
scaleRate = 1;
188
190
protected
:
std::string
colorRangeImage =
""
;
191
199
protected
:
float
particleScatterRatio = 0.65f;
200
202
private
:
friend
class
BaseScene
;
203
};
204
206
template
<
class
T>
207
BaseParticleEmitter<T>::BaseParticleEmitter
()
208
{
209
}
210
212
template
<
class
T>
213
BaseParticleEmitter<T>::~BaseParticleEmitter
()
214
{
215
}
216
218
template
<
class
T>
219
void
BaseParticleEmitter<T>::Init
()
220
{
221
T::Init();
222
}
223
225
template
<
class
T>
226
void
BaseParticleEmitter<T>::Reset
()
227
{
228
}
229
231
template
<
class
T>
232
void
BaseParticleEmitter<T>::PreRender
()
233
{
234
}
235
237
template
<
class
T>
238
EmitterType
BaseParticleEmitter<T>::Type
()
const
239
{
240
return
this->type;
241
}
242
244
template
<
class
T>
245
void
BaseParticleEmitter<T>::SetType
(
const
EmitterType
_type)
246
{
247
this->type = _type;
248
}
249
251
template
<
class
T>
252
gz::math::Vector3d
BaseParticleEmitter<T>::EmitterSize
()
const
253
{
254
return
this->emitterSize;
255
}
256
258
template
<
class
T>
259
void
BaseParticleEmitter<T>::SetEmitterSize
(
260
const
gz::math::Vector3d
&_size)
261
{
262
this->emitterSize = _size;
263
}
264
266
template
<
class
T>
267
double
BaseParticleEmitter<T>::Rate
()
const
268
{
269
return
this->rate;
270
}
271
273
template
<
class
T>
274
void
BaseParticleEmitter<T>::SetRate
(
double
_rate)
275
{
276
this->rate = _rate;
277
}
278
280
template
<
class
T>
281
double
BaseParticleEmitter<T>::Duration
()
const
282
{
283
return
this->duration;
284
}
285
287
template
<
class
T>
288
void
BaseParticleEmitter<T>::SetDuration
(
double
_duration)
289
{
290
this->duration = _duration;
291
}
292
294
template
<
class
T>
295
bool
BaseParticleEmitter<T>::Emitting
()
const
296
{
297
return
this->emitting;
298
}
299
301
template
<
class
T>
302
void
BaseParticleEmitter<T>::SetEmitting
(
bool
_enable)
303
{
304
this->emitting = _enable;
305
}
306
308
template
<
class
T>
309
gz::math::Vector3d
BaseParticleEmitter<T>::ParticleSize
()
const
310
{
311
return
this->particleSize;
312
}
313
315
template
<
class
T>
316
void
BaseParticleEmitter<T>::SetParticleSize
(
317
const
gz::math::Vector3d
&_size)
318
{
319
this->particleSize = _size;
320
}
321
323
template
<
class
T>
324
double
BaseParticleEmitter<T>::Lifetime
()
const
325
{
326
return
this->lifetime;
327
}
328
330
template
<
class
T>
331
void
BaseParticleEmitter<T>::SetLifetime
(
double
_lifetime)
332
{
333
this->lifetime = _lifetime;
334
}
335
337
template
<
class
T>
338
MaterialPtr
BaseParticleEmitter<T>::Material
()
const
339
{
340
return
this->material;
341
}
342
344
template
<
class
T>
345
void
BaseParticleEmitter<T>::SetMaterial
(
MaterialPtr
_material,
346
bool
/*_unique*/
)
347
{
348
this->material = _material;
349
}
350
352
template
<
class
T>
353
double
BaseParticleEmitter<T>::MinVelocity
()
const
354
{
355
return
this->minVelocity;
356
}
357
359
template
<
class
T>
360
double
BaseParticleEmitter<T>::MaxVelocity
()
const
361
{
362
return
this->maxVelocity;
363
}
364
366
template
<
class
T>
367
void
BaseParticleEmitter<T>::SetVelocityRange
(
double
_minVelocity,
368
double
_maxVelocity)
369
{
370
this->minVelocity = _minVelocity;
371
this->maxVelocity = _maxVelocity;
372
}
373
375
template
<
class
T>
376
gz::math::Color
BaseParticleEmitter<T>::ColorStart
()
const
377
{
378
return
this->colorStart;
379
}
380
382
template
<
class
T>
383
gz::math::Color
BaseParticleEmitter<T>::ColorEnd
()
const
384
{
385
return
this->colorEnd;
386
}
387
389
template
<
class
T>
390
void
BaseParticleEmitter<T>::SetColorRange
(
391
const
gz::math::Color
&_colorStart,
392
const
gz::math::Color
&_colorEnd)
393
{
394
this->colorStart = _colorStart;
395
this->colorEnd = _colorEnd;
396
}
397
399
template
<
class
T>
400
double
BaseParticleEmitter<T>::ScaleRate
()
const
401
{
402
return
this->scaleRate;
403
}
404
406
template
<
class
T>
407
void
BaseParticleEmitter<T>::SetScaleRate
(
double
_scaleRate)
408
{
409
this->scaleRate = _scaleRate;
410
}
411
413
template
<
class
T>
414
std::string
BaseParticleEmitter<T>::ColorRangeImage
()
const
415
{
416
return
this->colorRangeImage;
417
}
418
420
template
<
class
T>
421
void
BaseParticleEmitter<T>::SetColorRangeImage
(
const
std::string
&_image)
422
{
423
this->colorRangeImage = _image;
424
}
425
427
template
<
class
T>
428
float
BaseParticleEmitter<T>::ParticleScatterRatio
()
const
429
{
430
return
this->particleScatterRatio;
431
}
432
434
template
<
class
T>
435
void
BaseParticleEmitter<T>::SetParticleScatterRatio
(
float
_ratio)
436
{
437
if
(_ratio > 0.0f)
438
this->particleScatterRatio = _ratio;
439
}
440
}
441
}
442
}
443
#endif