本文整理汇总了C++中ogre::TextureUnitState::getContentType方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::getContentType方法的具体用法?C++ TextureUnitState::getContentType怎么用?C++ TextureUnitState::getContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::getContentType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetData
//.........这里部分代码省略.........
matmgr.parseScript(modified_data, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::MaterialPtr tempmat;
tempmat = matmgr.getByName(tempname);
if (tempmat.isNull())
{
OgreRenderingModule::LogWarning(std::string("Failed to create an Ogre material from material asset ") +
source->GetId());
return false;
}
if(!tempmat->getNumTechniques())
{
OgreRenderingModule::LogWarning("Failed to create an Ogre material from material asset " +
source->GetId());
return false;
}
ogre_material_ = tempmat->clone(id_);
tempmat.setNull();
matmgr.remove(tempname);
if (ogre_material_.isNull())
{
OgreRenderingModule::LogWarning("Failed to create an Ogre material from material asset " +
source->GetId());
return false;
}
// Now go through all the texturenames and restore \ back to / and @ to :
Ogre::Material::TechniqueIterator iter = ogre_material_->getTechniqueIterator();
while (iter.hasMoreElements())
{
Ogre::Technique *tech = iter.getNext();
Ogre::Technique::PassIterator passIter = tech->getPassIterator();
while (passIter.hasMoreElements())
{
Ogre::Pass *pass = passIter.getNext();
Ogre::Pass::TextureUnitStateIterator texIter = pass->getTextureUnitStateIterator();
while (texIter.hasMoreElements())
{
Ogre::TextureUnitState *texUnit = texIter.getNext();
std::string texname = texUnit->getTextureName();
if (texname.find('\\') != std::string::npos)
{
ReplaceCharInplace(texname, '\\', '/');
ReplaceCharInplace(texname, '@', ':');
texUnit->setTextureName(texname);
}
}
}
}
//workaround: if receives shadows, check the amount of shadowmaps. If only 1 specified, add 2 more to support 3 shadowmaps
if(ogre_material_->getReceiveShadows() && shadowquality_ == Shadows_High && ogre_material_->getNumTechniques() > 0)
{
Ogre::Technique *tech = ogre_material_->getTechnique(0);
if(tech)
{
Ogre::Technique::PassIterator passiterator = tech->getPassIterator();
while(passiterator.hasMoreElements())
{
Ogre::Pass* pass = passiterator.getNext();
Ogre::Pass::TextureUnitStateIterator texiterator = pass->getTextureUnitStateIterator();
int shadowmaps = 0;
while(texiterator.hasMoreElements())
{
Ogre::TextureUnitState* state = texiterator.getNext();
if(state->getContentType() == Ogre::TextureUnitState::CONTENT_SHADOW)
{
shadowmaps++;
}
}
if(shadowmaps>0 && shadowmaps<3)
{
Ogre::TextureUnitState* sm2 = pass->createTextureUnitState();
sm2->setContentType(Ogre::TextureUnitState::CONTENT_SHADOW);
Ogre::TextureUnitState* sm3 = pass->createTextureUnitState();
sm3->setContentType(Ogre::TextureUnitState::CONTENT_SHADOW);
}
}
}
}
} catch (Ogre::Exception &e)
{
OgreRenderingModule::LogWarning(e.what());
OgreRenderingModule::LogWarning("Failed to parse Ogre material " + source->GetId() + ".");
try
{
if (!matmgr.getByName(tempname).isNull())
Ogre::MaterialManager::getSingleton().remove(tempname);
}
catch (...) {}
return false;
}
return true;
}