//----------------------------------------------------------------------- void PagingLandScapeRenderableManager::processTileUnload() { if (mTilesLoadRenderableQueue.empty()) return; PagingLandScapeTile *tile; for (PagingLandScapeQueue<PagingLandScapeTile>::MsgQueType::iterator itq = mTilesLoadRenderableQueue.begin(); itq != mTilesLoadRenderableQueue.end();) { tile = *itq; assert (tile != 0); assert (tile->isLoading()); assert (tile->getRenderable ()); assert (tile->getRenderable ()->mQueued); assert (tile->isLoaded ()); assert (tile->getSceneNode()); assert (!tile->getRenderable ()->isLoaded ()); if (!tile->getRenderable ()->isInUse ()) { tile->setLoading (false); tile->getRenderable ()->mQueued = false; tile->unload (); itq = mTilesLoadRenderableQueue.erase (itq); } else { ++itq; } } }
//----------------------------------------------------------------------- bool PagingLandScapeRenderableManager::executeRenderableLoading(void) { if (mTilesLoadQueue.empty()) return true; else { const uint k = PagingLandScapeOptions::getSingleton ().num_renderables_loading; for (uint i = 0; i < k; i++ ) { PagingLandScapeTile* tile = mTilesLoadQueue.pop (); // no more in queues. if (tile == 0) return true; assert (tile->isLoaded ()); PagingLandScapeRenderable* rend = tile->getRenderable(); assert (!rend->isLoaded ()); SceneNode * tileSceneNode = tile->getTileNode (); assert (rend != 0 && tileSceneNode != 0); tileSceneNode->attachObject( rend ); // renderables need to be attached (BBox compute) if (rend->load()) { tile->_linkRenderableNeighbor (); } else { // renderable have been unloaded since. tile->unload (); } tileSceneNode->needUpdate(); } } return false; }