private void CorrectCameraConfiguration()
        {
            VuforiaARController.WorldCenterMode worldCenterMode = VuforiaManager.Instance.WorldCenterMode;
            Camera camera = null;

            Camera[] componentsInChildren = base.VuforiaBehaviour.GetComponentsInChildren <Camera>(true);
            int      num = 0;

            if (num < componentsInChildren.Length)
            {
                camera = componentsInChildren[num];
            }
            if (this.mEyewearType == DigitalEyewearARController.EyewearType.VideoSeeThrough && this.mStereoFramework != DigitalEyewearARController.StereoFramework.Vuforia)
            {
                if (camera != null)
                {
                    camera.gameObject.SetActive(false);
                }
                AudioListener component = base.VuforiaBehaviour.GetComponent <AudioListener>();
                if (component != null)
                {
                    component.enabled = false;
                }
                if (worldCenterMode == VuforiaARController.WorldCenterMode.CAMERA || worldCenterMode == VuforiaARController.WorldCenterMode.DEVICE_TRACKING)
                {
                    this.mParentAnchorPoint = this.mCentralAnchorPoint;
                    return;
                }
            }
            else if (this.mEyewearType == DigitalEyewearARController.EyewearType.OpticalSeeThrough && this.mSeeThroughConfiguration == DigitalEyewearARController.SeeThroughConfiguration.HoloLens)
            {
                if (camera != null)
                {
                    camera.gameObject.SetActive(false);
                }
                this.mPrimaryCamera = null;
                AudioListener component2 = base.VuforiaBehaviour.GetComponent <AudioListener>();
                if (component2 != null)
                {
                    component2.enabled = false;
                }
                this.mParentAnchorPoint = this.mCentralAnchorPoint;
                if (worldCenterMode != VuforiaARController.WorldCenterMode.CAMERA)
                {
                    VuforiaManager.Instance.WorldCenterMode = VuforiaARController.WorldCenterMode.CAMERA;
                    return;
                }
            }
            else
            {
                if (camera != null)
                {
                    camera.gameObject.SetActive(true);
                    this.mPrimaryCamera = camera;
                }
                this.mCentralAnchorPoint = base.VuforiaBehaviour.transform;
                this.mParentAnchorPoint  = base.VuforiaBehaviour.transform;
            }
        }
Пример #2
0
 public override void OnInspectorGUI()
 {
     VuforiaUtilities.DisableGuiForPrefab(base.target);
     base.DrawDefaultInspector();
     using (base.serializedObject.Edit())
     {
         bool flag = true;
         bool showCameraAnchors = true;
         bool flag2             = true;
         if (VuforiaUtilities.GetPrefabType(base.target) != PrefabType.Prefab)
         {
             flag2 = false;
             VuforiaAbstractConfiguration expr_3C = VuforiaAbstractConfigurationEditor.LoadConfigurationObject();
             VuforiaAbstractConfiguration.DigitalEyewearConfiguration digitalEyewear = expr_3C.DigitalEyewear;
             bool   arg_74_0 = digitalEyewear.EyewearType == DigitalEyewearARController.EyewearType.VideoSeeThrough && digitalEyewear.StereoFramework > DigitalEyewearARController.StereoFramework.Vuforia;
             bool   flag3    = digitalEyewear.EyewearType == DigitalEyewearARController.EyewearType.OpticalSeeThrough && digitalEyewear.SeeThroughConfiguration == DigitalEyewearARController.SeeThroughConfiguration.HoloLens;
             object expr_74  = arg_74_0;
             flag = ((arg_74_0 || flag3) != false);
             showCameraAnchors = (expr_74 != null);
             bool autoInitAndStartTracker = expr_3C.DeviceTracker.AutoInitAndStartTracker;
             int  num = 3;
             if (autoInitAndStartTracker && this.mWorldCenterMode.intValue != num)
             {
                 this.mWorldCenterMode.intValue = num;
             }
             else if (!autoInitAndStartTracker && this.mWorldCenterMode.intValue == num)
             {
                 this.mWorldCenterMode.intValue = 2;
             }
             if (flag && !this.WereBindingFieldsExposed)
             {
                 this.WereBindingFieldsExposed = true;
                 if (this.CentralAnchorPoint == null && (this.mWorldCenterMode.intValue == 1 || this.mWorldCenterMode.intValue == 0))
                 {
                     this.mWorldCenterMode.intValue = 2;
                 }
             }
             else if (!flag && this.WereBindingFieldsExposed)
             {
                 this.WereBindingFieldsExposed = false;
             }
         }
         VuforiaARController.WorldCenterMode worldCenterMode = this.DrawWorldCenterModeInspector();
         if (flag2 || worldCenterMode == VuforiaARController.WorldCenterMode.SPECIFIC_TARGET)
         {
             this.DrawWorldCenterInspector();
         }
         if (flag)
         {
             this.DrawDigitalEyewearInspector(worldCenterMode, showCameraAnchors);
         }
     }
     if (GUILayout.Button("Open Vuforia configuration", new GUILayoutOption[0]))
     {
         VuforiaAbstractConfigurationEditor.Init();
     }
 }
 public void SetWorldCenterMode(VuforiaARController.WorldCenterMode value)
 {
     if (Application.isPlaying)
     {
         VuforiaManager.Instance.WorldCenterMode = value;
         return;
     }
     this.mWorldCenterMode = value;
 }
