瀏覽代碼

Bullet (and jBullet): Remove deprecated PhysicsSpace.enableDebug method in favor of BulletAppState.setDebugEnabled.

iwgeric 10 年之前
父節點
當前提交
70b03ea28a

+ 1 - 11
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;

+ 6 - 30
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<PhysicsSweepTestResult>) results;
     }
 
-    public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, List<PhysicsSweepTestResult> results) {        
+    public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, List<PhysicsSweepTestResult> 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<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, List<PhysicsSweepTestResult> results, float allowedCcdPenetration ) {        
+    public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, List<PhysicsSweepTestResult> 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
-     * <code>BulletAppState.setDebugEnabled(boolean)</code> 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();
 
     /**

+ 7 - 31
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 <b>running on this thread</b><br/>
@@ -362,7 +361,7 @@ public class PhysicsSpace {
             eventFactory.recycle(physicsCollisionEvent);
         }
     }
-    
+
     public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) {
         AppTask<V> task = new AppTask<V>(callable);
         System.out.println("created apptask");
@@ -620,7 +619,7 @@ public class PhysicsSpace {
         physicsJoints.remove(joint.getObjectId());
         dynamicsWorld.removeConstraint(joint.getObjectId());
     }
-    
+
     public Collection<PhysicsRigidBody> getRigidBodyList(){
         return new LinkedList<PhysicsRigidBody>(physicsBodies.values());
     }
@@ -628,19 +627,19 @@ public class PhysicsSpace {
     public Collection<PhysicsGhostObject> getGhostObjectList(){
         return new LinkedList<PhysicsGhostObject>(physicsGhostObjects.values());
     }
-    
+
     public Collection<PhysicsCharacter> getCharacterList(){
         return new LinkedList<PhysicsCharacter>(physicsCharacters.values());
     }
-    
+
     public Collection<PhysicsJoint> getJointList(){
         return new LinkedList<PhysicsJoint>(physicsJoints.values());
     }
-    
+
     public Collection<PhysicsVehicle> getVehicleList(){
         return new LinkedList<PhysicsVehicle>(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
-     * <code>BulletAppState.setDebugEnabled(boolean)</code> 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
      */