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


C++ TextureList::push_back方法代码示例

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


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

示例1:

// ------------------------------------------------------------------------------------------------
void LWOImporter::LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head, unsigned int size )
{
	ai_assert(!mSurfaces->empty());
	LWO::Surface& surf = mSurfaces->back();
	LWO::Texture tex;

	// load the texture header
	LoadLWO2TextureHeader(head->length,tex);
	size -= head->length + 6;

	// now get the exact type of the texture
	switch (head->type)
	{
	case AI_LWO_PROC:
		LoadLWO2Procedural(size,tex);
		break;
	case AI_LWO_GRAD:
		LoadLWO2Gradient(size,tex); 
		break;
	case AI_LWO_IMAP:
		LoadLWO2ImageMap(size,tex);
	}

	// get the destination channel
	TextureList* listRef = NULL;
	switch (tex.type)
	{
	case AI_LWO_COLR:
		listRef = &surf.mColorTextures;break;
	case AI_LWO_DIFF:
		listRef = &surf.mDiffuseTextures;break;
	case AI_LWO_SPEC:
		listRef = &surf.mSpecularTextures;break;
	case AI_LWO_GLOS:
		listRef = &surf.mGlossinessTextures;break;
	case AI_LWO_BUMP:
		listRef = &surf.mBumpTextures;break;
	case AI_LWO_TRAN:
		listRef = &surf.mOpacityTextures;break;
	case AI_LWO_REFL:
		listRef = &surf.mReflectionTextures;break;
	default:
		DefaultLogger::get()->warn("LWO2: Encountered unknown texture type");
		return;
	}

	// now attach the texture to the parent surface - sort by ordinal string
	for (TextureList::iterator it = listRef->begin();it != listRef->end(); ++it)	{
		if (::strcmp(tex.ordinal.c_str(),(*it).ordinal.c_str()) < 0)	{
			listRef->insert(it,tex);
			return;
		}
	}
	listRef->push_back(tex);
}
开发者ID:JonathanWang1,项目名称:assimp,代码行数:56,代码来源:LWOMaterial.cpp

示例2: getPooledTexture

//---------------------------------------------------------------------
TexturePtr CompositorManager::getPooledTexture(const String& name, 
    const String& localName,
    size_t w, size_t h, PixelFormat f, uint aa, const String& aaHint, bool srgb, 
    CompositorManager::UniqueTextureSet& texturesAssigned, 
    CompositorInstance* inst, CompositionTechnique::TextureScope scope)
{
    if (scope == CompositionTechnique::TS_GLOBAL) 
    {
        OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
            "Global scope texture can not be pooled.",
            "CompositorManager::getPooledTexture");
    }

    TextureDef def(w, h, f, aa, aaHint, srgb);

    if (scope == CompositionTechnique::TS_CHAIN)
    {
        StringPair pair = std::make_pair(inst->getCompositor()->getName(), localName);
        TextureDefMap& defMap = mChainTexturesByDef[pair];
        TextureDefMap::iterator it = defMap.find(def);
        if (it != defMap.end())
        {
            return it->second;
        }
        // ok, we need to create a new one
        TexturePtr newTex = TextureManager::getSingleton().createManual(
            name, 
            ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME, TEX_TYPE_2D, 
            (uint)w, (uint)h, 0, f, TU_RENDERTARGET, 0,
            srgb, aa, aaHint);
        defMap.insert(TextureDefMap::value_type(def, newTex));
        return newTex;
    }

    TexturesByDef::iterator i = mTexturesByDef.find(def);
    if (i == mTexturesByDef.end())
    {
        TextureList* texList = OGRE_NEW_T(TextureList, MEMCATEGORY_GENERAL);
        i = mTexturesByDef.insert(TexturesByDef::value_type(def, texList)).first;
    }
    CompositorInstance* previous = inst->getChain()->getPreviousInstance(inst);
    CompositorInstance* next = inst->getChain()->getNextInstance(inst);

    TexturePtr ret;
    TextureList* texList = i->second;
    // iterate over the existing textures and check if we can re-use
    for (TextureList::iterator t = texList->begin(); t != texList->end(); ++t)
    {
        TexturePtr& tex = *t;
        // check not already used
        if (texturesAssigned.find(tex.get()) == texturesAssigned.end())
        {
            bool allowReuse = true;
            // ok, we didn't use this one already
            // however, there is an edge case where if we re-use a texture
            // which has an 'input previous' pass, and it is chained from another
            // compositor, we can end up trying to use the same texture for both
            // so, never allow a texture with an input previous pass to be 
            // shared with its immediate predecessor in the chain
            if (isInputPreviousTarget(inst, localName))
            {
                // Check whether this is also an input to the output target of previous
                // can't use CompositorInstance::mPreviousInstance, only set up
                // during compile
                if (previous && isInputToOutputTarget(previous, tex))
                    allowReuse = false;
            }
            // now check the other way around since we don't know what order they're bound in
            if (isInputToOutputTarget(inst, localName))
            {
                
                if (next && isInputPreviousTarget(next, tex))
                    allowReuse = false;
            }
            
            if (allowReuse)
            {
                ret = tex;
                break;
            }

        }
    }

    if (ret.isNull())
    {
        // ok, we need to create a new one
        ret = TextureManager::getSingleton().createManual(
            name, 
            ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME, TEX_TYPE_2D, 
            (uint)w, (uint)h, 0, f, TU_RENDERTARGET, 0,
            srgb, aa, aaHint); 

        texList->push_back(ret);

    }

    // record that we used this one in the requester's list
    texturesAssigned.insert(ret.get());
