Selaa lähdekoodia

Remove OpenVR References from BulletDebugAppState.java

Ryan McDonough 1 viikko sitten
vanhempi
sitoutus
128d1798a8

+ 8 - 35
jme3-jbullet/src/main/java/com/jme3/bullet/debug/BulletDebugAppState.java

@@ -32,7 +32,6 @@
 package com.jme3.bullet.debug;
 
 import com.jme3.app.Application;
-import com.jme3.app.VRAppState;
 import com.jme3.app.state.AbstractAppState;
 import com.jme3.app.state.AppStateManager;
 import com.jme3.asset.AssetManager;
@@ -173,17 +172,11 @@ public class BulletDebugAppState extends AbstractAppState {
         setupMaterials(app);
         physicsDebugRootNode.setCullHint(Spatial.CullHint.Never);
 
-        if (isVr()) {
-            /* This is a less good solution than the non-vr version (as the debug shapes can be obscured by the regular
-            * geometry), however it is the best possible as VR does not currently support multiple viewports per eye */
-            VRAppState vrAppState = stateManager.getState(VRAppState.ID, VRAppState.class);
-            vrAppState.getLeftViewPort().attachScene(physicsDebugRootNode);
-            vrAppState.getRightViewPort().attachScene(physicsDebugRootNode);
-        } else {
-            viewPort = rm.createMainView("Physics Debug Overlay", app.getCamera());
-            viewPort.setClearFlags(false, true, false);
-            viewPort.attachScene(physicsDebugRootNode);
-        }
+
+        viewPort = rm.createMainView("Physics Debug Overlay", app.getCamera());
+        viewPort.setClearFlags(false, true, false);
+        viewPort.attachScene(physicsDebugRootNode);
+        
     }
 
     /**
@@ -193,15 +186,8 @@ public class BulletDebugAppState extends AbstractAppState {
      * is invoked.
      */
     @Override
-    public void cleanup() {
-        if (isVr()) {
-            VRAppState vrAppState = app.getStateManager().getState(VRAppState.ID, VRAppState.class);
-            vrAppState.getLeftViewPort().detachScene(physicsDebugRootNode);
-            vrAppState.getRightViewPort().detachScene(physicsDebugRootNode);
-        } else {
-            rm.removeMainView(viewPort);
-        }
-
+    public void cleanup() {        
+        rm.removeMainView(viewPort);        
         super.cleanup();
     }
 
@@ -436,17 +422,4 @@ public class BulletDebugAppState extends AbstractAppState {
          */
         public boolean displayObject(Object obj);
     }
-
-    private boolean isVr() {
-        if (isVr == null) {
-            try {
-                VRAppState vrAppState = app.getStateManager().getState(VRAppState.ID, VRAppState.class);
-                isVr = vrAppState != null && !vrAppState.DISABLE_VR;
-            } catch (NoClassDefFoundError e) {
-                //Vr isn't even on the classpath
-                isVr = false;
-            }
-        }
-        return isVr;
-    }
-}
+}