@@ -160,17 +160,16 @@ public void getCenterOfMassPositions(
160160 * Return the center-of-mass transforms of the specified bodies.
161161 *
162162 * @param bodyIds the IDs of the bodies to locate (not null)
163- * @param storeMatrices storage for the matrices (not null, 16 doubles per
164- * body, interleaved, modified)
163+ * @param storeMatrices storage for the matrices (not null, modified)
165164 */
166165 public void getCenterOfMassTransforms (
167- BodyIdArray bodyIds , DoubleBuffer storeMatrices ) {
166+ BodyIdArray bodyIds , RMat44Array storeMatrices ) {
168167 int numBodies = bodyIds .length ();
169- assert storeMatrices .capacity () >= numBodies * 16 ;
170168 long bodyInterfaceVa = va ();
171169 long arrayVa = bodyIds .va ();
170+ long matricesVa = storeMatrices .va ();
172171 getCenterOfMassTransforms (
173- bodyInterfaceVa , arrayVa , numBodies , storeMatrices );
172+ bodyInterfaceVa , arrayVa , numBodies , matricesVa );
174173 }
175174
176175 /**
@@ -210,17 +209,16 @@ public void getGravityFactors(BodyIdArray bodyIds,
210209 * Copy the inverses of the inertia tensors in system coordinates.
211210 *
212211 * @param bodyIds the IDs of the bodies to query (not null)
213- * @param storeMatrices storage for the matrices (not null, 16 floats per
214- * body, interleaved, modified)
212+ * @param storeMatrices storage for the matrices (not null, modified)
215213 */
216214 public void getInverseInertias (
217- BodyIdArray bodyIds , FloatBuffer storeMatrices ) {
215+ BodyIdArray bodyIds , Mat44Array storeMatrices ) {
218216 int numBodies = bodyIds .length ();
219- assert storeMatrices .capacity () >= numBodies * 16 ;
220217 long bodyInterfaceVa = va ();
221218 long arrayVa = bodyIds .va ();
219+ long matricesVa = storeMatrices .va ();
222220 getInverseInertias (
223- bodyInterfaceVa , arrayVa , numBodies , storeMatrices );
221+ bodyInterfaceVa , arrayVa , numBodies , matricesVa );
224222 }
225223
226224 /**
@@ -339,41 +337,31 @@ public void getRotations(
339337 * Access the shapes of the specified bodies.
340338 *
341339 * @param bodyIds the IDs of the bodies (not null)
342- * @return a new array of new references
340+ * @param storeShapes storage for the references (not null, modified)
343341 */
344- public ShapeRefC [] getShapes (BodyIdArray bodyIds ) {
342+ public void getShapes (BodyIdArray bodyIds , ShapeRefCArray storeShapes ) {
345343 int numBodies = bodyIds .length ();
346- LongBuffer storeShapeVas = Jolt .newDirectLongBuffer (numBodies );
347344 long bodyInterfaceVa = va ();
348345 long arrayVa = bodyIds .va ();
349- getShapes (bodyInterfaceVa , arrayVa , numBodies , storeShapeVas );
350- ShapeRefC [] result = new ShapeRefC [numBodies ];
351- for (int i = 0 ; i < numBodies ; ++i ) {
352- long va = storeShapeVas .get (i );
353- result [i ] = new ShapeRefC (va , true );
354- }
355- return result ;
346+ long shapesVa = storeShapes .va ();
347+ getShapes (bodyInterfaceVa , arrayVa , numBodies , shapesVa );
356348 }
357349
358350 /**
359351 * Generate transformed shapes for the specified bodies.
360352 *
361353 * @param bodyIds the IDs of the bodies (not null)
362- * @return a new array of new objects
354+ * @param storeShapes storage for the transformed shapes (not null,
355+ * modified)
363356 */
364- public TransformedShape [] getTransformedShapes (BodyIdArray bodyIds ) {
357+ public void getTransformedShapes (
358+ BodyIdArray bodyIds , TransformedShapeArray storeShapes ) {
365359 int numBodies = bodyIds .length ();
366- LongBuffer storeShapeVas = Jolt .newDirectLongBuffer (numBodies );
367360 long bodyInterfaceVa = va ();
368361 long arrayVa = bodyIds .va ();
362+ long shapesVa = storeShapes .va ();
369363 getTransformedShapes (
370- bodyInterfaceVa , arrayVa , numBodies , storeShapeVas );
371- TransformedShape [] result = new TransformedShape [numBodies ];
372- for (int i = 0 ; i < numBodies ; ++i ) {
373- long va = storeShapeVas .get (i );
374- result [i ] = new TransformedShape (va , true );
375- }
376- return result ;
364+ bodyInterfaceVa , arrayVa , numBodies , shapesVa );
377365 }
378366
379367 /**
@@ -555,7 +543,7 @@ native private static void getCenterOfMassPositions(long bodyInterfaceVa,
555543 long arrayVa , int numBodies , DoubleBuffer storePositions );
556544
557545 native private static void getCenterOfMassTransforms (long bodyInterfaceVa ,
558- long arrayVa , int numBodies , DoubleBuffer storeMatrices );
546+ long arrayVa , int numBodies , long matricesVa );
559547
560548 native private static void getFrictions (long bodyInterfaceVa , long arrayVa ,
561549 int numBodies , FloatBuffer storeFrictions );
@@ -564,7 +552,7 @@ native private static void getGravityFactors(long bodyInterfaceVa,
564552 long arrayVa , int numBodies , FloatBuffer storeFactors );
565553
566554 native private static void getInverseInertias (long bodyInterfaceVa ,
567- long arrayVa , int numBodies , FloatBuffer storeMatrices );
555+ long arrayVa , int numBodies , long matricesVa );
568556
569557 native private static void getLinearVelocities (long bodyInterfaceVa ,
570558 long arrayVa , int numBodies , FloatBuffer storeVelocities );
@@ -588,10 +576,10 @@ native private static void getRotations(long bodyInterfaceVa, long arrayVa,
588576 int numBodies , FloatBuffer storeOrientations );
589577
590578 native private static void getShapes (long bodyInterfaceVa , long arrayVa ,
591- int numBodies , LongBuffer storeShapeVas );
579+ int numBodies , long shapesVa );
592580
593581 native private static void getTransformedShapes (long bodyInterfaceVa ,
594- long arrayVa , int numBodies , LongBuffer storeShapeVas );
582+ long arrayVa , int numBodies , long shapesVa );
595583
596584 native private static void getUseManifoldReductions (long bodyInterfaceVa ,
597585 long arrayVa , int numBodies , ByteBuffer storeStatus );
0 commit comments