示例#1
0
void World::CleanupRenderables()
{
	RenderableIterator it = theWorld.GetFirstRenderable();
	while (it != theWorld.GetLastRenderable())
	{
		if ((*it)->IsDestroyed())
		{
			//delete *it; 
			it = it.erase(it);
		}
		else
		{
			++it;
		}
	}
}
示例#2
0
void World::UnloadAll()
{
	RenderableIterator it = theWorld.GetFirstRenderable();
	while (it != GetLastRenderable())
	{
		Renderable* renderable = (*it);
		if( _gameManager != NULL && _gameManager->IsProtectedFromUnloadAll(renderable))
		{
			// Let the persistent actors know that we're unloading the level.
			Actor* actor = dynamic_cast<Actor*>(renderable);
			if (actor)
				actor->LevelUnloaded();
			++it;
			continue;
		}

		it = it.erase( it );
		renderable->Destroy();
		delete renderable;
	}

	PurgeDebugDrawing();
}