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


C++ TextureUnitState::getName方法代码示例

本文整理汇总了C++中TextureUnitState::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::getName方法的具体用法?C++ TextureUnitState::getName怎么用?C++ TextureUnitState::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextureUnitState的用法示例。


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

示例1: createTexturUnits

	//-----------------------------------------------------------------------------------
	void PbsMaterial::createTexturUnits(Pass* pass)
	{
		GpuProgramParametersSharedPtr fragmentParams = pass->getFragmentProgramParameters();
		fragmentParams->setIgnoreMissingParams(true);

		// Create the texture unit states
		for (int i = 0; i < ST_COUNT; i++)
		{
			SamplerContainer& s = _samplers[i];
			if (s.status == SS_ACTIVE || s.status == SS_ADDED || s.status == SS_UPDATED)
			{
				s.textureUnitState = pass->createTextureUnitState();
				s.textureUnitState->setName("in_map_" + s.name);
				s.status = SS_UPDATED;
			}
			else
			{
				s.status = SS_NOT_ACTIVE;
			}
		}

		// set the sampler name for the texture unit state
		int size = pass->getNumTextureUnitStates();
		for (int i = 0; i < size; i++)
		{
			TextureUnitState* tus = pass->getTextureUnitState(i);
			fragmentParams->setNamedConstant(tus->getName(), i);
		}

		_hasSamplerChanged = true;
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:32,代码来源:OgreHlmsPbsMaterial.cpp

示例2: 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

示例3: changeShadows


//.........这里部分代码省略.........
		if (matProfile && terrain)  {
			matProfile->setReceiveDynamicShadowsDepth(bDepth);
			matProfile->setReceiveDynamicShadowsPSSM(static_cast<PSSMShadowCameraSetup*>(mPSSMSetup.get()));
			MaterialPtr mtr = matProfile->generateForCompositeMap(terrain);
			//LogO(mtr->getBestTechnique()->getPass(0)->getTextureUnitState(0)->getName());
			//LogO(String("Ter mtr: ") + mtr->getName());

		}
		
		#if 0	// shadow tex overlay
		// add the overlay elements to show the shadow maps:
		// init overlay elements
		OverlayManager& mgr = OverlayManager::getSingleton();
		Overlay* overlay;
		
		// destroy if already exists
		if (overlay = mgr.getByName("DebugOverlay"))
			mgr.destroy(overlay);
			
		overlay = mgr.create("DebugOverlay");
		
		for (size_t i = 0; i < num; ++i) {
			TexturePtr tex = mSceneMgr->getShadowTexture(i);

			// Set up a debug panel to display the shadow
			
			if (MaterialManager::getSingleton().resourceExists("Ogre/DebugTexture" + toStr(i)))
				MaterialManager::getSingleton().remove("Ogre/DebugTexture" + toStr(i));
			MaterialPtr debugMat = MaterialManager::getSingleton().create(
				"Ogre/DebugTexture" + toStr(i), 
				ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
				
			debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
			TextureUnitState *t = debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(tex->getName());
			t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);

			OverlayContainer* debugPanel;
			
			// destroy container if exists
			try
			{
				if (debugPanel = 
					static_cast<OverlayContainer*>(
						mgr.getOverlayElement("Ogre/DebugTexPanel" + toStr(i)
					)))
					mgr.destroyOverlayElement(debugPanel);
			}
			catch (Ogre::Exception&) {}
			
			debugPanel = (OverlayContainer*)
				(OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" + StringConverter::toString(i)));
			debugPanel->_setPosition(0.8, i*0.25);
			debugPanel->_setDimensions(0.2, 0.24);
			debugPanel->setMaterialName(debugMat->getName());
			debugPanel->show();
			overlay->add2D(debugPanel);
			overlay->show();
		}
		#endif
	}
	
	materialFactory->setNumShadowTex(num);
	materialFactory->setShadows(pSet->shadow_type != 0);
	materialFactory->setShadowsDepth(bDepth);
	materialFactory->generate();
	
开发者ID:jsj2008,项目名称:stuntrally,代码行数:66,代码来源:Shadows.cpp

示例4: setShaderParams

void MaterialFactory::setShaderParams(MaterialPtr mat)
{
	if (mat.isNull()) return;
		
	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())
			{
				// shadow fading parameters
				if ( getShadowsFade()
					&& pass->getFragmentProgramParameters()->_findNamedConstantDefinition("fadeStart_farDist", false)
					&& mSceneMgr
				)
				{
					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())
					));
				}
				// terrain lightmap name & size
				if ( mTerrain && !mTerrain->getLightmap().isNull() )
				{
					if (pass->getFragmentProgramParameters()->_findNamedConstantDefinition("terrainWorldSize", false))
						pass->getFragmentProgramParameters()->setNamedConstant( "terrainWorldSize", Real( mTerrain->getWorldSize() ) );
					
					Pass::TextureUnitStateIterator tusIt = pass->getTextureUnitStateIterator();
					while (tusIt.hasMoreElements())
					{
						TextureUnitState* tus = tusIt.getNext();
						if (tus->getName() == "terrainLightMap")
						{
							tus->setTextureName( mTerrain->getLightmap()->getName() );
						}
					}
				}
				
				if (pass->getFragmentProgramParameters()->_findNamedConstantDefinition("invTerSize", false))
					pass->getFragmentProgramParameters()->setNamedConstant("invTerSize", 1.f / Real(pApp->sc.td.fTerWorldSize));

				// pssm split points
				if ( pass->getFragmentProgramParameters()->_findNamedConstantDefinition("pssmSplitPoints", false) && mPSSM)
				{
					const PSSMShadowCameraSetup::SplitPointList& splitPointList = mPSSM->getSplitPoints();
					Vector4 splitPoints;
					for (size_t i = 0; i < splitPointList.size(); ++i)
						splitPoints[i] = splitPointList[i];
						
					pass->getFragmentProgramParameters()->setNamedConstant("pssmSplitPoints", splitPoints);
				}
			}
		}
	}
}
开发者ID:sureandrew,项目名称:stuntrally,代码行数:67,代码来源:MaterialFactory.cpp


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