Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bullet: Virtualize btMotionState and btDefaultMotionState to fix the Callbacks #1297

Merged
merged 2 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,6 +148,8 @@ public void map(InfoMap infoMap) {

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

.put(new Info("btDefaultMotionState").virtualize())
.put(new Info("btMotionState").virtualize())
.put(new Info("btIDebugDraw").virtualize())
saudet marked this conversation as resolved.
Show resolved Hide resolved

.put(new Info(
Expand Down