當前位置: 首頁>>代碼示例>>C++>>正文


C++ Technique::getPassIterator方法代碼示例

本文整理匯總了C++中Technique::getPassIterator方法的典型用法代碼示例。如果您正苦於以下問題:C++ Technique::getPassIterator方法的具體用法?C++ Technique::getPassIterator怎麽用?C++ Technique::getPassIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Technique的用法示例。


在下文中一共展示了Technique::getPassIterator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: correctAlpha

	//--------------------------------------------------------------------------------
	void MaterialUtil::correctAlpha(const MaterialPtr& _material)
	{
		if(isPortal(_material) || isGhostOccluder(_material))
		{
			// create fully transparent material
			Material::TechniqueIterator it = _material->getTechniqueIterator();
			while(it.hasMoreElements())
			{
				Technique* technique = it.getNext();
				Technique::PassIterator it2 = technique->getPassIterator();
				while(it2.hasMoreElements())
				{
					Pass* pass = it2.getNext();
					pass->setAlphaRejectFunction(Ogre::CMPF_ALWAYS_FAIL);
				}
			}
		}
		else
		{
			Material::TechniqueIterator it = _material->getTechniqueIterator();
			while(it.hasMoreElements())
			{
				Technique* technique = it.getNext();
				Technique::PassIterator it2 = technique->getPassIterator();
				while(it2.hasMoreElements())
				{
					Pass* pass = it2.getNext();
					pass->setAlphaRejectFunction(Ogre::CMPF_GREATER);
					pass->setAlphaRejectValue(220);
				}
			}
			_material->setReceiveShadows(true);
		}
	}
開發者ID:raduetsya,項目名稱:GothOgre,代碼行數:35,代碼來源:GothOgre_MaterialUtil.cpp

示例2: ChangeClr

void CarModel::ChangeClr()
{
	int i = iColor;
	float c_h = pSet->gui.car_hue[i], c_s = pSet->gui.car_sat[i],
	      c_v = pSet->gui.car_val[i], gloss = pSet->gui.car_gloss[i], refl = pSet->gui.car_refl[i];
	color.setHSB(1-c_h, c_s, c_v);  //set, mini pos clr

	MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
	if (!mtr.isNull())
	{	Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{	Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{	Pass* pass = passIt.getNext();
				if (pass->hasFragmentProgram())
				{
					GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
					params->setNamedConstant("carColour", color);
					params->setNamedConstant("glossiness", 1 - gloss);
					params->setNamedConstant("reflectiveness", refl);
	}	}	}	}

	if (pNickTxt)
		pNickTxt->setTextColour(MyGUI::Colour(color.r,color.g,color.b));
	
	// opp list text and mini pos colors - auto in hud update
}
開發者ID:Mixone-FinallyHere,項目名稱:stuntrally,代碼行數:28,代碼來源:CarModel_Update.cpp

示例3: ChangeOriginalMaterial

void MaterialInstance::ChangeOriginalMaterial()
{
    if (mCopyMat.isNull ()) {
      createCopyMaterial ();
    }
	unsigned short i = 0, j;
	ColourValue sc, dc; // Source colur, destination colour
	Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
	while (techniqueIt.hasMoreElements ()) 
	{
		Technique *t = techniqueIt.getNext ();
		Technique::PassIterator passIt = t->getPassIterator ();
		j = 0;
		while (passIt.hasMoreElements ()) 
		{
			sc = mOriginalMat->getTechnique (i)->getPass (j)->getDiffuse ();

            passIt.peekNext ()->setAmbient (mOriginalMat->getTechnique (i)->getPass (j)->getAmbient ());
			passIt.peekNext ()->setDiffuse (sc);
			passIt.moveNext ();

			++j;
		}

		++i;
	}
}
開發者ID:oksangman,項目名稱:Ant,代碼行數:27,代碼來源:MaterialInstance.cpp

示例4: setShadowsEnabled

void MaterialFactory::setShadowsEnabled(bool bEnable)
{
	for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
		it!=mDefinitions.end(); ++it)
	{
		MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
			
		if (mat.isNull()) continue;
		
		Material::TechniqueIterator techIt = mat->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{
			Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{
				Pass* pass = passIt.getNext();
									
				if (pass->hasFragmentProgram())
				{
					if ( pass->getFragmentProgramParameters()->_findNamedConstantDefinition("enableShadows", false))
						pass->getFragmentProgramParameters()->setNamedConstant("enableShadows", Real(bEnable));
				}
			}
		}
		
	}
}
開發者ID:sureandrew,項目名稱:stuntrally,代碼行數:28,代碼來源:MaterialFactory.cpp

