예제 #1
0
    bool CompositionHandler::AddCompositor(const std::string &compositor, Ogre::Viewport *vp, int position)
    {
        bool succesfull = false;

        if (c_manager_!=0 && vp != 0)
        {
            Ogre::CompositorInstance* comp = c_manager_->addCompositor(vp, compositor, position);
            if(comp != 0)
            {
                if(compositor == "HDR" || compositor == "Strong HDR")
                {
                    comp->addListener(&hdr_listener_);
                    hdr_listener_.notifyViewportSize(vp->getActualWidth(), vp->getActualHeight());
                    hdr_listener_.notifyCompositor(comp);
                }
                else if(compositor == "Gaussian Blur")
                {
                    comp->addListener(&gaussian_listener_);
                    gaussian_listener_.notifyViewportSize(vp->getActualWidth(), vp->getActualHeight());
                }

                c_manager_->setCompositorEnabled(vp, compositor, true);
                succesfull=true;
            }
        }
        
        if (!succesfull)
            ::LogWarning("Failed to enable effect: " + compositor);
        
        return succesfull;
    }
예제 #2
0
	void Main::InitCompositor()
	{
		mSceneRenderCompositor = Ogre::CompositorManager::getSingleton().addCompositor(GetViewport(), "RenderHDRScene");
		mSceneRenderCompositor->addListener(new VolumetricLightListener());
		Ogre::CompositorManager::getSingleton().setCompositorEnabled(GetViewport(), "RenderHDRScene", true);
		Ogre::CompositorInstance *hdrinstance = Ogre::CompositorManager::getSingleton().addCompositor(Main::Instance().GetViewport(), "DownsampleHDR1");
		HDRListener *hdrListener = new HDRListener(); 
		hdrinstance->addListener(hdrListener);
		hdrListener->notifyViewportSize(mViewport->getActualWidth(), mViewport->getActualHeight());
		hdrListener->notifyCompositor(hdrinstance);
		Ogre::CompositorManager::getSingleton().setCompositorEnabled(GetViewport(), "DownsampleHDR1", true);
	}
예제 #3
0
		void PostEffect::AssignToViewport(Viewport& viewport)
		{
			#if defined ION_RENDERER_OGRE3D
			Ogre::CompositorInstance* compositorInstance = Ogre::CompositorManager::getSingleton().addCompositor(viewport.GetOgreViewportInterface(), mName.c_str());
			ion::debug::Assert(compositorInstance != NULL, "PostEffect::AssignToViewport() - Could not create compositor instance, did its materials load successfully?");
			compositorInstance->setEnabled(true);

			if(mOgreCompositorListener)
			{
				compositorInstance->addListener(mOgreCompositorListener);
			}
			#endif
		}