40 lines
2.2 KiB
Java
40 lines
2.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.joml.Matrix3x2f
|
|
* org.joml.Matrix3x2fc
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.gui.render.state;
|
|
|
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
import net.minecraft.client.gui.navigation.ScreenRectangle;
|
|
import net.minecraft.client.gui.render.TextureSetup;
|
|
import net.minecraft.client.gui.render.state.GuiElementRenderState;
|
|
import org.joml.Matrix3x2f;
|
|
import org.joml.Matrix3x2fc;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public record BlitRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, float u0, float u1, float v0, float v1, int color, @Nullable ScreenRectangle scissorArea, @Nullable ScreenRectangle bounds) implements GuiElementRenderState
|
|
{
|
|
public BlitRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, float u0, float u1, float v0, float v1, int color, @Nullable ScreenRectangle scissorArea) {
|
|
this(pipeline, textureSetup, pose, x0, y0, x1, y1, u0, u1, v0, v1, color, scissorArea, BlitRenderState.getBounds(x0, y0, x1, y1, pose, scissorArea));
|
|
}
|
|
|
|
@Override
|
|
public void buildVertices(VertexConsumer vertexConsumer) {
|
|
vertexConsumer.addVertexWith2DPose((Matrix3x2fc)this.pose(), this.x0(), this.y0()).setUv(this.u0(), this.v0()).setColor(this.color());
|
|
vertexConsumer.addVertexWith2DPose((Matrix3x2fc)this.pose(), this.x0(), this.y1()).setUv(this.u0(), this.v1()).setColor(this.color());
|
|
vertexConsumer.addVertexWith2DPose((Matrix3x2fc)this.pose(), this.x1(), this.y1()).setUv(this.u1(), this.v1()).setColor(this.color());
|
|
vertexConsumer.addVertexWith2DPose((Matrix3x2fc)this.pose(), this.x1(), this.y0()).setUv(this.u1(), this.v0()).setColor(this.color());
|
|
}
|
|
|
|
private static @Nullable ScreenRectangle getBounds(int x0, int y0, int x1, int y1, Matrix3x2f pose, @Nullable ScreenRectangle scissorArea) {
|
|
ScreenRectangle bounds = new ScreenRectangle(x0, y0, x1 - x0, y1 - y0).transformMaxBounds((Matrix3x2fc)pose);
|
|
return scissorArea != null ? scissorArea.intersection(bounds) : bounds;
|
|
}
|
|
}
|
|
|