CameraGizmo.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2017 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="Camera"/> component.
  11. /// </summary>
  12. internal class CameraGizmo
  13. {
  14. /// <summary>
  15. /// Method called by the runtime when gizmos are meant to be drawn.
  16. /// </summary>
  17. /// <param name="camera">Camera to draw gizmos for.</param>
  18. [DrawGizmo(DrawGizmoFlags.Selected)]
  19. private static void Draw(Camera camera)
  20. {
  21. SceneObject so = camera.SceneObject;
  22. Gizmos.Color = Color.Yellow;
  23. Gizmos.Transform = Matrix4.TRS(so.Position, Quaternion.LookRotation(so.Rotation.Forward, so.Rotation.Up), Vector3.One);
  24. Gizmos.DrawFrustum(Vector3.Zero, camera.AspectRatio, camera.FieldOfView, camera.NearClipPlane,
  25. camera.FarClipPlane);
  26. }
  27. }
  28. /** @} */
  29. }