diff --git a/SHADE_Managed/src/Utility/Gizmos.cxx b/SHADE_Managed/src/Utility/Gizmos.cxx index 47d86251..21636a5d 100644 --- a/SHADE_Managed/src/Utility/Gizmos.cxx +++ b/SHADE_Managed/src/Utility/Gizmos.cxx @@ -16,8 +16,54 @@ of DigiPen Institute of Technology is prohibited. #include "SHpch.h" // Primary Header #include "Gizmos.hxx" +#include "Convert.hxx" +#include "Tools/SHDebugDraw.h" // External Dependencies namespace SHADE { + /*---------------------------------------------------------------------------------*/ + /* Public Properties */ + /*---------------------------------------------------------------------------------*/ + Color Gizmos::Color::get() + { + return defaultColor; + } + void Gizmos::Color::set(SHADE::Color color) + { + defaultColor = color; + } + + /*---------------------------------------------------------------------------------*/ + /* Debug Draw Functions */ + /*---------------------------------------------------------------------------------*/ + void Gizmos::DrawLine(Vector3 from, Vector3 to) + { + DrawLine(from, to, defaultColor); + } + + void Gizmos::DrawLine(Vector3 from, Vector3 to, SHADE::Color color) + { + SHDebugDraw::Line(Convert::ToNative(color), Convert::ToNative(from), Convert::ToNative(to)); + } + + void Gizmos::DrawWireCube(Vector3 center, Vector3 extents) + { + DrawWireCube(center, extents, defaultColor); + } + + void Gizmos::DrawWireCube(Vector3 center, Vector3 extents, SHADE::Color color) + { + SHDebugDraw::Cube(Convert::ToNative(color), Convert::ToNative(center), Convert::ToNative(extents)); + } + + void Gizmos::DrawWireSphere(Vector3 center, float radius) + { + DrawWireSphere(center, radius, defaultColor); + } + + void Gizmos::DrawWireSphere(Vector3 center, float radius, SHADE::Color color) + { + SHDebugDraw::Sphere(Convert::ToNative(color), Convert::ToNative(center), radius); + } } diff --git a/SHADE_Managed/src/Utility/Gizmos.hxx b/SHADE_Managed/src/Utility/Gizmos.hxx index f0b082d7..1878d867 100644 --- a/SHADE_Managed/src/Utility/Gizmos.hxx +++ b/SHADE_Managed/src/Utility/Gizmos.hxx @@ -26,20 +26,72 @@ namespace SHADE public value class Gizmos abstract sealed { public: + /*-----------------------------------------------------------------------------*/ + /* Public Properties */ + /*-----------------------------------------------------------------------------*/ + /// + /// Default colour that will be used for drawing debug primitives if the color + /// parameter is not specified. + /// + static property Color Color + { + SHADE::Color get(); + void set(SHADE::Color color); + } /*-----------------------------------------------------------------------------*/ /* Debug Draw Functions */ /*-----------------------------------------------------------------------------*/ + /// + /// Renders a line between two points in world space. + /// Uses Color to render. + /// + /// First point of the line. + /// Second point of the line. static void DrawLine(Vector3 from, Vector3 to); - static void DrawLine(Vector3 from, Vector3 to, Color color); + /// + /// Renders a line between two points in world space. + /// + /// First point of the line. + /// Second point of the line. + /// Colour of the line. + static void DrawLine(Vector3 from, Vector3 to, SHADE::Color color); + /// + /// Renders a wireframe 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 DrawWireCube(Vector3 center, Vector3 extents); - static void DrawWireCube(Vector3 center, Vector3 extents, Color color); + /// + /// Renders a wireframe 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 DrawWireCube(Vector3 center, Vector3 extents, SHADE::Color color); + /// + /// Renders a wireframe 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 DrawWireSphere(Vector3 center, float radius); - static void DrawWireSphere(Vector3 center, float radius, Color color); + /// + /// Renders a wireframe 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 DrawWireSphere(Vector3 center, float radius, SHADE::Color color); private: /*-----------------------------------------------------------------------------*/ /* Data Members */ /*-----------------------------------------------------------------------------*/ - Color defaultColor; + static SHADE::Color defaultColor = SHADE::Color::White; }; } diff --git a/TempScriptsFolder/RaccoonShowcase.cs b/TempScriptsFolder/RaccoonShowcase.cs index da0b89d2..4583a699 100644 --- a/TempScriptsFolder/RaccoonShowcase.cs +++ b/TempScriptsFolder/RaccoonShowcase.cs @@ -36,4 +36,10 @@ public class RaccoonShowcase : Script //Transform.LocalRotation = new Vector3(0.0f, rotation, 0.0f); //Transform.LocalScale = new Vector3(System.Math.Abs(System.Math.Sin(scale.x)) * originalScale, System.Math.Abs(System.Math.Cos(scale.y)) * originalScale, System.Math.Abs(System.Math.Sin(scale.z)) * originalScale); } + + protected override void onDrawGizmos() + { + Gizmos.DrawLine(new Vector3(-1.0f, 0.0f, 0.0f), new Vector3(1.0f, 0.0f, 0.0f)); + Gizmos.DrawLine(new Vector3(-1.0f, 1.0f, 0.0f), new Vector3(1.0f, 1.0f, 0.0f), Color.Red); + } } \ No newline at end of file