DecalGizmos.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //************** Copyright (c) 2016-2019 Marko Pintera ([email protected]). All rights reserved. *******************//
  3. using bs;
  4. namespace bs.Editor
  5. {
  6. /** @addtogroup Gizmos
  7. * @{
  8. */
  9. /// <summary>
  10. /// Handles drawing of gizmos for <see cref="Decal"/> component.
  11. /// </summary>
  12. internal class DecalGizmos
  13. {
  14. /// <summary>
  15. /// Draws decal shape gizmo when a decal is selected.
  16. /// </summary>
  17. /// <param name="decal">Decal to draw the gizmos for.</param>
  18. [DrawGizmo(DrawGizmoFlags.Selected)]
  19. private static void Draw(Decal decal)
  20. {
  21. Gizmos.Color = Color.Yellow;
  22. Gizmos.Transform = decal.SceneObject.WorldTransform;
  23. Gizmos.DrawWireCube(
  24. new Vector3(0.0f, 0.0f, -decal.MaxDistance * 0.5f),
  25. new Vector3(decal.Size.x, decal.Size.y, decal.MaxDistance) * 0.5f);
  26. }
  27. /// <summary>
  28. /// Draws decal icon in scene view.
  29. /// </summary>
  30. /// <param name="decal">Decal to draw the icon for.</param>
  31. [DrawGizmo(DrawGizmoFlags.NotSelected | DrawGizmoFlags.Pickable)]
  32. private static void DrawIcon(Decal decal)
  33. {
  34. Gizmos.DrawIcon(decal.SceneObject.Position,
  35. EditorBuiltin.GetSceneViewIcon(SceneViewIcon.Decal), false);
  36. }
  37. }
  38. /** @} */
  39. }