예제 #1
0
        /// <summary>
        /// Updates the state of the device.
        /// </summary>
        public override void DpnpUpdate()
        {
            base.DpnpUpdate();
            double displayTime = Composer.DpnuGetPredictedDisplayTime(DpnManager.minimumVsync);

            pose = Composer.DpnuGetPredictedPose(displayTime); // 右手螺旋, 左手系, room坐标系 或者 惯性系
            if (DpnManager.peripheral == DPVRPeripheral.Polaris)
            {
                float[] temp_position = DpnpGetDeviceCurrentStatus().position_state[0];
                position   = new dpnVector3(temp_position[0], temp_position[1], temp_position[2]);
                position.z = -position.z;
            }
#if UNITY_ANDROID && !UNITY_EDITOR
            else if (DpnManager.peripheral == DPVRPeripheral.Nolo && NoloController._instance[(int)NoloController.NoloDevice.Nolo_Hmd] != null)
            {
                Vector3 temp_position = NoloController._instance[(int)NoloController.NoloDevice.Nolo_Hmd].transform.localPosition;
                position = new dpnVector3(temp_position.x, temp_position.y, temp_position.z);
            }
#endif
            else
            {
                position   = Composer.DpnuGetPredictedPosition(displayTime);
                position.z = -position.z;
            }


            position.x = position.x * DpnManager.worldScale;
            position.y = position.y * DpnManager.worldScale;
            position.z = position.z * DpnManager.worldScale;

            Pose posel = _sensor.GetEyePose(dpncEYE.LEFT, pose, position
                                            , DpnManager.DeviceInfo.ipd);
            Pose poser = _sensor.GetEyePose(dpncEYE.RIGHT, pose, position
                                            , DpnManager.DeviceInfo.ipd);

            //After GetEyePose: dpnQuarterion.ToQuaternion, 变成左手螺旋, 左手系, room坐标系 或者 惯性系

            //update eye's render target and transform
            _Update(posel, poser
                    , _monoscopic, _freezed);

            //Unity 使用的是左手螺旋,左手系

            UpdatePeripheral();
        }