Skip to content

Commit

Permalink
bugfix: 3 unimplemented methods in NarrowPhaseQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Nov 7, 2024
1 parent 7879fb8 commit 259a22b
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,17 @@ public void castShape(RShapeCast shapeCast, ShapeCastSettings settings,
long queryVa = va();
long shapeCastVa = shapeCast.va();
long settingsVa = settings.va();
double baseX = base.xx();
double baseY = base.yy();
double baseZ = base.zz();
long collectorVa = collector.va();
long bplFilterVa = bplFilter.va();
long olFilterVa = olFilter.va();
long bodyFilterVa = bodyFilter.va();
long shapeFilterVa = shapeFilter.va();
castShape(queryVa, shapeCastVa, settingsVa, collectorVa, bplFilterVa,
olFilterVa, bodyFilterVa, shapeFilterVa);
castShape(queryVa, shapeCastVa, settingsVa, baseX, baseY, baseZ,
collectorVa, bplFilterVa, olFilterVa, bodyFilterVa,
shapeFilterVa);
}

/**
Expand Down Expand Up @@ -560,8 +564,9 @@ native private static void castRay(long queryVa, long raycastVa,
long olFilterVa, long bodyFilterVa, long shapeFilterVa);

native private static void castShape(long queryVa, long shapeCastVa,
long settingsVa, long collectorVa, long bplFilterVa,
long olFilterVa, long bodyFilterVa, long shapeFilterVa);
long settingsVa, double baseX, double baseY, double baseZ,
long collectorVa, long bplFilterVa, long olFilterVa,
long bodyFilterVa, long shapeFilterVa);

native private static void collidePoint(long queryVa, double xx, double yy,
double zz, long collectorVa, long bplFilterVa,
Expand Down
90 changes: 90 additions & 0 deletions src/main/native/glue/n/NarrowPhaseQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,94 @@ JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_NarrowPhaseQuery_cast
= reinterpret_cast<ShapeFilter *> (shapeFilterVa);
pQuery->CastRay(*pRayCast, *pSettings, *pCollector, *pBplFilter, *pOlFilter,
*pBodyFilter, *pShapeFilter);
}

/*
* Class: com_github_stephengold_joltjni_NarrowPhaseQuery
* Method: castShape
* Signature: (JJJDDDJJJJJ)V
*/
JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_NarrowPhaseQuery_castShape
(JNIEnv *, jclass, jlong queryVa, jlong shapeCastVa, jlong settingsVa,
jdouble baseX, jdouble baseY, jdouble baseZ, jlong collectorVa,
jlong bplFilterVa, jlong olFilterVa, jlong bodyFilterVa, jlong shapeFilterVa) {
const NarrowPhaseQuery * const pQuery
= reinterpret_cast<NarrowPhaseQuery *> (queryVa);
const RShapeCast * const pShapeCast
= reinterpret_cast<RShapeCast *>(shapeCastVa);
const ShapeCastSettings * const pSettings
= reinterpret_cast<ShapeCastSettings *>(settingsVa);
const RVec3 baseOffset(baseX, baseY, baseZ);
CastShapeCollector * const pCollector
= reinterpret_cast<CastShapeCollector *>(collectorVa);
const BroadPhaseLayerFilter * const pBplFilter
= reinterpret_cast<BroadPhaseLayerFilter *> (bplFilterVa);
const ObjectLayerFilter * const pOlFilter
= reinterpret_cast<ObjectLayerFilter *> (olFilterVa);
const BodyFilter * const pBodyFilter
= reinterpret_cast<BodyFilter *> (bodyFilterVa);
const ShapeFilter * const pShapeFilter
= reinterpret_cast<ShapeFilter *> (shapeFilterVa);
pQuery->CastShape(*pShapeCast, *pSettings, baseOffset, *pCollector,
*pBplFilter, *pOlFilter, *pBodyFilter, *pShapeFilter);
}

/*
* Class: com_github_stephengold_joltjni_NarrowPhaseQuery
* Method: collidePoint
* Signature: (JDDDJJJJJ)V
*/
JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_NarrowPhaseQuery_collidePoint
(JNIEnv *, jclass, jlong queryVa, jdouble xx, jdouble yy, jdouble zz,
jlong collectorVa, jlong bplFilterVa, jlong olFilterVa, jlong bodyFilterVa,
jlong shapeFilterVa) {
const NarrowPhaseQuery * const pQuery
= reinterpret_cast<NarrowPhaseQuery *> (queryVa);
const RVec3 point(xx, yy, zz);
CollidePointCollector * const pCollector
= reinterpret_cast<CollidePointCollector *>(collectorVa);
const BroadPhaseLayerFilter * const pBplFilter
= reinterpret_cast<BroadPhaseLayerFilter *> (bplFilterVa);
const ObjectLayerFilter * const pOlFilter
= reinterpret_cast<ObjectLayerFilter *> (olFilterVa);
const BodyFilter * const pBodyFilter
= reinterpret_cast<BodyFilter *> (bodyFilterVa);
const ShapeFilter * const pShapeFilter
= reinterpret_cast<ShapeFilter *> (shapeFilterVa);
pQuery->CollidePoint(point, *pCollector, *pBplFilter, *pOlFilter,
*pBodyFilter, *pShapeFilter);
}

/*
* Class: com_github_stephengold_joltjni_NarrowPhaseQuery
* Method: collideShape
* Signature: (JJFFFJJDDDJJJJJ)V
*/
JNIEXPORT void JNICALL Java_com_github_stephengold_joltjni_NarrowPhaseQuery_collideShape
(JNIEnv *, jclass, jlong queryVa, jlong shapeVa, jfloat sx, jfloat sy,
jfloat sz, jlong transformVa, jlong settingsVa, jdouble baseX, jdouble baseY,
jdouble baseZ, jlong collectorVa, jlong bplFilterVa, jlong olFilterVa,
jlong bodyFilterVa, jlong shapeFilterVa) {
const NarrowPhaseQuery * const pQuery
= reinterpret_cast<NarrowPhaseQuery *> (queryVa);
const Shape * const pShape = reinterpret_cast<Shape *> (shapeVa);
const Vec3 shapeScale(sx, sy, sz);
const RMat44 * const pComTransform
= reinterpret_cast<RMat44 *> (transformVa);
const CollideShapeSettings * const pSettings
= reinterpret_cast<CollideShapeSettings *> (settingsVa);
const RVec3 baseOffset(baseX, baseY, baseZ);
CollideShapeCollector * const pCollector
= reinterpret_cast<CollideShapeCollector *> (collectorVa);
const BroadPhaseLayerFilter * const pBplFilter
= reinterpret_cast<BroadPhaseLayerFilter *> (bplFilterVa);
const ObjectLayerFilter * const pOlFilter
= reinterpret_cast<ObjectLayerFilter *> (olFilterVa);
const BodyFilter * const pBodyFilter
= reinterpret_cast<BodyFilter *> (bodyFilterVa);
const ShapeFilter * const pShapeFilter
= reinterpret_cast<ShapeFilter *> (shapeFilterVa);
pQuery->CollideShape(pShape, shapeScale, *pComTransform, *pSettings,
baseOffset, *pCollector, *pBplFilter, *pOlFilter, *pBodyFilter,
*pShapeFilter);
}

0 comments on commit 259a22b

Please sign in to comment.