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
This commit is contained in:
Jozufozu 2024-11-12 13:09:52 -08:00
parent 868a263c28
commit 6f0a2b0e56
3 changed files with 5 additions and 3 deletions

View file

@ -80,6 +80,7 @@ public final class LineModelBuilder {
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 final class LineModelBuilder {
@Override
public void write(MutableVertexList vertexList) {
vertexList.writeAll(vertexList);
this.vertexList.writeAll(vertexList);
}
@Override

View file

@ -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();

View file

@ -53,6 +53,7 @@ public class ShulkerBoxVisual extends AbstractBlockEntityVisual<ShulkerBoxBlockE
lid = instances.childOrThrow("lid");
initialPose = createInitialPose();
instances.updateInstancesStatic(initialPose);
}
private Matrix4f createInitialPose() {