void GodRaysManager::remove()
	{
		if (!mCreated)
		{
			return;
		}

		delete mPerlin;
		mPerlin = static_cast<Noise::Perlin*>(NULL);

		mHydrax->getSceneManager()->destroyManualObject(mManualGodRays);
		mManualGodRays = static_cast<Ogre::ManualObject*>(NULL);

		if (Ogre::MaterialManager::getSingleton().resourceExists(_def_GodRays_Material_Name))
		{
			Ogre::MaterialManager::getSingleton().remove(_def_GodRays_Material_Name);

			Ogre::HighLevelGpuProgramManager::getSingleton().unload(_def_GodRays_Shader_VP_Name);
		    Ogre::HighLevelGpuProgramManager::getSingleton().unload(_def_GodRays_Shader_FP_Name);
			Ogre::HighLevelGpuProgramManager::getSingleton().remove(_def_GodRays_Shader_VP_Name);
		    Ogre::HighLevelGpuProgramManager::getSingleton().remove(_def_GodRays_Shader_FP_Name);
		}

		if (Ogre::MaterialManager::getSingleton().resourceExists(_def_GodRaysDepth_Material_Name))
		{
			Ogre::MaterialManager::getSingleton().remove(_def_GodRaysDepth_Material_Name);

			Ogre::HighLevelGpuProgramManager::getSingleton().unload(_def_GodRaysDepth_Shader_VP_Name);
		    Ogre::HighLevelGpuProgramManager::getSingleton().unload(_def_GodRaysDepth_Shader_FP_Name);
			Ogre::HighLevelGpuProgramManager::getSingleton().remove(_def_GodRaysDepth_Shader_VP_Name);
		    Ogre::HighLevelGpuProgramManager::getSingleton().remove(_def_GodRaysDepth_Shader_FP_Name);
		}

		for (int k = 0; k < 2; k++)
		{
			mMaterials[k].setNull();
		}

		if (!mProjectorRTT.isNull())
		{
			Ogre::RenderTarget* RT = mProjectorRTT->getBuffer()->getRenderTarget();
            RT->removeAllListeners();
            RT->removeAllViewports();

			Ogre::TextureManager::getSingleton().remove(mProjectorRTT->getName());
			mProjectorRTT.setNull();
		}

		mHydrax->getSceneManager()->destroyCamera(mProjectorCamera);
		mProjectorCamera = static_cast<Ogre::Camera*>(NULL);

		mProjectorSN->detachAllObjects();
		mProjectorSN->getParentSceneNode()->removeAndDestroyChild(mProjectorSN->getName());
		mProjectorSN = static_cast<Ogre::SceneNode*>(NULL);

		mCreated = false;
	}
示例#2
0
void RttManager::remove(const RttType& Rtt)
{
  Ogre::TexturePtr &Tex = mTextures[Rtt];

  if (!Tex.isNull()) {
    Ogre::RenderTarget* RT = Tex->getBuffer()->getRenderTarget();
    RT->removeAllListeners();
    RT->removeAllViewports();

    Ogre::TextureManager::getSingleton().remove(mRttOptions[Rtt].Name);
    Ogre::MeshManager::getSingleton().remove(mRttOptions[Rtt].Name + "ClipPlane");

    Tex.setNull();
    delete mPlanes[Rtt];
    mPlanes[Rtt] = static_cast<Ogre::MovablePlane*>(NULL);
  }

  // Check it to avoid any possible problem(texture initializated by createTextureUnit(Name..))
  if (Ogre::TextureManager::getSingleton().resourceExists(mRttOptions[Rtt].Name)) {
    Ogre::TextureManager::getSingleton().remove(mRttOptions[Rtt].Name);
  }
}