LightInspector.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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="Light"/> component.
  12. /// </summary>
  13. [CustomInspector(typeof(Light))]
  14. internal class LightInspector : Inspector
  15. {
  16. /// <inheritdoc/>
  17. protected internal override void Initialize()
  18. {
  19. Light light = (Light)InspectedObject;
  20. drawer.AddDefault(light);
  21. drawer.AddConditional("SpotAngle", () => light.Type == LightType.Spot);
  22. drawer.AddConditional("SpotAngleFalloff", () => light.Type == LightType.Spot);
  23. drawer.AddConditional("AutoAttenuation", () => light.Type != LightType.Directional);
  24. drawer.AddConditional("AttenuationRadius", () =>
  25. {
  26. if (light.Type == LightType.Directional)
  27. return false;
  28. return !light.UseAutoAttenuation;
  29. });
  30. drawer.AddConditional("ShadowBias", () => light.CastsShadow);
  31. }
  32. }
  33. /** @} */
  34. }