@Override
    public void update(float tpf) {
        // TODO

        hardware.updatePose();

        // TODO deduplicate
        if (environment == null) {
            throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
        }

        // grab the observer
        Object obs = environment.getObserver();
        Quaternion objRot;
        Vector3f objPos;
        if (obs instanceof Camera) {
            objRot = ((Camera) obs).getRotation();
            objPos = ((Camera) obs).getLocation();
        } else {
            objRot = ((Spatial) obs).getWorldRotation();
            objPos = ((Spatial) obs).getWorldTranslation();
        }

        // update the HMD's position & orientation
        hardware.getPositionAndOrientation(hmdPos, hmdRot);
        if (obs != null) {
            // update hmdPos based on obs rotation
            finalRotation.set(objRot);
            finalRotation.mult(hmdPos, hmdPos);
            finalRotation.multLocal(hmdRot);
        }

        // Update both eye cameras
        finalizeCamera(hardware.getHMDVectorPoseLeftEye(), objPos, leftCamera);
        finalizeCamera(hardware.getHMDVectorPoseRightEye(), objPos, rightCamera);

        // Update the main camera, so it shows the same basic view the HMD is getting
        // TODO: Do this in VRAppState, so it works on all HMDs.
        // I only have a Rift, so I can't test it on anything else.
        if(!environment.isInstanceRendering()) { // We use the app camera as the left camera here
            // TODO: Double up on rendering and use one eye, to reduce GPU load rendering the scene again.
            // TODO: Snip at the image to remove the distorted corners from a very high FOV.
            finalizeCamera(Vector3f.ZERO, objPos, environment.getApplication().getCamera());
        }

        if (environment.hasTraditionalGUIOverlay()) {
            // update the mouse?
            environment.getVRMouseManager().update(tpf);

            // update GUI position?
            if (environment.getVRGUIManager().isWantsReposition() || environment.getVRGUIManager().getPositioningMode() != VRGUIPositioningMode.MANUAL) {
                environment.getVRGUIManager().positionGuiNow(tpf);
                environment.getVRGUIManager().updateGuiQuadGeometricState();
            }
        }
    }
A rendering system for Oculus's LibOVR API.

@author Campbell Suter (znix@znix.xyz)
jme3-vr/src/main/java/com/jme3/input/vr/oculus/OculusViewManager.java