本文整理汇总了C++中TextureUnitState::getTextureName方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::getTextureName方法的具体用法?C++ TextureUnitState::getTextureName怎么用?C++ TextureUnitState::getTextureName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::getTextureName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPaintTexutreName
// 替换指定纹理层的纹理
bool TerrainImpl::setPaintTexutreName(size_t nPaintChannel , const String &strTextureName)
{
Technique *pTech = mMaterial->getTechnique(0);
Pass *pass = pTech->getPass(nPaintChannel / SPLATTING_TEXTURE_NUM);
if(pass)
{
TextureUnitState *texture = pass->getTextureUnitState(COVERAGE_TEXTURE_NUM + (nPaintChannel % SPLATTING_TEXTURE_NUM));
if(texture)
{
texture->setTextureName(strTextureName);
return texture->getTextureName() == strTextureName && !texture->_getTexturePtr().isNull() && texture->_getTexturePtr()->isLoaded();
}
}
return false;
}
示例2: notifyMaterialSetup
void DepthComposerInstance::notifyMaterialSetup(uint pass_id, Ogre::MaterialPtr &mat)
{
//LogManager::getSingleton ().logMessage (
// "Caelum::DepthComposer: Material setup");
Pass* pass = mat->getBestTechnique ()->getPass (0);
TextureUnitState *depthTus = pass->getTextureUnitState(1);
if (depthTus->getTextureName () != mDepthRenderer->getDepthRenderTexture ()->getName()) {
depthTus->setTextureName (mDepthRenderer->getDepthRenderTexture ()->getName ());
LogManager::getSingleton ().logMessage (
"Caelum::DepthComposer: Assigned depth texture in compositor material");
}
mParams.setup(pass->getFragmentProgramParameters ());
}
示例3: loadMesh
void MeshObject::loadMesh()
{
try
{
Ogre::String resourceGroup = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME;
mesh = static_cast<Ogre::MeshPtr>(Ogre::MeshManager::getSingleton().create(meshName, resourceGroup));
if(backgroundLoading)
{
mesh->setBackgroundLoaded(true);
mesh->addListener(this);
ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(
Ogre::MeshManager::getSingletonPtr()->getResourceType(),
mesh->getName(),
resourceGroup,
false,
0,
0,
0);
// try to load its textures in the background
for(int i=0; i<mesh->getNumSubMeshes(); i++)
{
SubMesh *sm = mesh->getSubMesh(i);
String materialName = sm->getMaterialName();
Ogre::MaterialPtr mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName(materialName)); //, resourceGroup));
if(mat.isNull()) continue;
for(int tn=0; tn<mat->getNumTechniques(); tn++)
{
Technique *t = mat->getTechnique(tn);
for(int pn=0; pn<t->getNumPasses(); pn++)
{
Pass *p = t->getPass(pn);
for(int tun=0; tun<p->getNumTextureUnitStates(); tun++)
{
TextureUnitState *tu = p->getTextureUnitState(tun);
String textureName = tu->getTextureName();
// now add this texture to the background loading queue
Ogre::TexturePtr tex = static_cast<Ogre::TexturePtr>(Ogre::TextureManager::getSingleton().create(textureName, resourceGroup));
tex->setBackgroundLoaded(true);
tex->addListener(this);
ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(
Ogre::TextureManager::getSingletonPtr()->getResourceType(),
tex->getName(),
resourceGroup,
false,
0,
0,
0);
}
}
}
}
}
if(!backgroundLoading)
postProcess();
}
catch (Ogre::Exception* e)
{
LOG("exception while loading mesh: " + e->getFullDescription());
}
}
示例4: Create
void CarReflection::Create()
{
bFirstFrame = true;
if (pSet->refl_mode == "single") cubetexName = "ReflectionCube"; // single: use 1st cubemap
else if (pSet->refl_mode == "full")
{
cubetexName = "ReflectionCube" + toStr(iIndex);
// first cubemap: no index
if (cubetexName == "ReflectionCube0")
cubetexName = "ReflectionCube";
}
else /* static */
cubetexName = "ReflectionCube";
TextureManager* tm = TextureManager::getSingletonPtr();
int size = ciShadowSizesA[pSet->refl_size]; // /2 ?
// create cube render texture
if (! (pSet->refl_mode == "single" && iIndex != 0) )
{
cubetex = tm->createManual(cubetexName,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_CUBE_MAP,
size,size, 0/*mips*/, PF_R8G8B8, TU_RENDERTARGET);
//LogO("created rt cube");
for (int face = 0; face < 6; face++)
{
Camera* mCam = pSceneMgr->createCamera("Reflect_" + toStr(iIndex) + "_" + toStr(face));
mCam->setAspectRatio(1.0f); mCam->setFOVy(Degree(90));
mCam->setNearClipDistance(0.1);
//mCam->setFarClipDistance(pSet->refl_dist); //sky-
RenderTarget* mRT = cubetex->getBuffer(face)->getRenderTarget();
//LogO( "rt face Name: " + mRT->getName() );
mRT->removeAllViewports();
Viewport* vp = mRT->addViewport(mCam);
vp->setOverlaysEnabled(false);
vp->setVisibilityMask(RV_MaskReflect);
mRT->setAutoUpdated(false);
//mRT->addListener(this); //-
mCam->setPosition(Vector3::ZERO);
Vector3 lookAt(0,0,0), up(0,0,0), right(0,0,0); switch(face)
{
case 0: lookAt.x =-1; up.y = 1; right.z = 1; break; // +X
case 1: lookAt.x = 1; up.y = 1; right.z =-1; break; // -X
case 2: lookAt.y =-1; up.z = 1; right.x = 1; break; // +Y
case 3: lookAt.y = 1; up.z =-1; right.x = 1; break; // -Y
case 4: lookAt.z = 1; up.y = 1; right.x =-1; break; // +Z
case 5: lookAt.z =-1; up.y = 1; right.x =-1; break; // -Z
}
Quaternion orient( right, up, lookAt ); mCam->setOrientation( orient );
pCams[face] = mCam;
pRTs[face] = mRT;
}
}
// Iterate through our materials and add an index to ReflectionCube texture reference
for (int i=0; i < NumMaterials; i++)
{
MaterialPtr 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();
Pass::TextureUnitStateIterator tusIt = pass->getTextureUnitStateIterator();
while (tusIt.hasMoreElements())
{
TextureUnitState* tus = tusIt.getNext();
if (tus->getTextureName() == "ReflectionCube")
tus->setTextureName(cubetexName);
} } } } }
}