mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-15 00:14:28 -04:00
Allow passing UV coordinates as Vec2f
Rotating UV coordinates using vector math becomes extremely annoying when every `sprite` call requires the individual `u` and `v` coordinates to be extracted again. This change will allow passing UV coordinates in a container that will always be available.
This commit is contained in:
parent
73b29211a6
commit
b0fe27e0d7
1 changed files with 5 additions and 0 deletions
|
@ -19,6 +19,7 @@ package net.fabricmc.fabric.api.renderer.v1.mesh;
|
|||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
|
@ -90,6 +91,10 @@ public interface QuadEmitter extends MutableQuadView {
|
|||
@Override
|
||||
QuadEmitter sprite(int vertexIndex, int spriteIndex, float u, float v);
|
||||
|
||||
default QuadEmitter sprite(int vertexIndex, int spriteIndex, Vec2f uv) {
|
||||
return sprite(vertexIndex, spriteIndex, uv.x, uv.y);
|
||||
}
|
||||
|
||||
default QuadEmitter spriteUnitSquare(int spriteIndex) {
|
||||
sprite(0, spriteIndex, 0, 0);
|
||||
sprite(1, spriteIndex, 0, 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue