Class GltfBoundingBoxReader
java.lang.Object
io.goobi.viewer.model.media.voyager.GltfBoundingBoxReader
Reads the axis-aligned bounding box center of a GLTF 2.0 or GLB 3D model without a dedicated GLTF library.
The GLTF 2.0 specification requires that every vertex-position accessor carries min and max arrays. This class extracts those
values directly from the JSON metadata, making binary buffer parsing unnecessary.
All methods are static; this class is not meant to be instantiated.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[][]computeBounds(Path gltfFile) Returns the axis-aligned bounding box of all meshes in the given GLTF or GLB file.static double[]computeCenter(Path gltfFile) Computes the bounding-box centre of all meshes in the given GLTF or GLB file.
-
Method Details
-
computeBounds
Returns the axis-aligned bounding box of all meshes in the given GLTF or GLB file.- Parameters:
gltfFile- path to a.gltfor.glbfile- Returns:
double[2][3]where[0]is the global min and[1]is the global max; both are[0,0,0]if no POSITION accessor min/max data is found- Throws:
IOException- if the file cannot be read
-
computeCenter
Computes the bounding-box centre of all meshes in the given GLTF or GLB file.- Parameters:
gltfFile- path to a.gltfor.glbfile- Returns:
double[3]with[x, y, z]of the centre;[0, 0, 0]if no POSITION accessor min/max data is found- Throws:
IOException- if the file cannot be read
-