21 #include <Box2D/Common/b2Math.h>
23 #include <Box2D/Common/b2IntrusiveList.h>
102 return !r && !g && !b && !a;
111 b2Inline
void Set(uint8 r_, uint8 g_, uint8 b_, uint8 a_)
126 Set(color.r, color.g, color.b, color.a);
134 Set((uint8)(r * s), (uint8)(g * s), (uint8)(b * s), (uint8)(a * s));
142 const int32 scale = (int32)s + 1;
153 return MultiplyByScalar(s);
159 return MultiplyByScalar(s);
205 return r == color.r && g == color.g && b == color.b && a == color.a;
225 const int32 strength)
227 const uint8 dr = (uint8)((strength * (colorB->r - colorA->r)) >>
229 const uint8 dg = (uint8)((strength * (colorB->g - colorA->g)) >>
231 const uint8 db = (uint8)((strength * (colorB->b - colorA->b)) >>
233 const uint8 da = (uint8)((strength * (colorB->a - colorA->a)) >>
248 template <
typename T>
279 color = b2ParticleColor_zero;
285 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
286 void SetPosition(float32 x, float32 y);
290 void SetColor(int32 r, int32 g, int32 b, int32 a);
291 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
323 float32 gravity, float32 radius, float32 timeStep);
347 void SetIndex(int32 index) { m_index = index; }
354 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
355 inline void b2ParticleDef::SetPosition(float32 x, float32 y)
360 inline void b2ParticleDef::SetColor(int32 r, int32 g, int32 b, int32 a)
362 color.
Set((uint8)r, (uint8)g, (uint8)b, (uint8)a);
364 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
Mix color between contacting particles.
Definition: b2Particle.h:50
Prevents other particles from leaking.
Definition: b2Particle.h:54
static const float32 k_inverseMaxValue
1.0 / k_maxValue.
Definition: b2Particle.h:263
Makes pairs or triads with other particles.
Definition: b2Particle.h:58
With high repulsive force.
Definition: b2Particle.h:60
Definition: b2Particle.h:77
Call b2DestructionListener on destruction.
Definition: b2Particle.h:52
float32 lifetime
Definition: b2Particle.h:311
~b2ParticleHandle()
Empty destructor.
Definition: b2Particle.h:340
Definition: b2Particle.h:72
b2Vec2 velocity
The linear velocity of the particle in world co-ordinates.
Definition: b2Particle.h:304
Removed after next simulation step.
Definition: b2Particle.h:36
b2ParticleColor & operator=(const b2ParticleColor &color)
Assign a b2ParticleColor to this instance.
Definition: b2Particle.h:124
Definition: b2ParticleSystem.h:281
b2ParticleColor operator*(float32 s) const
Scales r, g, b, a members by s returning the modified b2ParticleColor.
Definition: b2Particle.h:151
int32 b2CalculateParticleIterations(float32 gravity, float32 radius, float32 timeStep)
A helper function to calculate the optimal number of iterations.
Definition: b2Particle.cpp:55
bool operator==(const b2ParticleColor &color) const
Compare this color with the specified color.
Definition: b2Particle.h:203
Color for debug drawing. Each value has the range [0,1].
Definition: b2Draw.h:27
With restitution from deformation.
Definition: b2Particle.h:42
With viscosity.
Definition: b2Particle.h:44
b2Inline b2ParticleColor & operator+=(const b2ParticleColor &color)
Definition: b2Particle.h:164
b2Vec2 position
The world position of the particle.
Definition: b2Particle.h:301
Definition: b2IntrusiveList.h:272
Definition: b2Particle.h:272
b2Inline void Mix(b2ParticleColor *const mixColor, const int32 strength)
Definition: b2Particle.h:213
Small color object for each particle.
Definition: b2Particle.h:81
Without isotropic pressure.
Definition: b2Particle.h:46
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:68
b2ParticleColor operator+(const b2ParticleColor &color) const
Definition: b2Particle.h:175
b2Inline b2ParticleColor(uint8 r, uint8 g, uint8 b, uint8 a)
Definition: b2Particle.h:88
Definition: b2Particle.h:66
void * userData
Use this to store application-specific body data.
Definition: b2Particle.h:314
b2Color GetColor() const
Definition: b2Particle.cpp:40
With surface tension.
Definition: b2Particle.h:48
A group of particles. b2ParticleGroup::CreateParticleGroup creates these.
Definition: b2ParticleGroup.h:172
int32 GetIndex() const
Get the index of the particle associated with this handle.
Definition: b2Particle.h:343
b2ParticleHandle()
Initialize the index associated with the handle to an invalid index.
Definition: b2Particle.h:338
b2ParticleColor color
The color of the particle.
Definition: b2Particle.h:307
b2Inline void Set(uint8 r_, uint8 g_, uint8 b_, uint8 a_)
Definition: b2Particle.h:111
Less compressibility.
Definition: b2Particle.h:56
b2Inline b2ParticleColor & operator-=(const b2ParticleColor &color)
Definition: b2Particle.h:184
uint32 flags
Specifies the type of particle (see b2ParticleFlag).
Definition: b2Particle.h:298
b2ParticleColor & operator*=(float32 s)
Definition: b2Particle.h:132
Water particle.
Definition: b2Particle.h:34
With restitution from stretching.
Definition: b2Particle.h:40
bool IsZero() const
Definition: b2Particle.h:100
b2ParticleColor operator-(const b2ParticleColor &color) const
Definition: b2Particle.h:195
static const uint8 k_bitsPerComponent
Number of bits used to store each b2ParticleColor component.
Definition: b2Particle.h:265
A 2D column vector.
Definition: b2Math.h:56
static b2Inline void MixColors(b2ParticleColor *const colorA, b2ParticleColor *const colorB, const int32 strength)
Definition: b2Particle.h:223
#define b2_invalidParticleIndex
NEON SIMD requires 16-bit particle indices.
Definition: b2Settings.h:168
b2ParticleGroup * group
An existing particle group to which the particle will be added.
Definition: b2Particle.h:317
static const float32 k_maxValue
Maximum value of a b2ParticleColor component.
Definition: b2Particle.h:261
Call b2ContactFilter when this particle interacts with rigid bodies.
Definition: b2Particle.h:74
b2ParticleFlag
The particle type. Can be combined with the | operator.
Definition: b2Particle.h:31
Zero velocity.
Definition: b2Particle.h:38
Definition: b2Particle.h:330