public void Start()
        {
            DigitalEyewearARController instance = DigitalEyewearARController.Instance;

            if (instance != null)
            {
                this.mCamera = this.mGameObject.GetComponent <Camera>();
                BackgroundPlaneAbstractBehaviour componentInChildren = instance.CentralAnchorPoint.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>();
                if (componentInChildren != null)
                {
                    this.mBgPlane = componentInChildren.gameObject;
                }
                else
                {
                    componentInChildren = instance.CentralAnchorPoint.transform.parent.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>();
                    if (componentInChildren != null)
                    {
                        this.mBgPlane = componentInChildren.gameObject;
                    }
                }
                if (this.mBgPlane != null)
                {
                    this.mHideBehaviours            = UnityEngine.Object.FindObjectsOfType <HideExcessAreaAbstractBehaviour>();
                    this.mDeactivatedHideBehaviours = new List <HideExcessAreaAbstractBehaviour>();
                    this.mLeftPlane   = this.CreateQuad(this.mGameObject, "LeftPlane", Vector3.zero, Quaternion.identity, Vector3.one, this.mBgPlane.layer);
                    this.mRightPlane  = this.CreateQuad(this.mGameObject, "RightPlane", Vector3.zero, Quaternion.identity, Vector3.one, this.mBgPlane.layer);
                    this.mTopPlane    = this.CreateQuad(this.mGameObject, "TopPlane", Vector3.zero, Quaternion.identity, Vector3.one, this.mBgPlane.layer);
                    this.mBottomPlane = this.CreateQuad(this.mGameObject, "BottomPlane", Vector3.zero, Quaternion.identity, Vector3.one, this.mBgPlane.layer);
                    this.SetPlanesRenderingActive(false);
                }
            }
        }
        public void Start()
        {
            DigitalEyewearARController instance = DigitalEyewearARController.Instance;

            if (instance != null)
            {
                this.mCamera = this.mGameObject.GetComponent <Camera>();
                BackgroundPlaneAbstractBehaviour componentInChildren = instance.CentralAnchorPoint.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>();
                if (componentInChildren != null)
                {
                    this.mBgPlane = componentInChildren.gameObject;
                }
                else
                {
                    componentInChildren = instance.CentralAnchorPoint.transform.parent.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>();
                    if (componentInChildren != null)
                    {
                        this.mBgPlane = componentInChildren.gameObject;
                    }
                }
                if (this.mBgPlane != null)
                {
                    this.mClippingPlane = this.CreateQuad(this.mGameObject, "ClippingPlane", Vector3.zero, Quaternion.identity, Vector3.one, this.mBgPlane.layer);
                }
            }
        }
Пример #3
0
 private void ResolveMembers()
 {
     if (this.mVuforiaBehaviour == null)
     {
         this.mVuforiaBehaviour = VuforiaARController.Instance;
     }
     if (this.mDigitalEyewearBehaviour == null)
     {
         this.mDigitalEyewearBehaviour = DigitalEyewearARController.Instance;
     }
     if (this.mDigitalEyewearBehaviour.GetEyewearType() == DigitalEyewearARController.EyewearType.VideoSeeThrough)
     {
         if (!this.mFrameWorkHasBeenSetExternally)
         {
             this.mStereoFramework = this.mDigitalEyewearBehaviour.GetStereoCameraConfig();
             if (!this.mViewerHasBeenSetExternally)
             {
                 this.mViewerParameters = Device.Instance.GetSelectedViewer();
             }
             if (this.mStereoFramework != DigitalEyewearARController.StereoFramework.Vuforia)
             {
                 this.mCentralAnchorPoint       = this.mDigitalEyewearBehaviour.CentralAnchorPoint;
                 this.mLeftCameraOfExternalSDK  = this.mDigitalEyewearBehaviour.PrimaryCamera;
                 this.mRightCameraOfExternalSDK = this.mDigitalEyewearBehaviour.SecondaryCamera;
             }
         }
     }
     else if (!this.mFrameWorkHasBeenSetExternally)
     {
         this.mStereoFramework = DigitalEyewearARController.StereoFramework.Vuforia;
         this.mDigitalEyewearBehaviour.SetCameraOffset(0.06f);
         this.mDigitalEyewearBehaviour.SetDistortionRendering(DistortionRenderingMode.SingleTexture);
         if (!this.mViewerHasBeenSetExternally)
         {
             this.mViewerParameters = null;
         }
     }
     if (this.mViewerParameters == null)
     {
         IViewerParametersList viewerList = Device.Instance.GetViewerList();
         if (viewerList != null)
         {
             this.mViewerParameters = viewerList.Get(0);
         }
     }
     if (this.mVideoBackgroundManager == null)
     {
         this.mVideoBackgroundManager = VideoBackgroundManager.Instance;
     }
 }
 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();
 }
