Esempio n. 1
0
    void Canvas::frameEntered( float _time )
    {
        int width = mReqTexSize.width;
        int height = mReqTexSize.height;
        TextureUsage usage = getDefaultTextureUsage();
        PixelFormat format = getDefaultTextureFormat();

        validate( width, height, usage, format );

        bool create = checkCreate( width, height );

        if ( mTexResizeMode == TRM_PT_CONST_SIZE )
            create = false;

        if ( create )
        {
            createExactTexture( width, height, usage, format );
            correctUV();
        }
        else // I thought order is important
        {
            correctUV();
            requestUpdateCanvas( this, Event( false, true, mInvalidateData ) );
        }

        mInvalidateData = false;
        frameAdvise( false );
    }
Esempio n. 2
0
	void Canvas::validate( int & _width, int & _height, Ogre::TextureUsage & _usage, Ogre::PixelFormat & _format ) const
	{
		validateSize( _width, _height );

		// restore usage and format
		if( ! mTexPtr.isNull() )
		{
			if( _usage == getDefaultTextureUsage() )
				_usage = (Ogre::TextureUsage) mTexPtr->getUsage();

			if( _format == getDefaultTextureFormat() )
				_format = mTexPtr->getFormat();
		}
	}
Esempio n. 3
0
    void Canvas::validate( int& _width, int& _height, TextureUsage& _usage, PixelFormat& _format ) const
    {
        _width = std::max(1, _width);
        _height = std::max(1, _height);

        _width = Bitwise::firstPO2From(_width);
        _height = Bitwise::firstPO2From(_height);

        // restore usage and format
        if ( mTexture != nullptr )
        {
            if ( _usage == getDefaultTextureUsage() )
                _usage = mTexture->getUsage();

            if ( _format == getDefaultTextureFormat() )
                _format = mTexture->getFormat();
        }
    }