Gazebo Rendering

API Reference

9.0.0~pre2
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>
25
26namespace 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>
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 =
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 =
181
183 protected: gz::math::Color colorEnd =
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>
210
212 template <class T>
216
218 template <class T>
220 {
221 T::Init();
222 }
223
225 template <class T>
229
231 template <class T>
235
237 template <class T>
239 {
240 return this->type;
241 }
242
244 template <class T>
246 {
247 this->type = _type;
248 }
249
251 template <class T>
253 {
254 return this->emitterSize;
255 }
256
258 template <class T>
260 const gz::math::Vector3d &_size)
261 {
262 this->emitterSize = _size;
263 }
264
266 template <class T>
268 {
269 return this->rate;
270 }
271
273 template <class T>
275 {
276 this->rate = _rate;
277 }
278
280 template <class T>
282 {
283 return this->duration;
284 }
285
287 template <class T>
289 {
290 this->duration = _duration;
291 }
292
294 template <class T>
296 {
297 return this->emitting;
298 }
299
301 template <class T>
303 {
304 this->emitting = _enable;
305 }
306
308 template <class T>
310 {
311 return this->particleSize;
312 }
313
315 template <class T>
317 const gz::math::Vector3d &_size)
318 {
319 this->particleSize = _size;
320 }
321
323 template <class T>
325 {
326 return this->lifetime;
327 }
328
330 template <class T>
332 {
333 this->lifetime = _lifetime;
334 }
335
337 template <class T>
339 {
340 return this->material;
341 }
342
344 template <class T>
346 bool /*_unique*/)
347 {
348 this->material = _material;
349 }
350
352 template <class T>
354 {
355 return this->minVelocity;
356 }
357
359 template <class T>
361 {
362 return this->maxVelocity;
363 }
364
366 template <class T>
368 double _maxVelocity)
369 {
370 this->minVelocity = _minVelocity;
371 this->maxVelocity = _maxVelocity;
372 }
373
375 template <class T>
377 {
378 return this->colorStart;
379 }
380
382 template <class T>
384 {
385 return this->colorEnd;
386 }
387
389 template <class T>
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>
401 {
402 return this->scaleRate;
403 }
404
406 template <class T>
408 {
409 this->scaleRate = _scaleRate;
410 }
411
413 template <class T>
415 {
416 return this->colorRangeImage;
417 }
418
420 template <class T>
422 {
423 this->colorRangeImage = _image;
424 }
425
427 template <class T>
429 {
430 return this->particleScatterRatio;
431 }
432
434 template <class T>
436 {
437 if (_ratio > 0.0f)
438 this->particleScatterRatio = _ratio;
439 }
440 }
441 }
442}
443#endif