Esempio n. 1
0
void dgWorld::ResetBroadPhase()
{
	dgBroadPhase* newBroadPhase = NULL;

	switch (GetBroadPhaseType())
	{
		case m_broadphaseSegregated:
			newBroadPhase = new (m_allocator) dgBroadPhaseSegregated (this);
			break;

		case m_broadphaseMixed:
		default:
			newBroadPhase = new (m_allocator) dgBroadPhaseMixed(this);
			break;
	}

	m_broadPhase->MoveNodes(newBroadPhase);
	delete m_broadPhase;
	m_broadPhase = newBroadPhase;
}
Esempio n. 2
0
void dgWorld::SetBroadPhaseType(dgInt32 type)
{
	if (type != GetBroadPhaseType()) {
		dgBroadPhase* newBroadPhase = NULL;
		
		switch (type)
		{
			case m_persistentBroadphase:
				newBroadPhase = new (m_allocator) dgBroadPhasePersistent(this);
				break;

			case m_defaultBroadphase:
			default:
				newBroadPhase = new (m_allocator) dgBroadPhaseDefault(this);
				break;
		}

		m_broadPhase->MoveNodes(newBroadPhase);
		delete m_broadPhase;
		m_broadPhase = newBroadPhase;
	}
}