Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/Bloom/BloomComponent.h>
namespace AZ
{
namespace Render
{
BloomComponent::BloomComponent(const BloomComponentConfig& config)
: BaseClass(config)
{
}
void BloomComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<BloomComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<BloomComponent>()->RequestBus("BloomRequestBus");
behaviorContext->ConstantProperty("BloomComponentTypeId", BehaviorConstant(Uuid(Bloom::BloomComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,43 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Bloom/BloomComponentConfig.h>
#include <Atom/Feature/PostProcess/Bloom/BloomConstants.h>
#include <PostProcess/Bloom/BloomComponentController.h>
namespace AZ
{
namespace Render
{
namespace Bloom
{
static constexpr const char* const BloomComponentTypeId = "{0D38705D-525D-4BA7-A805-26E3E9093F54}";
}
class BloomComponent final
: public AzFramework::Components::ComponentAdapter<BloomComponentController, BloomComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<BloomComponentController, BloomComponentConfig>;
AZ_COMPONENT(AZ::Render::BloomComponent, Bloom::BloomComponentTypeId, BaseClass);
BloomComponent() = default;
BloomComponent(const BloomComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,67 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/Bloom/BloomComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void BloomComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<BloomComponentConfig, ComponentConfig>()
->Version(0)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS BloomComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void BloomComponentConfig::CopySettingsFrom(BloomSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_SOURCE settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsFrom.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_SOURCE
}
void BloomComponentConfig::CopySettingsTo(BloomSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,167 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/Bloom/BloomComponentController.h>
namespace AZ
{
namespace Render
{
void BloomComponentController::Reflect(ReflectContext* context)
{
BloomComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<BloomComponentController>()
->Version(0)
->Field("Configuration", &BloomComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<BloomRequestBus>("BloomRequestBus")
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
// Auto-gen behavior context...
#define PARAM_EVENT_BUS BloomRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void BloomComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("BloomService"));
}
void BloomComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("BloomService"));
}
void BloomComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
BloomComponentController::BloomComponentController(const BloomComponentConfig& config)
: m_configuration(config)
{
}
void BloomComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostProcessFeatureProcessorInterface* fp = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (fp)
{
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
if (m_postProcessInterface)
{
m_settingsInterface = m_postProcessInterface->GetOrCreateBloomSettingsInterface();
OnConfigChanged();
}
}
BloomRequestBus::Handler::BusConnect(m_entityId);
}
void BloomComponentController::Deactivate()
{
BloomRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveBloomSettingsInterface();
}
m_postProcessInterface = nullptr;
m_settingsInterface = nullptr;
m_entityId.SetInvalid();
}
// Getters & Setters...
void BloomComponentController::SetConfiguration(const BloomComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const BloomComponentConfig& BloomComponentController::GetConfiguration() const
{
return m_configuration;
}
void BloomComponentController::OnConfigChanged()
{
if (m_settingsInterface)
{
m_configuration.CopySettingsTo(m_settingsInterface);
m_settingsInterface->OnConfigChanged();
}
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
ValueType BloomComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void BloomComponentController::Set##Name(ValueType val) \
{ \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name(val); \
m_settingsInterface->OnConfigChanged(); \
m_configuration.MemberName = m_settingsInterface->Get##Name(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
OverrideValueType BloomComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void BloomComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName##Override = val; \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name##Override(val); \
m_settingsInterface->OnConfigChanged(); \
} \
} \
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,66 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Bloom/BloomBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Bloom/BloomComponentConfig.h>
#include <Atom/Feature/PostProcess/Bloom/BloomConstants.h>
#include <Atom/Feature/PostProcess/Bloom/BloomSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
namespace AZ
{
namespace Render
{
class BloomComponentController final
: public BloomRequestBus::Handler
{
public:
friend class EditorBloomComponent;
AZ_TYPE_INFO(AZ::Render::BloomComponentController, "{502896C1-FF04-4BA7-833B-BA80946FA0DD}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
BloomComponentController() = default;
BloomComponentController(const BloomComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const BloomComponentConfig& config);
const BloomComponentConfig& GetConfiguration() const;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(BloomComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
BloomSettingsInterface* m_settingsInterface = nullptr;
BloomComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,177 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/Bloom/EditorBloomComponent.h>
namespace AZ
{
namespace Render
{
void EditorBloomComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorBloomComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorBloomComponent>(
"Bloom", "Controls the Bloom")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [TODO ATOM-2672][PostFX] need create page for PostProcessing.
;
editContext->Class<BloomComponentController>(
"ExposureControlComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &BloomComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<BloomComponentConfig>("BloomComponentConfig", "")
->DataElement(Edit::UIHandlers::CheckBox,
&BloomComponentConfig::m_enabled,
"Enable Bloom",
"Enable Bloom.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(AZ::Edit::UIHandlers::Default, &BloomComponentConfig::m_threshold, "Threshold", "How bright is the light source bloom applied to ")
->Attribute(AZ::Edit::Attributes::Min, 0.0)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_knee, "Knee", "Soft knee to smoothen edge of threshold")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Default, &BloomComponentConfig::m_intensity, "Intensity", "Brightness of bloom")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::CheckBox, &BloomComponentConfig::m_enableBicubic, "Enable Bicubic", "Enable bicubic filter for upsampling")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
// Kernel sizes
->ClassElement(AZ::Edit::ClassElements::Group, "Kernel Size")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeScale,
"Kernel Size Scale", "Global scaling factor of kernel size")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 2.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify,
Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeStage0, "Kernel Size 0", "Kernel size for blur stage 0 in percent of screen width")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeStage1, "Kernel Size 1", "Kernel size for blur stage 1 in percent of screen width")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeStage2, "Kernel Size 2", "Kernel size for blur stage 2 in percent of screen width")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeStage3, "Kernel Size 3", "Kernel size for blur stage 3 in percent of screen width")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &BloomComponentConfig::m_kernelSizeStage4, "Kernel Size 4", "Kernel size for blur stage 4 in percent of screen width")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
// Tints
->ClassElement(AZ::Edit::ClassElements::Group, "Tint")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
->DataElement(AZ::Edit::UIHandlers::Color, &BloomComponentConfig::m_tintStage0, "Tint 0", "Tint for blur stage 0")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Color, &BloomComponentConfig::m_tintStage1, "Tint 1", "Tint for blur stage 1")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Color, &BloomComponentConfig::m_tintStage2, "Tint 2", "Tint for blur stage 2")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Color, &BloomComponentConfig::m_tintStage3, "Tint 3", "Tint for blur stage 3")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Color, &BloomComponentConfig::m_tintStage4, "Tint 4", "Tint for blur stage 4")
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &BloomComponentConfig::ArePropertiesReadOnly)
// Overrides
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
// Auto-gen editor context settings for overrides
#define EDITOR_CLASS BloomComponentConfig
#include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
#include <Atom/Feature/PostProcess/Bloom/BloomParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef EDITOR_CLASS
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorBloomComponent>()->RequestBus("BloomRequestBus");
behaviorContext->ConstantProperty("EditorBloomComponentTypeId", BehaviorConstant(Uuid(Bloom::EditorBloomComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorBloomComponent::EditorBloomComponent(const BloomComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorBloomComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,47 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldConstants.h>
#include <PostProcess/Bloom/BloomComponent.h>
namespace AZ
{
namespace Render
{
namespace Bloom
{
static constexpr const char* const EditorBloomComponentTypeId =
"{33789179-AB9C-4891-9DA3-1972EAED6719}";
}
class EditorBloomComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<BloomComponentController, BloomComponent, BloomComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<BloomComponentController, BloomComponent, BloomComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorBloomComponent, Bloom::EditorBloomComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorBloomComponent() = default;
EditorBloomComponent(const BloomComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/DepthOfField/DepthOfFieldComponent.h>
namespace AZ
{
namespace Render
{
DepthOfFieldComponent::DepthOfFieldComponent(const DepthOfFieldComponentConfig& config)
: BaseClass(config)
{
}
void DepthOfFieldComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<DepthOfFieldComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<DepthOfFieldComponent>()->RequestBus("DepthOfFieldRequestBus");
behaviorContext->ConstantProperty("DepthOfFieldComponentTypeId", BehaviorConstant(Uuid(DepthOfField::DepthOfFieldComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,43 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DepthOfField/DepthOfFieldComponentConfig.h>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldConstants.h>
#include <PostProcess/DepthOfField/DepthOfFieldComponentController.h>
namespace AZ
{
namespace Render
{
namespace DepthOfField
{
static constexpr const char* const DepthOfFieldComponentTypeId = "{405F505B-D900-461F-A17D-380C294BEE39}";
}
class DepthOfFieldComponent final
: public AzFramework::Components::ComponentAdapter<DepthOfFieldComponentController, DepthOfFieldComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<DepthOfFieldComponentController, DepthOfFieldComponentConfig>;
AZ_COMPONENT(AZ::Render::DepthOfFieldComponent, DepthOfField::DepthOfFieldComponentTypeId , BaseClass);
DepthOfFieldComponent() = default;
DepthOfFieldComponent(const DepthOfFieldComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,67 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/DepthOfField/DepthOfFieldComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void DepthOfFieldComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<DepthOfFieldComponentConfig, ComponentConfig>()
->Version(0)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS DepthOfFieldComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void DepthOfFieldComponentConfig::CopySettingsFrom(DepthOfFieldSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_SOURCE settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsFrom.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_SOURCE
}
void DepthOfFieldComponentConfig::CopySettingsTo(DepthOfFieldSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,173 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/DepthOfField/DepthOfFieldComponentController.h>
namespace AZ
{
namespace Render
{
void DepthOfFieldComponentController::Reflect(ReflectContext* context)
{
DepthOfFieldComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<DepthOfFieldComponentController>()
->Version(0)
->Field("Configuration", &DepthOfFieldComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<DepthOfFieldRequestBus>("DepthOfFieldRequestBus")
// Auto-gen behavior context...
#define PARAM_EVENT_BUS DepthOfFieldRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void DepthOfFieldComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("DepthOfFieldService"));
}
void DepthOfFieldComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("DepthOfFieldService"));
}
void DepthOfFieldComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
DepthOfFieldComponentController::DepthOfFieldComponentController(const DepthOfFieldComponentConfig& config)
: m_configuration(config)
{
}
void DepthOfFieldComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostProcessFeatureProcessorInterface* fp = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (fp)
{
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
if (m_postProcessInterface)
{
m_depthOfFieldSettingsInterface = m_postProcessInterface->GetOrCreateDepthOfFieldSettingsInterface();
OnConfigChanged();
}
}
DepthOfFieldRequestBus::Handler::BusConnect(m_entityId);
}
void DepthOfFieldComponentController::Deactivate()
{
DepthOfFieldRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveDepthOfFieldSettingsInterface();
}
m_postProcessInterface = nullptr;
m_depthOfFieldSettingsInterface = nullptr;
m_entityId.SetInvalid();
}
// Getters & Setters...
void DepthOfFieldComponentController::SetConfiguration(const DepthOfFieldComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const DepthOfFieldComponentConfig& DepthOfFieldComponentController::GetConfiguration() const
{
return m_configuration;
}
void DepthOfFieldComponentController::OnConfigChanged()
{
if (m_depthOfFieldSettingsInterface)
{
m_configuration.CopySettingsTo(m_depthOfFieldSettingsInterface);
m_depthOfFieldSettingsInterface->OnConfigChanged();
UpdateInferredParams();
}
}
void DepthOfFieldComponentController::UpdateInferredParams()
{
m_configuration.m_fNumber = m_depthOfFieldSettingsInterface->GetFNumber();
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
ValueType DepthOfFieldComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void DepthOfFieldComponentController::Set##Name(ValueType val) \
{ \
if(m_depthOfFieldSettingsInterface) \
{ \
m_depthOfFieldSettingsInterface->Set##Name(val); \
m_depthOfFieldSettingsInterface->OnConfigChanged(); \
m_configuration.MemberName = m_depthOfFieldSettingsInterface->Get##Name(); \
UpdateInferredParams(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
OverrideValueType DepthOfFieldComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void DepthOfFieldComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName##Override = val; \
if(m_depthOfFieldSettingsInterface) \
{ \
m_depthOfFieldSettingsInterface->Set##Name##Override(val); \
m_depthOfFieldSettingsInterface->OnConfigChanged(); \
} \
} \
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,68 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DepthOfField/DepthOfFieldBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DepthOfField/DepthOfFieldComponentConfig.h>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
namespace AZ
{
namespace Render
{
class DepthOfFieldComponentController final
: public DepthOfFieldRequestBus::Handler
{
public:
friend class EditorDepthOfFieldComponent;
AZ_TYPE_INFO(AZ::Render::DepthOfFieldComponentController, "{D0E1675C-7E6F-472D-B037-E0D7ED5AFBE8}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
DepthOfFieldComponentController() = default;
DepthOfFieldComponentController(const DepthOfFieldComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const DepthOfFieldComponentConfig& config);
const DepthOfFieldComponentConfig& GetConfiguration() const;
// Updates members that are inferred from the values of other parameters
void UpdateInferredParams();
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(DepthOfFieldComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
DepthOfFieldSettingsInterface* m_depthOfFieldSettingsInterface = nullptr;
DepthOfFieldComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,197 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/DepthOfField/EditorDepthOfFieldComponent.h>
namespace AZ
{
namespace Render
{
void EditorDepthOfFieldComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorDepthOfFieldComponent, BaseClass>()
->Version(2);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorDepthOfFieldComponent>(
"DepthOfField", "Controls the Depth of Field.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.y
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [GFX TODO][ATOM-2672][PostFX] need create page for PostProcessing.
;
editContext->Class<DepthOfFieldComponentController>(
"DepthOfFieldComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &DepthOfFieldComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<DepthOfFieldComponentConfig>("DepthOfFieldComponentConfig", "")
->ClassElement(Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::EntityId,
&DepthOfFieldComponentConfig::m_cameraEntityId,
"Camera Entity",
"Camera entity. Required by Depth of Field.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::AttributesAndValues)
->DataElement(Edit::UIHandlers::CheckBox,
&DepthOfFieldComponentConfig::m_enabled,
"Enable Depth of Field",
"Enable Depth of Field.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsCameraEntityInvalid)
->DataElement(Edit::UIHandlers::Slider, &DepthOfFieldComponentConfig::m_qualityLevel,
"Quality Level",
"0 : Standard Bokeh blur.\n"
"1 : High quality Bokeh blur (large number of sample)")
->Attribute(Edit::Attributes::Min, 0)
->Attribute(Edit::Attributes::Max, DepthOfField::QualityLevelMax - 1)
->Attribute(Edit::Attributes::Step, 1)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::ArePropertiesReadOnly)
->DataElement(Edit::UIHandlers::Slider, &DepthOfFieldComponentConfig::m_apertureF,
"Aperture F",
"The higher the value, the larger the opening.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::ArePropertiesReadOnly)
->DataElement(Edit::UIHandlers::Default, &DepthOfFieldComponentConfig::m_fNumber,
"F Number",
"")
->Attribute(Edit::Attributes::ReadOnly, true)
->DataElement(Edit::UIHandlers::Default, &DepthOfFieldComponentConfig::m_focusDistance,
"Focus Distance",
"The distance from the camera to the focused subject.")
->Attribute(Edit::Attributes::Suffix, " m")
->Attribute(Edit::Attributes::Step, 1.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsFocusDistanceReadOnly)
// Auto Focus
->ClassElement(AZ::Edit::ClassElements::Group, "Auto Focus")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(Edit::UIHandlers::CheckBox,
&DepthOfFieldComponentConfig::m_enableAutoFocus,
"Enable Auto Focus",
"Enables auto focus.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::AttributesAndValues)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::ArePropertiesReadOnly)
->DataElement(Edit::UIHandlers::Default, &DepthOfFieldComponentConfig::m_autoFocusScreenPosition,
"Focus Screen Position",
"Values of the focus position on screen.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsAutoFocusReadOnly)
->DataElement(Edit::UIHandlers::Slider, &DepthOfFieldComponentConfig::m_autoFocusSensitivity,
"Auto Focus Sensitivity",
"Higher value is more responsive.\n"
"Lower value require a greater difference in depth before refocusing.\n"
"Always responds when the value is 1.0.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsAutoFocusReadOnly)
->DataElement(Edit::UIHandlers::Slider, &DepthOfFieldComponentConfig::m_autoFocusSpeed,
"Auto Focus Speed",
"Specify the distance that focus moves per second,\n"
"normalizing the distance from view near to view far as 1.0.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, DepthOfField::AutoFocusSpeedMax)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsAutoFocusReadOnly)
->DataElement(Edit::UIHandlers::Slider, &DepthOfFieldComponentConfig::m_autoFocusDelay,
"Auto Focus Delay",
"Specifies a delay time for focus to shift from one to another target.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, DepthOfField::AutoFocusDelayMax)
->Attribute(AZ::Edit::Attributes::Suffix, "[s]")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DepthOfFieldComponentConfig::IsAutoFocusReadOnly)
// Debugging
->ClassElement(AZ::Edit::ClassElements::Group, "Debugging")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
->DataElement(Edit::UIHandlers::CheckBox,
&DepthOfFieldComponentConfig::m_enableDebugColoring,
"Enable Debug Color",
"Enable coloring to see Depth of Field level\n"
"Red - Back large blur\n"
"Orange - Back middle blur\n"
"Yellow - Back small blur\n"
"Green - Focus area\n"
"Blue green - Front small blur\n"
"Blue - Front middle blur\n"
"Purple - Front large blur")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
// Overrides
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
// Auto-gen editor context settings for overrides
#define EDITOR_CLASS DepthOfFieldComponentConfig
#include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef EDITOR_CLASS
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorDepthOfFieldComponent>()->RequestBus("DepthOfFieldRequestBus");
behaviorContext->ConstantProperty("EditorDepthOfFieldComponentTypeId", BehaviorConstant(Uuid(DepthOfField::EditorDepthOfFieldComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorDepthOfFieldComponent::EditorDepthOfFieldComponent(const DepthOfFieldComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorDepthOfFieldComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,46 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <Atom/Feature/PostProcess/DepthOfField/DepthOfFieldConstants.h>
#include <PostProcess/DepthOfField/DepthOfFieldComponent.h>
namespace AZ
{
namespace Render
{
namespace DepthOfField
{
static constexpr const char* const EditorDepthOfFieldComponentTypeId = "{E9B85017-18F3-4CD6-9EEC-221B0E6B0619}";
}
class EditorDepthOfFieldComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<DepthOfFieldComponentController, DepthOfFieldComponent, DepthOfFieldComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<DepthOfFieldComponentController, DepthOfFieldComponent, DepthOfFieldComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorDepthOfFieldComponent, DepthOfField::EditorDepthOfFieldComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorDepthOfFieldComponent() = default;
EditorDepthOfFieldComponent(const DepthOfFieldComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,44 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/DisplayMapper/DisplayMapperComponent.h>
namespace AZ
{
namespace Render
{
DisplayMapperComponent::DisplayMapperComponent(const DisplayMapperComponentConfig& config)
: BaseClass(config)
{
}
void DisplayMapperComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<DisplayMapperComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->ConstantProperty("DisplayMapperComponentTypeId", BehaviorConstant(Uuid(DisplayMapperComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,38 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DisplayMapper/DisplayMapperComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DisplayMapper/DisplayMapperComponentConstants.h>
#include <PostProcess/DisplayMapper/DisplayMapperComponentController.h>
namespace AZ
{
namespace Render
{
class DisplayMapperComponent final
: public AzFramework::Components::ComponentAdapter<DisplayMapperComponentController, DisplayMapperComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<DisplayMapperComponentController, DisplayMapperComponentConfig>;
AZ_COMPONENT(AZ::Render::DisplayMapperComponent, DisplayMapperComponentTypeId , BaseClass);
DisplayMapperComponent() = default;
DisplayMapperComponent(const DisplayMapperComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,35 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/DisplayMapper/DisplayMapperComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void DisplayMapperComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<DisplayMapperComponentConfig, ComponentConfig>()
->Version(0)
->Field("DisplayMapperOperationType", &DisplayMapperComponentConfig::m_displayMapperOperation)
->Field("LdrColorGradingLutEnabled", &DisplayMapperComponentConfig::m_ldrColorGradingLutEnabled)
->Field("LdrColorGradingLut", &DisplayMapperComponentConfig::m_ldrColorGradingLut)
;
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,92 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/DisplayMapper/DisplayMapperComponentController.h>
#include <Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h>
#include <Atom/Feature/DisplayMapper/DisplayMapperConfigurationDescriptor.h>
namespace AZ
{
namespace Render
{
void DisplayMapperComponentController::Reflect(ReflectContext* context)
{
DisplayMapperComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<DisplayMapperComponentController>()
->Version(0)
->Field("Configuration", &DisplayMapperComponentController::m_configuration);
}
}
void DisplayMapperComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("ToneMapperService", 0xb8f814e8));
}
void DisplayMapperComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC("ToneMapperService", 0xb8f814e8));
}
void DisplayMapperComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
AZ_UNUSED(required);
}
DisplayMapperComponentController::DisplayMapperComponentController(const DisplayMapperComponentConfig& config)
: m_configuration(config)
{
}
void DisplayMapperComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
}
void DisplayMapperComponentController::Deactivate()
{
m_postProcessInterface = nullptr;
m_entityId.SetInvalid();
}
void DisplayMapperComponentController::SetConfiguration(const DisplayMapperComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const DisplayMapperComponentConfig& DisplayMapperComponentController::GetConfiguration() const
{
return m_configuration;
}
void DisplayMapperComponentController::OnConfigChanged()
{
// Register the configuration with the AcesDisplayMapperFeatureProcessor for this scene.
const AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
DisplayMapperFeatureProcessorInterface* fp = scene->GetFeatureProcessor<DisplayMapperFeatureProcessorInterface>();
DisplayMapperConfigurationDescriptor desc;
desc.m_operationType = m_configuration.m_displayMapperOperation;
desc.m_ldrGradingLutEnabled = m_configuration.m_ldrColorGradingLutEnabled;
desc.m_ldrColorGradingLut = m_configuration.m_ldrColorGradingLut;
fp->RegisterDisplayMapperConfiguration(desc);
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,56 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/DisplayMapper/DisplayMapperComponentConfig.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
namespace AZ
{
namespace Render
{
class DisplayMapperComponentController final
{
public:
friend class EditorDisplayMapperComponent;
AZ_TYPE_INFO(AZ::Render::DisplayMapperComponentController, "{85E5AE10-68AD-462D-B389-B8748BB1A19C}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
DisplayMapperComponentController() = default;
DisplayMapperComponentController(const DisplayMapperComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const DisplayMapperComponentConfig& config);
const DisplayMapperComponentConfig& GetConfiguration() const;
private:
AZ_DISABLE_COPY(DisplayMapperComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
DisplayMapperComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,90 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/DisplayMapper/EditorDisplayMapperComponent.h>
namespace AZ
{
namespace Render
{
void EditorDisplayMapperComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorDisplayMapperComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorDisplayMapperComponent>(
"Display Mapper", "The display mapper applying on the look modification process.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO][ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO][ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZStd::vector<AZ::Crc32>({ AZ_CRC("Level", 0x9aeacc13), AZ_CRC("Game", 0x232b318c) }))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [GFX TODO][ATOM-2672][PostFX] need to create page for PostProcessing.
;
editContext->Class<DisplayMapperComponentController>(
"ToneMapperComponentControl", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &DisplayMapperComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<DisplayMapperComponentConfig>("ToneMapperComponentConfig", "")
->ClassElement(Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::ComboBox,
&DisplayMapperComponentConfig::m_displayMapperOperation,
"Type",
"Display Mapper Type.")
->EnumAttribute(DisplayMapperOperationType::Aces, "Aces")
->EnumAttribute(DisplayMapperOperationType::AcesLut, "AcesLut")
->EnumAttribute(DisplayMapperOperationType::Passthrough, "Passthrough")
->EnumAttribute(DisplayMapperOperationType::GammaSRGB, "GammaSRGB")
->EnumAttribute(DisplayMapperOperationType::Reinhard, "Reinhard")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(Edit::UIHandlers::CheckBox,
&DisplayMapperComponentConfig::m_ldrColorGradingLutEnabled,
"Enable LDR color grading LUT",
"Enable LDR color grading LUT.")
->DataElement(AZ::Edit::UIHandlers::Default, &DisplayMapperComponentConfig::m_ldrColorGradingLut, "LDR color Grading LUT", "LDR color grading LUT");
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->ConstantProperty("EditorDisplayMapperComponentTypeId", BehaviorConstant(Uuid(EditorDisplayMapperComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorDisplayMapperComponent::EditorDisplayMapperComponent(const DisplayMapperComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorDisplayMapperComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,40 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/DisplayMapper/DisplayMapperComponent.h>
namespace AZ
{
namespace Render
{
class EditorDisplayMapperComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<DisplayMapperComponentController, DisplayMapperComponent, DisplayMapperComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<DisplayMapperComponentController, DisplayMapperComponent, DisplayMapperComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorDisplayMapperComponent, EditorDisplayMapperComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorDisplayMapperComponent() = default;
EditorDisplayMapperComponent(const DisplayMapperComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,44 @@
/*
* 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.
*
*/
#include <PostProcess/EditorPostFxLayerCategoriesAsset.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ
{
namespace Render
{
void EditorPostFxLayerCategoriesAsset::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
{
serialize->Class<EditorPostFxLayerCategoriesAsset>()
->Attribute(AZ::Edit::Attributes::EnableForAssetEditor, true)
->Version(0)
->Field("Layer Categories", &EditorPostFxLayerCategoriesAsset::m_layerCategories)
;
if (AZ::EditContext* edit = serialize->GetEditContext())
{
edit->Class<EditorPostFxLayerCategoriesAsset>(
"Layer Categories", "Contains priority-indexed layer categories used by PostFX Layer Component")
->DataElement(0, &EditorPostFxLayerCategoriesAsset::m_layerCategories, "Layer Categories", "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, true)
->ElementAttribute(AZ::Edit::Attributes::MaxLength, 64)
;
}
}
}
}
}
@@ -0,0 +1,36 @@
/*
* 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 <AzCore/Asset/AssetCommon.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/std/containers/map.h>
#include <Atom/Feature/PostProcess/PostFxLayerCategoriesConstants.h>
namespace AZ
{
namespace Render
{
class EditorPostFxLayerCategoriesAsset final
: public AZ::Data::AssetData
{
public:
AZ_RTTI(EditorPostFxLayerCategoriesAsset, "{A18B1B11-4C1E-4C1B-9643-178E8ED27019}", AZ::Data::AssetData);
AZ_CLASS_ALLOCATOR(EditorPostFxLayerCategoriesAsset, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context);
// layer categories for PostFX Layer Component indexed by priority
PostFx::LayerCategoriesMap m_layerCategories;
};
}
}
@@ -0,0 +1,91 @@
/*
* 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.
*
*/
#include <PostProcess/EditorPostFxLayerComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
namespace AZ
{
namespace Render
{
void EditorPostFxLayerComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorPostFxLayerComponent, BaseClass>()
->Version(4);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorPostFxLayerComponent>(
"PostFX Layer", "This component enables the entity to specify post process settings")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->Attribute(AZ::Edit::Attributes::HelpPageURL, "")
;
editContext->Class<PostFxLayerComponentController>(
"PostFxLayerComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &PostFxLayerComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<PostFxLayerComponentConfig>(
"PostFxLayerComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::ComboBox, &PostFxLayerComponentConfig::m_layerCategoryValue, "Layer Category", "The frequency at which the settings will be applied")
->Attribute(AZ::Edit::Attributes::EnumValues, &PostFxLayerComponentConfig::BuildLayerCategories)
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
->DataElement(Edit::UIHandlers::Default, &PostFxLayerComponentConfig::m_priority, "Priority", "The priority this will take over other settings with the same frequency. Lower priority values take precedence.")
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &PostFxLayerComponentConfig::GetPriorityLabel)
->Attribute(AZ::Edit::Attributes::Min, 0)
->Attribute(AZ::Edit::Attributes::Max, 20)
->DataElement(AZ::Edit::UIHandlers::Slider, &PostFxLayerComponentConfig::m_overrideFactor, "Weight", "How much these settings override previous settings")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Default, &PostFxLayerComponentConfig::m_cameraTags, "Select Camera Tags Only", "Limit the PostFx Layer to specific camera entities with the specified tag.")
->DataElement(AZ::Edit::UIHandlers::Default, &PostFxLayerComponentConfig::m_exclusionTags, "Excluded Camera Tags", "Camera entities containing these tags will not be included.")
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorPostFxLayerComponent>()->RequestBus("PostFxLayerRequestBus");
behaviorContext->ConstantProperty("EditorPostFxLayerComponentTypeId", BehaviorConstant(Uuid(EditorPostFxLayerComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorPostFxLayerComponent::EditorPostFxLayerComponent(const PostFxLayerComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorPostFxLayerComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
m_controller.RebuildCameraEntitiesList();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,41 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConstants.h>
#include <PostProcess/PostFxLayerComponent.h>
namespace AZ
{
namespace Render
{
class EditorPostFxLayerComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<PostFxLayerComponentController, PostFxLayerComponent, PostFxLayerComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<PostFxLayerComponentController, PostFxLayerComponent, PostFxLayerComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorPostFxLayerComponent, EditorPostFxLayerComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorPostFxLayerComponent() = default;
EditorPostFxLayerComponent(const PostFxLayerComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,145 @@
/*
* 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.
*
*/
#include <PostProcess/EditorPostFxSystemComponent.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
namespace AZ
{
namespace Render
{
void EditorPostFxSystemComponent::Reflect(AZ::ReflectContext* context)
{
EditorPostFxLayerCategoriesAsset::Reflect(context);
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
{
serialize->Class<EditorPostFxSystemComponent, AzToolsFramework::Components::EditorComponentBase>()
->Version(0)
;
if (AZ::EditContext* ec = serialize->GetEditContext())
{
ec->Class<EditorPostFxSystemComponent>("Editor PostFx System", "Manages discovery of PostFx layer categories asset")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b))
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
;
}
}
}
void EditorPostFxSystemComponent::Init()
{
AzToolsFramework::Components::EditorComponentBase::Init();
}
void EditorPostFxSystemComponent::Activate()
{
RegisterAssethandlers();
AzFramework::AssetCatalogEventBus::Handler::BusConnect();
AzToolsFramework::Components::EditorComponentBase::Activate();
PostFxLayerCategoriesProviderRequestBus::Handler::BusConnect();
}
void EditorPostFxSystemComponent::Deactivate()
{
PostFxLayerCategoriesProviderRequestBus::Handler::BusDisconnect();
AzToolsFramework::Components::EditorComponentBase::Deactivate();
AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
UnregisterAssethandlers();
}
void EditorPostFxSystemComponent::RegisterAssethandlers()
{
m_postFxLayerCategoriesAsset = aznew AzFramework::GenericAssetHandler<EditorPostFxLayerCategoriesAsset>("PostFx Layer Categories", "Other", "postFxLayerCategories");
m_postFxLayerCategoriesAsset->Register();
}
void EditorPostFxSystemComponent::UnregisterAssethandlers()
{
m_layerCategoriesAssetMap.clear();
if (m_postFxLayerCategoriesAsset)
{
m_postFxLayerCategoriesAsset->Unregister();
delete m_postFxLayerCategoriesAsset;
m_postFxLayerCategoriesAsset = nullptr;
}
}
void EditorPostFxSystemComponent::GetLayerCategories(PostFx::LayerCategoriesMap& layerCategories) const
{
// use layer category definitions from all postfxlayercategories asset files
for (const auto& assetPair : m_layerCategoriesAssetMap)
{
const auto& asset = assetPair.second;
if (asset.IsReady())
{
const auto& priorityLayerPairs = asset.Get()->m_layerCategories;
layerCategories.insert(priorityLayerPairs.begin(), priorityLayerPairs.end());
}
}
// insert default layer
layerCategories[PostFx::DefaultLayerCategory] = PostFx::DefaultLayerCategoryValue;
}
void EditorPostFxSystemComponent::OnCatalogLoaded(const char* catalogFile)
{
AZ_UNUSED(catalogFile);
// automatically register all layer categories assets
AZ::Data::AssetCatalogRequestBus::Broadcast(&AZ::Data::AssetCatalogRequestBus::Events::EnumerateAssets,
nullptr,
[this](const AZ::Data::AssetId assetId, const AZ::Data::AssetInfo& assetInfo) {
const auto assetType = azrtti_typeid<EditorPostFxLayerCategoriesAsset>();
if (assetInfo.m_assetType == assetType)
{
m_layerCategoriesAssetMap[assetId] = AZ::Data::AssetManager::Instance().GetAsset(assetId, assetType, AZ::Data::AssetLoadBehavior::PreLoad);
m_layerCategoriesAssetMap[assetId].QueueLoad();
}
},
nullptr);
}
void EditorPostFxSystemComponent::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId)
{
UpdateLayerCategoriesAssetMap(assetId);
}
void EditorPostFxSystemComponent::OnCatalogAssetAdded(const AZ::Data::AssetId& assetId)
{
UpdateLayerCategoriesAssetMap(assetId);
}
void EditorPostFxSystemComponent::UpdateLayerCategoriesAssetMap(const AZ::Data::AssetId& assetId)
{
AZ::Data::AssetInfo assetInfo;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, assetId);
const auto assetType = azrtti_typeid<EditorPostFxLayerCategoriesAsset>();
if (assetInfo.m_assetType == assetType)
{
m_layerCategoriesAssetMap[assetId] = AZ::Data::AssetManager::Instance().GetAsset(assetId, assetType, AZ::Data::AssetLoadBehavior::PreLoad);
m_layerCategoriesAssetMap[assetId].BlockUntilLoadComplete();
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh, AzToolsFramework::PropertyModificationRefreshLevel::Refresh_AttributesAndValues);
}
}
void EditorPostFxSystemComponent::OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo&)
{
m_layerCategoriesAssetMap.erase(assetId);
}
}
}
@@ -0,0 +1,59 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerCategoriesProviderRequestBus.h>
#include <Atom/Feature/PostProcess/PostFxLayerCategoriesConstants.h>
#include <PostProcess/EditorPostFxLayerCategoriesAsset.h>
#include <AzFramework/Asset/GenericAssetHandler.h>
namespace AZ
{
namespace Render
{
class EditorPostFxSystemComponent
: public AzToolsFramework::Components::EditorComponentBase
, private PostFxLayerCategoriesProviderRequestBus::Handler
, private AzFramework::AssetCatalogEventBus::Handler
{
public:
AZ_EDITOR_COMPONENT(EditorPostFxSystemComponent, "{D86D2F88-ACDC-49B3-89D3-AE2EC5B8FEBC}");
static void Reflect(AZ::ReflectContext* context);
void Init() override;
void Activate() override;
void Deactivate() override;
// PostFxLayerCategoriesProviderRequestBus Override
void GetLayerCategories(PostFx::LayerCategoriesMap& layerCategories) const override;
// AssetCatalogEventBus Overrides
void OnCatalogLoaded(const char* catalogFile) override;
void OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) override;
void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override;
void OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo) override;
void UpdateLayerCategoriesAssetMap(const AZ::Data::AssetId& assetId);
// Asset handler registration
void RegisterAssethandlers();
void UnregisterAssethandlers();
AzFramework::GenericAssetHandler<EditorPostFxLayerCategoriesAsset>* m_postFxLayerCategoriesAsset = nullptr;
AZStd::unordered_map<AZ::Data::AssetId, AZ::Data::Asset<EditorPostFxLayerCategoriesAsset>> m_layerCategoriesAssetMap;
};
}
}
@@ -0,0 +1,135 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/ExposureControl/EditorExposureControlComponent.h>
namespace AZ
{
namespace Render
{
void EditorExposureControlComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorExposureControlComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorExposureControlComponent>(
"Exposure Control", "Exposure component control exposure value for rendered scene.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [TODO ATOM-2672][PostFX] need create page for PostProcessing.
;
editContext->Class<ExposureControlComponentController>(
"ExposureControlComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &ExposureControlComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<ExposureControlComponentConfig>("ExposureControlComponentConfig", "")
->DataElement(Edit::UIHandlers::CheckBox,
&ExposureControlComponentConfig::m_enabled,
"Enable",
"Enable exposure control.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->ClassElement(Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::ComboBox,
&ExposureControlComponentConfig::m_exposureControlType,
"Control Type",
"How to control a exposure value.")
->EnumAttribute(AZ::Render::ExposureControl::ExposureControlType::ManualOnly, "Manual Only")
->EnumAttribute(AZ::Render::ExposureControl::ExposureControlType::EyeAdaptation, "Eye Adaptation")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &ExposureControlComponentConfig::m_manualCompensationValue, "Manual Compensation", "Manual exposure compensation value.")
->Attribute(AZ::Edit::Attributes::Min, -16.0f)
->Attribute(AZ::Edit::Attributes::Max, 16.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->ClassElement(AZ::Edit::ClassElements::Group, "Eye Adaptation")
->Attribute(Edit::Attributes::Visibility, &ExposureControlComponentConfig::IsEyeAdaptation)
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &ExposureControlComponentConfig::m_autoExposureMin, "Minimum Exposure", "Minimum exposure value for the auto exposure.")
->Attribute(AZ::Edit::Attributes::Min, -16.0f)
->Attribute(AZ::Edit::Attributes::Max, 16.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &ExposureControlComponentConfig::m_autoExposureMax, "Maximum Exposure", "Maximum exposure value for the auto exposure.")
->Attribute(AZ::Edit::Attributes::Min, -16.0f)
->Attribute(AZ::Edit::Attributes::Max, 16.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &ExposureControlComponentConfig::m_autoExposureSpeedUp, "Speed Up", "The speed at which auto exposure adapts to bright scenes.")
->Attribute(AZ::Edit::Attributes::Min, 0.01)
->Attribute(AZ::Edit::Attributes::Max, 10.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &ExposureControlComponentConfig::m_autoExposureSpeedDown, "Speed Down", "The speed at which auto exposure adapts to dark scenes.")
->Attribute(AZ::Edit::Attributes::Min, 0.01)
->Attribute(AZ::Edit::Attributes::Max, 10.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &ExposureControlComponentConfig::ArePropertiesReadOnly)
->DataElement(Edit::UIHandlers::CheckBox, &ExposureControlComponentConfig::m_heatmapEnabled, "Enable Heatmap", "Areas below minimum exposure will be highlighted in blue. Areas above in red.")
// Overrides
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
// Auto-gen editor context settings for overrides
#define EDITOR_CLASS ExposureControlComponentConfig
#include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef EDITOR_CLASS
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorExposureControlComponent>()->RequestBus("ExposureControlRequestBus");
behaviorContext->ConstantProperty("EditorExposureControlComponentTypeId", BehaviorConstant(Uuid(EditorExposureControlComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorExposureControlComponent::EditorExposureControlComponent(const ExposureControlComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorExposureControlComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,41 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConstants.h>
#include <PostProcess/ExposureControl/ExposureControlComponent.h>
namespace AZ
{
namespace Render
{
class EditorExposureControlComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<ExposureControlComponentController, ExposureControlComponent, ExposureControlComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<ExposureControlComponentController, ExposureControlComponent, ExposureControlComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorExposureControlComponent, EditorExposureControlComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorExposureControlComponent() = default;
EditorExposureControlComponent(const ExposureControlComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/ExposureControl/ExposureControlComponent.h>
namespace AZ
{
namespace Render
{
ExposureControlComponent::ExposureControlComponent(const ExposureControlComponentConfig& config)
: BaseClass(config)
{
}
void ExposureControlComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ExposureControlComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<ExposureControlComponent>()->RequestBus("ExposureControlRequestBus");
behaviorContext->ConstantProperty("ExposureControlComponentTypeId", BehaviorConstant(Uuid(ExposureControlComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,39 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConstants.h>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlConstants.h>
#include <PostProcess/ExposureControl/ExposureControlComponentController.h>
namespace AZ
{
namespace Render
{
class ExposureControlComponent final
: public AzFramework::Components::ComponentAdapter<ExposureControlComponentController, ExposureControlComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<ExposureControlComponentController, ExposureControlComponentConfig>;
AZ_COMPONENT(AZ::Render::ExposureControlComponent, ExposureControlComponentTypeId , BaseClass);
ExposureControlComponent() = default;
ExposureControlComponent(const ExposureControlComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,67 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void ExposureControlComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ExposureControlComponentConfig, ComponentConfig>()
->Version(1)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS ExposureControlComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void ExposureControlComponentConfig::CopySettingsFrom(ExposureControlSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_SOURCE settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsFrom.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_SOURCE
}
void ExposureControlComponentConfig::CopySettingsTo(ExposureControlSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,167 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/ExposureControl/ExposureControlComponentController.h>
namespace AZ
{
namespace Render
{
void ExposureControlComponentController::Reflect(ReflectContext* context)
{
ExposureControlComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<ExposureControlComponentController>()
->Version(0)
->Field("Configuration", &ExposureControlComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<ExposureControlRequestBus>("ExposureControlRequestBus")
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
// Auto-gen behavior context...
#define PARAM_EVENT_BUS ExposureControlRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void ExposureControlComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("ExposureControlService"));
}
void ExposureControlComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("ExposureControlService"));
}
void ExposureControlComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
ExposureControlComponentController::ExposureControlComponentController(const ExposureControlComponentConfig& config)
: m_configuration(config)
{
}
void ExposureControlComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostProcessFeatureProcessorInterface* fp = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (fp)
{
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
if (m_postProcessInterface)
{
m_settingsInterface = m_postProcessInterface->GetOrCreateExposureControlSettingsInterface();
OnConfigChanged();
}
}
ExposureControlRequestBus::Handler::BusConnect(m_entityId);
}
void ExposureControlComponentController::Deactivate()
{
ExposureControlRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveExposureControlSettingsInterface();
}
m_postProcessInterface = nullptr;
m_settingsInterface = nullptr;
m_entityId.SetInvalid();
}
// Getters & Setters...
void ExposureControlComponentController::SetConfiguration(const ExposureControlComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const ExposureControlComponentConfig& ExposureControlComponentController::GetConfiguration() const
{
return m_configuration;
}
void ExposureControlComponentController::OnConfigChanged()
{
if (m_settingsInterface)
{
m_configuration.CopySettingsTo(m_settingsInterface);
m_settingsInterface->OnConfigChanged();
}
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
ValueType ExposureControlComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void ExposureControlComponentController::Set##Name(ValueType val) \
{ \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name(val); \
m_settingsInterface->OnConfigChanged(); \
m_configuration.MemberName = m_settingsInterface->Get##Name(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
OverrideValueType ExposureControlComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void ExposureControlComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName##Override = val; \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name##Override(val); \
m_settingsInterface->OnConfigChanged(); \
} \
} \
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,66 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConfig.h>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlConstants.h>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
namespace AZ
{
namespace Render
{
class ExposureControlComponentController final
: public ExposureControlRequestBus::Handler
{
public:
friend class EditorExposureControlComponent;
AZ_TYPE_INFO(AZ::Render::ExposureControlComponentController, "{A9D74E65-D1EE-416E-9108-B321526B049C}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
ExposureControlComponentController() = default;
ExposureControlComponentController(const ExposureControlComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const ExposureControlComponentConfig& config);
const ExposureControlComponentConfig& GetConfiguration() const;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(ExposureControlComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
ExposureControlSettingsInterface* m_settingsInterface = nullptr;
ExposureControlComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,78 @@
/*
* 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.
*
*/
#include <PostProcess/GradientWeightModifier/EditorGradientWeightModifierComponent.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
namespace AZ
{
namespace Render
{
void EditorGradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorGradientWeightModifierComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorGradientWeightModifierComponent>(
"PostFX Gradient Weight Modifier", "Modifies PostFX override factor based on a gradient signal sampled from an entity")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png")
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "")
;
editContext->Class<GradientWeightModifierComponentController>("GradientWeightModifierComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<GradientWeightModifierComponentConfig>("GradientWeightModifierComponentConfig", "")
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentConfig::m_gradientSampler, "Gradient Sampler", "Gradient sampler configuration")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorGradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("EditorGradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorGradientWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorGradientWeightModifierComponent::EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
AZ::u32 EditorGradientWeightModifierComponent::OnConfigurationChanged()
{
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,37 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
class EditorGradientWeightModifierComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponent, GradientWeightModifierComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponent, GradientWeightModifierComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorGradientWeightModifierComponent, EditorGradientWeightModifierComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorGradientWeightModifierComponent() = default;
EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config);
AZ::u32 OnConfigurationChanged() override;
};
}
}
@@ -0,0 +1,44 @@
/*
* 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.
*
*/
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
GradientWeightModifierComponent::GradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
void GradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<GradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("GradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(GradientWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
}
}
@@ -0,0 +1,38 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
class GradientWeightModifierComponent final
: public AzFramework::Components::ComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponentConfig>;
AZ_COMPONENT(AZ::Render::GradientWeightModifierComponent, "{4DE2AD79-85BE-49FF-9DC5-D709720B013E}", BaseClass);
GradientWeightModifierComponent() = default;
GradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
}
}
@@ -0,0 +1,34 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void GradientWeightModifierComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponentConfig, ComponentConfig>()
->Version(0)
->Field("GradientSampler", &GradientWeightModifierComponentConfig::m_gradientSampler)
;
}
}
}
}
@@ -0,0 +1,77 @@
/*
* 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.
*
*/
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
void GradientWeightModifierComponentController::Reflect(AZ::ReflectContext* context)
{
GradientWeightModifierComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponentController>()
->Version(0)
->Field("Configuration", &GradientWeightModifierComponentController::m_configuration);
}
}
void GradientWeightModifierComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void GradientWeightModifierComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void GradientWeightModifierComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
GradientWeightModifierComponentController::GradientWeightModifierComponentController(const GradientWeightModifierComponentConfig& config)
: m_configuration(config)
{
}
void GradientWeightModifierComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
m_configuration.m_gradientSampler.m_ownerEntityId = entityId;
PostFxWeightRequestBus::Handler::BusConnect(m_entityId);
}
void GradientWeightModifierComponentController::Deactivate()
{
PostFxWeightRequestBus::Handler::BusDisconnect(m_entityId);
m_entityId.SetInvalid();
}
void GradientWeightModifierComponentController::SetConfiguration(const GradientWeightModifierComponentConfig& config)
{
m_configuration = config;
}
float GradientWeightModifierComponentController::GetWeightAtPosition(const AZ::Vector3& influencerPosition) const
{
return m_configuration.m_gradientSampler.GetValue(influencerPosition);
}
}
}
@@ -0,0 +1,52 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
namespace AZ
{
namespace Render
{
class GradientWeightModifierComponentController final
: public PostFxWeightRequestBus::Handler
{
public:
friend class EditorGradientWeightModifierComponent;
AZ_TYPE_INFO(AZ::Render::GradientWeightModifierComponentController, "{62AB316D-8B8E-434E-8F87-C4ABC42642A6}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
GradientWeightModifierComponentController() = default;
GradientWeightModifierComponentController(const GradientWeightModifierComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const GradientWeightModifierComponentConfig& config);
const GradientWeightModifierComponentConfig& GetConfiguration() const { return m_configuration; }
virtual float GetWeightAtPosition(const AZ::Vector3& influencerPosition) const override;
private:
AZ_DISABLE_COPY(GradientWeightModifierComponentController);
GradientWeightModifierComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,118 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/LookModification/EditorLookModificationComponent.h>
namespace AZ
{
namespace Render
{
void EditorLookModificationComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorLookModificationComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorLookModificationComponent>(
"Look Modification", "The look modification process.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [TODO ATOM-2672][PostFX] need to create page for PostProcessing.
;
editContext->Class<LookModificationComponentController>(
"LookModificationComponentControl", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<LookModificationComponentConfig>("LookModificationComponentConfig", "")
->DataElement(Edit::UIHandlers::CheckBox,
&LookModificationComponentConfig::m_enabled,
"Enable look modification",
"Enable look modification.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentConfig::m_colorGradingLut, "Color Grading LUT", "Color grading LUT")
->ClassElement(Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::ComboBox,
&LookModificationComponentConfig::m_shaperPresetType,
"Shaper Type",
"Shaper Type.")
->EnumAttribute(ShaperPresetType::None, "None")
->EnumAttribute(ShaperPresetType::Log2_48_nits, "Log2_48_nits")
->EnumAttribute(ShaperPresetType::Log2_1000_nits, "Log2_1000_nits")
->EnumAttribute(ShaperPresetType::Log2_2000_nits, "Log2_2000_nits")
->EnumAttribute(ShaperPresetType::Log2_4000_nits, "Log2_4000_nits")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutIntensity, "LUT Intensity", "Blend intensity of this LUT.")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutOverride, "LUT Override", "Blend intensity of this LUT.")
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
// Overrides
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
// Auto-gen editor context settings for overrides
#define EDITOR_CLASS LookModificationComponentConfig
#include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef EDITOR_CLASS
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorLookModificationComponent>()->RequestBus("LookModificationRequestBus");
behaviorContext->ConstantProperty("EditorLookModificationComponentTypeId", BehaviorConstant(Uuid(EditorLookModificationComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorLookModificationComponent::EditorLookModificationComponent(const LookModificationComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorLookModificationComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,41 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConstants.h>
#include <PostProcess/LookModification/LookModificationComponent.h>
namespace AZ
{
namespace Render
{
class EditorLookModificationComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<LookModificationComponentController, LookModificationComponent, LookModificationComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<LookModificationComponentController, LookModificationComponent, LookModificationComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorLookModificationComponent, EditorLookModificationComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorLookModificationComponent() = default;
EditorLookModificationComponent(const LookModificationComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/LookModification/LookModificationComponent.h>
namespace AZ
{
namespace Render
{
LookModificationComponent::LookModificationComponent(const LookModificationComponentConfig& config)
: BaseClass(config)
{
}
void LookModificationComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<LookModificationComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<LookModificationComponent>()->RequestBus("LookModificationRequestBus");
behaviorContext->ConstantProperty("LookModificationComponentTypeId", BehaviorConstant(Uuid(LookModificationComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,38 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConstants.h>
#include <PostProcess/LookModification/LookModificationComponentController.h>
namespace AZ
{
namespace Render
{
class LookModificationComponent final
: public AzFramework::Components::ComponentAdapter<LookModificationComponentController, LookModificationComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<LookModificationComponentController, LookModificationComponentConfig>;
AZ_COMPONENT(AZ::Render::LookModificationComponent, LookModificationComponentTypeId , BaseClass);
LookModificationComponent() = default;
LookModificationComponent(const LookModificationComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,68 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <Atom/Feature/ACES/Aces.h>
namespace AZ
{
namespace Render
{
void LookModificationComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<LookModificationComponentConfig, ComponentConfig>()
->Version(0)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS LookModificationComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void LookModificationComponentConfig::CopySettingsFrom(LookModificationSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_SOURCE settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsFrom.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_SOURCE
}
void LookModificationComponentConfig::CopySettingsTo(LookModificationSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,169 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <Atom/Feature/ACES/Aces.h>
#include <PostProcess/LookModification/LookModificationComponentController.h>
namespace AZ
{
namespace Render
{
void LookModificationComponentController::Reflect(ReflectContext* context)
{
LookModificationComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<LookModificationComponentController>()
->Version(0)
->Field("Configuration", &LookModificationComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<LookModificationRequestBus>("LookModificationRequestBus")
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
// Auto-gen behavior context...
#define PARAM_EVENT_BUS LookModificationRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void LookModificationComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("LookModificationService", 0x207b7539));
}
void LookModificationComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC("LookModificationService", 0x207b7539));
}
void LookModificationComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
LookModificationComponentController::LookModificationComponentController(const LookModificationComponentConfig& config)
: m_configuration(config)
{
}
void LookModificationComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostProcessFeatureProcessorInterface* fp = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (fp)
{
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
if (m_postProcessInterface)
{
m_settingsInterface = m_postProcessInterface->GetOrCreateLookModificationSettingsInterface();
OnConfigChanged();
}
}
LookModificationRequestBus::Handler::BusConnect(m_entityId);
}
void LookModificationComponentController::Deactivate()
{
LookModificationRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveLookModificationSettingsInterface();
}
m_postProcessInterface = nullptr;
m_settingsInterface = nullptr;
m_entityId.SetInvalid();
}
// Getters & Setters...
void LookModificationComponentController::SetConfiguration(const LookModificationComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const LookModificationComponentConfig& LookModificationComponentController::GetConfiguration() const
{
return m_configuration;
}
void LookModificationComponentController::OnConfigChanged()
{
if (m_settingsInterface)
{
m_configuration.CopySettingsTo(m_settingsInterface);
m_settingsInterface->OnConfigChanged();
}
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
ValueType LookModificationComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void LookModificationComponentController::Set##Name(ValueType val) \
{ \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name(val); \
m_settingsInterface->OnConfigChanged(); \
m_configuration.MemberName = m_settingsInterface->Get##Name(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
OverrideValueType LookModificationComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void LookModificationComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName##Override = val; \
if(m_settingsInterface) \
{ \
m_settingsInterface->Set##Name##Override(val); \
m_settingsInterface->OnConfigChanged(); \
} \
}
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,68 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h>
#include <Atom/Feature/ACES/Aces.h>
#include <Atom/Feature/PostProcess/LookModification/LookModificationSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
#include <AzCore/Asset/AssetCommon.h>
#include <Atom/RPI.Reflect/System/AnyAsset.h>
namespace AZ
{
namespace Render
{
class LookModificationComponentController final
: public LookModificationRequestBus::Handler
{
public:
friend class EditorLookModificationComponent;
AZ_TYPE_INFO(AZ::Render::LookModificationComponentController, "{66912D19-CAB2-457C-A4EF-88FE4AF592B1}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
LookModificationComponentController() = default;
LookModificationComponentController(const LookModificationComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const LookModificationComponentConfig& config);
const LookModificationComponentConfig& GetConfiguration() const;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(LookModificationComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
LookModificationSettingsInterface* m_settingsInterface = nullptr;
LookModificationComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <PostProcess/PostFxLayerComponent.h>
#include <AzCore/RTTI/BehaviorContext.h>
namespace AZ
{
namespace Render
{
PostFxLayerComponent::PostFxLayerComponent(const PostFxLayerComponentConfig& config)
: BaseClass(config)
{
}
void PostFxLayerComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<PostFxLayerComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<PostFxLayerComponent>()->RequestBus("PostFxLayerRequestBus");
behaviorContext->ConstantProperty("PostFxLayerComponentTypeId", BehaviorConstant(Uuid(PostFxLayerComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,37 @@
/*
* 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 <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConstants.h>
#include <PostProcess/PostFxLayerComponentController.h>
namespace AZ
{
namespace Render
{
class PostFxLayerComponent final
: public AzFramework::Components::ComponentAdapter<PostFxLayerComponentController, PostFxLayerComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<PostFxLayerComponentController, PostFxLayerComponentConfig>;
AZ_COMPONENT(AZ::Render::PostFxLayerComponent, PostFxLayerComponentTypeId , BaseClass);
PostFxLayerComponent() = default;
PostFxLayerComponent(const PostFxLayerComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,92 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerCategoriesProviderRequestBus.h>
#include <AzCore/std/sort.h>
namespace AZ
{
namespace Render
{
void PostFxLayerComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<PostFxLayerComponentConfig, ComponentConfig>()
->Version(2)
->Field("layerCategory", &PostFxLayerComponentConfig::m_layerCategoryValue)
#define SERIALIZE_CLASS PostFxLayerComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/PostProcessParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
->Field("cameraTags", &PostFxLayerComponentConfig::m_cameraTags)
->Field("exclusionTags", &PostFxLayerComponentConfig::m_exclusionTags)
;
}
}
void PostFxLayerComponentConfig::CopySettingsTo(PostProcessSettingsInterface* settings) const
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/PostProcessParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
settings->SetLayerCategoryValue(m_layerCategoryValue);
}
AZStd::string PostFxLayerComponentConfig::GetPriorityLabel()
{
auto priorityLayersList = BuildLayerCategories();
// use the first match as the priority label since all labels with the same priority will belong to the same layer
auto it = AZStd::find_if(
priorityLayersList.begin(),
priorityLayersList.end(),
[this](const auto& entry) { return m_layerCategoryValue == entry.first; });
return it == priorityLayersList.end() ? "Priority" : "Priority in " + it->second;
}
AZStd::vector<AZStd::pair<int, AZStd::string>> PostFxLayerComponentConfig::BuildLayerCategories() const
{
// Call the bus to retrieve a list of categories
PostFx::LayerCategoriesMap layerCategories;
PostFxLayerCategoriesProviderRequestBus::Broadcast(&PostFxLayerCategoriesProviderRequests::GetLayerCategories, layerCategories);
AZStd::vector<AZStd::pair<int, AZStd::string>> results;
results.reserve(layerCategories.size());
for (const auto& layer : layerCategories)
{
results.push_back(AZStd::pair<int, AZStd::string>(layer.second, layer.first));
}
AZStd::sort(
results.begin(),
results.end(),
[](auto& left, auto& right) { return left.first < right.first;});
return results;
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,312 @@
/*
* 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.
*
*/
#include <PostProcess/PostFxLayerComponentController.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
#include <LmbrCentral/Scripting/TagComponentBus.h>
#include <LmbrCentral/Scripting/EditorTagComponentBus.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <Atom/RPI.Public/ViewProviderBus.h>
#include <Atom/RPI.Public/ViewportContextBus.h>
namespace AZ
{
namespace Render
{
void PostFxLayerComponentController::Reflect(ReflectContext* context)
{
PostFxLayerComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<PostFxLayerComponentController>()
->Version(0)
->Field("Configuration", &PostFxLayerComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<PostFxLayerRequestBus>("PostFxLayerRequestBus")
// Auto-gen behavior context...
#define PARAM_EVENT_BUS PostFxLayerRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/PostProcessParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void PostFxLayerComponentController::OnTick(float deltaTime, ScriptTimePoint time)
{
AZ_UNUSED(deltaTime);
AZ_UNUSED(time);
// get all camera entities if no tags were set in the PostFx layer
const AZStd::unordered_set<AZ::EntityId>& cameraEntityList = GetCameraEntityList();
// Get views of each camera
AZStd::unordered_set<AZ::RPI::View*> allSceneViews;
for (const AZ::EntityId& cameraEntityId : cameraEntityList)
{
// Get the view pointer associated to each camera entity
AZ::RPI::ViewPtr view = nullptr;
AZ::RPI::ViewProviderBus::EventResult(
view,
cameraEntityId,
&AZ::RPI::ViewProvider::GetView
);
if (view != nullptr)
{
allSceneViews.insert(view.get());
}
}
// Add the current view which can potentially be the editor view
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
const AZ::Name contextName = atomViewportRequests->GetDefaultViewportContextName();
allSceneViews.insert(atomViewportRequests->GetCurrentView(contextName).get());
// calculate blend weights for all cameras
PostProcessSettingsInterface::ViewBlendWeightMap perViewBlendWeights;
for (auto view : allSceneViews)
{
if (view)
{
// get the view position
AZ::Vector3 viewPosition = view->GetViewToWorldMatrix().GetTranslation();
// calculate blend weight based on proximity to weight modifier
float blendWeightResult = 1.0f;
AZ::Render::PostFxWeightRequestBus::EventResult(
blendWeightResult,
m_entityId,
&AZ::Render::PostFxWeightRequests::GetWeightAtPosition,
viewPosition
);
// store result
perViewBlendWeights[view] = blendWeightResult;
}
}
// copy cameraToBlendWeight data to settings
m_postProcessInterface = m_featureProcessorInterface->GetOrCreateSettingsInterface(m_entityId);
m_postProcessInterface->CopyViewToBlendWeightSettings(perViewBlendWeights);
m_postProcessInterface->OnConfigChanged();
}
void PostFxLayerComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("PostFXLayerService"));
}
void PostFxLayerComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("PostFXLayerService"));
}
PostFxLayerComponentController::PostFxLayerComponentController(const PostFxLayerComponentConfig& config)
: m_configuration(config)
{
}
void PostFxLayerComponentController::OnEntityTagAdded(const AZ::EntityId& entityId)
{
// If the entity contains an exclusion tag, do not add it to the tagged camera entities
if (!HasTags(entityId, m_configuration.m_exclusionTags))
{
m_taggedCameraEntities.insert(entityId);
}
}
void PostFxLayerComponentController::OnEntityTagRemoved(const AZ::EntityId& entityId)
{
m_taggedCameraEntities.erase(entityId);
}
void PostFxLayerComponentController::OnCameraAdded(const AZ::EntityId& cameraId)
{
// If the entity contains an exclusion tag, do not add it to the camera entities
if (!HasTags(cameraId, m_configuration.m_exclusionTags))
{
m_cameraEntities.insert(cameraId);
}
}
void PostFxLayerComponentController::OnCameraRemoved(const AZ::EntityId& cameraId)
{
m_cameraEntities.erase(cameraId);
}
void PostFxLayerComponentController::RebuildCameraEntitiesList()
{
// Reconnect buses to regenerate the entities list
m_taggedCameraEntities.clear();
BusConnectToTags();
m_cameraEntities.clear();
Camera::CameraNotificationBus::Handler::BusDisconnect();
Camera::CameraNotificationBus::Handler::BusConnect();
}
const AZStd::unordered_set<AZ::EntityId>& PostFxLayerComponentController::GetCameraEntityList() const
{
if (m_configuration.m_cameraTags.empty())
{
return m_cameraEntities;
}
else
{
return m_taggedCameraEntities;
}
}
bool PostFxLayerComponentController::HasTags(const AZ::EntityId& entityId, const AZStd::vector<AZStd::string>& tags) const
{
bool hasTag = false;
for (auto tag : tags)
{
LmbrCentral::TagComponentRequestBus::EventResult(
hasTag,
entityId,
&LmbrCentral::TagComponentRequests::HasTag,
LmbrCentral::Tag(tag)
);
LmbrCentral::EditorTagComponentRequestBus::EventResult(
hasTag,
entityId,
&LmbrCentral::EditorTagComponentRequests::HasTag,
tag.c_str()
);
if (hasTag)
{
return true;
}
}
return false;
}
void PostFxLayerComponentController::BusConnectToTags()
{
LmbrCentral::TagGlobalNotificationBus::MultiHandler::BusDisconnect();
for (auto tag : m_configuration.m_cameraTags)
{
LmbrCentral::TagGlobalNotificationBus::MultiHandler::BusConnect(LmbrCentral::Tag(tag));
}
}
void PostFxLayerComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
m_featureProcessorInterface = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (m_featureProcessorInterface)
{
m_postProcessInterface = m_featureProcessorInterface->GetOrCreateSettingsInterface(m_entityId);
m_configuration.CopySettingsTo(m_postProcessInterface);
}
BusConnectToTags();
Camera::CameraNotificationBus::Handler::BusConnect();
PostFxLayerRequestBus::Handler::BusConnect(m_entityId);
AZ::TickBus::Handler::BusConnect();
}
void PostFxLayerComponentController::Deactivate()
{
AZ::TickBus::Handler::BusDisconnect();
PostFxLayerRequestBus::Handler::BusDisconnect(m_entityId);
Camera::CameraNotificationBus::Handler::BusDisconnect();
LmbrCentral::TagGlobalNotificationBus::MultiHandler::BusDisconnect();
if (m_featureProcessorInterface)
{
m_featureProcessorInterface->RemoveSettingsInterface(m_entityId);
}
m_postProcessInterface = nullptr;
m_featureProcessorInterface = nullptr;
m_entityId.SetInvalid();
}
void PostFxLayerComponentController::SetConfiguration(const PostFxLayerComponentConfig& config)
{
m_configuration = config;
}
const PostFxLayerComponentConfig& PostFxLayerComponentController::GetConfiguration() const
{
return m_configuration;
}
void PostFxLayerComponentController::OnConfigChanged()
{
if (m_postProcessInterface)
{
m_configuration.CopySettingsTo(m_postProcessInterface);
m_postProcessInterface->OnConfigChanged();
}
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
\
ValueType PostFxLayerComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void PostFxLayerComponentController::Set##Name(ValueType val) \
{ \
if(m_postProcessInterface) \
{ \
m_postProcessInterface->Set##Name(val); \
m_postProcessInterface->OnConfigChanged(); \
m_configuration.MemberName = m_postProcessInterface->Get##Name(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
\
OverrideValueType PostFxLayerComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void PostFxLayerComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName = val; \
if(m_postProcessInterface) \
{ \
m_postProcessInterface->Set##Name##Override(val); \
m_postProcessInterface->OnConfigChanged(); \
} \
} \
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/PostProcessParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,90 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerBus.h>
#include <AzCore/Component/TickBus.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
#include <LmbrCentral/Scripting/TagComponentBus.h>
#include <AzFramework/Components/CameraBus.h>
namespace AZ
{
namespace Render
{
class PostFxLayerComponentController final
: public PostFxLayerRequestBus::Handler
, public LmbrCentral::TagGlobalNotificationBus::MultiHandler
, public Camera::CameraNotificationBus::Handler
, public TickBus::Handler
{
public:
friend class EditorPostFxLayerComponent;
AZ_TYPE_INFO(AZ::Render::PostFxLayerComponentController, "{A3285A02-944B-4339-95B1-15E0F410BD1D}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
PostFxLayerComponentController() = default;
PostFxLayerComponentController(const PostFxLayerComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const PostFxLayerComponentConfig& config);
const PostFxLayerComponentConfig& GetConfiguration() const;
// Called whenever a tag is added to this component via Editor or Script
void RebuildCameraEntitiesList();
// TagGlobalNotificationBus::MultiHandler overrides
void OnEntityTagAdded(const AZ::EntityId& entityId) override;
void OnEntityTagRemoved(const AZ::EntityId& entityId) override;
// CameraNotificationBus::Handler overrides
void OnCameraAdded(const AZ::EntityId& cameraId) override;
void OnCameraRemoved(const AZ::EntityId& cameraId) override;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/PostProcessParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(PostFxLayerComponentController);
void OnConfigChanged();
void OnTick(float deltaTime, ScriptTimePoint time) override;
// Connects to all camera tags listed in this component
void BusConnectToTags();
const AZStd::unordered_set<AZ::EntityId>& GetCameraEntityList() const;
bool HasTags(const AZ::EntityId& entityId, const AZStd::vector<AZStd::string>& tags) const;
// list of entities containing tags set in this component's property.
AZStd::unordered_set<AZ::EntityId> m_taggedCameraEntities;
// a list of cameras tracked by this component. This is used if no camera tags are specified.
AZStd::unordered_set<AZ::EntityId> m_cameraEntities;
PostProcessFeatureProcessorInterface* m_featureProcessorInterface = nullptr;
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
PostFxLayerComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,84 @@
/*
* 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.
*
*/
#include <PostProcess/RadiusWeightModifier/EditorRadiusWeightModifierComponent.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentConstants.h>
namespace AZ
{
namespace Render
{
void EditorRadiusWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorRadiusWeightModifierComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorRadiusWeightModifierComponent>(
"Radius Weight Modifier", "Modifies PostFX override factor based on proximity of an influencer against this entity's bounding sphere")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png")
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "")
;
editContext->Class<RadiusWeightModifierComponentController>("RadiusWeightModifierComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &RadiusWeightModifierComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<RadiusWeightModifierComponentConfig>("RadiusWeightModifierComponentConfig", "")
->DataElement(AZ::Edit::UIHandlers::Slider,
&RadiusWeightModifierComponentConfig::m_radius,
"Radius",
"Radius of PostFx Volume.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, std::numeric_limits<float>::max())
->Attribute(AZ::Edit::Attributes::SoftMax, 100.0f);
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorRadiusWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("EditorRadiusWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorRadiusWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorRadiusWeightModifierComponent::EditorRadiusWeightModifierComponent(const RadiusWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
AZ::u32 EditorRadiusWeightModifierComponent::OnConfigurationChanged()
{
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,37 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/RadiusWeightModifier/RadiusWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
class EditorRadiusWeightModifierComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<RadiusWeightModifierComponentController, RadiusWeightModifierComponent, RadiusWeightModifierComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<RadiusWeightModifierComponentController, RadiusWeightModifierComponent, RadiusWeightModifierComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorRadiusWeightModifierComponent, EditorRadiusWeightModifierComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorRadiusWeightModifierComponent() = default;
EditorRadiusWeightModifierComponent(const RadiusWeightModifierComponentConfig& config);
AZ::u32 OnConfigurationChanged() override;
};
}
}
@@ -0,0 +1,44 @@
/*
* 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.
*
*/
#include <PostProcess/RadiusWeightModifier/RadiusWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
RadiusWeightModifierComponent::RadiusWeightModifierComponent(const RadiusWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
void RadiusWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<RadiusWeightModifierComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<RadiusWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("RadiusWeightModifierComponentTypeId", BehaviorConstant(Uuid(RadiusWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
}
}
@@ -0,0 +1,38 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentConfig.h>
#include <PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
class RadiusWeightModifierComponent final
: public AzFramework::Components::ComponentAdapter<RadiusWeightModifierComponentController, RadiusWeightModifierComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<RadiusWeightModifierComponentController, RadiusWeightModifierComponentConfig>;
AZ_COMPONENT(AZ::Render::RadiusWeightModifierComponent, "{8F0FC718-50E1-425E-A1E7-9C0425879CEB}", BaseClass);
RadiusWeightModifierComponent() = default;
RadiusWeightModifierComponent(const RadiusWeightModifierComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
}
}
@@ -0,0 +1,34 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void RadiusWeightModifierComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<RadiusWeightModifierComponentConfig, ComponentConfig>()
->Version(0)
->Field("Radius", &RadiusWeightModifierComponentConfig::m_radius)
;
}
}
}
}
@@ -0,0 +1,84 @@
/*
* 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.
*
*/
#include <PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
void RadiusWeightModifierComponentController::Reflect(AZ::ReflectContext* context)
{
RadiusWeightModifierComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<RadiusWeightModifierComponentController>()
->Version(0)
->Field("Configuration", &RadiusWeightModifierComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<PostFxWeightRequestBus>("PostFxWeightRequestBus");
}
}
void RadiusWeightModifierComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void RadiusWeightModifierComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void RadiusWeightModifierComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
RadiusWeightModifierComponentController::RadiusWeightModifierComponentController(const RadiusWeightModifierComponentConfig& config)
: m_configuration(config)
{
}
void RadiusWeightModifierComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostFxWeightRequestBus::Handler::BusConnect(m_entityId);
}
void RadiusWeightModifierComponentController::Deactivate()
{
PostFxWeightRequestBus::Handler::BusDisconnect(m_entityId);
m_entityId.SetInvalid();
}
void RadiusWeightModifierComponentController::SetConfiguration(const RadiusWeightModifierComponentConfig& config)
{
m_configuration = config;
}
float RadiusWeightModifierComponentController::GetWeightAtPosition(const AZ::Vector3& influencerPosition) const
{
AZ::Vector3 postfxCenterPosition = AZ::Vector3::CreateZero();
AZ::TransformBus::EventResult(postfxCenterPosition, m_entityId, &AZ::TransformInterface::GetWorldTranslation);
float magnitude = postfxCenterPosition.GetDistance(influencerPosition);
return AZ::GetMax(0.0f, 1 - magnitude / m_configuration.m_radius);
}
}
}
@@ -0,0 +1,52 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
namespace AZ
{
namespace Render
{
class RadiusWeightModifierComponentController final
: public PostFxWeightRequestBus::Handler
{
public:
friend class EditorRadiusWeightModifierComponent;
AZ_TYPE_INFO(AZ::Render::RadiusWeightModifierComponentController, "{29565EC9-8DE1-46A5-B20C-328AA6ED23C6}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
RadiusWeightModifierComponentController() = default;
RadiusWeightModifierComponentController(const RadiusWeightModifierComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const RadiusWeightModifierComponentConfig& config);
const RadiusWeightModifierComponentConfig& GetConfiguration() const { return m_configuration; }
virtual float GetWeightAtPosition(const AZ::Vector3& influencerPosition) const override;
private:
AZ_DISABLE_COPY(RadiusWeightModifierComponentController);
RadiusWeightModifierComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,84 @@
/*
* 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.
*
*/
#include <PostProcess/ShapeWeightModifier/EditorShapeWeightModifierComponent.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConstants.h>
namespace AZ
{
namespace Render
{
void EditorShapeWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorShapeWeightModifierComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorShapeWeightModifierComponent>(
"PostFX Shape Weight Modifier", "Modifies PostFX override factor based on proximity of an influencer against this entity's bounding sphere")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png")
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "")
;
editContext->Class<ShapeWeightModifierComponentController>("ShapeWeightModifierComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &ShapeWeightModifierComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<ShapeWeightModifierComponentConfig>("ShapeWeightModifierComponentConfig", "")
->DataElement(AZ::Edit::UIHandlers::Slider,
&ShapeWeightModifierComponentConfig::m_falloffDistance,
"Fall-off Distance",
"Distance from the shape to smoothly transition the PostFX.")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
->Attribute(AZ::Edit::Attributes::Max, std::numeric_limits<float>::max())
->Attribute(AZ::Edit::Attributes::SoftMax, 100.0f);
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorShapeWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("EditorShapeWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorShapeWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorShapeWeightModifierComponent::EditorShapeWeightModifierComponent(const ShapeWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
AZ::u32 EditorShapeWeightModifierComponent::OnConfigurationChanged()
{
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,37 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/ShapeWeightModifier/ShapeWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
class EditorShapeWeightModifierComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<ShapeWeightModifierComponentController, ShapeWeightModifierComponent, ShapeWeightModifierComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<ShapeWeightModifierComponentController, ShapeWeightModifierComponent, ShapeWeightModifierComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorShapeWeightModifierComponent, EditorShapeWeightModifierComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorShapeWeightModifierComponent() = default;
EditorShapeWeightModifierComponent(const ShapeWeightModifierComponentConfig& config);
AZ::u32 OnConfigurationChanged() override;
};
}
}
@@ -0,0 +1,44 @@
/*
* 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.
*
*/
#include <PostProcess/ShapeWeightModifier/ShapeWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
ShapeWeightModifierComponent::ShapeWeightModifierComponent(const ShapeWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
void ShapeWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ShapeWeightModifierComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<ShapeWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("ShapeWeightModifierComponentTypeId", BehaviorConstant(Uuid(ShapeWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
}
}
@@ -0,0 +1,38 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConfig.h>
#include <PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
class ShapeWeightModifierComponent final
: public AzFramework::Components::ComponentAdapter<ShapeWeightModifierComponentController, ShapeWeightModifierComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<ShapeWeightModifierComponentController, ShapeWeightModifierComponentConfig>;
AZ_COMPONENT(AZ::Render::ShapeWeightModifierComponent, "{0BB6438B-6DD1-4A09-927F-7757D39C940D}", BaseClass);
ShapeWeightModifierComponent() = default;
ShapeWeightModifierComponent(const ShapeWeightModifierComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
}
}
@@ -0,0 +1,34 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void ShapeWeightModifierComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<ShapeWeightModifierComponentConfig, ComponentConfig>()
->Version(0)
->Field("FalloffDistance", &ShapeWeightModifierComponentConfig::m_falloffDistance)
;
}
}
}
}
@@ -0,0 +1,108 @@
/*
* 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.
*
*/
#include <PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentController.h>
#include <LmbrCentral/Shape/ShapeComponentBus.h>
namespace AZ
{
namespace Render
{
void ShapeWeightModifierComponentController::Reflect(AZ::ReflectContext* context)
{
ShapeWeightModifierComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<ShapeWeightModifierComponentController>()
->Version(0)
->Field("Configuration", &ShapeWeightModifierComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
}
}
void ShapeWeightModifierComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void ShapeWeightModifierComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void ShapeWeightModifierComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
required.push_back(AZ_CRC("ShapeService", 0xe86aa5fe));
}
ShapeWeightModifierComponentController::ShapeWeightModifierComponentController(const ShapeWeightModifierComponentConfig& config)
: m_configuration(config)
{
}
void ShapeWeightModifierComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostFxWeightRequestBus::Handler::BusConnect(m_entityId);
}
void ShapeWeightModifierComponentController::Deactivate()
{
PostFxWeightRequestBus::Handler::BusDisconnect(m_entityId);
m_entityId.SetInvalid();
}
void ShapeWeightModifierComponentController::SetConfiguration(const ShapeWeightModifierComponentConfig& config)
{
m_configuration = config;
}
// Implementation taken from GradientSignal Gem
float ShapeWeightModifierComponentController::GetWeightAtPosition(const AZ::Vector3& influencerPosition) const
{
float distance = 0.0f;
LmbrCentral::ShapeComponentRequestsBus::EventResult(distance, m_entityId, &LmbrCentral::ShapeComponentRequestsBus::Events::DistanceFromPoint, influencerPosition);
// In the special case of 0 falloff, make sure that all points inside the shape (0 distance) return
// 1.0, and all points outside the shape return 0.
if (m_configuration.m_falloffDistance == 0.0f)
{
return (distance > 0.0f) ? 0.0f : 1.0f;
}
// Since this is outer falloff, distance should give us values from 1.0 at the minimum distance
// to 0.0 at the maximum distance.
return GetRatio(m_configuration.m_falloffDistance, 0.0f, distance);
}
// Implementation taken from GradientSignal Gem
float ShapeWeightModifierComponentController::GetRatio(float maxRange, float minRange, float distance) const
{
// If our min/max range is equal, GetRatio() would end up dividing by infinity, so in this case
// make sure that everything below or equal to the min/max value is 0.0, and everything above it is 1.0.
if (maxRange == minRange)
{
return (distance <= minRange) ? 0.0f : 1.0f;
}
return AZ::GetClamp((distance - maxRange) / (minRange - maxRange), 0.0f, 1.0f);
}
}
}
@@ -0,0 +1,55 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ShapeWeightModifier/ShapeWeightModifierComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
namespace AZ
{
namespace Render
{
class ShapeWeightModifierComponentController final
: public PostFxWeightRequestBus::Handler
{
public:
friend class EditorShapeWeightModifierComponent;
AZ_TYPE_INFO(AZ::Render::ShapeWeightModifierComponentController, "{5EF82EB8-8A7F-4B6C-BD40-8BABA1ABE0E5}");
static void Reflect(AZ::ReflectContext* context);
ShapeWeightModifierComponentController() = default;
ShapeWeightModifierComponentController(const ShapeWeightModifierComponentConfig& config);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const ShapeWeightModifierComponentConfig& config);
const ShapeWeightModifierComponentConfig& GetConfiguration() const { return m_configuration; }
//! PostFxWeightRequestBus::Handler Override
virtual float GetWeightAtPosition(const AZ::Vector3& influencerPosition) const override;
private:
float GetRatio(float maxRange, float minRange, float distance) const;
AZ_DISABLE_COPY(ShapeWeightModifierComponentController);
ShapeWeightModifierComponentConfig m_configuration;
EntityId m_entityId;
};
}
}
@@ -0,0 +1,134 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/Ssao/EditorSsaoComponent.h>
namespace AZ
{
namespace Render
{
void EditorSsaoComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorSsaoComponent, BaseClass>()
->Version(2);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorSsaoComponent>(
"SSAO", "Controls SSAO.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [GFX TODO][ATOM-2672][PostFX] need create page for PostProcessing.
;
editContext->Class<SsaoComponentController>(
"SsaoComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &SsaoComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<SsaoComponentConfig>("SsaoComponentConfig", "")
->ClassElement(Edit::ClassElements::EditorData, "")
->DataElement(Edit::UIHandlers::CheckBox,
&SsaoComponentConfig::m_enabled,
"Enable SSAO",
"Enable SSAO.")
->DataElement(Edit::UIHandlers::Slider, &SsaoComponentConfig::m_strength,
"SSAO Strength",
"Multiplier for how much strong SSAO appears.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 2.0f)
->DataElement(Edit::UIHandlers::Slider, &SsaoComponentConfig::m_samplingRadius,
"Sampling Radius",
"The sampling radius of the SSAO effect in screen UV space")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 0.25f)
->DataElement(Edit::UIHandlers::CheckBox,
&SsaoComponentConfig::m_enableBlur,
"Enable Blur",
"Enables SSAO Blur")
->DataElement(Edit::UIHandlers::Slider, &SsaoComponentConfig::m_blurConstFalloff,
"Blur Strength",
"Affects how strong the blur is. Recommended value is 0.67")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 0.95f)
->DataElement(Edit::UIHandlers::Slider, &SsaoComponentConfig::m_blurDepthFalloffStrength,
"Blur Sharpness",
"Affects how sharp the SSAO blur appears around edges. Recommended value is 50")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 400.0f)
->DataElement(Edit::UIHandlers::Slider, &SsaoComponentConfig::m_blurDepthFalloffThreshold,
"Blur Edge Threshold",
"Affects the threshold needed for the blur algorithm to detect an edge. Recommended to be left at 0.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(Edit::UIHandlers::CheckBox,
&SsaoComponentConfig::m_enableDownsample,
"Enable Downsample",
"Enables depth downsampling before SSAO. Slightly lower quality but 2x as fast as regular SSAO.")
// Overrides
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
// Auto-gen editor context settings for overrides
#define EDITOR_CLASS SsaoComponentConfig
#include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef EDITOR_CLASS
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorSsaoComponent>()->RequestBus("SsaoRequestBus");
behaviorContext->ConstantProperty("EditorSsaoComponentTypeId", BehaviorConstant(Uuid(Ssao::EditorSsaoComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorSsaoComponent::EditorSsaoComponent(const SsaoComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorSsaoComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,46 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <Atom/Feature/PostProcess/Ssao/SsaoConstants.h>
#include <PostProcess/Ssao/SsaoComponent.h>
namespace AZ
{
namespace Render
{
namespace Ssao
{
static constexpr const char* const EditorSsaoComponentTypeId = "{5A807489-4FB2-4421-A4D2-9D9E523ABF83}";
}
class EditorSsaoComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<SsaoComponentController, SsaoComponent, SsaoComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<SsaoComponentController, SsaoComponent, SsaoComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorSsaoComponent, Ssao::EditorSsaoComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorSsaoComponent() = default;
EditorSsaoComponent(const SsaoComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,46 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <PostProcess/Ssao/SsaoComponent.h>
namespace AZ
{
namespace Render
{
SsaoComponent::SsaoComponent(const SsaoComponentConfig& config)
: BaseClass(config)
{
}
void SsaoComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<SsaoComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<SsaoComponent>()->RequestBus("SsaoRequestBus");
behaviorContext->ConstantProperty("SsaoComponentTypeId", BehaviorConstant(Uuid(Ssao::SsaoComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,43 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoComponentConfiguration.h>
#include <Atom/Feature/PostProcess/Ssao/SsaoConstants.h>
#include <PostProcess/Ssao/SsaoComponentController.h>
namespace AZ
{
namespace Render
{
namespace Ssao
{
static constexpr const char* const SsaoComponentTypeId = "{F1203F4B-89B6-409E-AB99-B9CC87AABC2E}";
}
class SsaoComponent final
: public AzFramework::Components::ComponentAdapter<SsaoComponentController, SsaoComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<SsaoComponentController, SsaoComponentConfig>;
AZ_COMPONENT(AZ::Render::SsaoComponent, Ssao::SsaoComponentTypeId , BaseClass);
SsaoComponent() = default;
SsaoComponent(const SsaoComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,67 @@
/*
* 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.
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoComponentConfiguration.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void SsaoComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<SsaoComponentConfig, ComponentConfig>()
->Version(0)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS SsaoComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void SsaoComponentConfig::CopySettingsFrom(SsaoSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_SOURCE settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsFrom.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_SOURCE
}
void SsaoComponentConfig::CopySettingsTo(SsaoSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,166 @@
/*
* 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.
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/Ssao/SsaoComponentController.h>
namespace AZ
{
namespace Render
{
void SsaoComponentController::Reflect(ReflectContext* context)
{
SsaoComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<SsaoComponentController>()
->Version(0)
->Field("Configuration", &SsaoComponentController::m_configuration);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<SsaoRequestBus>("SsaoRequestBus")
// Auto-gen behavior context...
#define PARAM_EVENT_BUS SsaoRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void SsaoComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("SsaoService"));
}
void SsaoComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("SsaoService"));
}
void SsaoComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
SsaoComponentController::SsaoComponentController(const SsaoComponentConfig& config)
: m_configuration(config)
{
}
void SsaoComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
PostProcessFeatureProcessorInterface* fp = RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
if (fp)
{
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
if (m_postProcessInterface)
{
m_ssaoSettingsInterface = m_postProcessInterface->GetOrCreateSsaoSettingsInterface();
OnConfigChanged();
}
}
SsaoRequestBus::Handler::BusConnect(m_entityId);
}
void SsaoComponentController::Deactivate()
{
SsaoRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveSsaoSettingsInterface();
}
m_postProcessInterface = nullptr;
m_ssaoSettingsInterface = nullptr;
m_entityId.SetInvalid();
}
// Getters & Setters...
void SsaoComponentController::SetConfiguration(const SsaoComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const SsaoComponentConfig& SsaoComponentController::GetConfiguration() const
{
return m_configuration;
}
void SsaoComponentController::OnConfigChanged()
{
if (m_ssaoSettingsInterface)
{
m_configuration.CopySettingsTo(m_ssaoSettingsInterface);
m_ssaoSettingsInterface->OnConfigChanged();
}
}
// Auto-gen getter/setter function definitions...
// The setter functions will set the values on the Atom settings class, then get the value back
// from the settings class to set the local configuration. This is in case the settings class
// applies some custom logic that results in the set value being different from the input
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
ValueType SsaoComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void SsaoComponentController::Set##Name(ValueType val) \
{ \
if(m_ssaoSettingsInterface) \
{ \
m_ssaoSettingsInterface->Set##Name(val); \
m_ssaoSettingsInterface->OnConfigChanged(); \
m_configuration.MemberName = m_ssaoSettingsInterface->Get##Name(); \
} \
else \
{ \
m_configuration.MemberName = val; \
} \
} \
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
OverrideValueType SsaoComponentController::Get##Name##Override() const \
{ \
return m_configuration.MemberName##Override; \
} \
void SsaoComponentController::Set##Name##Override(OverrideValueType val) \
{ \
m_configuration.MemberName##Override = val; \
if(m_ssaoSettingsInterface) \
{ \
m_ssaoSettingsInterface->Set##Name##Override(val); \
m_ssaoSettingsInterface->OnConfigChanged(); \
} \
} \
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,65 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoComponentConfiguration.h>
#include <Atom/Feature/PostProcess/Ssao/SsaoSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
namespace AZ
{
namespace Render
{
class SsaoComponentController final
: public SsaoRequestBus::Handler
{
public:
friend class EditorSsaoComponent;
AZ_TYPE_INFO(AZ::Render::SsaoComponentController, "{B53B6F29-C803-46AD-83E1-526457BDFBAE}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
SsaoComponentController() = default;
SsaoComponentController(const SsaoComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const SsaoComponentConfig& config);
const SsaoComponentConfig& GetConfiguration() const;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/Ssao/SsaoParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(SsaoComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
SsaoSettingsInterface* m_ssaoSettingsInterface = nullptr;
SsaoComponentConfig m_configuration;
EntityId m_entityId;
};
}
}