private void Start() { VuforiaARController expr_05 = VuforiaARController.Instance; expr_05.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); expr_05.RegisterOnPauseCallback(new Action <bool>(this.OnPause)); }
private void UpdateWordResultPoses(Transform arCameraTransform, IEnumerable <VuforiaManagerImpl.WordResultData> wordResults) { if (this.mVuforiaBehaviour == null) { this.mVuforiaBehaviour = VuforiaARController.Instance; } Rect videoBackgroundRectInViewPort = this.mVuforiaBehaviour.GetVideoBackgroundRectInViewPort(); bool isTextureMirrored = this.mVuforiaBehaviour.VideoBackGroundMirrored == VuforiaRenderer.VideoBackgroundReflection.ON; CameraDevice.VideoModeData videoMode = CameraDevice.Instance.GetVideoMode(); foreach (VuforiaManagerImpl.WordResultData current in wordResults) { WordResultImpl arg_A9_0 = (WordResultImpl)this.mTrackedWords[current.id]; Vector3 position = arCameraTransform.TransformPoint(current.pose.position); Quaternion orientation = current.pose.orientation; Quaternion orientation2 = arCameraTransform.rotation * orientation * Quaternion.AngleAxis(270f, Vector3.left); arg_A9_0.SetPose(position, orientation2); arg_A9_0.SetStatus(current.status); OrientedBoundingBox cameraFrameObb = new OrientedBoundingBox(current.orientedBoundingBox.center, current.orientedBoundingBox.halfExtents, current.orientedBoundingBox.rotation); arg_A9_0.SetObb(VuforiaRuntimeUtilities.CameraFrameToScreenSpaceCoordinates(cameraFrameObb, videoBackgroundRectInViewPort, isTextureMirrored, videoMode)); } if (this.mWordPrefabCreationMode == WordPrefabCreationMode.DUPLICATE) { this.UpdateWordBehaviourPoses(); } }
protected override void Awake() { VuforiaAbstractConfiguration.DigitalEyewearConfiguration digitalEyewear = VuforiaAbstractConfiguration.Instance.DigitalEyewear; this.mCameraOffset = digitalEyewear.CameraOffset; this.mDistortionRenderingMode = digitalEyewear.DistortionRenderingMode; this.mDistortionRenderingLayer = digitalEyewear.DistortionRenderingLayer; this.mEyewearType = digitalEyewear.EyewearType; this.mStereoFramework = digitalEyewear.StereoFramework; this.mSeeThroughConfiguration = digitalEyewear.SeeThroughConfiguration; this.mViewerName = digitalEyewear.ViewerName; this.mViewerManufacturer = digitalEyewear.ViewerManufacturer; this.mUseCustomViewer = digitalEyewear.UseCustomViewer; this.mCustomViewer = digitalEyewear.CustomViewer; if (this.mEyewearType == DigitalEyewearARController.EyewearType.VideoSeeThrough && this.mStereoFramework != DigitalEyewearARController.StereoFramework.Vuforia) { this.mCentralAnchorPoint = base.VuforiaBehaviour.CentralAnchorPoint; this.mParentAnchorPoint = base.VuforiaBehaviour.ParentAnchorPoint; this.mPrimaryCamera = base.VuforiaBehaviour.PrimaryCamera; this.mSecondaryCamera = base.VuforiaBehaviour.SecondaryCamera; } if (this.mEyewearType == DigitalEyewearARController.EyewearType.OpticalSeeThrough && this.mSeeThroughConfiguration == DigitalEyewearARController.SeeThroughConfiguration.HoloLens) { this.mCentralAnchorPoint = base.VuforiaBehaviour.CentralAnchorPoint; } this.mVuforiaBehaviour = VuforiaARController.Instance; this.mVuforiaBehaviour.RegisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); this.mVuforiaBehaviour.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); if (VuforiaRuntimeUtilities.IsPlayMode() && this.mEyewearType == DigitalEyewearARController.EyewearType.OpticalSeeThrough) { Device.SetPlayModeEyewearDevice(); return; } Device.UnsetDevice(); }
protected override void Start() { VuforiaARController expr_05 = VuforiaARController.Instance; expr_05.RegisterVideoBgEventHandler(this); expr_05.RegisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); }
private void Start() { this.mVideoBgMgr = VideoBackgroundManager.Instance; this.CheckForChangedClippingMode(); this.mVuforiaBehaviour = VuforiaARController.Instance; this.mVuforiaBehaviour.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); this.mVuforiaBehaviour.RegisterTrackablesUpdatedCallback(new Action(this.OnTrackablesUpdated)); }
protected override void OnDestroy() { VuforiaARController expr_05 = VuforiaARController.Instance; expr_05.UnregisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); expr_05.UnregisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); expr_05.UnregisterOnPauseCallback(new Action <bool>(this.OnPause)); }
private void Start() { this.mVuforiaBehaviour = VuforiaARController.Instance; this.mVuforiaBehaviour.RegisterVideoBgEventHandler(this); this.mVuforiaBehaviour.RegisterBackgroundTextureChangedCallback(new Action(this.OnBackgroundTextureChanged)); this.mVuforiaBehaviour.RegisterTrackablesUpdatedCallback(new Action(this.OnTrackablesUpdated)); this.mCamera = base.transform.parent.GetComponent <Camera>(); this.mStereoDepth = this.mCamera.GetMaxDepthForVideoBackground(); }
private void Awake() { this.mCamera = base.GetComponent <Camera>(); this.mVuforiaARController = VuforiaARController.Instance; if (this.mVuforiaARController != null) { this.mVuforiaARController.RegisterRenderOnUpdateCallback(new Action(this.RenderOnUpdate)); } this.mStereoDepth = this.mCamera.GetMaxDepthForVideoBackground(); this.mBackgroundBehaviour = base.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>(); }
protected override void OnDestroy() { if (VuforiaRenderer.Instance.VideoBackgroundTexture == this.mTexture) { VuforiaRenderer.Instance.SetVideoBackgroundTexture(null, 0); } VuforiaARController expr_29 = VuforiaARController.Instance; expr_29.UnregisterVideoBgEventHandler(this); expr_29.UnregisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); }
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; } }
private void OnDestroy() { VuforiaARController expr_05 = VuforiaARController.Instance; expr_05.UnregisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); expr_05.UnregisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); expr_05.UnregisterTrackablesUpdatedCallback(new Action(this.OnTrackablesUpdated)); expr_05.UnregisterOnPauseCallback(new Action <bool>(this.OnPause)); TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { tracker.WordList.UnloadAllLists(); } }
private void Awake() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return; } VuforiaARController instance = VuforiaARController.Instance; if (instance != null) { instance.RegisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); instance.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); instance.RegisterTrackablesUpdatedCallback(new Action(this.OnTrackablesUpdated)); instance.RegisterOnPauseCallback(new Action <bool>(this.OnPause)); } }
protected override void Awake() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return; } VuforiaAbstractConfiguration.SmartTerrainTrackerConfiguration smartTerrainTracker = VuforiaAbstractConfiguration.Instance.SmartTerrainTracker; this.mAutoInitTracker = smartTerrainTracker.AutoInitAndStartTracker; this.mAutoStartTracker = smartTerrainTracker.AutoInitAndStartTracker; this.mAutoInitBuilder = smartTerrainTracker.AutoInitBuilder; this.mSceneUnitsToMillimeter = smartTerrainTracker.SceneUnitsToMillimeter; VuforiaARController expr_48 = VuforiaARController.Instance; expr_48.RegisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); expr_48.RegisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); expr_48.RegisterOnPauseCallback(new Action <bool>(this.OnPause)); }
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 bool GetRegionOfInterest(out Rect detectionRegion, out Rect trackingRegion) { VuforiaARController expr_05 = VuforiaARController.Instance; Rect videoBackgroundRectInViewPort = expr_05.GetVideoBackgroundRectInViewPort(); bool isTextureMirrored = expr_05.VideoBackGroundMirrored == VuforiaRenderer.VideoBackgroundReflection.ON; CameraDevice.VideoModeData videoMode = CameraDevice.Instance.GetVideoMode(); IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RectangleIntData))); IntPtr intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RectangleIntData))); VuforiaWrapper.Instance.TextTrackerGetRegionOfInterest(intPtr, intPtr2); RectangleIntData camSpaceRectData = (RectangleIntData)Marshal.PtrToStructure(intPtr, typeof(RectangleIntData)); RectangleIntData camSpaceRectData2 = (RectangleIntData)Marshal.PtrToStructure(intPtr2, typeof(RectangleIntData)); Marshal.FreeHGlobal(intPtr); Marshal.FreeHGlobal(intPtr2); detectionRegion = this.ScreenSpaceRectFromCamSpaceRectData(camSpaceRectData, videoBackgroundRectInViewPort, isTextureMirrored, videoMode); trackingRegion = this.ScreenSpaceRectFromCamSpaceRectData(camSpaceRectData2, videoBackgroundRectInViewPort, isTextureMirrored, videoMode); return(true); }
public override bool SetRegionOfInterest(Rect detectionRegion, Rect trackingRegion) { VuforiaARController expr_05 = VuforiaARController.Instance; Rect videoBackgroundRectInViewPort = expr_05.GetVideoBackgroundRectInViewPort(); bool flag = expr_05.VideoBackGroundMirrored == VuforiaRenderer.VideoBackgroundReflection.ON; CameraDevice.VideoModeData videoMode = CameraDevice.Instance.GetVideoMode(); Vector2 screenSpaceCoordinate; Vector2 screenSpaceCoordinate2; VuforiaRuntimeUtilities.SelectRectTopLeftAndBottomRightForLandscapeLeft(detectionRegion, flag, out screenSpaceCoordinate, out screenSpaceCoordinate2); Vector2 screenSpaceCoordinate3; Vector2 screenSpaceCoordinate4; VuforiaRuntimeUtilities.SelectRectTopLeftAndBottomRightForLandscapeLeft(trackingRegion, flag, out screenSpaceCoordinate3, out screenSpaceCoordinate4); VuforiaRenderer.Vec2I vec2I = VuforiaRuntimeUtilities.ScreenSpaceToCameraFrameCoordinates(screenSpaceCoordinate, videoBackgroundRectInViewPort, flag, videoMode); VuforiaRenderer.Vec2I vec2I2 = VuforiaRuntimeUtilities.ScreenSpaceToCameraFrameCoordinates(screenSpaceCoordinate2, videoBackgroundRectInViewPort, flag, videoMode); VuforiaRenderer.Vec2I vec2I3 = VuforiaRuntimeUtilities.ScreenSpaceToCameraFrameCoordinates(screenSpaceCoordinate3, videoBackgroundRectInViewPort, flag, videoMode); VuforiaRenderer.Vec2I vec2I4 = VuforiaRuntimeUtilities.ScreenSpaceToCameraFrameCoordinates(screenSpaceCoordinate4, videoBackgroundRectInViewPort, flag, videoMode); if (VuforiaWrapper.Instance.TextTrackerSetRegionOfInterest(vec2I.x, vec2I.y, vec2I2.x, vec2I2.y, vec2I3.x, vec2I3.y, vec2I4.x, vec2I4.y, (int)this.CurrentUpDirection) == 0) { Debug.LogError(string.Format("Could not set region of interest: ({0}, {1}, {2}, {3}) - ({4}, {5}, {6}, {7})", new object[] { detectionRegion.x, detectionRegion.y, detectionRegion.width, detectionRegion.height, trackingRegion.x, trackingRegion.y, trackingRegion.width, trackingRegion.height })); return(false); } return(true); }
public static bool IsValidPrimaryCamera(Camera cam) { return(VuforiaARController.IsValidSecondaryCamera(cam) && cam.GetComponentsInChildren <BackgroundPlaneAbstractBehaviour>(true).Any <BackgroundPlaneAbstractBehaviour>()); }
private void ConfigureView() { EyewearDevice eyewearDevice = Device.Instance as EyewearDevice; bool arg_4E_0 = Device.Instance.IsViewerActive() || (eyewearDevice != null && eyewearDevice.IsDualDisplay()); bool flag = this.mCentralAnchorPoint != base.VuforiaBehaviour.transform && this.mCentralAnchorPoint != null; if (!arg_4E_0) { if (this.mSecondaryCamera && this.mSecondaryCamera.enabled) { this.mPrimaryCameraOriginalRect = new Rect(this.mPrimaryCamera.rect); this.mSecondaryCameraOriginalRect = new Rect(this.mSecondaryCamera.rect); this.mSecondaryCamera.enabled = false; this.mSecondaryCameraDisabledLocally = true; this.DisableDistortionRendering(); Rect rect = new Rect(0f, 0f, 1f, 1f); this.mPrimaryCamera.rect = rect; this.mPrimaryCamera.fieldOfView = 60f; } } else { if (this.mSecondaryCamera && !this.mSecondaryCamera.enabled) { if (!flag) { this.mSecondaryCamera.enabled = true; } if (this.mSecondaryCameraDisabledLocally) { this.mSecondaryCameraDisabledLocally = false; this.mPrimaryCamera.rect = this.mPrimaryCameraOriginalRect; this.mSecondaryCamera.rect = this.mSecondaryCameraOriginalRect; } } if (!flag && this.mSecondaryCamera == null) { this.mPrimaryCamera.name = "StereoCameraLeft"; this.mPrimaryCamera.rect = new Rect(0f, 0f, 0.5f, 1f); this.mSecondaryCamera = UnityEngine.Object.Instantiate <Camera>(this.mPrimaryCamera); this.mSecondaryCamera.transform.parent = this.mPrimaryCamera.transform.parent; this.mSecondaryCamera.transform.localPosition = this.mPrimaryCamera.transform.localPosition; this.mSecondaryCamera.transform.localRotation = this.mPrimaryCamera.transform.localRotation; this.mSecondaryCamera.transform.localScale = this.mPrimaryCamera.transform.localScale; this.mSecondaryCamera.name = "StereoCameraRight"; this.mSecondaryCamera.rect = new Rect(0.5f, 0f, 0.5f, 1f); BackgroundPlaneAbstractBehaviour componentInChildren = this.mSecondaryCamera.GetComponentInChildren <BackgroundPlaneAbstractBehaviour>(); if (componentInChildren != null) { UnityEngine.Object.Destroy(componentInChildren.gameObject); } VideoBackgroundAbstractBehaviour component = this.mSecondaryCamera.GetComponent <VideoBackgroundAbstractBehaviour>(); if (component != null) { component.DisconnectFromBackgroundBehaviour(); } } } if (this.mPrimaryCamera && VuforiaARController.IsValidPrimaryCamera(this.mPrimaryCamera)) { this.mPrimaryCamera.transform.localRotation = Quaternion.identity; this.mPrimaryCamera.transform.localScale = Vector3.one; if (this.mSecondaryCamera && (flag || this.mSecondaryCamera.enabled) && VuforiaARController.IsValidSecondaryCamera(this.mSecondaryCamera)) { this.mSecondaryCamera.transform.localRotation = Quaternion.identity; this.mSecondaryCamera.transform.localScale = Vector3.one; if (flag) { this.CameraConfiguration = new ExternalStereoCameraConfiguration(this.mPrimaryCamera, this.mSecondaryCamera); Debug.Log("Creating an External Stereo Camera Configuration (Check for reflection)"); } else if (eyewearDevice != null) { this.CameraConfiguration = new DedicatedEyewearCameraConfiguration(this.mPrimaryCamera, this.mSecondaryCamera); Debug.Log("Creating a Dedicated Eyewear Camera Configuration (Check for reflection)"); } else { this.CameraConfiguration = new StereoViewerCameraConfiguration(this.mPrimaryCamera, this.mSecondaryCamera, this.mCameraOffset, this.mDistortionRenderingMode > DistortionRenderingMode.None); Debug.Log("Creating a Stereo Viewer Camera Configuration (Check for reflection)"); this.EnableDistortionRendering(); } } else { this.CameraConfiguration = new MonoCameraConfiguration(this.mPrimaryCamera); Debug.Log("Creating a Mono Camera Configuration (Check for reflection)"); } } else { this.CameraConfiguration = new NullCameraConfiguration(); Debug.Log("Creating a Null Camera Configuration (Check for reflection)"); } this.mVuforiaBehaviour.InitCameraConfiguration(); this.CameraConfiguration.Init(); if (this.mPrimaryCamera != null) { HideExcessAreaAbstractBehaviour component2 = this.mPrimaryCamera.GetComponent <HideExcessAreaAbstractBehaviour>(); if (component2) { component2.OnConfigurationChanged(); } } if (this.mSecondaryCamera != null) { HideExcessAreaAbstractBehaviour component3 = this.mSecondaryCamera.GetComponent <HideExcessAreaAbstractBehaviour>(); if (component3) { component3.OnConfigurationChanged(); } } }