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(); } }
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)); }
public static OrientedBoundingBox CameraFrameToScreenSpaceCoordinates(OrientedBoundingBox cameraFrameObb, Rect bgTextureViewPortRect, bool isTextureMirrored, CameraDevice.VideoModeData videoModeData) { bool flag = false; float num = 0f; switch (VuforiaRuntimeUtilities.ScreenOrientation) { case ScreenOrientation.Portrait: num += 90f; flag = true; break; case ScreenOrientation.PortraitUpsideDown: num += 270f; flag = true; break; case ScreenOrientation.LandscapeRight: num += 180f; break; } float num2 = bgTextureViewPortRect.width / (float)(flag ? videoModeData.height : videoModeData.width); float num3 = bgTextureViewPortRect.height / (float)(flag ? videoModeData.width : videoModeData.height); Vector2 arg_D9_0 = VuforiaRuntimeUtilities.CameraFrameToScreenSpaceCoordinates(cameraFrameObb.Center, bgTextureViewPortRect, isTextureMirrored, videoModeData); Vector2 halfExtents = new Vector2(cameraFrameObb.HalfExtents.x * num2, cameraFrameObb.HalfExtents.y * num3); float num4 = cameraFrameObb.Rotation; if (isTextureMirrored) { num4 = -num4; } num4 = num4 * 180f / 3.14159274f + num; return(new OrientedBoundingBox(arg_D9_0, halfExtents, num4)); }