示例5: execute

	virtual void execute(SceneManager *sm, RenderSystem *rs)
	{
		// Fire listener
		instance->_fireNotifyMaterialRender(pass_id, mat);

        Rectangle2D * mRectangle=static_cast<Rectangle2D *>(CompositorManager::getSingleton()._getTexturedRectangle2D());
        if (mQuadCornerModified)
        {
            // insure positions are using peculiar render system offsets 
            RenderSystem* rs = Root::getSingleton().getRenderSystem();
            Viewport* vp = rs->_getViewport();
            Real hOffset = rs->getHorizontalTexelOffset() / (0.5 * vp->getActualWidth());
            Real vOffset = rs->getVerticalTexelOffset() / (0.5 * vp->getActualHeight());
            mRectangle->setCorners(mQuadLeft + hOffset, mQuadTop - vOffset, mQuadRight + hOffset, mQuadBottom - vOffset);
        }
        
		// Queue passes from mat
		Technique::PassIterator i = technique->getPassIterator();
		while(i.hasMoreElements())
		{
			sm->_injectRenderWithPass(
				i.getNext(), 
				mRectangle,
				false // don't allow replacement of shadow passes
				);
		}
	}
開發者ID:masonh,項目名稱:marblemax,代碼行數:27,代碼來源:OgreCompositorInstance.cpp

示例6: setColor

void MaterialInstance::setColor(float red, float green, float blue, float alpha)
{
    if (mCopyMat.isNull ()) {
      createCopyMaterial ();
    }
	unsigned short i = 0, j;
	ColourValue sc, dc; // Source colur, destination colour
	Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
	while (techniqueIt.hasMoreElements ()) 
	{
		Technique *t = techniqueIt.getNext ();
		Technique::PassIterator passIt = t->getPassIterator ();
		j = 0;
		while (passIt.hasMoreElements ()) 
		{
			sc = mOriginalMat->getTechnique (i)->getPass (j)->getDiffuse ();

			dc = sc;

			dc.a = alpha;
			dc.r = red;
			dc.g = green;
			dc.b = blue;
            passIt.peekNext ()->setAmbient (mOriginalMat->getTechnique (i)->getPass (j)->getAmbient ());
			passIt.peekNext ()->setDiffuse (dc);
			passIt.moveNext ();

			++j;
		}

		++i;
	}
}
開發者ID:oksangman,項目名稱:Ant,代碼行數:33,代碼來源:MaterialInstance.cpp

示例7: setSceneBlending

void MaterialInstance::setSceneBlending (SceneBlendType sbt) {
  mSBT = sbt;

  if (!mCopyMat.isNull ()) {
    Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
    while (techniqueIt.hasMoreElements ()) {
      Technique *t = techniqueIt.getNext ();
      Technique::PassIterator passIt = t->getPassIterator ();
      while (passIt.hasMoreElements ()) {
        passIt.getNext ()->setSceneBlending (mSBT);
      }
    }
  }
}
開發者ID:oksangman,項目名稱:Ant,代碼行數:14,代碼來源:MaterialInstance.cpp

示例8: execute

	virtual void execute(SceneManager *sm, RenderSystem *rs)
	{
		// Fire listener
		instance->_fireNotifyMaterialRender(pass_id, mat);
		// Queue passes from mat
		Technique::PassIterator i = technique->getPassIterator();
		while(i.hasMoreElements())
		{
			sm->_injectRenderWithPass(
				i.getNext(), 
				CompositorManager::getSingleton()._getTexturedRectangle2D(),
				false // don't allow replacement of shadow passes
				);
		}
	}
開發者ID:brock7,項目名稱:TianLong,代碼行數:15,代碼來源:OgreCompositorInstance.cpp

示例9: setTransparency

