//-----------------------------------------------------------------------
void CompositorChain::createOriginalScene()
{
    /// Create "default" compositor
    /** Compositor that is used to implicitly represent the original
        render in the chain. This is an identity compositor with only an output pass:
    compositor Ogre/Scene
    {
        technique
        {
            target_output
            {
				pass clear
				{
					/// Clear frame
				}
                pass render_scene
                {
					visibility_mask FFFFFFFF
					render_queues SKIES_EARLY SKIES_LATE
                }
            }
        }
    };
    */

	mOriginalSceneScheme = mViewport->getMaterialScheme();
	String compName = "Ogre/Scene/" + mOriginalSceneScheme;
	CompositorPtr scene = CompositorManager::getSingleton().getByName(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
	if (scene.isNull())
	{
		scene = CompositorManager::getSingleton().create(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
		CompositionTechnique *t = scene->createTechnique();
		t->setSchemeName(StringUtil::BLANK);
		CompositionTargetPass *tp = t->getOutputTargetPass();
		tp->setVisibilityMask(0xFFFFFFFF);
		{
			CompositionPass *pass = tp->createPass();
			pass->setType(CompositionPass::PT_CLEAR);
		}
		{
			CompositionPass *pass = tp->createPass();
			pass->setType(CompositionPass::PT_RENDERSCENE);
			/// Render everything, including skies
			pass->setFirstRenderQueue(RENDER_QUEUE_BACKGROUND);
			pass->setLastRenderQueue(RENDER_QUEUE_SKIES_LATE);
		}


		/// Create base "original scene" compositor
		scene = CompositorManager::getSingleton().load(compName,
			ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);



	}
	mOriginalScene = OGRE_NEW CompositorInstance(scene->getSupportedTechnique(), this);
}
示例#2
0
//-----------------------------------------------------------------------
void CompositorChain::createOriginalScene()
{
    /// Create "default" compositor
    /** Compositor that is used to implicitly represent the original
        render in the chain. This is an identity compositor with only an output pass:
    compositor Ogre/Scene
    {
        technique
        {
            target_output
            {
    			pass clear
    			{
    				/// Clear frame
    			}
                pass render_scene
                {
    				visibility_mask FFFFFFFF
    				render_queues SKIES_EARLY SKIES_LATE
                }
            }
        }
    };
    */

    // If two viewports use the same scheme but differ in settings like visibility masks, shadows, etc we don't
    // want compositors to share their technique.  Otherwise both compositors will have to recompile every time they
    // render.  Thus we generate a unique compositor per viewport.
    String compName("Ogre/Scene/");
    compName += StringConverter::toString((intptr_t)mViewport);

    mOriginalSceneScheme = mViewport->getMaterialScheme();
    CompositorPtr scene = CompositorManager::getSingleton().getByName(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
    if (scene.isNull())
    {
        scene = CompositorManager::getSingleton().create(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
        CompositionTechnique *t = scene->createTechnique();
        t->setSchemeName(StringUtil::BLANK);
        CompositionTargetPass *tp = t->getOutputTargetPass();
        tp->setVisibilityMask(0xFFFFFFFF);
        {
            CompositionPass *pass = tp->createPass();
            pass->setType(CompositionPass::PT_CLEAR);
        }
        {
            CompositionPass *pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERSCENE);
            /// Render everything, including skies
            pass->setFirstRenderQueue(RENDER_QUEUE_BACKGROUND);
            pass->setLastRenderQueue(RENDER_QUEUE_SKIES_LATE);
        }


        /// Create base "original scene" compositor
        scene = CompositorManager::getSingleton().load(compName,
                ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);



    }
    mOriginalScene = OGRE_NEW CompositorInstance(scene->getSupportedTechnique(), this);
}