/* * 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 EditorDiffuseProbeGridComponent final : public EditorRenderComponentAdapter , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler , private AzFramework::EntityDebugDisplayEventBus::Handler , private AZ::TickBus::Handler , private AzToolsFramework::EditorEntityInfoNotificationBus::Handler { public: using BaseClass = EditorRenderComponentAdapter; AZ_EDITOR_COMPONENT(AZ::Render::EditorDiffuseProbeGridComponent, EditorDiffuseProbeGridComponentTypeId, BaseClass); static void Reflect(AZ::ReflectContext* context); EditorDiffuseProbeGridComponent(); EditorDiffuseProbeGridComponent(const DiffuseProbeGridComponentConfig& config); // AZ::Component overrides void Activate() override; void Deactivate() override; private: // AZ::TickBus overrides void OnTick(float deltaTime, AZ::ScriptTimePoint time) override; // EditorComponentSelectionRequestsBus overrides AZ::Aabb GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& viewportInfo) override; bool SupportsEditorRayIntersect() override; // EditorEntityInfoNotifications overrides void OnEntityInfoUpdatedVisibility(AZ::EntityId entityId, bool visible) override; // helper functions AZStd::string ValidateOrCreateNewTexturePath(const AZStd::string& relativePath, const char* fileSuffix); void CheckoutSourceTextureFile(const AZStd::string& fullPath); void CheckTextureAssetNotification(const AZStd::string& relativePath, Data::Asset& configurationAsset); // property change notifications AZ::Outcome OnProbeSpacingValidateX(void* newValue, const AZ::Uuid& valueType); AZ::Outcome OnProbeSpacingValidateY(void* newValue, const AZ::Uuid& valueType); AZ::Outcome OnProbeSpacingValidateZ(void* newValue, const AZ::Uuid& valueType); AZ::u32 OnProbeSpacingChanged(); AZ::u32 OnAmbientMultiplierChanged(); AZ::u32 OnViewBiasChanged(); AZ::u32 OnNormalBiasChanged(); AZ::u32 OnEditorModeChanged(); AZ::u32 OnRuntimeModeChanged(); AZ::Outcome OnModeChangeValidate(void* newValue, const AZ::Uuid& valueType); // Button handler AZ::u32 BakeDiffuseProbeGrid(); AZ::u32 GetBakeDiffuseProbeGridVisibilitySetting(); // properties float m_probeSpacingX = DefaultDiffuseProbeGridSpacing; float m_probeSpacingY = DefaultDiffuseProbeGridSpacing; float m_probeSpacingZ = DefaultDiffuseProbeGridSpacing; float m_ambientMultiplier = DefaultDiffuseProbeGridAmbientMultiplier; float m_viewBias = DefaultDiffuseProbeGridViewBias; float m_normalBias = DefaultDiffuseProbeGridNormalBias; DiffuseProbeGridMode m_editorMode = DiffuseProbeGridMode::RealTime; DiffuseProbeGridMode m_runtimeMode = DiffuseProbeGridMode::RealTime; // flags bool m_editorModeSet = false; AZStd::atomic_bool m_bakeInProgress = false; }; } // namespace Render } // namespace AZ