diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a289c2c04a..1126ad96ced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Virtualize `btCollisionWorld`, `btOverlapFilterCallback`, `btOverlapCallback` from Bullet Physics SDK ([pull #1475](https://github.com/bytedeco/javacpp-presets/pull/1475)) * Upgrade presets for PyTorch 2.2.1 ([pull #1466](https://github.com/bytedeco/javacpp-presets/pull/1466)) ### January 29, 2024 version 1.5.10 diff --git a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btCollisionWorld.java b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btCollisionWorld.java index 65e0b271888..16d96d1d928 100644 --- a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btCollisionWorld.java +++ b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btCollisionWorld.java @@ -34,19 +34,19 @@ public class btCollisionWorld extends Pointer { public native void updateSingleAabb(btCollisionObject colObj); - public native void updateAabbs(); + @Virtual public native void updateAabbs(); /**the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSimulation) * it can be useful to use if you perform ray tests without collision detection/simulation */ - public native void computeOverlappingPairs(); + @Virtual public native void computeOverlappingPairs(); - public native void setDebugDrawer(btIDebugDraw debugDrawer); + @Virtual public native void setDebugDrawer(btIDebugDraw debugDrawer); - public native btIDebugDraw getDebugDrawer(); + @Virtual public native btIDebugDraw getDebugDrawer(); - public native void debugDrawWorld(); + @Virtual public native void debugDrawWorld(); - public native void debugDrawObject(@Const @ByRef btTransform worldTransform, @Const btCollisionShape shape, @Const @ByRef btVector3 color); + @Virtual public native void debugDrawObject(@Const @ByRef btTransform worldTransform, @Const btCollisionShape shape, @Const @ByRef btVector3 color); /**LocalShapeInfo gives extra information for complex shapes * Currently, only btTriangleMeshShape is available, so it just contains triangleIndex and subpart */ @@ -99,6 +99,15 @@ private native void allocate(@Const btCollisionObject collisionObject, static { Loader.load(); } /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ public RayResultCallback(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public RayResultCallback(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public RayResultCallback position(long position) { + return (RayResultCallback)super.position(position); + } + @Override public RayResultCallback getPointer(long i) { + return new RayResultCallback((Pointer)this).offsetAddress(i); + } public native @Cast("btScalar") double m_closestHitFraction(); public native RayResultCallback m_closestHitFraction(double setter); public native @Const btCollisionObject m_collisionObject(); public native RayResultCallback m_collisionObject(btCollisionObject setter); @@ -108,9 +117,9 @@ private native void allocate(@Const btCollisionObject collisionObject, public native @Cast("unsigned int") int m_flags(); public native RayResultCallback m_flags(int setter); public native @Cast("bool") boolean hasHit(); - public native @Cast("bool") boolean needsCollision(btBroadphaseProxy proxy0); + @Virtual public native @Cast("bool") @Const({false, false, true}) boolean needsCollision(btBroadphaseProxy proxy0); - public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); + @Virtual(true) public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); } @NoOffset public static class ClosestRayResultCallback extends RayResultCallback { @@ -127,7 +136,7 @@ private native void allocate(@Const btCollisionObject collisionObject, public native @ByRef btVector3 m_hitNormalWorld(); public native ClosestRayResultCallback m_hitNormalWorld(btVector3 setter); public native @ByRef btVector3 m_hitPointWorld(); public native ClosestRayResultCallback m_hitPointWorld(btVector3 setter); - public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); + @Virtual public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); } @NoOffset public static class AllHitsRayResultCallback extends RayResultCallback { @@ -147,7 +156,7 @@ private native void allocate(@Const btCollisionObject collisionObject, public native @ByRef btVector3Array m_hitPointWorld(); public native AllHitsRayResultCallback m_hitPointWorld(btVector3Array setter); public native @ByRef btScalarArray m_hitFractions(); public native AllHitsRayResultCallback m_hitFractions(btScalarArray setter); - public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); + @Virtual public native @Cast("btScalar") double addSingleResult(@ByRef LocalRayResult rayResult, @Cast("bool") boolean normalInWorldSpace); } @NoOffset public static class LocalConvexResult extends Pointer { @@ -178,6 +187,15 @@ private native void allocate(@Const btCollisionObject hitCollisionObject, static { Loader.load(); } /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ public ConvexResultCallback(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public ConvexResultCallback(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public ConvexResultCallback position(long position) { + return (ConvexResultCallback)super.position(position); + } + @Override public ConvexResultCallback getPointer(long i) { + return new ConvexResultCallback((Pointer)this).offsetAddress(i); + } public native @Cast("btScalar") double m_closestHitFraction(); public native ConvexResultCallback m_closestHitFraction(double setter); public native int m_collisionFilterGroup(); public native ConvexResultCallback m_collisionFilterGroup(int setter); @@ -185,9 +203,9 @@ private native void allocate(@Const btCollisionObject hitCollisionObject, public native @Cast("bool") boolean hasHit(); - public native @Cast("bool") boolean needsCollision(btBroadphaseProxy proxy0); + @Virtual public native @Cast("bool") @Const({false, false, true}) boolean needsCollision(btBroadphaseProxy proxy0); - public native @Cast("btScalar") double addSingleResult(@ByRef LocalConvexResult convexResult, @Cast("bool") boolean normalInWorldSpace); + @Virtual(true) public native @Cast("btScalar") double addSingleResult(@ByRef LocalConvexResult convexResult, @Cast("bool") boolean normalInWorldSpace); } @NoOffset public static class ClosestConvexResultCallback extends ConvexResultCallback { @@ -205,7 +223,7 @@ private native void allocate(@Const btCollisionObject hitCollisionObject, public native @ByRef btVector3 m_hitPointWorld(); public native ClosestConvexResultCallback m_hitPointWorld(btVector3 setter); public native @Const btCollisionObject m_hitCollisionObject(); public native ClosestConvexResultCallback m_hitCollisionObject(btCollisionObject setter); - public native @Cast("btScalar") double addSingleResult(@ByRef LocalConvexResult convexResult, @Cast("bool") boolean normalInWorldSpace); + @Virtual public native @Cast("btScalar") double addSingleResult(@ByRef LocalConvexResult convexResult, @Cast("bool") boolean normalInWorldSpace); } /**ContactResultCallback is used to report contact points */ @@ -213,21 +231,30 @@ private native void allocate(@Const btCollisionObject hitCollisionObject, static { Loader.load(); } /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ public ContactResultCallback(Pointer p) { super(p); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public ContactResultCallback(long size) { super((Pointer)null); allocateArray(size); } + private native void allocateArray(long size); + @Override public ContactResultCallback position(long position) { + return (ContactResultCallback)super.position(position); + } + @Override public ContactResultCallback getPointer(long i) { + return new ContactResultCallback((Pointer)this).offsetAddress(i); + } public native int m_collisionFilterGroup(); public native ContactResultCallback m_collisionFilterGroup(int setter); public native int m_collisionFilterMask(); public native ContactResultCallback m_collisionFilterMask(int setter); public native @Cast("btScalar") double m_closestDistanceThreshold(); public native ContactResultCallback m_closestDistanceThreshold(double setter); - public native @Cast("bool") boolean needsCollision(btBroadphaseProxy proxy0); + @Virtual public native @Cast("bool") @Const({false, false, true}) boolean needsCollision(btBroadphaseProxy proxy0); - public native @Cast("btScalar") double addSingleResult(@ByRef btManifoldPoint cp, @Const btCollisionObjectWrapper colObj0Wrap, int partId0, int index0, @Const btCollisionObjectWrapper colObj1Wrap, int partId1, int index1); + @Virtual(true) public native @Cast("btScalar") double addSingleResult(@ByRef btManifoldPoint cp, @Const btCollisionObjectWrapper colObj0Wrap, int partId0, int index0, @Const btCollisionObjectWrapper colObj1Wrap, int partId1, int index1); } public native int getNumCollisionObjects(); /** rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback * This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback. */ - public native void rayTest(@Const @ByRef btVector3 rayFromWorld, @Const @ByRef btVector3 rayToWorld, @ByRef RayResultCallback resultCallback); + @Virtual public native @Const({false, false, true}) void rayTest(@Const @ByRef btVector3 rayFromWorld, @Const @ByRef btVector3 rayToWorld, @ByRef RayResultCallback resultCallback); /** convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback * This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback. */ @@ -266,16 +293,15 @@ public static native void objectQuerySingleInternal(@Const btConvexShape castSha @Const btCollisionObjectWrapper colObjWrap, @ByRef ConvexResultCallback resultCallback, @Cast("btScalar") double allowedPenetration); - public native void addCollisionObject(btCollisionObject collisionObject, int collisionFilterGroup/*=btBroadphaseProxy::DefaultFilter*/, int collisionFilterMask/*=btBroadphaseProxy::AllFilter*/); - public native void addCollisionObject(btCollisionObject collisionObject); + @Virtual public native void addCollisionObject(btCollisionObject collisionObject, int collisionFilterGroup/*=btBroadphaseProxy::DefaultFilter*/, int collisionFilterMask/*=btBroadphaseProxy::AllFilter*/); - public native void refreshBroadphaseProxy(btCollisionObject collisionObject); + @Virtual public native void refreshBroadphaseProxy(btCollisionObject collisionObject); public native @ByRef btCollisionObjectArray getCollisionObjectArray(); - public native void removeCollisionObject(btCollisionObject collisionObject); + @Virtual public native void removeCollisionObject(btCollisionObject collisionObject); - public native void performDiscreteCollisionDetection(); + @Virtual public native void performDiscreteCollisionDetection(); public native @ByRef btDispatcherInfo getDispatchInfo(); @@ -283,5 +309,5 @@ public static native void objectQuerySingleInternal(@Const btConvexShape castSha public native void setForceUpdateAllAabbs(@Cast("bool") boolean forceUpdateAllAabbs); /**Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (Bullet/Demos/SerializeDemo) */ - public native void serialize(btSerializer serializer); + @Virtual public native void serialize(btSerializer serializer); } diff --git a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapCallback.java b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapCallback.java index 9b0613450c0..1406ac0cba3 100644 --- a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapCallback.java +++ b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapCallback.java @@ -16,9 +16,21 @@ @Properties(inherit = org.bytedeco.bullet.presets.BulletCollision.class) public class btOverlapCallback extends Pointer { static { Loader.load(); } + /** Default native constructor. */ + public btOverlapCallback() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public btOverlapCallback(long size) { super((Pointer)null); allocateArray(size); } /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ public btOverlapCallback(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public btOverlapCallback position(long position) { + return (btOverlapCallback)super.position(position); + } + @Override public btOverlapCallback getPointer(long i) { + return new btOverlapCallback((Pointer)this).offsetAddress(i); + } //return true for deletion of the pair - public native @Cast("bool") boolean processOverlap(@ByRef btBroadphasePair pair); + @Virtual(true) public native @Cast("bool") boolean processOverlap(@ByRef btBroadphasePair pair); } diff --git a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapFilterCallback.java b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapFilterCallback.java index 6c4c257c4bf..8f60b11dd33 100644 --- a/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapFilterCallback.java +++ b/bullet/src/gen/java/org/bytedeco/bullet/BulletCollision/btOverlapFilterCallback.java @@ -16,9 +16,21 @@ @Properties(inherit = org.bytedeco.bullet.presets.BulletCollision.class) public class btOverlapFilterCallback extends Pointer { static { Loader.load(); } + /** Default native constructor. */ + public btOverlapFilterCallback() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public btOverlapFilterCallback(long size) { super((Pointer)null); allocateArray(size); } /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ public btOverlapFilterCallback(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public btOverlapFilterCallback position(long position) { + return (btOverlapFilterCallback)super.position(position); + } + @Override public btOverlapFilterCallback getPointer(long i) { + return new btOverlapFilterCallback((Pointer)this).offsetAddress(i); + } // return true when pairs need collision - public native @Cast("bool") boolean needBroadphaseCollision(btBroadphaseProxy proxy0, btBroadphaseProxy proxy1); + @Virtual(true) public native @Cast("bool") @Const({false, false, true}) boolean needBroadphaseCollision(btBroadphaseProxy proxy0, btBroadphaseProxy proxy1); } diff --git a/bullet/src/main/java/org/bytedeco/bullet/presets/BulletCollision.java b/bullet/src/main/java/org/bytedeco/bullet/presets/BulletCollision.java index 8e85644b7f7..e98b734a542 100644 --- a/bullet/src/main/java/org/bytedeco/bullet/presets/BulletCollision.java +++ b/bullet/src/main/java/org/bytedeco/bullet/presets/BulletCollision.java @@ -220,6 +220,7 @@ public void map(InfoMap infoMap) { .put(new Info("btDbvt::sStkNPS").pointerTypes("btDbvt.sStkNPS")) .put(new Info("btCollisionObjectWrapper").purify(true)) + .put(new Info("btCollisionWorld", "btOverlapFilterCallback", "btOverlapCallback").virtualize()) .put(new Info("btCollisionWorldImporter.h").linePatterns("struct btContactSolverInfo;").skip()) .put(new Info("btDispatcher.h").linePatterns("class btRigidBody;").skip())