18 #ifndef B2_PARTICLE_GROUP
19 #define B2_PARTICLE_GROUP
28 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
30 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
47 b2_particleGroupInternalMask =
65 color = b2ParticleColor_zero;
77 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
79 ownShapesArray =
false;
80 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
85 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
87 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
146 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
154 void FreeShapesMemory();
159 void SetCircleShapesFromVertexList(
void* inBuf,
164 void SetPosition(float32 x, float32 y);
167 void SetColor(int32 r, int32 g, int32 b, int32 a);
168 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
267 int32 m_firstIndex, m_lastIndex;
273 mutable int32 m_timestamp;
274 mutable float32 m_mass;
275 mutable float32 m_inertia;
277 mutable b2Vec2 m_linearVelocity;
278 mutable float32 m_angularVelocity;
285 void UpdateStatistics()
const;
311 return m_lastIndex - m_firstIndex;
316 return m_firstIndex <= index && index < m_lastIndex;
319 inline b2ParticleGroup::~b2ParticleGroup()
330 return m_groupFlags & ~b2_particleGroupInternalMask;
354 return m_linearVelocity;
360 return m_angularVelocity;
370 return m_transform.p;
379 const b2Vec2& worldPoint)
const
382 return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_center);
400 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
401 inline void b2ParticleGroupDef::SetPosition(float32 x, float32 y)
406 inline void b2ParticleGroupDef::SetColor(int32 r, int32 g, int32 b, int32 a)
408 color.
Set((uint8)r, (uint8)g, (uint8)b, (uint8)a);
410 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
b2Vec2 linearVelocity
The linear velocity of the group's origin in world co-ordinates.
Definition: b2ParticleGroup.h:105
A circle shape.
Definition: b2CircleShape.h:26
float32 stride
Definition: b2ParticleGroup.h:128
uint32 flags
The particle-behavior flags (See b2ParticleFlag).
Definition: b2ParticleGroup.h:91
Keeps its shape.
Definition: b2ParticleGroup.h:40
float32 GetAngle() const
Get the angle in radians.
Definition: b2Math.h:388
void * userData
Use this to store application-specific group data.
Definition: b2ParticleGroup.h:141
Definition: b2ParticleGroup.h:54
float32 angle
Definition: b2ParticleGroup.h:102
const b2Shape *const * shapes
A array of shapes where particles will be added.
Definition: b2ParticleGroup.h:121
float32 GetMass() const
Get the total mass of the group: the sum of all particles in it.
Definition: b2ParticleGroup.h:333
const b2Vec2 * positionData
The initial positions of the particleCount particles.
Definition: b2ParticleGroup.h:134
b2ParticleGroupFlag
The particle group type. Can be combined with the | operator.
Definition: b2ParticleGroup.h:35
b2Vec2 position
Definition: b2ParticleGroup.h:98
Will be destroyed on next simulation step.
Definition: b2ParticleGroup.h:44
void ApplyForce(const b2Vec2 &force)
Call b2ParticleSystem::ApplyForce for every particle in the group.
Definition: b2ParticleGroup.cpp:102
b2ParticleGroup * group
An existing particle group to which the particles will be added.
Definition: b2ParticleGroup.h:144
Updates depth data on next simulation step.
Definition: b2ParticleGroup.h:46
uint32 groupFlags
The group-construction flags (See b2ParticleGroupFlag).
Definition: b2ParticleGroup.h:94
b2Vec2 GetLinearVelocity() const
Get the linear velocity of the group.
Definition: b2ParticleGroup.h:351
Definition: b2ParticleSystem.h:281
uint32 GetAllParticleFlags() const
Get the logical sum of particle flags.
Definition: b2ParticleGroup.cpp:49
Won't be destroyed if it gets empty.
Definition: b2ParticleGroup.h:42
bool ContainsParticle(int32 index) const
Does this group contain the particle.
Definition: b2ParticleGroup.h:314
b2Vec2 GetCenter() const
Get the center of gravity for the group.
Definition: b2ParticleGroup.h:345
Small color object for each particle.
Definition: b2Particle.h:81
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:68
float32 angularVelocity
The angular velocity of the group.
Definition: b2ParticleGroup.h:108
float32 GetAngle() const
Definition: b2ParticleGroup.h:373
uint32 GetGroupFlags() const
Get the construction flags for the group.
Definition: b2ParticleGroup.h:328
void SetGroupFlags(uint32 flags)
Set the construction flags for the group.
Definition: b2ParticleGroup.cpp:59
int32 particleCount
The number of particles in addition to ones added in the shape.
Definition: b2ParticleGroup.h:131
const b2Transform & GetTransform() const
Definition: b2ParticleGroup.h:363
A group of particles. b2ParticleGroup::CreateParticleGroup creates these.
Definition: b2ParticleGroup.h:172
b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2 &worldPoint) const
Definition: b2ParticleGroup.h:378
void SetUserData(void *data)
Set the user data. Use this to store your application specific data.
Definition: b2ParticleGroup.h:390
float32 strength
Definition: b2ParticleGroup.h:115
b2Inline void Set(uint8 r_, uint8 g_, uint8 b_, uint8 a_)
Definition: b2Particle.h:111
void ApplyLinearImpulse(const b2Vec2 &impulse)
Definition: b2ParticleGroup.cpp:107
int32 GetParticleCount() const
Get the number of particles.
Definition: b2ParticleGroup.h:309
Prevents overlapping or leaking.
Definition: b2ParticleGroup.h:38
float32 GetInertia() const
Get the moment of inertia for the group.
Definition: b2ParticleGroup.h:339
b2ParticleSystem * GetParticleSystem()
Get the particle system that holds this particle group.
Definition: b2ParticleGroup.h:299
int32 shapeCount
The number of shapes.
Definition: b2ParticleGroup.h:124
void * GetUserData() const
Get the user data pointer that was provided in the group definition.
Definition: b2ParticleGroup.h:385
const b2Vec2 & GetPosition() const
Definition: b2ParticleGroup.h:368
int32 GetBufferIndex() const
Get the offset of this group in the global particle buffer.
Definition: b2ParticleGroup.h:323
A 2D column vector.
Definition: b2Math.h:56
b2ParticleGroup * GetNext()
Get the next particle group from the list in b2_World.
Definition: b2ParticleGroup.h:289
void DestroyParticles()
Definition: b2ParticleGroup.h:395
b2ParticleColor color
The color of all particles in the group.
Definition: b2ParticleGroup.h:111
float32 GetAngularVelocity() const
Get the angular velocity of the group.
Definition: b2ParticleGroup.h:357
const b2Shape * shape
The shape where particles will be added.
Definition: b2ParticleGroup.h:118
float32 lifetime
Definition: b2ParticleGroup.h:138