当前位置: 首页>>代码示例>>C++>>正文


C++ CompositionPass类代码示例

本文整理汇总了C++中CompositionPass的典型用法代码示例。如果您正苦于以下问题:C++ CompositionPass类的具体用法?C++ CompositionPass怎么用?C++ CompositionPass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CompositionPass类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clearCompiledState

//-----------------------------------------------------------------------
void CompositorChain::_compile()
{
	clearCompiledState();

	bool compositorsEnabled = false;

	// force default scheme so materials for compositor quads will determined correctly
	MaterialManager& matMgr = MaterialManager::getSingleton();
	String prevMaterialScheme = matMgr.getActiveScheme();
	matMgr.setActiveScheme(MaterialManager::DEFAULT_SCHEME_NAME);
	
    /// Set previous CompositorInstance for each compositor in the list
    CompositorInstance *lastComposition = mOriginalScene;
	mOriginalScene->mPreviousInstance = 0;
	CompositionPass* pass = mOriginalScene->getTechnique()->getOutputTargetPass()->getPass(0);
	pass->setClearBuffers(mViewport->getClearBuffers());
	pass->setClearColour(mViewport->getBackgroundColour());
    for(Instances::iterator i=mInstances.begin(); i!=mInstances.end(); ++i)
    {
        if((*i)->getEnabled())
        {
			compositorsEnabled = true;
            (*i)->mPreviousInstance = lastComposition;
            lastComposition = (*i);
        }
    }
    

    /// Compile misc targets
    lastComposition->_compileTargetOperations(mCompiledState);
    
    /// Final target viewport (0)
	mOutputOperation.renderSystemOperations.clear();
    lastComposition->_compileOutputOperation(mOutputOperation);

	// Deal with viewport settings
	if (compositorsEnabled != mAnyCompositorsEnabled)
	{
		mAnyCompositorsEnabled = compositorsEnabled;
		if (mAnyCompositorsEnabled)
		{
			// Save old viewport clearing options
			mOldClearEveryFrameBuffers = mViewport->getClearBuffers();
			// Don't clear anything every frame since we have our own clear ops
			mViewport->setClearEveryFrame(false);
		}
		else
		{
			// Reset clearing options
			mViewport->setClearEveryFrame(mOldClearEveryFrameBuffers > 0, 
				mOldClearEveryFrameBuffers);
		}
	}

	// restore material scheme
	matMgr.setActiveScheme(prevMaterialScheme);

    
    mDirty = false;
}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:61,代码来源:OgreCompositorChain.cpp

示例2: fixCompositorClearColor

void TerrainManager::fixCompositorClearColor()
{
	// hack
	// now with extensive error checking
	if (CompositorManager::getSingleton().hasCompositorChain(gEnv->mainCamera->getViewport()))
	{
		//	//CompositorManager::getSingleton().getCompositorChain(gEnv->ogreCamera->getViewport())->getCompositor(0)->getTechnique()->getOutputTargetPass()->getPass(0)->setClearColour(fade_color);
		CompositorInstance *co = CompositorManager::getSingleton().getCompositorChain(gEnv->mainCamera->getViewport())->_getOriginalSceneCompositor();
		if (co)
		{
			CompositionTechnique *ct = co->getTechnique();
			if (ct)
			{
				CompositionTargetPass *ctp = ct->getOutputTargetPass();
				if (ctp)
				{
					CompositionPass *p = ctp->getPass(0);
					if (p)
					{
						p->setClearColour(fade_color);
					}
				}
			}
		}
	}
}
开发者ID:KinaMarie,项目名称:rigs-of-rods,代码行数:26,代码来源:TerrainManager.cpp

示例3: preViewportUpdate

