PolygonLightDelegate.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/PolygonPrismShapeComponentBus.h>
  13. #include <LmbrCentral/Shape/ShapeComponentBus.h>
  14. #include <Atom/Feature/CoreLights/PolygonLightFeatureProcessorInterface.h>
  15. namespace AZ::Render
  16. {
  17. //! Manages rendering a Polygon light through the Polygon light feature processor and communication with a Polygon shape bus for the
  18. //! area light component.
  19. class PolygonLightDelegate final : public LightDelegateBase<PolygonLightFeatureProcessorInterface>
  20. {
  21. public:
  22. PolygonLightDelegate(LmbrCentral::PolygonPrismShapeComponentRequests* shapeBus, EntityId entityId, bool isVisible);
  23. // LightDelegateBase overrides...
  24. void SetLightEmitsBothDirections(bool lightEmitsBothDirections) override;
  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. Aabb GetLocalVisualizationBounds() const override;
  34. private:
  35. // LightDelegateBase overrides...
  36. void HandleShapeChanged() override;
  37. LmbrCentral::PolygonPrismShapeComponentRequests* m_shapeBus = nullptr;
  38. };
  39. inline float PolygonLightDelegate::GetEffectiveSolidAngle() const
  40. {
  41. return PhotometricValue::DirectionalEffectiveSteradians;
  42. }
  43. } // namespace AZ::Render