本文整理汇总了C++中TextureManager::isFormatSupported方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::isFormatSupported方法的具体用法?C++ TextureManager::isFormatSupported怎么用?C++ TextureManager::isFormatSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::isFormatSupported方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mMasterViewport
DepthRenderer::DepthRenderer
(
Viewport* masterViewport
):
mMasterViewport (masterViewport),
mDepthRenderViewport (0),
mDepthRenderingNow (false),
mViewportVisibilityMask (~0),
mUseCustomDepthScheme (true),
mCustomDepthSchemeName (DEFAULT_CUSTOM_DEPTH_SCHEME_NAME)
{
disableRenderGroupRangeFilter ();
Ogre::String uniqueId = Ogre::StringConverter::toString ((size_t)this);
// Not cloned!
mDepthRenderMaterial = MaterialManager::getSingleton ().getByName ("Caelum/DepthRender");
mDepthRenderMaterial->load();
if (!mDepthRenderMaterial->getBestTechnique ()) {
CAELUM_THROW_UNSUPPORTED_EXCEPTION (
"Can't load depth render material: " +
mDepthRenderMaterial->getUnsupportedTechniquesExplanation(),
"DepthComposer");
}
TextureManager* texMgr = TextureManager::getSingletonPtr();
int width = getMasterViewport ()->getActualWidth ();
int height = getMasterViewport ()->getActualHeight ();
LogManager::getSingleton ().logMessage (
"Caelum::DepthRenderer: Creating depth render texture size " +
StringConverter::toString (width) +
"x" +
StringConverter::toString (height));
PixelFormat desiredFormat = PF_FLOAT32_R;
PixelFormat requestFormat = desiredFormat;
if (texMgr->isFormatSupported (TEX_TYPE_2D, desiredFormat, TU_RENDERTARGET)) {
LogManager::getSingleton ().logMessage (
"Caelum::DepthRenderer: RenderSystem has native support for " +
PixelUtil::getFormatName (desiredFormat));
} else if (texMgr->isEquivalentFormatSupported (TEX_TYPE_2D, desiredFormat, TU_RENDERTARGET)) {
PixelFormat equivFormat = texMgr->getNativeFormat (TEX_TYPE_2D, desiredFormat, TU_RENDERTARGET);
LogManager::getSingleton ().logMessage (
"Caelum::DepthRenderer: RenderSystem supports " +
PixelUtil::getFormatName (equivFormat) +
" instead of " +
PixelUtil::getFormatName (desiredFormat));
requestFormat = equivFormat;
} else {
CAELUM_THROW_UNSUPPORTED_EXCEPTION (
PixelUtil::getFormatName(desiredFormat) + " or equivalent not supported",
"DepthRenderer");
}
if (texMgr->isHardwareFilteringSupported (TEX_TYPE_2D, requestFormat, TU_RENDERTARGET)) {
LogManager::getSingleton ().logMessage (
"Caelum::DepthRenderer: RenderSystem supports hardware filtering for " +
PixelUtil::getFormatName (requestFormat));
} else {
LogManager::getSingleton ().logMessage (
"Caelum::DepthRenderer: RenderSystem does not support hardware filtering for " +
PixelUtil::getFormatName (requestFormat));
}
// Create depth texture.
// This depends on the size of the viewport.
mDepthRenderTexture = texMgr->createManual(
"Caelum/DepthComposer/" + uniqueId + "/DepthTexture",
Caelum::RESOURCE_GROUP_NAME,
TEX_TYPE_2D,
width, height, 1,
0,
requestFormat,
TU_RENDERTARGET,
0);
assert(getDepthRenderTarget());
// Should be the same format
LogManager::getSingleton().logMessage (
"Caelum::DepthRenderer: Created depth render texture"
" actual format " + PixelUtil::getFormatName (getDepthRenderTexture()->getFormat ()) +
" desired format " + PixelUtil::getFormatName (getDepthRenderTexture()->getDesiredFormat ()));
// We do our updates by hand.
getDepthRenderTarget()->setAutoUpdated (false);
// Viewport for the depth rtt. Don't set camera here; it can mess Camera::getViewport();
mDepthRenderViewport = getDepthRenderTarget()->addViewport(0);
getDepthRenderViewport ()->setShadowsEnabled (false);
getDepthRenderViewport ()->setOverlaysEnabled (false);
getDepthRenderViewport ()->setClearEveryFrame (true);
// Depth buffer values range from 0 to 1 in both OpenGL and Directx; unless depth ranges are used.
// Clear to the maximum value.
getDepthRenderViewport ()->setBackgroundColour (Ogre::ColourValue (1, 1, 1, 1));
}