void MaterialInstance::setTransparency (Real transparency) {
  mCurrentTransparency = transparency;
  if (mCurrentTransparency > 0.0f) {
    if (mCurrentTransparency > 1.0f)
      mCurrentTransparency = 1.0f;
    
    if (mCopyMat.isNull ()) {
      createCopyMaterial ();
    }
      
    unsigned short i = 0, j;
    ColourValue sc, dc; // Source colur, destination colour
    Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
    while (techniqueIt.hasMoreElements ()) {
      Technique *t = techniqueIt.getNext ();
      Technique::PassIterator passIt = t->getPassIterator ();
      j = 0;
      while (passIt.hasMoreElements ()) {
        sc = mOriginalMat->getTechnique (i)->getPass (j)->getDiffuse ();

        switch (mSBT) {
          case SBT_ADD:
            dc = sc;
            dc.r -= sc.r * mCurrentTransparency;
            dc.g -= sc.g * mCurrentTransparency;
            dc.b -= sc.b * mCurrentTransparency;
            passIt.peekNext ()->setAmbient (ColourValue::Black);
            break;
          case SBT_TRANSPARENT_ALPHA:
          default:
            dc = sc;
            dc.a = sc.a * (1.0f - mCurrentTransparency);
            passIt.peekNext ()->setAmbient (mOriginalMat->getTechnique (i)->getPass (j)->getAmbient ());
            break;
        }
        passIt.peekNext ()->setDiffuse (dc);
        passIt.moveNext ();
            
        ++j;
      }
          
      ++i;
    }
  }
  else {
    mCurrentTransparency = 0.0f;
  }
}
開發者ID:oksangman,項目名稱:Ant,代碼行數:48,代碼來源:MaterialInstance.cpp

示例10: createCopyMaterial

void MaterialInstance::createCopyMaterial () {
	String name;
	// Avoid name collision
	do {
		name = mOriginalMat->getName () + StringConverter::toString (Math::UnitRandom ());
	} while (MaterialManager::getSingleton ().resourceExists (name));

	mCopyMat = mOriginalMat->clone (name);

	Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
	while (techniqueIt.hasMoreElements ()) {
		Technique *t = techniqueIt.getNext ();
		Technique::PassIterator passIt = t->getPassIterator ();
		while (passIt.hasMoreElements ()) {
			passIt.peekNext ()->setDepthWriteEnabled (false);
			passIt.peekNext ()->setSceneBlending (mSBT);
			passIt.moveNext ();
		}
	}
}
開發者ID:oksangman,項目名稱:Ant,代碼行數:20,代碼來源:MaterialInstance.cpp

示例11: UpdateLightMap

//-------------------------------------------------------------------------------------------------------
//  utility
//-------------------------------------------------------------------------------------------------------
void CarModel::UpdateLightMap()
{
	MaterialPtr mtr;
	for (int i=0; i < NumMaterials; ++i)
	{
		mtr = MaterialManager::getSingleton().getByName(sMtr[i]);
		if (!mtr.isNull())
		{	Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
			while (techIt.hasMoreElements())
			{	Technique* tech = techIt.getNext();
				Technique::PassIterator passIt = tech->getPassIterator();
				while (passIt.hasMoreElements())
				{	Pass* pass = passIt.getNext();
					if (pass->hasFragmentProgram())
					{
						GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
						params->setIgnoreMissingParams(true);  // don't throw exception if material doesnt use lightmap
						params->setNamedConstant("enableTerrainLightMap", bLightMapEnabled ? 1.f : 0.f);
	}	}	}	}	}
}
開發者ID:Mixone-FinallyHere,項目名稱:stuntrally,代碼行數:23,代碼來源:CarModel_Update.cpp

示例12: update

void MaterialFactory::update()
{
	for (std::vector<std::string>::const_iterator it = timeMtrs.begin();
		it != timeMtrs.end(); ++it)
	{
		MaterialPtr mtr = MaterialManager::getSingleton().getByName( (*it) );

		if (!mtr.isNull())
		{	Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
			while (techIt.hasMoreElements())
			{	Technique* tech = techIt.getNext();
				Technique::PassIterator passIt = tech->getPassIterator();
				while (passIt.hasMoreElements())
				{	Pass* pass = passIt.getNext();

					// time
					if (pass->hasFragmentProgram() && pass->getFragmentProgramParameters()->_findNamedConstantDefinition("time", false))
						pass->getFragmentProgramParameters()->setNamedConstantFromTime( "time", 1 );
				}
			}	
		}	
	}
}
開發者ID:sureandrew,項目名稱:stuntrally,代碼行數:23,代碼來源:MaterialFactory.cpp

示例13: UpdateBraking

void CarModel::UpdateBraking()
{
	if (brakes)
		brakes->setVisible(bBraking && mbVisible);

	std::string texName = sDirname + (bBraking ? "_body00_brake.png" : "_body00_add.png");

	MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
	if (!mtr.isNull())
	{	Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{	Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{	Pass* pass = passIt.getNext();
				Pass::TextureUnitStateIterator tusIt = pass->getTextureUnitStateIterator();
				while (tusIt.hasMoreElements())
				{
					TextureUnitState* tus = tusIt.getNext();
					if (tus->getName() == "diffuseMap")
					{	tus->setTextureName( texName );  return;  }
	}	}	}	}
}
開發者ID:Mixone-FinallyHere,項目名稱:stuntrally,代碼行數:23,代碼來源:CarModel_Update.cpp

