EditorImageBasedLightComponent.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <ImageBasedLights/ImageBasedLightComponent.h>
  10. #include <Atom/Feature/Utils/EditorRenderComponentAdapter.h>
  11. #include <AtomLyIntegration/CommonFeatures/ImageBasedLights/ImageBasedLightComponentConstants.h>
  12. #include <AtomLyIntegration/CommonFeatures/ImageBasedLights/ImageBasedLightComponentBus.h>
  13. namespace AZ
  14. {
  15. namespace Render
  16. {
  17. //! In-editor image based lighting component
  18. class EditorImageBasedLightComponent final
  19. : public EditorRenderComponentAdapter<ImageBasedLightComponentController, ImageBasedLightComponent, ImageBasedLightComponentConfig>
  20. {
  21. public:
  22. using BaseClass = EditorRenderComponentAdapter<ImageBasedLightComponentController, ImageBasedLightComponent, ImageBasedLightComponentConfig>;
  23. AZ_EDITOR_COMPONENT(AZ::Render::EditorImageBasedLightComponent, EditorImageBasedLightComponentTypeId, BaseClass);
  24. static void Reflect(AZ::ReflectContext* context);
  25. EditorImageBasedLightComponent() = default;
  26. EditorImageBasedLightComponent(const ImageBasedLightComponentConfig& config);
  27. // AZ::Component overrides
  28. void Activate() override;
  29. AZ::u32 OnDiffuseImageAssetChanged();
  30. AZ::u32 OnSpecularImageAssetChanged();
  31. AZ::u32 OnExposureChanged();
  32. private:
  33. bool UpdateImageAsset(Data::Asset<RPI::StreamingImageAsset>& asset1, const char* asset1Suffix, const char* asset1Name,
  34. Data::Asset<RPI::StreamingImageAsset>& asset2, const char* asset2Suffix, const char* asset2Name);
  35. Data::Asset<RPI::StreamingImageAsset> m_specularImageAsset;
  36. Data::Asset<RPI::StreamingImageAsset> m_diffuseImageAsset;
  37. float m_exposure = 0.0f;
  38. };
  39. } // namespace Render
  40. } // namespace AZ