public interface SpriteFinder
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 QuadView.toBakedQuad(int, Sprite, boolean)
.Modifier and Type | Method and Description |
---|---|
net.minecraft.client.texture.Sprite |
find(float u,
float v)
Alternative to
find(QuadView, int) when vertex centroid is already
known or unsuitable. |
net.minecraft.client.texture.Sprite |
find(QuadView quad,
int textureIndex)
Finds the atlas sprite containing the vertex centroid of the quad.
|
static SpriteFinder |
get(net.minecraft.client.texture.SpriteAtlasTexture atlas)
Retrieves or creates the finder for the given atlas.
|
static SpriteFinder get(net.minecraft.client.texture.SpriteAtlasTexture atlas)
net.minecraft.client.texture.Sprite find(QuadView quad, int textureIndex)
Should be reliable for any convex quad or triangle. May fail for non-convex quads. Note that all the above refers to u,v coordinates. Geometric vertex does not matter, except to the extent it was used to determine u,v.
net.minecraft.client.texture.Sprite find(float u, float v)
find(QuadView, int)
when vertex centroid is already
known or unsuitable. Expects normalized (0-1) coordinates on the atlas texture,
which should already be the case for u,v values in vanilla baked quads and in
QuadView
after calling MutableQuadView.spriteBake(int, Sprite, int)
.
Coordinates must be in the sprite interior for reliable results. Generally will
be easier to use find(QuadView, int)
unless you know the vertex
centroid will somehow not be in the quad interior. This method will be slightly
faster if you already have the centroid or another appropriate value.