当前位置: 首页>>代码示例>>C++>>正文


C++ TexturePtr::getNumFaces方法代码示例

本文整理汇总了C++中TexturePtr::getNumFaces方法的典型用法代码示例。如果您正苦于以下问题:C++ TexturePtr::getNumFaces方法的具体用法?C++ TexturePtr::getNumFaces怎么用?C++ TexturePtr::getNumFaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TexturePtr的用法示例。


在下文中一共展示了TexturePtr::getNumFaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copyToTexture

 //-----------------------------------------------------------------------------   
 void Texture::copyToTexture( TexturePtr& target )
 {
     if(target->getNumFaces() != getNumFaces())
     {
         OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
             "Texture types must match",
             "Texture::copyToTexture");
     }
     size_t numMips = std::min(getNumMipmaps(), target->getNumMipmaps());
     if((mUsage & TU_AUTOMIPMAP) || (target->getUsage()&TU_AUTOMIPMAP))
         numMips = 0;
     for(unsigned int face=0; face<getNumFaces(); face++)
     {
         for(unsigned int mip=0; mip<=numMips; mip++)
         {
             target->getBuffer(face, mip)->blit(getBuffer(face, mip));
         }
     }
 }
开发者ID:masonh,项目名称:marblemax,代码行数:20,代码来源:OgreTexture.cpp

示例2: calculateRenderTarget

    //-----------------------------------------------------------------------------------
    RenderTarget* CompositorPass::calculateRenderTarget( size_t rtIndex,
                                                         const CompositorChannel &source )
    {
        RenderTarget *retVal;

        if( !source.isMrt() && !source.textures.empty() &&
            source.textures[0]->getTextureType() > TEX_TYPE_2D )
        {
            //Who had the bright idea of handling Cubemaps differently
            //than 3D textures is a mystery. Anyway, deal with it.
            TexturePtr texturePtr = source.textures[0];

            if( rtIndex >= texturePtr->getDepth() && rtIndex >= texturePtr->getNumFaces() )
            {
                size_t maxRTs = std::max<size_t>( source.textures[0]->getDepth(),
                                                    source.textures[0]->getNumFaces() );
                OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
                        "Compositor pass is asking for a 3D/Cubemap/2D_array texture with "
                        "more faces/depth/slices than what's been supplied (Asked for slice '" +
                        StringConverter::toString( rtIndex ) + "', RT has '" +
                        StringConverter::toString( maxRTs ) + "')",
                        "CompositorPass::calculateRenderTarget" );
            }

            /*//If goes out bounds, will reference the last slice/face
            rtIndex = std::min( rtIndex, std::max( source.textures[0]->getDepth(),
                                                    source.textures[0]->getNumFaces() ) - 1 );*/

            TextureType textureType = texturePtr->getTextureType();
            size_t face = textureType == TEX_TYPE_CUBE_MAP ? rtIndex : 0;
            size_t slice= textureType != TEX_TYPE_CUBE_MAP ? rtIndex : 0;
            retVal = texturePtr->getBuffer( face )->getRenderTarget( slice );
        }
        else
        {
            retVal = source.target;
        }

        return retVal;
    }
开发者ID:amerkoleci,项目名称:mogre,代码行数:41,代码来源:OgreCompositorPass.cpp

示例3: updateControls

void TextureToolWindow::updateControls(String texName)
{
    try
    {
        bool exists = TextureManager::getSingleton().resourceExists(texName);
        if (!exists)
        {
            mTxt->setCaption(convertToMyGUIString("Texture not found:\n" + texName));
            mBtnSavePNG->setEnabled(false);
            return;
        }

        TexturePtr tex = TextureManager::getSingleton().getByName(texName);
        if (tex.isNull())
        {
            mTxt->setCaption(convertToMyGUIString("Error loading texture:\n" + texName));
            mBtnSavePNG->setEnabled(false);
            return;
        }

        String str = "#aa0000" + texName + "#000000\n";
        str += "#00aa00res: #000000" + TOSTRING(tex->getWidth()) + " x " + TOSTRING(tex->getHeight()) + " pixels\n";
        str += "#00aa00size: #000000" + formatBytes(tex->getSize()) + "\n";
        str += "#00aa00format: #000000" + PixelUtil::getFormatName(tex->getFormat()) + "\n";
        if (tex->getNumFaces() > 1)
            str += "#00aa00faces: #000000" + TOSTRING(tex->getNumFaces()) + "\n";
        if (tex->getFSAA() > 0)
            str += "#00aa00FSAA: #000000" + TOSTRING(tex->getFSAA()) + "\n";
        if (tex->getNumMipmaps() > 0)
            str += "#00aa00mipmaps: #000000" + TOSTRING(tex->getNumMipmaps()) + "\n";

        String typeStr = "";
        switch (tex->getTextureType())
        {
        case TEX_TYPE_1D: typeStr = "1D";
            break;
        case TEX_TYPE_2D: typeStr = "2D";
            break;
        case TEX_TYPE_3D: typeStr = "3D";
            break;
        case TEX_TYPE_CUBE_MAP: typeStr = "Cube Map";
            break;
        }
        str += "#00aa00type: #000000" + typeStr + "\n";

        String usageStr = "";
        if (tex->getUsage() & TU_STATIC)
            usageStr += "static,\n";
        if (tex->getUsage() & TU_DYNAMIC)
            usageStr += "dynamic,\n";
        if (tex->getUsage() & TU_WRITE_ONLY)
            usageStr += "write only,\n";
        if (tex->getUsage() & TU_STATIC_WRITE_ONLY)
            usageStr += "static write only,\n";
        if (tex->getUsage() & TU_DYNAMIC_WRITE_ONLY)
            usageStr += "dynamic write only,\n";
        if (tex->getUsage() & TU_DYNAMIC_WRITE_ONLY_DISCARDABLE)
            usageStr += "dynamic write only discardable,\n";
        if (tex->getUsage() & TU_AUTOMIPMAP)
            usageStr += "automipmap,\n";
        if (tex->getUsage() & TU_RENDERTARGET)
            usageStr += "rendertarget,\n";
        if (tex->getUsage() & TU_DEFAULT)
            usageStr += "default\n";

        str += "#00aa00usage: #000000" + usageStr + "\n";
        if (tex->getDepth() > 1)
            str += "#00aa00depth: #000000" + TOSTRING(tex->getDepth()) + "\n";

        mTxt->setCaption(convertToMyGUIString(str));
        mImage->setImageTexture(texName);
        mBtnSavePNG->setEnabled(true);
    }
    catch (Exception& e)
    {
        UTFString str = "Exception while opening texture:" + e.getFullDescription();
        RoR::App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_MSGTYPE_INFO, str, "error.png");
    }
}
开发者ID:jirijunek,项目名称:rigs-of-rods,代码行数:79,代码来源:GUI_TextureToolWindow.cpp


注:本文中的TexturePtr::getNumFaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。