示例14: isPotentialOccluder

bool OcclusionQuery::isPotentialOccluder(Ogre::SceneNode* node)
{
    bool result = false;
    for (unsigned int i=0; i < node->numAttachedObjects(); ++i)
    {
        MovableObject* ob = node->getAttachedObject(i);
        std::string type = ob->getMovableType();
        if (type == "Entity")
        {
            Entity* ent = static_cast<Entity*>(ob);
            for (unsigned int j=0; j < ent->getNumSubEntities(); ++j)
            {
                // if any sub entity has a material with depth write off,
                // consider the object as not an occluder
                MaterialPtr mat = ent->getSubEntity(j)->getMaterial();

                Material::TechniqueIterator techIt = mat->getTechniqueIterator();
                while (techIt.hasMoreElements())
                {
                    Technique* tech = techIt.getNext();
                    Technique::PassIterator passIt = tech->getPassIterator();
                    while (passIt.hasMoreElements())
                    {
                        Pass* pass = passIt.getNext();

                        if (pass->getDepthWriteEnabled() == false)
                            return false;
                        else
                            result = true;
                    }
                }
            }
        }
    }
    return result;
}
開發者ID:AlfredBroda,項目名稱:openmw,代碼行數:36,代碼來源:occlusionquery.cpp

示例15: generate


//.........這裏部分代碼省略.........
			bool exists = false;
			shaderMap::iterator sit;
			for (sit = mShaderCache.begin();
				sit != mShaderCache.end(); ++sit)
			{
				if ( sit->second->isEqual( shaderProps ) )
				{
					exists = true;
					break;
				}
			}
			
			if (!exists)
				generator->mShaderCached = false;
			else
			{
				generator->mShaderCached = true;
				generator->mVertexProgram = sit->first.first;
				generator->mFragmentProgram = sit->first.second;
			}
						
			generator->mDef = (*it);
			generator->mShader = shaderProps;
			generator->generate();
			
			// insert into cache
			#ifdef USE_CACHE
			if (!exists)
			{
				if (!generator->mVertexProgram.isNull() && !generator->mFragmentProgram.isNull()) 
					mShaderCache[ std::make_pair(generator->mVertexProgram, generator->mFragmentProgram) ] = shaderProps;
				else
					delete shaderProps;
			}
			else
				delete shaderProps;
			#else
			delete shaderProps;
			#endif
		}
		
		bSettingsChanged = false;
		
		ti.update(); /// time
		float dt = ti.dt * 1000.f;
		LogO(String("::: Time MaterialFactory: ") + toStr(dt) + " ms");

		// recreate cloned car materials
		#ifndef ROAD_EDITOR
		pApp->recreateCarMtr();
		#endif
	}
	else
	{
		LogO("[MaterialFactory] settings not changed, using old materials");
	}
	
	
	// update params	
	for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
		it!=mDefinitions.end(); ++it)
	{
		MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
		setShaderParams(mat);
	}
	
	#ifdef USE_CUSTOM_TERRAIN_MATERIAL
	// update terrain params
	if (!mTerrain) return;
	MaterialPtr terrainMat = mTerrain->_getMaterial();
	if (!terrainMat.isNull())
	{
		Material::TechniqueIterator techIt = terrainMat->getTechniqueIterator();
		while (techIt.hasMoreElements())
		{
			Technique* tech = techIt.getNext();
			Technique::PassIterator passIt = tech->getPassIterator();
			while (passIt.hasMoreElements())
			{
				Pass* pass = passIt.getNext();
				
				if (!pass->hasFragmentProgram()
				 || !pass->getFragmentProgramParameters()->_findNamedConstantDefinition("fadeStart_farDist", false)) continue;
				
				float fadeDist;
				if (mSceneMgr->getShadowFarDistance() != 0)
					fadeDist = getShadowsFadeDistance()/mSceneMgr->getShadowFarDistance();
				else
					fadeDist = 0.f;
																
				pass->getFragmentProgramParameters()->setNamedConstant("fadeStart_farDist", Vector3(
					fadeDist,
					mSceneMgr->getShadowFarDistance(),
					float(getShadowsFade())
				));
			}
		}
	}
	#endif
}
開發者ID:sureandrew,項目名稱:stuntrally,代碼行數:101,代碼來源:MaterialFactory.cpp


注:本文中的Technique::getPassIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。