public override VuforiaRenderer.VideoTextureInfo GetVideoTextureInfo() { if (VuforiaRuntimeUtilities.IsPlayMode()) { return(((CameraDeviceImpl)CameraDevice.Instance).WebCam.GetVideoTextureInfo()); } IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VuforiaRenderer.VideoTextureInfo))); VuforiaWrapper.Instance.RendererGetVideoBackgroundTextureInfo(intPtr); VuforiaRenderer.VideoTextureInfo arg_58_0 = (VuforiaRenderer.VideoTextureInfo)Marshal.PtrToStructure(intPtr, typeof(VuforiaRenderer.VideoTextureInfo)); Marshal.FreeHGlobal(intPtr); return(arg_58_0); }
private void OnTrackablesUpdated() { if (VuforiaRenderer.Instance.IsVideoBackgroundInfoAvailable()) { int pixelWidthInt = this.mCamera.GetPixelWidthInt(); int pixelHeightInt = this.mCamera.GetPixelHeightInt(); if ((this.mNumFramesToUpdateVideoBg > 0 || this.mViewWidth != pixelWidthInt || this.mViewHeight != pixelHeightInt) && !((VuforiaManagerImpl)VuforiaManager.Instance).IsDiscardingRenderingStates()) { this.mViewWidth = pixelWidthInt; this.mViewHeight = pixelHeightInt; this.mTextureInfo = VuforiaRenderer.Instance.GetVideoTextureInfo(); this.CreateAndSetVideoMesh(); this.PositionVideoMesh(); this.mNumFramesToUpdateVideoBg--; } } }
public void Update() { if (VuforiaRuntimeUtilities.IsPlayMode()) { this.mWebCamTexture.CheckPermissions(); if (!this.IsTextureSizeAvailable && this.mWebCamTexture.DidUpdateThisFrame) { this.IsTextureSizeAvailable = true; if (this.mWebCamProfile.ResampledTextureSize.y == 0) { this.ComputeResampledTextureSize(); VuforiaWrapper.Instance.CameraDeviceStopCamera(); VuforiaWrapper.Instance.CameraDeviceDeinitCamera(); VuforiaWrapper.Instance.CameraDeviceSetCameraConfiguration(this.mWebCamProfile.ResampledTextureSize.x, this.mWebCamProfile.ResampledTextureSize.y); VuforiaWrapper.Instance.CameraDeviceInitCamera(1); VuforiaWrapper.Instance.CameraDeviceSelectVideoMode(-1); VuforiaWrapper.Instance.CameraDeviceStartCamera(); } VuforiaRenderer.Vec2I resampledTextureSize = this.mWebCamProfile.ResampledTextureSize; this.mVideoModeData = new CameraDevice.VideoModeData { width = resampledTextureSize.x, height = resampledTextureSize.y, frameRate = (float)this.mWebCamProfile.RequestedFPS }; this.mVideoTextureInfo = new VuforiaRenderer.VideoTextureInfo { imageSize = resampledTextureSize, textureSize = resampledTextureSize }; this.mTextureRenderer = new TextureRenderer(this.mWebCamTexture.Texture, this.mRenderTextureLayer, resampledTextureSize); this.mBufferReadTexture = new Texture2D(resampledTextureSize.x, resampledTextureSize.y); this.mReadPixelsRect = new Rect(0f, 0f, (float)resampledTextureSize.x, (float)resampledTextureSize.y); } } }