public virtual void Init()
 {
     this.ResolveVideoBackgroundBehaviours();
     if (this.mBackgroundPlaneBehaviour != null)
     {
         this.EnableObjectRenderer(this.mBackgroundPlaneBehaviour.gameObject, this.IsVideoBackgroundEnabled());
     }
     VuforiaRenderer.VideoBGCfgData videoBackgroundConfig = VuforiaRenderer.Instance.GetVideoBackgroundConfig();
     videoBackgroundConfig.reflection = this.mInitialReflection;
     VuforiaRenderer.InternalInstance.SetVideoBackgroundConfigInternal(videoBackgroundConfig);
 }
        public override VuforiaRenderer.VideoBGCfgData GetVideoBackgroundConfig()
        {
            if (VuforiaRuntimeUtilities.IsPlayMode())
            {
                return(this.mVideoBGConfig);
            }
            IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VuforiaRenderer.VideoBGCfgData)));

            VuforiaWrapper.Instance.RendererGetVideoBackgroundCfg(intPtr);
            VuforiaRenderer.VideoBGCfgData arg_49_0 = (VuforiaRenderer.VideoBGCfgData)Marshal.PtrToStructure(intPtr, typeof(VuforiaRenderer.VideoBGCfgData));
            Marshal.FreeHGlobal(intPtr);
            return(arg_49_0);
        }
示例#3
0
        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();
            }
        }
        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);
        }
示例#5
0
        public 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);
            float num  = (float)this.mScreenHeight;
            float num2 = (float)this.mScreenWidth;

            if (!this.mEyewearDevice.IsSeeThru())
            {
                ScreenOrientation surfaceOrientation = SurfaceUtilities.GetSurfaceOrientation();
                if (surfaceOrientation == ScreenOrientation.Landscape || surfaceOrientation == ScreenOrientation.LandscapeLeft || surfaceOrientation == ScreenOrientation.LandscapeRight)
                {
                    num2 = num * (float)videoMode.width / (float)videoMode.height;
                }
                else
                {
                    num2 = num * (float)videoMode.height / (float)videoMode.width;
                }
            }
            videoBackgroundConfig.size       = new VuforiaRenderer.Vec2I((int)num2, (int)num);
            videoBackgroundConfig.reflection = VuforiaRenderer.VideoBackgroundReflection.OFF;
            VuforiaRenderer.InternalInstance.SetVideoBackgroundConfigInternal(videoBackgroundConfig);
            int num3 = videoBackgroundConfig.position.x + (this.mScreenWidth - videoBackgroundConfig.size.x) / 2;
            int num4 = videoBackgroundConfig.position.y + (this.mScreenHeight - 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();
            }
        }
 public override void SetVideoBackgroundConfig(VuforiaRenderer.VideoBGCfgData config)
 {
     this.SetVideoBackgroundConfigInternal(config);
     VuforiaUnityImpl.SetRendererDirty();
 }
 public abstract void SetVideoBackgroundConfig(VuforiaRenderer.VideoBGCfgData config);