@Environment(value=CLIENT) final class Sprite.Interpolation extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
private NativeImage[] |
images |
Modifier | Constructor and Description |
---|---|
private |
Interpolation(Sprite.Info info,
int mipmap) |
Modifier and Type | Method and Description |
---|---|
private void |
apply()
Linearly interpolate between the current and next frame on all mip levels
based on the tick position within the current frame,
and upload the results to the currently bound texture to the frame slot at position (0,0).
|
void |
close() |
private int |
getPixelColor(int frameIndex,
int layer,
int x,
int y)
Returns the pixel color at frame
frameIndex within mipmap layer at sprite relative coordinates. |
private int |
lerp(double delta,
int to,
int from)
Purely mathematical single-value linear interpolation.
|
private final NativeImage[] images
private Interpolation(Sprite.Info info, int mipmap)
private void apply()
private int getPixelColor(int frameIndex, int layer, int x, int y)
frameIndex
within mipmap layer
at sprite relative coordinates.private int lerp(double delta, int to, int from)
lerp(0, a, b) == b
, lerp(1, a, b) == a
.public void close()
close
in interface AutoCloseable