BlitRenderState.java

net.minecraft.client.renderer.state.gui.BlitRenderState

信息

  • 全限定名:net.minecraft.client.renderer.state.gui.BlitRenderState
  • 类型:public record
  • 包:net.minecraft.client.renderer.state.gui
  • 源码路径:src/main/java/net/minecraft/client/renderer/state/gui/BlitRenderState.java
  • 起始行号:L13
  • 实现:GuiElementRenderState
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

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, ScreenRectangle scissorArea) @ L29

  • 构造器名:BlitRenderState
  • 源码定位:L29
  • 修饰符:public

参数:

  • pipeline: RenderPipeline
  • textureSetup: TextureSetup
  • pose: Matrix3x2f
  • x0: int
  • y0: int
  • x1: int
  • y1: int
  • u0: float
  • u1: float
  • v0: float
  • v1: float
  • color: int
  • scissorArea: ScreenRectangle

说明:

TODO

方法

下面的方法块按源码顺序生成。

public void buildVertices(VertexConsumer vertexConsumer) @ L47

  • 方法名:buildVertices
  • 源码定位:L47
  • 返回类型:void
  • 修饰符:public

参数:

  • vertexConsumer: VertexConsumer

说明:

TODO

private static ScreenRectangle getBounds(int x0, int y0, int x1, int y1, Matrix3x2f pose, ScreenRectangle scissorArea) @ L55

  • 方法名:getBounds
  • 源码定位:L55
  • 返回类型:ScreenRectangle
  • 修饰符:private static

参数:

  • x0: int
  • y0: int
  • x1: int
  • y1: int
  • pose: Matrix3x2f
  • scissorArea: ScreenRectangle

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
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, getBounds(x0, y0, x1, y1, pose, scissorArea));
    }
 
    @Override
    public void buildVertices(VertexConsumer vertexConsumer) {
        vertexConsumer.addVertexWith2DPose(this.pose(), this.x0(), this.y0()).setUv(this.u0(), this.v0()).setColor(this.color());
        vertexConsumer.addVertexWith2DPose(this.pose(), this.x0(), this.y1()).setUv(this.u0(), this.v1()).setColor(this.color());
        vertexConsumer.addVertexWith2DPose(this.pose(), this.x1(), this.y1()).setUv(this.u1(), this.v1()).setColor(this.color());
        vertexConsumer.addVertexWith2DPose(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(pose);
        return scissorArea != null ? scissorArea.intersection(bounds) : bounds;
    }
}

引用的其他类