Permalink
Browse files

updating OpenVR libraries (which removed some functions that we were …

…not using yet).

Got GUI elements working again, with one small oddity (see forum post)

Camera resolution, FOV, frustrum all fixed

Moved some things out of the AppState into VRApplication for simplicity, now hides AppState to be managed by VRApplication. VRApplication things, like setting the current observer, can be access by static methods anywhere.
  • Loading branch information...
phr00t committed Jul 8, 2015
1 parent 585a40f commit 13db35d6e678d4bf63b1a3ca014268efb0d3710e
Showing with 340 additions and 530 deletions.
  1. BIN src/darwin/openvr_api.dylib
  2. +28 −95 src/jmevr/app/VRApplication.java
  3. +2 −6 src/jmevr/control/StereoCameraControl.java
  4. 0 src/jmevr/input/HMDInfo.java
  5. 0 src/jmevr/input/OculusRift.java
  6. 0 src/jmevr/input/OpenVR.java
  7. 0 src/jmevr/input/VRHMD.java
  8. 0 src/jmevr/input/VRInput.java
  9. 0 src/jmevr/post/CartoonSSAO.java
  10. 0 src/jmevr/post/FastSSAO.java
  11. 0 src/jmevr/post/OculusFilter.java
  12. 0 src/jmevr/post/OpenVRFilter.java
  13. 0 src/jmevr/shaders/CartoonSSAO.frag
  14. 0 src/jmevr/shaders/CartoonSSAO.j3md
  15. 0 src/jmevr/shaders/FastSSAO.frag
  16. 0 src/jmevr/shaders/FastSSAO.j3md
  17. 0 src/jmevr/shaders/Oculus.frag
  18. 0 src/jmevr/shaders/Oculus.j3md
  19. 0 src/jmevr/shaders/OpenVR.frag
  20. 0 src/jmevr/shaders/OpenVR.j3md
  21. 0 src/jmevr/shaders/OpenVR.vert
  22. 0 src/jmevr/shadow/VRDirectionalLightShadowRenderer.java
  23. +0 −180 src/jmevr/state/OpenVRAppState.java
  24. +269 −0 src/jmevr/state/OpenVRCamControl.java
  25. +1 −0 src/jmevr/state/VRAppState.java
  26. 0 src/jmevr/util/FilterUtil.java
  27. 0 src/jmevr/util/OculusRiftUtil.java
  28. 0 src/jmevr/util/OpenVRUtil.java
  29. +1 −1 src/jmevr/util/VRGuiNode.java
  30. 0 src/jopenvr/CameraImage_t.java
  31. 0 src/jopenvr/CameraInfo_t.java
  32. 0 src/jopenvr/ChaperoneSeatedBoundsInfo_t.java
  33. 0 src/jopenvr/ChaperoneSoftBoundsInfo_t.java
  34. 0 src/jopenvr/Compositor_FrameTiming.java
  35. 0 src/jopenvr/Compositor_OverlaySettings.java
  36. 0 src/jopenvr/DistortionCoordinates_t.java
  37. 0 src/jopenvr/HiddenAreaMesh_t.java
  38. 0 src/jopenvr/HmdMatrix34_t.java
  39. 0 src/jopenvr/HmdMatrix44_t.java
  40. 0 src/jopenvr/HmdQuad_t.java
  41. 0 src/jopenvr/HmdQuaternion_t.java
  42. 0 src/jopenvr/HmdVector2_t.java
  43. 0 src/jopenvr/HmdVector3_t.java
  44. 0 src/jopenvr/HmdVector3d_t.java
  45. +30 −30 src/jopenvr/JOpenVRLibrary.java
  46. 0 src/jopenvr/NotificationBitmap.java
  47. 0 src/jopenvr/RenderModel_TextureMap_t.java
  48. 0 src/jopenvr/RenderModel_Vertex_t.java
  49. 0 src/jopenvr/RenderModel_t.java
  50. 0 src/jopenvr/TrackedDevicePose_t.java
  51. 0 src/jopenvr/VRControllerAxis_t.java
  52. 0 src/jopenvr/VRControllerState_t.java
  53. 0 src/jopenvr/VREvent_Controller_t.java
  54. 0 src/jopenvr/VREvent_Data_t.java
  55. 0 src/jopenvr/VREvent_Mouse_t.java
  56. 0 src/jopenvr/VREvent_Process_t.java
  57. 0 src/jopenvr/VREvent_Reserved_t.java
  58. 0 src/jopenvr/VROverlayIntersectionParams_t.java
  59. 0 src/jopenvr/VROverlayIntersectionResults_t.java
  60. 0 src/jopenvr/VRTextureBounds_t.java
  61. BIN src/linux-x86-64/libopenvr_api.so
  62. BIN src/linux-x86/libopenvr_api.so
  63. BIN src/linux-x86/libopenvr_api.so.dbg
  64. BIN src/win32-x86-64/openvr_api.dll
  65. BIN src/win32-x86-64/openvr_api.pdb
  66. BIN src/win32-x86/openvr_api.dll
  67. BIN src/win32-x86/openvr_api.pdb
  68. +9 −15 test/jmevr/TestOpenVR.java
  69. +0 −203 test/jmevr/TestVRApplication.java