Пример #5
0
        private void UpdateVideoBackgroundEnabled()
        {
            DigitalEyewearARController instance = DigitalEyewearARController.Instance;
            Camera            primaryCamera     = instance.PrimaryCamera;
            Camera            secondaryCamera   = instance.SecondaryCamera;
            GameObject        gameObject        = UnityEngine.Object.FindObjectOfType <VuforiaAbstractBehaviour>().gameObject;
            List <GameObject> list = new List <GameObject>
            {
                gameObject
            };

            if (primaryCamera != null)
            {
                list.Add(primaryCamera.gameObject);
            }
            if (secondaryCamera != null)
            {
                list.Add(secondaryCamera.gameObject);
            }
            HashSet <VideoBackgroundAbstractBehaviour> hashSet = new HashSet <VideoBackgroundAbstractBehaviour>();

            using (List <GameObject> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    VideoBackgroundAbstractBehaviour[] componentsInChildren = enumerator.Current.GetComponentsInChildren <VideoBackgroundAbstractBehaviour>(true);
                    for (int i = 0; i < componentsInChildren.Length; i++)
                    {
                        VideoBackgroundAbstractBehaviour item = componentsInChildren[i];
                        hashSet.Add(item);
                    }
                }
            }
            using (HashSet <VideoBackgroundAbstractBehaviour> .Enumerator enumerator2 = hashSet.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    enumerator2.Current.enabled = this.mVideoBackgroundEnabled;
                }
            }
            HashSet <BackgroundPlaneAbstractBehaviour> hashSet2 = new HashSet <BackgroundPlaneAbstractBehaviour>();

            using (List <GameObject> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BackgroundPlaneAbstractBehaviour[] componentsInChildren2 = enumerator.Current.GetComponentsInChildren <BackgroundPlaneAbstractBehaviour>(true);
                    for (int i = 0; i < componentsInChildren2.Length; i++)
                    {
                        BackgroundPlaneAbstractBehaviour item2 = componentsInChildren2[i];
                        hashSet2.Add(item2);
                    }
                }
            }
            using (HashSet <BackgroundPlaneAbstractBehaviour> .Enumerator enumerator3 = hashSet2.GetEnumerator())
            {
                while (enumerator3.MoveNext())
                {
                    enumerator3.Current.GetComponent <Renderer>().GetComponent <Renderer>().enabled = this.mVideoBackgroundEnabled;
                }
            }
            HashSet <HideExcessAreaAbstractBehaviour> hashSet3 = new HashSet <HideExcessAreaAbstractBehaviour>();

            using (List <GameObject> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    HideExcessAreaAbstractBehaviour[] componentsInChildren3 = enumerator.Current.GetComponentsInChildren <HideExcessAreaAbstractBehaviour>(true);
                    for (int i = 0; i < componentsInChildren3.Length; i++)
                    {
                        HideExcessAreaAbstractBehaviour item3 = componentsInChildren3[i];
                        hashSet3.Add(item3);
                    }
                }
            }
            using (HashSet <HideExcessAreaAbstractBehaviour> .Enumerator enumerator4 = hashSet3.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    enumerator4.Current.enabled = this.mVideoBackgroundEnabled;
                }
            }
            instance.SetMode(this.mVideoBackgroundEnabled ? Device.Mode.MODE_AR : Device.Mode.MODE_VR);
            VuforiaARController.Instance.CameraConfiguration.SetSkewFrustum(this.mVideoBackgroundEnabled);
        }