本文整理汇总了C++中ogre::TextureUnitState::getFrameTextureName方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::getFrameTextureName方法的具体用法?C++ TextureUnitState::getFrameTextureName怎么用?C++ TextureUnitState::getFrameTextureName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::getFrameTextureName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectMaterial
//-----------------------------------------------------------------------
void MaterialTab::selectMaterial(wxString& materialName)
{
Ogre::TextureUnitState* textureUnitState = 0;
mTxtMaterialName->SetValue(materialName);
if (isSelectedMaterialInUse())
{
mTxtMaterialName->Disable();
}
else
{
mTxtMaterialName->Enable();
}
mLastSelectedMaterial = materialName;
Ogre::String name = wx2ogre(materialName);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(name);
if (!material.isNull() && material->getNumTechniques() > 0)
{
material->load();
mTxtTextureLoad->SetValue(wxT(""));
Ogre::Technique* technique = material->getBestTechnique(); // Get the best technique
if (technique && technique->getNumPasses() > 0)
{
Ogre::Pass* pass = technique->getPass(0); // Get the first
if (pass)
{
// Set pass properties
mCheckLighting->SetValue(pass->getLightingEnabled());
mCheckDepthCheck->SetValue(pass->getDepthCheckEnabled());
mCheckDepthWrite->SetValue(pass->getDepthWriteEnabled());
mSceneBlendList->SetValue(getSceneBlending(pass));
if (pass->getNumTextureUnitStates() > 0)
{
textureUnitState = pass->getTextureUnitState(0); // Get the first
if (textureUnitState)
{
// Set texture properties
if (textureUnitState->getNumFrames() > 0)
{
wxString name = ogre2wx(textureUnitState->getFrameTextureName(0));
mTxtTextureLoad->SetValue(name);
}
mAddressingModeList->SetValue(getTextureAddressingMode(textureUnitState));
}
}
}
}
}
// Display image
viewTexture(textureUnitState); // Clear the old texture if no TextureUnitState
}
示例2:
void RoR::SkinManager::ReplaceMaterialTextures(SkinDef* skin_def, std::string materialName) // Static
{
const auto not_found = skin_def->replace_textures.end();
Ogre::MaterialPtr mat = RoR::OgreSubsystem::GetMaterialByName(materialName);
if (!mat.isNull())
{
for (int t = 0; t < mat->getNumTechniques(); t++)
{
Ogre::Technique* tech = mat->getTechnique(0);
if (!tech)
continue;
for (int p = 0; p < tech->getNumPasses(); p++)
{
Ogre::Pass* pass = tech->getPass(p);
if (!pass)
continue;
for (int tu = 0; tu < pass->getNumTextureUnitStates(); tu++)
{
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tu);
if (!tus)
continue;
//if (tus->getTextureType() != TEX_TYPE_2D) continue; // only replace 2d images
// walk the frames, usually there is only one
for (unsigned int fr = 0; fr < tus->getNumFrames(); fr++)
{
Ogre::String textureName = tus->getFrameTextureName(fr);
std::map<Ogre::String, Ogre::String>::iterator it = skin_def->replace_textures.find(textureName);
if (it != not_found)
{
textureName = it->second; //getReplacementForTexture(textureName);
tus->setFrameTextureName(textureName, fr);
}
}
}
}
}
}
}