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


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

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


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

示例1: createAnimatedTextureState

	//------------------------------------------------------------------------------------
	Ogre::TextureUnitState* MaterialService::createAnimatedTextureState(Pass* pass, const String& baseTextureName, const String& resourceGroup, float fps) {
		//
		// Texture unit state for the main texture...
		TextureUnitState* tus = pass->createTextureUnitState(baseTextureName);

		StringVectorPtr mat_textures;

		// if if was found, then we'll proceed by enumerating all the resources with the same name,
		// but with _NUMBER
		mat_textures = getAnimTextureNames(baseTextureName, resourceGroup);

		// if we have anim. textures:
		if (!mat_textures.isNull() && mat_textures->size() > 1) {
			// convert to String* array
			size_t size = mat_textures->size();

			String* sarray = new String[size];

			size_t s = 0;
			for (StringVector::iterator it = mat_textures->begin(); s < size; ++it, ++s) {
				sarray[s] = *it;
			}

			tus->setAnimatedTextureName(sarray, size, size/fps);

			delete[] sarray;
		}

		return tus;

	}
开发者ID:Painpillow,项目名称:openDarkEngine,代码行数:32,代码来源:MaterialService.cpp

示例2: getAnimTextureNames

//------------------------------------------------------------------------------------
Ogre::TextureUnitState *MaterialService::createAnimatedTextureState(
    Pass *pass, const String &baseTextureName, const String &resourceGroup,
    float fps) {
    //
    // Texture unit state for the main texture...
    TextureUnitState *tus = pass->createTextureUnitState(baseTextureName);

    // if if was found, then we'll proceed by enumerating all the resources with
    // the same name, but with _NUMBER
    auto mat_textures = getAnimTextureNames(baseTextureName, resourceGroup);

    // if we have anim. textures:
    if (mat_textures.size() > 1) {
        // convert to String* array
        size_t size = mat_textures.size();

        std::unique_ptr<String[]> sarray(new String[size]);

        size_t i = 0;
        for (const String &s : mat_textures) {
            sarray[i++] = s;
        }

        tus->setAnimatedTextureName(sarray.get(), size, size / fps);
    }

    return tus;
}
开发者ID:volca02,项目名称:openDarkEngine,代码行数:29,代码来源:MaterialService.cpp

示例3: if

    //-----------------------------------------------------------------------
    MaterialPtr Quake3Shader::createAsMaterial(int lightmapNumber)
    {
		String matName;
		StringUtil::StrStreamType str;
        String resourceGroup = ResourceGroupManager::getSingleton().getWorldResourceGroupName();

        str << mName << "#" << lightmapNumber;
		matName = str.str();

        MaterialPtr mat = MaterialManager::getSingleton().create(matName, 
            resourceGroup);
		Ogre::Pass* ogrePass = mat->getTechnique(0)->getPass(0);

        LogManager::getSingleton().logMessage("Using Q3 shader " + mName, LML_CRITICAL);
        for (int p = 0; p < numPasses; ++p)
        {
            TextureUnitState* t;
            // Create basic texture
            if (pass[p].textureName == "$lightmap")
            {
                StringUtil::StrStreamType str2;
				str2 << "@lightmap" << lightmapNumber;
                t = ogrePass->createTextureUnitState(str2.str());
            }
            // Animated texture support
            else if (pass[p].animNumFrames > 0)
            {
                Real sequenceTime = pass[p].animNumFrames / pass[p].animFps;
                /* Pre-load textures
                   We need to know if each one was loaded OK since extensions may change for each
                   Quake3 can still include alternate extension filenames e.g. jpg instead of tga
                   Pain in the arse - have to check for each frame as letters<n>.tga for example
                   is different per frame!
                */
                for (unsigned int alt = 0; alt < pass[p].animNumFrames; ++alt)
                {
                    if (!ResourceGroupManager::getSingleton().resourceExists(
                        resourceGroup, pass[p].frames[alt]))
                    {
                        // Try alternate extension
                        pass[p].frames[alt] = getAlternateName(pass[p].frames[alt]);
                        if (!ResourceGroupManager::getSingleton().resourceExists(
                            resourceGroup, pass[p].frames[alt]))
                        { 
                            // stuffed - no texture
                            continue;
                        }
                    }

                }

                t = ogrePass->createTextureUnitState("");
                t->setAnimatedTextureName(pass[p].frames, pass[p].animNumFrames, sequenceTime);

            }
            else
            {
                // Quake3 can still include alternate extension filenames e.g. jpg instead of tga
                // Pain in the arse - have to check for failure
                if (!ResourceGroupManager::getSingleton().resourceExists(
                    resourceGroup, pass[p].textureName))
                {
                    // Try alternate extension
                    pass[p].textureName = getAlternateName(pass[p].textureName);
                    if (!ResourceGroupManager::getSingleton().resourceExists(
                        resourceGroup, pass[p].textureName))
                    { 
                        // stuffed - no texture
                        continue;
                    }
                }
                t = ogrePass->createTextureUnitState(pass[p].textureName);
            }
            // Blending
            if (p == 0)
            {
                // scene blend
                mat->setSceneBlending(pass[p].blendSrc, pass[p].blendDest);
                if (mat->isTransparent())
                    mat->setDepthWriteEnabled(false);

                t->setColourOperation(LBO_REPLACE);
				// Alpha mode
				ogrePass->setAlphaRejectSettings(
					pass[p].alphaFunc, pass[p].alphaVal);
            }
            else
            {
                if (pass[p].customBlend)
                {
                    // Fallback for now
                    t->setColourOperation(LBO_MODULATE);
                }
                else
                {
                    // simple layer blend
                    t->setColourOperation(pass[p].blend);
                }
				// Alpha mode, prefer 'most alphary'
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:likeleon,代码行数:101,代码来源:OgreQuake3Shader.cpp


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