Search in sources :

Example 1 with VRViewManagerOSVR

use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.

the class OSVRInput method getFinalObserverPosition.

@Override
public Vector3f getFinalObserverPosition(int index) {
    VRViewManagerOSVR vrvm = (VRViewManagerOSVR) environment.getVRViewManager();
    if (vrvm == null || isInputDeviceTracking(index) == false)
        return null;
    Object obs = environment.getObserver();
    Vector3f pos = getPosition(index);
    if (obs instanceof Camera) {
        ((Camera) obs).getRotation().mult(pos, pos);
        return pos.addLocal(((Camera) obs).getLocation());
    } else {
        ((Spatial) obs).getWorldRotation().mult(pos, pos);
        return pos.addLocal(((Spatial) obs).getWorldTranslation());
    }
}
Also used : VRViewManagerOSVR(com.jme3.util.VRViewManagerOSVR) Vector3f(com.jme3.math.Vector3f) Camera(com.jme3.renderer.Camera)

Example 2 with VRViewManagerOSVR

use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.

the class VREnvironment method atttach.

/**
     * Attach the VR environment to the given app state and application. 
     * This method should be called within the {@link AppState#stateAttached(com.jme3.app.state.AppStateManager) stateAttached(com.jme3.app.state.AppStateManager)} method 
     * from the app state.
     * @param appState the app state to attach.
     * @param application the application to attach.
     */
public void atttach(AppState appState, Application application) {
    this.application = application;
    this.app = appState;
    // Instanciate view manager
    if (vrBinding == VRConstants.SETTING_VRAPI_OPENVR_VALUE) {
        viewmanager = new VRViewManagerOpenVR(this);
    } else if (vrBinding == VRConstants.SETTING_VRAPI_OSVR_VALUE) {
        viewmanager = new VRViewManagerOSVR(this);
    } else {
        logger.severe("Cannot instanciate view manager, unknown VRAPI type: " + vrBinding);
    }
}
Also used : VRViewManagerOSVR(com.jme3.util.VRViewManagerOSVR) VRViewManagerOpenVR(com.jme3.util.VRViewManagerOpenVR)

Example 3 with VRViewManagerOSVR

use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.

the class OSVRInput method getFinalObserverRotation.

@Override
public Quaternion getFinalObserverRotation(int index) {
    VRViewManagerOSVR vrvm = (VRViewManagerOSVR) environment.getVRViewManager();
    if (vrvm == null || isInputDeviceTracking(index) == false)
        return null;
    Object obs = environment.getObserver();
    if (obs instanceof Camera) {
        tempq.set(((Camera) obs).getRotation());
    } else {
        tempq.set(((Spatial) obs).getWorldRotation());
    }
    return tempq.multLocal(getOrientation(index));
}
Also used : VRViewManagerOSVR(com.jme3.util.VRViewManagerOSVR) Camera(com.jme3.renderer.Camera)

Aggregations

VRViewManagerOSVR (com.jme3.util.VRViewManagerOSVR)3 Camera (com.jme3.renderer.Camera)2 Vector3f (com.jme3.math.Vector3f)1 VRViewManagerOpenVR (com.jme3.util.VRViewManagerOpenVR)1