From 70b03ea28a568463dbc942fd123aaba78de6c04e Mon Sep 17 00:00:00 2001 From: iwgeric Date: Sun, 26 Apr 2015 19:20:06 -0400 Subject: [PATCH] Bullet (and jBullet): Remove deprecated PhysicsSpace.enableDebug method in favor of BulletAppState.setDebugEnabled. --- .../java/com/jme3/bullet/BulletAppState.java | 12 +----- .../java/com/jme3/bullet/PhysicsSpace.java | 36 +++--------------- .../java/com/jme3/bullet/PhysicsSpace.java | 38 ++++--------------- 3 files changed, 14 insertions(+), 72 deletions(-) diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/BulletAppState.java b/jme3-bullet/src/common/java/com/jme3/bullet/BulletAppState.java index 05aa9a926..ae278c871 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/BulletAppState.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/BulletAppState.java @@ -166,7 +166,7 @@ public class BulletAppState implements AppState, PhysicsTickListener { pSpace.addTickListener(this); initialized = true; } - + public void stopPhysics() { if(!initialized){ return; @@ -226,19 +226,9 @@ public class BulletAppState implements AppState, PhysicsTickListener { if (debugEnabled && debugAppState == null && pSpace != null) { debugAppState = new BulletDebugAppState(pSpace); stateManager.attach(debugAppState); - pSpace.enableDebug(app.getAssetManager()); } else if (!debugEnabled && debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; - if (pSpace != null) { - pSpace.enableDebug(null); - } - } - //TODO: remove when deprecation of PhysicsSpace.enableDebug is through - if (pSpace.getDebugManager() != null && !debugEnabled) { - debugEnabled = true; - } else if (pSpace.getDebugManager() == null && debugEnabled) { - debugEnabled = false; } if (!active) { return; diff --git a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index 380dc3e16..4485edcd7 100644 --- a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -102,7 +102,6 @@ public class PhysicsSpace { private Vector3f worldMax = new Vector3f(10000f, 10000f, 10000f); private float accuracy = 1f / 60f; private int maxSubSteps = 4, rayTestFlags = 1 << 2; - private AssetManager debugManager; static { // System.loadLibrary("bulletjme"); @@ -702,7 +701,7 @@ public class PhysicsSpace { public Vector3f getGravity(Vector3f gravity) { return gravity.set(this.gravity); } - + // /** // * applies gravity value to all objects // */ @@ -783,7 +782,7 @@ public class PhysicsSpace { 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. @@ -792,7 +791,7 @@ public class PhysicsSpace { public int GetRayTestFlags() { return rayTestFlags; } - + /** * Performs a ray collision test and returns the results as a list of * PhysicsRayTestResults @@ -837,7 +836,7 @@ public class PhysicsSpace { return (List) results; } - public List sweepTest(CollisionShape shape, Transform start, Transform end, List results) { + public List sweepTest(CollisionShape shape, Transform start, Transform end, List results) { return sweepTest(shape, start, end, results, 0.0f); } @@ -849,7 +848,7 @@ public class PhysicsSpace { * collision if it starts INSIDE an object and is moving AWAY from its * center. */ - public List sweepTest(CollisionShape shape, Transform start, Transform end, List results, float allowedCcdPenetration ) { + public List sweepTest(CollisionShape shape, Transform start, Transform end, List results, float allowedCcdPenetration ) { results.clear(); sweepTest_native(shape.getObjectId(), start, end, physicsSpaceId, results, allowedCcdPenetration); return results; @@ -872,7 +871,7 @@ public class PhysicsSpace { } */ - + /** * destroys the current PhysicsSpace so that a new one can be created */ @@ -959,29 +958,6 @@ public class PhysicsSpace { this.worldMax.set(worldMax); } - /** - * Enable debug display for physics. - * - * @deprecated in favor of BulletDebugAppState, use - * BulletAppState.setDebugEnabled(boolean) to add automatically - * @param manager AssetManager to use to create debug materials - */ - @Deprecated - public void enableDebug(AssetManager manager) { - debugManager = manager; - } - - /** - * Disable debug display - */ - public void disableDebug() { - debugManager = null; - } - - public AssetManager getDebugManager() { - return debugManager; - } - public static native void initNativePhysics(); /** diff --git a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index dc61e6c6c..3c8a3b225 100644 --- a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -142,7 +142,6 @@ public class PhysicsSpace { private javax.vecmath.Vector3f rayVec2 = new javax.vecmath.Vector3f(); private com.bulletphysics.linearmath.Transform sweepTrans1 = new com.bulletphysics.linearmath.Transform(new javax.vecmath.Matrix3f()); private com.bulletphysics.linearmath.Transform sweepTrans2 = new com.bulletphysics.linearmath.Transform(new javax.vecmath.Matrix3f()); - private AssetManager debugManager; /** * Get the current PhysicsSpace running on this thread
@@ -362,7 +361,7 @@ public class PhysicsSpace { eventFactory.recycle(physicsCollisionEvent); } } - + public static Future enqueueOnThisThread(Callable callable) { AppTask task = new AppTask(callable); System.out.println("created apptask"); @@ -620,7 +619,7 @@ public class PhysicsSpace { physicsJoints.remove(joint.getObjectId()); dynamicsWorld.removeConstraint(joint.getObjectId()); } - + public Collection getRigidBodyList(){ return new LinkedList(physicsBodies.values()); } @@ -628,19 +627,19 @@ public class PhysicsSpace { public Collection getGhostObjectList(){ return new LinkedList(physicsGhostObjects.values()); } - + public Collection getCharacterList(){ return new LinkedList(physicsCharacters.values()); } - + public Collection getJointList(){ return new LinkedList(physicsJoints.values()); } - + public Collection getVehicleList(){ return new LinkedList(physicsVehicles.values()); } - + /** * Sets the gravity of the PhysicsSpace, set before adding physics objects! * @param gravity @@ -658,7 +657,7 @@ public class PhysicsSpace { dynamicsWorld.getGravity(tempVec); return Converter.convert(tempVec, gravity); } - + /** * applies gravity value to all objects */ @@ -877,29 +876,6 @@ public class PhysicsSpace { this.worldMax.set(worldMax); } - /** - * Enable debug display for physics. - * - * @deprecated in favor of BulletDebugAppState, use - * BulletAppState.setDebugEnabled(boolean) to add automatically - * @param manager AssetManager to use to create debug materials - */ - @Deprecated - public void enableDebug(AssetManager manager) { - debugManager = manager; - } - - /** - * Disable debug display - */ - public void disableDebug() { - debugManager = null; - } - - public AssetManager getDebugManager() { - return debugManager; - } - /** * interface with Broadphase types */