Exemplo n.º 1
0
VOID CEngineInterface::Scene_Load(INT nID, const STRING& theSceneDefine)
{
	Fairy::ExpatParser parserExpat(NULL);
	
	if(m_pTerrainGrid)
	{
		m_pTerrainGrid->destroyRenderable();
	}
	// 卸载现有资源
	m_pFairySystem->resetScene();

	// 加载场景文件
	m_pFairySystem->loadSceneFromResource(&parserExpat, theSceneDefine.c_str(), "Scene");

	// 释放未使用资源
	{
		Ogre::ResourceGroupManager& resManager = Ogre::ResourceGroupManager::getSingleton();

		const Ogre::StringVector& strGroupVec = resManager.getResourceGroups();

		for(int i=0; i<(int)strGroupVec.size(); i++)
		{
			if( strGroupVec[i] != Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME &&
				strGroupVec[i] != Fairy::BOOTSTRAP_RESOURCE_GROUP_NAME)
			{
				resManager.unloadUnreferencedResourcesInGroup(strGroupVec[i]);
			}
		}
	}
	
	// 设置LightMap
	BOOL bHave = FALSE;
	INT qu = g_pVaribleSys->GetAs_Uint(szLightmapQualityVar, &bHave);
	if ( !bHave )
	{
		qu = 3;
	}
	Scene_SetLightmapQuality(qu);
	
	// 取得环境特效
	Fairy::SceneInfo::ObjectsByTypeRange objEnviroment = m_pFairySystem->getSceneInfo()->findObjectsByType("Enviroment");

	if (objEnviroment.first != objEnviroment.second)
	{
		m_pEnviromentObject = static_cast< Fairy::EnviromentObject * >(objEnviroment.first->get());
		KLAssert(m_pEnviromentObject);
	}
	else
	{
		m_pEnviromentObject = NULL;
	}
}
Exemplo n.º 2
0
VOID CRenderSystem::Scene_Load(INT nID, const STRING& theSceneDefine)
{
	WX::ExpatParser parserExpat(NULL);
	
	if(m_pTerrainGrid)
	{
		m_pTerrainGrid->destroyRenderable();
	}

	//卸载现有资源
	m_pRenderSystem->resetScene();

	//加载场景文件
	m_pRenderSystem->loadSceneFromResource(&parserExpat, theSceneDefine.c_str(), "General");

	//释放未使用资源
	{
		Ogre::ResourceGroupManager& resManager = Ogre::ResourceGroupManager::getSingleton();

		const Ogre::StringVector& strGroupVec = resManager.getResourceGroups();

		for(int i=0; i<(int)strGroupVec.size(); i++)
		{
			if( strGroupVec[i] != Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME &&
				strGroupVec[i] != Ogre::ResourceGroupManager::BOOTSTRAP_RESOURCE_GROUP_NAME)
			{
				resManager.unloadUnreferencedResourcesInGroup(strGroupVec[i]);
			}
		}
	}
	
	//设置LightMap
	m_pRenderSystem->getTerrain()->setLightmapQuality(WX::Terrain::LMQ_LOW);
	m_pRenderSystem->getTerrain()->buildGeometry(m_pRenderSystem->getBaseSceneNode());

	//取得环境特效
	WX::SceneInfo::ObjectsByTypeRange objEnviroment = 
		m_pRenderSystem->getSceneInfo()->findObjectsByType("Enviroment");

	if (objEnviroment.first != objEnviroment.second)
	{
		m_pEnviromentObject = static_cast< WX::EnviromentObject * >(objEnviroment.first->get());
		TDAssert(m_pEnviromentObject);
	}
	else
	{
		m_pEnviromentObject = NULL;
	}
}