CameraInspector.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System.Collections.Generic;
  4. using bs;
  5. namespace bs.Editor
  6. {
  7. /** @addtogroup Inspectors
  8. * @{
  9. */
  10. /// <summary>
  11. /// Renders an inspector for the <see cref="Camera"/> component.
  12. /// </summary>
  13. [CustomInspector(typeof(Camera))]
  14. internal class CameraInspector : Inspector
  15. {
  16. /// <inheritdoc/>
  17. protected internal override void Initialize()
  18. {
  19. Camera camera = (Camera)InspectedObject;
  20. drawer.AddDefault(camera);
  21. drawer.BeginCategory("Viewport");
  22. drawer.AddField("Area", () => camera.Viewport.Area, x => camera.Viewport.Area = x);
  23. drawer.AddField("Clear flags", () => camera.Viewport.ClearFlags, x => camera.Viewport.ClearFlags = x);
  24. drawer.AddField("Clear color", () => camera.Viewport.ClearColor, x => camera.Viewport.ClearColor = x);
  25. drawer.AddField("Clear stencil", () => camera.Viewport.ClearStencil, x => camera.Viewport.ClearStencil = x);
  26. drawer.AddField("Clear depth", () => camera.Viewport.ClearDepth, x => camera.Viewport.ClearDepth = x);
  27. drawer.AddConditional("FieldOfView", () => camera.ProjectionType == ProjectionType.Perspective);
  28. drawer.AddConditional("OrthoHeight", () => camera.ProjectionType == ProjectionType.Orthographic);
  29. drawer.EndCategory();
  30. }
  31. }
  32. /** @} */
  33. }