| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCLFeatures.ScreencaptureCamera.CameraObject |
| | 4 | | { |
| | 5 | | public struct ScreenFrameData |
| | 6 | | { |
| | 7 | | public float ScreenWidth; |
| | 8 | | public float ScreenHeight; |
| | 9 | |
|
| | 10 | | public float FrameWidth; |
| | 11 | | public float FrameHeight; |
| | 12 | |
|
| 0 | 13 | | public int ScreenWidthInt => Mathf.RoundToInt(ScreenWidth); |
| 0 | 14 | | public int ScreenHeightInt => Mathf.RoundToInt(ScreenHeight); |
| | 15 | |
|
| 0 | 16 | | public int FrameWidthInt => Mathf.RoundToInt(FrameWidth); |
| 0 | 17 | | public int FrameHeightInt => Mathf.RoundToInt(FrameHeight); |
| | 18 | |
|
| 0 | 19 | | public float ScreenAspectRatio => ScreenWidth / ScreenHeight; |
| 0 | 20 | | public float FrameAspectRatio => FrameWidth / FrameHeight; |
| | 21 | |
|
| | 22 | | public Vector2Int CalculateFrameCorners() => |
| 0 | 23 | | new () |
| | 24 | | { |
| | 25 | | x = Mathf.RoundToInt((ScreenWidth - FrameWidth) / 2f), |
| | 26 | | y = Mathf.RoundToInt((ScreenHeight - FrameHeight) / 2f), |
| | 27 | | }; |
| | 28 | |
|
| | 29 | | public static ScreenFrameData operator *(ScreenFrameData frame, int factor) => |
| 0 | 30 | | new() |
| | 31 | | { |
| | 32 | | FrameWidth = frame.FrameWidth * factor, |
| | 33 | | FrameHeight = frame.FrameHeight * factor, |
| | 34 | | ScreenWidth = frame.ScreenWidth * factor, |
| | 35 | | ScreenHeight = frame.ScreenHeight * factor |
| | 36 | | }; |
| | 37 | | } |
| | 38 | | } |