//-----------------------------------------------------------------------
void CompositorChain::preViewportUpdate(const RenderTargetViewportEvent& evt)
{
	// Only set up if there is at least one compositor enabled, and it's this viewport
    if(evt.source != mViewport || !mAnyCompositorsEnabled)
        return;

	// set original scene details from viewport
	CompositionPass* pass = mOriginalScene->getTechnique()->getOutputTargetPass()->getPass(0);
	CompositionTargetPass* passParent = pass->getParent();
	if (pass->getClearBuffers() != mViewport->getClearBuffers() ||
		//pass->getClearColour() != mViewport->getBackgroundColour() ||
		//pass->getClearDepth() != mViewport->getDepthClear() ||
		passParent->getVisibilityMask() != mViewport->getVisibilityMask() ||
		passParent->getMaterialScheme() != mViewport->getMaterialScheme() ||
		passParent->getShadowsEnabled() != mViewport->getShadowsEnabled())
	{
		// recompile if viewport settings are different
		//pass->setClearBuffers(mViewport->getClearBuffers());
		//pass->setClearColour(mViewport->getBackgroundColour());
		//pass->setClearDepth(mViewport->getDepthClear());
		passParent->setVisibilityMask(mViewport->getVisibilityMask());
		passParent->setMaterialScheme(mViewport->getMaterialScheme());
		passParent->setShadowsEnabled(mViewport->getShadowsEnabled());
		_compile();
	}

	Camera *cam = mViewport->getCamera();
	if (cam)
	{
		/// Prepare for output operation
		preTargetOperation(mOutputOperation, mViewport, cam);
	}
}
开发者ID:dryadf68116,项目名称:vuforia-gamekit-integration,代码行数:34,代码来源:OgreCompositorChain.cpp

示例4: getPassIterator

//-----------------------------------------------------------------------
bool CompositionTargetPass::_isSupported(void)
{
    // A target pass is supported if all passes are supported

    PassIterator passi = getPassIterator();
    while (passi.hasMoreElements())
    {
        CompositionPass* pass = passi.getNext();
        if (!pass->_isSupported())
        {
            return false;
        }
    }

    return true;
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:17,代码来源:OgreCompositionTargetPass.cpp

示例5: while

//---------------------------------------------------------------------
bool CompositorManager::isInputToOutputTarget(CompositorInstance* inst, const Ogre::String& localName)
{
    CompositionTargetPass* tp = inst->getTechnique()->getOutputTargetPass();
    CompositionTargetPass::PassIterator pit = tp->getPassIterator();

    while(pit.hasMoreElements())
    {
        CompositionPass* p = pit.getNext();
        for (size_t i = 0; i < p->getNumInputs(); ++i)
        {
            if (p->getInput(i).name == localName)
                return true;
        }
    }

    return false;

}
开发者ID:Gerviba,项目名称:MuOnline,代码行数:19,代码来源:OgreCompositorManager.cpp

示例6: CreateTextureDef

void HDRCompositor::CalculateKey(void)
{
	CompositionTargetPass *tp;
	CompositionPass *pass;

	CreateTextureDef("Key",1,1,PF_FLOAT16_RGB);

	tp = m_HDRTechnique->createTargetPass();
	tp->setInputMode(CompositionTargetPass::IM_NONE);
	tp->setOutputName("Key");
	
	pass = tp->createPass();
	pass->setType(CompositionPass::PT_RENDERQUAD);
	if(m_AutoKeying)
	{
		pass->setMaterialName("AutoKey");
		pass->setInput(0,"Luminance");
	}
	else
	{
		pass->setIdentifier(MID_KEY);
		pass->setMaterialName("ManualKey");
//		GpuProgramParameters::RealConstantEntry* entry = pass->getMaterial()->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->getNamedRealConstantEntry("Key");
//		if(entry)
//			entry->val[0] = m_Key;
	}
	
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:28,代码来源:HDRCompositor.cpp

示例7: createOriginalScene

//-----------------------------------------------------------------------
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);
}
开发者ID:dryadf68116,项目名称:vuforia-gamekit-integration,代码行数:58,代码来源:OgreCompositorChain.cpp

