MCPcopy Create free account
hub / github.com/aardappel/lobster / SplitParticleGroup

Method SplitParticleGroup

dev/include/Box2D/Particle/b2ParticleSystem.cpp:1167–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165}
1166
1167void b2ParticleSystem::SplitParticleGroup(b2ParticleGroup* group)
1168{
1169 UpdateContacts(true);
1170 int32 particleCount = group->GetParticleCount();
1171 // We create several linked lists. Each list represents a set of connected
1172 // particles.
1173 ParticleListNode* nodeBuffer =
1174 (ParticleListNode*) m_world->m_stackAllocator.Allocate(
1175 sizeof(ParticleListNode) * particleCount);
1176 InitializeParticleLists(group, nodeBuffer);
1177 MergeParticleListsInContact(group, nodeBuffer);
1178 ParticleListNode* survivingList =
1179 FindLongestParticleList(group, nodeBuffer);
1180 MergeZombieParticleListNodes(group, nodeBuffer, survivingList);
1181 CreateParticleGroupsFromParticleList(group, nodeBuffer, survivingList);
1182 UpdatePairsAndTriadsWithParticleList(group, nodeBuffer);
1183 m_world->m_stackAllocator.Free(nodeBuffer);
1184}
1185
1186void b2ParticleSystem::InitializeParticleLists(
1187 const b2ParticleGroup* group, ParticleListNode* nodeBuffer)

Callers

nothing calls this directly

Calls 3

GetParticleCountMethod · 0.45
AllocateMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected