CircleGizmo.java
net.minecraft.gizmos.CircleGizmo
信息
- 全限定名:net.minecraft.gizmos.CircleGizmo
- 类型:public record
- 包:net.minecraft.gizmos
- 源码路径:src/main/java/net/minecraft/gizmos/CircleGizmo.java
- 起始行号:L5
- 实现:Gizmo
- 职责:
TODO
字段/常量
-
CIRCLE_VERTICES- 类型:
int - 修饰符:
private static final - 源码定位:
L6 - 说明:
TODO
- 类型:
-
SEGMENT_SIZE_RADIANS- 类型:
float - 修饰符:
private static final - 源码定位:
L7 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public void emit(GizmoPrimitives primitives, float alphaMultiplier) @ L9
- 方法名:emit
- 源码定位:L9
- 返回类型:void
- 修饰符:public
参数:
- primitives: GizmoPrimitives
- alphaMultiplier: float
说明:
TODO
代码
public record CircleGizmo(Vec3 pos, float radius, GizmoStyle style) implements Gizmo {
private static final int CIRCLE_VERTICES = 20;
private static final float SEGMENT_SIZE_RADIANS = (float) (Math.PI / 10);
@Override
public void emit(GizmoPrimitives primitives, float alphaMultiplier) {
if (this.style.hasStroke() || this.style.hasFill()) {
Vec3[] points = new Vec3[21];
for (int i = 0; i < 20; i++) {
float theta = i * (float) (Math.PI / 10);
Vec3 point = this.pos.add((float)(this.radius * Math.cos(theta)), 0.0, (float)(this.radius * Math.sin(theta)));
points[i] = point;
}
points[20] = points[0];
if (this.style.hasFill()) {
int color = this.style.multipliedFill(alphaMultiplier);
primitives.addTriangleFan(points, color);
}
if (this.style.hasStroke()) {
int color = this.style.multipliedStroke(alphaMultiplier);
for (int i = 0; i < 20; i++) {
primitives.addLine(points[i], points[i + 1], color, this.style.strokeWidth());
}
}
}
}
}引用的其他类
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数
- 引用位置: