From 77a164cefbba7cd09fdae29529994189428bbd33 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Thu, 15 Dec 2022 23:33:53 +0800 Subject: [PATCH] Updated C# Gizmos class with DrawCube and DrawSphere in --- SHADE_Managed/src/Utility/Gizmos.cxx | 20 +++++++++++++++++ SHADE_Managed/src/Utility/Gizmos.hxx | 32 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/SHADE_Managed/src/Utility/Gizmos.cxx b/SHADE_Managed/src/Utility/Gizmos.cxx index 458b64b6..cccdbad1 100644 --- a/SHADE_Managed/src/Utility/Gizmos.cxx +++ b/SHADE_Managed/src/Utility/Gizmos.cxx @@ -47,6 +47,26 @@ namespace SHADE SHDebugDraw::Line(Convert::ToNative(from), Convert::ToNative(to), Convert::ToNative(color)); } + void Gizmos::DrawCube(Vector3 center, Vector3 extents) + { + DrawCube(center, extents, defaultColor); + } + + void Gizmos::DrawCube(Vector3 center, Vector3 extents, SHADE::Color color) + { + SHDebugDraw::Cube(Convert::ToNative(center), Convert::ToNative(extents), Convert::ToNative(color)); + } + + void Gizmos::DrawSphere(Vector3 center, float radius) + { + DrawSphere(center, radius, defaultColor); + } + + void Gizmos::DrawSphere(Vector3 center, float radius, SHADE::Color color) + { + SHDebugDraw::Sphere(Convert::ToNative(center), SHVec3(radius, radius, radius), Convert::ToNative(color)); + } + void Gizmos::DrawWireCube(Vector3 center, Vector3 extents) { DrawWireCube(center, extents, defaultColor); diff --git a/SHADE_Managed/src/Utility/Gizmos.hxx b/SHADE_Managed/src/Utility/Gizmos.hxx index 1878d867..f96f1261 100644 --- a/SHADE_Managed/src/Utility/Gizmos.hxx +++ b/SHADE_Managed/src/Utility/Gizmos.hxx @@ -56,6 +56,38 @@ namespace SHADE /// Colour of the line. static void DrawLine(Vector3 from, Vector3 to, SHADE::Color color); /// + /// Renders a cube centered around the position specified in world + /// space. + /// Uses Color to render. + /// + /// Position where the cube wil be centered at. + /// Size of the rendered cube. + static void DrawCube(Vector3 center, Vector3 extents); + /// + /// Renders a cube centered around the position specified in world + /// space. + /// + /// Position where the cube wil be centered at. + /// Size of the rendered cube. + /// Colour of the cube. + static void DrawCube(Vector3 center, Vector3 extents, SHADE::Color color); + /// + /// Renders a sphere centered around the position specified in world + /// space. + /// Uses Color to render. + /// + /// Position where the sphere wil be centered at. + /// Radius of the rendered sphere. + static void DrawSphere(Vector3 center, float radius); + /// + /// Renders a sphere centered around the position specified in world + /// space. + /// + /// Position where the sphere wil be centered at. + /// Radius of the rendered sphere. + /// Colour of the sphere. + static void DrawSphere(Vector3 center, float radius, SHADE::Color color); + /// /// Renders a wireframe cube centered around the position specified in world /// space. /// Uses Color to render.