18 #ifndef B2_PARTICLE_SYSTEM_H
19 #define B2_PARTICLE_SYSTEM_H
21 #include <Box2D/Common/b2SlabAllocator.h>
22 #include <Box2D/Common/b2GrowableBuffer.h>
24 #include <Box2D/Dynamics/b2TimeStep.h>
26 #if LIQUIDFUN_UNIT_TESTS
27 #include <gtest/gtest.h>
28 #endif // LIQUIDFUN_UNIT_TESTS
30 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
32 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
45 class b2ParticlePairSet;
46 class FixtureParticleSet;
61 #ifdef B2_USE_16_BIT_PARTICLE_INDICES
62 typedef int16 b2ParticleIndex;
64 typedef int32 b2ParticleIndex;
68 b2ParticleIndex indexA, indexB;
83 void SetIndices(int32 a, int32 b);
84 void SetWeight(float32 w) { weight = w; }
85 void SetNormal(
const b2Vec2& n) { normal = n; }
86 void SetFlags(uint32 f) { flags = f; }
88 int32 GetIndexA()
const {
return indexA; }
89 int32 GetIndexB()
const {
return indexB; }
90 float32 GetWeight()
const {
return weight; }
91 const b2Vec2& GetNormal()
const {
return normal; }
92 uint32 GetFlags()
const {
return flags; }
150 float32 ka, kb, kc, s;
320 const bool callDestructionListener);
348 bool callDestructionListener);
513 void SetPositionBuffer(
b2Vec2* buffer, int32 capacity);
514 void SetVelocityBuffer(
b2Vec2* buffer, int32 capacity);
516 void SetUserDataBuffer(
void** buffer, int32 capacity);
522 int32 GetContactCount()
const;
528 int32 GetBodyContactCount()
const;
544 int32 GetPairCount()
const;
561 int32 GetTriadCount()
const;
692 const b2Vec2& point2)
const;
699 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
704 b2_particleIndexOutOfBounds,
710 void SetParticleVelocity(int32 index, float32 vx, float32 vy);
713 float GetParticlePositionX(int32 index)
const;
716 float GetParticlePositionY(int32 index)
const;
719 int CopyPositionBuffer(
int startIndex,
int numParticles,
void* outBuf,
723 int CopyColorBuffer(
int startIndex,
int numParticles,
void* outBuf,
727 int CopyWeightBuffer(
int startIndex,
int numParticles,
void* outBuf,
732 int CopyBuffer(
int startIndex,
int numParticles,
void* inBufWithOffset,
733 void* outBuf,
int outBufSize,
int copySize)
const;
737 b2ExceptionType IsBufCopyValid(
int startIndex,
int numParticles,
738 int copySize,
int bufSize)
const;
739 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
744 friend class b2ParticleBodyContactRemovePredicate;
745 friend class b2FixtureParticleQueryCallback;
746 #ifdef LIQUIDFUN_UNIT_TESTS
747 FRIEND_TEST(FunctionTests, GetParticleMass);
748 FRIEND_TEST(FunctionTests, AreProxyBuffersTheSame);
749 #endif // LIQUIDFUN_UNIT_TESTS
751 template <
typename T>
752 struct UserOverridableBuffer
754 UserOverridableBuffer()
757 userSuppliedCapacity = 0;
760 int32 userSuppliedCapacity;
768 friend inline bool operator<(
const Proxy &a,
const Proxy &b)
770 return a.tag < b.tag;
772 friend inline bool operator<(uint32 a,
const Proxy &b)
776 friend inline bool operator<(
const Proxy &a, uint32 b)
783 class ConnectionFilter
786 virtual ~ConnectionFilter() {}
789 virtual bool IsNecessary(int32 index)
const
795 virtual bool ShouldCreatePair(int32 a, int32 b)
const
802 virtual bool ShouldCreateTriad(int32 a, int32 b, int32 c)
const
812 class InsideBoundsEnumerator
816 InsideBoundsEnumerator(
817 uint32 lower, uint32 upper,
818 const Proxy* first,
const Proxy* last);
825 uint32 m_xLower, m_xUpper;
827 uint32 m_yLower, m_yUpper;
829 const Proxy* m_first;
834 struct ParticleListNode
837 ParticleListNode* list;
839 ParticleListNode* next;
848 static const int32 k_pairFlags =
852 static const int32 k_triadFlags =
855 static const int32 k_noPressureFlags =
859 static const int32 k_extraDampingFlags =
865 template <
typename T>
void FreeBuffer(T** b,
int capacity);
866 template <
typename T>
void FreeUserOverridableBuffer(
867 UserOverridableBuffer<T>* b);
868 template <
typename T> T* ReallocateBuffer(T* buffer, int32 oldCapacity,
870 template <
typename T> T* ReallocateBuffer(
871 T* buffer, int32 userSuppliedCapacity, int32 oldCapacity,
872 int32 newCapacity,
bool deferred);
873 template <
typename T> T* ReallocateBuffer(
874 UserOverridableBuffer<T>* buffer, int32 oldCapacity, int32 newCapacity,
876 template <
typename T> T* RequestBuffer(T* buffer);
880 void ReallocateHandleBuffers(int32 newCapacity);
882 void ReallocateInternalAllocatedBuffers(int32 capacity);
883 int32 CreateParticleForGroup(
886 void CreateParticlesStrokeShapeForGroup(
889 void CreateParticlesFillShapeForGroup(
892 void CreateParticlesWithShapeForGroup(
895 void CreateParticlesWithShapesForGroup(
896 const b2Shape*
const* shapes, int32 shapeCount,
901 void UpdatePairsAndTriads(
902 int32 firstIndex, int32 lastIndex,
const ConnectionFilter& filter);
903 void UpdatePairsAndTriadsWithReactiveParticles();
909 static void InitializeParticleLists(
911 void MergeParticleListsInContact(
913 static void MergeParticleLists(
914 ParticleListNode* listA, ParticleListNode* listB);
915 static ParticleListNode* FindLongestParticleList(
917 void MergeZombieParticleListNodes(
919 ParticleListNode* survivingList)
const;
920 static void MergeParticleListAndNode(
921 ParticleListNode* list, ParticleListNode* node);
922 void CreateParticleGroupsFromParticleList(
924 const ParticleListNode* survivingList);
925 void UpdatePairsAndTriadsWithParticleList(
930 InsideBoundsEnumerator GetInsideBoundsEnumerator(
const b2AABB& aabb)
const;
932 void UpdateAllParticleFlags();
933 void UpdateAllGroupFlags();
934 void AddContact(int32 a, int32 b,
936 void FindContacts_Reference(
939 int alignedCount)
const;
940 void GatherChecksOneParticle(
942 const int startIndex,
943 const int particleIndex,
944 int* nextUncheckedIndex,
947 void FindContacts_Simd(
951 static void UpdateProxyTags(
952 const uint32*
const tags,
954 static bool ProxyBufferHasIndex(
955 int32 index,
const Proxy*
const a,
int count);
956 static int NumProxiesWithSameTag(
957 const Proxy*
const a,
const Proxy*
const b,
int count);
965 void NotifyContactListenerPreContact(
966 b2ParticlePairSet* particlePairs)
const;
967 void NotifyContactListenerPostContact(b2ParticlePairSet& particlePairs);
968 void UpdateContacts(
bool exceptZombie);
969 void NotifyBodyContactListenerPreContact(
970 FixtureParticleSet* fixtureSet)
const;
971 void NotifyBodyContactListenerPostContact(FixtureParticleSet& fixtureSet);
972 void UpdateBodyContacts();
979 void SolveStaticPressure(
const b2TimeStep& step);
980 void ComputeWeight();
983 void SolveRigidDamping();
984 void SolveExtraDamping();
995 void SolveColorMixing();
1000 void RotateBuffer(int32 start, int32 mid, int32 end);
1002 float32 GetCriticalVelocity(
const b2TimeStep& step)
const;
1003 float32 GetCriticalVelocitySquared(
const b2TimeStep& step)
const;
1004 float32 GetCriticalPressure(
const b2TimeStep& step)
const;
1005 float32 GetParticleStride()
const;
1006 float32 GetParticleMass()
const;
1007 float32 GetParticleInvMass()
const;
1025 template <
typename T>
void SetUserOverridableBuffer(
1026 UserOverridableBuffer<T>* buffer, T* newBufferData, int32 newCapacity);
1030 void RemoveSpuriousBodyContacts();
1034 void DetectStuckParticle(int32 particle);
1037 bool ValidateParticleIndex(
const int32 index)
const;
1040 int32 GetQuantizedTimeElapsed()
const;
1042 int64 LifetimeToExpirationTime(
const float32 lifetime)
const;
1044 bool ForceCanBeApplied(uint32 flags)
const;
1045 void PrepareForceBuffer();
1048 b2Vec2 GetLinearVelocity(
1050 const b2Vec2 &point)
const;
1051 void InitDampingParameter(
1052 float32* invMass, float32* invInertia, float32* tangentDistance,
1053 float32 mass, float32 inertia,
const b2Vec2& center,
1055 void InitDampingParameterWithRigidGroupOrParticle(
1056 float32* invMass, float32* invInertia, float32* tangentDistance,
1059 float32 ComputeDampingImpulse(
1060 float32 invMassA, float32 invInertiaA, float32 tangentDistanceA,
1061 float32 invMassB, float32 invInertiaB, float32 tangentDistanceB,
1062 float32 normalVelocity)
const;
1064 float32 invMass, float32 invInertia, float32 tangentDistance,
1066 float32 impulse,
const b2Vec2& normal);
1070 int32 m_allParticleFlags;
1071 bool m_needsUpdateAllParticleFlags;
1072 int32 m_allGroupFlags;
1073 bool m_needsUpdateAllGroupFlags;
1075 int32 m_iterationIndex;
1076 float32 m_inverseDensity;
1077 float32 m_particleDiameter;
1078 float32 m_inverseDiameter;
1079 float32 m_squaredDiameter;
1082 int32 m_internalAllocatedCapacity;
1086 UserOverridableBuffer<b2ParticleHandle*> m_handleIndexBuffer;
1087 UserOverridableBuffer<uint32> m_flagsBuffer;
1088 UserOverridableBuffer<b2Vec2> m_positionBuffer;
1089 UserOverridableBuffer<b2Vec2> m_velocityBuffer;
1093 float32* m_weightBuffer;
1098 float32* m_staticPressureBuffer;
1101 float32* m_accumulationBuffer;
1106 b2Vec2* m_accumulation2Buffer;
1111 float32* m_depthBuffer;
1112 UserOverridableBuffer<b2ParticleColor> m_colorBuffer;
1114 UserOverridableBuffer<void*> m_userDataBuffer;
1117 int32 m_stuckThreshold;
1118 UserOverridableBuffer<int32> m_lastBodyContactStepBuffer;
1119 UserOverridableBuffer<int32> m_bodyContactCountBuffer;
1120 UserOverridableBuffer<int32> m_consecutiveContactStepsBuffer;
1131 UserOverridableBuffer<int32> m_expirationTimeBuffer;
1133 UserOverridableBuffer<int32> m_indexByExpirationTimeBuffer;
1136 int64 m_timeElapsed;
1139 bool m_expirationTimeBufferRequiresSorting;
1151 inline void b2ParticleContact::SetIndices(int32 a, int32 b)
1153 b2Assert(a <= b2_maxParticleIndex && b <= b2_maxParticleIndex);
1154 indexA = (b2ParticleIndex)a;
1155 indexB = (b2ParticleIndex)b;
1159 inline bool b2ParticleContact::operator==(
1162 return indexA == rhs.indexA
1163 && indexB == rhs.indexB
1164 && flags == rhs.flags
1165 && weight == rhs.weight
1166 && normal == rhs.normal;
1171 inline bool b2ParticleContact::ApproximatelyEqual(
1174 static const float MAX_WEIGHT_DIFF = 0.01f;
1175 static const float MAX_NORMAL_DIFF = 0.01f;
1176 return indexA == rhs.indexA
1177 && indexB == rhs.indexB
1178 && flags == rhs.flags
1179 && b2Abs(weight - rhs.weight) < MAX_WEIGHT_DIFF
1180 && (normal - rhs.normal).Length() < MAX_NORMAL_DIFF;
1195 return m_groupCount;
1215 return m_contactBuffer.Data();
1218 inline int32 b2ParticleSystem::GetContactCount()
const
1220 return m_contactBuffer.GetCount();
1225 return m_bodyContactBuffer.Data();
1228 inline int32 b2ParticleSystem::GetBodyContactCount()
const
1230 return m_bodyContactBuffer.GetCount();
1235 return m_pairBuffer.Data();
1238 inline int32 b2ParticleSystem::GetPairCount()
const
1240 return m_pairBuffer.GetCount();
1245 return m_triadBuffer.Data();
1248 inline int32 b2ParticleSystem::GetTriadCount()
const
1250 return m_triadBuffer.GetCount();
1265 return m_stuckParticleBuffer.Data();
1270 return m_stuckParticleBuffer.GetCount();
1285 m_particleDiameter = 2 * radius;
1286 m_squaredDiameter = m_particleDiameter * m_particleDiameter;
1287 m_inverseDiameter = 1 / m_particleDiameter;
1293 m_inverseDensity = 1 / m_def.
density;
1333 return m_particleDiameter / 2;
1336 inline float32 b2ParticleSystem::GetCriticalVelocity(
const b2TimeStep& step)
const
1338 return m_particleDiameter * step.inv_dt;
1341 inline float32 b2ParticleSystem::GetCriticalVelocitySquared(
1344 float32 velocity = GetCriticalVelocity(step);
1345 return velocity * velocity;
1348 inline float32 b2ParticleSystem::GetCriticalPressure(
const b2TimeStep& step)
const
1350 return m_def.
density * GetCriticalVelocitySquared(step);
1353 inline float32 b2ParticleSystem::GetParticleStride()
const
1358 inline float32 b2ParticleSystem::GetParticleMass()
const
1360 float32 stride = GetParticleStride();
1361 return m_def.
density * stride * stride;
1364 inline float32 b2ParticleSystem::GetParticleInvMass()
const
1368 return m_inverseDensity * inverseStride * inverseStride;
1373 return m_positionBuffer.data;
1378 return m_velocityBuffer.data;
1383 return m_weightBuffer;
1393 b2Assert(m_count <= count);
1399 return m_allParticleFlags;
1404 return m_allGroupFlags;
1409 return m_flagsBuffer.data;
1414 return m_positionBuffer.data;
1419 return m_velocityBuffer.data;
1429 return m_groupBuffer;
1434 return m_weightBuffer;
1444 return m_groupBuffer;
1452 inline bool b2ParticleSystem::ValidateParticleIndex(
const int32 index)
const
1472 #if LIQUIDFUN_EXTERNAL_LANGUAGE_API
1474 inline void b2ParticleSystem::SetParticleVelocity(int32 index,
1483 inline float b2ParticleSystem::GetParticlePositionX(int32 index)
const
1488 inline float b2ParticleSystem::GetParticlePositionY(int32 index)
const
1493 inline int b2ParticleSystem::CopyPositionBuffer(
int startIndex,
1498 int copySize = numParticles *
sizeof(
b2Vec2);
1500 return CopyBuffer(startIndex, numParticles, inBufWithOffset, outBuf, size,
1504 inline int b2ParticleSystem::CopyColorBuffer(
int startIndex,
1511 return CopyBuffer(startIndex, numParticles, inBufWithOffset, outBuf, size,
1515 inline int b2ParticleSystem::CopyWeightBuffer(
int startIndex,
1520 int copySize = numParticles *
sizeof(float32);
1522 return CopyBuffer(startIndex, numParticles, inBufWithOffset, outBuf, size,
1526 inline int b2ParticleSystem::CopyBuffer(
int startIndex,
int numParticles,
1527 void* inBufWithOffset,
void* outBuf,
1528 int outBufSize,
int copySize)
const
1530 b2ExceptionType exception = IsBufCopyValid(startIndex, numParticles,
1531 copySize, outBufSize);
1532 if (exception != b2_noExceptions)
1537 memcpy(outBuf, inBufWithOffset, copySize);
1538 return b2_noExceptions;
1541 #endif // LIQUIDFUN_EXTERNAL_LANGUAGE_API
float32 gravityScale
Definition: b2ParticleSystem.h:193
const int32 * GetExpirationTimeBuffer()
Definition: b2ParticleSystem.cpp:4274
float32 ExpirationTimeToLifetime(const int32 expirationTime) const
Definition: b2ParticleSystem.cpp:4256
Prevents other particles from leaking.
Definition: b2Particle.h:54
void SetPaused(bool paused)
Definition: b2ParticleSystem.h:1203
float32 radius
Particles behave as circles with this radius. In Box2D units.
Definition: b2ParticleSystem.h:196
Connection between two particles.
Definition: b2ParticleSystem.h:121
uint32 flags
The logical sum of the particle flags. See the b2ParticleFlag enum.
Definition: b2ParticleSystem.h:143
void ApplyForce(int32 firstIndex, int32 lastIndex, const b2Vec2 &force)
Definition: b2ParticleSystem.cpp:4434
const uint32 * GetFlagsBuffer() const
Definition: b2ParticleSystem.h:1407
b2Vec2 * GetVelocityBuffer()
Definition: b2ParticleSystem.h:1376
Definition: b2ParticleSystem.h:153
void ParticleApplyLinearImpulse(int32 index, const b2Vec2 &impulse)
Definition: b2ParticleSystem.h:1463
float32 repulsiveStrength
Definition: b2ParticleSystem.h:237
float32 GetRadius() const
Get the particle radius.
Definition: b2ParticleSystem.h:1331
float32 lifetimeGranularity
Definition: b2ParticleSystem.h:277
void SetDensity(float32 density)
Definition: b2ParticleSystem.h:1290
float32 density
Definition: b2ParticleSystem.h:189
const b2ParticleHandle * GetParticleHandleFromIndex(const int32 index)
Retrieve a handle to the particle at the specified index.
Definition: b2ParticleSystem.cpp:748
Definition: b2ParticleGroup.h:54
int32 maxCount
Definition: b2ParticleSystem.h:202
float32 ComputeCollisionEnergy() const
Compute the kinetic energy that can be lost by damping force.
Definition: b2ParticleSystem.cpp:4581
Definition: b2WorldCallbacks.h:241
uint32 flags
The logical sum of the particle flags. See the b2ParticleFlag enum.
Definition: b2ParticleSystem.h:127
b2ParticleColor * GetColorBuffer()
Definition: b2ParticleSystem.cpp:558
float32 * GetWeightBuffer()
Definition: b2ParticleSystem.h:1381
void RayCast(b2RayCastCallback *callback, const b2Vec2 &point1, const b2Vec2 &point2) const
Definition: b2ParticleSystem.cpp:4527
void SetParticleLifetime(const int32 index, const float32 lifetime)
Definition: b2ParticleSystem.cpp:4220
b2ParticleGroup * GetParticleGroupList()
Definition: b2ParticleSystem.h:1183
uint32 GetAllGroupFlags() const
Get all existing particle group flags.
Definition: b2ParticleSystem.h:1402
float32 weight
Weight of the contact. A value between 0.0f and 1.0f.
Definition: b2ParticleSystem.h:111
Definition: b2StackAllocator.h:37
Definition: b2ParticleSystem.h:281
int32 staticPressureIterations
Definition: b2ParticleSystem.h:259
bool strictContactCheck
Definition: b2ParticleSystem.h:185
b2ParticleGroup * CreateParticleGroup(const b2ParticleGroupDef &def)
Definition: b2ParticleSystem.cpp:1043
int32 GetStuckCandidateCount() const
Get the number of stuck particle candidates from the last step.
Definition: b2ParticleSystem.h:1268
void ComputeAABB(b2AABB *const aabb) const
Definition: b2ParticleSystem.cpp:2336
uint32 GetParticleFlags(const int32 index)
Get flags for a particle. See the b2ParticleFlag enum.
Definition: b2ParticleSystem.h:1447
Definition: b2BlockAllocator.h:36
float32 GetParticleLifetime(const int32 index)
Definition: b2ParticleSystem.cpp:4266
float32 distance
The initial distance of the particles.
Definition: b2ParticleSystem.h:133
void QueryShapeAABB(b2QueryCallback *callback, const b2Shape &shape, const b2Transform &xf) const
Definition: b2ParticleSystem.cpp:4518
b2Vec2 pa
Values used for calculation.
Definition: b2ParticleSystem.h:149
With restitution from deformation.
Definition: b2Particle.h:42
bool GetStrictContactCheck() const
Get the status of the strict contact check.
Definition: b2ParticleSystem.h:1278
float32 colorMixingStrength
Definition: b2ParticleSystem.h:264
float32 powderStrength
Definition: b2ParticleSystem.h:241
bool GetDestructionByAge() const
Definition: b2ParticleSystem.h:1458
int32 index
Index of the particle making contact.
Definition: b2ParticleSystem.h:102
void SetMaxParticleCount(int32 count)
Definition: b2ParticleSystem.h:1391
void ParticleApplyForce(int32 index, const b2Vec2 &force)
Definition: b2ParticleSystem.cpp:4462
float32 staticPressureRelaxation
Definition: b2ParticleSystem.h:255
Definition: b2Particle.h:272
b2Vec2 normal
The normalized direction from the particle to the body.
Definition: b2ParticleSystem.h:114
Small color object for each particle.
Definition: b2Particle.h:81
Without isotropic pressure.
Definition: b2Particle.h:46
void SetParticleFlags(int32 index, uint32 flags)
Set flags for a particle. See the b2ParticleFlag enum.
Definition: b2ParticleSystem.cpp:4364
float32 strength
The strength of cohesion among the particles.
Definition: b2ParticleSystem.h:130
float32 pressureStrength
Definition: b2ParticleSystem.h:206
uint32 GetAllParticleFlags() const
Get all existing particle flags.
Definition: b2ParticleSystem.h:1397
float32 ejectionStrength
Definition: b2ParticleSystem.h:245
b2Fixture * fixture
The specific fixture making contact.
Definition: b2ParticleSystem.h:108
float32 mass
The effective mass used in calculating force.
Definition: b2ParticleSystem.h:117
Connection between three particles.
Definition: b2ParticleSystem.h:137
const int32 * GetStuckCandidates() const
Definition: b2ParticleSystem.h:1263
void SetDamping(float32 damping)
Definition: b2ParticleSystem.h:1311
int32 GetParticleCount() const
Get the number of particles.
Definition: b2ParticleSystem.h:1198
void ** GetUserDataBuffer()
Definition: b2ParticleSystem.cpp:564
With surface tension.
Definition: b2Particle.h:48
A group of particles. b2ParticleGroup::CreateParticleGroup creates these.
Definition: b2ParticleGroup.h:172
float32 dampingStrength
Definition: b2ParticleSystem.h:210
An axis aligned bounding box.
Definition: b2Collision.h:162
int32 DestroyParticlesInShape(const b2Shape &shape, const b2Transform &xf)
Definition: b2ParticleSystem.h:331
void SetFlagsBuffer(uint32 *buffer, int32 capacity)
Definition: b2ParticleSystem.cpp:4336
float32 GetGravityScale() const
Get the particle gravity scale.
Definition: b2ParticleSystem.h:1306
const b2ParticleBodyContact * GetBodyContacts() const
Definition: b2ParticleSystem.h:1223
This is an internal structure.
Definition: b2TimeStep.h:39
b2Vec2 * GetPositionBuffer()
Definition: b2ParticleSystem.h:1371
Less compressibility.
Definition: b2Particle.h:56
int32 GetParticleGroupCount() const
Get the number of particle groups.
Definition: b2ParticleSystem.h:1193
float32 viscousStrength
Definition: b2ParticleSystem.h:222
int32 GetMaxParticleCount() const
Get the maximum number of particles.
Definition: b2ParticleSystem.h:1386
bool destroyByAge
Definition: b2ParticleSystem.h:269
void DestroyOldestParticle(const int32 index, const bool callDestructionListener)
Definition: b2ParticleSystem.cpp:779
Definition: b2ParticleSystem.h:99
void SetRadius(float32 radius)
Definition: b2ParticleSystem.h:1283
int32 GetStaticPressureIterations() const
Get the number of iterations for static pressure of particles.
Definition: b2ParticleSystem.h:1326
const b2ParticleTriad * GetTriads() const
Definition: b2ParticleSystem.h:1243
#define b2_particleStride
The default distance between particles, multiplied by the particle diameter.
Definition: b2Settings.h:177
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:132
int32 indexA
Indices of the respective particles making pair.
Definition: b2ParticleSystem.h:124
bool GetPaused() const
Definition: b2ParticleSystem.h:1208
void SetStaticPressureIterations(int32 iterations)
Definition: b2ParticleSystem.h:1321
float32 surfaceTensionNormalStrength
Definition: b2ParticleSystem.h:231
void SetDestructionByAge(const bool enable)
Definition: b2ParticleSystem.cpp:4301
With restitution from stretching.
Definition: b2Particle.h:40
void SetStuckThreshold(int32 iterations)
Definition: b2ParticleSystem.cpp:4600
float32 staticPressureStrength
Definition: b2ParticleSystem.h:251
b2ParticleGroup *const * GetGroupBuffer()
Definition: b2ParticleSystem.h:1442
b2Body * body
The body making contact.
Definition: b2ParticleSystem.h:105
int32 CreateParticle(const b2ParticleDef &def)
Definition: b2ParticleSystem.cpp:637
float32 springStrength
Definition: b2ParticleSystem.h:218
Definition: b2ParticleSystem.h:53
A 2D column vector.
Definition: b2Math.h:56
void JoinParticleGroups(b2ParticleGroup *groupA, b2ParticleGroup *groupB)
Definition: b2ParticleSystem.cpp:1111
void SplitParticleGroup(b2ParticleGroup *group)
Definition: b2ParticleSystem.cpp:1163
#define b2_invalidParticleIndex
NEON SIMD requires 16-bit particle indices.
Definition: b2Settings.h:168
int32 indexA
Indices of the respective particles making triad.
Definition: b2ParticleSystem.h:140
void ApplyLinearImpulse(int32 firstIndex, int32 lastIndex, const b2Vec2 &impulse)
Definition: b2ParticleSystem.cpp:4472
float32 strength
The strength of cohesion among the particles.
Definition: b2ParticleSystem.h:146
float32 surfaceTensionPressureStrength
Definition: b2ParticleSystem.h:226
float32 GetDamping() const
Get damping for particles.
Definition: b2ParticleSystem.h:1316
const b2ParticlePair * GetPairs() const
Definition: b2ParticleSystem.h:1233
float32 elasticStrength
Definition: b2ParticleSystem.h:214
float32 GetDensity() const
Get the particle density.
Definition: b2ParticleSystem.h:1296
Definition: b2WorldCallbacks.h:208
void SetStrictContactCheck(bool enabled)
Definition: b2ParticleSystem.h:1273
b2ParticleSystem * GetNext()
Get the next particle-system in the world's particle-system list.
Definition: b2ParticleSystem.h:1253
void DestroyParticle(int32 index)
Definition: b2ParticleSystem.h:300
void QueryAABB(b2QueryCallback *callback, const b2AABB &aabb) const
Definition: b2ParticleSystem.cpp:4484
const b2ParticleContact * GetContacts() const
Definition: b2ParticleSystem.h:1213
const int32 * GetIndexByExpirationTimeBuffer()
Definition: b2ParticleSystem.cpp:4286
Definition: b2Particle.h:330
void SetGravityScale(float32 gravityScale)
Definition: b2ParticleSystem.h:1301
Definition: b2Fixture.h:108