/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once #include #include #include #include #include #include #include namespace AZ { namespace Render { class EditorReflectionProbeComponent final : public EditorRenderComponentAdapter , public EditorReflectionProbeBus::Handler , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler , private AzFramework::EntityDebugDisplayEventBus::Handler { public: using BaseClass = EditorRenderComponentAdapter; AZ_EDITOR_COMPONENT(AZ::Render::EditorReflectionProbeComponent, EditorReflectionProbeComponentTypeId, BaseClass); static void Reflect(AZ::ReflectContext* context); EditorReflectionProbeComponent() = default; EditorReflectionProbeComponent(const ReflectionProbeComponentConfig& config); // AZ::Component overrides void Activate() override; void Deactivate() override; // AzFramework::EntityDebugDisplayEventBus::Handler overrides void DisplayEntityViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override; private: // validation AZ::Outcome OnUseBakedCubemapValidate(void* newValue, const AZ::Uuid& valueType); // change notifications AZ::u32 OnUseBakedCubemapChanged(); AZ::u32 OnAuthoredCubemapChanged(); // retrieves visibility for baked or authored cubemap controls AZ::u32 GetBakedCubemapVisibilitySetting(); AZ::u32 GetAuthoredCubemapVisibilitySetting(); // initiate the reflection probe cubemap generation, returns the refresh value for the ChangeNotify UIElement attribute AZ::u32 BakeReflectionProbe() override; // save the cubemap data to the output file void WriteOutputFile(AZStd::string filePath, uint8_t* const* cubeMapTextureData, RHI::Format cubeMapTextureFormat); // EditorComponentSelectionRequestsBus overrides AZ::Aabb GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& viewportInfo) override; bool SupportsEditorRayIntersect() override; // UI settings // the user can select between a baked cubemap or an authored cubemap asset bool m_useBakedCubemap = true; AZStd::string m_bakedCubeMapRelativePath; Data::Asset m_bakedCubeMapAsset; Data::Asset m_authoredCubeMapAsset; // flag indicating if a cubemap bake is currently in progress AZStd::atomic_bool m_bakeInProgress = false; }; } // namespace Render } // namespace AZ