简体   繁体   English

360全景查看器与rajawali + VR如何改变FieldOfView

[英]360 panorama viewer with rajawali + VR howto change FieldOfView

I am trying to create a 360 image viewer using rajawali + vr (Cardboard toolkit). 我正在尝试使用rajawali + vr(Cardboard toolkit)创建360图像查看器。 When i disable the VR-Mode on the CardboardView the changes i made on Field of View property in the renderer has no effect. 当我在CardboardView上禁用VR模式时,我在渲染器中对Field of View属性所做的更改无效。 in the Google Cardboard docs i found the the view will ignore it 在Google Cardboard 文档中,我发现该视图将忽略它

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 对于单眼渲染,实现者应该随意忽略FieldOfView,而是创建一个透视矩阵,其中单眼渲染需要任何视野。

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[])? 我应该在哪里实现它,渲染器和CardboardView都没有设置perspectiveMatrix(float [])的方法?

updating the device param seems to always get overwritten by the gvr view 更新设备参数似乎总是被gvr视图覆盖

but if you decompile the FieldOfView class, you get this: 但如果你反编译FieldOfView类,你得到这个:

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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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