示例8: _init

        void _init(void)
        {
            CompositorPtr compositor = CompositorManager::getSingleton().create(
                _theType(), ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
			CompositionTechnique *t;
            CompositionTechnique::TextureDefinition *td;
            CompositionTargetPass *tp;
            CompositionPass *pass;

            t = compositor->createTechnique();
            td = t->createTextureDefinition("scene");
            td->width.viewport = 1;
            td->height.viewport = 1;
            td->format = PF_X8R8G8B8;
            td = t->createTextureDefinition("heat");
            td->width.viewport = 0.5;
            td->height.viewport = 0.5;
            td->format = PF_X8R8G8B8;

            tp = t->createTargetPass();
            tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);
            tp->setOutputName("scene");

            tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            tp->setOutputName("heat");
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/HeatVision/LightToHeat");
            pass->setInput(0, "scene");
            pass->setIdentifier(0xDEADBADE);

            tp = t->getOutputTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/HeatVision/Blur");
            pass->setInput(0, "heat");
        }
开发者ID:brock7,项目名称:TianLong,代码行数:39,代码来源:WXHeatVisionPostFilter.cpp

示例9: FinalRendering

void HDRCompositor::FinalRendering(void)
{
	CompositionTargetPass *tp = m_HDRTechnique->getOutputTargetPass();
	tp->setInputMode(CompositionTargetPass::IM_NONE);
	
	CompositionPass *pass = tp->createPass();
	pass->setType(CompositionPass::PT_RENDERQUAD);

	if(m_ToneMapper == TM_NONE || m_DebugRendertarget)
        pass->setMaterialName("CompositorCopyback");
	else if(m_ToneMapper == TM_LINEAR)
		pass->setMaterialName("HDRFinalLinear");
	else if(m_ToneMapper == TM_REINHARDS)
		pass->setMaterialName("HDRFinalReinh");
	else if(m_ToneMapper == TM_REINHARDSMOD)
		pass->setMaterialName("HDRFinalReinhMod");
	else if(m_ToneMapper == TM_LOG)
		pass->setMaterialName("HDRFinalLog");
	else if(m_ToneMapper == TM_ADAPTLOG)
		pass->setMaterialName("HDRFinalAdaptiveLog");
	else if(m_ToneMapper == TM_REINHARDLOCAL)
		pass->setMaterialName("HDRFinalReinhLocal");

	if(m_DebugRendertarget == 1)
		pass->setInput(0,"scenedown4");
	else if(m_DebugRendertarget == 2)
		pass->setInput(0,"Lumscale1");
	else if(m_DebugRendertarget == 3)
		pass->setInput(0,"Lumscale2");
	else if(m_DebugRendertarget == 4)
		pass->setInput(0,"Lumscale4");
	else if(m_DebugRendertarget == 5)
		pass->setInput(0,"scale0");
	else if(m_DebugRendertarget == 6)
		pass->setInput(0,"scale1");
	else if(m_DebugRendertarget == 7)
		pass->setInput(0,"scale2");
	else if(m_DebugRendertarget == 8)
		pass->setInput(0,"scale6");
	/*else if(m_DebugRendertarget == 2)
		pass->setInput(0,"Lum64");
	else if(m_DebugRendertarget == 3)
		pass->setInput(0,"Lum16");
	else if(m_DebugRendertarget == 4)
		pass->setInput(0,"Lum4");
	else if(m_DebugRendertarget == 5)
		pass->setInput(0,"Luminance");
	else if(m_DebugRendertarget == 6)
		pass->setInput(0,"Bright");
	else if(m_DebugRendertarget == 7)
		pass->setInput(0,"Glare");
	else if(m_DebugRendertarget == 8)
		pass->setInput(0,"Star");*/
	else
	{
		pass->setInput(0,"Scene",0);

		if(m_ToneMapper != TM_NONE)
		{
			if(m_ToneMapper == TM_REINHARDLOCAL)
			{
				pass->setInput(0, "Lumscale1");

				pass->setInput(1,"Key");

				if(m_GlareType != GT_NONE)
					pass->setInput(2,"Glare");
				if(m_StarType != GT_NONE)
					pass->setInput(3,"Star");

				pass->setInput(4, "LocalAdaptMap");
			}
			else
			{
				if(m_LumAdaption)
					pass->setInput(1, "AdaptedLum");
				else
					pass->setInput(1, "Luminance");
				pass->setInput(2, "Key");
			}
		}

		if(m_ToneMapper != TM_REINHARDLOCAL)
		{
			if(m_GlareType != GT_NONE)
				pass->setInput(3,"Glare");

			if(m_StarType != GT_NONE)
				pass->setInput(4,"Star");
		}
	}

	pass->setIdentifier(MID_FINAL);
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:94,代码来源:HDRCompositor.cpp

示例10: while

//---------------------------------------------------------------------
void CompositorInstance::deriveTextureRenderTargetOptions(
	const String& texname, bool *hwGammaWrite, uint *fsaa)
{
	// search for passes on this texture def that either include a render_scene
	// or use input previous
	bool renderingScene = false;

	CompositionTechnique::TargetPassIterator it = mTechnique->getTargetPassIterator();
	while (it.hasMoreElements())
	{
		CompositionTargetPass* tp = it.getNext();
		if (tp->getOutputName() == texname)
		{
			if (tp->getInputMode() == CompositionTargetPass::IM_PREVIOUS)
			{
				// this may be rendering the scene implicitly
				// Can't check mPreviousInstance against mChain->_getOriginalSceneCompositor()
				// at this time, so check the position
				CompositorChain::InstanceIterator instit = mChain->getCompositors();
				renderingScene = true;
				while(instit.hasMoreElements())
				{
					CompositorInstance* inst = instit.getNext();
					if (inst == this)
						break;
					else if (inst->getEnabled())
					{
						// nope, we have another compositor before us, this will
						// be doing the AA
						renderingScene = false;
					}
				}
				if (renderingScene)
					break;
			}
			else
			{
				// look for a render_scene pass
				CompositionTargetPass::PassIterator pit = tp->getPassIterator();
				while(pit.hasMoreElements())
				{
					CompositionPass* pass = pit.getNext();
					if (pass->getType() == CompositionPass::PT_RENDERSCENE)
					{
						renderingScene = true;
						break;
					}
				}
			}

		}
	}

	if (renderingScene)
	{
		// Ok, inherit settings from target
		RenderTarget* target = mChain->getViewport()->getTarget();
		*hwGammaWrite = target->isHardwareGammaEnabled();
		*fsaa = target->getFSAA();
	}
	else
	{
		*hwGammaWrite = false;
		*fsaa = 0;
	}

}
开发者ID:masonh,项目名称:marblemax,代码行数:68,代码来源:OgreCompositorInstance.cpp

示例11: refreshCompositor


//.........这里部分代码省略.........
			def->height = 0;
			def->formatList.push_back(PF_R8G8B8);
		}
		{
			CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("sum");
			def->width = 0;
			def->height = 0;
			def->formatList.push_back(PF_R8G8B8);
		}
		{
			CompositionTechnique::TextureDefinition *def = t->createTextureDefinition("temp");
			def->width = 0;
			def->height = 0;
			def->formatList.push_back(PF_R8G8B8);
		}
		/// Render scene
		{
			CompositionTargetPass *tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);
			tp->setOutputName("scene");
		}
		/// Initialisation pass for sum texture
		{
			CompositionTargetPass *tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);
			tp->setOutputName("sum");
			tp->setOnlyInitial(true);
		}
		/// Do the motion blur
		{
			CompositionTargetPass *tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
			tp->setOutputName("temp");
			{ CompositionPass *pass = tp->createPass();
			pass->setType(CompositionPass::PT_RENDERQUAD);
			pass->setMaterialName("Ogre/Compositor/Combine");
			pass->setIdentifier(120);
			pass->setInput(0, "scene");
			pass->setInput(1, "sum");
			}
		}
		/// Copy back sum texture
		{
			CompositionTargetPass *tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
			tp->setOutputName("sum");
			{ CompositionPass *pass = tp->createPass();
			pass->setType(CompositionPass::PT_RENDERQUAD);
			pass->setMaterialName("Ogre/Compositor/Copyback");
			pass->setInput(0, "temp");
			}
		}
		/// Display result
		{
			CompositionTargetPass *tp = t->getOutputTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
			{ CompositionPass *pass = tp->createPass();
			pass->setType(CompositionPass::PT_RENDERQUAD);
			pass->setMaterialName("Ogre/Compositor/MotionBlur");
			pass->setInput(0, "sum");
			}
		}
	}


	if (!mMotionBlurLogic)
