简体   繁体   中英

360 panorama viewer with rajawali + VR howto change FieldOfView

I am trying to create a 360 image viewer using rajawali + vr (Cardboard toolkit). When i disable the VR-Mode on the CardboardView the changes i made on Field of View property in the renderer has no effect. in the Google Cardboard docs i found the the view will ignore it

For monocular rendering, the implementor should feel free to ignore the FieldOfView and instead create a perspective matrix with whatever field of view is desired for monocular rendering

My Question is how can i do this? and where should i implement it, neither the renderer nor the CardboardView has a method to set an perspectiveMatrix (float[])?

updating the device param seems to always get overwritten by the gvr view

but if you decompile the FieldOfView class, you get this:

public void toPerspectiveMatrix(float near, float far, float[] perspective, int offset) {
    if(offset + 16 > perspective.length) {
        throw new IllegalArgumentException("Not enough space to write the result");
    } else {
        float l = (float)(-Math.tan(Math.toRadians((double)this.left))) * near;
        float r = (float)Math.tan(Math.toRadians((double)this.right)) * near;
        float b = (float)(-Math.tan(Math.toRadians((double)this.bottom))) * near;
        float t = (float)Math.tan(Math.toRadians((double)this.top)) * near;
        Matrix.frustumM(perspective, offset, l, r, b, t, near, far);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM