From 4ce05dd0cad78f5ed5395bfd210ccd237802f53a Mon Sep 17 00:00:00 2001 From: Campbell Suter Date: Thu, 28 Sep 2017 12:51:27 +1300 Subject: [PATCH] Add pre-render method to VRViewManager in preparation for adding Oculus Rift support. See https://hub.jmonkeyengine.org/t/libovr-oculus-rift-support/39427 --- jme3-vr/src/main/java/com/jme3/app/VRAppState.java | 10 ++++++++++ .../main/java/com/jme3/util/AbstractVRViewManager.java | 4 ++++ jme3-vr/src/main/java/com/jme3/util/VRViewManager.java | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/jme3-vr/src/main/java/com/jme3/app/VRAppState.java b/jme3-vr/src/main/java/com/jme3/app/VRAppState.java index a468e71b9..39df3884b 100644 --- a/jme3-vr/src/main/java/com/jme3/app/VRAppState.java +++ b/jme3-vr/src/main/java/com/jme3/app/VRAppState.java @@ -432,6 +432,16 @@ public class VRAppState extends AbstractAppState { } } + @Override + public void render(RenderManager rm) { + super.render(rm); + + // update compositor + if( environment.getVRViewManager() != null ) { + environment.getVRViewManager().render(); + } + } + @Override public void initialize(AppStateManager stateManager, Application app) { super.initialize(stateManager, app); diff --git a/jme3-vr/src/main/java/com/jme3/util/AbstractVRViewManager.java b/jme3-vr/src/main/java/com/jme3/util/AbstractVRViewManager.java index f4f7e7f91..6c664dd59 100644 --- a/jme3-vr/src/main/java/com/jme3/util/AbstractVRViewManager.java +++ b/jme3-vr/src/main/java/com/jme3/util/AbstractVRViewManager.java @@ -128,6 +128,10 @@ public abstract class AbstractVRViewManager implements VRViewManager { public VREnvironment getVREnvironment(){ return environment; } + + @Override + public void render() { + } /** * Handles moving filters from the main view to each eye diff --git a/jme3-vr/src/main/java/com/jme3/util/VRViewManager.java b/jme3-vr/src/main/java/com/jme3/util/VRViewManager.java index 58a6c166e..1a5eaeb75 100644 --- a/jme3-vr/src/main/java/com/jme3/util/VRViewManager.java +++ b/jme3-vr/src/main/java/com/jme3/util/VRViewManager.java @@ -150,6 +150,12 @@ public interface VRViewManager { */ public void update(float tpf); + /** + * Set up the scene for rendering. + * This method should be called before any rendering takes place. + */ + public void render(); + /** * Send the rendering result as textures to the two eyes. * This method should be called after all the rendering operations