public virtual void ConfigureVideoBackground() { Device.Instance.DeleteRenderingPrimitives(); VuforiaRenderer.VideoBGCfgData videoBackgroundConfig = VuforiaRenderer.Instance.GetVideoBackgroundConfig(); CameraDevice.VideoModeData videoMode = CameraDevice.Instance.GetVideoMode(this.mCameraDeviceMode); videoBackgroundConfig.enabled = 1; videoBackgroundConfig.position = new VuforiaRenderer.Vec2I(0, 0); videoBackgroundConfig.reflection = VuforiaRenderer.InternalInstance.GetLastSetReflection(); bool flag; if (VuforiaRuntimeUtilities.IsPlayMode()) { flag = true; } else { ScreenOrientation surfaceOrientation = SurfaceUtilities.GetSurfaceOrientation(); flag = (surfaceOrientation == ScreenOrientation.Landscape || surfaceOrientation == ScreenOrientation.LandscapeLeft || surfaceOrientation == ScreenOrientation.LandscapeRight); } if (flag) { float num = (float)videoMode.height * ((float)this.mCameraViewPortWidth / (float)videoMode.width); videoBackgroundConfig.size = new VuforiaRenderer.Vec2I(this.mCameraViewPortWidth, (int)num); if (videoBackgroundConfig.size.y < this.mCameraViewPortHeight) { videoBackgroundConfig.size.x = (int)((float)this.mCameraViewPortHeight * ((float)videoMode.width / (float)videoMode.height)); videoBackgroundConfig.size.y = this.mCameraViewPortHeight; } } else { float num2 = (float)videoMode.height * ((float)this.mCameraViewPortHeight / (float)videoMode.width); videoBackgroundConfig.size = new VuforiaRenderer.Vec2I((int)num2, this.mCameraViewPortHeight); if (videoBackgroundConfig.size.x < this.mCameraViewPortWidth) { videoBackgroundConfig.size.x = this.mCameraViewPortWidth; videoBackgroundConfig.size.y = (int)((float)this.mCameraViewPortWidth * ((float)videoMode.width / (float)videoMode.height)); } } VuforiaRenderer.InternalInstance.SetVideoBackgroundConfigInternal(videoBackgroundConfig); int num3 = videoBackgroundConfig.position.x + (this.mCameraViewPortWidth - videoBackgroundConfig.size.x) / 2; int num4 = videoBackgroundConfig.position.y + (this.mCameraViewPortHeight - videoBackgroundConfig.size.y) / 2; this.mVideoBackgroundViewportRect = new Rect((float)num3, (float)num4, (float)videoBackgroundConfig.size.x, (float)videoBackgroundConfig.size.y); this.mLastVideoBackGroundMirroredFromSDK = VuforiaRenderer.Instance.GetVideoBackgroundConfig().reflection; this.UpdateProjection(); if (this.mOnVideoBackgroundConfigChanged != null) { this.mOnVideoBackgroundConfigChanged(); } }
void Awake() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { // We remove the mesh components at run-time only, but keep them for // visualization when running in the editor: MeshRenderer targetMeshRenderer = this.GetComponent <MeshRenderer>(); Destroy(targetMeshRenderer); MeshFilter targetMesh = this.GetComponent <MeshFilter>(); Destroy(targetMesh); Debug.Log(" Vuforia enable"); } }
public static void CreateCamIndependentInstance() { if (VuforiaRuntimeUtilities.IsNativePluginSupportAvailable()) { if (Application.platform != RuntimePlatform.IPhonePlayer) { VuforiaWrapper.sCamIndependentWrapper = new VuforiaNativeWrapper(); return; } } else { VuforiaWrapper.sCamIndependentWrapper = new VuforiaNullWrapper(); } }
public static void CreateRuntimeInstance() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { if (Application.platform != RuntimePlatform.IPhonePlayer) { VuforiaWrapper.sWrapper = new VuforiaNativeWrapper(); return; } } else { VuforiaWrapper.sWrapper = new VuforiaNullWrapper(); } }
public void SetVideoBackgroundConfigInternal(VuforiaRenderer.VideoBGCfgData config) { if (VuforiaRuntimeUtilities.IsPlayMode()) { config.reflection = VuforiaRenderer.VideoBackgroundReflection.OFF; this.mVideoBGConfig = config; this.mVideoBGConfigSet = true; } this.mLastSetReflection = config.reflection; IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VuforiaRenderer.VideoBGCfgData))); Marshal.StructureToPtr(config, intPtr, true); VuforiaWrapper.Instance.RendererSetVideoBackgroundCfg(intPtr); Marshal.FreeHGlobal(intPtr); }
public override bool SetVideoBackgroundTexturePtr(Texture texture, IntPtr nativeTexturePtr) { this.mVideoBackgroundTexture = texture; this.mBackgroundTextureHasChanged = true; if (!VuforiaRuntimeUtilities.IsPlayMode()) { if (texture != null) { ((VuforiaManagerImpl)VuforiaManager.Instance).VideoBackgroundTextureSet = true; return(VuforiaWrapper.Instance.RendererSetVideoBackgroundTexturePtr(nativeTexturePtr) != 0); } ((VuforiaManagerImpl)VuforiaManager.Instance).VideoBackgroundTextureSet = false; } return(true); }
private int StopCameraDevice() { if (VuforiaRuntimeUtilities.IsPlayMode()) { int result = 0; if (CameraDeviceImpl.mWebCam != null) { CameraDeviceImpl.mWebCam.StopCamera(); result = 1; } VuforiaWrapper.Instance.CameraDeviceStopCamera(); return(result); } return(VuforiaWrapper.Instance.CameraDeviceStopCamera()); }
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)); } }
public override bool Start() { this.mIsDirty = true; this.mVideoModeDataNeedsUpdate = true; GL.Clear(false, true, new Color(0f, 0f, 0f, 1f)); if (this.StartCameraDevice() == 0) { return(false); } if (VuforiaRuntimeUtilities.IsPlayMode() && VuforiaRuntimeUtilities.IsVuforiaEnabled()) { this.ForceFrameFormat(Image.PIXEL_FORMAT.RGBA8888, true); } this.mCameraActive = true; return(true); }
private int DeinitCameraDevice() { if (VuforiaRuntimeUtilities.IsPlayMode()) { int result = 0; if (CameraDeviceImpl.mWebCam != null) { CameraDeviceImpl.mWebCam.StopCamera(); result = 1; } VuforiaWrapper.Instance.CameraDeviceDeinitCamera(); return(result); } ((VuforiaManagerImpl)VuforiaManager.Instance).SetStatesToDiscard(); return(VuforiaWrapper.Instance.CameraDeviceDeinitCamera()); }
protected override void Update() { if (!VuforiaRuntimeUtilities.IsPlayMode()) { return; } RotationalPlayModeDeviceTrackerImpl rotationalPlayModeDeviceTrackerImpl = TrackerManager.Instance.GetTracker <DeviceTracker>() as RotationalPlayModeDeviceTrackerImpl; if (rotationalPlayModeDeviceTrackerImpl == null) { return; } Vector3 rotation = rotationalPlayModeDeviceTrackerImpl.Rotation; if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { float num = Input.GetAxis("Mouse X") * 100f * Time.deltaTime; rotation.z += num; rotation.z = Mathf.Clamp(rotation.z, -90f, 90f); rotationalPlayModeDeviceTrackerImpl.Rotation = rotation; } else { float num2 = Mathf.Abs(rotation.z); if (num2 > 0f) { float num3 = 100f * Time.deltaTime; if (num2 < num3) { rotation.z = 0f; } else { rotation.z += -Mathf.Sign(rotation.z) * num3; } rotationalPlayModeDeviceTrackerImpl.Rotation = rotation; } } if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) { float num4 = Input.GetAxis("Mouse X") * 100f * Time.deltaTime; rotation.y += num4; float num5 = -Input.GetAxis("Mouse Y") * 100f * Time.deltaTime; rotation.x += num5; rotationalPlayModeDeviceTrackerImpl.Rotation = rotation; } }
void Awake() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { // We remove the mesh components at run-time only, but keep them for // visualization when running in the editor: var components = this.GetComponentsInChildren <MeshRenderer>(); foreach (Renderer r in components) { //Destroy (r); } MeshRenderer targetMeshRenderer = this.GetComponent <MeshRenderer>(); Destroy(targetMeshRenderer); MeshFilter targetMesh = this.GetComponent <MeshFilter>(); Destroy(targetMesh); } }
public static string GetStoragePath(string path, VuforiaUnity.StorageType storageType) { string result = path; if (storageType == VuforiaUnity.StorageType.STORAGE_APPRESOURCE) { if (VuforiaRuntimeUtilities.IsWSARuntime()) { result = "Data/StreamingAssets/" + path; } if (VuforiaRuntimeUtilities.IsPlayMode()) { result = "Assets/StreamingAssets/" + path; } } return(result); }
public static bool CheckNativePluginSupport() { if (VuforiaRuntimeUtilities.IsPlayMode()) { int num = 0; try { num = VuforiaRuntimeUtilities.qcarCheckNativePluginSupport(); } catch (Exception) { num = 0; } return(num == 1); } return(true); }
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)); }
void Awake() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { // We remove the renderer at run-time only, but keep it for // visualization when running in the editor // We keep the MeshFilter for retreiving the size of the Word-prefab MeshRenderer targetMeshRenderer = this.GetComponent <MeshRenderer>(); Destroy(targetMeshRenderer); //The child object for visualizing text is removed at runtime var text = transform.FindChild("Text"); if (text != null) { Destroy(text.gameObject); } } }
void Awake() { #if UNITY_EDITOR Destroy(gameObject); return; #endif if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { // We remove the mesh components at run-time only, but keep them for // visualization when running in the editor: MeshRenderer targetMeshRenderer = this.GetComponent <MeshRenderer>(); Destroy(targetMeshRenderer); MeshFilter targetMesh = this.GetComponent <MeshFilter>(); Destroy(targetMesh); } }
void Awake() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { // We remove the mesh components at run-time only, but keep them for // visualization when running in the editor: MeshRenderer targetMeshRenderer = this.GetComponent <MeshRenderer>(); Destroy(targetMeshRenderer); MeshFilter targetMesh = this.GetComponent <MeshFilter>(); Destroy(targetMesh); print("Targetoff" + this.name); } else { print("TargetOn: " + this.name); } }
public void OnDestroy() { if (VuforiaRuntimeUtilities.IsPlayMode()) { for (int i = 0; i < this.mARCameras.Length; i++) { if (this.mARCameras[i] != null) { this.mARCameras[i].cullingMask = this.mOriginalCameraCullMask[i]; } } this.IsTextureSizeAvailable = false; if (this.mTextureRenderer != null) { this.mTextureRenderer.Destroy(); } } }
protected override void UpdateProjection() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return; } Device instance = Device.Instance; this.mLastAppliedLeftNearClipPlane = this.mNewLeftNearClipPlane; this.mLastAppliedLeftFarClipPlane = this.mNewLeftFarClipPlane; this.mLastAppliedLeftVerticalVirtualFoV = this.mNewLeftVerticalVirtualFoV; this.mLastAppliedLeftHorizontalVirtualFoV = this.mNewLeftHorizontalVirtualFoV; this.mLastAppliedRightNearClipPlane = this.mNewRightNearClipPlane; this.mLastAppliedRightFarClipPlane = this.mNewRightFarClipPlane; this.mLastAppliedRightVerticalVirtualFoV = this.mNewRightVerticalVirtualFoV; this.mLastAppliedRightHorizontalVirtualFoV = this.mNewRightHorizontalVirtualFoV; if (Device.Instance.GetMode() == Device.Mode.MODE_AR) { Matrix4x4 projectionMatrix = instance.GetProjectionMatrix(View.VIEW_LEFTEYE, this.mLastAppliedLeftNearClipPlane, this.mLastAppliedLeftFarClipPlane, this.mProjectionOrientation); Matrix4x4 projectionMatrix2 = instance.GetProjectionMatrix(View.VIEW_RIGHTEYE, this.mLastAppliedRightNearClipPlane, this.mLastAppliedRightFarClipPlane, this.mProjectionOrientation); this.mPrimaryCamera.projectionMatrix = CameraConfigurationUtility.ScalePerspectiveProjectionMatrix(projectionMatrix, this.mLastAppliedLeftVerticalVirtualFoV, this.mLastAppliedLeftHorizontalVirtualFoV); this.mSecondaryCamera.projectionMatrix = CameraConfigurationUtility.ScalePerspectiveProjectionMatrix(projectionMatrix2, this.mLastAppliedLeftVerticalVirtualFoV, this.mLastAppliedLeftHorizontalVirtualFoV); Vector2 skewingValues = new Vector2(this.mPrimaryCamera.projectionMatrix[0, 2], this.mPrimaryCamera.projectionMatrix[1, 2]); this.mVideoBackgroundBehaviours[this.mPrimaryCamera].SetVuforiaFrustumSkewValues(skewingValues, Vector2.zero); Vector2 skewingValues2 = new Vector2(this.mSecondaryCamera.projectionMatrix[0, 2], this.mSecondaryCamera.projectionMatrix[1, 2]); this.mVideoBackgroundBehaviours[this.mSecondaryCamera].SetVuforiaFrustumSkewValues(skewingValues2, Vector2.zero); } else { this.mPrimaryCamera.projectionMatrix = this.mExternallySetLeftMatrix; this.mSecondaryCamera.projectionMatrix = this.mExternallySetRightMatrix; this.mVideoBackgroundBehaviours[this.mPrimaryCamera].SetVuforiaFrustumSkewValues(Vector2.zero, Vector2.zero); this.mVideoBackgroundBehaviours[this.mSecondaryCamera].SetVuforiaFrustumSkewValues(Vector2.zero, Vector2.zero); } CameraConfigurationUtility.SetFovForCustomProjection(this.mPrimaryCamera); CameraConfigurationUtility.SetFovForCustomProjection(this.mSecondaryCamera); this.mLastAppliedLeftProjection = this.mPrimaryCamera.projectionMatrix; this.mLastAppliedRightProjection = this.mSecondaryCamera.projectionMatrix; int pixelWidthInt = this.mPrimaryCamera.GetPixelWidthInt(); int pixelHeightInt = this.mPrimaryCamera.GetPixelHeightInt(); base.ComputeViewPortRect(pixelHeightInt, pixelWidthInt); }
public static bool IsVuforiaEnabled() { if (VuforiaRuntimeUtilities.IsPlayMode()) { if (VuforiaRuntimeUtilities.sWebCamUsed == VuforiaRuntimeUtilities.InitializableBool.UNKNOWN) { if (VuforiaRuntimeUtilities.IsWebCamUsed()) { VuforiaRuntimeUtilities.sWebCamUsed = VuforiaRuntimeUtilities.InitializableBool.TRUE; } else { VuforiaRuntimeUtilities.sWebCamUsed = VuforiaRuntimeUtilities.InitializableBool.FALSE; } } return(VuforiaRuntimeUtilities.sWebCamUsed == VuforiaRuntimeUtilities.InitializableBool.TRUE); } return(true); }
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)); }
/// <summary> /// Create platform-specific unity player /// </summary> private static IUnityPlayer CreateUnityPlayer() { IUnityPlayer unityPlayer = new NullUnityPlayer(); // instantiate the correct UnityPlayer for the current platform if (Application.platform == RuntimePlatform.Android) { unityPlayer = new AndroidUnityPlayer(); } else if (VuforiaRuntimeUtilities.IsPlayMode()) { unityPlayer = new PlayModeUnityPlayer(); } else if (VuforiaRuntimeUtilities.IsWSARuntime()) { unityPlayer = new WSAUnityPlayer(); } return(unityPlayer); }
public WebCamImpl(Camera[] arCameras, int renderTextureLayer, string webcamDeviceName, bool flipHorizontally) { if (VuforiaRuntimeUtilities.IsPlayMode()) { this.mRenderTextureLayer = renderTextureLayer; this.mARCameras = arCameras; this.mOriginalCameraCullMask = new int[this.mARCameras.Length]; for (int i = 0; i < this.mARCameras.Length; i++) { this.mOriginalCameraCullMask[i] = this.mARCameras[i].cullingMask; Camera expr_60 = this.mARCameras[i]; expr_60.cullingMask = expr_60.cullingMask & ~(1 << this.mRenderTextureLayer); } WebCamProfile webCamProfile = new WebCamProfile(); if (VuforiaRuntimeUtilities.IsVuforiaEnabled() && WebCamTexture.devices.Length != 0) { bool flag = false; WebCamDevice[] devices = WebCamTexture.devices; for (int j = 0; j < devices.Length; j++) { WebCamDevice webCamDevice = devices[j]; if (webCamDevice.name.Equals(webcamDeviceName)) { flag = true; } } if (!flag) { webcamDeviceName = WebCamTexture.devices[0].name; } this.mWebCamProfile = webCamProfile.GetProfile(webcamDeviceName); this.mWebCamTexture = new WebCamTexAdaptorImpl(webcamDeviceName, this.mWebCamProfile.RequestedFPS, this.mWebCamProfile.RequestedTextureSize); } else { this.mWebCamProfile = webCamProfile.Default; this.mWebCamTexture = new NullWebCamTexAdaptor(this.mWebCamProfile.RequestedFPS, this.mWebCamProfile.RequestedTextureSize); } this.mFlipHorizontally = flipHorizontally; } }
private void UpdateProjection() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return; } if (VuforiaRuntimeUtilities.IsPlayMode()) { Matrix4x4 projectionGL = VuforiaUnity.GetProjectionGL(this.mPrimaryCamera.nearClipPlane, this.mPrimaryCamera.farClipPlane, this.mProjectionOrientation); this.ApplyMatrix(this.mPrimaryCamera, projectionGL); this.ApplyMatrix(this.mSecondaryCamera, projectionGL); return; } Device instance = Device.Instance; this.mLastAppliedNearClipPlane = this.mNewNearClipPlane; this.mLastAppliedFarClipPlane = this.mNewFarClipPlane; Matrix4x4 projectionMatrix = instance.GetProjectionMatrix(View.VIEW_LEFTEYE, this.mPrimaryCamera.nearClipPlane, this.mPrimaryCamera.farClipPlane, this.mProjectionOrientation); Matrix4x4 projectionMatrix2 = instance.GetProjectionMatrix(View.VIEW_RIGHTEYE, this.mPrimaryCamera.nearClipPlane, this.mPrimaryCamera.farClipPlane, this.mProjectionOrientation); Matrix4x4 eyeDisplayAdjustmentMatrix = instance.GetEyeDisplayAdjustmentMatrix(View.VIEW_LEFTEYE); Matrix4x4 eyeDisplayAdjustmentMatrix2 = instance.GetEyeDisplayAdjustmentMatrix(View.VIEW_RIGHTEYE); EyewearDevice eyewearDevice = Device.Instance as EyewearDevice; if (eyewearDevice != null && eyewearDevice.IsSeeThru()) { DedicatedEyewearCameraConfiguration.SetProjectionAndOffset(this.mPrimaryCamera, projectionMatrix, eyeDisplayAdjustmentMatrix); DedicatedEyewearCameraConfiguration.SetProjectionAndOffset(this.mSecondaryCamera, projectionMatrix2, eyeDisplayAdjustmentMatrix2); } else { this.mPrimaryCamera.projectionMatrix = projectionMatrix; this.mSecondaryCamera.projectionMatrix = projectionMatrix2; this.mPrimaryCamera.transform.localPosition = -eyeDisplayAdjustmentMatrix.GetColumn(3); this.mPrimaryCamera.transform.localRotation = StateManagerImpl.ExtractRotationFromMatrix(eyeDisplayAdjustmentMatrix); this.mSecondaryCamera.transform.localPosition = -eyeDisplayAdjustmentMatrix2.GetColumn(3); this.mSecondaryCamera.transform.localRotation = StateManagerImpl.ExtractRotationFromMatrix(eyeDisplayAdjustmentMatrix2); } this.mPrimaryCamera.rect = instance.GetNormalizedViewport(View.VIEW_LEFTEYE); this.mSecondaryCamera.rect = instance.GetNormalizedViewport(View.VIEW_RIGHTEYE); }
protected void Awake() { IUnityPlayer unityPlayer = new NullUnityPlayer(); // instantiate the correct UnityPlayer for the current platform if (Application.platform == RuntimePlatform.Android) { unityPlayer = new AndroidUnityPlayer(); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { unityPlayer = new IOSUnityPlayer(); } else if (VuforiaRuntimeUtilities.IsPlayMode()) { unityPlayer = new PlayModeUnityPlayer(); } SetUnityPlayerImplementation(unityPlayer); gameObject.AddComponent <ComponentFactoryStarterBehaviour>(); }
private void OnDisable() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { if (this.mPreviouslyEnabled != base.enabled) { this.mPreviouslyEnabled = base.enabled; this.UpdateEnabled(); } if (this.mPressed && this.mHandlers != null) { using (List <IVirtualButtonEventHandler> .Enumerator enumerator = this.mHandlers.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.OnButtonReleased(this); } } } this.mPressed = false; } }
public RectangleData[] GetLetterBoundingBoxes() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return(new RectangleData[0]); } if (this.mLetterBoundingBoxes == null) { int length = this.mText.Length; this.mLetterBoundingBoxes = new RectangleData[length]; IntPtr intPtr = Marshal.AllocHGlobal(length * Marshal.SizeOf(typeof(RectangleData))); VuforiaWrapper.Instance.WordGetLetterBoundingBoxes(base.ID, intPtr); IntPtr ptr = new IntPtr(intPtr.ToInt64()); for (int i = 0; i < length; i++) { this.mLetterBoundingBoxes[i] = (RectangleData)Marshal.PtrToStructure(ptr, typeof(RectangleData)); ptr = new IntPtr(ptr.ToInt64() + (long)Marshal.SizeOf(typeof(RectangleData))); } Marshal.FreeHGlobal(intPtr); } return(this.mLetterBoundingBoxes); }
protected override void OnApplicationPause(bool pause) { if (!VuforiaRuntimeUtilities.IsPlayMode()) { if (pause) { if (!this.mPaused) { if (this.mOnPause != null) { this.mOnPause.InvokeWithExceptionHandling(true); } ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); this.mObjectTrackerWasActiveBeforePause = (tracker != null && tracker.IsActive); this.mWasEnabledBeforePause = base.VuforiaBehaviour.enabled; if (this.mWasEnabledBeforePause) { this.StopVuforia(); } GL.Clear(false, true, new Color(0f, 0f, 0f, 1f)); UnityPlayer.Instance.OnPause(); } } else if (this.mPaused) { UnityPlayer.Instance.OnResume(); if (this.mWasEnabledBeforePause && this.StartVuforia(this.mObjectTrackerWasActiveBeforePause)) { IOSCamRecoveringHelper.SetHasJustResumed(); } this.ResetBackgroundPlane(true); if (this.mOnPause != null) { this.mOnPause.InvokeWithExceptionHandling(false); } } } this.mPaused = pause; }
void Start() { if (VuforiaRuntimeUtilities.IsVuforiaEnabled()) { Renderer rendererComp = GetComponent <Renderer>(); int numMaterials = rendererComp.materials.Length; if (numMaterials == 1) { rendererComp.sharedMaterial = maskMaterial; } else { Material[] maskMaterials = new Material[numMaterials]; for (int i = 0; i < numMaterials; i++) { maskMaterials[i] = maskMaterial; } rendererComp.sharedMaterials = maskMaterials; } } }