ShapeRenderer.java

net.minecraft.client.renderer.ShapeRenderer

信息

  • 全限定名:net.minecraft.client.renderer.ShapeRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer
  • 源码路径:src/main/java/net/minecraft/client/renderer/ShapeRenderer.java
  • 起始行号:L11
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

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

public static void renderShape(PoseStack poseStack, VertexConsumer builder, VoxelShape shape, double x, double y, double z, int color, float width) @ L12

  • 方法名:renderShape
  • 源码定位:L12
  • 返回类型:void
  • 修饰符:public static

参数:

  • poseStack: PoseStack
  • builder: VertexConsumer
  • shape: VoxelShape
  • x: double
  • y: double
  • z: double
  • color: int
  • width: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ShapeRenderer {
    public static void renderShape(PoseStack poseStack, VertexConsumer builder, VoxelShape shape, double x, double y, double z, int color, float width) {
        PoseStack.Pose pose = poseStack.last();
        shape.forAllEdges((x1, y1, z1, x2, y2, z2) -> {
            Vector3f normal = new Vector3f((float)(x2 - x1), (float)(y2 - y1), (float)(z2 - z1)).normalize();
            builder.addVertex(pose, (float)(x1 + x), (float)(y1 + y), (float)(z1 + z)).setColor(color).setNormal(pose, normal).setLineWidth(width);
            builder.addVertex(pose, (float)(x2 + x), (float)(y2 + y), (float)(z2 + z)).setColor(color).setNormal(pose, normal).setLineWidth(width);
        });
    }
}

引用的其他类