private IEnumerator TakeSnapshots_Routine(OnSnapshotsReady callback) { DCL.Environment.i.platform.cullingController.Stop(); var current = camera.targetTexture; camera.targetTexture = null; var avatarAnimator = avatarRenderer.gameObject.GetComponent <AvatarAnimatorLegacy>(); SetFocus(CameraFocus.FaceSnapshot, false); avatarAnimator.Reset(); yield return(null); Texture2D face = Snapshot(SNAPSHOT_FACE_WIDTH_RES, SNAPSHOT_FACE_HEIGHT_RES); Texture2D face128 = Snapshot(SNAPSHOT_FACE_128_WIDTH_RES, SNAPSHOT_FACE_128_HEIGHT_RES); Texture2D face256 = Snapshot(SNAPSHOT_FACE_256_WIDTH_RES, SNAPSHOT_FACE_256_HEIGHT_RES); SetFocus(CameraFocus.BodySnapshot, false); avatarAnimator.Reset(); yield return(null); Texture2D body = Snapshot(SNAPSHOT_BODY_WIDTH_RES, SNAPSHOT_BODY_HEIGHT_RES); SetFocus(CameraFocus.DefaultEditing, false); camera.targetTexture = current; DCL.Environment.i.platform.cullingController.Start(); callback?.Invoke(face, face128, face256, body); }
public void TakeSnapshots(OnSnapshotsReady onSuccess, Action onFailed) { if (avatarLoadFailed) { onFailed?.Invoke(); return; } StartCoroutine(TakeSnapshots_Routine(onSuccess)); }
private IEnumerator TakeSceneScreenshotCoroutine(OnSnapshotsReady callback) { var current = camera.targetTexture; camera.targetTexture = null; yield return(null); Texture2D sceneScreenshot = ScreenshotFromCamera(SCENE_SNAPSHOT_WIDTH_RES, SCENE_SNAPSHOT_HEIGHT_RES); camera.targetTexture = current; callback?.Invoke(sceneScreenshot); }
private IEnumerator TakeSnapshots_Routine(OnSnapshotsReady callback) { var current = camera.targetTexture; camera.targetTexture = null; var avatarAnimator = avatarRenderer.gameObject.GetComponent <AvatarAnimatorLegacy>(); SetFocus(CameraFocus.FaceSnapshot, false); avatarAnimator.Reset(); yield return(null); Sprite face = Snapshot(SNAPSHOT_FACE_WIDTH_RES, SNAPSHOT_FACE_HEIGHT_RES); SetFocus(CameraFocus.BodySnapshot, false); avatarAnimator.Reset(); yield return(null); Sprite body = Snapshot(SNAPSHOT_BODY_WIDTH_RES, SNAPSHOT_BODY_HEIGHT_RES); SetFocus(CameraFocus.DefaultEditing, false); camera.targetTexture = current; callback?.Invoke(face, body); }
private IEnumerator TakeSceneScreenshotFromResetPositionCoroutine(OnSnapshotsReady callback) { // Store current camera position/direction Vector3 currentPos = transform.position; Vector3 currentLookAt = transform.forward; SetPosition(originalCameraPosition); transform.LookAt(originalCameraLookAt); var current = camera.targetTexture; camera.targetTexture = null; yield return(null); Texture2D sceneScreenshot = ScreenshotFromCamera(SCENE_SNAPSHOT_WIDTH_RES, SCENE_SNAPSHOT_HEIGHT_RES); camera.targetTexture = current; callback?.Invoke(sceneScreenshot); // Restore camera position/direction after the screenshot SetPosition(currentPos); transform.forward = currentLookAt; }
public void TakeSnapshots(OnSnapshotsReady callback) { StartCoroutine(TakeSnapshots_Routine(callback)); }
public void TakeSceneScreenshotFromResetPosition(OnSnapshotsReady onSuccess) { StartCoroutine(TakeSceneScreenshotFromResetPositionCoroutine(onSuccess)); }
public void TakeSceneScreenshot(OnSnapshotsReady onSuccess) { StartCoroutine(TakeSceneScreenshotCoroutine(onSuccess)); }