From 6f0a2b0e5643c82fb14af731bd82fb2309b2df13 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Tue, 12 Nov 2024 13:09:52 -0800 Subject: [PATCH] Reticulated splines - Fix line models rendering garbage - Fix shulker boxes appear at the origin before snapping into place - Make the box and line models public --- .../dev/engine_room/flywheel/lib/model/LineModelBuilder.java | 3 ++- .../flywheel/lib/visual/component/HitboxComponent.java | 4 ++-- .../dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/src/lib/java/dev/engine_room/flywheel/lib/model/LineModelBuilder.java b/common/src/lib/java/dev/engine_room/flywheel/lib/model/LineModelBuilder.java index 5e93d92ee..0689e8097 100644 --- a/common/src/lib/java/dev/engine_room/flywheel/lib/model/LineModelBuilder.java +++ b/common/src/lib/java/dev/engine_room/flywheel/lib/model/LineModelBuilder.java @@ -80,6 +80,7 @@ public LineModelBuilder line(float x1, float y1, float z1, float x2, float y2, f public Model build() { vertexView.vertexCount(vertexCount); + vertexView.nativeMemoryOwner(data); var boundingSphere = ModelUtil.computeBoundingSphere(vertexView); boundingSphere.w += 0.1f; // make the bounding sphere a little bigger to account for line width @@ -137,7 +138,7 @@ public int vertexCount() { @Override public void write(MutableVertexList vertexList) { - vertexList.writeAll(vertexList); + this.vertexList.writeAll(vertexList); } @Override diff --git a/common/src/lib/java/dev/engine_room/flywheel/lib/visual/component/HitboxComponent.java b/common/src/lib/java/dev/engine_room/flywheel/lib/visual/component/HitboxComponent.java index 834410ed5..8cebf06a3 100644 --- a/common/src/lib/java/dev/engine_room/flywheel/lib/visual/component/HitboxComponent.java +++ b/common/src/lib/java/dev/engine_room/flywheel/lib/visual/component/HitboxComponent.java @@ -25,7 +25,7 @@ public final class HitboxComponent implements EntityComponent { // | / | / // |/ |/ // 001------101 - private static final Model BOX_MODEL = new LineModelBuilder(12) + public static final Model BOX_MODEL = new LineModelBuilder(12) // Starting from 0, 0, 0 .line(0, 0, 0, 0, 0, 1) .line(0, 0, 0, 0, 1, 0) @@ -44,7 +44,7 @@ public final class HitboxComponent implements EntityComponent { .line(1, 1, 0, 0, 1, 0) .build(); - private static final Model LINE_MODEL = new LineModelBuilder(1) + public static final Model LINE_MODEL = new LineModelBuilder(1) .line(0, 0, 0, 0, 2, 0) .build(); diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java b/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java index 0c7abb853..8f8953b60 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java +++ b/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java @@ -53,6 +53,7 @@ public ShulkerBoxVisual(VisualizationContext ctx, ShulkerBoxBlockEntity blockEnt lid = instances.childOrThrow("lid"); initialPose = createInitialPose(); + instances.updateInstancesStatic(initialPose); } private Matrix4f createInitialPose() {