Search in sources :

Example 1 with VRTextureBounds_t

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

the class VRViewManagerOpenVR method initTextureSubmitStructs.

/**
     * Initialize the system binds of the textures.
     */
private void initTextureSubmitStructs() {
    leftTextureType = new Texture_t();
    rightTextureType = new Texture_t();
    if (environment != null) {
        if (environment.getVRHardware() instanceof OpenVR) {
            leftTextureBounds = new VRTextureBounds_t();
            rightTextureBounds = new VRTextureBounds_t();
            // left eye
            leftTextureBounds.uMax = 0.5f;
            leftTextureBounds.uMin = 0f;
            leftTextureBounds.vMax = 1f;
            leftTextureBounds.vMin = 0f;
            leftTextureBounds.setAutoSynch(false);
            leftTextureBounds.setAutoRead(false);
            leftTextureBounds.setAutoWrite(false);
            leftTextureBounds.write();
            // right eye
            rightTextureBounds.uMax = 1f;
            rightTextureBounds.uMin = 0.5f;
            rightTextureBounds.vMax = 1f;
            rightTextureBounds.vMin = 0f;
            rightTextureBounds.setAutoSynch(false);
            rightTextureBounds.setAutoRead(false);
            rightTextureBounds.setAutoWrite(false);
            rightTextureBounds.write();
            // texture type
            leftTextureType.eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma;
            leftTextureType.eType = JOpenVRLibrary.ETextureType.ETextureType_TextureType_OpenGL;
            leftTextureType.setAutoSynch(false);
            leftTextureType.setAutoRead(false);
            leftTextureType.setAutoWrite(false);
            leftTextureType.handle = -1;
            rightTextureType.eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma;
            rightTextureType.eType = JOpenVRLibrary.ETextureType.ETextureType_TextureType_OpenGL;
            rightTextureType.setAutoSynch(false);
            rightTextureType.setAutoRead(false);
            rightTextureType.setAutoWrite(false);
            rightTextureType.handle = -1;
            logger.config("Init eyes native texture binds");
            logger.config("  Left eye texture");
            logger.config("           address: " + leftTextureType.getPointer());
            logger.config("              size: " + leftTextureType.size() + " bytes");
            logger.config("       color space: " + OpenVRUtil.getEColorSpaceString(leftTextureType.eColorSpace));
            logger.config("              type: " + OpenVRUtil.getETextureTypeString(leftTextureType.eType));
            logger.config("         auto read: " + leftTextureType.getAutoRead());
            logger.config("        auto write: " + leftTextureType.getAutoWrite());
            logger.config("    handle address: " + leftTextureType.handle);
            logger.config("      handle value: " + leftTextureType.handle);
            logger.config("");
            logger.config("  Right eye texture");
            logger.config("           address: " + rightTextureType.getPointer());
            logger.config("              size: " + rightTextureType.size() + " bytes");
            logger.config("       color space: " + OpenVRUtil.getEColorSpaceString(rightTextureType.eColorSpace));
            logger.config("              type: " + OpenVRUtil.getETextureTypeString(rightTextureType.eType));
            logger.config("         auto read: " + rightTextureType.getAutoRead());
            logger.config("        auto write: " + rightTextureType.getAutoWrite());
            logger.config("    handle address: " + rightTextureType.handle);
            logger.config("      handle value: " + rightTextureType.handle);
        }
    } else {
        throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
    }
}
Also used : VRTextureBounds_t(com.jme3.system.jopenvr.VRTextureBounds_t) OpenVR(com.jme3.input.vr.OpenVR) Texture_t(com.jme3.system.jopenvr.Texture_t)

Aggregations

OpenVR (com.jme3.input.vr.OpenVR)1 Texture_t (com.jme3.system.jopenvr.Texture_t)1 VRTextureBounds_t (com.jme3.system.jopenvr.VRTextureBounds_t)1