Allow to force a texture bind.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2018-03-20 20:36:54 -03:00
parent f43c486900
commit 7cd326960e
3 changed files with 9 additions and 7 deletions

View File

@@ -97,15 +97,17 @@ class EE_API TextureFactory : protected Mutex {
/** Bind the the internal Texture Id indicated. This is useful if you are rendering a texture outside this class.
* @param TexId The internal Texture Id
* @param coordinateType Use normalized or pixel coordinates
* @param TextureUnit The Texture Unit binded
* @param forceRebind Force the texture bind
*/
void bind( const Uint32& TexId, Texture::CoordinateType coordinateType = Texture::CoordinateType::Normalized, const Uint32& textureUnit = 0 );
void bind( const Uint32& TexId, Texture::CoordinateType coordinateType = Texture::CoordinateType::Normalized, const Uint32& textureUnit = 0, const bool& forceRebind = false );
/** Bind the the Texture indicated. This is useful if you are rendering a texture outside this class.
* @param Tex The Texture Pointer
* @param TextureUnit The Texture Unit binded
*/
void bind( const Texture* Tex, Texture::CoordinateType coordinateType = Texture::CoordinateType::Normalized, const Uint32& TextureUnit = 0 );
void bind( const Texture* Tex, Texture::CoordinateType coordinateType = Texture::CoordinateType::Normalized, const Uint32& TextureUnit = 0, const bool& forceRebind = false );
/**
* @param TexId The internal Texture Id

View File

@@ -239,7 +239,7 @@ class EE_API UIWindow : public UIWidget {
virtual void postDraw();
Sizei getFrameBufferSize();
virtual Sizei getFrameBufferSize();
UISceneNode * getUISceneNode();
};

View File

@@ -109,9 +109,9 @@ Uint32 TextureFactory::findFreeSlot() {
return (Uint32)mTextures.size() - 1;
}
void TextureFactory::bind( const Texture* texture, Texture::CoordinateType coordinateType, const Uint32& TextureUnit ) {
void TextureFactory::bind( const Texture* texture, Texture::CoordinateType coordinateType, const Uint32& TextureUnit, const bool& forceRebind ) {
if( NULL != texture ) {
if ( mCurrentTexture[ TextureUnit ] != (Int32)texture->getHandle() ) {
if ( mCurrentTexture[ TextureUnit ] != (Int32)texture->getHandle() || forceRebind ) {
if ( TextureUnit && GLi->isExtension( EEGL_ARB_multitexture ) )
setActiveTextureUnit( TextureUnit );
@@ -153,8 +153,8 @@ void TextureFactory::bind( const Texture* texture, Texture::CoordinateType coord
}
}
void TextureFactory::bind( const Uint32& TexId, Texture::CoordinateType coordinateType, const Uint32& textureUnit ) {
bind( getTexture( TexId ), coordinateType, textureUnit );
void TextureFactory::bind( const Uint32& TexId, Texture::CoordinateType coordinateType, const Uint32& textureUnit, const bool& forceRebind ) {
bind( getTexture( TexId ), coordinateType, textureUnit, forceRebind );
}
void TextureFactory::unloadTextures() {