Skip to content

Commit

Permalink
Reticulated splines
Browse files Browse the repository at this point in the history
- Fix line models rendering garbage
- Fix shulker boxes appear at the origin before snapping into place
- Make the box and line models public
  • Loading branch information
Jozufozu committed Nov 12, 2024
1 parent 868a263 commit 6f0a2b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -137,7 +138,7 @@ public int vertexCount() {

@Override
public void write(MutableVertexList vertexList) {
vertexList.writeAll(vertexList);
this.vertexList.writeAll(vertexList);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public ShulkerBoxVisual(VisualizationContext ctx, ShulkerBoxBlockEntity blockEnt
lid = instances.childOrThrow("lid");

initialPose = createInitialPose();
instances.updateInstancesStatic(initialPose);
}

private Matrix4f createInitialPose() {
Expand Down

0 comments on commit 6f0a2b0

Please sign in to comment.