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 int
LRU
static int
MAX_GLES_UNITS
GLES only supports up to 32 texturesstatic int
ROUNDROBIN
-
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 void
begin()
Prepares the binder for operation, must be matched with a call toTextureBinder.end()
.int
bind(TextureDescriptor textureDesc)
Binds the texture to an available unit and applies the filters in the descriptor.int
bind(GLTexture texture)
Binds the texture to an available unit.void
end()
Disables all used texture units and unbinds textures.int
getBindCount()
int
getReuseCount()
void
resetCounts()
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:TextureBinder
Prepares the binder for operation, must be matched with a call toTextureBinder.end()
.- Specified by:
begin
in interfaceTextureBinder
-
end
public void end()
Description copied from interface:TextureBinder
Disables all used texture units and unbinds textures. Resets the counts.- Specified by:
end
in interfaceTextureBinder
-
bind
public final int bind(TextureDescriptor textureDesc)
Description copied from interface:TextureBinder
Binds the texture to an available unit and applies the filters in the descriptor.- Specified by:
bind
in interfaceTextureBinder
- Parameters:
textureDesc
- theTextureDescriptor
- Returns:
- the unit the texture was bound to
-
bind
public final int bind(GLTexture texture)
Description copied from interface:TextureBinder
Binds the texture to an available unit.- Specified by:
bind
in interfaceTextureBinder
- Parameters:
texture
- theTexture
- Returns:
- the unit the texture was bound to
-
getBindCount
public final int getBindCount()
- Specified by:
getBindCount
in interfaceTextureBinder
- Returns:
- the number of binds actually executed since the last call to
TextureBinder.resetCounts()
-
getReuseCount
public final int getReuseCount()
- Specified by:
getReuseCount
in interfaceTextureBinder
- Returns:
- the number of binds that could be avoided by reuse
-
resetCounts
public final void resetCounts()
Description copied from interface:TextureBinder
Resets the bind/reuse counts- Specified by:
resetCounts
in interfaceTextureBinder
-
-