From 9a8b140c2e0ef3f3acbb293887b4e9a1b703fe6c Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Mon, 18 Mar 2024 23:59:02 -0700 Subject: [PATCH] GImpactCollisionShape: add countSubmeshes() and getSubmesh() methods --- .../shapes/GImpactCollisionShape.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/MinieLibrary/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java b/MinieLibrary/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java index 4889c4965..afeae6901 100644 --- a/MinieLibrary/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java +++ b/MinieLibrary/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java @@ -142,6 +142,31 @@ public int countMeshVertices() { return numVertices; } + /** + * Count how many submeshes are in the mesh. + * + * @return the count (≥0) + */ + public int countSubmeshes() { + int result = nativeMesh.countSubmeshes(); + return result; + } + + /** + * Access the specified submesh. + * + * @param index the index of the desired submesh (in the order the submeshes + * were added, ≥0) + * @return the pre-existing instance (not null) + */ + public IndexedMesh getSubmesh(int index) { + int numSubmeshes = nativeMesh.countSubmeshes(); + Validate.inRange(index, "submesh index", 0, numSubmeshes - 1); + + IndexedMesh result = nativeMesh.getSubmesh(index); + return result; + } + /** * Attempt to divide this shape into 2 shapes. *