Fix dual terrain corner rounding

This commit is contained in:
2026-05-08 22:18:02 +02:00
parent 5fb4265197
commit 5838214b36

View File

@@ -215,10 +215,12 @@ public sealed partial class MainWindow
{
var wallColor = ColorHelper.FromArgb(255, 54, 61, 68);
var floorColor = ColorHelper.FromArgb(255, 31, 36, 40);
drawing.FillRectangle(rect, wallColor);
if (floorMask == 0)
{
drawing.FillRectangle(rect, wallColor);
return;
}
if (floorMask == c_AllFloorCorners)
{
@@ -226,26 +228,22 @@ public sealed partial class MainWindow
return;
}
var halfWidth = rect.Width / 2;
var halfHeight = rect.Height / 2;
if ((floorMask & c_TopLeftFloor) != 0)
DrawFloorCorner(drawing, rect, floorColor, c_TopLeftFloor);
drawing.FillRectangle(rect, floorColor);
var wallMask = c_AllFloorCorners ^ floorMask;
if ((wallMask & c_TopLeftFloor) != 0)
DrawTerrainCorner(drawing, rect, wallColor, c_TopLeftFloor);
if ((floorMask & c_TopRightFloor) != 0)
DrawFloorCorner(drawing, rect, floorColor, c_TopRightFloor);
if ((wallMask & c_TopRightFloor) != 0)
DrawTerrainCorner(drawing, rect, wallColor, c_TopRightFloor);
if ((floorMask & c_BottomLeftFloor) != 0)
DrawFloorCorner(drawing, rect, floorColor, c_BottomLeftFloor);
if ((wallMask & c_BottomLeftFloor) != 0)
DrawTerrainCorner(drawing, rect, wallColor, c_BottomLeftFloor);
if ((floorMask & c_BottomRightFloor) != 0)
DrawFloorCorner(drawing, rect, floorColor, c_BottomRightFloor);
var center = new Vector2((float)(rect.X + halfWidth), (float)(rect.Y + halfHeight));
if (floorMask is c_TopLeftFloor or c_TopRightFloor or c_BottomLeftFloor or c_BottomRightFloor)
drawing.FillCircle(center, (float)Math.Min(rect.Width, rect.Height) * 0.18f, floorColor);
if ((wallMask & c_BottomRightFloor) != 0)
DrawTerrainCorner(drawing, rect, wallColor, c_BottomRightFloor);
}
private static void DrawFloorCorner(CanvasDrawingSession drawing, Rect rect, Color color, int corner)
private static void DrawTerrainCorner(CanvasDrawingSession drawing, Rect rect, Color color, int corner)
{
var center = new Vector2((float)(rect.X + rect.Width / 2), (float)(rect.Y + rect.Height / 2));
var radiusX = (float)rect.Width / 2;