Skip to content

Commit

Permalink
DebugShapeFactory: add return value to 2 native methods (API change)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jan 19, 2024
1 parent f6183a8 commit e231f5f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/jme3/bullet/util/DebugShapeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ private static Transform planeTransform(PlaneCollisionShape shape) {
// *************************************************************************
// native private methods

native private static void getTriangles(
native private static boolean getTriangles(
long shapeId, int meshResolution, DebugMeshCallback buffer);

native private static void getVertices(
native private static boolean getVertices(
long shapeId, int meshResolution, DebugMeshCallback buffer);
}
24 changes: 14 additions & 10 deletions src/main/native/glue/com_jme3_bullet_util_DebugShapeFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ class DebugCallback : public btTriangleCallback, public btInternalTriangleIndexC
/*
* Class: com_jme3_bullet_util_DebugShapeFactory
* Method: getTriangles
* Signature: (JILcom/jme3/bullet/util/DebugMeshCallback;)V
* Signature: (JILcom/jme3/bullet/util/DebugMeshCallback;)Z
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getTriangles
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getTriangles
(JNIEnv *pEnv, jclass, jlong shapeId, jint resolution, jobject callback) {
const btCollisionShape * const
pShape = reinterpret_cast<btCollisionShape *> (shapeId);
NULL_CHK(pEnv, pShape, "The btCollisionShape does not exist.",);
NULL_CHK(pEnv, pShape, "The btCollisionShape does not exist.", JNI_FALSE);

if (pShape->isConcave()) {
const btConcaveShape * const pConcave = (btConcaveShape *) pShape;
Expand Down Expand Up @@ -120,32 +120,34 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getTriangles
pEnv->CallVoidMethod(callback,
jmeClasses::DebugMeshCallback_addVector, vertexA.getX(),
vertexA.getY(), vertexA.getZ());
EXCEPTION_CHK(pEnv,);
EXCEPTION_CHK(pEnv, JNI_FALSE);

pEnv->CallVoidMethod(callback,
jmeClasses::DebugMeshCallback_addVector, vertexB.getX(),
vertexB.getY(), vertexB.getZ());
EXCEPTION_CHK(pEnv,);
EXCEPTION_CHK(pEnv, JNI_FALSE);

pEnv->CallVoidMethod(callback,
jmeClasses::DebugMeshCallback_addVector, vertexC.getX(),
vertexC.getY(), vertexC.getZ());
EXCEPTION_CHK(pEnv,);
EXCEPTION_CHK(pEnv, JNI_FALSE);
}
delete pHull; //dance027
}

return JNI_TRUE; // success!
}

/*
* Class: com_jme3_bullet_util_DebugShapeFactory
* Method: getVertices
* Signature: (JILcom/jme3/bullet/util/DebugMeshCallback;)V
* Signature: (JILcom/jme3/bullet/util/DebugMeshCallback;)Z
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getVertices
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getVertices
(JNIEnv *pEnv, jclass, jlong shapeId, jint resolution, jobject callback) {
const btCollisionShape * const
pShape = reinterpret_cast<btCollisionShape *> (shapeId);
NULL_CHK(pEnv, pShape, "The btCollisionShape does not exist.",);
NULL_CHK(pEnv, pShape, "The btCollisionShape does not exist.", JNI_FALSE);

if (pShape->isConcave()) {
const btConcaveShape * const pConcave = (btConcaveShape *) pShape;
Expand Down Expand Up @@ -175,8 +177,10 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getVertices
pEnv->CallVoidMethod(callback,
jmeClasses::DebugMeshCallback_addVector, vertex.getX(),
vertex.getY(), vertex.getZ());
EXCEPTION_CHK(pEnv,);
EXCEPTION_CHK(pEnv, JNI_FALSE);
}
delete pHull; //dance026
}

return JNI_TRUE; // success!
}
8 changes: 4 additions & 4 deletions src/main/native/glue/com_jme3_bullet_util_DebugShapeFactory.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e231f5f

Please sign in to comment.