Modifier and Type | Class and Description |
---|---|
static class |
Texture.Config
Used to configure texture at creation time.
|
Closeable.Set, Closeable.Util
Modifier and Type | Field and Description |
---|---|
Texture.Config |
config
This texture's configuration.
|
float |
displayHeight
The height of this texture in display units.
|
float |
displayWidth
The width of this texture in display units.
|
int |
id
The GL texture handle.
|
int |
pixelHeight
The height of this texture in pixels.
|
int |
pixelWidth
The width of this texture in pixels.
|
Scale |
scale
The scale factor used by this texture.
|
Constructor and Description |
---|
Texture(Graphics gfx,
int id,
Texture.Config config,
int pixWidth,
int pixHeight,
Scale scale,
float dispWidth,
float dispHeight) |
Modifier and Type | Method and Description |
---|---|
void |
addToBatch(QuadBatch batch,
int tint,
AffineTransform tx,
float x,
float y,
float width,
float height)
Adds this tile to the supplied quad batch.
|
void |
addToBatch(QuadBatch batch,
int tint,
AffineTransform tx,
float dx,
float dy,
float dw,
float dh,
float sx,
float sy,
float sw,
float sh)
Adds this tile to the supplied quad batch.
|
void |
close()
Deletes this texture's GPU resources and renders it unusable.
|
boolean |
disposed()
Returns whether this texture is been disposed.
|
UnitSlot |
disposeSlot()
Returns a
Slot that will dispose this texture when triggered. |
float |
height()
The height of this tile (in display units).
|
static int |
nextPOT(int value)
Returns next largest power of two, or
value if value is already a POT. |
void |
reference()
Increments this texture's reference count.
|
void |
release()
Decrements this texture's reference count.
|
float |
sx()
Returns the
s texture coordinate for the x-axis. |
float |
sy()
Returns the
s texture coordinate for the y-axis. |
Texture |
texture()
The texture which contains this tile.
|
Tile |
tile(float x,
float y,
float width,
float height)
Returns an instance that can be used to render a sub-region of this texture.
|
Tile |
tile(IRectangle region)
Returns an instance that can be used to render a sub-region of this texture.
|
java.lang.String |
toString() |
float |
tx()
Returns the
t texture coordinate for the x-axis. |
float |
ty()
Returns the
t texture coordinate for the y-axis. |
void |
update(Image image)
Uploads
image to this texture's GPU memory. |
float |
width()
The width of this tile (in display units).
|
public final int id
public final Texture.Config config
public final int pixelWidth
public final int pixelHeight
public final Scale scale
public final float displayWidth
public final float displayHeight
public Texture(Graphics gfx, int id, Texture.Config config, int pixWidth, int pixHeight, Scale scale, float dispWidth, float dispHeight)
public static int nextPOT(int value)
value
if value
is already a POT. Note:
this is limited to values less than 0x10000
.public void reference()
Texture.Config.managed
.public void release()
public void update(Image image)
image
to this texture's GPU memory. image
must have the exact same
size as this texture and must be fully loaded. This is generally useful for updating a
texture which was created from a canvas when the canvas has been changed.public Tile tile(IRectangle region)
public Tile tile(float x, float y, float width, float height)
public boolean disposed()
public UnitSlot disposeSlot()
Slot
that will dispose this texture when triggered.
This is useful when you want to manually bind the lifecycle of an unmanaged texture to the lifecycle of a layer. Simply `layer.onDisposed(texture.disposeSlot())`.
public Texture texture()
Tile
public float width()
Tile
public float height()
Tile
public float sx()
Tile
s
texture coordinate for the x-axis.public float sy()
Tile
s
texture coordinate for the y-axis.public float tx()
Tile
t
texture coordinate for the x-axis.public float ty()
Tile
t
texture coordinate for the y-axis.public void addToBatch(QuadBatch batch, int tint, AffineTransform tx, float x, float y, float width, float height)
Tile
addToBatch
in class Tile
public void addToBatch(QuadBatch batch, int tint, AffineTransform tx, float dx, float dy, float dw, float dh, float sx, float sy, float sw, float sh)
Tile
addToBatch
in class Tile
public void close()
Copyright © 2019. All Rights Reserved.