Class DefaultTextureBinder
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.utils.DefaultTextureBinder
-
- All Implemented Interfaces:
TextureBinder
public final class DefaultTextureBinder extends java.lang.Object implements TextureBinder
Class that you assign a range of texture units and binds textures for you within that range. It does some basic usage tracking to avoid unnecessary bind calls.
-
-
Field Summary
Fields Modifier and Type Field Description static intLRUstatic intMAX_GLES_UNITSGLES only supports up to 32 texturesstatic intROUNDROBIN
-
Constructor Summary
Constructors Constructor Description DefaultTextureBinder(int method)Uses all available texture units and reuse weight of 3DefaultTextureBinder(int method, int offset)Uses all remaining texture units and reuse weight of 3DefaultTextureBinder(int method, int offset, int count)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Prepares the binder for operation, must be matched with a call toTextureBinder.end().intbind(TextureDescriptor textureDesc)Binds the texture to an available unit and applies the filters in the descriptor.intbind(GLTexture texture)Binds the texture to an available unit.voidend()Disables all used texture units and unbinds textures.intgetBindCount()intgetReuseCount()voidresetCounts()Resets the bind/reuse counts
-
-
-
Field Detail
-
ROUNDROBIN
public static final int ROUNDROBIN
- See Also:
- Constant Field Values
-
LRU
public static final int LRU
- See Also:
- Constant Field Values
-
MAX_GLES_UNITS
public static final int MAX_GLES_UNITS
GLES only supports up to 32 textures- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultTextureBinder
public DefaultTextureBinder(int method)
Uses all available texture units and reuse weight of 3
-
DefaultTextureBinder
public DefaultTextureBinder(int method, int offset)Uses all remaining texture units and reuse weight of 3
-
DefaultTextureBinder
public DefaultTextureBinder(int method, int offset, int count)
-
-
Method Detail
-
begin
public void begin()
Description copied from interface:TextureBinderPrepares the binder for operation, must be matched with a call toTextureBinder.end().- Specified by:
beginin interfaceTextureBinder
-
end
public void end()
Description copied from interface:TextureBinderDisables all used texture units and unbinds textures. Resets the counts.- Specified by:
endin interfaceTextureBinder
-
bind
public final int bind(TextureDescriptor textureDesc)
Description copied from interface:TextureBinderBinds the texture to an available unit and applies the filters in the descriptor.- Specified by:
bindin interfaceTextureBinder- Parameters:
textureDesc- theTextureDescriptor- Returns:
- the unit the texture was bound to
-
bind
public final int bind(GLTexture texture)
Description copied from interface:TextureBinderBinds the texture to an available unit.- Specified by:
bindin interfaceTextureBinder- Parameters:
texture- theTexture- Returns:
- the unit the texture was bound to
-
getBindCount
public final int getBindCount()
- Specified by:
getBindCountin interfaceTextureBinder- Returns:
- the number of binds actually executed since the last call to
TextureBinder.resetCounts()
-
getReuseCount
public final int getReuseCount()
- Specified by:
getReuseCountin interfaceTextureBinder- Returns:
- the number of binds that could be avoided by reuse
-
resetCounts
public final void resetCounts()
Description copied from interface:TextureBinderResets the bind/reuse counts- Specified by:
resetCountsin interfaceTextureBinder
-
-