本文整理汇总了C++中ogre::TexturePtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::reset方法的具体用法?C++ TexturePtr::reset怎么用?C++ TexturePtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getIcon
Icon* IconManager::getIcon(int, EmberEntity* entity) {
std::string key = "entity_" + entity->getId();
if (mIconStore.hasIcon(key)) {
return mIconStore.getIcon(key);
} else {
std::string modelName;
Mapping::ModelActionCreator actionCreator(*entity, [&](std::string newModelName){
modelName = newModelName;
}, [&](std::string partName){
//Ignore parts
});
std::unique_ptr<EntityMapping::EntityMapping> modelMapping(Mapping::EmberEntityMappingManager::getSingleton().getManager().createMapping(*entity, actionCreator, &EmberOgre::getSingleton().getWorld()->getView()));
if (modelMapping) {
modelMapping->initialize();
}
//if there's no model defined for this use the placeholder model
if (modelName.empty()) {
modelName = "common/primitives/placeholder.modeldef";
}
auto modelDefPtr = Model::ModelDefinitionManager::getSingleton().getByName(modelName);
if (modelDefPtr) {
Model::ModelDefinition* modelDef = modelDefPtr.get();
const std::string& iconPath(modelDef->getIconPath());
if (!iconPath.empty()) {
Ogre::TexturePtr texPtr;
try {
if (Ogre::TextureManager::getSingleton().resourceExists(iconPath, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)) {
texPtr = static_cast<Ogre::TexturePtr> (Ogre::TextureManager::getSingleton().getByName(iconPath, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME));
//try to load it to make sure that's it a working image
texPtr->load();
}
if (!texPtr) {
texPtr = Ogre::TextureManager::getSingleton().load(iconPath, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
}
} catch (...) {
S_LOG_WARNING("Error when trying to load the icon " << iconPath << ". The icon will be rendered dynamically.");
texPtr.reset();
}
if (texPtr) {
Icon* icon = mIconStore.createIcon(key, texPtr);
return icon;
}
}
}
Icon* icon = mIconStore.createIcon(key);
if (icon) {
//update the model preview window
// Model::Model* model = Model::Model::createModel(mIconRenderer.getRenderContext()->getSceneManager(), modelName);
render(*icon, modelName);
// mIconRenderer.getRenderContext()->getSceneManager()->destroyMovableObject(model);
}
return icon;
}
}