Exemplo n.º 1
0
        public override void UpdateScreenData()
        {
            // configData is 0.062000,0.037250,0.039000,40.000000,40.000000,43.299999,43.299999,0.127560,0.084400,2560.000000,1440.000000,0.003000,0.120960,0.068040
            string deviceConfigInfo = "ar device config parameter : ";

            if (deviceConfigData != null)
            {
                for (int i = 0; i < deviceConfigData.Length; i++)
                {
                    deviceConfigInfo += deviceConfigData[i];
                    if (i < deviceConfigData.Length - 1)
                    {
                        deviceConfigInfo += ",";
                    }
                }
                Debug.Log(deviceConfigInfo);
            }

            Profile = NxrProfile.GetKnownProfile(NxrViewer.Instance.ScreenSize, NxrViewer.Instance.ViewerType);
            if (loadConfigData && deviceConfigData != null)
            {
                Profile.screen.width  = deviceConfigData[12];
                Profile.screen.height = deviceConfigData[13];
                Profile.viewer        = new NxrProfile.Viewer
                {
                    lenses =
                    {
                        separation     = deviceConfigData[0],
                        offset         = deviceConfigData[1],
                        screenDistance = deviceConfigData[2],
                        alignment      = NxrProfile.Lenses.AlignBottom,
                    },
                    maxFOV =
                    {
                        outer = deviceConfigData[3],
                        inner = deviceConfigData[4],
                        upper = deviceConfigData[5],
                        lower = deviceConfigData[6]
                    },
                    distortion =
                    {
                        Coef = new [] { deviceConfigData[7], deviceConfigData[8] },
                    },
                    inverse = NxrProfile.ApproximateInverse(new[] { deviceConfigData[7], deviceConfigData[8] })
                };
            }

            if (userIpd > 0)
            {
                Profile.viewer.lenses.separation = userIpd;
            }

            ComputeEyesFromProfile(1, 2000);
            profileChanged = true;
            Debug.Log("UpdateScreenData=" + Profile.viewer.lenses.separation);
        }
Exemplo n.º 2
0
        private void UpdateProfile()
        {
            if (NxrViewer.USE_DTR)
            {
                _NVR_GetNVRConfig(profileData);
            }

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

            if (profileData[14] > 0)
            {
                NxrGlobal.fovFar = profileData[14] > NxrGlobal.fovFar ? profileData[14] : NxrGlobal.fovFar;
            }


            if (NxrViewer.USE_DTR && !NxrGlobal.supportDtr && NxrGlobal.dftProfileParams[0] != 0)
            {
                // DFT模式加载cardboard参数 0.062_0.03725_0.06_40.0_40.0_43.3_43.3_0.11825_0.39027_1920.0_1080.0_0.003_0.126_0.0625_-1
                // fov
                profileData[0] = NxrGlobal.dftProfileParams[3];  //45;
                profileData[1] = NxrGlobal.dftProfileParams[4];  //45;
                profileData[2] = NxrGlobal.dftProfileParams[5];  //51.5f;
                profileData[3] = NxrGlobal.dftProfileParams[6];  //51.5f;
                // screen size
                profileData[4] = NxrGlobal.dftProfileParams[12]; //0.110f;
                profileData[5] = NxrGlobal.dftProfileParams[13]; //0.062f;
                // ipd
                profileData[7] = NxrGlobal.dftProfileParams[0];  //0.063f;
                // screen to lens
                profileData[9] = NxrGlobal.dftProfileParams[2];  //0.035f;
                // k1 k2
                profileData[11] = NxrGlobal.dftProfileParams[7]; //0.252f;
                profileData[12] = NxrGlobal.dftProfileParams[8]; //0.019f;
                if (NxrGlobal.offaxisDistortionEnabled)
                {
                    // profileData[7] = 0.058f;
                }
            }

            NxrProfile.Viewer device = new NxrProfile.Viewer();
            NxrProfile.Screen screen = new NxrProfile.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 = NxrProfile.GetMaxRadius(rect);

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