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


C++ TextureUnitState::getTextureAddressingMode方法代码示例

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


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

示例1: exportFont

    // ----------------------------------------------------------------------
    void FontSerializer::exportFont(const Font *pFont, const Ogre::String &fileName)
    {
        // Open/create the file
		mpfFile = fopen(fileName.c_str(), "wb");
		if (!mpfFile)
		{
		    // Throw an error if the file was not found, or was not possible to read
		    SONETTO_THROW("A file was not found!");
		}
		fwrite(&Font::mFourCC, sizeof(uint32), 1, mpfFile);

		fwrite(&pFont->mVersion, sizeof(uint32), 1, mpfFile);
		fwrite(&pFont->mEncode, sizeof(uint32), 1, mpfFile);
		fwrite(&pFont->mVerticalOffsetTop, sizeof(float), 1, mpfFile);
		fwrite(&pFont->mVerticalOffsetBottom, sizeof(float), 1, mpfFile);
		fwrite(&pFont->mHorizontalScale, sizeof(float), 1, mpfFile);

		saveString(pFont->mIName);

		if(pFont->mMaterial.isNull())
            SONETTO_THROW("Material does not exist");

		Ogre::Pass * pass = pFont->mMaterial->getTechnique(0)->getPass(0);

		bool has_separate_blend = pass->hasSeparateSceneBlending();

        uint32 mat_scene_blend_source = (uint32)pass->getSourceBlendFactor();
        uint32 mat_scene_blend_dest = (uint32)pass->getDestBlendFactor();
        uint32 mat_scene_blend_source_a = (uint32)pass->getSourceBlendFactorAlpha();
        uint32 mat_scene_blend_dest_a = (uint32)pass->getDestBlendFactorAlpha();

        fwrite(&has_separate_blend, sizeof(bool), 1, mpfFile);
        fwrite(&mat_scene_blend_source, sizeof(uint32), 1, mpfFile);
        fwrite(&mat_scene_blend_dest, sizeof(uint32), 1, mpfFile);
        fwrite(&mat_scene_blend_source_a, sizeof(uint32), 1, mpfFile);
        fwrite(&mat_scene_blend_dest_a, sizeof(uint32), 1, mpfFile);

        uint32 mat_alpha_reject_func = (uint32)pass->getAlphaRejectFunction();
        uint8 mat_alpha_reject_val = (uint8)pass->getAlphaRejectValue();
        bool map_alpha_reject_atc = pass->isAlphaToCoverageEnabled();

        fwrite(&mat_alpha_reject_func, sizeof(uint32), 1, mpfFile);
        fwrite(&mat_alpha_reject_val, sizeof(uint8), 1, mpfFile);
        fwrite(&map_alpha_reject_atc, sizeof(bool), 1, mpfFile);

        Ogre::TextureUnitState * texunit = pass->getTextureUnitState(0);

        Ogre::TextureUnitState::UVWAddressingMode tex_address_mode_uvw = texunit->getTextureAddressingMode();

        uint32 tex_address_mode_u = (uint32)tex_address_mode_uvw.u;
        uint32 tex_address_mode_v = (uint32)tex_address_mode_uvw.v;
        uint32 tex_address_mode_w = (uint32)tex_address_mode_uvw.w;

        uint32 tex_filtering_min = (uint32)texunit->getTextureFiltering(Ogre::FT_MIN);
        uint32 tex_filtering_mag = (uint32)texunit->getTextureFiltering(Ogre::FT_MAG);
        Ogre::ColourValue tex_border_color = texunit->getTextureBorderColour();

        fwrite(&tex_address_mode_u,sizeof(uint32), 1, mpfFile);
        fwrite(&tex_address_mode_v,sizeof(uint32), 1, mpfFile);
        fwrite(&tex_address_mode_w,sizeof(uint32), 1, mpfFile);
        fwrite(&tex_filtering_min,sizeof(uint32), 1, mpfFile);
        fwrite(&tex_filtering_mag,sizeof(uint32), 1, mpfFile);
        fwrite(tex_border_color.ptr(),sizeof(float)*4, 1, mpfFile);

        uint32 colsize = (uint32)pFont->mColorList.size();
        fwrite(&colsize,sizeof(uint32), 1, mpfFile);

        for(uint32 i = 0; i != colsize; ++i)
        {
            fwrite(pFont->mColorList[i].ptr(),sizeof(float)*4, 1, mpfFile);
        }

        for(uint32 i = 0; i != 256; ++i)
        {
            FontGlyph glyph = pFont->mGlyph[i];
            fwrite(&glyph, sizeof(FontGlyph), 1,mpfFile);
        }

        Ogre::Image * tex = pFont->mFontImage;

        size_t uWidth = tex->getWidth();
        size_t uHeight = tex->getHeight();
        size_t uDepth = tex->getDepth();
		size_t eFormat = (uint32)tex->getFormat();
		size_t numFaces = tex->getNumFaces();
		size_t numMipMaps = tex->getNumMipmaps();

		fwrite(&uWidth, sizeof(size_t), 1, mpfFile);
		fwrite(&uHeight, sizeof(size_t), 1, mpfFile);
		fwrite(&uDepth, sizeof(size_t), 1, mpfFile);
		fwrite(&eFormat, sizeof(size_t), 1, mpfFile);
		fwrite(&numFaces, sizeof(size_t), 1, mpfFile);
		fwrite(&numMipMaps, sizeof(size_t), 1, mpfFile);

		size_t texdatasize = Ogre::Image::calculateSize(numMipMaps,
                                                        numFaces,
                                                        uWidth,
                                                        uHeight,
                                                        uDepth,
//.........这里部分代码省略.........
开发者ID:gmasucci,项目名称:sonetto,代码行数:101,代码来源:SonettoFontSerializer.cpp


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