Merge branch 'Atom/santorac/RemixableMaterialTypes' into Atom/santorac/RemixableMaterialTypes2

This commit is contained in:
santorac
2021-09-28 22:14:23 -07:00
860 changed files with 25089 additions and 12205 deletions
@@ -32,7 +32,7 @@ namespace AZ
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorDecalComponent>(
"Decal (Atom)", "The Decal component allows an entity to project a texture or material onto a mesh")
"Decal", "The Decal component allows an entity to project a texture or material onto a mesh")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Decal.svg")
@@ -97,13 +97,25 @@ namespace AZ
BaseClass::Deactivate();
}
AZ::Transform EditorDecalComponent::GetTransform() const
AZ::Transform EditorDecalComponent::GetWorldTransform() const
{
AZ::Transform transform = AZ::Transform::CreateIdentity();
AZ::TransformBus::EventResult(transform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
return transform;
}
AZ::Matrix3x4 EditorDecalComponent::GetWorldTransformWithNonUniformScale() const
{
const AZ::Transform worldTransform = GetWorldTransform();
const AZ::Matrix3x3 rotationMat = AZ::Matrix3x3::CreateFromQuaternion(worldTransform.GetRotation());
const AZ::Vector3 nonUniformScale = m_controller.m_cachedNonUniformScale * worldTransform.GetUniformScale();
const AZ::Matrix3x3 nonUniformScaleMat = AZ::Matrix3x3::CreateScale(nonUniformScale);
const AZ::Matrix3x3 rotationAndScale = rotationMat * nonUniformScaleMat;
return AZ::Matrix3x4::CreateFromMatrix3x3AndTranslation(rotationAndScale, worldTransform.GetTranslation());
}
void EditorDecalComponent::DisplayEntityViewport(
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
AzFramework::DebugDisplayRequests& debugDisplay)
@@ -113,11 +125,9 @@ namespace AZ
return;
}
AZ::Transform transform = GetTransform();
debugDisplay.SetColor(AZ::Colors::Red);
debugDisplay.PushMatrix(transform);
const AZ::Matrix3x4 transform = GetWorldTransformWithNonUniformScale();
debugDisplay.PushPremultipliedMatrix(transform);
debugDisplay.DrawWireBox(-AZ::Vector3::CreateOne(), AZ::Vector3::CreateOne());
AZ::Vector3 x1 = AZ::Vector3(-1, 0, 1);
@@ -136,7 +146,7 @@ namespace AZ
// Two diagonal edges
debugDisplay.DrawLine(p0, p2);
debugDisplay.DrawLine(p1, p3);
debugDisplay.PopMatrix();
debugDisplay.PopPremultipliedMatrix();
}
AZ::Aabb EditorDecalComponent::GetEditorSelectionBoundsViewport([[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo)
@@ -56,7 +56,11 @@ namespace AZ
private:
AZ::Transform GetTransform() const;
// Returns the component transform which includes uniform-scale, rotation and translation
AZ::Transform GetWorldTransform() const;
// Returns the full transform, including both the uniform scale and non-uniform scale along with rotation and translation
AZ::Matrix3x4 GetWorldTransformWithNonUniformScale() const;
//! EditorRenderComponentAdapter overrides ...
u32 OnConfigurationChanged() override;
@@ -32,9 +32,6 @@ namespace AZ
const char* EditorMaterialComponent::GenerateMaterialsButtonText = "Generate/Manage Source Materials...";
const char* EditorMaterialComponent::GenerateMaterialsToolTipText = "Generate editable source material files from materials provided by the model.";
const char* EditorMaterialComponent::ResetMaterialsButtonText = "Reset Materials";
const char* EditorMaterialComponent::ResetMaterialsToolTipText = "Clear all settings, materials, and properties then rebuild material slots from the associated model.";
// Update serialized data to the new format and data types
bool EditorMaterialComponent::ConvertVersion(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
{
@@ -178,43 +175,74 @@ namespace AZ
menu->addSeparator();
action = menu->addAction(ResetMaterialsButtonText, [this]() { ResetMaterialSlots(); });
action->setToolTip(ResetMaterialsToolTipText);
action = menu->addAction("Clear All Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing all materials.");
SetDirty();
menu->addSeparator();
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearAllMaterialOverrides);
m_materialSlotsByLodEnabled = false;
UpdateMaterialSlots();
});
action->setToolTip("Clear all materials and properties then rebuild material slots from the associated model.");
action = menu->addAction("Clear Model Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing model materials.");
SetDirty();
for (auto& materialSlotPair : GetMaterialSlots())
{
EditorMaterialComponentSlot* materialSlot = materialSlotPair.second;
if (materialSlot->m_id.IsSlotIdOnly())
{
materialSlot->Clear();
}
}
});
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearModelMaterialOverrides);
UpdateMaterialSlots();
});
action->setToolTip("Clear model materials and properties then rebuild material slots from the associated model.");
action = menu->addAction("Clear LOD Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing LOD materials.");
SetDirty();
for (auto& materialSlotPair : GetMaterialSlots())
{
EditorMaterialComponentSlot* materialSlot = materialSlotPair.second;
if (materialSlot->m_id.IsLodAndSlotId())
{
materialSlot->Clear();
}
}
});
action->setEnabled(m_materialSlotsByLodEnabled);
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides);
m_materialSlotsByLodEnabled = false;
UpdateMaterialSlots();
});
action->setToolTip("Clear LOD materials and properties then rebuild material slots from the associated model.");
action = menu->addAction("Clear Incompatible Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing incompatible materials.");
SetDirty();
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearIncompatibleMaterialOverrides);
UpdateMaterialSlots();
});
action->setToolTip("Clear residual materials that don't correspond to the associated model.");
action = menu->addAction("Clear Invalid Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing invalid materials.");
SetDirty();
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearInvalidMaterialOverrides);
UpdateMaterialSlots();
});
action->setToolTip("Clear materials that reference missing assets.");
action = menu->addAction("Repair Invalid Materials", [this]() {
AzToolsFramework::ScopedUndoBatch undoBatch("Repairing invalid materials.");
SetDirty();
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::RepairInvalidMaterialOverrides);
UpdateMaterialSlots();
});
action->setToolTip("Repair materials that reference missing assets by assigning the default asset.");
}
void EditorMaterialComponent::SetPrimaryAsset(const AZ::Data::AssetId& assetId)
{
m_controller.SetDefaultMaterialOverride(assetId);
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::SetDefaultMaterialOverride, assetId);
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
@@ -249,14 +277,18 @@ namespace AZ
m_materialSlots = {};
m_materialSlotsByLod = {};
const MaterialComponentConfig& config = m_controller.GetConfiguration();
// Get current material assignments
MaterialAssignmentMap currentMaterials;
MaterialComponentRequestBus::EventResult(
currentMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetMaterialOverrides);
// Get the known material assignment slots from the associated model or other source
MaterialAssignmentMap materialsFromSource;
MaterialReceiverRequestBus::EventResult(materialsFromSource, GetEntityId(), &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
MaterialAssignmentMap originalMaterials;
MaterialComponentRequestBus::EventResult(
originalMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetOriginalMaterialAssignments);
// Generate the table of editable materials using the source data to define number of groups, elements, and initial values
for (const auto& materialPair : materialsFromSource)
for (const auto& materialPair : originalMaterials)
{
// Setup the material slot entry
EditorMaterialComponentSlot slot;
@@ -264,7 +296,7 @@ namespace AZ
slot.m_id = materialPair.first;
// if material is present in controller configuration, assign its data
const MaterialAssignment& materialFromController = GetMaterialAssignmentFromMap(config.m_materials, slot.m_id);
const MaterialAssignment& materialFromController = GetMaterialAssignmentFromMap(currentMaterials, slot.m_id);
slot.m_materialAsset = materialFromController.m_materialAsset;
if (slot.m_id.IsDefault())
@@ -289,7 +321,7 @@ namespace AZ
}
}
// Sort all of the slots by label to ensure stable index values (materialsFromSource is an unordered map)
// Sort all of the slots by label to ensure stable index values (originalMaterials is an unordered map)
AZStd::sort(m_materialSlots.begin(), m_materialSlots.end(),
[](const auto& a, const auto& b) { return a.GetLabel() < b.GetLabel(); });
@@ -305,49 +337,36 @@ namespace AZ
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
}
AZ::u32 EditorMaterialComponent::ResetMaterialSlots()
{
AzToolsFramework::ScopedUndoBatch undoBatch("Resetting materials.");
SetDirty();
m_controller.SetMaterialOverrides(MaterialAssignmentMap());
UpdateMaterialSlots();
m_materialSlotsByLodEnabled = false;
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
return AZ::Edit::PropertyRefreshLevels::EntireTree;
}
AZ::u32 EditorMaterialComponent::OpenMaterialExporter()
{
AzToolsFramework::ScopedUndoBatch undoBatch("Generating materials.");
SetDirty();
// First generating a unique set of all material asset IDs that will be used for source data generation
AZStd::unordered_map<AZ::Data::AssetId, AZStd::string /*slot name*/> assetIdMap;
MaterialAssignmentMap originalMaterials;
MaterialComponentRequestBus::EventResult(
originalMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetOriginalMaterialAssignments);
auto materialSlots = GetMaterialSlots();
for (auto& materialSlotPair : materialSlots)
// Generate a unique set of all material asset IDs that will be used for source data generation
AZStd::unordered_map<AZ::Data::AssetId, AZStd::string> assetIdToSlotNameMap;
for (const auto& materialPair : originalMaterials)
{
Data::AssetId defaultMaterialAssetId = materialSlotPair.second->GetDefaultAssetId();
if (defaultMaterialAssetId.IsValid())
const Data::AssetId originalAssetId = materialPair.second.m_materialAsset.GetId();
if (originalAssetId.IsValid())
{
assetIdMap[defaultMaterialAssetId] = materialSlotPair.second->GetLabel();
MaterialComponentRequestBus::EventResult(
assetIdToSlotNameMap[originalAssetId], GetEntityId(), &MaterialComponentRequestBus::Events::GetMaterialSlotLabel,
materialPair.first);
}
}
// Convert the unique set of asset IDs into export items that can be configured in the dialog
// The order should not matter because the table in the dialog can sort itself for a specific row
EditorMaterialComponentExporter::ExportItemsContainer exportItems;
for (auto assetIdInfo : assetIdMap)
exportItems.reserve(assetIdToSlotNameMap.size());
for (const auto& [assetId, slotName] : assetIdToSlotNameMap)
{
EditorMaterialComponentExporter::ExportItem exportItem{ assetIdInfo.first, assetIdInfo.second };
exportItems.push_back(exportItem);
exportItems.emplace_back(assetId, slotName);
}
// Display the export dialog so that the user can configure how they want different materials to be exported
@@ -363,16 +382,17 @@ namespace AZ
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
if (assetIdOutcome)
{
for (auto& materialSlotPair : materialSlots)
for (const auto& materialPair : originalMaterials)
{
EditorMaterialComponentSlot* editorMaterialSlot = materialSlotPair.second;
if (editorMaterialSlot)
// We need to check whether replaced material corresponds to this slot's default material.
const Data::AssetId originalAssetId = materialPair.second.m_materialAsset.GetId();
if (originalAssetId == exportItem.GetOriginalAssetId())
{
// We need to check whether replaced material corresponds to this slot's default material.
if (editorMaterialSlot->GetDefaultAssetId() == exportItem.GetOriginalAssetId())
if (m_materialSlotsByLodEnabled || !materialPair.first.IsLodAndSlotId())
{
editorMaterialSlot->SetAsset(assetIdOutcome.GetValue());
MaterialComponentRequestBus::Event(
GetEntityId(), &MaterialComponentRequestBus::Events::SetMaterialOverride, materialPair.first,
assetIdOutcome.GetValue());
}
}
}
@@ -380,12 +400,9 @@ namespace AZ
}
}
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
UpdateMaterialSlots();
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_AttributesAndValues);
return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
return AZ::Edit::PropertyRefreshLevels::EntireTree;
}
AZ::u32 EditorMaterialComponent::OnLodsToggled()
@@ -395,15 +412,10 @@ namespace AZ
if (!m_materialSlotsByLodEnabled)
{
MaterialComponentConfig config = m_controller.GetConfiguration();
AZStd::erase_if(config.m_materials, [](const auto& item) {
const auto& [key, value] = item;
return key.m_lodIndex != MaterialAssignmentId::NonLodIndex;
});
m_controller.SetMaterialOverrides(config.m_materials);
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides);
}
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
UpdateMaterialSlots();
return AZ::Edit::PropertyRefreshLevels::EntireTree;
}
@@ -440,41 +452,5 @@ namespace AZ
{
return AZStd::string::format("LOD %d", lodIndex);
}
template<typename ComponentType, typename ContainerType>
void EditorMaterialComponent::BuildMaterialSlotMap(ComponentType& component, ContainerType& materialSlots)
{
materialSlots[DefaultMaterialAssignmentId] = &component.m_defaultMaterialSlot;
for (auto& slot : component.m_materialSlots)
{
materialSlots[slot.m_id] = &slot;
}
if (component.m_materialSlotsByLodEnabled)
{
for (auto& slotsForLod : component.m_materialSlotsByLod)
{
for (auto& slot : slotsForLod)
{
materialSlots[slot.m_id] = &slot;
}
}
}
}
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> EditorMaterialComponent::GetMaterialSlots()
{
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> materialSlots;
BuildMaterialSlotMap(*this, materialSlots);
return AZStd::move(materialSlots);
}
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> EditorMaterialComponent::GetMaterialSlots() const
{
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> materialSlots;
BuildMaterialSlotMap(*this, materialSlots);
return AZStd::move(materialSlots);
}
} // namespace Render
} // namespace AZ
@@ -58,9 +58,6 @@ namespace AZ
// controller configuration then those values will be assigned to the editor component slots.
void UpdateMaterialSlots();
// Clears all values related to the material component and regenerates the editor slots
AZ::u32 ResetMaterialSlots();
// Opens the source material export dialog and updates editor material slots based on
// selected actions
AZ::u32 OpenMaterialExporter();
@@ -82,10 +79,6 @@ namespace AZ
// Evaluate if materials can be edited
bool IsEditingAllowed() const;
template<typename ComponentType, typename ContainerType>
static void BuildMaterialSlotMap(ComponentType& component, ContainerType& materialSlots);
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> GetMaterialSlots();
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> GetMaterialSlots() const;
AZStd::string GetLabelForLod(int lodIndex) const;
AZStd::string m_message;
@@ -55,6 +55,10 @@ namespace AZ
bool OpenExportDialog(ExportItemsContainer& exportItems)
{
// Sort material entries so they are ordered by name in the table
AZStd::sort(exportItems.begin(), exportItems.end(),
[](const auto& a, const auto& b) { return a.GetMaterialSlotName() < b.GetMaterialSlotName(); });
QWidget* activeWindow = nullptr;
AzToolsFramework::EditorWindowRequestBus::BroadcastResult(activeWindow, &AzToolsFramework::EditorWindowRequests::GetAppMainWindow);
@@ -140,7 +140,7 @@ namespace AZ
void EditorMaterialComponentSlot::SetAsset(const Data::AssetId& assetId)
{
m_materialAsset.Create(assetId);
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(assetId, AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
MaterialComponentRequestBus::Event(
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
OnDataChanged();
@@ -164,7 +164,7 @@ namespace AZ
void EditorMaterialComponentSlot::ClearToDefaultAsset()
{
m_materialAsset.Create(GetDefaultAssetId());
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(GetDefaultAssetId(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
MaterialComponentRequestBus::Event(
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
ClearOverrides();
@@ -204,7 +204,8 @@ namespace AZ
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
if (assetIdOutcome)
{
m_materialAsset.Create(assetIdOutcome.GetValue());
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(
assetIdOutcome.GetValue(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
changed = true;
}
}
@@ -43,6 +43,11 @@ namespace AZ
->Event("SetDefaultMaterialOverride", &MaterialComponentRequestBus::Events::SetDefaultMaterialOverride)
->Event("GetDefaultMaterialOverride", &MaterialComponentRequestBus::Events::GetDefaultMaterialOverride)
->Event("ClearDefaultMaterialOverride", &MaterialComponentRequestBus::Events::ClearDefaultMaterialOverride)
->Event("ClearModelMaterialOverrides", &MaterialComponentRequestBus::Events::ClearModelMaterialOverrides)
->Event("ClearLodMaterialOverrides", &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides)
->Event("ClearIncompatibleMaterialOverrides", &MaterialComponentRequestBus::Events::ClearIncompatibleMaterialOverrides)
->Event("ClearInvalidMaterialOverrides", &MaterialComponentRequestBus::Events::ClearInvalidMaterialOverrides)
->Event("RepairInvalidMaterialOverrides", &MaterialComponentRequestBus::Events::RepairInvalidMaterialOverrides)
->Event("SetMaterialOverride", &MaterialComponentRequestBus::Events::SetMaterialOverride)
->Event("GetMaterialOverride", &MaterialComponentRequestBus::Events::GetMaterialOverride)
->Event("ClearMaterialOverride", &MaterialComponentRequestBus::Events::ClearMaterialOverride)
@@ -275,10 +280,10 @@ namespace AZ
MaterialAssignmentMap MaterialComponentController::GetOriginalMaterialAssignments() const
{
MaterialAssignmentMap materialAssignmentMap;
MaterialAssignmentMap originalMaterials;
MaterialReceiverRequestBus::EventResult(
materialAssignmentMap, m_entityId, &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
return materialAssignmentMap;
originalMaterials, m_entityId, &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
return originalMaterials;
}
MaterialAssignmentId MaterialComponentController::FindMaterialAssignmentId(
@@ -348,6 +353,67 @@ namespace AZ
}
}
void MaterialComponentController::ClearModelMaterialOverrides()
{
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
return materialPair.first.IsSlotIdOnly();
});
QueueMaterialUpdateNotification();
}
void MaterialComponentController::ClearLodMaterialOverrides()
{
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
return materialPair.first.IsLodAndSlotId();
});
QueueMaterialUpdateNotification();
}
void MaterialComponentController::ClearIncompatibleMaterialOverrides()
{
const MaterialAssignmentMap& originalMaterials = GetOriginalMaterialAssignments();
AZStd::erase_if(m_configuration.m_materials, [&originalMaterials](const auto& materialPair) {
return originalMaterials.find(materialPair.first) == originalMaterials.end();
});
QueueMaterialUpdateNotification();
}
void MaterialComponentController::ClearInvalidMaterialOverrides()
{
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
if (materialPair.second.m_materialAsset.GetId().IsValid())
{
AZ::Data::AssetInfo assetInfo;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(
assetInfo, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetInfoById,
materialPair.second.m_materialAsset.GetId());
return !assetInfo.m_assetId.IsValid();
}
return false;
});
QueueMaterialUpdateNotification();
}
void MaterialComponentController::RepairInvalidMaterialOverrides()
{
for (auto& materialPair : m_configuration.m_materials)
{
if (materialPair.second.m_materialAsset.GetId().IsValid())
{
AZ::Data::AssetInfo assetInfo;
AZ::Data::AssetCatalogRequestBus::BroadcastResult(
assetInfo, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetInfoById,
materialPair.second.m_materialAsset.GetId());
if (!assetInfo.m_assetId.IsValid())
{
materialPair.second.m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(
GetDefaultMaterialAssetId(materialPair.first), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
}
}
}
LoadMaterials();
}
void MaterialComponentController::SetDefaultMaterialOverride(const AZ::Data::AssetId& materialAssetId)
{
SetMaterialOverride(DefaultMaterialAssignmentId, materialAssetId);
@@ -363,9 +429,11 @@ namespace AZ
ClearMaterialOverride(DefaultMaterialAssignmentId);
}
void MaterialComponentController::SetMaterialOverride(const MaterialAssignmentId& materialAssignmentId, const AZ::Data::AssetId& materialAssetId)
void MaterialComponentController::SetMaterialOverride(
const MaterialAssignmentId& materialAssignmentId, const AZ::Data::AssetId& materialAssetId)
{
m_configuration.m_materials[materialAssignmentId].m_materialAsset.Create(materialAssetId);
m_configuration.m_materials[materialAssignmentId].m_materialAsset =
AZ::Data::Asset<AZ::RPI::MaterialAsset>(materialAssetId, AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
LoadMaterials();
}
@@ -616,7 +684,6 @@ namespace AZ
void MaterialComponentController::ClearAllPropertyOverrides()
{
bool cleared = false;
for (auto& materialPair : m_configuration.m_materials)
{
if (!materialPair.second.m_propertyOverrides.empty())
@@ -625,13 +692,8 @@ namespace AZ
materialPair.second.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialPair.second);
QueueMaterialUpdateNotification();
cleared = true;
}
}
if (cleared)
{
}
}
void MaterialComponentController::SetPropertyOverrides(
@@ -52,6 +52,11 @@ namespace AZ
void SetMaterialOverrides(const MaterialAssignmentMap& materials) override;
const MaterialAssignmentMap& GetMaterialOverrides() const override;
void ClearAllMaterialOverrides() override;
void ClearModelMaterialOverrides() override;
void ClearLodMaterialOverrides() override;
void ClearIncompatibleMaterialOverrides() override;
void ClearInvalidMaterialOverrides() override;
void RepairInvalidMaterialOverrides() override;
void SetDefaultMaterialOverride(const AZ::Data::AssetId& materialAssetId) override;
const AZ::Data::AssetId GetDefaultMaterialOverride() const override;
void ClearDefaultMaterialOverride() override;
@@ -24,6 +24,7 @@
#include <OcclusionCullingPlane/OcclusionCullingPlaneComponent.h>
#include <PostProcess/PostFxLayerComponent.h>
#include <PostProcess/Bloom/BloomComponent.h>
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
#include <PostProcess/DepthOfField/DepthOfFieldComponent.h>
#include <PostProcess/DisplayMapper/DisplayMapperComponent.h>
#include <PostProcess/ExposureControl/ExposureControlComponent.h>
@@ -57,6 +58,7 @@
#include <OcclusionCullingPlane/EditorOcclusionCullingPlaneComponent.h>
#include <PostProcess/EditorPostFxLayerComponent.h>
#include <PostProcess/Bloom/EditorBloomComponent.h>
#include <PostProcess/ColorGrading/EditorHDRColorGradingComponent.h>
#include <PostProcess/DepthOfField/EditorDepthOfFieldComponent.h>
#include <PostProcess/DisplayMapper/EditorDisplayMapperComponent.h>
#include <PostProcess/ExposureControl/EditorExposureControlComponent.h>
@@ -93,6 +95,7 @@ namespace AZ
DecalComponent::CreateDescriptor(),
DirectionalLightComponent::CreateDescriptor(),
BloomComponent::CreateDescriptor(),
HDRColorGradingComponent::CreateDescriptor(),
DisplayMapperComponent::CreateDescriptor(),
DepthOfFieldComponent::CreateDescriptor(),
ExposureControlComponent::CreateDescriptor(),
@@ -124,6 +127,7 @@ namespace AZ
EditorDecalComponent::CreateDescriptor(),
EditorDirectionalLightComponent::CreateDescriptor(),
EditorBloomComponent::CreateDescriptor(),
EditorHDRColorGradingComponent::CreateDescriptor(),
EditorDepthOfFieldComponent::CreateDescriptor(),
EditorDisplayMapperComponent::CreateDescriptor(),
EditorExposureControlComponent::CreateDescriptor(),
@@ -0,0 +1,145 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <PostProcess/ColorGrading/EditorHDRColorGradingComponent.h>
namespace AZ
{
namespace Render
{
void EditorHDRColorGradingComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorHDRColorGradingComponent, BaseClass>()->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorHDRColorGradingComponent>(
"HDR Color Grading", "Tune and apply color grading in HDR.")
->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.svg") // [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://") // [TODO ATOM-2672][PostFX] need to create page for PostProcessing.
;
editContext->Class<HDRColorGradingComponentController>(
"HDRColorGradingComponentControl", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &HDRColorGradingComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<HDRColorGradingComponentConfig>("HDRColorGradingComponentConfig", "")
->DataElement(Edit::UIHandlers::CheckBox, &HDRColorGradingComponentConfig::m_enabled,
"Enable HDR color grading",
"Enable HDR color grading.")
->ClassElement(AZ::Edit::ClassElements::Group, "Color Adjustment")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingExposure, "Exposure", "Exposure Value")
->Attribute(Edit::Attributes::Min, AZStd::numeric_limits<float>::lowest())
->Attribute(Edit::Attributes::Max, AZStd::numeric_limits<float>::max())
->Attribute(Edit::Attributes::SoftMin, -20.0f)
->Attribute(Edit::Attributes::SoftMax, 20.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingContrast, "Contrast", "Contrast Value")
->Attribute(Edit::Attributes::Min, -100.0f)
->Attribute(Edit::Attributes::Max, 100.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingPreSaturation, "Pre Saturation", "Pre Saturation Value")
->Attribute(Edit::Attributes::Min, -100.0f)
->Attribute(Edit::Attributes::Max, 100.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingFilterIntensity, "Filter Intensity", "Filter Intensity Value")
->Attribute(Edit::Attributes::Min, AZStd::numeric_limits<float>::lowest())
->Attribute(Edit::Attributes::Max, AZStd::numeric_limits<float>::max())
->Attribute(Edit::Attributes::SoftMin, -1.0f)
->Attribute(Edit::Attributes::SoftMax, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingFilterMultiply, "Filter Multiply", "Filter Multiply Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_colorFilterSwatch, "Color Filter Swatch", "Color Filter Swatch Value")
->ClassElement(AZ::Edit::ClassElements::Group, "White Balance")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_whiteBalanceKelvin, "Temperature", "Temperature in Kelvin")
->Attribute(Edit::Attributes::Min, 1000.0f)
->Attribute(Edit::Attributes::Max, 40000.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_whiteBalanceTint, "Tint", "Tint Value")
->Attribute(Edit::Attributes::Min, -100.0f)
->Attribute(Edit::Attributes::Max, 100.0f)
->ClassElement(AZ::Edit::ClassElements::Group, "Split Toning")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_splitToneWeight, "Split Tone Weight", "Modulates the split toning effect.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_splitToneBalance, "Split Tone Balance", "Split Tone Balance Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_splitToneShadowsColor, "Split Tone Shadows Color", "Split Tone Shadows Color")
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_splitToneHighlightsColor, "Split Tone Highlights Color", "Split Tone Highlights Color")
->ClassElement(AZ::Edit::ClassElements::Group, "Channel Mixing")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingRed, "Channel Mixing Red", "Channel Mixing Red Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingGreen, "Channel Mixing Green", "Channel Mixing Green Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingBlue, "Channel Mixing Blue", "Channel Mixing Blue Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->ClassElement(AZ::Edit::ClassElements::Group, "Shadow Midtones Highlights")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhWeight, "SMH Weight", "Modulates the SMH effect.")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhShadowsStart, "SMH Shadows Start", "SMH Shadows Start Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhShadowsEnd, "SMH Shadows End", "SMH Shadows End Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhHighlightsStart, "SMH Highlights Start", "SMH Highlights Start Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhHighlightsEnd, "SMH Highlights End", "SMH Highlights End Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhShadowsColor, "SMH Shadows Color", "SMH Shadows Color")
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhMidtonesColor, "SMH Midtones Color", "SMH Midtones Color")
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhHighlightsColor, "SMH Highlights Color", "SMH Highlights Color")
->ClassElement(AZ::Edit::ClassElements::Group, "Final Adjustment")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingHueShift, "Hue Shift", "Hue Shift Value")
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 1.0f)
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingPostSaturation, "Post Saturation", "Post Saturation Value")
->Attribute(Edit::Attributes::Min, -100.0f)
->Attribute(Edit::Attributes::Max, 100.0f)
;
}
}
}
EditorHDRColorGradingComponent::EditorHDRColorGradingComponent(const HDRColorGradingComponentConfig& config)
: BaseClass(config)
{
}
u32 EditorHDRColorGradingComponent::OnConfigurationChanged()
{
m_controller.OnConfigChanged();
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,35 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
namespace AZ
{
namespace Render
{
class EditorHDRColorGradingComponent final
: public AzToolsFramework::Components::
EditorComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponent, HDRColorGradingComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponent, HDRColorGradingComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorHDRColorGradingComponent, "{C1FAB0B1-5847-4533-B08E-7314AC807B8E}", BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorHDRColorGradingComponent() = default;
EditorHDRColorGradingComponent(const HDRColorGradingComponentConfig& config);
//! EditorRenderComponentAdapter overrides...
AZ::u32 OnConfigurationChanged() override;
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,30 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
namespace AZ
{
namespace Render
{
HDRColorGradingComponent::HDRColorGradingComponent(const HDRColorGradingComponentConfig& config)
: BaseClass(config)
{
}
void HDRColorGradingComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<HDRColorGradingComponent, BaseClass>();
}
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,33 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Component/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <PostProcess/ColorGrading/HDRColorGradingComponentController.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
namespace AZ
{
namespace Render
{
class HDRColorGradingComponent final
: public AzFramework::Components::ComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponentConfig>;
AZ_COMPONENT(AZ::Render::HDRColorGradingComponent, "{51968E0F-4DF0-4851-8405-388CBB15B573}", BaseClass);
HDRColorGradingComponent() = default;
HDRColorGradingComponent(const HDRColorGradingComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
} // namespace Render
} // namespace AZ
@@ -0,0 +1,47 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void HDRColorGradingComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<HDRColorGradingComponentConfig, ComponentConfig>()->Version(0)
// Auto-gen serialize context code...
#define SERIALIZE_CLASS HDRColorGradingComponentConfig
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef SERIALIZE_CLASS
;
}
}
void HDRColorGradingComponentConfig::CopySettingsTo (HDRColorGradingSettingsInterface* settings)
{
if (!settings)
{
return;
}
#define COPY_TARGET settings
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef COPY_TARGET
}
} // namespace Render
} // namespace AZ
@@ -0,0 +1,146 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/RTTI/BehaviorContext.h>
#include <Atom/RPI.Public/Scene.h>
#include <PostProcess/ColorGrading/HDRColorGradingComponentController.h>
namespace AZ
{
namespace Render
{
void HDRColorGradingComponentController::Reflect(ReflectContext* context)
{
HDRColorGradingComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<HDRColorGradingComponentController>()
->Version(0)
->Field("Configuration", &HDRColorGradingComponentController::m_configuration);
}
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->EBus<HDRColorGradingRequestBus>("HDRColorGradingRequestBus")
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
// Auto-gen behavior context...
#define PARAM_EVENT_BUS HDRColorGradingRequestBus::Events
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
#undef PARAM_EVENT_BUS
;
}
}
void HDRColorGradingComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("HDRColorGradingService"));
}
void HDRColorGradingComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("HDRColorGradingService"));
}
void HDRColorGradingComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
HDRColorGradingComponentController::HDRColorGradingComponentController(const HDRColorGradingComponentConfig& config)
: m_configuration(config)
{
}
void HDRColorGradingComponentController::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->GetOrCreateHDRColorGradingSettingsInterface();
OnConfigChanged();
}
}
HDRColorGradingRequestBus::Handler::BusConnect(m_entityId);
}
void HDRColorGradingComponentController::Deactivate()
{
HDRColorGradingRequestBus::Handler::BusDisconnect(m_entityId);
if (m_postProcessInterface)
{
m_postProcessInterface->RemoveHDRColorGradingSettingsInterface();
}
m_postProcessInterface = nullptr;
m_settingsInterface = nullptr;
m_entityId.SetInvalid();
}
void HDRColorGradingComponentController::SetConfiguration(const HDRColorGradingComponentConfig& config)
{
m_configuration = config;
OnConfigChanged();
}
const HDRColorGradingComponentConfig& HDRColorGradingComponentController::GetConfiguration() const
{
return m_configuration;
}
void HDRColorGradingComponentController::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 HDRColorGradingComponentController::Get##Name() const \
{ \
return m_configuration.MemberName; \
} \
void HDRColorGradingComponentController::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; \
} \
}
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
} // namespace Render
} // namespace AZ
@@ -0,0 +1,59 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Component/Component.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingBus.h>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
namespace AZ
{
namespace Render
{
class HDRColorGradingComponentController final
: public HDRColorGradingRequestBus::Handler
{
public:
friend class EditorHDRColorGradingComponent;
AZ_TYPE_INFO(AZ::Render::HDRColorGradingComponentController, "{CA1D635C-64E9-42C7-A8E0-36C6B825B15D}");
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);
HDRColorGradingComponentController() = default;
HDRColorGradingComponentController(const HDRColorGradingComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const HDRColorGradingComponentConfig& config);
const HDRColorGradingComponentConfig& GetConfiguration() const;
// Auto-gen function override declarations (functions definitions in .cpp)...
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
#include <Atom/Feature/ParamMacros/EndParams.inl>
private:
AZ_DISABLE_COPY(HDRColorGradingComponentController);
void OnConfigChanged();
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
HDRColorGradingSettingsInterface* m_settingsInterface = nullptr;
HDRColorGradingComponentConfig m_configuration;
EntityId m_entityId;
};
} // namespace Render
} // namespace AZ
@@ -212,6 +212,9 @@ namespace AZ
AZ::Vector3 position = AZ::Vector3::CreateZero();
AZ::TransformBus::EventResult(position, GetEntityId(), &AZ::TransformBus::Events::GetWorldTranslation);
AZ::Quaternion rotationQuaternion = AZ::Quaternion::CreateIdentity();
AZ::TransformBus::EventResult(rotationQuaternion, GetEntityId(), &AZ::TransformBus::Events::GetWorldRotationQuaternion);
AZ::Matrix3x3 rotationMatrix = AZ::Matrix3x3::CreateFromQuaternion(rotationQuaternion);
float scale = 1.0f;
AZ::TransformBus::EventResult(scale, GetEntityId(), &AZ::TransformBus::Events::GetLocalUniformScale);
@@ -224,9 +227,7 @@ namespace AZ
AZ::Vector3 innerExtents(configuration.m_innerWidth, configuration.m_innerLength, configuration.m_innerHeight);
innerExtents *= scale;
AZ::Vector3 innerMin(position.GetX() - innerExtents.GetX() / 2, position.GetY() - innerExtents.GetY() / 2, position.GetZ() - innerExtents.GetZ() / 2);
AZ::Vector3 innerMax(position.GetX() + innerExtents.GetX() / 2, position.GetY() + innerExtents.GetY() / 2, position.GetZ() + innerExtents.GetZ() / 2);
debugDisplay.DrawWireBox(innerMin, innerMax);
debugDisplay.DrawWireOBB(position, rotationMatrix.GetBasisX(), rotationMatrix.GetBasisY(), rotationMatrix.GetBasisZ(), innerExtents / 2.0f);
}
AZ::Aabb EditorReflectionProbeComponent::GetEditorSelectionBoundsViewport([[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo)
@@ -231,7 +231,7 @@ namespace SurfaceData
void SurfaceDataMeshComponent::UpdateMeshData()
{
AZ_PROFILE_FUNCTION(Entity);
AZ_PROFILE_SCOPE(Entity, "SurfaceDataMeshComponent: UpdateMeshData");
bool meshValidBeforeUpdate = false;
bool meshValidAfterUpdate = false;