예제 #1
0
        public override void SetModelCorrectionModeWithTransform(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode, Vector3 transform)
        {
            transform.z *= -1f;
            IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector3)));

            Marshal.StructureToPtr(transform, intPtr, false);
            VuforiaWrapper.Instance.RotationalDeviceTracker_SetModelCorrectionModeWithTransform((int)mode, intPtr);
            Marshal.FreeHGlobal(intPtr);
        }
 public override void SetModelCorrectionMode(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode)
 {
     this.mModelCorrection = mode;
     if (mode == RotationalDeviceTracker.MODEL_CORRECTION_MODE.HEAD)
     {
         this.mModelCorrectionTransform = DeviceTrackerARController.DEFAULT_HEAD_PIVOT;
         return;
     }
     if (mode == RotationalDeviceTracker.MODEL_CORRECTION_MODE.HANDHELD)
     {
         this.mModelCorrectionTransform = DeviceTrackerARController.DEFAULT_HANDHELD_PIVOT;
     }
 }
예제 #3
0
        private void StartDeviceTracker(bool videoBackground, RotationalDeviceTracker.MODEL_CORRECTION_MODE mode)
        {
            RotationalDeviceTracker rotationalDeviceTracker = TrackerManager.Instance.GetTracker <RotationalDeviceTracker>();

            if (this.mStereoFramework != DigitalEyewearARController.StereoFramework.Vuforia)
            {
                if (rotationalDeviceTracker != null && rotationalDeviceTracker.IsActive)
                {
                    rotationalDeviceTracker.Stop();
                    return;
                }
            }
            else
            {
                CameraDevice.CameraDirection  cameraDirection;
                CameraDevice.CameraDeviceMode mode2;
                if (rotationalDeviceTracker == null && CameraDevice.Instance.GetSelectedCameraDirection(out cameraDirection) && CameraDevice.Instance.GetSelectedVideoMode(out mode2))
                {
                    bool expr_54 = CameraDevice.Instance.IsActive();
                    if (expr_54)
                    {
                        CameraDevice.Instance.Stop();
                    }
                    CameraDevice.Instance.Deinit();
                    rotationalDeviceTracker = TrackerManager.Instance.InitTracker <RotationalDeviceTracker>();
                    CameraDevice.Instance.Init(cameraDirection);
                    CameraDevice.Instance.SelectVideoMode(mode2);
                    if (expr_54)
                    {
                        CameraDevice.Instance.Start();
                    }
                }
                if (rotationalDeviceTracker != null)
                {
                    rotationalDeviceTracker.SetPosePrediction(!videoBackground);
                    rotationalDeviceTracker.SetModelCorrectionMode(mode);
                    if (!rotationalDeviceTracker.IsActive)
                    {
                        rotationalDeviceTracker.Start();
                    }
                }
            }
        }
예제 #4
0
        protected override void Awake()
        {
            if (!VuforiaRuntimeUtilities.IsVuforiaEnabled())
            {
                return;
            }
            VuforiaAbstractConfiguration.DeviceTrackerConfiguration deviceTracker = VuforiaAbstractConfiguration.Instance.DeviceTracker;
            this.mAutoInitTracker       = deviceTracker.AutoInitAndStartTracker;
            this.mAutoStartTracker      = deviceTracker.AutoInitAndStartTracker;
            this.mPosePrediction        = deviceTracker.PosePrediction;
            this.mModelCorrectionMode   = deviceTracker.ModelCorrectionMode;
            this.mModelTransformEnabled = deviceTracker.ModelTransformEnabled;
            this.mModelTransform        = deviceTracker.ModelTransform;
            VuforiaARController expr_60 = VuforiaARController.Instance;

            expr_60.RegisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized));
            expr_60.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted));
            expr_60.RegisterOnPauseCallback(new Action <bool>(this.OnPause));
        }
        public override void DrawInspectorGUI()
        {
            bool boolValue = this.mAutoInitTracker.boolValue;

            EditorGUILayout.PropertyField(this.mAutoInitTracker, new GUIContent("Enable device pose tracking"), new GUILayoutOption[0]);
            if (this.mAutoInitTracker.boolValue != boolValue)
            {
                boolValue = this.mAutoInitTracker.boolValue;
                this.mAutoStartTracker.boolValue = boolValue;
            }
            if (boolValue)
            {
                EditorGUILayout.PropertyField(this.mPosePrediction, new GUIContent("Enable prediction"), new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.mModelCorrectionMode, new GUIContent("Model Correction Mode"), new GUILayoutOption[0]);
                RotationalDeviceTracker.MODEL_CORRECTION_MODE enumValueIndex = (RotationalDeviceTracker.MODEL_CORRECTION_MODE) this.mModelCorrectionMode.enumValueIndex;
                if (enumValueIndex != RotationalDeviceTracker.MODEL_CORRECTION_MODE.NONE)
                {
                    EditorGUILayout.PropertyField(this.mModelTransformEnabled, new GUIContent("Custom model transform"), new GUILayoutOption[0]);
                    if (this.mModelTransformEnabled.boolValue)
                    {
                        this.mModelTransform.vector3Value = EditorGUILayout.Vector3Field("Pivot point", this.mModelTransform.vector3Value, new GUILayoutOption[0]);
                        if (GUILayout.Button(new GUIContent("Set default pivot point", "Reset pivot point to default value of this model correction mode"), new GUILayoutOption[0]))
                        {
                            if (enumValueIndex == RotationalDeviceTracker.MODEL_CORRECTION_MODE.HEAD)
                            {
                                this.mModelTransform.vector3Value = DeviceTrackerARController.DEFAULT_HEAD_PIVOT;
                                return;
                            }
                            if (enumValueIndex != RotationalDeviceTracker.MODEL_CORRECTION_MODE.HANDHELD)
                            {
                                return;
                            }
                            this.mModelTransform.vector3Value = DeviceTrackerARController.DEFAULT_HANDHELD_PIVOT;
                        }
                    }
                }
            }
        }
 public override void SetModelCorrectionModeWithTransform(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode, Vector3 transform)
 {
     this.mModelCorrection          = mode;
     this.mModelCorrectionTransform = transform;
 }
예제 #7
0
 public abstract void SetModelCorrectionModeWithTransform(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode, Vector3 transform);
예제 #8
0
 public abstract void SetModelCorrectionMode(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode);
예제 #9
0
 public override void SetModelCorrectionMode(RotationalDeviceTracker.MODEL_CORRECTION_MODE mode)
 {
     VuforiaWrapper.Instance.RotationalDeviceTracker_SetModelCorrectionMode((int)mode);
 }