mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-25 20:37:39 +00:00
BoundingBox - Fix exception when empty enumerable was passed
This commit is contained in:
@@ -71,7 +71,7 @@ namespace PckStudio.Rendering
|
||||
|
||||
public static BoundingBox GetEnclosingBoundingBox(IEnumerable<BoundingBox> boundingBoxes)
|
||||
{
|
||||
return boundingBoxes.Aggregate((a, b) => new BoundingBox(OpenTK.Vector3.ComponentMin(a.Start, b.Start), OpenTK.Vector3.ComponentMax(a.End, b.End)));
|
||||
return boundingBoxes.DefaultIfEmpty().Aggregate((a, b) => new BoundingBox(OpenTK.Vector3.ComponentMin(a.Start, b.Start), OpenTK.Vector3.ComponentMax(a.End, b.End)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,7 @@ namespace PckStudio.Rendering
|
||||
{
|
||||
IEnumerable<BoundingBox> boundingBoxes = cubes
|
||||
.Where(c => c.Visible)
|
||||
.Select(c => c.GetBounds(Transform * transform))
|
||||
.DefaultIfEmpty();
|
||||
.Select(c => c.GetBounds(Transform * transform));
|
||||
return BoundingBox.GetEnclosingBoundingBox(boundingBoxes);
|
||||
}
|
||||
|
||||
|
||||
@@ -1059,7 +1059,7 @@ namespace PckStudio.Rendering
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
return SelectedIndices.Length >= 1 ? BoundingBox.GetEnclosingBoundingBox(GetBoundingBoxesFromSelectedIndices(SelectedIndices)) : BoundingBox.Empty;
|
||||
return BoundingBox.GetEnclosingBoundingBox(GetBoundingBoxesFromSelectedIndices(SelectedIndices));
|
||||
}
|
||||
|
||||
private void RenderBodyPart(ShaderProgram shader, Matrix4 partsMatrix, Matrix4 globalMatrix, params string[] partNames)
|
||||
|
||||
Reference in New Issue
Block a user