Beispiel #1
0
void TerrainMaterialCompilationTask::updateSceneManagersAfterMaterialsChange()
{
    //We need to do this to prevent stale hashes in Ogre, which will lead to crashes during rendering.
    if (Ogre::Pass::getDirtyHashList().size() != 0 || Ogre::Pass::getPassGraveyard().size() != 0) {
        Ogre::SceneManagerEnumerator::SceneManagerIterator scenesIter = Ogre::Root::getSingleton().getSceneManagerIterator();

        while (scenesIter.hasMoreElements()) {
            Ogre::SceneManager* pScene = scenesIter.getNext();
            if (pScene) {
                Ogre::RenderQueue* pQueue = pScene->getRenderQueue();
                if (pQueue) {
                    Ogre::RenderQueue::QueueGroupIterator groupIter = pQueue->_getQueueGroupIterator();
                    while (groupIter.hasMoreElements()) {
                        Ogre::RenderQueueGroup* pGroup = groupIter.getNext();
                        if (pGroup)
                            pGroup->clear(false);
                    }//end_while(groupIter.hasMoreElements())
                }//end_if(pScene)
            }//end_if(pScene)
        }//end_while(scenesIter.hasMoreElements())

        // Now trigger the pending pass updates
        Ogre::Pass::processPendingPassUpdates();

    }//end_if(m_Root..
}
Beispiel #2
0
	void COgreManager::updateSceneManagersAfterMaterialsChange()
	{
		if(Root::getSingletonPtr() && (Ogre::Pass::getDirtyHashList().size()!=0 || Ogre::Pass::getPassGraveyard().size()!=0))
		{
			Ogre::SceneManagerEnumerator::SceneManagerIterator scenesIter = Root::getSingletonPtr()->getSceneManagerIterator();

			while(scenesIter.hasMoreElements())
			{
				Ogre::SceneManager* pScene = scenesIter.getNext();
				if(pScene)
				{
					Ogre::RenderQueue* pQueue = pScene->getRenderQueue();
					if(pQueue)
					{
						Ogre::RenderQueue::QueueGroupIterator groupIter = pQueue->_getQueueGroupIterator();
						while(groupIter.hasMoreElements())
						{
							Ogre::RenderQueueGroup* pGroup = groupIter.getNext();
							if(pGroup)
								pGroup->clear(false);
						}//end_while(groupIter.hasMoreElements())
					}//end_if(pScene)
				}//end_if(pScene)
			}//end_while(scenesIter.hasMoreElements())      

			// Now trigger the pending pass updates
			Ogre::Pass::processPendingPassUpdates();

		}//end_if(m_Root..
	}
void updateSceneManagersAfterMaterialsChange()
{
    Ogre::SceneManagerEnumerator::SceneManagerIterator scenesIter = Ogre::Root::getSingletonPtr()->getSceneManagerIterator();

    while(scenesIter.hasMoreElements())
    {
        Ogre::SceneManager* pScene = scenesIter.getNext();
        if(pScene)
        {
            Ogre::RenderQueue* pQueue = pScene->getRenderQueue();
            if(pQueue)
            {
                Ogre::RenderQueue::QueueGroupIterator groupIter = pQueue->_getQueueGroupIterator();
                while(groupIter.hasMoreElements())
                {
                    Ogre::RenderQueueGroup* pGroup = groupIter.getNext();
                    if(pGroup)
                    {
                        pGroup->clear(true);
                    }
                }
            }
        }
    }

    // Now trigger the pending pass updates
    Ogre::Pass::processPendingPassUpdates();


}