我正在尝试使用 rajawali + vr(Cardboard 工具包)创建 360 度图像查看器。 当我在 CardboardView 上禁用 VR 模式时,我对渲染器中的 Field of View 属性所做的更改无效。 在 Google Cardboard 中 docs我发现 View 会忽略它
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
我的问题是我该怎么做? 我应该在哪里实现它,渲染器和 CardboardView 都没有设置 perspectiveMatrix (float[]) 的方法?
最佳答案
更新设备参数似乎总是被 gvr View 覆盖
但是如果你反编译 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);
}
}
关于android - 带有 rajawali + VR 的 360 度全景查看器如何更改视野,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38661630/