/** * Recursively compute the bounding box of the {@link MeshPrimitiveModel} * objects of all {@link MeshModel} objects in the given {@link SceneModel} * (including the respective global node transforms). * If the given result is <code>null</code>, then a new bounding box * will be created and returned. * * @param sceneModel The {@link SceneModel} * @param transform The root transform, as a column major 4x4 matrix * @param boundingBox The optional bounding box that will store the result * @return The result */ private BoundingBox computeSceneBoundingBox( SceneModel sceneModel, float transform[], BoundingBox boundingBox) { BoundingBox localResult = boundingBox; if (localResult == null) { localResult = new BoundingBox(); } List<NodeModel> nodeModels = sceneModel.getNodeModels(); for (NodeModel nodeModel : nodeModels) { computeNodeBoundingBox(nodeModel, transform, localResult); } return localResult; }
/** * Compute the bounding box of the {@link GltfModel} * * @return The bounding box */ BoundingBox compute() { BoundingBox boundingBox = new BoundingBox(); List<SceneModel> sceneModels = gltfModel.getSceneModels(); for (SceneModel sceneModel : sceneModels) { float rootTransform[] = MathUtils.createIdentity4x4(); computeSceneBoundingBox(sceneModel, rootTransform, boundingBox); } return boundingBox; }
if (result == null) result = new BoundingBox();
BoundingBox boundingBox = new BoundingBox(); for (int e = 0; e < accessorData.getNumElements(); e++)
if (result == null) result = new BoundingBox();