Gizmos.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System.Runtime.CompilerServices;
  2. using BansheeEngine;
  3. namespace BansheeEditor
  4. {
  5. public class Gizmos
  6. {
  7. private static Color _color;
  8. private static Matrix4 _transform;
  9. public static Color color
  10. {
  11. get { return _color; }
  12. set { _color = value; Internal_SetColor(_color); }
  13. }
  14. public static Matrix4 transform
  15. {
  16. get { return _transform; }
  17. set { _transform = value; Internal_SetTransform(_transform); }
  18. }
  19. public static void DrawCube(Vector3 position, Vector3 extents)
  20. {
  21. Internal_DrawCube(position, extents);
  22. }
  23. public static void DrawSphere(Vector3 position, float radius)
  24. {
  25. Internal_DrawSphere(position, radius);
  26. }
  27. public static void DrawWireCube(Vector3 position, Vector3 extents)
  28. {
  29. Internal_DrawWireCube(position, extents);
  30. }
  31. public static void DrawWireSphere(Vector3 position, float radius)
  32. {
  33. Internal_DrawWireSphere(position, radius);
  34. }
  35. public static void DrawLine(Vector3 start, Vector3 end)
  36. {
  37. Internal_DrawLine(start, end);
  38. }
  39. public static void DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
  40. {
  41. Internal_DrawFrustum(position, aspect, FOV, near, far);
  42. }
  43. public static void DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale)
  44. {
  45. Internal_DrawIcon(position, image, fixedScale);
  46. }
  47. [MethodImpl(MethodImplOptions.InternalCall)]
  48. private static extern void Internal_SetColor(Color color);
  49. [MethodImpl(MethodImplOptions.InternalCall)]
  50. private static extern void Internal_SetTransform(Matrix4 transform);
  51. [MethodImpl(MethodImplOptions.InternalCall)]
  52. private static extern void Internal_DrawCube(Vector3 position, Vector3 extents);
  53. [MethodImpl(MethodImplOptions.InternalCall)]
  54. private static extern void Internal_DrawSphere(Vector3 position, float radius);
  55. [MethodImpl(MethodImplOptions.InternalCall)]
  56. private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents);
  57. [MethodImpl(MethodImplOptions.InternalCall)]
  58. private static extern void Internal_DrawWireSphere(Vector3 position, float radius);
  59. [MethodImpl(MethodImplOptions.InternalCall)]
  60. private static extern void Internal_DrawLine(Vector3 start, Vector3 end);
  61. [MethodImpl(MethodImplOptions.InternalCall)]
  62. private static extern void Internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far);
  63. [MethodImpl(MethodImplOptions.InternalCall)]
  64. private static extern void Internal_DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale);
  65. }
  66. }