CubeMapCaptureComponentController.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 <AzCore/Component/TransformBus.h>
  10. #include <Atom/Feature/CubeMapCapture/CubeMapCaptureFeatureProcessorInterface.h>
  11. #include <CubeMapCapture/EditorCubeMapRenderer.h>
  12. #include <CubeMapCapture/CubeMapCaptureComponentConstants.h>
  13. namespace AZ
  14. {
  15. namespace Render
  16. {
  17. class CubeMapCaptureComponentConfig final
  18. : public AZ::ComponentConfig
  19. {
  20. public:
  21. AZ_RTTI(AZ::Render::CubeMapCaptureComponentConfig, "{3DA089D0-E0D0-4F00-B76E-EC28CFE41547}", ComponentConfig);
  22. AZ_CLASS_ALLOCATOR(CubeMapCaptureComponentConfig, SystemAllocator);
  23. static void Reflect(AZ::ReflectContext* context);
  24. CubeMapCaptureType m_captureType = CubeMapCaptureType::Specular;
  25. CubeMapSpecularQualityLevel m_specularQualityLevel = CubeMapSpecularQualityLevel::Medium;
  26. AZStd::string m_relativePath;
  27. float m_exposure = 0.0f;
  28. AZ::u32 OnCaptureTypeChanged();
  29. AZ::u32 GetSpecularQualityVisibilitySetting() const;
  30. AZ::u32 OnSpecularQualityChanged();
  31. };
  32. class CubeMapCaptureComponentController final
  33. : private TransformNotificationBus::Handler
  34. {
  35. public:
  36. friend class EditorCubeMapCaptureComponent;
  37. AZ_CLASS_ALLOCATOR(CubeMapCaptureComponentController, AZ::SystemAllocator);
  38. AZ_RTTI(AZ::Render::CubeMapCaptureComponentController, "{85156008-28A0-4F7B-BC16-0311682E14D7}");
  39. static void Reflect(AZ::ReflectContext* context);
  40. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  41. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  42. CubeMapCaptureComponentController() = default;
  43. CubeMapCaptureComponentController(const CubeMapCaptureComponentConfig& config);
  44. void Activate(AZ::EntityId entityId);
  45. void Deactivate();
  46. void SetConfiguration(const CubeMapCaptureComponentConfig& config);
  47. const CubeMapCaptureComponentConfig& GetConfiguration() const;
  48. // set the exposure to use when building the cubemap
  49. void SetExposure(float bakeExposure);
  50. // initiate the cubemap capture, invokes callback when complete
  51. void RenderCubeMap(RenderCubeMapCallback callback, const AZStd::string& relativePath);
  52. private:
  53. AZ_DISABLE_COPY(CubeMapCaptureComponentController);
  54. // TransformNotificationBus overrides ...
  55. void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
  56. CubeMapCaptureFeatureProcessorInterface* m_featureProcessor = nullptr;
  57. TransformInterface* m_transformInterface = nullptr;
  58. AZ::EntityId m_entityId;
  59. CubeMapCaptureComponentConfig m_configuration;
  60. CubeMapCaptureHandle m_handle;
  61. };
  62. } // namespace Render
  63. } // namespace AZ