Native bullet raytest m_flags now accessible to Java, updated bullet builds incoming...

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10881 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
phr00t 11 years ago
parent ac51e1d885
commit 614bffa9ae
  1. 3
      engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.cpp
  2. 4
      engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.h
  3. 23
      engine/src/bullet/com/jme3/bullet/PhysicsSpace.java

@ -419,7 +419,7 @@ extern "C" {
} }
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native
(JNIEnv * env, jobject object, jobject from, jobject to, jlong spaceId, jobject resultlist) { (JNIEnv * env, jobject object, jobject from, jobject to, jlong spaceId, jobject resultlist, jint flags) {
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*> (spaceId); jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*> (spaceId);
if (space == NULL) { if (space == NULL) {
@ -463,6 +463,7 @@ extern "C" {
AllRayResultCallback resultCallback(native_from, native_to); AllRayResultCallback resultCallback(native_from, native_to);
resultCallback.env = env; resultCallback.env = env;
resultCallback.resultlist = resultlist; resultCallback.resultlist = resultlist;
resultCallback.m_flags = flags;
space->getDynamicsWorld()->rayTest(native_from, native_to, resultCallback); space->getDynamicsWorld()->rayTest(native_from, native_to, resultCallback);
return; return;
} }

@ -144,10 +144,10 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setGravity
/* /*
* Class: com_jme3_bullet_PhysicsSpace * Class: com_jme3_bullet_PhysicsSpace
* Method: rayTest_native * Method: rayTest_native
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;)V * Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;I)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native
(JNIEnv *, jobject, jobject, jobject, jlong, jobject); (JNIEnv *, jobject, jobject, jobject, jlong, jobject, jint);
/* /*
* Class: com_jme3_bullet_PhysicsSpace * Class: com_jme3_bullet_PhysicsSpace

@ -99,7 +99,7 @@ public class PhysicsSpace {
private Vector3f worldMin = new Vector3f(-10000f, -10000f, -10000f); private Vector3f worldMin = new Vector3f(-10000f, -10000f, -10000f);
private Vector3f worldMax = new Vector3f(10000f, 10000f, 10000f); private Vector3f worldMax = new Vector3f(10000f, 10000f, 10000f);
private float accuracy = 1f / 60f; private float accuracy = 1f / 60f;
private int maxSubSteps = 4; private int maxSubSteps = 4, rayTestFlags = 1 << 2;
private AssetManager debugManager; private AssetManager debugManager;
static { static {
@ -787,17 +787,34 @@ public class PhysicsSpace {
return (List<PhysicsRayTestResult>) results; return (List<PhysicsRayTestResult>) results;
} }
/**
* Sets m_flags for raytest, see https://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
* for possible options. Defaults to using the faster, approximate raytest.
*/
public void SetRayTestFlags(int flags) {
rayTestFlags = flags;
}
/**
* Gets m_flags for raytest, see https://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h
* for possible options.
* @return rayTestFlags
*/
public int GetRayTestFlags() {
return rayTestFlags;
}
/** /**
* Performs a ray collision test and returns the results as a list of * Performs a ray collision test and returns the results as a list of
* PhysicsRayTestResults * PhysicsRayTestResults
*/ */
public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to, List<PhysicsRayTestResult> results) { public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to, List<PhysicsRayTestResult> results) {
results.clear(); results.clear();
rayTest_native(from, to, physicsSpaceId, results); rayTest_native(from, to, physicsSpaceId, results, rayTestFlags);
return results; return results;
} }
public native void rayTest_native(Vector3f from, Vector3f to, long physicsSpaceId, List<PhysicsRayTestResult> results); public native void rayTest_native(Vector3f from, Vector3f to, long physicsSpaceId, List<PhysicsRayTestResult> results, int flags);
// private class InternalRayListener extends CollisionWorld.RayResultCallback { // private class InternalRayListener extends CollisionWorld.RayResultCallback {
// //

Loading…
Cancel
Save