Skip to content

Commit

Permalink
* Virtualize btMotionState and btDefaultMotionState from Bullet …
Browse files Browse the repository at this point in the history
…Physics SDK to allow callbacks (pull #1297)
  • Loading branch information
calvertdw authored Dec 29, 2022
1 parent 72b6efd commit 76f9623
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Virtualize `btMotionState` and `btDefaultMotionState` from Bullet Physics SDK to fix that functionality. ([pull #1297](https://github.com/bytedeco/javacpp-presets/pull/1297))
* Define `STRING_BYTES_CHARSET` to "UTF-8" for FFmpeg since it appears to assume that ([issue bytedeco/javacv#1945](https://github.com/bytedeco/javacv/issues/1945))
* Map `at::ITensorListRef` as used by `at::cat()` in presets for PyTorch ([issue #1293](https://github.com/bytedeco/javacpp-presets/issues/1293))
* Map `torch::data::datasets::ChunkDataReader` and related data loading classes from PyTorch ([issue #1215](https://github.com/bytedeco/javacpp-presets/issues/1215))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public class btDefaultMotionState extends btMotionState {
private native void allocate();

/**synchronizes world transform from user to physics */
public native void getWorldTransform(@ByRef btTransform centerOfMassWorldTrans);
@Virtual public native @Const({false, false, true}) void getWorldTransform(@ByRef btTransform centerOfMassWorldTrans);

/**synchronizes world transform from physics to user
* Bullet only calls the update of worldtransform for active objects */
public native void setWorldTransform(@Const @ByRef btTransform centerOfMassWorldTrans);
@Virtual public native void setWorldTransform(@Const @ByRef btTransform centerOfMassWorldTrans);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@
@Properties(inherit = org.bytedeco.bullet.presets.LinearMath.class)
public class btMotionState extends Pointer {
static { Loader.load(); }
/** Default native constructor. */
public btMotionState() { super((Pointer)null); allocate(); }
/** Native array allocator. Access with {@link Pointer#position(long)}. */
public btMotionState(long size) { super((Pointer)null); allocateArray(size); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public btMotionState(Pointer p) { super(p); }
private native void allocate();
private native void allocateArray(long size);
@Override public btMotionState position(long position) {
return (btMotionState)super.position(position);
}
@Override public btMotionState getPointer(long i) {
return new btMotionState((Pointer)this).offsetAddress(i);
}


public native void getWorldTransform(@ByRef btTransform worldTrans);
@Virtual(true) public native @Const({false, false, true}) void getWorldTransform(@ByRef btTransform worldTrans);

//Bullet only calls the update of worldtransform for active objects
public native void setWorldTransform(@Const @ByRef btTransform worldTrans);
@Virtual(true) public native void setWorldTransform(@Const @ByRef btTransform worldTrans);
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void map(InfoMap infoMap) {

.put(new Info("btAlignedObjectArray.h").linePatterns("\tclass less", "\t};").skip())

.put(new Info("btIDebugDraw").virtualize())
.put(new Info("btIDebugDraw", "btMotionState", "btDefaultMotionState").virtualize())

.put(new Info(
"BT_DECLARE_ALIGNED_ALLOCATOR",
Expand Down

0 comments on commit 76f9623

Please sign in to comment.