コード例 #1
0
 //-----------------------------------------------------------------------
 void TextureUnitState::setCubicTextureName(const String* const names, bool forUVW)
 {
     mFramePtrs.resize(forUVW ? 1 : 6);
     for (unsigned int i = 0; i < mFramePtrs.size(); ++i)
     {
         mFramePtrs[i] = retrieveTexture(names[i]);
         mFramePtrs[i]->setTextureType(forUVW ? TEX_TYPE_CUBE_MAP : TEX_TYPE_2D);
     }
     setCubicTexture(&mFramePtrs[0], forUVW);
 }
コード例 #2
0
    //-----------------------------------------------------------------------
    void TextureUnitState::setTexture( const TexturePtr& texPtr)
    {
        if (!texPtr)
        {
            OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
                "Texture Pointer is empty.",
                "TextureUnitState::setTexture");
        }

        setContentType(CONTENT_NAMED);
        mTextureLoadFailed = false;

        if (texPtr->getTextureType() == TEX_TYPE_CUBE_MAP)
        {
            // delegate to cubic texture implementation
            setCubicTexture(&texPtr, true);
            return;
        }
        
        if (texPtr->getTextureType() == TEX_TYPE_EXTERNAL_OES || texPtr->getTextureType() == TEX_TYPE_2D_RECT)
        {
            setTextureAddressingMode( TAM_CLAMP );
        }

        mFramePtrs.resize(1);
        mFramePtrs[0] = texPtr;

        mCurrentFrame = 0;
        mCubic = false;

        // Load immediately ?
        if (isLoaded())
        {
            _load(); // reload
        }
        // Tell parent to recalculate hash
        if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
        {
            mParent->_dirtyHash();
        }
    }
コード例 #3
0
	//-----------------------------------------------------------------------
	void TextureUnitState::setTexture( const TexturePtr& texPtr)
	{
		if (texPtr.isNull())
		{
			OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
				"Texture Pointer is empty.",
				"TextureUnitState::setTexture");
		}

		setContentType(CONTENT_NAMED);
		mTextureLoadFailed = false;

		if (texPtr->getTextureType() == TEX_TYPE_CUBE_MAP)
		{
			// delegate to cubic texture implementation
			setCubicTexture(&texPtr, true);
		}
		else
		{
			mFrames.resize(1);
			mFramePtrs.resize(1);
			mFrames[0] = texPtr->getName();
			mFramePtrs[0] = texPtr;
			// defer load until used, so don't grab pointer yet
			mCurrentFrame = 0;
			mCubic = false;
			mTextureType = texPtr->getTextureType();

			// Load immediately ?
			if (isLoaded())
			{
				_load(); // reload
			}
			// Tell parent to recalculate hash
			if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
			{
				mParent->_dirtyHash();
			}
		}
	}