1 namespace UnityEngine
.Experimental
.Rendering
3 public static class TileLayoutUtils
5 public static bool TryLayoutByTiles(
13 if (src
.width
< tileSize
|| src
.height
< tileSize
)
16 topRow
= RectInt
.zero
;
17 rightCol
= RectInt
.zero
;
18 topRight
= RectInt
.zero
;
22 int mainRows
= src
.height
/ (int)tileSize
;
23 int mainCols
= src
.width
/ (int)tileSize
;
24 int mainWidth
= mainCols
* (int)tileSize
;
25 int mainHeight
= mainRows
* (int)tileSize
;
37 y
= src
.y
+ mainHeight
,
39 height
= src
.height
- mainHeight
41 rightCol
= new RectInt
43 x
= src
.x
+ mainWidth
,
45 width
= src
.width
- mainWidth
,
48 topRight
= new RectInt
50 x
= src
.x
+ mainWidth
,
51 y
= src
.y
+ mainHeight
,
52 width
= src
.width
- mainWidth
,
53 height
= src
.height
- mainHeight
59 public static bool TryLayoutByRow(
65 if (src
.height
< tileSize
)
72 int mainRows
= src
.height
/ (int)tileSize
;
73 int mainHeight
= mainRows
* (int)tileSize
;
85 y
= src
.y
+ mainHeight
,
87 height
= src
.height
- mainHeight
93 public static bool TryLayoutByCol(
99 if (src
.width
< tileSize
)
102 other
= RectInt
.zero
;
106 int mainCols
= src
.width
/ (int)tileSize
;
107 int mainWidth
= mainCols
* (int)tileSize
;
118 x
= src
.x
+ mainWidth
,
120 width
= src
.width
- mainWidth
,