mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-23 06:15:51 +00:00
Move 'SceneViewport.GetBounds' to 'BoundingBox.GetEnclosingBoundingBox'
This commit is contained in:
@@ -68,5 +68,10 @@ namespace PckStudio.Rendering
|
||||
3, 7
|
||||
];
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace PckStudio.Rendering
|
||||
.Select(b => new ModelBox(b.Position + p.Translation, b.Size, System.Numerics.Vector2.Zero, 0f, false)))
|
||||
.Select(b => new BoundingBox(b.Position, b.Position + b.Size));
|
||||
|
||||
_maxBounds = GetBounds(allBoxes);
|
||||
_maxBounds = BoundingBox.GetEnclosingBoundingBox(allBoxes);
|
||||
|
||||
if (!GameModelImporter.ModelMetaData.TryGetValue(model.Name, out JsonModelMetaData modelMetaData))
|
||||
{
|
||||
|
||||
@@ -283,11 +283,6 @@ namespace PckStudio.Rendering
|
||||
Renderer.SetLineWidth(1f);
|
||||
}
|
||||
|
||||
protected BoundingBox GetBounds(IEnumerable<BoundingBox> boundingBoxes)
|
||||
{
|
||||
return boundingBoxes.Aggregate((a, b) => new BoundingBox(Vector3.ComponentMin(a.Start, b.Start), Vector3.ComponentMax(a.End, b.End)));
|
||||
}
|
||||
|
||||
static void DebugProc(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr instanceHandle)
|
||||
{
|
||||
string dbgMessage = Marshal.PtrToStringAnsi(message, length);
|
||||
|
||||
@@ -1042,7 +1042,7 @@ namespace PckStudio.Rendering
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
return SelectedIndices.Length >= 1 ? GetBounds(GetBoundingBoxesFromSelectedIndices(SelectedIndices)) : BoundingBox.Empty;
|
||||
return SelectedIndices.Length >= 1 ? BoundingBox.GetEnclosingBoundingBox(GetBoundingBoxesFromSelectedIndices(SelectedIndices)) : BoundingBox.Empty;
|
||||
}
|
||||
|
||||
private void RenderBodyPart(ShaderProgram shader, Matrix4 partsMatrix, Matrix4 globalMatrix, params string[] partNames)
|
||||
|
||||
Reference in New Issue
Block a user