DiskLightDelegate.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <CoreLights/LightDelegateBase.h>
  10. #include <AzCore/Component/TransformBus.h>
  11. #include <AzFramework/Entity/EntityDebugDisplayBus.h>
  12. #include <LmbrCentral/Shape/DiskShapeComponentBus.h>
  13. #include <LmbrCentral/Shape/ShapeComponentBus.h>
  14. #include <Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h>
  15. namespace AZ::Render
  16. {
  17. //! Manages rendering a disk light through the disk light feature processor and communication with a disk shape bus for the area light
  18. //! component.
  19. class DiskLightDelegate final : public LightDelegateBase<DiskLightFeatureProcessorInterface>
  20. {
  21. using Base = LightDelegateBase<DiskLightFeatureProcessorInterface>;
  22. public:
  23. DiskLightDelegate(LmbrCentral::DiskShapeComponentRequests* shapeBus, EntityId entityId, bool isVisible);
  24. // LightDelegateBase overrides...
  25. float GetSurfaceArea() const override;
  26. float GetEffectiveSolidAngle() const override;
  27. float CalculateAttenuationRadius(float lightThreshold) const override;
  28. void DrawDebugDisplay(
  29. const Transform& transform,
  30. const Color& color,
  31. AzFramework::DebugDisplayRequests& debugDisplay,
  32. bool isSelected) const override;
  33. void SetEnableShutters(bool enabled) override;
  34. void SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees) override;
  35. void SetEnableShadow(bool enabled) override;
  36. void SetShadowBias(float bias) override;
  37. void SetShadowmapMaxSize(ShadowmapSize size) override;
  38. void SetShadowFilterMethod(ShadowFilterMethod method) override;
  39. void SetFilteringSampleCount(uint32_t count) override;
  40. void SetEsmExponent(float exponent) override;
  41. void SetNormalShadowBias(float bias) override;
  42. void SetShadowCachingMode(AreaLightComponentConfig::ShadowCachingMode cachingMode) override;
  43. void SetAffectsGI(bool affectsGI) override;
  44. void SetAffectsGIFactor(float affectsGIFactor) override;
  45. Aabb GetLocalVisualizationBounds() const override;
  46. private:
  47. // LightDelegateBase overrides...
  48. void HandleShapeChanged() override;
  49. float GetRadius() const;
  50. struct ConeVisualizationDimensions
  51. {
  52. float m_topRadius;
  53. float m_bottomRadius;
  54. float m_height;
  55. };
  56. ConeVisualizationDimensions CalculateConeVisualizationDimensions(float degrees) const;
  57. LmbrCentral::DiskShapeComponentRequests* m_shapeBus = nullptr;
  58. };
  59. inline float DiskLightDelegate::GetEffectiveSolidAngle() const
  60. {
  61. return PhotometricValue::DirectionalEffectiveSteradians;
  62. }
  63. } // namespace AZ::Render