开发者ID:jacobgogogo,项目名称:stuntrally,代码行数:67,代码来源:BaseApp_Effects.cpp

示例12: _init

        void _init(void)
        {
            CompositorPtr compositor = CompositorManager::getSingleton().create(
                _theType(), ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
			CompositionTechnique *t;
            CompositionTechnique::TextureDefinition *td;
            CompositionTargetPass *tp;
            CompositionPass *pass;

            t = compositor->createTechnique();
            td = t->createTextureDefinition("scene");
            td->width.viewport = 1;
            td->height.viewport = 1;
            td->format = PF_X8R8G8B8;
            td = t->createTextureDefinition("blur0");
            td->width.viewport = 0.5;
            td->height.viewport = 0.5;
            td->format = PF_X8R8G8B8;
            td = t->createTextureDefinition("blur1");
            td->width.viewport = 0.5;
            td->height.viewport = 0.5;
            td->format = PF_X8R8G8B8;

            tp = t->createTargetPass();
            tp->setInputMode(CompositionTargetPass::IM_PREVIOUS);
            tp->setOutputName("scene");

            tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            tp->setOutputName("blur0");
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/Floodlighting/DownSample");
            pass->setInput(0, "scene");

            tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            tp->setOutputName("blur1");
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/Floodlighting/BlurHorizontal");
            pass->setInput(0, "blur0");

            tp = t->createTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            tp->setOutputName("blur1");
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/Floodlighting/BlurVertical");
            pass->setInput(0, "blur0");

            tp = t->getOutputTargetPass();
			tp->setInputMode(CompositionTargetPass::IM_NONE);
            pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERQUAD);
            pass->setMaterialName("PostFilters/Floodlighting/Blend");
            pass->setInput(0, "scene");
            pass->setInput(1, "blur1");
            pass->setIdentifier(0xDEADBADE);

            mBlurAmount = 0.2f;
            mShineAmount = 0.3f;
            // receive default parameters from material script
            if (!pass->getMaterial().isNull())
            {
                GpuProgramParametersSharedPtr parameters = pass->getMaterial()->getTechnique(0)->getPass(0)->getFragmentProgramParameters();
#if OGRE_VERSION >= 0x010300
                const GpuConstantDefinition* def;
                
                def = parameters->_findNamedConstantDefinition("blur_amount");
                if (def)
                    parameters->_readRawConstants(def->physicalIndex, 1, &mBlurAmount);
                def = parameters->_findNamedConstantDefinition("shine_amount");
                if (def)
                    parameters->_readRawConstants(def->physicalIndex, 1, &mShineAmount);
#else
                GpuProgramParameters::RealConstantEntry* entry;

                entry = parameters->getNamedRealConstantEntry("blur_amount");
                if (entry && entry->isSet)
                    mBlurAmount = entry->val[0];

                entry = parameters->getNamedRealConstantEntry("shine_amount");
                if (entry && entry->isSet)
                    mShineAmount = entry->val[0];
#endif
            }
        }