View
BIN +1.76 KB (100%) src/darwin/openvr_api.dylib 100755 → 100644
Binary file not shown.
View
123 src/jmevr/app/VRApplication.java 100755 → 100644
@@ -17,6 +17,7 @@
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.input.event.TouchEvent;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Spatial;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
import com.jme3.system.JmeSystem;
@@ -26,6 +27,7 @@
import jmevr.input.VRHMD;
import jmevr.input.VRInput;
import jmevr.post.PreNormalCaching;
import jmevr.state.OpenVRCamControl;
import jmevr.state.VRAppState;
import jmevr.util.VRGuiNode;
import jmevr.util.OculusRiftUtil;
@@ -36,61 +38,19 @@
*/
public class VRApplication extends SimpleApplication{
private static VRHMD VRhardware;
private static VRAppState VRappstate;
private static OpenVR VRhardware;
private static OpenVRCamControl VRappstate;
private static VRGuiNode primaryGuiNode;
private static Spatial observer;
private static final ArrayList<VRInput> VRinput = new ArrayList<>();
protected boolean useFOVMax, flipEyes, disable_vignette;
private final String TOGGLE_LOW_PERSISTENCE = "ToggleLowPersistence";
private final String RESET_HMD = "ResetHMD";
private final DismissWarningListener oculusWarningListener = new DismissWarningListener();
private class DismissWarningListener implements RawInputListener {
@Override
public void beginInput() {
}
@Override
public void endInput() {
}
@Override
public void onJoyAxisEvent(JoyAxisEvent evt) {
}
@Override
public void onJoyButtonEvent(JoyButtonEvent evt) {
dismissWarning();
}
@Override
public void onMouseMotionEvent(MouseMotionEvent evt) {
}
@Override
public void onMouseButtonEvent(MouseButtonEvent evt) {
dismissWarning();
}
@Override
public void onKeyEvent(KeyInputEvent evt) {
dismissWarning();
}
@Override
public void onTouchEvent(TouchEvent evt) {
dismissWarning();
}
}
private class OculusListener implements ActionListener{
private class VRListener implements ActionListener{
public void onAction(String name, boolean isPressed, float tpf) {
if(name.equals(TOGGLE_LOW_PERSISTENCE) && !isPressed && VRhardware instanceof OculusRift ){
((OculusRift)VRhardware).toggleLowPersistence();
} else if (name.equals(RESET_HMD) && !isPressed){
if (name.equals(RESET_HMD) && !isPressed){
reset();
}
}
@@ -104,7 +64,8 @@ public void simpleRender(RenderManager renderManager) {
public VRApplication() {
super();
guiNode = new VRGuiNode();
guiNode = new VRGuiNode();
primaryGuiNode = (VRGuiNode)guiNode;
// we are going to use OpenVR now, not the Oculus Rift
// OpenVR does support the Rift
@@ -127,10 +88,6 @@ public void preconfigureVRApp(boolean disable_vignette, boolean force_max_fov, b
return VRinput;
}
public static VRAppState getVRAppState() {
return VRappstate;
}
public static VRHMD getVRHardware() {
return VRhardware;
}
@@ -140,51 +97,35 @@ private static void initVRinput() {
// check for Vive controllers, add as needed etc.
}
public static VRGuiNode getVRGuiNode(){
return primaryGuiNode;
}
public static Spatial getObserver() {
return observer;
}
public static void setObserver(Spatial observer) {
VRApplication.observer = observer;
}
@Override
public void simpleInitApp() {
// run this function before OVRAppState gets initialized to force
// maximum FOV rendering
if( VRhardware.isInitialized() ) {
if( VRhardware instanceof OculusRift ) {
OculusRiftUtil.useMaxEyeFov(useFOVMax);
OculusRiftUtil.disableVignette(disable_vignette);
} else if( VRhardware instanceof OpenVR ) {
if( VRhardware instanceof OpenVR ) {
((OpenVR)VRhardware).initOpenVRCompositor();
}
VRappstate = new VRAppState((VRGuiNode)guiNode, flipEyes);
VRappstate.getGuiNode().setPositioningMode(VRGuiNode.POSITIONING_MODE.AUTO);
inputManager.addRawInputListener(oculusWarningListener);
inputManager.addListener(new OculusListener(), new String[]{TOGGLE_LOW_PERSISTENCE, RESET_HMD});
inputManager.addMapping(TOGGLE_LOW_PERSISTENCE, new KeyTrigger(KeyInput.KEY_F10));
inputManager.addMapping(RESET_HMD, new KeyTrigger(KeyInput.KEY_F9));
// TODO: implement flipeyes?
VRappstate = new OpenVRCamControl(this);
stateManager.attach(VRappstate);
inputManager.addListener(new VRListener(), new String[]{RESET_HMD});
inputManager.addMapping(RESET_HMD, new KeyTrigger(KeyInput.KEY_F9));
initVRinput();
setLostFocusBehavior(LostFocusBehavior.Disabled);
}
}
@Override
public void start() {
// set some default settings in-case
// settings dialog is not shown
boolean loadSettings = false;
if (settings == null) {
setSettings(new AppSettings(true));
loadSettings = true;
}
// show settings dialog
if (showSettings) {
if (!JmeSystem.showSettingsDialog(settings, loadSettings)) {
return;
}
}
//swap buffers setting
settings.setSwapBuffers(!VRhardware.isInitialized());
//re-setting settings they can have been merged from the registry.
setSettings(settings);
start(JmeContext.Type.Display, false);
}
@Override
protected void finalize() throws Throwable {
@@ -195,14 +136,6 @@ protected void finalize() throws Throwable {
}
}
public void dismissWarning(){
if( VRhardware instanceof OculusRift ) {
((OculusRift)VRhardware).getHmd().dismissHSWDisplay();
reset(); // reset position when the warning gets removed
inputManager.removeRawInputListener(oculusWarningListener);
}
}
public void reset(){
VRhardware.reset();
for(int i=0;i<VRinput.size();i++) {
View
@@ -48,6 +48,7 @@
import jmevr.app.VRApplication;
import jmevr.input.OculusRift;
import jmevr.input.VRHMD;
import jmevr.state.OpenVRCamControl;
import jmevr.state.VRAppState;
import jmevr.util.VRGuiNode.POSITIONING_MODE;
@@ -57,6 +58,7 @@
* of the current spatial.
* @author tim, reden
*/
@Deprecated
public class StereoCameraControl extends CameraControl {
private final Quaternion lookDirection = new Quaternion();
@@ -146,12 +148,6 @@ public void setView(float tpf, Vector3f pos, Quaternion look, boolean useOffset)
vars.release();
// update gui node?
VRAppState vrapp = VRApplication.getVRAppState();
if( vrapp != null && vrapp.getGuiNode() != null &&
vrapp.getGuiNode().getPositioningMode() != POSITIONING_MODE.MANUAL ) {
vrapp.getGuiNode().positionGui();
}
}
// fields used, when inversing ControlDirection:
View
0 src/jmevr/input/HMDInfo.java 100755 → 100644
No changes.
View
0 src/jmevr/input/OculusRift.java 100755 → 100644
No changes.
View
0 src/jmevr/input/OpenVR.java 100755 → 100644
No changes.
View
0 src/jmevr/input/VRHMD.java 100755 → 100644
No changes.
View
0 src/jmevr/input/VRInput.java 100755 → 100644
No changes.
View
0 src/jmevr/post/CartoonSSAO.java 100755 → 100644
No changes.
View
0 src/jmevr/post/FastSSAO.java 100755 → 100644
No changes.
View
0 src/jmevr/post/OculusFilter.java 100755 → 100644
No changes.
View
0 src/jmevr/post/OpenVRFilter.java 100755 → 100644
No changes.
View
No changes.
View
No changes.
View
0 src/jmevr/shaders/FastSSAO.frag 100755 → 100644
No changes.
View
0 src/jmevr/shaders/FastSSAO.j3md 100755 → 100644
No changes.
View
0 src/jmevr/shaders/Oculus.frag 100755 → 100644
No changes.
View
0 src/jmevr/shaders/Oculus.j3md 100755 → 100644
No changes.
View
0 src/jmevr/shaders/OpenVR.frag 100755 → 100644
No changes.
View
0 src/jmevr/shaders/OpenVR.j3md 100755 → 100644
No changes.
View
0 src/jmevr/shaders/OpenVR.vert 100755 → 100644
No changes.
No changes.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 13db35d

Please sign in to comment.