using System.Runtime.CompilerServices;
using BansheeEngine;
namespace BansheeEditor
{
///
/// Contains various method that can be used for drawing handles. These methods should only be called from
/// method or its overrides.
///
public sealed class HandleDrawing
{
///
/// Determines the color that will be used on any following draw method.
///
public static Color Color
{
set { Internal_SetColor(value); }
}
///
/// Determines the world transform that will be applied to any following draw method.
///
public static Matrix4 Transform
{
set { Internal_SetTransform(value); }
}
///
/// Draws an axis aligned solid cube.
///
/// World coordinates of the center of the cube.
/// Extents defining the half-size of the cube in each dimension.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawCube(Vector3 position, Vector3 extents, float size = 1.0f)
{
Internal_DrawCube(position, extents, size);
}
///
/// Draws a solid sphere.
///
/// World coordinates of the center of the sphere.
/// Sphere radius.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawSphere(Vector3 position, float radius, float size = 1.0f)
{
Internal_DrawSphere(position, radius, size);
}
///
/// Draws an axis aligned wireframe cube.
///
/// World coordinates of the center of the cube.
/// Extents defining the half-size of the cube in each dimension.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawWireCube(Vector3 position, Vector3 extents, float size = 1.0f)
{
Internal_DrawWireCube(position, extents, size);
}
///
/// Draws a wireframe sphere.
///
/// World coordinates of the center of the sphere.
/// Sphere radius.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawWireSphere(Vector3 position, float radius, float size = 1.0f)
{
Internal_DrawWireSphere(position, radius, size);
}
///
/// Draws a solid cone.
///
/// Location of the cone base (center of the cone disc).
/// Normal pointing from the base to the cone point.
/// Distance from the origin to the cone point.
/// Radius of the cone disc.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size = 1.0f)
{
Internal_DrawCone(coneBase, normal, height, radius, size);
}
///
/// Draws a 3D line.
///
/// Starting point for the line.
/// Ending point for the line.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawLine(Vector3 start, Vector3 end, float size = 1.0f)
{
Internal_DrawLine(start, end, size);
}
///
/// Draws a solid double-sided disc.
///
/// Center of the disc.
/// Normal towards which to orient the disc.
/// Radius of the disc.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
{
Internal_DrawDisc(position, normal, radius, size);
}
///
/// Draws a wireframe disc.
///
/// Center of the disc.
/// Normal towards which to orient the disc.
/// Radius of the disc.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
{
Internal_DrawWireDisc(position, normal, radius, size);
}
///
/// Draws a solid double-sided arc.
///
/// Center of the disc out of which the arc is cut out of.
/// Normal towards which to orient the arc.
/// Radius of the disc out of which the arc is cut out of.
/// Angle at which the arc starts.
/// Length of the arc.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
{
Internal_DrawArc(position, normal, radius, startAngle, amountAngle, size);
}
///
/// Draws a wireframe arc.
///
/// Center of the disc out of which the arc is cut out of.
/// Normal towards which to orient the arc.
/// Radius of the disc out of which the arc is cut out of.
/// Angle at which the arc starts.
/// Length of the arc.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
{
Internal_DrawWireArc(position, normal, radius, startAngle, amountAngle, size);
}
///
/// Draws a single-sided rectangle in 3D.
///
/// Determines the position, orientation and size of the rectangle.
/// Uniform scale to apply on top of the existing transform. Primarily used for maintaining
/// handle size regardless of distance from camera.
public static void DrawRect(Rect3 area, float size = 1.0f)
{
Internal_DrawRect(area.Center, area.AxisHorz, area.AxisVert, area.ExtentHorz, area.ExtentVert, size);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetColor(Color color);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetTransform(Matrix4 transform);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawCube(Vector3 position, Vector3 extents, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawSphere(Vector3 position, float radius, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawWireSphere(Vector3 position, float radius, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawLine(Vector3 start, Vector3 end, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_DrawRect(Vector3 center, Vector3 axisH, Vector3 axisV, float extentH, float extentV, float size);
}
}