Example #1
0
        private void UpdateProfile()
        {
            if (NvrViewer.USE_DTR)
            {
                _NVR_GetNVRConfig(profileData);
            }

            if (profileData[13] > 0)
            {
                NvrGlobal.fovNear = profileData[13];
            }

            if (profileData[14] > 0)
            {
                NvrGlobal.fovFar = profileData[14];
            }


            if (NvrViewer.USE_DTR && !NvrGlobal.supportDtr && NvrGlobal.dftProfileParams[0] != 0)
            {
                // DFT模式加载cardboard参数
                // fov
                profileData[0] = NvrGlobal.dftProfileParams[3];  //45;
                profileData[1] = NvrGlobal.dftProfileParams[4];  //45;
                profileData[2] = NvrGlobal.dftProfileParams[5];  //51.5f;
                profileData[3] = NvrGlobal.dftProfileParams[6];  //51.5f;
                // screen size
                profileData[4] = NvrGlobal.dftProfileParams[12]; //0.110f;
                profileData[5] = NvrGlobal.dftProfileParams[13]; //0.062f;
                // ipd
                profileData[7] = NvrGlobal.dftProfileParams[0];  //0.063f;
                // screen to lens
                profileData[9] = NvrGlobal.dftProfileParams[2];  //0.035f;
                // k1 k2
                profileData[11] = NvrGlobal.dftProfileParams[7]; //0.252f;
                profileData[12] = NvrGlobal.dftProfileParams[8]; //0.019f;
            }

            NvrProfile.Viewer device = new NvrProfile.Viewer();
            NvrProfile.Screen screen = new NvrProfile.Screen();
            // left top right bottom
            device.maxFOV.outer          = profileData[0];
            device.maxFOV.upper          = profileData[2];
            device.maxFOV.inner          = profileData[1];
            device.maxFOV.lower          = profileData[3];
            screen.width                 = profileData[4];
            screen.height                = profileData[5];
            screen.border                = profileData[6];
            device.lenses.separation     = profileData[7];
            device.lenses.offset         = profileData[8];
            device.lenses.screenDistance = profileData[9];
            device.lenses.alignment      = (int)profileData[10];
            device.distortion.Coef       = new[] { profileData[11], profileData[12] };
            Profile.screen               = screen;
            Profile.viewer               = device;

            float[] rect = new float[4];
            Profile.GetLeftEyeNoLensTanAngles(rect);
            float maxRadius = NvrProfile.GetMaxRadius(rect);

            Profile.viewer.inverse = NvrProfile.ApproximateInverse(
                Profile.viewer.distortion, maxRadius);
        }