コード例 #1
0
	// 保存场景
	void TerrainEditorPlugin::onPreSaveScene(const String &fileName ,IScene *scene)
	{
		// 找到所有地形,保存之
		IScene::SceneObjectIterator iter = scene->getSceneObjectIterator();
		while(iter.hasMoreElements())
		{
			ISceneObject *obj = iter.getNext();
			if(obj->getType() == TerrainObjectFactory::FACTORY_TYPE)
			{
				TerrainObject *terrain = static_cast<TerrainObject*>(obj);

				String outBasename;
				String outExtention; 
				String outPath;
				StringUtil::splitFullFilename(fileName , outBasename , outExtention , outPath);
				removeTerrainBlockerPass(terrain->getOgreTerrain());
				terrain->save(outBasename);
				addTerrainBlockerPass(terrain->getOgreTerrain());
			}
		}
	}
コード例 #2
0
	// 新建场景
	void TerrainEditorPlugin::onNewScene(IScene *scene)
	{
		// 找到所有地形,激活之
		IScene::SceneObjectIterator iter = scene->getSceneObjectIterator();
		while(iter.hasMoreElements())
		{
			ISceneObject *obj = iter.getNext();
			if(obj->getType() == TerrainObjectFactory::FACTORY_TYPE)
			{
				TerrainObject *terrain = static_cast<TerrainObject*>(obj);
				activateTerrain(terrain->getOgreTerrain());
			}
		}
	}