From e9e081b22071160c5cd29e92f947c6246b2bf93c Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 2 Jun 2022 12:18:03 +0100 Subject: [PATCH] Add Bounds overload to DebugEx.DrawWireCube --- X10D.Unity/src/DebugEx.WireCube.cs | 51 +++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/X10D.Unity/src/DebugEx.WireCube.cs b/X10D.Unity/src/DebugEx.WireCube.cs index 43b9794..13ae883 100644 --- a/X10D.Unity/src/DebugEx.WireCube.cs +++ b/X10D.Unity/src/DebugEx.WireCube.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using X10D.Drawing; using X10D.Unity.Numerics; @@ -6,6 +6,55 @@ namespace X10D.Unity; public static partial class DebugEx { + /// + /// Draws an axis-aligned bounding box. + /// + /// The bounding box to draw. + public static void DrawWireCube(in Bounds bounds) + { + DrawWireCube(bounds.center, bounds.size, Color.white, DefaultDrawDuration, DefaultDepthTest); + } + + /// + /// Draws an axis-aligned bounding box. + /// + /// The bounding box to draw. + /// The color of the box. + public static void DrawWireCube(in Bounds bounds, in Color color) + { + DrawWireCube(bounds.center, bounds.size, color, DefaultDrawDuration, DefaultDepthTest); + } + + /// + /// Draws an axis-aligned bounding box. + /// + /// The bounding box to draw. + /// The color of the box. + /// + /// The duration of the box's visibility, in seconds. If 0 is passed, the box is visible for a single frame. + /// + public static void DrawWireCube(in Bounds bounds, in Color color, float duration) + { + DrawWireCube(bounds.center, bounds.size, color, duration, DefaultDepthTest); + } + + /// + /// Draws an axis-aligned bounding box. + /// + /// The bounding box to draw. + /// The color of the box. + /// + /// The duration of the box's visibility, in seconds. If 0 is passed, the box is visible for a single frame. + /// + /// + /// if depth test should be applied; otherwise, . Passing + /// will have the box be obscured by objects closer to the camera. + /// + public static void DrawWireCube(in Bounds bounds, in Color color, float duration, bool depthTest) + { + DrawWireCube(bounds.center, bounds.size, color, duration, depthTest); + } + /// /// Draws a wireframe cube with a center and a size. ///