experiments with fresnel and shadergraph
[WindSway-HDRP.git] / Library / PackageCache / com.unity.render-pipelines.high-definition@4.10.0-preview / Runtime / Core / Utilities / TileLayoutUtils.cs
blob8a1e6af977971909bc8bb4ae529fec59aa7f227f
1 namespace UnityEngine.Experimental.Rendering
3 public static class TileLayoutUtils
5 public static bool TryLayoutByTiles(
6 RectInt src,
7 uint tileSize,
8 out RectInt main,
9 out RectInt topRow,
10 out RectInt rightCol,
11 out RectInt topRight)
13 if (src.width < tileSize || src.height < tileSize)
15 main = RectInt.zero;
16 topRow = RectInt.zero;
17 rightCol = RectInt.zero;
18 topRight = RectInt.zero;
19 return false;
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;
27 main = new RectInt
29 x = src.x,
30 y = src.y,
31 width = mainWidth,
32 height = mainHeight,
34 topRow = new RectInt
36 x = src.x,
37 y = src.y + mainHeight,
38 width = mainWidth,
39 height = src.height - mainHeight
41 rightCol = new RectInt
43 x = src.x + mainWidth,
44 y = src.y,
45 width = src.width - mainWidth,
46 height = mainHeight
48 topRight = new RectInt
50 x = src.x + mainWidth,
51 y = src.y + mainHeight,
52 width = src.width - mainWidth,
53 height = src.height - mainHeight
56 return true;
59 public static bool TryLayoutByRow(
60 RectInt src,
61 uint tileSize,
62 out RectInt main,
63 out RectInt other)
65 if (src.height < tileSize)
67 main = RectInt.zero;
68 other = RectInt.zero;
69 return false;
72 int mainRows = src.height / (int)tileSize;
73 int mainHeight = mainRows * (int)tileSize;
75 main = new RectInt
77 x = src.x,
78 y = src.y,
79 width = src.width,
80 height = mainHeight,
82 other = new RectInt
84 x = src.x,
85 y = src.y + mainHeight,
86 width = src.width,
87 height = src.height - mainHeight
90 return true;
93 public static bool TryLayoutByCol(
94 RectInt src,
95 uint tileSize,
96 out RectInt main,
97 out RectInt other)
99 if (src.width < tileSize)
101 main = RectInt.zero;
102 other = RectInt.zero;
103 return false;
106 int mainCols = src.width / (int)tileSize;
107 int mainWidth = mainCols * (int)tileSize;
109 main = new RectInt
111 x = src.x,
112 y = src.y,
113 width = mainWidth,
114 height = src.height,
116 other = new RectInt
118 x = src.x + mainWidth,
119 y = src.y,
120 width = src.width - mainWidth,
121 height = src.height
124 return true;