bugfix: correct AABB bounds for mesh
@@ -44,12 +44,8 @@ protected AABBf getBound(MeshData data, AABBf dest) {
dest.maxZ = vertices.get(2);
for (int index = 1; index < vertexCount; ++index) {
- dest.minX = Math.min(dest.minX, vertices.get(3 * index));
- dest.minY = Math.max(dest.minY, vertices.get(3 * index));
- dest.minZ = Math.min(dest.minZ, vertices.get(3 * index + 1));
- dest.maxX = Math.max(dest.maxX, vertices.get(3 * index + 1));
- dest.maxY = Math.min(dest.maxY, vertices.get(3 * index + 2));
- dest.maxZ = Math.max(dest.maxZ, vertices.get(3 * index + 2));
+ dest.union(vertices.get(3 * index), vertices.get(3 * index + 1), vertices.get(3 * index + 2));
+
}
return dest;
}
