android - 带有 rajawali + VR 的 360 度全景查看器如何更改视野

标签 android google-cardboard rajawali rajawalivr

我正在尝试使用 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/

相关文章:

java - 在 CardboardView 上显示的 YUV 视频

ios - 相机卡在 Google Cardboard + Unity 应用程序中重新加载

android - rajawali 和 md2 动画文件

android - 使用 min3d/Rajawali 框架(android)在触摸时围绕 3d 对象旋转

安卓错误 : addConnectionCallbacks not applicable for arguments

java - RecyclerView LinearLayout 始终出现在其他元素之上

android - 对 PixelFormat 感到困惑

android - 如何锁定安卓屏幕方向

android - [android 并排相机

android - Rajawali 中具有可编程颜色的纹理