Updated C# Gizmos class with DrawCube and DrawSphere in

This commit is contained in:
Kah Wei 2022-12-15 23:33:53 +08:00
parent 8978515cb9
commit 77a164cefb
2 changed files with 52 additions and 0 deletions

View File

@ -47,6 +47,26 @@ namespace SHADE
SHDebugDraw::Line(Convert::ToNative(from), Convert::ToNative(to), Convert::ToNative(color)); 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) void Gizmos::DrawWireCube(Vector3 center, Vector3 extents)
{ {
DrawWireCube(center, extents, defaultColor); DrawWireCube(center, extents, defaultColor);

View File

@ -56,6 +56,38 @@ namespace SHADE
/// <param name="color">Colour of the line.</param> /// <param name="color">Colour of the line.</param>
static void DrawLine(Vector3 from, Vector3 to, SHADE::Color color); static void DrawLine(Vector3 from, Vector3 to, SHADE::Color color);
/// <summary> /// <summary>
/// Renders a cube centered around the position specified in world
/// space.
/// Uses <see cref="Gizmos.Color">Color</see> to render.
/// </summary>
/// <param name="center">Position where the cube wil be centered at.</param>
/// <param name="extents">Size of the rendered cube.</param>
static void DrawCube(Vector3 center, Vector3 extents);
/// <summary>
/// Renders a cube centered around the position specified in world
/// space.
/// </summary>
/// <param name="center">Position where the cube wil be centered at.</param>
/// <param name="extents">Size of the rendered cube.</param>
/// <param name="color">Colour of the cube.</param>
static void DrawCube(Vector3 center, Vector3 extents, SHADE::Color color);
/// <summary>
/// Renders a sphere centered around the position specified in world
/// space.
/// Uses <see cref="Gizmos.Color">Color</see> to render.
/// </summary>
/// <param name="center">Position where the sphere wil be centered at.</param>
/// <param name="radius">Radius of the rendered sphere.</param>
static void DrawSphere(Vector3 center, float radius);
/// <summary>
/// Renders a sphere centered around the position specified in world
/// space.
/// </summary>
/// <param name="center">Position where the sphere wil be centered at.</param>
/// <param name="radius">Radius of the rendered sphere.</param>
/// <param name="color">Colour of the sphere.</param>
static void DrawSphere(Vector3 center, float radius, SHADE::Color color);
/// <summary>
/// Renders a wireframe cube centered around the position specified in world /// Renders a wireframe cube centered around the position specified in world
/// space. /// space.
/// Uses <see cref="Gizmos.Color">Color</see> to render. /// Uses <see cref="Gizmos.Color">Color</see> to render.