Skip to content

Commit

Permalink
GLTF: Reject meshes without positions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Oct 26, 2024
1 parent d710add commit 56330eb
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,19 @@ public Node visit(@NotNull Node node) {
return null;
}

final Mesh mesh = node.getMesh();
Mesh mesh = node.getMesh();
if (mesh != null) {
var primitives = mesh.primitives().stream()
.filter(primitive -> primitive.attributes().containsKey(Semantic.POSITION))
.toList();

if (primitives.isEmpty()) {
mesh = null;
} else {
mesh = new Mesh(primitives);
}
}

final List<Node> children = node.getChildren().stream()
.map(child -> child.apply(this))
.filter(Objects::nonNull)
Expand Down

0 comments on commit 56330eb

Please sign in to comment.