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,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;
};
}
}