Search in sources :

Example 1 with VR_IVRChaperone_FnTable

use of com.jme3.system.jopenvr.VR_IVRChaperone_FnTable in project jmonkeyengine by jMonkeyEngine.

the class VRBounds method init.

/**
     * Initialize the VR bounds.
     * @return <code>true</code> if the initialization is a success and <code>false</code> otherwise.
     */
public static boolean init() {
    logger.config("Initialize VR bounds...");
    if (vrChaperone == null) {
        vrChaperone = new VR_IVRChaperone_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRChaperone_Version, OpenVR.hmdErrorStore).getPointer());
        if (vrChaperone != null) {
            vrChaperone.setAutoSynch(false);
            vrChaperone.read();
            FloatByReference fbX = new FloatByReference();
            FloatByReference fbZ = new FloatByReference();
            vrChaperone.GetPlayAreaSize.apply(fbX, fbZ);
            playSize = new Vector2f(fbX.getValue(), fbZ.getValue());
            logger.config("Initialize VR bounds [SUCCESS]");
            // init success
            return true;
        }
        logger.warning("Initialize VR bounds [FAILED].");
        // failed to init
        return false;
    }
    logger.config("Initialize VR bounds already done.");
    // already initialized
    return true;
}
Also used : FloatByReference(com.sun.jna.ptr.FloatByReference) Vector2f(com.jme3.math.Vector2f) VR_IVRChaperone_FnTable(com.jme3.system.jopenvr.VR_IVRChaperone_FnTable)

Aggregations

Vector2f (com.jme3.math.Vector2f)1 VR_IVRChaperone_FnTable (com.jme3.system.jopenvr.VR_IVRChaperone_FnTable)1 FloatByReference (com.sun.jna.ptr.FloatByReference)1