本文整理汇总了C++中TexturePtr::getPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::getPointer方法的具体用法?C++ TexturePtr::getPointer怎么用?C++ TexturePtr::getPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::getPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getShadowTextures
//---------------------------------------------------------------------
void ShadowTextureManager::getShadowTextures(const ShadowTextureConfigList& configList,
ShadowTextureList& listToPopulate)
{
listToPopulate.clear();
set<Texture*>::type usedTextures;
for (ShadowTextureConfigList::const_iterator c = configList.begin(); c != configList.end(); ++c)
{
const ShadowTextureConfig& config = *c;
bool found = false;
for (ShadowTextureList::iterator t = mTextureList.begin(); t != mTextureList.end(); ++t)
{
const TexturePtr& tex = *t;
// Skip if already used this one
if (usedTextures.find(tex.getPointer()) != usedTextures.end())
continue;
if (config.width == tex->getWidth() && config.height == tex->getHeight()
&& config.format == tex->getFormat() && config.fsaa == tex->getFSAA())
{
// Ok, a match
listToPopulate.push_back(tex);
usedTextures.insert(tex.getPointer());
found = true;
break;
}
}
if (!found)
{
// Create a new texture
static const String baseName = "Ogre/ShadowTexture";
String targName = baseName + StringConverter::toString(mCount++);
TexturePtr shadowTex = TextureManager::getSingleton().createManual(
targName,
ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME,
TEX_TYPE_2D, config.width, config.height, 0, config.format,
TU_RENDERTARGET, NULL, false, config.fsaa);
// Ensure texture loaded
shadowTex->load();
listToPopulate.push_back(shadowTex);
usedTextures.insert(shadowTex.getPointer());
mTextureList.push_back(shadowTex);
}
}
}
示例2: loadObject
//.........这里部分代码省略.........
LOG("ODEF: animation '" + String(animname) + "' for mesh: '" + String(mesh) + "' in odef file '" + name + ".odef' not found!");
continue;
}
animated_object_t ao;
ao.node = tenode;
ao.ent = mo->getEntity();
ao.speedfactor = speedfactorMin;
if (speedfactorMin != speedfactorMax)
ao.speedfactor = Math::RangeRandom(speedfactorMin, speedfactorMax);
ao.anim = 0;
try
{
ao.anim = mo->getEntity()->getAnimationState(String(animname));
} catch (...)
{
ao.anim = 0;
}
if (!ao.anim)
{
LOG("ODEF: animation '" + String(animname) + "' for mesh: '" + String(mesh) + "' in odef file '" + name + ".odef' not found!");
continue;
}
ao.anim->setEnabled(true);
animatedObjects.push_back(ao);
}
continue;
}
if (!strncmp("drawTextOnMeshTexture", ptline, 21) && mo)
{
if (!mo->getEntity())
continue;
String matName = mo->getEntity()->getSubEntity(0)->getMaterialName();
MaterialPtr m = MaterialManager::getSingleton().getByName(matName);
if (m.getPointer() == 0)
{
LOG("ODEF: problem with drawTextOnMeshTexture command: mesh material not found: "+odefname+" : "+String(ptline));
continue;
}
String texName = m->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureName();
Texture* background = (Texture *)TextureManager::getSingleton().getByName(texName).getPointer();
if (!background)
{
LOG("ODEF: problem with drawTextOnMeshTexture command: mesh texture not found: "+odefname+" : "+String(ptline));
continue;
}
static int textureNumber = 0;
textureNumber++;
char tmpTextName[256]="", tmpMatName[256]="";
sprintf(tmpTextName, "TextOnTexture_%d_Texture", textureNumber);
sprintf(tmpMatName, "TextOnTexture_%d_Material", textureNumber); // Make sure the texture is not WRITE_ONLY, we need to read the buffer to do the blending with the font (get the alpha for example)
TexturePtr texture = TextureManager::getSingleton().createManual(tmpTextName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, (Ogre::uint)background->getWidth(), (Ogre::uint)background->getHeight(), MIP_UNLIMITED , PF_X8R8G8B8, Ogre::TU_STATIC|Ogre::TU_AUTOMIPMAP, new ResourceBuffer());
if (texture.getPointer() == 0)
{
LOG("ODEF: problem with drawTextOnMeshTexture command: could not create texture: "+odefname+" : "+String(ptline));
continue;
}
float x=0, y=0, w=0, h=0;
float a=0, r=0, g=0, b=0;
char fontname[256]="";
char text[256]="";
char option='l';
int res = sscanf(ptline, "drawTextOnMeshTexture %f, %f, %f, %f, %f, %f, %f, %f, %c, %s %s", &x, &y, &w, &h, &r, &g, &b, &a, &option, fontname, text);
if (res < 11)
{