本文整理汇总了C++中TexturePtr::setNull方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::setNull方法的具体用法?C++ TexturePtr::setNull怎么用?C++ TexturePtr::setNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TexturePtr
的用法示例。
在下文中一共展示了TexturePtr::setNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderTextures
//.........这里部分代码省略.........
key[i] = (key[i] % 26) + 'A';
String tempdir = this->group->geom->getTempdir();
ResourceGroupManager::getSingleton().addResourceLocation(tempdir, "FileSystem", "BinFolder");
String fileNamePNG = "Impostor." + String(key, sizeof(key)) + '.' + StringConverter::toString(textureSize) + ".png";
String fileNameDDS = "Impostor." + String(key, sizeof(key)) + '.' + StringConverter::toString(textureSize) + ".dds";
//Attempt to load the pre-render file if allowed
needsRegen = force;
if (!needsRegen){
try{
texture = TextureManager::getSingleton().load(fileNameDDS, "BinFolder", TEX_TYPE_2D, MIP_UNLIMITED);
}
catch (...){
try{
texture = TextureManager::getSingleton().load(fileNamePNG, "BinFolder", TEX_TYPE_2D, MIP_UNLIMITED);
}
catch (...){
needsRegen = true;
}
}
}
#endif
if (needsRegen){
//If this has not been pre-rendered, do so now
const float xDivFactor = 1.0f / IMPOSTOR_YAW_ANGLES;
const float yDivFactor = 1.0f / IMPOSTOR_PITCH_ANGLES;
for (int o = 0; o < IMPOSTOR_PITCH_ANGLES; ++o){ //4 pitch angle renders
#ifdef IMPOSTOR_RENDER_ABOVE_ONLY
Radian pitch = Degree((90.0f * o) * yDivFactor); //0, 22.5, 45, 67.5
#else
Radian pitch = Degree((180.0f * o) * yDivFactor - 90.0f);
#endif
for (int i = 0; i < IMPOSTOR_YAW_ANGLES; ++i){ //8 yaw angle renders
Radian yaw = Degree((360.0f * i) * xDivFactor); //0, 45, 90, 135, 180, 225, 270, 315
//Position camera
camNode->setPosition(0, 0, 0);
camNode->setOrientation(Quaternion(yaw, Vector3::UNIT_Y) * Quaternion(-pitch, Vector3::UNIT_X));
camNode->translate(Vector3(0, 0, objDist), Node::TS_LOCAL);
//Render the impostor
renderViewport->setDimensions((float)(i) * xDivFactor, (float)(o) * yDivFactor, xDivFactor, yDivFactor);
renderTarget->update();
}
}
#ifdef IMPOSTOR_FILE_SAVE
//Save RTT to file with respecting the temp dir
renderTarget->writeContentsToFile(tempdir + fileNamePNG);
//Load the render into the appropriate texture view
texture = TextureManager::getSingleton().load(fileNamePNG, "BinFolder", TEX_TYPE_2D, MIP_UNLIMITED);
#else
texture = renderTexture;
#endif
}
entity->setVisible(oldVisible);
entity->setRenderQueueGroup(oldRenderQueueGroup);
entity->setRenderingDistance(oldMaxDistance);
sceneMgr->removeSpecialCaseRenderQueue(group->geom->getRenderQueue() + 1);
// Restore original state
sceneMgr->setSpecialCaseRenderQueueMode(OldSpecialCaseRenderQueueMode);
//Re-enable mipmapping
mm->setDefaultTextureFiltering(oldMinFilter, oldMagFilter, oldMipFilter);
//Re-enable fog
sceneMgr->setFog(oldFogMode, oldFogColor, oldFogDensity, oldFogStart, oldFogEnd);
//Re-enable both scene lightning and disabled individual lights
sceneMgr->setAmbientLight(oldAmbientColour);
for (std::vector<Ogre::MovableObject*>::const_iterator I = lightStore.begin(); I != lightStore.end(); ++I) {
(*I)->setVisible(true);
}
//Delete camera
renderTarget->removeViewport(0);
renderCamera->getSceneManager()->destroyCamera(renderCamera);
//Delete scene node
node->detachAllObjects();
if (oldSceneNode) {
oldSceneNode->attachObject(entity);
}
#ifdef IMPOSTOR_FILE_SAVE
//Delete RTT texture
assert(!renderTexture.isNull());
String texName2(renderTexture->getName());
renderTexture.setNull();
if (TextureManager::getSingletonPtr())
TextureManager::getSingleton().remove(texName2);
#endif
}