Пример #4
0
 private void DrawDigitalEyewearInspector(VuforiaARController.WorldCenterMode worldCenterMode, bool showCameraAnchors)
 {
     EditorGUILayout.PropertyField(this.mCentralAnchorPoint, new GUIContent("Central Anchor Point"), new GUILayoutOption[0]);
     if (showCameraAnchors && worldCenterMode != VuforiaARController.WorldCenterMode.CAMERA && worldCenterMode != VuforiaARController.WorldCenterMode.DEVICE_TRACKING)
     {
         EditorGUILayout.HelpBox("Using world center mode " + worldCenterMode + " when binding to a camera controlled by another SDK is non-trivial. Please consult the developer guide for more information", MessageType.Info);
         UnityEngine.Object objectReferenceValue = this.mParentAnchorPoint.objectReferenceValue;
         EditorGUILayout.PropertyField(this.mParentAnchorPoint, new GUIContent("Parent Anchor Point"), new GUILayoutOption[0]);
         if (this.ParentAnchorPoint != objectReferenceValue && this.ParentAnchorPoint != null && this.CentralAnchorPoint != null && this.ParentAnchorPoint != this.CentralAnchorPoint && !this.CentralAnchorPoint.IsChildOf(this.ParentAnchorPoint))
         {
             EditorWindow.focusedWindow.ShowNotification(new GUIContent(this.ParentAnchorPoint.gameObject.name + " is not a parent of " + this.CentralAnchorPoint.gameObject.name + "!"));
             this.ParentAnchorPoint = this.CentralAnchorPoint;
         }
     }
     else
     {
         this.ParentAnchorPoint = this.CentralAnchorPoint;
     }
     if (showCameraAnchors)
     {
         EditorGUILayout.PropertyField(this.mPrimaryCamera, new GUIContent("Left Camera"), new GUILayoutOption[0]);
         if (this.PrimaryCamera != null && !VuforiaARController.IsValidPrimaryCamera(this.PrimaryCamera))
         {
             EditorGUILayout.HelpBox("The selected camera needs to be upgraded to be used for Augmented Reality. Please click the button below to do that.", MessageType.Warning);
             if (GUILayout.Button(new GUIContent("Add Vuforia Components", "Adds the VideoBackgroundBehaviour, HideExcessBehaviour and a background plane."), new GUILayoutOption[0]))
             {
                 this.AddPrimaryCameraComponents(this.PrimaryCamera, this.mBhvr);
             }
             EditorGUILayout.Space();
         }
         EditorGUILayout.PropertyField(this.mSecondaryCamera, new GUIContent("Right Camera"), new GUILayoutOption[0]);
         if (this.SecondaryCamera != null && !VuforiaARController.IsValidSecondaryCamera(this.SecondaryCamera))
         {
             EditorGUILayout.HelpBox("The selected camera needs to be upgraded to be used for Augmented Reality. Please click the button below to do that.", MessageType.Warning);
             if (GUILayout.Button(new GUIContent("Add Vuforia Components", "Adds the VideoBackgroundBehaviour and HideExcessBehaviour."), new GUILayoutOption[0]))
             {
                 this.AddSecondaryCameraComponents(this.SecondaryCamera, this.mBhvr);
                 return;
             }
         }
     }
     else if (PlayerSettings.defaultInterfaceOrientation != UIOrientation.LandscapeLeft)
     {
         PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft;
         Debug.Log("Setting Default Orientation to Landscape Left");
     }
 }
 protected override void Awake()
 {
     VuforiaAbstractConfiguration.GenericVuforiaConfiguration vuforia = VuforiaAbstractConfiguration.Instance.Vuforia;
     this.CameraDeviceModeSetting        = vuforia.CameraDeviceMode;
     this.MaxSimultaneousImageTargets    = vuforia.MaxSimultaneousImageTargets;
     this.MaxSimultaneousObjectTargets   = vuforia.MaxSimultaneousObjectTargets;
     this.UseDelayedLoadingObjectTargets = vuforia.UseDelayedLoadingObjectTargets;
     this.CameraDirection       = vuforia.CameraDirection;
     this.MirrorVideoBackground = vuforia.MirrorVideoBackground;
     this.mWorldCenterMode      = base.VuforiaBehaviour.WorldCenterMode;
     this.mWorldCenter          = base.VuforiaBehaviour.WorldCenter;
     this.mEyewearBehaviour     = DigitalEyewearARController.Instance;
     if (this.mEyewearBehaviour == null)
     {
         Debug.LogError("Failed to get an instance of DigitalEyewearBehaviour");
     }
     this.mVideoBackgroundMgr = VideoBackgroundManager.Instance;
     this.mVideoBackgroundMgr.Initialize();
 }