Skip to content

Commit cf6cc91

Browse files
committed
Cap depth to 1.0
1 parent e495209 commit cf6cc91

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/TSMapEditor/Rendering/DepthRectangle.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace TSMapEditor.Rendering
1+
using System;
2+
3+
namespace TSMapEditor.Rendering
24
{
35
public struct DepthRectangle
46
{
@@ -11,10 +13,10 @@ public DepthRectangle() { }
1113

1214
public DepthRectangle(float topLeft, float topRight, float bottomLeft, float bottomRight)
1315
{
14-
TopLeft = topLeft;
15-
TopRight = topRight;
16-
BottomLeft = bottomLeft;
17-
BottomRight = bottomRight;
16+
TopLeft = Math.Min(1.0f, topLeft);
17+
TopRight = Math.Min(1.0f, topRight);
18+
BottomLeft = Math.Min(1.0f, bottomLeft);
19+
BottomRight = Math.Min(1.0f, bottomRight);
1820
}
1921

2022
public DepthRectangle(float top, float bottom) : this(top, top, bottom, bottom) { }

0 commit comments

Comments
 (0)