You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/DisplayMapper/EditorDisplayMapperComponen...

166 lines
10 KiB
C++

/*
* 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 "Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h"
#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, "Icons/Components/Component_Placeholder.svg") // [GFX TODO][ATOM-2672][PostFX] need to create icons for PostProcessing.
->Attribute(AZ::Edit::Attributes::ViewportIcon, "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<DisplayMapperAcesParameters>(
"DisplayMapperAcesParameters", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &DisplayMapperAcesParameters::m_overrideDefaults, "Override Defaults",
"When enabled allows parameter overrides for ACES configuration")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &DisplayMapperAcesParameters::m_alterSurround, "Alter Surround",
"Apply gamma adjustment to compensate for dim surround")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &DisplayMapperAcesParameters::m_applyDesaturation, "Alter Desaturation",
"Apply desaturation to compensate for luminance difference")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &DisplayMapperAcesParameters::m_applyCATD60toD65, "Alter CAT D60 to D65",
"Apply Color appearance transform (CAT) from ACES white point to assumed observer adapted white point")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
Edit::UIHandlers::Default, &DisplayMapperAcesParameters::m_cinemaLimitsBlack,
"Cinema Limit (black)",
"Reference black luminance value")
->DataElement(
Edit::UIHandlers::Default, &DisplayMapperAcesParameters::m_cinemaLimitsWhite,
"Cinema Limit (white)",
"Reference white luminance value")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
Edit::UIHandlers::Vector2, &DisplayMapperAcesParameters::m_minPoint, "Min Point (luminance)",
"Linear extension below this")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
Edit::UIHandlers::Vector2, &DisplayMapperAcesParameters::m_midPoint, "Mid Point (luminance)",
"Middle gray")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
Edit::UIHandlers::Vector2, &DisplayMapperAcesParameters::m_maxPoint, "Max Point (luminance)",
"Linear extension above this")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
AZ::Edit::UIHandlers::Default, &DisplayMapperAcesParameters::m_surroundGamma, "Surround Gamma",
"Gamma adjustment to be applied to compensate for the condition of the viewing environment")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->DataElement(
AZ::Edit::UIHandlers::Default, &DisplayMapperAcesParameters::m_gamma, "Gamma",
"Optional gamma value that is applied as basic gamma curve OETF")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
// Load preset group
->ClassElement(AZ::Edit::ClassElements::Group, "Load Preset")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(
Edit::UIHandlers::ComboBox, &DisplayMapperAcesParameters::m_preset, "Preset Selection",
"Allows specifying default preset for different ODT modes")
->EnumAttribute(OutputDeviceTransformType::OutputDeviceTransformType_48Nits, "48 Nits")
->EnumAttribute(OutputDeviceTransformType::OutputDeviceTransformType_1000Nits, "1000 Nits")
->EnumAttribute(OutputDeviceTransformType::OutputDeviceTransformType_2000Nits, "2000 Nits")
->EnumAttribute(OutputDeviceTransformType::OutputDeviceTransformType_4000Nits, "4000 Nits")
->UIElement(AZ::Edit::UIHandlers::Button, "Load", "Load default preset")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &DisplayMapperAcesParameters::LoadPreset)
->Attribute(AZ::Edit::Attributes::ButtonText, "Load")
;
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")
->DataElement(AZ::Edit::UIHandlers::Default, &DisplayMapperComponentConfig::m_acesParameterOverrides, "ACES Parameters", "Parameter overrides for ACES.")
;
}
}
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;
}
}
}