开发者ID:brock7,项目名称:TianLong,代码行数:88,代码来源:WXFloodlightingPostFilter.cpp

示例13: compName

//-----------------------------------------------------------------------
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);
}
开发者ID:nezticle,项目名称:ogre,代码行数:63,代码来源:OgreCompositorChain.cpp

示例14: while

void CompositorInstance::collectPasses(TargetOperation &finalState, CompositionTargetPass *target)
{
	/// Here, passes are converted into render target operations
    Pass *targetpass;
    Technique *srctech;
	MaterialPtr mat, srcmat;
	
    CompositionTargetPass::PassIterator it = target->getPassIterator();
    while(it.hasMoreElements())
    {
        CompositionPass *pass = it.getNext();
        switch(pass->getType())
        {
        case CompositionPass::PT_CLEAR:
			queueRenderSystemOp(finalState, new RSClearOperation(
				pass->getClearBuffers(),
				pass->getClearColour(),
				pass->getClearDepth(),
				pass->getClearStencil()
				));
            break;
		case CompositionPass::PT_STENCIL:
			queueRenderSystemOp(finalState, new RSStencilOperation(
				pass->getStencilCheck(),pass->getStencilFunc(), pass->getStencilRefValue(),
				pass->getStencilMask(), pass->getStencilFailOp(), pass->getStencilDepthFailOp(),
				pass->getStencilPassOp(), pass->getStencilTwoSidedOperation()
				));
            break;
        case CompositionPass::PT_RENDERSCENE:
			if(pass->getFirstRenderQueue() < finalState.currentQueueGroupID)
			{
				/// Mismatch -- warn user
				/// XXX We could support repeating the last queue, with some effort
				LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
					+mCompositor->getName()+": Attempt to render queue "+
					StringConverter::toString(pass->getFirstRenderQueue())+" before "+
					StringConverter::toString(finalState.currentQueueGroupID));
			}
			/// Add render queues
			for(int x=pass->getFirstRenderQueue(); x<=pass->getLastRenderQueue(); ++x)
			{
				assert(x>=0);
				finalState.renderQueues.set(x);
			}
			finalState.currentQueueGroupID = pass->getLastRenderQueue()+1;
			finalState.findVisibleObjects = true;
			finalState.materialScheme = target->getMaterialScheme();

            break;
        case CompositionPass::PT_RENDERQUAD:
            srcmat = pass->getMaterial();
			if(srcmat.isNull())
            {
                /// No material -- warn user
				LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
					+mCompositor->getName()+": No material defined for composition pass");
                break;
            }
			srcmat->compile();
			if(srcmat->getNumSupportedTechniques()==0)  
			{
				/// No supported techniques -- warn user
				LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
					+mCompositor->getName()+": material "+srcmat->getName()+" has no supported techniques");
                break;
			}
			srctech = srcmat->getBestTechnique(0);
			/// Create local material
			MaterialPtr mat = createLocalMaterial();
			/// Copy and adapt passes from source material
			Technique::PassIterator i = srctech->getPassIterator();
			while(i.hasMoreElements())
			{
				Pass *srcpass = i.getNext();
				/// Create new target pass
				targetpass = mat->getTechnique(0)->createPass();
				(*targetpass) = (*srcpass);
				/// Set up inputs
				for(size_t x=0; x<pass->getNumInputs(); ++x)
				{
					String inp = pass->getInput(x);
					if(!inp.empty())
					{
						if(x < targetpass->getNumTextureUnitStates())
						{
							targetpass->getTextureUnitState((ushort)x)->setTextureName(getSourceForTex(inp));
						} 
						else
						{
							/// Texture unit not there
							LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
								+mCompositor->getName()+": material "+srcmat->getName()+" texture unit "
								+StringConverter::toString(x)+" out of bounds");
						}
					}
				}
			}
			queueRenderSystemOp(finalState, new RSQuadOperation(this,pass->getIdentifier(),mat));
            break;
        }
//.........这里部分代码省略.........
开发者ID:brock7,项目名称:TianLong,代码行数:101,代码来源:OgreCompositorInstance.cpp


注:本文中的CompositionPass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。