Frédéric Vauchelles
7 年前
当前提交
04e13257
共有 4 个文件被更改,包括 169 次插入 和 0 次删除
-
20ScriptableRenderPipeline/Core/CoreRP/RectInt.cs
-
11ScriptableRenderPipeline/Core/CoreRP/RectInt.cs.meta
-
127ScriptableRenderPipeline/Core/CoreRP/TileLayoutUtils.cs
-
11ScriptableRenderPipeline/Core/CoreRP/TileLayoutUtils.cs.meta
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
{ |
|||
public struct RectInt |
|||
{ |
|||
public static readonly RectInt zero = new RectInt(0, 0, 0, 0); |
|||
|
|||
public int x; |
|||
public int y; |
|||
public int width; |
|||
public int height; |
|||
|
|||
public RectInt(int x, int y, int width, int height) |
|||
{ |
|||
this.x = x; |
|||
this.y = y; |
|||
this.width = width; |
|||
this.height = height; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c8e81b226dbe13441ab23fbc3719f78c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
{ |
|||
public static class TileLayoutUtils |
|||
{ |
|||
public static bool TryLayoutByTiles( |
|||
RectInt src, |
|||
uint tileSize, |
|||
out RectInt main, |
|||
out RectInt topRow, |
|||
out RectInt rightCol, |
|||
out RectInt topRight) |
|||
{ |
|||
if (src.width < tileSize || src.height < tileSize) |
|||
{ |
|||
main = RectInt.zero; |
|||
topRow = RectInt.zero; |
|||
rightCol = RectInt.zero; |
|||
topRight = RectInt.zero; |
|||
return false; |
|||
} |
|||
|
|||
int mainRows = src.height / (int)tileSize; |
|||
int mainCols = src.width / (int)tileSize; |
|||
int mainWidth = mainCols * (int)tileSize; |
|||
int mainHeight = mainRows * (int)tileSize; |
|||
|
|||
main = new RectInt |
|||
{ |
|||
x = src.x, |
|||
y = src.y, |
|||
width = mainWidth, |
|||
height = mainHeight, |
|||
}; |
|||
topRow = new RectInt |
|||
{ |
|||
x = src.x, |
|||
y = src.y + mainHeight, |
|||
width = mainWidth, |
|||
height = src.height - mainHeight |
|||
}; |
|||
rightCol = new RectInt |
|||
{ |
|||
x = src.x + mainWidth, |
|||
y = src.y, |
|||
width = src.width - mainWidth, |
|||
height = mainHeight |
|||
}; |
|||
topRight = new RectInt |
|||
{ |
|||
x = src.x + mainWidth, |
|||
y = src.y + mainHeight, |
|||
width = src.width - mainWidth, |
|||
height = src.height - mainHeight |
|||
}; |
|||
|
|||
return true; |
|||
} |
|||
|
|||
public static bool TryLayoutByRow( |
|||
RectInt src, |
|||
uint tileSize, |
|||
out RectInt main, |
|||
out RectInt other) |
|||
{ |
|||
if (src.height < tileSize) |
|||
{ |
|||
main = RectInt.zero; |
|||
other = RectInt.zero; |
|||
return false; |
|||
} |
|||
|
|||
int mainRows = src.height / (int)tileSize; |
|||
int mainHeight = mainRows * (int)tileSize; |
|||
|
|||
main = new RectInt |
|||
{ |
|||
x = src.x, |
|||
y = src.y, |
|||
width = src.width, |
|||
height = mainHeight, |
|||
}; |
|||
other = new RectInt |
|||
{ |
|||
x = src.x, |
|||
y = src.y + mainHeight, |
|||
width = src.width, |
|||
height = src.height - mainHeight |
|||
}; |
|||
|
|||
return true; |
|||
} |
|||
|
|||
public static bool TryLayoutByCol( |
|||
RectInt src, |
|||
uint tileSize, |
|||
out RectInt main, |
|||
out RectInt other) |
|||
{ |
|||
if (src.width < tileSize) |
|||
{ |
|||
main = RectInt.zero; |
|||
other = RectInt.zero; |
|||
return false; |
|||
} |
|||
|
|||
int mainCols = src.width / (int)tileSize; |
|||
int mainWidth = mainCols * (int)tileSize; |
|||
|
|||
main = new RectInt |
|||
{ |
|||
x = src.x, |
|||
y = src.y, |
|||
width = mainWidth, |
|||
height = src.height, |
|||
}; |
|||
other = new RectInt |
|||
{ |
|||
x = src.x + mainWidth, |
|||
y = src.y, |
|||
width = src.width - mainWidth, |
|||
height = src.height |
|||
}; |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 39aaac96b648c194298b5441a11fd53a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue