示例#1
0
        private Rect ScreenSpaceRectFromCamSpaceRectData(RectangleIntData camSpaceRectData, Rect bgTextureViewPortRect, bool isTextureMirrored, CameraDevice.VideoModeData videoModeData)
        {
            Vector2 arg_3B_0    = VuforiaRuntimeUtilities.CameraFrameToScreenSpaceCoordinates(new Vector2((float)camSpaceRectData.leftTopX, (float)camSpaceRectData.leftTopY), bgTextureViewPortRect, isTextureMirrored, videoModeData);
            Vector2 bottomRight = VuforiaRuntimeUtilities.CameraFrameToScreenSpaceCoordinates(new Vector2((float)camSpaceRectData.rightBottomX, (float)camSpaceRectData.rightBottomY), bgTextureViewPortRect, isTextureMirrored, videoModeData);

            return(VuforiaRuntimeUtilities.CalculateRectFromLandscapeLeftCorners(arg_3B_0, bottomRight, isTextureMirrored));
        }
示例#2
0
        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);
        }