ReflectionProbeGizmo.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. /** @addtogroup Gizmos
  7. * @{
  8. */
  9. /// <summary>
  10. /// Handles drawing of gizmos for the <see cref="ReflectionProbe"/> component.
  11. /// </summary>
  12. internal class ReflectionProbeGizmos
  13. {
  14. /// <summary>
  15. /// Method called by the runtime when gizmos are meant to be drawn.
  16. /// </summary>
  17. /// <param name="reflProbe">Reflection probe to draw gizmos for.</param>
  18. [DrawGizmo(DrawGizmoFlags.Selected)]
  19. private static void Draw(ReflectionProbe reflProbe)
  20. {
  21. Vector3 position = reflProbe.SceneObject.Position;
  22. Gizmos.Color = Color.Yellow;
  23. switch (reflProbe.Type)
  24. {
  25. case ReflectionProbeType.Box:
  26. SceneObject so = reflProbe.SceneObject;
  27. Gizmos.Transform = Matrix4.TRS(so.Position, so.Rotation, Vector3.One);
  28. Vector3 scaledExtents = reflProbe.Extents * so.Scale;
  29. Gizmos.DrawWireCube(Vector3.Zero, scaledExtents);
  30. break;
  31. case ReflectionProbeType.Sphere:
  32. Gizmos.DrawWireSphere(position, reflProbe.Radius);
  33. break;
  34. }
  35. }
  36. }
  37. /** @} */
  38. }