SpriteFinder

public interface SpriteFinder

Indexes a texture atlas to allow fast lookup of Sprites from baked vertex coordinates. Main use is for Mesh-based models to generate vanilla quads on demand without tracking and retaining the sprites that were baked into the mesh. In other words, this class supplies the sprite parameter for toBakedQuad.

Functions

find
Link copied to clipboard
abstract Sprite find(float u, float v)
Alternative to find when vertex centroid is alreadyknown or unsuitable.
abstract Sprite find(QuadView quad, int textureIndex)
Finds the atlas sprite containing the vertex centroid of the quad.Vertex centroid is essentially the mean u,v coordinate - the intent beingto find a point that is unambiguously inside the sprite (vs on an edge.
get
Link copied to clipboard
static SpriteFinder get(SpriteAtlasTexture atlas)
Retrieves or creates the finder for the given atlas.Instances should not be retained as fields or they must berefreshed whenever there is a resource reload or other eventthat causes atlas textures to be re-stitched.

Inheritors

SpriteFinderImpl
Link copied to clipboard

Sources

jvm source
Link copied to clipboard