//.........这里部分代码省略.........
开发者ID:Gerviba,项目名称:MuOnline,代码行数:101,代码来源:OgreCompositorManager.cpp

示例3: Render

double GraphicsEntity::Render( TextureList& out, float frameTime, AnimSpeed speed )
{
    if( !Active() )
        return 0.; // Shouldn't happen; inactive doesn't collide with camera

    const size_t layCount = m_Layers.Size();
    if( layCount == 0 )
        return 0.;

    std::vector<GraphCompLoc> layers;
    RSKMAP_ITERATE( m_Layers )
    layers.push_back( iter->first );
    if( layCount > 1 )
    {
        //
        // Basic loc value sorting to maintain layer consistency
        GraphCompLoc nll, naa;
        for( size_t lll = layCount-1; lll < layCount; --lll )
        {
            nll = layers[lll];
            for( size_t aaa = lll-1; aaa < layCount; --aaa )
            {
                naa = layers[aaa];
                if( naa < nll )
                {
                    layers[lll] = naa;
                    layers[aaa] = nll;
                    nll = naa;
                }
            }
        }

        if( m_HaveOffset && mp_Sort )
        {
            //
            // At least one loc has an offset, so sort by loc offset
            size_t
            lll,
            aaa;
            GraphCompLoc mll;
            int
            ox,
            oy,
            oz,
            aox,
            aoy,
            aoz;
            for( lll = 0; lll < layCount; ++lll )
            {
                nll = layers[lll];
                const rsk::Vector3I& offset = m_Offsets[nll];
                ox = offset.x;
                oy = offset.y;
                oz = offset.z;
                for( aaa = lll+1; aaa < layCount; ++aaa )
                {
                    naa = layers[aaa];
                    const rsk::Vector3I& offset = m_Offsets[naa];
                    aox = offset.x;
                    aoy = offset.y;
                    aoz = offset.z;

                    mll = mp_Sort( nll, naa, ox, oy, oz, aox, aoy, aoz );
                    if( mll != nll )
                    {
                        layers[lll] = mll;
                        layers[aaa] = nll;
                        nll = mll;
                        ox = aox;
                        oy = aoy;
                        oz = aoz;
                    }
                }
            } // for lll
        } // if have offset
    } // if layCount > 1
    //
    // Commit the layers to be rendered
    for( size_t lll = layCount-1; lll < layCount; --lll )
        out.push_back( m_Layers[ layers[lll] ]->Render(frameTime, speed) );

    return m_Rotation;
}
开发者ID:rsk78n,项目名称:zoya,代码行数:83,代码来源:graphicsentity.cpp


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