QuadLightDelegate.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/QuadShapeComponentBus.h>
  13. #include <LmbrCentral/Shape/ShapeComponentBus.h>
  14. #include <Atom/Feature/CoreLights/QuadLightFeatureProcessorInterface.h>
  15. namespace AZ::Render
  16. {
  17. //! Manages rendering a quad light through the quad light feature processor and communication with a quad shape bus for the area light
  18. //! component.
  19. class QuadLightDelegate final : public LightDelegateBase<QuadLightFeatureProcessorInterface>
  20. {
  21. public:
  22. QuadLightDelegate(LmbrCentral::QuadShapeComponentRequests* shapeBus, EntityId entityId, bool isVisible);
  23. // LightDelegateBase overrides...
  24. void SetLightEmitsBothDirections(bool lightEmitsBothDirections) override;
  25. void SetUseFastApproximation(bool useFastApproximation) override;
  26. float GetSurfaceArea() const override;
  27. float GetEffectiveSolidAngle() const override;
  28. float CalculateAttenuationRadius(float lightThreshold) const override;
  29. void DrawDebugDisplay(
  30. const Transform& transform,
  31. const Color& color,
  32. AzFramework::DebugDisplayRequests& debugDisplay,
  33. bool isSelected) const override;
  34. void SetAffectsGI(bool affectsGI) override;
  35. void SetAffectsGIFactor(float affectsGIFactor) override;
  36. Aabb GetLocalVisualizationBounds() const override;
  37. private:
  38. // LightDelegateBase overrides...
  39. void HandleShapeChanged() override;
  40. float GetWidth() const;
  41. float GetHeight() const;
  42. LmbrCentral::QuadShapeComponentRequests* m_shapeBus = nullptr;
  43. };
  44. inline float QuadLightDelegate::GetEffectiveSolidAngle() const
  45. {
  46. return PhotometricValue::DirectionalEffectiveSteradians;
  47. }
  48. } // namespace AZ::Render