Exemplo n.º 1
0
void b2World::DrawParticleSystem(const b2ParticleSystem& system)
{
	int32 particleCount = system.GetParticleCount();
	if (particleCount)
	{
		float32 radius = system.GetRadius();
		const b2Vec2* positionBuffer = system.GetPositionBuffer();
		if (system.m_colorBuffer.data)
		{
			const b2ParticleColor* colorBuffer = system.GetColorBuffer();
			m_debugDraw->DrawParticles(positionBuffer, radius, colorBuffer, particleCount);
		}
		else
		{
			m_debugDraw->DrawParticles(positionBuffer, radius, NULL, particleCount);
		}
	}
}
Exemplo n.º 2
0
int32
ConfinementTests::TestLeakCount()
{
	for (int32 t = 0; t < NUMBER_OF_STEPS; t++) {
		m_world->Step(DELTA_T, 1, 1);
	}
	int32 bufferIndex = m_particleGroup->GetBufferIndex();
	int32 particleCount = m_particleGroup->GetParticleCount();
	const b2Vec2 *positionBuffer = m_particleSystem->GetPositionBuffer();
	int32 leakCount = 0;
	for (int32 i = 0; i < particleCount; i++) {
		b2Vec2 p = positionBuffer[bufferIndex + i];
		if (std::abs(p.x) > WIDTH || std::abs(p.y) > HEIGHT) {
			leakCount++;
		}
	}
	return leakCount;
}