AGXDynamics
2.35.0.3
ParticleEmitter.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2022. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
18
#ifndef AGX_PARTICLE_EMITTER_H
19
#define AGX_PARTICLE_EMITTER_H
20
21
#include <
agx/Emitter.h
>
22
#include <
agx/ParticleSystem.h
>
23
24
namespace
agx
25
{
26
AGX_DECLARE_POINTER_TYPES
(
ParticleEmitter
);
27
AGX_DECLARE_VECTOR_TYPES
(
ParticleEmitter
);
28
32
class
CALLABLE
AGXPHYSICS_EXPORT
ParticleEmitter
:
public
agx::Emitter
33
{
34
public
:
35
typedef
Event2<ParticleEmitter *, agxData::EntityRange>
Event
;
36
Event
emitEvent
;
37
38
AGX_DECLARE_POINTER_TYPES
(DistributionModel);
39
40
public
:
41
45
ParticleEmitter
(
ParticleSystem
*target,
Quantity
quantity = QUANTITY_COUNT );
46
51
void
setLife(
Real
life );
52
56
Real
getLife()
const
;
57
62
void
setColor(
const
Vec4
& color );
63
67
const
Vec4
& getColor( )
const
;
68
72
void
setEnableMoisture(
bool
enable);
73
74
/*
75
Get if the emitter should set a moisture property for the created particles
76
*/
77
bool
getEnableMoisture()
const
;
78
82
void
setDefaultMoisture(
agx::Real
defaultMoisture);
83
87
agx::Real
getDefaultMoisture()
const
;
88
89
90
DOXYGEN_START_INTERNAL_BLOCK
()
91
92
AGXSTREAM_DECLARE_SERIALIZABLE
(
agx
::
ParticleEmitter
);
93
94
DOXYGEN_END_INTERNAL_BLOCK
()
95
96
protected:
98
ParticleEmitter
();
99
101
virtual ~
ParticleEmitter
();
102
103
virtual
void
emitBody(const
Vec3
& position,
104
const
Quat
& rotation,
105
const
Vec3
& velocity,
106
Emitter
::DistributionModel *model) override;
107
virtual
bool
preEmit() override;
108
virtual
void
postEmit() override;
109
virtual
Real
getDefaultElementQuantity(
Quantity
quantity) override;
110
111
private:
112
// Creates and initializes the parameters.
113
void
init
(
ParticleSystem
*target);
114
115
private:
116
ParticleSystemRef
m_particleSystem;
117
bool
m_isGranularSystem;
118
ScalarParameterRef
m_life;
119
120
ScalarParameterRef
m_particleColor;
121
size_t
m_startSize;
122
123
bool
m_enableMoistureProperty = false;
124
agx
::
Real
m_defaultMoisture = 0;
125
};
126
127
128
class
AGXPHYSICS_EXPORT
ParticleEmitter
::DistributionModel : public
Emitter
::DistributionModel
129
{
130
public
:
131
DistributionModel();
132
DistributionModel(
agx::Real
particleRadius,
agx::Material
*particleMaterial,
agx::Real
probabilityWeight);
133
137
// void setParticleRadius(agx::Real radius);
138
142
agx::Real
getParticleRadius()
const
;
143
147
// void setParticleMaterial(agx::Material *material);
148
152
agx::Material
*getParticleMaterial();
153
const
agx::Material
*getParticleMaterial()
const
;
154
155
DOXYGEN_START_INTERNAL_BLOCK
()
156
157
AGXSTREAM_DECLARE_SERIALIZABLE
(
agx
::
ParticleEmitter
::DistributionModel );
158
159
DOXYGEN_END_INTERNAL_BLOCK
()
160
161
protected:
162
virtual ~DistributionModel();
163
virtual
agx
::
Real
calculateVolume() override;
164
virtual
agx
::
Real
calculateMass() override;
165
166
private:
167
agx
::
Real
m_particleRadius;
168
agx
::
MaterialRef
m_particleMaterial;
169
};
170
}
171
172
#endif
agx::Real
double Real
Definition:
Real.h:42
CALLABLE
#define CALLABLE
Definition:
macros.h:72
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition:
macros.h:97
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition:
macros.h:96
agx::Vec4T
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition:
Vec4Template.h:34
ParticleSystem.h
AGXSTREAM_DECLARE_SERIALIZABLE
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition:
Serializable.h:207
agx::Emitter::Quantity
Quantity
Definition:
Emitter.h:47
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition:
AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition:
Vector.h:34
agx::ParticleEmitter::Event
Event2< ParticleEmitter *, agxData::EntityRange > Event
Definition:
ParticleEmitter.h:35
agx::ParticleSystem
A basic particle system that contains all the storages and buffers required for basic operation and a...
Definition:
ParticleSystem.h:67
agx::ref_ptr< ParticleSystem >
agx::QuatT< Real >
agx::ParticleEmitter::emitEvent
Event emitEvent
Definition:
ParticleEmitter.h:36
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
Emitter.h
agx::init
void AGXPHYSICS_EXPORT init()
Initialize agx.
agx::Material
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition:
Material.h:387
agx::Vec3T< Real >
agx::ParticleEmitter
Spawns new particles inside a given volume given to the Emitter.
Definition:
ParticleEmitter.h:32
agx::Event2< ParticleEmitter *, agxData::EntityRange >
agx::Emitter
Spawns new bodys inside a given volume.
Definition:
Emitter.h:44
include
agx
ParticleEmitter.h
Generated on Fri Feb 10 2023 14:06:16 for AGXDynamics by
1.8.17