From a71a5746ccd6734a68b8c592cab757879993301f Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Tue, 13 Apr 2021 17:15:10 +0100
Subject: [PATCH 001/330] [LY-113714] Jira: LY-113714
https://jira.agscollab.com/browse/LY-113714
---
.../Serialization/EditContextConstants.inl | 2 +
.../Components/img/UI20/line.svg | 7 ++++
.../AzQtComponents/Components/resources.qrc | 1 +
.../UI/PropertyEditor/PropertyRowWidget.cpp | 37 ++++++++++++++++++-
.../UI/PropertyEditor/PropertyRowWidget.hxx | 8 ++++
Code/Sandbox/Editor/Style/Editor.qss | 5 +++
Gems/Vegetation/Code/Source/Descriptor.cpp | 2 +
7 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
diff --git a/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl b/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
index d4658d4e8c..de67013741 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
+++ b/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
@@ -62,6 +62,8 @@ namespace AZ
const static AZ::Crc32 ButtonTooltip = AZ_CRC("ButtonTooltip", 0x1605a7d2);
const static AZ::Crc32 CheckboxTooltip = AZ_CRC("CheckboxTooltip", 0x1159eb78);
const static AZ::Crc32 CheckboxDefaultValue = AZ_CRC("CheckboxDefaultValue", 0x03f117e6);
+ //! Emboldens the text and adds a line above this item within the RPE.
+ const static AZ::Crc32 RPESectionSeparator = AZ_CRC("RPESectionSeparator", 0xc6249a95);
//! Affects the display order of a node relative to it's parent/children. Higher values display further down (after) lower values. Default is 0, negative values are allowed. Must be applied as an attribute to the EditorData element
const static AZ::Crc32 DisplayOrder = AZ_CRC("DisplayOrder", 0x23660ec2);
//! Specifies whether the UI should support multi-edit for aggregate instances of this property
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
new file mode 100644
index 0000000000..60f7c07c8d
--- /dev/null
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
index 77dead96a1..decc1bd72f 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
@@ -627,6 +627,7 @@
img/UI20/Settings.svg
img/UI20/Asset_Folder.svg
img/UI20/Asset_File.svg
+ img/UI20/line.svg
img/UI20/AssetEditor/default_document.svg
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
index 8c371baf8c..a16c1f7480 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
@@ -44,6 +44,24 @@ namespace AzToolsFramework
m_iconOpen = s_iconOpen;
m_iconClosed = s_iconClosed;
+ m_outerLayout = new QVBoxLayout(nullptr);
+ m_outerLayout->setSpacing(0);
+ m_outerLayout->setContentsMargins(0, 0, 0, 0);
+
+ // separatorLayout will contain a spacer and a separator line. The width of the spacer is adjusted later to ensure the line is the
+ // correct length.
+ QHBoxLayout* separatorLayout = new QHBoxLayout(nullptr);
+ m_outerLayout->addLayout(separatorLayout);
+
+ m_separatorIndent = new QSpacerItem(1, 1);
+ separatorLayout->addItem(m_separatorIndent);
+
+ m_separatorLine.load(QStringLiteral(":/Gallery/line.svg"));
+ m_separatorLine.setFixedHeight(3);
+
+ separatorLayout->addWidget(&m_separatorLine);
+ m_separatorLine.setVisible(false);
+
m_mainLayout = new QHBoxLayout();
m_mainLayout->setSpacing(0);
m_mainLayout->setContentsMargins(0, 1, 0, 1);
@@ -118,7 +136,8 @@ namespace AzToolsFramework
m_handler = nullptr;
m_containerSize = 0;
- setLayout(m_mainLayout);
+ m_outerLayout->addLayout(m_mainLayout);
+ setLayout(m_outerLayout);
}
bool PropertyRowWidget::HasChildWidgetAlready() const
@@ -301,6 +320,9 @@ namespace AzToolsFramework
}
}
+ m_isSectionSeparator = false;
+ m_separatorLine.setVisible(false);
+
RefreshAttributesFromNode(true);
// --------------------- HANDLER discovery:
@@ -946,6 +968,11 @@ namespace AzToolsFramework
{
HandleChangeNotifyAttribute(reader, m_sourceNode ? m_sourceNode->GetParent() : nullptr, m_editingCompleteNotifiers);
}
+ else if (attributeName == AZ::Edit::Attributes::RPESectionSeparator)
+ {
+ m_separatorLine.setVisible(true);
+ m_isSectionSeparator = true;
+ }
}
void PropertyRowWidget::SetReadOnlyQueryFunction(const ReadOnlyQueryFunction& readOnlyQueryFunction)
@@ -1070,6 +1097,7 @@ namespace AzToolsFramework
{
m_dropDownArrow->hide();
}
+ m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1085,6 +1113,7 @@ namespace AzToolsFramework
connect(m_dropDownArrow, &QCheckBox::clicked, this, &PropertyRowWidget::OnClickedExpansionButton);
}
m_dropDownArrow->show();
+ m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1095,6 +1124,7 @@ namespace AzToolsFramework
void PropertyRowWidget::SetIndentSize(int w)
{
+ m_separatorIndent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1318,6 +1348,11 @@ namespace AzToolsFramework
return canBeTopLevel(this);
}
+ bool PropertyRowWidget::IsSectionSeparator() const
+ {
+ return m_isSectionSeparator;
+ }
+
bool PropertyRowWidget::GetAppendDefaultLabelToName()
{
return false;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index e4b538ccdc..af1b68b66f 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -25,6 +25,7 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // class '...' needs t
#include
#include
#include
+#include
#include
AZ_POP_DISABLE_WARNING
@@ -44,6 +45,7 @@ namespace AzToolsFramework
Q_PROPERTY(bool hasChildRows READ HasChildRows);
Q_PROPERTY(bool isTopLevel READ IsTopLevel);
Q_PROPERTY(int getLevel READ GetLevel);
+ Q_PROPERTY(bool isSectionSeparator READ IsSectionSeparator);
Q_PROPERTY(bool appendDefaultLabelToName READ GetAppendDefaultLabelToName WRITE AppendDefaultLabelToName)
public:
AZ_CLASS_ALLOCATOR(PropertyRowWidget, AZ::SystemAllocator, 0)
@@ -82,6 +84,7 @@ namespace AzToolsFramework
PropertyRowWidget* GetParentRow() const { return m_parentRow; }
int GetLevel() const;
bool IsTopLevel() const;
+ bool IsSectionSeparator() const;
// Remove the default label and append the text to the name label.
bool GetAppendDefaultLabelToName();
@@ -161,6 +164,9 @@ namespace AzToolsFramework
QHBoxLayout* m_leftHandSideLayout;
QHBoxLayout* m_middleLayout;
QHBoxLayout* m_rightHandSideLayout;
+ QVBoxLayout* m_outerLayout;
+ QSvgWidget m_separatorLine;
+ QSpacerItem* m_separatorIndent;
QPointer m_dropDownArrow;
QPointer m_containerClearButton;
@@ -229,6 +235,8 @@ namespace AzToolsFramework
int m_treeIndentation = 14;
int m_leafIndentation = 16;
+ bool m_isSectionSeparator = false;
+
QIcon m_iconOpen;
QIcon m_iconClosed;
diff --git a/Code/Sandbox/Editor/Style/Editor.qss b/Code/Sandbox/Editor/Style/Editor.qss
index 0c3f64b85c..7887560105 100644
--- a/Code/Sandbox/Editor/Style/Editor.qss
+++ b/Code/Sandbox/Editor/Style/Editor.qss
@@ -38,6 +38,11 @@ AzToolsFramework--ComponentPaletteWidget > QTreeView
background-color: #222222;
}
+AzToolsFramework--PropertyRowWidget[isSectionSeparator="true"] QLabel#Name
+{
+ font-weight: bold;
+}
+
/* Style for visualizing property values overridden from their prefab values */
AzToolsFramework--PropertyRowWidget[IsOverridden=true] #Name QLabel,
AzToolsFramework--ComponentEditorHeader #Title[IsOverridden="true"]
diff --git a/Gems/Vegetation/Code/Source/Descriptor.cpp b/Gems/Vegetation/Code/Source/Descriptor.cpp
index 93a301f073..4fd1037f09 100644
--- a/Gems/Vegetation/Code/Source/Descriptor.cpp
+++ b/Gems/Vegetation/Code/Source/Descriptor.cpp
@@ -170,6 +170,8 @@ namespace Vegetation
{
edit->Class(
"Vegetation Descriptor", "Details used to create vegetation instances")
+ ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
+ ->Attribute(AZ::Edit::Attributes::RPESectionSeparator, true)
// For this ComboBox to actually work, there is a PropertyHandler registration in EditorVegetationSystemComponent.cpp
->DataElement(AZ::Edit::UIHandlers::ComboBox, &Descriptor::m_spawnerType, "Instance Spawner", "The type of instances to spawn")
->Attribute(AZ::Edit::Attributes::GenericValueList, &Descriptor::GetSpawnerTypeList)
From a94700786133526d14971bddfdd87e5d989d8678 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Wed, 14 Apr 2021 15:15:42 +0100
Subject: [PATCH 002/330] Darken line
---
.../AzQtComponents/AzQtComponents/Components/img/UI20/line.svg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
index 60f7c07c8d..fe01efddba 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
@@ -2,6 +2,6 @@
\ No newline at end of file
From 490b2afd319c595850df82f6038e13a4fa179102 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Fri, 16 Apr 2021 10:59:27 +0100
Subject: [PATCH 003/330] [LY-105687] Jira: LY-105687
https://jira.agscollab.com/browse/LY-105687
---
.../Components/FancyDocking.cpp | 14 +++++++
.../AzQtComponents/Components/FancyDocking.h | 2 +
.../Components/Widgets/TabWidget.cpp | 24 ++++++++----
.../Components/Widgets/TabWidget.h | 3 ++
.../img/UI20/Cursors/Grab_release.svg | 37 +++++++++++++++++++
.../Components/img/UI20/Cursors/Grabbing.svg | 23 ++++++++++++
.../AzQtComponents/Components/resources.qrc | 2 +
7 files changed, 98 insertions(+), 7 deletions(-)
create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
index 76df971108..bc8da127a6 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
@@ -159,6 +159,8 @@ namespace AzQtComponents
// Timer for updating our hovered drop zone opacity
QObject::connect(m_dropZoneHoverFadeInTimer, &QTimer::timeout, this, &FancyDocking::onDropZoneHoverFadeInUpdate);
m_dropZoneHoverFadeInTimer->setInterval(g_FancyDockingConstants.dropZoneHoverFadeUpdateIntervalMS);
+ QIcon dragIcon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
+ m_dragCursor = QCursor(dragIcon.pixmap(32), 10, 5);
}
FancyDocking::~FancyDocking()
@@ -1884,6 +1886,8 @@ namespace AzQtComponents
return;
}
+ QApplication::setOverrideCursor(m_dragCursor);
+
QPoint relativePressPos = pressPos;
// If we are dragging a floating window, we need to grab a reference to its
@@ -1999,6 +2003,11 @@ namespace AzQtComponents
clearDraggingState();
}
+ if (QApplication::overrideCursor())
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
return true;
}
@@ -2376,6 +2385,11 @@ namespace AzQtComponents
*/
void FancyDocking::dropDockWidget(QDockWidget* dock, QWidget* onto, Qt::DockWidgetArea area)
{
+ if (QApplication::overrideCursor())
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
// If the dock widget we are dropping is currently a tab, we need to retrieve it from
// the tab widget, and remove it as a tab. We also need to remove its item from our
// cache of widget <-> tab container since we are moving it somewhere else.
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
index a466ce7087..20b90ad25c 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
@@ -266,6 +266,8 @@ namespace AzQtComponents
QString m_floatingWindowIdentifierPrefix;
QString m_tabContainerIdentifierPrefix;
+
+ QCursor m_dragCursor;
};
} // namespace AzQtComponents
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
index 895785f47b..8f408b01ef 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
@@ -21,6 +21,7 @@
#include
#include
+#include
#include
#include
#include
@@ -419,6 +420,14 @@ namespace AzQtComponents
// a mouse move. The paint handler updates the close button's visibility
setAttribute(Qt::WA_Hover);
AzQtComponents::Style::addClass(this, g_emptyStyleClass);
+
+ QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab release.svg"));
+ m_hoverCursor = QCursor(icon.pixmap(32), 10, 5);
+
+ icon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
+ m_dragCursor = QCursor(icon.pixmap(32), 10, 5);
+
+ this->setCursor(m_hoverCursor);
}
void TabBar::setHandleOverflow(bool handleOverflow)
@@ -479,6 +488,13 @@ namespace AzQtComponents
void TabBar::mouseReleaseEvent(QMouseEvent* mouseEvent)
{
+ // Ensure we don't reset the cursor in the case of a dummy event being sent from DockTabWidget to trigger the animation.
+ Qt::MouseButtons realButtons = QApplication::mouseButtons();
+ if (QApplication::overrideCursor() && !(realButtons & Qt::LeftButton))
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
if (m_movingTab && !(mouseEvent->buttons() & Qt::LeftButton))
{
// When a moving tab is released, there is a short animation to put the moving tab
@@ -632,13 +648,7 @@ namespace AzQtComponents
{
QPoint p = tabRect(i).topLeft();
- int rightPadding = g_closeButtonPadding;
- if (m_overflowing == Overflowing)
- {
- rightPadding = 0;
- }
-
- p.setX(p.x() + tabRect(i).width() - rightPadding - g_closeButtonWidth);
+ p.setX(p.x() + tabRect(i).width() - g_closeButtonPadding - g_closeButtonWidth);
p.setY(p.y() + 1 + (tabRect(i).height() - g_closeButtonWidth) / 2);
tabBtn->move(p);
}
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
index 3f12f79907..e86deef7b4 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
@@ -203,6 +203,9 @@ namespace AzQtComponents
bool m_movingTab = false;
QPoint m_lastMousePress;
+ QCursor m_dragCursor;
+ QCursor m_hoverCursor;
+
void resetOverflow();
void overflowIfNeeded();
void showCloseButtonAt(int index);
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
new file mode 100644
index 0000000000..c0da9b802f
--- /dev/null
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
@@ -0,0 +1,37 @@
+
+
+
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
new file mode 100644
index 0000000000..e70be77d51
--- /dev/null
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
@@ -0,0 +1,23 @@
+
+
+
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
index f9e601fb6d..048758c283 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
@@ -636,5 +636,7 @@
img/UI20/Cursors/Pointer.svg
+ img/UI20/Cursors/Grab_release.svg
+ img/UI20/Cursors/Grabbing.svg
From db4b080544d305052602e0ba7e8260ee90bf0a87 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Fri, 16 Apr 2021 14:55:39 +0100
Subject: [PATCH 004/330] Renamed svg
---
.../AzQtComponents/Components/Widgets/TabWidget.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
index 8f408b01ef..121f35db61 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
@@ -421,7 +421,7 @@ namespace AzQtComponents
setAttribute(Qt::WA_Hover);
AzQtComponents::Style::addClass(this, g_emptyStyleClass);
- QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab release.svg"));
+ QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab_release.svg"));
m_hoverCursor = QCursor(icon.pixmap(32), 10, 5);
icon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
From 2a339edc4e9ddafedc6dac297abdd1d9c8faf3ca Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Fri, 16 Apr 2021 10:59:27 +0100
Subject: [PATCH 005/330] [LY-105687] Jira: LY-105687
https://jira.agscollab.com/browse/LY-105687
Renamed svg
---
.../Components/FancyDocking.cpp | 14 +++++++
.../AzQtComponents/Components/FancyDocking.h | 2 +
.../Components/Widgets/TabWidget.cpp | 24 ++++++++----
.../Components/Widgets/TabWidget.h | 3 ++
.../img/UI20/Cursors/Grab_release.svg | 37 +++++++++++++++++++
.../Components/img/UI20/Cursors/Grabbing.svg | 23 ++++++++++++
.../AzQtComponents/Components/resources.qrc | 2 +
7 files changed, 98 insertions(+), 7 deletions(-)
create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
index 76df971108..bc8da127a6 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
@@ -159,6 +159,8 @@ namespace AzQtComponents
// Timer for updating our hovered drop zone opacity
QObject::connect(m_dropZoneHoverFadeInTimer, &QTimer::timeout, this, &FancyDocking::onDropZoneHoverFadeInUpdate);
m_dropZoneHoverFadeInTimer->setInterval(g_FancyDockingConstants.dropZoneHoverFadeUpdateIntervalMS);
+ QIcon dragIcon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
+ m_dragCursor = QCursor(dragIcon.pixmap(32), 10, 5);
}
FancyDocking::~FancyDocking()
@@ -1884,6 +1886,8 @@ namespace AzQtComponents
return;
}
+ QApplication::setOverrideCursor(m_dragCursor);
+
QPoint relativePressPos = pressPos;
// If we are dragging a floating window, we need to grab a reference to its
@@ -1999,6 +2003,11 @@ namespace AzQtComponents
clearDraggingState();
}
+ if (QApplication::overrideCursor())
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
return true;
}
@@ -2376,6 +2385,11 @@ namespace AzQtComponents
*/
void FancyDocking::dropDockWidget(QDockWidget* dock, QWidget* onto, Qt::DockWidgetArea area)
{
+ if (QApplication::overrideCursor())
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
// If the dock widget we are dropping is currently a tab, we need to retrieve it from
// the tab widget, and remove it as a tab. We also need to remove its item from our
// cache of widget <-> tab container since we are moving it somewhere else.
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
index a466ce7087..20b90ad25c 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.h
@@ -266,6 +266,8 @@ namespace AzQtComponents
QString m_floatingWindowIdentifierPrefix;
QString m_tabContainerIdentifierPrefix;
+
+ QCursor m_dragCursor;
};
} // namespace AzQtComponents
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
index 895785f47b..121f35db61 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
@@ -21,6 +21,7 @@
#include
#include
+#include
#include
#include
#include
@@ -419,6 +420,14 @@ namespace AzQtComponents
// a mouse move. The paint handler updates the close button's visibility
setAttribute(Qt::WA_Hover);
AzQtComponents::Style::addClass(this, g_emptyStyleClass);
+
+ QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab_release.svg"));
+ m_hoverCursor = QCursor(icon.pixmap(32), 10, 5);
+
+ icon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
+ m_dragCursor = QCursor(icon.pixmap(32), 10, 5);
+
+ this->setCursor(m_hoverCursor);
}
void TabBar::setHandleOverflow(bool handleOverflow)
@@ -479,6 +488,13 @@ namespace AzQtComponents
void TabBar::mouseReleaseEvent(QMouseEvent* mouseEvent)
{
+ // Ensure we don't reset the cursor in the case of a dummy event being sent from DockTabWidget to trigger the animation.
+ Qt::MouseButtons realButtons = QApplication::mouseButtons();
+ if (QApplication::overrideCursor() && !(realButtons & Qt::LeftButton))
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
if (m_movingTab && !(mouseEvent->buttons() & Qt::LeftButton))
{
// When a moving tab is released, there is a short animation to put the moving tab
@@ -632,13 +648,7 @@ namespace AzQtComponents
{
QPoint p = tabRect(i).topLeft();
- int rightPadding = g_closeButtonPadding;
- if (m_overflowing == Overflowing)
- {
- rightPadding = 0;
- }
-
- p.setX(p.x() + tabRect(i).width() - rightPadding - g_closeButtonWidth);
+ p.setX(p.x() + tabRect(i).width() - g_closeButtonPadding - g_closeButtonWidth);
p.setY(p.y() + 1 + (tabRect(i).height() - g_closeButtonWidth) / 2);
tabBtn->move(p);
}
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
index 3f12f79907..e86deef7b4 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.h
@@ -203,6 +203,9 @@ namespace AzQtComponents
bool m_movingTab = false;
QPoint m_lastMousePress;
+ QCursor m_dragCursor;
+ QCursor m_hoverCursor;
+
void resetOverflow();
void overflowIfNeeded();
void showCloseButtonAt(int index);
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
new file mode 100644
index 0000000000..c0da9b802f
--- /dev/null
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
@@ -0,0 +1,37 @@
+
+
+
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
new file mode 100644
index 0000000000..e70be77d51
--- /dev/null
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grabbing.svg
@@ -0,0 +1,23 @@
+
+
+
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
index f9e601fb6d..048758c283 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
@@ -636,5 +636,7 @@
img/UI20/Cursors/Pointer.svg
+ img/UI20/Cursors/Grab_release.svg
+ img/UI20/Cursors/Grabbing.svg
From 2dbd9e4a050e141a45c85a12b4d245f0695f581a Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Mon, 19 Apr 2021 15:54:41 +0100
Subject: [PATCH 006/330] Changed to use direct line drawing rather than adding
svg.
---
.../Components/img/UI20/line.svg | 7 ----
.../UI/PropertyEditor/PropertyRowWidget.cpp | 40 +++++++------------
.../UI/PropertyEditor/PropertyRowWidget.hxx | 4 +-
3 files changed, 16 insertions(+), 35 deletions(-)
delete mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
deleted file mode 100644
index fe01efddba..0000000000
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/line.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
index a16c1f7480..5b02e81e6d 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
@@ -27,6 +27,7 @@ AZ_PUSH_DISABLE_WARNING(4244 4251 4800, "-Wunknown-warning-option") // 4244: con
#include
#include
#include
+#include
AZ_POP_DISABLE_WARNING
static const int LabelColumnStretch = 2;
@@ -44,24 +45,6 @@ namespace AzToolsFramework
m_iconOpen = s_iconOpen;
m_iconClosed = s_iconClosed;
- m_outerLayout = new QVBoxLayout(nullptr);
- m_outerLayout->setSpacing(0);
- m_outerLayout->setContentsMargins(0, 0, 0, 0);
-
- // separatorLayout will contain a spacer and a separator line. The width of the spacer is adjusted later to ensure the line is the
- // correct length.
- QHBoxLayout* separatorLayout = new QHBoxLayout(nullptr);
- m_outerLayout->addLayout(separatorLayout);
-
- m_separatorIndent = new QSpacerItem(1, 1);
- separatorLayout->addItem(m_separatorIndent);
-
- m_separatorLine.load(QStringLiteral(":/Gallery/line.svg"));
- m_separatorLine.setFixedHeight(3);
-
- separatorLayout->addWidget(&m_separatorLine);
- m_separatorLine.setVisible(false);
-
m_mainLayout = new QHBoxLayout();
m_mainLayout->setSpacing(0);
m_mainLayout->setContentsMargins(0, 1, 0, 1);
@@ -136,8 +119,20 @@ namespace AzToolsFramework
m_handler = nullptr;
m_containerSize = 0;
- m_outerLayout->addLayout(m_mainLayout);
- setLayout(m_outerLayout);
+ setLayout(m_mainLayout);
+ }
+
+ void PropertyRowWidget::paintEvent(QPaintEvent* event)
+ {
+ QStylePainter p(this);
+
+ if (IsSectionSeparator())
+ {
+ const QPen linePen(QColor(0x3B3E3F));
+ p.setPen(linePen);
+ int indent = m_treeDepth * m_treeIndentation;
+ p.drawLine(event->rect().topLeft() + QPoint(indent, 0), event->rect().topRight());
+ }
}
bool PropertyRowWidget::HasChildWidgetAlready() const
@@ -321,7 +316,6 @@ namespace AzToolsFramework
}
m_isSectionSeparator = false;
- m_separatorLine.setVisible(false);
RefreshAttributesFromNode(true);
@@ -970,7 +964,6 @@ namespace AzToolsFramework
}
else if (attributeName == AZ::Edit::Attributes::RPESectionSeparator)
{
- m_separatorLine.setVisible(true);
m_isSectionSeparator = true;
}
}
@@ -1097,7 +1090,6 @@ namespace AzToolsFramework
{
m_dropDownArrow->hide();
}
- m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1113,7 +1105,6 @@ namespace AzToolsFramework
connect(m_dropDownArrow, &QCheckBox::clicked, this, &PropertyRowWidget::OnClickedExpansionButton);
}
m_dropDownArrow->show();
- m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1124,7 +1115,6 @@ namespace AzToolsFramework
void PropertyRowWidget::SetIndentSize(int w)
{
- m_separatorIndent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index af1b68b66f..d08779caa4 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -129,6 +129,7 @@ namespace AzToolsFramework
void SetSelectionEnabled(bool selectionEnabled);
void SetSelected(bool selected);
bool eventFilter(QObject *watched, QEvent *event) override;
+ void paintEvent(QPaintEvent*) override;
/// Apply tooltip to widget and some of its children.
void SetDescription(const QString& text);
@@ -164,9 +165,6 @@ namespace AzToolsFramework
QHBoxLayout* m_leftHandSideLayout;
QHBoxLayout* m_middleLayout;
QHBoxLayout* m_rightHandSideLayout;
- QVBoxLayout* m_outerLayout;
- QSvgWidget m_separatorLine;
- QSpacerItem* m_separatorIndent;
QPointer m_dropDownArrow;
QPointer m_containerClearButton;
From b1d8330870f31399d05aa0c1d1b28e5f55512580 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Tue, 20 Apr 2021 17:20:19 +0100
Subject: [PATCH 007/330] Review fixes.
---
.../AzQtComponents/AzQtComponents/Components/resources.qrc | 1 -
.../AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx | 1 -
2 files changed, 2 deletions(-)
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
index e253c6492d..f9e601fb6d 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/resources.qrc
@@ -630,7 +630,6 @@
img/UI20/Settings.svg
img/UI20/Asset_Folder.svg
img/UI20/Asset_File.svg
- img/UI20/line.svg
img/UI20/AssetEditor/default_document.svg
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index d08779caa4..2fb695fca5 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -25,7 +25,6 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // class '...' needs t
#include
#include
#include
-#include
#include
AZ_POP_DISABLE_WARNING
From bfa964a23edd6bce5f6ae0da11506aa0895f0961 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Wed, 21 Apr 2021 10:19:12 +0100
Subject: [PATCH 008/330] Moved TabWidget grab animation to mouse press to
match fancy docking behavior, fixed missed mouse up cursor restore
---
.../AzQtComponents/Components/FancyDocking.cpp | 15 +++++----------
.../Components/Widgets/TabWidget.cpp | 6 ++++++
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
index bc8da127a6..2fb06a8367 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
@@ -2003,11 +2003,6 @@ namespace AzQtComponents
clearDraggingState();
}
- if (QApplication::overrideCursor())
- {
- QApplication::restoreOverrideCursor();
- }
-
return true;
}
@@ -2385,11 +2380,6 @@ namespace AzQtComponents
*/
void FancyDocking::dropDockWidget(QDockWidget* dock, QWidget* onto, Qt::DockWidgetArea area)
{
- if (QApplication::overrideCursor())
- {
- QApplication::restoreOverrideCursor();
- }
-
// If the dock widget we are dropping is currently a tab, we need to retrieve it from
// the tab widget, and remove it as a tab. We also need to remove its item from our
// cache of widget <-> tab container since we are moving it somewhere else.
@@ -3573,6 +3563,11 @@ namespace AzQtComponents
*/
void FancyDocking::clearDraggingState()
{
+ if (QApplication::overrideCursor())
+ {
+ QApplication::restoreOverrideCursor();
+ }
+
m_ghostWidget->hide();
// Release the mouse and keyboard from our main window since we grab them when we start dragging
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
index 121f35db61..a0006d7979 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
@@ -464,6 +464,11 @@ namespace AzQtComponents
{
if (mouseEvent->buttons() & Qt::LeftButton)
{
+ if (!QApplication::overrideCursor() || *QApplication::overrideCursor() != m_dragCursor)
+ {
+ QApplication::setOverrideCursor(m_dragCursor);
+ }
+
m_lastMousePress = mouseEvent->pos();
}
@@ -478,6 +483,7 @@ namespace AzQtComponents
// selected tab is moved around. The close button is not explicitly rendered for the
// moved tab during this operation. We need to make sure not to set it visible again
// while the tab is moving. This flag makes sure it happens.
+
m_movingTab = true;
}
From 099f43237debb61e3ac047f27451760599445eac Mon Sep 17 00:00:00 2001
From: greerdv
Date: Fri, 23 Apr 2021 10:13:24 +0100
Subject: [PATCH 009/330] removing long deprecated transform scale functions
---
.../AzCore/AzCore/Component/TransformBus.h | 40 --------
.../Components/TransformComponent.cpp | 93 -------------------
.../Components/TransformComponent.h | 10 --
.../ToolsComponents/TransformComponent.cpp | 70 --------------
.../ToolsComponents/TransformComponent.h | 10 --
.../Tests/ShapeColliderComponentTests.cpp | 2 +-
6 files changed, 1 insertion(+), 224 deletions(-)
diff --git a/Code/Framework/AzCore/AzCore/Component/TransformBus.h b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
index 2003b949e2..e34fa6a97b 100644
--- a/Code/Framework/AzCore/AzCore/Component/TransformBus.h
+++ b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
@@ -287,46 +287,6 @@ namespace AZ
//! Scale modifiers
//! @{
- //! @deprecated Use SetLocalScale()
- //! Scales the entity along the world's axes. The origin of the axes is the entity's position in the world.
- //! @param scale A three-dimensional vector that represents the multipliers with which to scale the entity in world space.
- virtual void SetScale([[maybe_unused]] const AZ::Vector3& scale) {}
-
- //! @deprecated Use SetLocalScaleX()
- //! Scales the entity along the world's X axis. The origin of the axis is the entity's position in the world.
- //! @param scaleX The multiplier by which to scale the entity along the X axis in world space.
- virtual void SetScaleX([[maybe_unused]] float scaleX) {}
-
- //! @deprecated Use SetLocalScaleY()
- //! Scales the entity along the world's Y axis. The origin of the axis is the entity's position in the world.
- //! @param scaleY The multiplier by which to scale the entity along the Y axis in world space.
- virtual void SetScaleY([[maybe_unused]] float scaleY) {}
-
- //! @deprecated Use SetLocalScaleZ()
- //! Scales the entity along the world's Z axis. The origin of the axis is the entity's position in the world.
- //! @param scaleZ The multiplier by which to scale the entity along the Z axis in world space.
- virtual void SetScaleZ([[maybe_unused]] float scaleZ) {}
-
- //! @deprecated Use GetLocalScale()
- //! Gets the scale of the entity in world space.
- //! @return A three-dimensional vector that represents the scale of the entity in world space.
- virtual AZ::Vector3 GetScale() { return AZ::Vector3(FLT_MAX); }
-
- //! @deprecated Use GetLocalScale()
- //! Gets the amount by which an entity is scaled along the world's X axis.
- //! @return The amount by which an entity is scaled along the X axis in world space.
- virtual float GetScaleX() { return FLT_MAX; }
-
- //! @deprecated Use GetLocalScale()
- //! Gets the amount by which an entity is scaled along the world's Y axis.
- //! @return The amount by which an entity is scaled along the Y axis in world space.
- virtual float GetScaleY() { return FLT_MAX; }
-
- //! @deprecated Use GetLocalScale()
- //! Gets the amount by which an entity is scaled along the world's Z axis.
- //! @return The amount by which an entity is scaled along the Z axis in world space.
- virtual float GetScaleZ() { return FLT_MAX; }
-
//! Set local scale of the transform.
//! @param scale The new scale to set along three local axes.
virtual void SetLocalScale([[maybe_unused]] const AZ::Vector3& scale) {}
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
index 910d6749af..4914279e7e 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
@@ -510,75 +510,6 @@ namespace AzFramework
return m_localTM.GetRotation();
}
- void TransformComponent::SetScale(const AZ::Vector3& scale)
- {
- AZ_Warning("TransformComponent", false, "SetScale is deprecated, please use SetLocalScale");
-
- if (!m_worldTM.GetScale().IsClose(scale))
- {
- AZ::Transform newWorldTransform = m_worldTM;
- newWorldTransform.SetScale(scale);
- SetWorldTM(newWorldTransform);
- }
- }
-
- void TransformComponent::SetScaleX(float scaleX)
- {
- AZ_Warning("TransformComponent", false, "SetScaleX is deprecated, please use SetLocalScaleX");
-
- AZ::Vector3 newScale = m_worldTM.GetScale();
- newScale.SetX(scaleX);
- AZ::Transform newWorldTransform = m_worldTM;
- newWorldTransform.SetScale(newScale);
- SetWorldTM(newWorldTransform);
- }
-
- void TransformComponent::SetScaleY(float scaleY)
- {
- AZ_Warning("TransformComponent", false, "SetScaleY is deprecated, please use SetLocalScaleY");
-
- AZ::Vector3 newScale = m_worldTM.GetScale();
- newScale.SetY(scaleY);
- AZ::Transform newWorldTransform = m_worldTM;
- newWorldTransform.SetScale(newScale);
- SetWorldTM(newWorldTransform);
- }
-
- void TransformComponent::SetScaleZ(float scaleZ)
- {
- AZ_Warning("TransformComponent", false, "SetScaleZ is deprecated, please use SetLocalScaleZ");
-
- AZ::Vector3 newScale = m_worldTM.GetScale();
- newScale.SetZ(scaleZ);
- AZ::Transform newWorldTransform = m_worldTM;
- newWorldTransform.SetScale(newScale);
- SetWorldTM(newWorldTransform);
- }
-
- AZ::Vector3 TransformComponent::GetScale()
- {
- AZ_Warning("TransformComponent", false, "GetScale is deprecated, please use GetLocalScale");
- return m_worldTM.GetScale();
- }
-
- float TransformComponent::GetScaleX()
- {
- AZ_Warning("TransformComponent", false, "GetScaleX is deprecated, please use GetLocalScale");
- return m_worldTM.GetScale().GetX();
- }
-
- float TransformComponent::GetScaleY()
- {
- AZ_Warning("TransformComponent", false, "GetScaleY is deprecated, please use GetLocalScale");
- return m_worldTM.GetScale().GetY();
- }
-
- float TransformComponent::GetScaleZ()
- {
- AZ_Warning("TransformComponent", false, "GetScaleZ is deprecated, please use GetLocalScale");
- return m_worldTM.GetScale().GetZ();
- }
-
void TransformComponent::SetLocalScale(const AZ::Vector3& scale)
{
AZ::Transform newLocalTM = m_localTM;
@@ -972,30 +903,6 @@ namespace AzFramework
->Event("GetLocalRotationQuaternion", &AZ::TransformBus::Events::GetLocalRotationQuaternion)
->Attribute("Rotation", AZ::Edit::Attributes::PropertyRotation)
->VirtualProperty("Rotation", "GetLocalRotationQuaternion", "SetLocalRotationQuaternion")
- ->Event("SetScale", &AZ::TransformBus::Events::SetScale)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("SetScaleX", &AZ::TransformBus::Events::SetScaleX)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("SetScaleY", &AZ::TransformBus::Events::SetScaleY)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("SetScaleZ", &AZ::TransformBus::Events::SetScaleZ)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("GetScale", &AZ::TransformBus::Events::GetScale)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("GetScaleX", &AZ::TransformBus::Events::GetScaleX)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("GetScaleY", &AZ::TransformBus::Events::GetScaleY)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
- ->Event("GetScaleZ", &AZ::TransformBus::Events::GetScaleZ)
- ->Attribute(AZ::Script::Attributes::Deprecated, true)
- ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Event("SetLocalScale", &AZ::TransformBus::Events::SetLocalScale)
->Event("SetLocalScaleX", &AZ::TransformBus::Events::SetLocalScaleX)
->Event("SetLocalScaleY", &AZ::TransformBus::Events::SetLocalScaleY)
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
index abea0bd4dd..f78a621096 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
@@ -145,16 +145,6 @@ namespace AzFramework
AZ::Quaternion GetLocalRotationQuaternion() override;
// Scale Modifiers
- void SetScale(const AZ::Vector3& scale) override;
- void SetScaleX(float scaleX) override;
- void SetScaleY(float scaleY) override;
- void SetScaleZ(float scaleZ) override;
-
- AZ::Vector3 GetScale() override;
- float GetScaleX() override;
- float GetScaleY() override;
- float GetScaleZ() override;
-
void SetLocalScale(const AZ::Vector3& scale) override;
void SetLocalScaleX(float scaleX) override;
void SetLocalScaleY(float scaleY) override;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
index 7ce11e5957..147667ae75 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
@@ -643,76 +643,6 @@ namespace AzToolsFramework
return result;
}
- void TransformComponent::SetScale(const AZ::Vector3& newScale)
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "SetScale is deprecated, please use SetLocalScale");
-
- AZ::Transform newWorldTransform = GetWorldTM();
- AZ::Vector3 prevScale = newWorldTransform.ExtractScale();
- if (!prevScale.IsClose(newScale))
- {
- newWorldTransform.MultiplyByScale(newScale);
- SetWorldTM(newWorldTransform);
- }
- }
-
- void TransformComponent::SetScaleX(float newScale)
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "SetScaleX is deprecated, please use SetLocalScaleX");
-
- AZ::Transform newWorldTransform = GetWorldTM();
- AZ::Vector3 scale = newWorldTransform.ExtractScale();
- scale.SetX(newScale);
- newWorldTransform.MultiplyByScale(scale);
- SetWorldTM(newWorldTransform);
- }
-
- void TransformComponent::SetScaleY(float newScale)
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "SetScaleY is deprecated, please use SetLocalScaleY");
-
- AZ::Transform newWorldTransform = GetWorldTM();
- AZ::Vector3 scale = newWorldTransform.ExtractScale();
- scale.SetY(newScale);
- newWorldTransform.MultiplyByScale(scale);
- SetWorldTM(newWorldTransform);
- }
-
- void TransformComponent::SetScaleZ(float newScale)
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "SetScaleZ is deprecated, please use SetLocalScaleZ");
-
- AZ::Transform newWorldTransform = GetWorldTM();
- AZ::Vector3 scale = newWorldTransform.ExtractScale();
- scale.SetZ(newScale);
- newWorldTransform.MultiplyByScale(scale);
- SetWorldTM(newWorldTransform);
- }
-
- AZ::Vector3 TransformComponent::GetScale()
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "GetScale is deprecated, please use GetLocalScale");
- return GetWorldTM().GetScale();
- }
-
- float TransformComponent::GetScaleX()
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "GetScaleX is deprecated, please use GetLocalScale");
- return GetWorldTM().GetScale().GetX();
- }
-
- float TransformComponent::GetScaleY()
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "GetScaleY is deprecated, please use GetLocalScale");
- return GetWorldTM().GetScale().GetY();
- }
-
- float TransformComponent::GetScaleZ()
- {
- AZ_Warning("AzToolsFramework::TransformComponent", false, "GetScaleZ is deprecated, please use GetLocalScale");
- return GetWorldTM().GetScale().GetZ();
- }
-
void TransformComponent::SetLocalScale(const AZ::Vector3& scale)
{
m_editorTransform.m_scale = scale;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
index 8327c5f128..0898e14d6b 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
@@ -129,16 +129,6 @@ namespace AzToolsFramework
AZ::Quaternion GetLocalRotationQuaternion() override;
// Scale Modifiers
- void SetScale(const AZ::Vector3& newScale) override;
- void SetScaleX(float newScale) override;
- void SetScaleY(float newScale) override;
- void SetScaleZ(float newScale) override;
-
- AZ::Vector3 GetScale() override;
- float GetScaleX() override;
- float GetScaleY() override;
- float GetScaleZ() override;
-
void SetLocalScale(const AZ::Vector3& scale) override;
void SetLocalScaleX(float scaleX) override;
void SetLocalScaleY(float scaleY) override;
diff --git a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
index 422385a777..8af9defff8 100644
--- a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
+++ b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
@@ -241,7 +241,7 @@ namespace PhysXEditorTests
SetPolygonPrismHeight(entityId, 2.0f);
// update the transform scale and non-uniform scale
- AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetScale, AZ::Vector3(2.0f));
+ AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetLocalScale, AZ::Vector3(2.0f));
AZ::NonUniformScaleRequestBus::Event(entityId, &AZ::NonUniformScaleRequests::SetScale, AZ::Vector3(0.5f, 1.5f, 2.0f));
EntityPtr gameEntity = CreateActiveGameEntityFromEditorEntity(editorEntity.get());
From 40655eba030b0ed6c02cd795993beda647abef53 Mon Sep 17 00:00:00 2001
From: greerdv
Date: Fri, 23 Apr 2021 11:30:17 +0100
Subject: [PATCH 010/330] removing element-wise scale setters from transform
bus
---
.../AzCore/AzCore/Component/TransformBus.h | 12 -----
.../Components/TransformComponent.cpp | 30 -------------
.../Components/TransformComponent.h | 3 --
.../ToolsComponents/TransformComponent.cpp | 18 --------
.../ToolsComponents/TransformComponent.h | 3 --
Code/Framework/Tests/TransformComponent.cpp | 45 -------------------
Gems/Blast/Code/Tests/Mocks/BlastMocks.h | 11 -----
7 files changed, 122 deletions(-)
diff --git a/Code/Framework/AzCore/AzCore/Component/TransformBus.h b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
index e34fa6a97b..64af853e99 100644
--- a/Code/Framework/AzCore/AzCore/Component/TransformBus.h
+++ b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
@@ -291,18 +291,6 @@ namespace AZ
//! @param scale The new scale to set along three local axes.
virtual void SetLocalScale([[maybe_unused]] const AZ::Vector3& scale) {}
- //! Set local scale of the transform on x-axis.
- //! @param scaleX The new x-axis scale to set.
- virtual void SetLocalScaleX([[maybe_unused]] float scaleX) {}
-
- //! Set local scale of the transform on y-axis.
- //! @param scaleY The new y-axis scale to set.
- virtual void SetLocalScaleY([[maybe_unused]] float scaleY) {}
-
- //! Set local scale of the transform on z-axis.
- //! @param scaleZ The new z-axis scale to set.
- virtual void SetLocalScaleZ([[maybe_unused]] float scaleZ) {}
-
//! Get the scale value on each axis in local space
//! @return The scale value of type Vector3 along each axis in local space.
virtual AZ::Vector3 GetLocalScale() { return AZ::Vector3(FLT_MAX); }
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
index 4914279e7e..4b805fd3e1 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
@@ -517,33 +517,6 @@ namespace AzFramework
SetLocalTM(newLocalTM);
}
- void TransformComponent::SetLocalScaleX(float scaleX)
- {
- AZ::Transform newLocalTM = m_localTM;
- AZ::Vector3 newScale = newLocalTM.GetScale();
- newScale.SetX(scaleX);
- newLocalTM.SetScale(newScale);
- SetLocalTM(newLocalTM);
- }
-
- void TransformComponent::SetLocalScaleY(float scaleY)
- {
- AZ::Transform newLocalTM = m_localTM;
- AZ::Vector3 newScale = newLocalTM.GetScale();
- newScale.SetY(scaleY);
- newLocalTM.SetScale(newScale);
- SetLocalTM(newLocalTM);
- }
-
- void TransformComponent::SetLocalScaleZ(float scaleZ)
- {
- AZ::Transform newLocalTM = m_localTM;
- AZ::Vector3 newScale = newLocalTM.GetScale();
- newScale.SetZ(scaleZ);
- newLocalTM.SetScale(newScale);
- SetLocalTM(newLocalTM);
- }
-
AZ::Vector3 TransformComponent::GetLocalScale()
{
return m_localTM.GetScale();
@@ -904,9 +877,6 @@ namespace AzFramework
->Attribute("Rotation", AZ::Edit::Attributes::PropertyRotation)
->VirtualProperty("Rotation", "GetLocalRotationQuaternion", "SetLocalRotationQuaternion")
->Event("SetLocalScale", &AZ::TransformBus::Events::SetLocalScale)
- ->Event("SetLocalScaleX", &AZ::TransformBus::Events::SetLocalScaleX)
- ->Event("SetLocalScaleY", &AZ::TransformBus::Events::SetLocalScaleY)
- ->Event("SetLocalScaleZ", &AZ::TransformBus::Events::SetLocalScaleZ)
->Event("GetLocalScale", &AZ::TransformBus::Events::GetLocalScale)
->Attribute("Scale", AZ::Edit::Attributes::PropertyScale)
->VirtualProperty("Scale", "GetLocalScale", "SetLocalScale")
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
index f78a621096..f393e22064 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
@@ -146,9 +146,6 @@ namespace AzFramework
// Scale Modifiers
void SetLocalScale(const AZ::Vector3& scale) override;
- void SetLocalScaleX(float scaleX) override;
- void SetLocalScaleY(float scaleY) override;
- void SetLocalScaleZ(float scaleZ) override;
AZ::Vector3 GetLocalScale() override;
AZ::Vector3 GetWorldScale() override;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
index 147667ae75..671a56b4d4 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
@@ -649,24 +649,6 @@ namespace AzToolsFramework
TransformChanged();
}
- void TransformComponent::SetLocalScaleX(float scaleX)
- {
- m_editorTransform.m_scale.SetX(scaleX);
- TransformChanged();
- }
-
- void TransformComponent::SetLocalScaleY(float scaleY)
- {
- m_editorTransform.m_scale.SetY(scaleY);
- TransformChanged();
- }
-
- void TransformComponent::SetLocalScaleZ(float scaleZ)
- {
- m_editorTransform.m_scale.SetZ(scaleZ);
- TransformChanged();
- }
-
AZ::Vector3 TransformComponent::GetLocalScale()
{
return m_editorTransform.m_scale;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
index 0898e14d6b..bbdf770dab 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
@@ -130,9 +130,6 @@ namespace AzToolsFramework
// Scale Modifiers
void SetLocalScale(const AZ::Vector3& scale) override;
- void SetLocalScaleX(float scaleX) override;
- void SetLocalScaleY(float scaleY) override;
- void SetLocalScaleZ(float scaleZ) override;
AZ::Vector3 GetLocalScale() override;
AZ::Vector3 GetWorldScale() override;
diff --git a/Code/Framework/Tests/TransformComponent.cpp b/Code/Framework/Tests/TransformComponent.cpp
index de172dc051..44008686cd 100644
--- a/Code/Framework/Tests/TransformComponent.cpp
+++ b/Code/Framework/Tests/TransformComponent.cpp
@@ -584,51 +584,6 @@ namespace UnitTest
EXPECT_TRUE(scales.IsClose(expectedScales));
}
- TEST_F(TransformComponentTransformMatrixSetGet, SetLocalScaleX_SimpleValues_Set)
- {
- float sx = 64.336f;
- Transform tm;
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 expectedScales = tm.GetScale();
- expectedScales.SetX(sx);
-
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScaleX, sx);
-
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 scales = tm.GetScale();
- EXPECT_TRUE(scales.IsClose(expectedScales));
- }
-
- TEST_F(TransformComponentTransformMatrixSetGet, SetLocalScaleY_SimpleValues_Set)
- {
- float sy = 23.754f;
- Transform tm;
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 expectedScales = tm.GetScale();
- expectedScales.SetY(sy);
-
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScaleY, sy);
-
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 scales = tm.GetScale();
- EXPECT_TRUE(scales.IsClose(expectedScales));
- }
-
- TEST_F(TransformComponentTransformMatrixSetGet, SetLocalScaleZ_SimpleValues_Set)
- {
- float sz = 65.140f;
- Transform tm;
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 expectedScales = tm.GetScale();
- expectedScales.SetZ(sz);
-
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScaleZ, sz);
-
- TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 scales = tm.GetScale();
- EXPECT_TRUE(scales.IsClose(expectedScales));
- }
-
TEST_F(TransformComponentTransformMatrixSetGet, GetLocalScale_SimpleValues_Return)
{
float sx = 43.463f;
diff --git a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
index 95a16c311f..88c22cf67f 100644
--- a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
+++ b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
@@ -666,18 +666,7 @@ namespace Blast
MOCK_METHOD1(RotateAroundLocalZ, void(float));
MOCK_METHOD0(GetLocalRotation, AZ::Vector3());
MOCK_METHOD0(GetLocalRotationQuaternion, AZ::Quaternion());
- MOCK_METHOD1(SetScale, void(const AZ::Vector3&));
- MOCK_METHOD1(SetScaleX, void(float));
- MOCK_METHOD1(SetScaleY, void(float));
- MOCK_METHOD1(SetScaleZ, void(float));
- MOCK_METHOD0(GetScale, AZ::Vector3());
- MOCK_METHOD0(GetScaleX, float());
- MOCK_METHOD0(GetScaleY, float());
- MOCK_METHOD0(GetScaleZ, float());
MOCK_METHOD1(SetLocalScale, void(const AZ::Vector3&));
- MOCK_METHOD1(SetLocalScaleX, void(float));
- MOCK_METHOD1(SetLocalScaleY, void(float));
- MOCK_METHOD1(SetLocalScaleZ, void(float));
MOCK_METHOD0(GetLocalScale, AZ::Vector3());
MOCK_METHOD0(GetWorldScale, AZ::Vector3());
MOCK_METHOD0(GetParentId, AZ::EntityId());
From b113f09a713833b1e98a4e7179568fce27a6fe06 Mon Sep 17 00:00:00 2001
From: greerdv
Date: Tue, 27 Apr 2021 18:12:46 +0100
Subject: [PATCH 011/330] first pass of changing transform to use float for
scale internally rather than Vector3
---
Code/CryEngine/CryCommon/IMovieSystem.h | 4 +-
.../AzCore/AzCore/Component/TransformBus.h | 22 ++--
Code/Framework/AzCore/AzCore/Math/Spline.h | 4 +-
.../AzCore/AzCore/Math/Transform.cpp | 14 +--
Code/Framework/AzCore/AzCore/Math/Transform.h | 23 ++--
.../AzCore/AzCore/Math/Transform.inl | 78 +++++++++----
.../AzCore/Math/TransformSerializer.cpp | 10 +-
.../AzCore/Tests/Math/MathTestData.h | 4 +-
Code/Framework/AzCore/Tests/Math/ObbTests.cpp | 8 +-
.../Tests/Math/TransformPerformanceTests.cpp | 6 +-
.../AzCore/Tests/Math/TransformTests.cpp | 36 ++----
Code/Framework/AzCore/Tests/ScriptMath.cpp | 24 ++--
.../Json/TransformSerializerTests.cpp | 6 +-
.../Components/TransformComponent.cpp | 38 +++---
.../Components/TransformComponent.h | 5 +-
.../Manipulators/ScaleManipulators.cpp | 4 +-
.../AzToolsFramework/Slice/SliceUtilities.cpp | 2 -
.../ToolsComponents/TransformComponent.cpp | 37 +++---
.../ToolsComponents/TransformComponent.h | 6 +-
.../ToolsComponents/TransformComponentBus.h | 5 +-
.../EditorTransformComponentSelection.cpp | 37 +++---
.../EditorTransformComponentSelection.h | 8 +-
...torTransformComponentSelectionRequestBus.h | 4 +-
.../GridMate/Serialize/CompressionMarshal.cpp | 15 ++-
Code/Framework/Tests/TransformComponent.cpp | 110 +++++++-----------
.../Sandbox/Editor/Objects/SelectionGroup.cpp | 22 ----
Code/Sandbox/Editor/Objects/SelectionGroup.h | 1 -
.../Editor/TrackView/TrackViewAnimNode.cpp | 18 +--
.../Editor/TrackView/TrackViewAnimNode.h | 4 +-
.../Editor/TrackView/TrackViewSequence.cpp | 6 +-
.../Containers/Utilities/SceneUtilities.cpp | 2 +-
.../RowWidgets/TransformRowHandler.cpp | 12 +-
.../SceneUI/RowWidgets/TransformRowHandler.h | 2 +-
.../SceneUI/RowWidgets/TransformRowWidget.cpp | 28 ++---
.../SceneUI/RowWidgets/TransformRowWidget.h | 16 ++-
.../RowWidgets/TransformRowWidgetTests.cpp | 20 ++--
.../Viewport/MaterialViewportRenderer.cpp | 4 +-
.../CoreLights/PolygonLightDelegate.cpp | 1 -
Gems/Blast/Code/Tests/BlastFamilyTest.cpp | 2 +-
Gems/Blast/Code/Tests/Mocks/BlastMocks.h | 3 +
.../EMotionFX/Rendering/Common/RenderUtil.cpp | 2 +-
.../Code/Include/GradientSignal/Util.h | 9 +-
.../Components/GradientTransformComponent.cpp | 13 ++-
.../Components/GradientTransformComponent.h | 5 +-
.../Source/Animation/AttachmentComponent.cpp | 4 +-
.../Animation/EditorAttachmentComponent.cpp | 2 +-
.../Scripting/EditorLookAtComponent.cpp | 14 ++-
.../Code/Source/Shape/BoxShape.cpp | 2 +-
.../Code/Source/Shape/PolygonPrismShape.cpp | 22 ++--
.../Code/Source/Shape/ShapeDisplay.h | 9 +-
.../Code/Source/Shape/TubeShape.cpp | 32 ++---
Gems/LmbrCentral/Code/Tests/BoxShapeTest.cpp | 28 ++---
.../Code/Tests/CapsuleShapeTest.cpp | 18 +--
.../Code/Tests/CylinderShapeTest.cpp | 14 +--
Gems/LmbrCentral/Code/Tests/DiskShapeTest.cpp | 2 +-
.../Code/Tests/PolygonPrismShapeTest.cpp | 12 +-
Gems/LmbrCentral/Code/Tests/QuadShapeTest.cpp | 12 +-
.../Code/Tests/SphereShapeTest.cpp | 14 +--
Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp | 2 +-
.../Source/Cinematics/AnimAZEntityNode.cpp | 6 +-
.../Code/Source/Cinematics/AnimAZEntityNode.h | 4 +-
.../Source/Cinematics/AnimComponentNode.cpp | 17 ++-
.../Source/Cinematics/AnimComponentNode.h | 6 +-
.../Maestro/Code/Source/Cinematics/AnimNode.h | 4 +-
Gems/PhysX/Code/Source/RigidBodyComponent.cpp | 17 +--
Gems/PhysX/Code/Source/RigidBodyComponent.h | 1 -
Gems/PhysX/Code/Source/Utils.cpp | 6 +-
.../PhysX/Code/Tests/ColliderScalingTests.cpp | 12 +-
Gems/PhysX/Code/Tests/DebugDrawTests.cpp | 14 +--
.../Code/Tests/RigidBodyComponentTests.cpp | 8 +-
.../Tests/ShapeColliderComponentTests.cpp | 12 +-
.../Code/Include/ScriptCanvas/Core/Datum.cpp | 6 +-
.../ScriptCanvas/Libraries/Entity/Rotate.cpp | 15 +--
.../Libraries/Entity/RotateMethod.cpp | 18 +--
.../Libraries/Math/TransformNodes.h | 4 +-
.../RotateCameraLookAt.cpp | 16 +--
76 files changed, 487 insertions(+), 546 deletions(-)
diff --git a/Code/CryEngine/CryCommon/IMovieSystem.h b/Code/CryEngine/CryCommon/IMovieSystem.h
index c22394e1b3..ca723eb6bd 100644
--- a/Code/CryEngine/CryCommon/IMovieSystem.h
+++ b/Code/CryEngine/CryCommon/IMovieSystem.h
@@ -696,7 +696,7 @@ public:
//! Rotate entity node.
virtual void SetRotate(float time, const Quat& quat) = 0;
//! Scale entity node.
- virtual void SetScale(float time, const Vec3& scale) = 0;
+ virtual void SetScale(float time, const float scale) = 0;
//! Compute and return the offset which brings the current position to the given position
virtual Vec3 GetOffsetPosition(const Vec3& position) { return position - GetPos(); }
@@ -708,7 +708,7 @@ public:
//! Get entity rotation at specified time.
virtual Quat GetRotate(float time) = 0;
//! Get current entity scale.
- virtual Vec3 GetScale() = 0;
+ virtual float GetScale() = 0;
// General Set param.
// Set float/vec3/vec4 parameter at given time.
diff --git a/Code/Framework/AzCore/AzCore/Component/TransformBus.h b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
index 64af853e99..95c8f6e719 100644
--- a/Code/Framework/AzCore/AzCore/Component/TransformBus.h
+++ b/Code/Framework/AzCore/AzCore/Component/TransformBus.h
@@ -288,18 +288,26 @@ namespace AZ
//! Scale modifiers
//! @{
//! Set local scale of the transform.
- //! @param scale The new scale to set along three local axes.
+ //! @param scale The new scale to set.
virtual void SetLocalScale([[maybe_unused]] const AZ::Vector3& scale) {}
- //! Get the scale value on each axis in local space
- //! @return The scale value of type Vector3 along each axis in local space.
+ //! Get the scale value in local space.
+ //! @return The scale value in local space.
virtual AZ::Vector3 GetLocalScale() { return AZ::Vector3(FLT_MAX); }
- //! Get the scale value on each axis in world space.
- //! Note the transform will be skewed when it is rotated and has a parent transform scaled, in which
- //! case the returned world-scale from this function will be inaccurate.
- //! @return The scale value of type Vector3 along each axis in world space.
+ //! Get the scale value in world space.
+ //! @return The scale value in world space.
virtual AZ::Vector3 GetWorldScale() { return AZ::Vector3(FLT_MAX); }
+
+
+ virtual void SetLocalUniformScale([[maybe_unused]] float scale) {}
+
+ virtual float GetLocalUniformScale() { return FLT_MAX; }
+
+ virtual float GetWorldUniformScale() { return FLT_MAX; }
+
+
+
//! @}
//! Transform hierarchy
diff --git a/Code/Framework/AzCore/AzCore/Math/Spline.h b/Code/Framework/AzCore/AzCore/Math/Spline.h
index 912c10f46f..1adfc9b2fa 100644
--- a/Code/Framework/AzCore/AzCore/Math/Spline.h
+++ b/Code/Framework/AzCore/AzCore/Math/Spline.h
@@ -441,10 +441,10 @@ namespace AZ
const Transform& worldFromLocal, const Vector3& src, const Vector3& dir, const Spline& spline)
{
Transform worldFromLocalNormalized = worldFromLocal;
- const Vector3 scale = worldFromLocalNormalized.ExtractScale();
+ const float scale = worldFromLocalNormalized.ExtractUniformScale();
const Transform localFromWorldNormalized = worldFromLocalNormalized.GetInverse();
- const Vector3 localRayOrigin = localFromWorldNormalized.TransformPoint(src) * scale.GetReciprocal();
+ const Vector3 localRayOrigin = localFromWorldNormalized.TransformPoint(src) / scale;
const Vector3 localRayDirection = localFromWorldNormalized.TransformVector(dir);
return spline.GetNearestAddressRay(localRayOrigin, localRayDirection);
}
diff --git a/Code/Framework/AzCore/AzCore/Math/Transform.cpp b/Code/Framework/AzCore/AzCore/Math/Transform.cpp
index bb3f764492..ad57daa5e4 100644
--- a/Code/Framework/AzCore/AzCore/Math/Transform.cpp
+++ b/Code/Framework/AzCore/AzCore/Math/Transform.cpp
@@ -130,7 +130,7 @@ namespace AZ
const Transform* transform = reinterpret_cast(classPtr);
float data[NumFloats];
transform->GetRotation().StoreToFloat4(data);
- transform->GetScale().StoreToFloat3(&data[4]);
+ Vector3(transform->GetScale()).StoreToFloat3(&data[4]);
transform->GetTranslation().StoreToFloat3(&data[7]);
for (int i = 0; i < NumFloats; i++)
@@ -220,7 +220,7 @@ namespace AZ
Vector3 translation = Vector3::CreateFromFloat3(&data[7]);
*reinterpret_cast(classPtr) =
- Transform::CreateFromQuaternionAndTranslation(rotation, translation) * Transform::CreateScale(scale);
+ Transform::CreateFromQuaternionAndTranslation(rotation, translation) * Transform::CreateUniformScale(scale.GetMaxElement());
return true;
}
@@ -250,7 +250,7 @@ namespace AZ
Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::All)->
Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::Value)->
Attribute(Script::Attributes::GenericConstructorOverride, &Internal::TransformDefaultConstructor)->
- Constructor()->
+ Constructor()->
Method("GetBasis", &Transform::GetBasis)->
Method("GetBasisX", &Transform::GetBasisX)->
Method("GetBasisY", &Transform::GetBasisY)->
@@ -284,7 +284,7 @@ namespace AZ
Method("GetRotation", &Transform::GetRotation)->
Method("SetRotation", &Transform::SetRotation)->
Method("GetScale", &Transform::GetScale)->
- Method("SetScale", &Transform::SetScale)->
+ Method("SetScale", static_cast(&Transform::SetScale))->
Method("ExtractScale", &Transform::ExtractScale)->
Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::All)->
Method("MultiplyByScale", &Transform::MultiplyByScale)->
@@ -315,7 +315,7 @@ namespace AZ
{
Transform result;
Matrix3x3 tmp = value;
- result.m_scale = tmp.ExtractScale();
+ result.m_scale = tmp.ExtractScale().GetMaxElement();
result.m_rotation = Quaternion::CreateFromMatrix3x3(tmp);
result.m_translation = Vector3::CreateZero();
return result;
@@ -325,7 +325,7 @@ namespace AZ
{
Transform result;
Matrix3x3 tmp = value;
- result.m_scale = tmp.ExtractScale();
+ result.m_scale = tmp.ExtractScale().GetMaxElement();
result.m_rotation = Quaternion::CreateFromMatrix3x3(tmp);
result.m_translation = p;
return result;
@@ -335,7 +335,7 @@ namespace AZ
{
Transform result;
Matrix3x4 tmp = value;
- result.m_scale = tmp.ExtractScale();
+ result.m_scale = tmp.ExtractScale().GetMaxElement();
result.m_rotation = Quaternion::CreateFromMatrix3x4(tmp);
result.m_translation = value.GetTranslation();
return result;
diff --git a/Code/Framework/AzCore/AzCore/Math/Transform.h b/Code/Framework/AzCore/AzCore/Math/Transform.h
index eb1a12a912..ba08722338 100644
--- a/Code/Framework/AzCore/AzCore/Math/Transform.h
+++ b/Code/Framework/AzCore/AzCore/Math/Transform.h
@@ -63,7 +63,7 @@ namespace AZ
Transform() = default;
//! Construct a transform from components.
- Transform(const Vector3& translation, const Quaternion& rotation, const Vector3& scale);
+ Transform(const Vector3& translation, const Quaternion& rotation, const float scale);
//! Creates an identity transform.
static Transform CreateIdentity();
@@ -89,8 +89,11 @@ namespace AZ
static Transform CreateFromMatrix3x4(const Matrix3x4& value);
- //! Sets the matrix to be a scale matrix, translation is set to zero.
- static Transform CreateScale(const Vector3& scale);
+ //! Sets the transform to apply (uniform) scale only, no rotation or translation.
+ static Transform CreateScale(const AZ::Vector3& scale);
+
+ //! Sets the transform to apply (uniform) scale only, no rotation or translation.
+ static Transform CreateUniformScale(const float scale);
//! Sets the matrix to be a translation matrix, rotation part is set to identity.
static Transform CreateTranslation(const Vector3& translation);
@@ -119,13 +122,19 @@ namespace AZ
const Quaternion& GetRotation() const;
void SetRotation(const Quaternion& rotation);
- const Vector3& GetScale() const;
+ Vector3 GetScale() const;
+ float GetUniformScale() const;
void SetScale(const Vector3& v);
+ void SetUniformScale(const float scale);
- //! Sets the transforms scale to a unit value and returns the previous scale value.
+ //! Sets the transform's scale to a unit value and returns the previous scale value.
Vector3 ExtractScale();
- void MultiplyByScale(const Vector3& scale);
+ //! Sets the transform's scale to a unit value and returns the previous scale value.
+ float ExtractUniformScale();
+
+ void MultiplyByScale(const AZ::Vector3& scale);
+ void MultiplyByUniformScale(float scale);
Transform operator*(const Transform& rhs) const;
Transform& operator*=(const Transform& rhs);
@@ -159,7 +168,7 @@ namespace AZ
private:
Quaternion m_rotation;
- Vector3 m_scale;
+ float m_scale;
Vector3 m_translation;
};
diff --git a/Code/Framework/AzCore/AzCore/Math/Transform.inl b/Code/Framework/AzCore/AzCore/Math/Transform.inl
index 63425e6e41..c92208da54 100644
--- a/Code/Framework/AzCore/AzCore/Math/Transform.inl
+++ b/Code/Framework/AzCore/AzCore/Math/Transform.inl
@@ -12,7 +12,7 @@
namespace AZ
{
- AZ_MATH_INLINE Transform::Transform(const Vector3& translation, const Quaternion& rotation, const Vector3& scale)
+ AZ_MATH_INLINE Transform::Transform(const Vector3& translation, const Quaternion& rotation, const float scale)
: m_translation(translation)
, m_rotation(rotation)
, m_scale(scale)
@@ -25,7 +25,7 @@ namespace AZ
{
Transform result;
result.m_rotation = Quaternion::CreateIdentity();
- result.m_scale = Vector3::CreateOne();
+ result.m_scale = 1.0f;
result.m_translation = Vector3::CreateZero();
return result;
}
@@ -49,7 +49,7 @@ namespace AZ
{
Transform result;
result.m_rotation = q;
- result.m_scale = Vector3::CreateOne();
+ result.m_scale = 1.0f;
result.m_translation = Vector3::CreateZero();
return result;
}
@@ -58,12 +58,22 @@ namespace AZ
{
Transform result;
result.m_rotation = q;
- result.m_scale = Vector3::CreateOne();
+ result.m_scale = 1.0f;
result.m_translation = p;
return result;
}
- AZ_MATH_INLINE Transform Transform::CreateScale(const Vector3& scale)
+ AZ_MATH_INLINE Transform Transform::CreateScale(const AZ::Vector3& scale)
+ {
+ AZ_Warning("Transform", false, "CreateScale is deprecated, please use CreateUniformScale instead.");
+ Transform result;
+ result.m_rotation = Quaternion::CreateIdentity();
+ result.m_scale = scale.GetMaxElement();
+ result.m_translation = Vector3::CreateZero();
+ return result;
+ }
+
+ AZ_MATH_INLINE Transform Transform::CreateUniformScale(float scale)
{
Transform result;
result.m_rotation = Quaternion::CreateIdentity();
@@ -76,7 +86,7 @@ namespace AZ
{
Transform result;
result.m_rotation = Quaternion::CreateIdentity();
- result.m_scale = Vector3::CreateOne();
+ result.m_scale = 1.0f;
result.m_translation = translation;
return result;
}
@@ -104,17 +114,17 @@ namespace AZ
AZ_MATH_INLINE Vector3 Transform::GetBasisX() const
{
- return m_rotation.TransformVector(Vector3::CreateAxisX(m_scale.GetX()));
+ return m_rotation.TransformVector(Vector3::CreateAxisX(m_scale));
}
AZ_MATH_INLINE Vector3 Transform::GetBasisY() const
{
- return m_rotation.TransformVector(Vector3::CreateAxisY(m_scale.GetY()));
+ return m_rotation.TransformVector(Vector3::CreateAxisY(m_scale));
}
AZ_MATH_INLINE Vector3 Transform::GetBasisZ() const
{
- return m_rotation.TransformVector(Vector3::CreateAxisZ(m_scale.GetZ()));
+ return m_rotation.TransformVector(Vector3::CreateAxisZ(m_scale));
}
AZ_MATH_INLINE void Transform::GetBasisAndTranslation(Vector3* basisX, Vector3* basisY, Vector3* basisZ, Vector3* pos) const
@@ -150,24 +160,50 @@ namespace AZ
m_rotation = rotation;
}
- AZ_MATH_INLINE const Vector3& Transform::GetScale() const
+ AZ_MATH_INLINE Vector3 Transform::GetScale() const
+ {
+ AZ_Warning("Transform", false, "GetScale is deprecated, please use GetUniformScale instead.");
+ return Vector3(m_scale);
+ }
+
+ AZ_MATH_INLINE float Transform::GetUniformScale() const
{
return m_scale;
}
AZ_MATH_INLINE void Transform::SetScale(const Vector3& scale)
+ {
+ AZ_Warning("Transform", false, "SetScale is deprecated, please use SetUniformScale instead.");
+ m_scale = scale.GetMaxElement();
+ }
+
+ AZ_MATH_INLINE void Transform::SetUniformScale(const float scale)
{
m_scale = scale;
}
AZ_MATH_INLINE Vector3 Transform::ExtractScale()
{
- const Vector3 scale = m_scale;
- m_scale = Vector3::CreateOne();
+ AZ_Warning("Transform", false, "ExtractScale is deprecated, please use ExtractUniformScale instead.");
+ const float scale = m_scale;
+ m_scale = 1.0f;
+ return Vector3(scale);
+ }
+
+ AZ_MATH_INLINE float Transform::ExtractUniformScale()
+ {
+ const float scale = m_scale;
+ m_scale = 1.0f;
return scale;
}
- AZ_MATH_INLINE void Transform::MultiplyByScale(const Vector3& scale)
+ AZ_MATH_INLINE void Transform::MultiplyByScale(const AZ::Vector3& scale)
+ {
+ AZ_Warning("Transform", false, "MultiplyByScale is deprecated, please use MultiplyByUniformScale instead.");
+ m_scale *= scale.GetMaxElement();
+ }
+
+ AZ_MATH_INLINE void Transform::MultiplyByUniformScale(float scale)
{
m_scale *= scale;
}
@@ -207,7 +243,7 @@ namespace AZ
// note - need to be careful about how to calculate inverse when there is non-uniform scale
Transform out;
out.m_rotation = m_rotation.GetConjugate();
- out.m_scale = m_scale.GetReciprocal();
+ out.m_scale = 1.0f / m_scale;
out.m_translation = -out.m_scale * (out.m_rotation.TransformVector(m_translation));
return out;
}
@@ -219,27 +255,27 @@ namespace AZ
AZ_MATH_INLINE bool Transform::IsOrthogonal(float tolerance) const
{
- return m_scale.IsClose(Vector3::CreateOne(), tolerance);
+ return AZ::IsClose(m_scale, 1.0f, tolerance);
}
AZ_MATH_INLINE Transform Transform::GetOrthogonalized() const
{
Transform result;
result.m_rotation = m_rotation;
- result.m_scale = Vector3::CreateOne();
+ result.m_scale = 1.0f;
result.m_translation = m_translation;
return result;
}
AZ_MATH_INLINE void Transform::Orthogonalize()
{
- *this = GetOrthogonalized();
+ m_scale = 1.0f;
}
AZ_MATH_INLINE bool Transform::IsClose(const Transform& rhs, float tolerance) const
{
return m_rotation.IsClose(rhs.m_rotation, tolerance)
- && m_scale.IsClose(rhs.m_scale, tolerance)
+ && AZ::IsClose(m_scale, rhs.m_scale, tolerance)
&& m_translation.IsClose(rhs.m_translation, tolerance);
}
@@ -268,21 +304,21 @@ namespace AZ
AZ_MATH_INLINE void Transform::SetFromEulerDegrees(const Vector3& eulerDegrees)
{
m_translation = Vector3::CreateZero();
- m_scale = Vector3::CreateOne();
+ m_scale = 1.0f;
m_rotation.SetFromEulerDegrees(eulerDegrees);
}
AZ_MATH_INLINE void Transform::SetFromEulerRadians(const Vector3& eulerRadians)
{
m_translation = Vector3::CreateZero();
- m_scale = Vector3::CreateOne();
+ m_scale = 1.0f;
m_rotation.SetFromEulerRadians(eulerRadians);
}
AZ_MATH_INLINE bool Transform::IsFinite() const
{
return m_rotation.IsFinite()
- && m_scale.IsFinite()
+ && IsFiniteFloat(m_scale)
&& m_translation.IsFinite();
}
diff --git a/Code/Framework/AzCore/AzCore/Math/TransformSerializer.cpp b/Code/Framework/AzCore/AzCore/Math/TransformSerializer.cpp
index 0a3e02ee0d..46440ac000 100644
--- a/Code/Framework/AzCore/AzCore/Math/TransformSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Math/TransformSerializer.cpp
@@ -58,9 +58,7 @@ namespace AZ
}
{
- // Scale is transitioning to a single uniform scale value, but since it's still internally represented as a Vector3,
- // we need to pick one number to use for load/store operations.
- float scale = transformInstance->GetScale().GetMaxElement();
+ float scale = transformInstance->GetUniformScale();
JSR::ResultCode loadResult =
ContinueLoadingFromJsonObjectField(&scale, azrtti_typeid(), inputValue, ScaleTag, context);
@@ -122,10 +120,8 @@ namespace AZ
{
AZ::ScopedContextPath subPathName(context, ScaleTag);
- // Scale is transitioning to a single uniform scale value, but since it's still internally represented as a Vector3,
- // we need to pick one number to use for load/store operations.
- float scale = transformInstance->GetScale().GetMaxElement();
- float defaultScale = defaultTransformInstance ? defaultTransformInstance->GetScale().GetMaxElement() : 0.0f;
+ float scale = transformInstance->GetUniformScale();
+ float defaultScale = defaultTransformInstance ? defaultTransformInstance->GetUniformScale() : 0.0f;
JSR::ResultCode storeResult = ContinueStoringToJsonObjectField(
outputValue, ScaleTag, &scale, defaultTransformInstance ? &defaultScale : nullptr, azrtti_typeid(),
diff --git a/Code/Framework/AzCore/Tests/Math/MathTestData.h b/Code/Framework/AzCore/Tests/Math/MathTestData.h
index cd3ade7854..c82c5caea7 100644
--- a/Code/Framework/AzCore/Tests/Math/MathTestData.h
+++ b/Code/Framework/AzCore/Tests/Math/MathTestData.h
@@ -61,8 +61,8 @@ namespace MathTestData
};
static const AZ::Transform NonOrthogonalTransforms[] = {
- AZ::Transform::CreateScale(AZ::Vector3(2.4f, 0.3f, 1.7f)),
- AZ::Transform::CreateRotationX(2.2f) * AZ::Transform::CreateScale(AZ::Vector3(0.2f, 0.8f, 1.4f))
+ AZ::Transform::CreateUniformScale(2.4f),
+ AZ::Transform::CreateRotationX(2.2f) * AZ::Transform::CreateUniformScale(0.8f)
};
static const AZ::Transform OrthogonalTransforms[] = {
diff --git a/Code/Framework/AzCore/Tests/Math/ObbTests.cpp b/Code/Framework/AzCore/Tests/Math/ObbTests.cpp
index a90d66f288..de267b4265 100644
--- a/Code/Framework/AzCore/Tests/Math/ObbTests.cpp
+++ b/Code/Framework/AzCore/Tests/Math/ObbTests.cpp
@@ -59,11 +59,11 @@ namespace UnitTest
TEST(MATH_Obb, TestScaleTransform)
{
Obb obb = Obb::CreateFromPositionRotationAndHalfLengths(position, rotation, halfLengths);
- Vector3 scaleFactors = Vector3(1.0f, 2.0f, 3.0f);
- Transform transform = Transform::CreateScale(scaleFactors);
+ float scale = 3.0f;
+ Transform transform = Transform::CreateUniformScale(scale);
obb = transform * obb;
- EXPECT_THAT(obb.GetPosition(), IsClose(Vector3(1.0f, 4.0f, 9.0f)));
- EXPECT_THAT(obb.GetHalfLengths(), IsClose(Vector3(0.5f, 1.0f, 1.5f)));
+ EXPECT_THAT(obb.GetPosition(), IsClose(Vector3(3.0f, 6.0f, 9.0f)));
+ EXPECT_THAT(obb.GetHalfLengths(), IsClose(Vector3(1.5f, 1.5f, 1.5f)));
}
TEST(MATH_Obb, TestSetPosition)
diff --git a/Code/Framework/AzCore/Tests/Math/TransformPerformanceTests.cpp b/Code/Framework/AzCore/Tests/Math/TransformPerformanceTests.cpp
index 400a845913..a9788375ad 100644
--- a/Code/Framework/AzCore/Tests/Math/TransformPerformanceTests.cpp
+++ b/Code/Framework/AzCore/Tests/Math/TransformPerformanceTests.cpp
@@ -186,7 +186,7 @@ namespace Benchmark
{
for (auto& testData : m_testDataArray)
{
- AZ::Transform result = AZ::Transform::CreateScale(testData.v3);
+ AZ::Transform result = AZ::Transform::CreateUniformScale(testData.value[0]);
benchmark::DoNotOptimize(result);
}
}
@@ -350,7 +350,7 @@ namespace Benchmark
{
for (auto& testData : m_testDataArray)
{
- AZ::Vector3 result = testData.t1.GetScale();
+ float result = testData.t1.GetUniformScale();
benchmark::DoNotOptimize(result);
}
}
@@ -376,7 +376,7 @@ namespace Benchmark
for (auto& testData : m_testDataArray)
{
AZ::Transform testTransform = testData.t2;
- AZ::Vector3 result = testTransform.ExtractScale();
+ float result = testTransform.ExtractUniformScale();
benchmark::DoNotOptimize(result);
}
}
diff --git a/Code/Framework/AzCore/Tests/Math/TransformTests.cpp b/Code/Framework/AzCore/Tests/Math/TransformTests.cpp
index d0343211c3..49607573ce 100644
--- a/Code/Framework/AzCore/Tests/Math/TransformTests.cpp
+++ b/Code/Framework/AzCore/Tests/Math/TransformTests.cpp
@@ -184,12 +184,12 @@ namespace UnitTest
TEST(MATH_Transform, CreateScale)
{
- const AZ::Vector3 scale(1.7f, 0.3f, 2.4f);
- const AZ::Transform transform = AZ::Transform::CreateScale(scale);
+ const float scale = 1.7f;
+ const AZ::Transform transform = AZ::Transform::CreateUniformScale(scale);
const AZ::Vector3 vector(0.2f, -1.6f, 0.4f);
EXPECT_THAT(transform.GetTranslation(), IsClose(AZ::Vector3::CreateZero()));
const AZ::Vector3 transformedVector = transform.TransformPoint(vector);
- const AZ::Vector3 expected(0.34f, -0.48f, 0.96f);
+ const AZ::Vector3 expected(0.34f, -2.72f, 0.68f);
EXPECT_THAT(transformedVector, IsClose(expected));
}
@@ -237,10 +237,10 @@ namespace UnitTest
TEST(MATH_Transform, MultiplyByTransform)
{
const AZ::Transform transform1 = AZ::Transform::CreateRotationY(0.3f);
- const AZ::Transform transform2 = AZ::Transform::CreateScale(AZ::Vector3(1.3f, 1.5f, 0.4f));
+ const AZ::Transform transform2 = AZ::Transform::CreateUniformScale(1.3f);
const AZ::Transform transform3 = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.42f, 0.46f, -0.66f, 0.42f), AZ::Vector3(2.8f, -3.7f, 1.6f));
- const AZ::Transform transform4 = AZ::Transform::CreateRotationX(-0.7f) * AZ::Transform::CreateScale(AZ::Vector3(0.6f, 1.3f, 0.7f));
+ const AZ::Transform transform4 = AZ::Transform::CreateRotationX(-0.7f) * AZ::Transform::CreateUniformScale(0.6f);
AZ::Transform transform5 = transform1;
transform5 *= transform4;
const AZ::Vector3 vector(1.9f, 2.3f, 0.2f);
@@ -341,10 +341,10 @@ namespace UnitTest
AZ::Transform unscaledTransform = orthogonalTransform;
unscaledTransform.ExtractScale();
EXPECT_THAT(unscaledTransform.GetScale(), IsClose(AZ::Vector3::CreateOne()));
- const AZ::Vector3 scale(2.8f, 0.7f, 1.3f);
+ const float scale = 2.8f;
AZ::Transform scaledTransform = orthogonalTransform;
- scaledTransform.MultiplyByScale(scale);
- EXPECT_THAT(scaledTransform.GetScale(), IsClose(scale));
+ scaledTransform.MultiplyByUniformScale(scale);
+ EXPECT_NEAR(scaledTransform.GetUniformScale(), scale, AZ::Constants::Tolerance);
}
INSTANTIATE_TEST_CASE_P(MATH_Transform, TransformScaleFixture, ::testing::ValuesIn(MathTestData::OrthogonalTransforms));
@@ -353,24 +353,11 @@ namespace UnitTest
{
EXPECT_TRUE(AZ::Transform::CreateIdentity().IsOrthogonal());
EXPECT_TRUE(AZ::Transform::CreateRotationZ(0.3f).IsOrthogonal());
- EXPECT_FALSE(AZ::Transform::CreateScale(AZ::Vector3(0.8f, 0.3f, 1.2f)).IsOrthogonal());
+ EXPECT_FALSE(AZ::Transform::CreateUniformScale(0.8f).IsOrthogonal());
EXPECT_TRUE(AZ::Transform::CreateFromQuaternion(AZ::Quaternion(-0.52f, -0.08f, 0.56f, 0.64f)).IsOrthogonal());
AZ::Transform transform;
transform.SetFromEulerRadians(AZ::Vector3(0.2f, 0.4f, 0.1f));
EXPECT_TRUE(transform.IsOrthogonal());
-
- // want to test each possible way the transform could fail to be orthogonal, which we can do by testing for one
- // axis, then using a rotation which cycles the axes
- const AZ::Transform axisCycle = AZ::Transform::CreateFromQuaternion(AZ::Quaternion(0.5f, 0.5f, 0.5f, 0.5f));
-
- // a transform which is normalized in 2 axes, but not the third
- AZ::Transform nonOrthogonalTransform1 = AZ::Transform::CreateScale(AZ::Vector3(1.0f, 1.0f, 2.0f));
-
- for (int i = 0; i < 3; i++)
- {
- EXPECT_FALSE(nonOrthogonalTransform1.IsOrthogonal());
- nonOrthogonalTransform1 = axisCycle * nonOrthogonalTransform1;
- }
}
using TransformSetFromEulerDegreesFixture = ::testing::TestWithParam;
@@ -465,10 +452,11 @@ namespace UnitTest
AZ::Transform* deserializedTransform = AZ::Utils::LoadObjectFromBuffer(objectStreamBuffer, strlen(objectStreamBuffer) + 1);
const AZ::Vector3 expectedTranslation(513.7845459f, 492.5420837f, 32.0000000f);
- const AZ::Vector3 expectedScale(1.5f, 0.5f, 1.2f);
+ const float expectedScale = 1.5f;
const AZ::Quaternion expectedRotation(0.2624075f, 0.4405251f, 0.2029076f, 0.8342113f);
const AZ::Transform expectedTransform =
- AZ::Transform::CreateFromQuaternionAndTranslation(expectedRotation, expectedTranslation) * AZ::Transform::CreateScale(expectedScale);
+ AZ::Transform::CreateFromQuaternionAndTranslation(expectedRotation, expectedTranslation) *
+ AZ::Transform::CreateUniformScale(expectedScale);
EXPECT_TRUE(deserializedTransform->IsClose(expectedTransform));
azfree(deserializedTransform);
diff --git a/Code/Framework/AzCore/Tests/ScriptMath.cpp b/Code/Framework/AzCore/Tests/ScriptMath.cpp
index cb673e92e7..493a21de36 100644
--- a/Code/Framework/AzCore/Tests/ScriptMath.cpp
+++ b/Code/Framework/AzCore/Tests/ScriptMath.cpp
@@ -1275,10 +1275,10 @@ namespace UnitTest
script->Execute("AZTestAssert(t1:TransformVector(Vector3(1, 0, 0)):IsClose(Vector3(1, 0, 0)))");
script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 1, 0)):IsClose(Vector3(0, 0.866, 0.5)))");
script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 0, 1)):IsClose(Vector3(0, -0.5, 0.866)))");
- script->Execute("t1 = Transform.CreateScale(Vector3(1, 2, 3))");
- script->Execute("AZTestAssert(t1:TransformVector(Vector3(1, 0, 0)):IsClose(Vector3(1, 0, 0)))");
+ script->Execute("t1 = Transform.CreateScale(2)");
+ script->Execute("AZTestAssert(t1:TransformVector(Vector3(1, 0, 0)):IsClose(Vector3(2, 0, 0)))");
script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 1, 0)):IsClose(Vector3(0, 2, 0)))");
- script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 0, 1)):IsClose(Vector3(0, 0, 3)))");
+ script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 0, 1)):IsClose(Vector3(0, 0, 2)))");
script->Execute("t1 = Transform.CreateTranslation(Vector3(1, 2, 3))");
script->Execute("AZTestAssert(t1:TransformVector(Vector3(1, 0, 0)):IsClose(Vector3(1, 0, 0)))");
script->Execute("AZTestAssert(t1:TransformVector(Vector3(0, 1, 0)):IsClose(Vector3(0, 1, 0)))");
@@ -1341,19 +1341,19 @@ namespace UnitTest
script->Execute("AZTestAssert(t3:GetTranslation():IsClose(Vector3(-5.90, 25.415, 19.645), 0.001))");
////test inverse, should handle non-orthogonal matrices
- script->Execute("t1 = Transform.CreateRotationX(1) * Transform.CreateScale(Vector3(1, 2, 3))");
+ script->Execute("t1 = Transform.CreateRotationX(1) * Transform.CreateScale(2)");
script->Execute("AZTestAssert((t1*t1:GetInverse()):IsClose(Transform.CreateIdentity()))");
////scale access
- script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(40)) * Transform.CreateScale(Vector3(2, 3, 4))");
- script->Execute("AZTestAssert(t1:GetScale():IsClose(Vector3(2, 3, 4)))");
- script->Execute("AZTestAssert(t1:ExtractScale():IsClose(Vector3(2, 3, 4)))");
- script->Execute("AZTestAssert(t1:GetScale():IsClose(Vector3.CreateOne()))");
- script->Execute("t1:MultiplyByScale(Vector3(3, 4, 5))");
- script->Execute("AZTestAssert(t1:GetScale():IsClose(Vector3(3, 4, 5)))");
+ script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(40)) * Transform.CreateScale(3)");
+ script->Execute("AZTestAssert(t1:GetScale():IsClose(3))");
+ script->Execute("AZTestAssert(t1:ExtractScale():IsClose(3))");
+ script->Execute("AZTestAssert(t1:GetScale():IsClose(1))");
+ script->Execute("t1:MultiplyByScale(2)");
+ script->Execute("AZTestAssert(t1:GetScale():IsClose(2))");
////orthogonalize
- script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(30)) * Transform.CreateScale(Vector3(2, 3, 4))");
+ script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(30)) * Transform.CreateScale(3)");
script->Execute("t1:SetTranslation(Vector3(1,2,3))");
script->Execute("t2 = t1:GetOrthogonalized()");
script->Execute("AZTestAssertFloatClose(t2:GetBasisX():GetLength(), 1)");
@@ -1372,7 +1372,7 @@ namespace UnitTest
script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(30))");
script->Execute("t1:SetTranslation(Vector3(1, 2, 3))");
script->Execute("AZTestAssert(t1:IsOrthogonal(0.05))");
- script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(30)) * Transform.CreateScale(Vector3(2, 3, 4))");
+ script->Execute("t1 = Transform.CreateRotationX(Math.DegToRad(30)) * Transform.CreateScale(2)");
script->Execute("AZTestAssert( not t1:IsOrthogonal(0.05))");
////IsClose
diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/TransformSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/TransformSerializerTests.cpp
index 12711b1e1a..7febbbb5d9 100644
--- a/Code/Framework/AzCore/Tests/Serialization/Json/TransformSerializerTests.cpp
+++ b/Code/Framework/AzCore/Tests/Serialization/Json/TransformSerializerTests.cpp
@@ -44,7 +44,7 @@ namespace JsonSerializationTests
AZStd::shared_ptr CreateFullySetInstance() override
{
return AZStd::make_shared(
- AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion(0.25f, 0.5f, 0.75f, 1.0f), AZ::Vector3(9.0f));
+ AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion(0.25f, 0.5f, 0.75f, 1.0f), 9.0f);
}
AZStd::string_view GetJsonForFullySetInstance() override
@@ -95,7 +95,7 @@ namespace JsonSerializationTests
AZ::Transform expectedTransform(
AZ::Vector3(2.25f, 3.5f, 4.75f),
AZ::Quaternion(0.25f, 0.5f, 0.75f, 1.0f),
- AZ::Vector3(5.5f));
+ 5.5f);
rapidjson::Document json;
json.Parse(R"({ "Translation": [ 2.25, 3.5, 4.75 ], "Rotation": [ 0.25, 0.5, 0.75, 1.0 ], "Scale": 5.5 })");
@@ -189,7 +189,7 @@ namespace JsonSerializationTests
TEST_F(JsonTransformSerializerTests, Load_FullySetTransform_ReturnsSuccessWithOnlyScale)
{
AZ::Transform testTransform = AZ::Transform::CreateIdentity();
- AZ::Transform expectedTransform = AZ::Transform::CreateScale(AZ::Vector3(5.5f));
+ AZ::Transform expectedTransform = AZ::Transform::CreateUniformScale(5.5f);
rapidjson::Document json;
json.Parse(R"({ "Scale" : 5.5 })");
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
index 4b805fd3e1..b1b2378174 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp
@@ -447,29 +447,12 @@ namespace AzFramework
static AZ::Transform RotateAroundLocalHelper(float eulerAngleRadian, const AZ::Transform& localTM, AZ::Vector3 axis)
{
- //get the existing translation and scale
- AZ::Vector3 translation = localTM.GetTranslation();
- AZ::Vector3 scale = localTM.GetScale();
-
//normalize the axis before creating rotation
axis.Normalize();
AZ::Quaternion rotate = AZ::Quaternion::CreateFromAxisAngle(axis, eulerAngleRadian);
- //create new rotation transform
- AZ::Quaternion currentRotate = localTM.GetRotation();
- AZ::Quaternion newRotate = rotate * currentRotate;
- newRotate.Normalize();
-
- //scale
- AZ::Transform newLocalTM = AZ::Transform::CreateScale(scale);
-
- //rotate
- AZ::Transform rotateLocalTM = AZ::Transform::CreateFromQuaternion(newRotate);
- newLocalTM = rotateLocalTM * newLocalTM;
-
- //translate
- newLocalTM.SetTranslation(translation);
-
+ AZ::Transform newLocalTM = localTM;
+ newLocalTM.SetRotation((rotate * localTM.GetRotation()).GetNormalized());
return newLocalTM;
}
@@ -527,6 +510,23 @@ namespace AzFramework
return m_worldTM.GetScale();
}
+ void TransformComponent::SetLocalUniformScale(float scale)
+ {
+ AZ::Transform newLocalTM = m_localTM;
+ newLocalTM.SetUniformScale(scale);
+ SetLocalTM(newLocalTM);
+ }
+
+ float TransformComponent::GetLocalUniformScale()
+ {
+ return m_localTM.GetUniformScale();
+ }
+
+ float TransformComponent::GetWorldUniformScale()
+ {
+ return m_worldTM.GetUniformScale();
+ }
+
AZStd::vector TransformComponent::GetChildren()
{
AZStd::vector children;
diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
index f393e22064..f0fa1b6985 100644
--- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
+++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h
@@ -146,10 +146,13 @@ namespace AzFramework
// Scale Modifiers
void SetLocalScale(const AZ::Vector3& scale) override;
-
AZ::Vector3 GetLocalScale() override;
AZ::Vector3 GetWorldScale() override;
+ void SetLocalUniformScale(float scale) override;
+ float GetLocalUniformScale() override;
+ float GetWorldUniformScale() override;
+
// Transform hierarchy
AZStd::vector GetChildren() override;
AZStd::vector GetAllDescendants() override;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ScaleManipulators.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ScaleManipulators.cpp
index 3af09f644d..caeedd834f 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ScaleManipulators.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ScaleManipulators.cpp
@@ -82,9 +82,7 @@ namespace AzToolsFramework
m_uniformScaleManipulator->SetVisualOrientationOverride(
QuaternionFromTransformNoScaling(localTransform));
- m_uniformScaleManipulator->SetLocalTransform(
- AZ::Transform::CreateTranslation(localTransform.GetTranslation()) *
- AZ::Transform::CreateScale(localTransform.GetScale()));
+ m_uniformScaleManipulator->SetLocalOrientation(AZ::Quaternion::CreateIdentity());
}
void ScaleManipulators::SetLocalPositionImpl(const AZ::Vector3& localPosition)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp
index 75070d9b41..e13d4fdb47 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp
@@ -1475,10 +1475,8 @@ namespace AzToolsFramework
// to avoid pushing them to the slice.
// Only scale is preserved on the root entity of a slice.
transformComponent->SetParent(AZ::EntityId());
- AZ::Vector3 scale = transformComponent->GetLocalScale();
transformComponent->SetWorldTranslation(AZ::Vector3::CreateZero());
transformComponent->SetLocalRotation(AZ::Vector3::CreateZero());
- transformComponent->SetLocalScale(scale);
}
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
index 671a56b4d4..bcd8e3fa4a 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp
@@ -46,9 +46,9 @@ namespace AzToolsFramework
const AZ::u32 ParentEntityCRC = AZ_CRC("Parent Entity", 0x5b1b276c);
// Decompose a transform into euler angles in degrees, scale (along basis, any shear will be dropped), and translation.
- void DecomposeTransform(const AZ::Transform& transform, AZ::Vector3& translation, AZ::Vector3& rotation, AZ::Vector3& scale)
+ void DecomposeTransform(const AZ::Transform& transform, AZ::Vector3& translation, AZ::Vector3& rotation, float& scale)
{
- scale = transform.GetScale();
+ scale = transform.GetUniformScale();
translation = transform.GetTranslation();
rotation = transform.GetRotation().GetEulerDegrees();
}
@@ -323,7 +323,7 @@ namespace AzToolsFramework
AZ::Transform TransformComponent::GetLocalScaleTM() const
{
- return AZ::Transform::CreateScale(m_editorTransform.m_scale);
+ return AZ::Transform::CreateUniformScale(m_editorTransform.m_scale);
}
const AZ::Transform& TransformComponent::GetLocalTM()
@@ -340,7 +340,8 @@ namespace AzToolsFramework
// given a local transform, update local transform.
void TransformComponent::SetLocalTM(const AZ::Transform& finalTx)
{
- AZ::Vector3 tx, rot, scale;
+ AZ::Vector3 tx, rot;
+ float scale;
Internal::DecomposeTransform(finalTx, tx, rot, scale);
m_editorTransform.m_translate = tx;
@@ -645,13 +646,13 @@ namespace AzToolsFramework
void TransformComponent::SetLocalScale(const AZ::Vector3& scale)
{
- m_editorTransform.m_scale = scale;
+ m_editorTransform.m_scale = scale.GetMaxElement();
TransformChanged();
}
AZ::Vector3 TransformComponent::GetLocalScale()
{
- return m_editorTransform.m_scale;
+ return AZ::Vector3(m_editorTransform.m_scale);
}
AZ::Vector3 TransformComponent::GetWorldScale()
@@ -659,6 +660,22 @@ namespace AzToolsFramework
return GetWorldTM().GetScale();
}
+ void TransformComponent::SetLocalUniformScale(float scale)
+ {
+ m_editorTransform.m_scale = scale;
+ TransformChanged();
+ }
+
+ float TransformComponent::GetLocalUniformScale()
+ {
+ return m_editorTransform.m_scale;
+ }
+
+ float TransformComponent::GetWorldUniformScale()
+ {
+ return GetWorldTM().GetUniformScale();
+ }
+
const AZ::Transform& TransformComponent::GetParentWorldTM() const
{
auto parent = GetParentTransformComponent();
@@ -1062,12 +1079,6 @@ namespace AzToolsFramework
ModifyEditorTransform(m_editorTransform.m_rotate, data, parent);
}
- void TransformComponent::ScaleBy(const AZ::Vector3& data)
- {
- //scale is always local
- ModifyEditorTransform(m_editorTransform.m_scale, data, AZ::Transform::Identity());
- }
-
AZ::EntityId TransformComponent::GetSliceEntityParentId()
{
return GetParentId();
@@ -1214,7 +1225,7 @@ namespace AzToolsFramework
{
AzToolsFramework::ScopedUndoBatch undo("Reset transform values");
m_editorTransform.m_translate = AZ::Vector3::CreateZero();
- m_editorTransform.m_scale = AZ::Vector3::CreateOne();
+ m_editorTransform.m_scale = 1.0f;
m_editorTransform.m_rotate = AZ::Vector3::CreateZero();
OnTransformChanged();
SetDirty();
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
index bbdf770dab..06d1101c58 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h
@@ -130,10 +130,13 @@ namespace AzToolsFramework
// Scale Modifiers
void SetLocalScale(const AZ::Vector3& scale) override;
-
AZ::Vector3 GetLocalScale() override;
AZ::Vector3 GetWorldScale() override;
+ void SetLocalUniformScale(float scale) override;
+ float GetLocalUniformScale() override;
+ float GetWorldUniformScale() override;
+
AZ::EntityId GetParentId() override;
AZ::TransformInterface* GetParent() override;
void SetParent(AZ::EntityId parentId) override;
@@ -147,7 +150,6 @@ namespace AzToolsFramework
// TransformComponentMessages::Bus
void TranslateBy(const AZ::Vector3&) override;
void RotateBy(const AZ::Vector3&) override; // euler in degrees
- void ScaleBy(const AZ::Vector3&) override;
const EditorTransform& GetLocalEditorTransform() override;
void SetLocalEditorTransform(const EditorTransform& dest) override;
bool IsTransformLocked() override;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponentBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponentBus.h
index f1cb8459c4..6082bda4bd 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponentBus.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponentBus.h
@@ -30,7 +30,7 @@ namespace AzToolsFramework
EditorTransform()
{
m_translate = AZ::Vector3::CreateZero();
- m_scale = AZ::Vector3::CreateOne();
+ m_scale = 1.0f;
m_rotate = AZ::Vector3::CreateZero();
m_locked = false;
}
@@ -41,7 +41,7 @@ namespace AzToolsFramework
}
AZ::Vector3 m_translate; //! Translation in engine units (meters)
- AZ::Vector3 m_scale;
+ float m_scale;
AZ::Vector3 m_rotate; //! Rotation in degrees
bool m_locked;
};
@@ -65,7 +65,6 @@ namespace AzToolsFramework
virtual void TranslateBy(const AZ::Vector3&) = 0;
virtual void RotateBy(const AZ::Vector3&) = 0;
- virtual void ScaleBy(const AZ::Vector3&) = 0;
virtual bool IsTransformLocked() = 0;
};
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp
index 433602e6d8..65ba51908d 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp
@@ -1472,7 +1472,7 @@ namespace AzToolsFramework
{
const AZ::Quaternion rotation = entityIdLookupIt->second.m_initial.GetRotation().GetNormalized();
const AZ::Vector3 position = entityIdLookupIt->second.m_initial.GetTranslation();
- const AZ::Vector3 scale = entityIdLookupIt->second.m_initial.GetScale();
+ const float scale = entityIdLookupIt->second.m_initial.GetUniformScale();
const AZ::Vector3 centerOffset = CalculateCenterOffset(entityId, m_pivotMode);
@@ -1483,7 +1483,7 @@ namespace AzToolsFramework
AZ::Transform::CreateFromQuaternion(rotation) *
AZ::Transform::CreateTranslation(centerOffset) * offsetRotation *
AZ::Transform::CreateTranslation(-centerOffset) *
- AZ::Transform::CreateScale(scale));
+ AZ::Transform::CreateUniformScale(scale));
}
break;
case ReferenceFrame::Parent:
@@ -1595,16 +1595,15 @@ namespace AzToolsFramework
}
const AZ::Transform initial = entityIdLookupIt->second.m_initial;
- const AZ::Vector3 initialScale = initial.GetScale();
+ const float initialScale = initial.GetUniformScale();
const auto sumVectorElements = [](const AZ::Vector3& vec) {
return vec.GetX() + vec.GetY() + vec.GetZ();
};
- const AZ::Vector3 uniformScale = AZ::Vector3(action.m_start.m_sign * sumVectorElements(action.LocalScaleOffset()));
- const AZ::Vector3 scale = (AZ::Vector3::CreateOne() +
- (uniformScale / initialScale)).GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale));
- const AZ::Transform scaleTransform = AZ::Transform::CreateScale(scale);
+ const float uniformScale = action.m_start.m_sign * sumVectorElements(action.LocalScaleOffset());
+ const float scale = AZ::GetClamp(1.0f + uniformScale / initialScale, AZ::MinTransformScale, AZ::MaxTransformScale);
+ const AZ::Transform scaleTransform = AZ::Transform::CreateUniformScale(scale);
if (action.m_modifiers.Alt())
{
@@ -1866,7 +1865,7 @@ namespace AzToolsFramework
CopyOrientationToSelectedEntitiesGroup(QuaternionFromTransformNoScaling(worldFromLocal));
break;
case Mode::Scale:
- CopyScaleToSelectedEntitiesIndividualWorld(worldFromLocal.GetScale());
+ CopyScaleToSelectedEntitiesIndividualWorld(worldFromLocal.GetUniformScale());
break;
case Mode::Translation:
CopyTranslationToSelectedEntitiesGroup(worldFromLocal.GetTranslation());
@@ -1895,7 +1894,7 @@ namespace AzToolsFramework
CopyOrientationToSelectedEntitiesIndividual(QuaternionFromTransformNoScaling(worldFromLocal));
break;
case Mode::Scale:
- CopyScaleToSelectedEntitiesIndividualWorld(worldFromLocal.GetScale());
+ CopyScaleToSelectedEntitiesIndividualWorld(worldFromLocal.GetUniformScale());
break;
case Mode::Translation:
CopyTranslationToSelectedEntitiesIndividual(worldFromLocal.GetTranslation());
@@ -2388,7 +2387,7 @@ namespace AzToolsFramework
ResetOrientationForSelectedEntitiesLocal();
break;
case Mode::Scale:
- CopyScaleToSelectedEntitiesIndividualLocal(AZ::Vector3::CreateOne());
+ CopyScaleToSelectedEntitiesIndividualLocal(1.0f);
break;
case Mode::Translation:
ResetTranslationForSelectedEntitiesLocal();
@@ -2414,7 +2413,7 @@ namespace AzToolsFramework
ResetOrientationForSelectedEntitiesLocal();
break;
case Mode::Scale:
- CopyScaleToSelectedEntitiesIndividualWorld(AZ::Vector3::CreateOne());
+ CopyScaleToSelectedEntitiesIndividualWorld(1.0f);
break;
case Mode::Translation:
// do nothing
@@ -2934,7 +2933,7 @@ namespace AzToolsFramework
}
}
- void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualWorld(const AZ::Vector3& scale)
+ void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualWorld(float scale)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
@@ -2949,7 +2948,7 @@ namespace AzToolsFramework
const auto transformsBefore = RecordTransformsBefore(manipulatorEntityIds.m_entityIds);
// update scale relative to initial
- const AZ::Transform scaleTransform = AZ::Transform::CreateScale(scale);
+ const AZ::Transform scaleTransform = AZ::Transform::CreateUniformScale(scale);
for (AZ::EntityId entityId : manipulatorEntityIds.m_entityIds)
{
ScopedUndoBatch::MarkEntityDirty(entityId);
@@ -2968,7 +2967,7 @@ namespace AzToolsFramework
RefreshUiAfterChange(manipulatorEntityIds.m_entityIds);
}
- void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualLocal(const AZ::Vector3& scale)
+ void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualLocal(float scale)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
@@ -3014,9 +3013,9 @@ namespace AzToolsFramework
if (transformIt != transformsBefore.end())
{
AZ::Transform newWorldFromLocal = transformIt->second;
- const AZ::Vector3 scale = newWorldFromLocal.GetScale();
+ const float scale = newWorldFromLocal.GetUniformScale();
newWorldFromLocal.SetRotation(orientation);
- newWorldFromLocal *= AZ::Transform::CreateScale(scale);
+ newWorldFromLocal *= AZ::Transform::CreateUniformScale(scale);
SetEntityWorldTransform(entityId, newWorldFromLocal);
}
@@ -3661,7 +3660,7 @@ namespace AzToolsFramework
}
void EditorTransformComponentSelection::SetEntityLocalScale(
- const AZ::EntityId entityId, const AZ::Vector3& localScale)
+ const AZ::EntityId entityId, const float localScale)
{
ETCS::SetEntityLocalScale(entityId, localScale, m_transformChangedInternally);
}
@@ -3714,11 +3713,11 @@ namespace AzToolsFramework
entityId, &AZ::TransformBus::Events::SetWorldTM, worldTransform);
}
- void SetEntityLocalScale(AZ::EntityId entityId, const AZ::Vector3& localScale, bool& internal)
+ void SetEntityLocalScale(AZ::EntityId entityId, float localScale, bool& internal)
{
ScopeSwitch sw(internal);
AZ::TransformBus::Event(
- entityId, &AZ::TransformBus::Events::SetLocalScale, localScale);
+ entityId, &AZ::TransformBus::Events::SetLocalUniformScale, localScale);
}
void SetEntityLocalRotation(AZ::EntityId entityId, const AZ::Vector3& localRotation, bool& internal)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h
index 99265313fe..9fd16a6e21 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h
@@ -212,8 +212,8 @@ namespace AzToolsFramework
void CopyOrientationToSelectedEntitiesIndividual(const AZ::Quaternion& orientation);
void CopyOrientationToSelectedEntitiesGroup(const AZ::Quaternion& orientation);
void ResetOrientationForSelectedEntitiesLocal();
- void CopyScaleToSelectedEntitiesIndividualLocal(const AZ::Vector3& scale);
- void CopyScaleToSelectedEntitiesIndividualWorld(const AZ::Vector3& scale);
+ void CopyScaleToSelectedEntitiesIndividualLocal(float scale);
+ void CopyScaleToSelectedEntitiesIndividualWorld(float scale);
// EditorManipulatorCommandUndoRedoRequestBus ...
void UndoRedoEntityManipulatorCommand(
@@ -248,7 +248,7 @@ namespace AzToolsFramework
void SetEntityWorldTranslation(AZ::EntityId entityId, const AZ::Vector3& worldTranslation);
void SetEntityLocalTranslation(AZ::EntityId entityId, const AZ::Vector3& localTranslation);
void SetEntityWorldTransform(AZ::EntityId entityId, const AZ::Transform& worldTransform);
- void SetEntityLocalScale(AZ::EntityId entityId, const AZ::Vector3& localScale);
+ void SetEntityLocalScale(AZ::EntityId entityId, float localScale);
void SetEntityLocalRotation(AZ::EntityId entityId, const AZ::Vector3& localRotation);
AZ::EntityId m_hoveredEntityId; ///< What EntityId is the mouse currently hovering over (if any).
@@ -316,7 +316,7 @@ namespace AzToolsFramework
void SetEntityWorldTranslation(AZ::EntityId entityId, const AZ::Vector3& worldTranslation, bool& internal);
void SetEntityLocalTranslation(AZ::EntityId entityId, const AZ::Vector3& localTranslation, bool& internal);
void SetEntityWorldTransform(AZ::EntityId entityId, const AZ::Transform& worldTransform, bool& internal);
- void SetEntityLocalScale(AZ::EntityId entityId, const AZ::Vector3& localScale, bool& internal);
+ void SetEntityLocalScale(AZ::EntityId entityId, float localScale, bool& internal);
void SetEntityLocalRotation(AZ::EntityId entityId, const AZ::Vector3& localRotation, bool& internal);
} // namespace ETCS
} // namespace AzToolsFramework
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h
index 59c250b8f7..9cd78f8c50 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h
@@ -101,10 +101,10 @@ namespace AzToolsFramework
virtual void ResetOrientationForSelectedEntitiesLocal() = 0;
/// Copy scale to each individual entity in local space without moving position.
- virtual void CopyScaleToSelectedEntitiesIndividualLocal(const AZ::Vector3& scale) = 0;
+ virtual void CopyScaleToSelectedEntitiesIndividualLocal(float scale) = 0;
/// Copy scale to to each individual entity in world (absolute) space.
- virtual void CopyScaleToSelectedEntitiesIndividualWorld(const AZ::Vector3& scale) = 0;
+ virtual void CopyScaleToSelectedEntitiesIndividualWorld(float scale) = 0;
protected:
~EditorTransformComponentSelectionRequests() = default;
diff --git a/Code/Framework/GridMate/GridMate/Serialize/CompressionMarshal.cpp b/Code/Framework/GridMate/GridMate/Serialize/CompressionMarshal.cpp
index 751e151ec6..9dc7de1cf7 100644
--- a/Code/Framework/GridMate/GridMate/Serialize/CompressionMarshal.cpp
+++ b/Code/Framework/GridMate/GridMate/Serialize/CompressionMarshal.cpp
@@ -488,18 +488,17 @@ void TransformCompressor::Marshal(WriteBuffer& wb, const AZ::Transform& value) c
{
AZ::u8 flags = 0;
auto flagsMarker = wb.InsertMarker(flags);
- AZ::Matrix3x3 m33 = AZ::Matrix3x3::CreateFromTransform(value);
- AZ::Vector3 scale = m33.ExtractScale();
- AZ::Quaternion rot = AZ::Quaternion::CreateFromMatrix3x3(m33.GetOrthogonalized());
+ float scale = value.GetUniformScale();
+ AZ::Quaternion rot = value.GetRotation();
if (!rot.IsIdentity())
{
flags |= HAS_ROT;
wb.Write(rot, QuatCompMarshaler());
}
- if (!scale.IsClose(AZ::Vector3::CreateOne()))
+ if (!AZ::IsClose(scale, 1.0f))
{
flags |= HAS_SCALE;
- wb.Write(scale, Vec3CompMarshaler());
+ wb.Write(scale, HalfMarshaler());
}
AZ::Vector3 pos = value.GetTranslation();
if (!pos.IsZero())
@@ -527,9 +526,9 @@ void TransformCompressor::Unmarshal(AZ::Transform& value, ReadBuffer& rb) const
}
if (flags & HAS_SCALE)
{
- AZ::Vector3 scale;
- rb.Read(scale, Vec3CompMarshaler());
- xform.MultiplyByScale(scale);
+ float scale;
+ rb.Read(scale, HalfMarshaler());
+ xform.MultiplyByUniformScale(scale);
}
if (flags & HAS_POS)
{
diff --git a/Code/Framework/Tests/TransformComponent.cpp b/Code/Framework/Tests/TransformComponent.cpp
index 44008686cd..0b6110e3aa 100644
--- a/Code/Framework/Tests/TransformComponent.cpp
+++ b/Code/Framework/Tests/TransformComponent.cpp
@@ -24,6 +24,8 @@
#include
#include
+#include
+
using namespace AZ;
using namespace AzFramework;
@@ -362,8 +364,8 @@ namespace UnitTest
TEST_F(TransformComponentTransformMatrixSetGet, SetLocalRotation_SimpleValues_Set)
{
// add some scale first
- float sx = 1.03f, sy = 0.67f, sz = 1.23f;
- Transform tm = Transform::CreateScale(Vector3(sx, sy, sz));
+ float scale = 1.23f;
+ Transform tm = Transform::CreateUniformScale(scale);
TransformBus::Event(m_childId, &TransformBus::Events::SetLocalTM, tm);
float rx = 42.435f;
@@ -379,13 +381,13 @@ namespace UnitTest
Matrix3x3 finalRotate = rotateX * rotateY * rotateZ;
Vector3 basisX = tm.GetBasisX();
- Vector3 expectedBasisX = finalRotate.GetBasisX() * sx;
+ Vector3 expectedBasisX = finalRotate.GetBasisX() * scale;
EXPECT_TRUE(basisX.IsClose(expectedBasisX));
Vector3 basisY = tm.GetBasisY();
- Vector3 expectedBasisY = finalRotate.GetBasisY() * sy;
+ Vector3 expectedBasisY = finalRotate.GetBasisY() * scale;
EXPECT_TRUE(basisY.IsClose(expectedBasisY));
Vector3 basisZ = tm.GetBasisZ();
- Vector3 expectedBasisZ = finalRotate.GetBasisZ() * sz;
+ Vector3 expectedBasisZ = finalRotate.GetBasisZ() * scale;
EXPECT_TRUE(basisZ.IsClose(expectedBasisZ));
}
@@ -476,18 +478,15 @@ namespace UnitTest
{
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalX, rx);
}
- Vector3 localScale;
- TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalScale);
- EXPECT_TRUE(localScale.IsClose(Vector3(1.0f, 1.0f, 1.0f)));
+ float localScale = FLT_MAX;
+ TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalUniformScale);
+ EXPECT_NEAR(localScale, 1.0f, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, RotateAroundLocalX_ScaleDoesNotSkewRotation)
{
- float sx = 42.564f;
- float sy = 12.460f;
- float sz = 28.692f;
- Vector3 expectedScales(sx, sy, sz);
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScale, expectedScales);
+ float expectedScale = 42.564f;
+ TransformBus::Event(m_childId, &TransformBus::Events::SetLocalUniformScale, expectedScale);
float rx = 1.43f;
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalX, rx);
@@ -513,18 +512,15 @@ namespace UnitTest
{
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalY, ry);
}
- Vector3 localScale;
- TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalScale);
- EXPECT_TRUE(localScale.IsClose(Vector3(1.0f, 1.0f, 1.0f)));
+ float localScale = FLT_MAX;
+ TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalUniformScale);
+ EXPECT_NEAR(localScale, 1.0f, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, RotateAroundLocalY_ScaleDoesNotSkewRotation)
{
- float sx = 42.564f;
- float sy = 12.460f;
- float sz = 28.692f;
- Vector3 expectedScales(sx, sy, sz);
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScale, expectedScales);
+ float expectedScale = 42.564f;
+ TransformBus::Event(m_childId, &TransformBus::Events::SetLocalUniformScale, expectedScale);
float ry = 1.43f;
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalY, ry);
@@ -550,18 +546,15 @@ namespace UnitTest
{
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalZ, rz);
}
- Vector3 localScale;
- TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalScale);
- EXPECT_TRUE(localScale.IsClose(Vector3(1.0f, 1.0f, 1.0f)));
+ float localScale = FLT_MAX;
+ TransformBus::EventResult(localScale, m_childId, &TransformBus::Events::GetLocalUniformScale);
+ EXPECT_NEAR(localScale, 1.0f, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, RotateAroundLocalZ_ScaleDoesNotSkewRotation)
{
- float sx = 42.564f;
- float sy = 12.460f;
- float sz = 28.692f;
- Vector3 expectedScales(sx, sy, sz);
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScale, expectedScales);
+ float expectedScale = 42.564f;
+ TransformBus::Event(m_childId, &TransformBus::Events::SetLocalUniformScale, expectedScale);
float rz = 1.43f;
TransformBus::Event(m_childId, &TransformBus::Events::RotateAroundLocalZ, rz);
@@ -572,65 +565,50 @@ namespace UnitTest
TEST_F(TransformComponentTransformMatrixSetGet, SetLocalScale_SimpleValues_Set)
{
- float sx = 42.564f;
- float sy = 12.460f;
- float sz = 28.692f;
- Vector3 expectedScales(sx, sy, sz);
- TransformBus::Event(m_childId, &TransformBus::Events::SetLocalScale, expectedScales);
+ float expectedScale = 42.564f;
+ TransformBus::Event(m_childId, &TransformBus::Events::SetLocalUniformScale, expectedScale);
- Transform tm ;
+ Transform tm;
TransformBus::EventResult(tm, m_childId, &TransformBus::Events::GetLocalTM);
- Vector3 scales = tm.GetScale();
- EXPECT_TRUE(scales.IsClose(expectedScales));
+ float scale = tm.GetUniformScale();
+ EXPECT_NEAR(scale, expectedScale, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, GetLocalScale_SimpleValues_Return)
{
- float sx = 43.463f;
- float sy = 346.22f;
- float sz = 863.32f;
- Vector3 expectedScales(sx, sy, sz);
- Transform scaleTM = Transform::CreateScale(expectedScales);
+ float expectedScale = 43.463f;
+ Transform scaleTM = Transform::CreateUniformScale(expectedScale);
TransformBus::Event(m_childId, &TransformBus::Events::SetLocalTM, scaleTM);
- Vector3 scales;
- TransformBus::EventResult(scales, m_childId, &TransformBus::Events::GetLocalScale);
- EXPECT_TRUE(scales.IsClose(expectedScales));
+ float scale;
+ TransformBus::EventResult(scale, m_childId, &TransformBus::Events::GetLocalUniformScale);
+ EXPECT_NEAR(scale, expectedScale, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, GetWorldScale_ChildHasNoScale_ReturnScaleSameAsParent)
{
- float sx = 43.463f;
- float sy = 346.22f;
- float sz = 863.32f;
- Vector3 expectedScales(sx, sy, sz);
- Transform scaleTM = Transform::CreateScale(expectedScales);
+ float expectedScale = 43.463f;
+ Transform scaleTM = Transform::CreateUniformScale(expectedScale);
TransformBus::Event(m_parentId, &TransformBus::Events::SetLocalTM, scaleTM);
- Vector3 scales;
- TransformBus::EventResult(scales, m_childId, &TransformBus::Events::GetWorldScale);
- EXPECT_TRUE(scales.IsClose(expectedScales));
+ float scale = FLT_MAX;
+ TransformBus::EventResult(scale, m_childId, &TransformBus::Events::GetWorldUniformScale);
+ EXPECT_NEAR(scale, expectedScale, AZ::Constants::Tolerance);
}
TEST_F(TransformComponentTransformMatrixSetGet, GetWorldScale_ChildHasScale_ReturnCompoundScale)
{
- float sx = 4.463f;
- float sy = 3.22f;
- float sz = 8.32f;
- Vector3 parentScales(sx, sy, sz);
- Transform parentScaleTM = Transform::CreateScale(parentScales);
+ float parentScale = 4.463f;
+ Transform parentScaleTM = Transform::CreateUniformScale(parentScale);
TransformBus::Event(m_parentId, &TransformBus::Events::SetLocalTM, parentScaleTM);
- float csx = 1.64f;
- float csy = 9.35f;
- float csz = 1.57f;
- Vector3 childScales(csx, csy, csz);
- Transform childScaleTM = Transform::CreateScale(childScales);
+ float childScale = 1.64f;
+ Transform childScaleTM = Transform::CreateUniformScale(childScale);
TransformBus::Event(m_childId, &TransformBus::Events::SetLocalTM, childScaleTM);
- Vector3 scales;
- TransformBus::EventResult(scales, m_childId, &TransformBus::Events::GetWorldScale);
- EXPECT_TRUE(scales.IsClose(parentScales * childScales));
+ float scale = FLT_MAX;
+ TransformBus::EventResult(scale, m_childId, &TransformBus::Events::GetWorldUniformScale);
+ EXPECT_NEAR(scale, parentScale * childScale, AZ::Constants::Tolerance);
}
class TransformComponentHierarchy
diff --git a/Code/Sandbox/Editor/Objects/SelectionGroup.cpp b/Code/Sandbox/Editor/Objects/SelectionGroup.cpp
index b883b78e49..6363257e2f 100644
--- a/Code/Sandbox/Editor/Objects/SelectionGroup.cpp
+++ b/Code/Sandbox/Editor/Objects/SelectionGroup.cpp
@@ -490,28 +490,6 @@ void CSelectionGroup::StartScaling()
}
-void CSelectionGroup::FinishScaling(const Vec3& scale, [[maybe_unused]] int referenceCoordSys)
-{
- if (fabs(scale.x - scale.y) < 0.001f &&
- fabs(scale.y - scale.z) < 0.001f &&
- fabs(scale.z - scale.x) < 0.001f)
- {
- return;
- }
-
- for (int i = 0; i < GetFilteredCount(); ++i)
- {
- CBaseObject* obj = GetFilteredObject(i);
- Vec3 OriginalScale;
- if (obj->GetUntransformedScale(OriginalScale))
- {
- obj->TransformScale(scale);
- obj->SetScale(OriginalScale);
- }
- }
-}
-
-
//////////////////////////////////////////////////////////////////////////
void CSelectionGroup::Align()
{
diff --git a/Code/Sandbox/Editor/Objects/SelectionGroup.h b/Code/Sandbox/Editor/Objects/SelectionGroup.h
index 277ff2a492..9f672f28b2 100644
--- a/Code/Sandbox/Editor/Objects/SelectionGroup.h
+++ b/Code/Sandbox/Editor/Objects/SelectionGroup.h
@@ -103,7 +103,6 @@ public:
void StartScaling();
void Scale(const Vec3& scale, int referenceCoordSys);
void SetScale(const Vec3& scale, int referenceCoordSys);
- void FinishScaling(const Vec3& scale, int referenceCoordSys);
//! Align objects in selection to surface normal
void Align();
//! Very special method to move contents of a voxel.
diff --git a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp
index ae7077b4fc..b9814e66c1 100644
--- a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp
+++ b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp
@@ -1869,7 +1869,7 @@ void CTrackViewAnimNode::SetPos(const Vec3& position)
}
//////////////////////////////////////////////////////////////////////////
-void CTrackViewAnimNode::SetScale(const Vec3& scale)
+void CTrackViewAnimNode::SetScale(float scale)
{
CTrackViewTrack* track = GetTrackForParameter(AnimParamType::Scale);
@@ -2012,9 +2012,9 @@ void CTrackViewAnimNode::SetPosRotScaleTracksDefaultValues(bool positionAllowed,
}
if (scaleAllowed)
{
- AZ::Vector3 scale = AZ::Vector3::CreateOne();
- AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldScale);
- m_animNode->SetScale(time, AZVec3ToLYVec3(scale));
+ float scale = 1.0f;
+ AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldUniformScale);
+ m_animNode->SetScale(time, scale);
}
}
}
@@ -2482,11 +2482,11 @@ Quat CTrackViewAnimNode::GetTransformDelegateRotation(const Quat& baseRotation)
//////////////////////////////////////////////////////////////////////////
Vec3 CTrackViewAnimNode::GetTransformDelegateScale(const Vec3& baseScale) const
{
- const Vec3 scale = GetScale();
+ float scale = GetScale();
- return Vec3(CheckTrackAnimated(AnimParamType::ScaleX) ? scale.x : baseScale.x,
- CheckTrackAnimated(AnimParamType::ScaleY) ? scale.y : baseScale.y,
- CheckTrackAnimated(AnimParamType::ScaleZ) ? scale.z : baseScale.z);
+ return Vec3(CheckTrackAnimated(AnimParamType::ScaleX) ? scale : baseScale.x,
+ CheckTrackAnimated(AnimParamType::ScaleY) ? scale : baseScale.y,
+ CheckTrackAnimated(AnimParamType::ScaleZ) ? scale : baseScale.z);
}
//////////////////////////////////////////////////////////////////////////
@@ -2504,7 +2504,7 @@ void CTrackViewAnimNode::SetTransformDelegateRotation(const Quat& rotation)
//////////////////////////////////////////////////////////////////////////
void CTrackViewAnimNode::SetTransformDelegateScale(const Vec3& scale)
{
- SetScale(scale);
+ SetScale(scale.x);
}
bool CTrackViewAnimNode::IsTransformAnimParamTypeDelegated(const AnimParamType animParamType) const
diff --git a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.h b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.h
index 1e0cc2262a..4435d0efc7 100644
--- a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.h
+++ b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.h
@@ -182,8 +182,8 @@ public:
// Rotation/Position & Scale
void SetPos(const Vec3& position);
Vec3 GetPos() const { return m_animNode->GetPos(); }
- void SetScale(const Vec3& scale);
- Vec3 GetScale() const { return m_animNode->GetScale(); }
+ void SetScale(float scale);
+ float GetScale() const { return m_animNode->GetScale(); }
void SetRotation(const Quat& rotation);
Quat GetRotation() const { return m_animNode->GetRotate(); }
Quat GetRotation(float time) const { return m_animNode != nullptr ? m_animNode->GetRotate(time) : Quat(0,0,0,0); }
diff --git a/Code/Sandbox/Editor/TrackView/TrackViewSequence.cpp b/Code/Sandbox/Editor/TrackView/TrackViewSequence.cpp
index f915c804f8..3642f21da6 100644
--- a/Code/Sandbox/Editor/TrackView/TrackViewSequence.cpp
+++ b/Code/Sandbox/Editor/TrackView/TrackViewSequence.cpp
@@ -825,10 +825,10 @@ void CTrackViewSequence::SyncSelectedTracksToBase()
{
const Vec3 position = pAnimNode->GetPos();
const Quat rotation = pAnimNode->GetRotation();
- const Vec3 scale = pAnimNode->GetScale();
+ const float scale = pAnimNode->GetScale();
AZ::Transform transform = AZ::Transform::CreateIdentity();
- transform.SetScale(LYVec3ToAZVec3(scale));
+ transform.SetUniformScale(scale);
transform.SetRotation(LYQuaternionToAZQuaternion(rotation));
transform.SetTranslation(LYVec3ToAZVec3(position));
@@ -870,7 +870,7 @@ void CTrackViewSequence::SyncSelectedTracksFromBase()
pAnimNode->SetPos(AZVec3ToLYVec3(transform.GetTranslation()));
pAnimNode->SetRotation(AZQuaternionToLYQuaternion(transform.GetRotation()));
- pAnimNode->SetScale(AZVec3ToLYVec3(transform.GetScale()));
+ pAnimNode->SetScale(transform.GetUniformScale());
bNothingWasSynced = false;
}
diff --git a/Code/Tools/SceneAPI/SceneCore/Containers/Utilities/SceneUtilities.cpp b/Code/Tools/SceneAPI/SceneCore/Containers/Utilities/SceneUtilities.cpp
index f5bb9d28a6..ac27ed54eb 100644
--- a/Code/Tools/SceneAPI/SceneCore/Containers/Utilities/SceneUtilities.cpp
+++ b/Code/Tools/SceneAPI/SceneCore/Containers/Utilities/SceneUtilities.cpp
@@ -79,7 +79,7 @@ namespace AZ
if (coordinateSystemRule->GetScale() != 1.0f)
{
float scale = coordinateSystemRule->GetScale();
- matrix.MultiplyByScale(Vector3(scale, scale, scale));
+ matrix.MultiplyByScale(Vector3(scale));
}
if (!coordinateSystemRule->GetOriginNodeName().empty())
{
diff --git a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.cpp b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.cpp
index 09588a606e..640c092070 100644
--- a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.cpp
+++ b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.cpp
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
#include
namespace AZ
@@ -58,10 +59,11 @@ namespace AZ
}
else
{
- AzToolsFramework::Vector3PropertyHandler handler;
- handler.ConsumeAttribute(widget->GetTranslationWidget(), attrib, attrValue, debugName);
- handler.ConsumeAttribute(widget->GetRotationWidget(), attrib, attrValue, debugName);
- handler.ConsumeAttribute(widget->GetScaleWidget(), attrib, attrValue, debugName);
+ AzToolsFramework::Vector3PropertyHandler vector3Handler;
+ vector3Handler.ConsumeAttribute(widget->GetTranslationWidget(), attrib, attrValue, debugName);
+ vector3Handler.ConsumeAttribute(widget->GetRotationWidget(), attrib, attrValue, debugName);
+ AzToolsFramework::doublePropertySpinboxHandler spinboxHandler;
+ spinboxHandler.ConsumeAttribute(widget->GetScaleWidget(), attrib, attrValue, debugName);
}
}
@@ -109,4 +111,4 @@ namespace AZ
} // namespace SceneAPI
} // namespace AZ
-#include
\ No newline at end of file
+#include
diff --git a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.h b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.h
index a020ee8198..582f32649e 100644
--- a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.h
+++ b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowHandler.h
@@ -60,4 +60,4 @@ namespace AZ
};
} // namespace SceneUI
} // namespace SceneAPI
-} // namespace AZ
\ No newline at end of file
+} // namespace AZ
diff --git a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp
index 10e0fd2a68..e8ecaa0c27 100644
--- a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp
+++ b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp
@@ -15,6 +15,7 @@
#include
#include
#include
+#include
#include
#include
@@ -47,7 +48,7 @@ namespace AZ
ExpandedTransform::ExpandedTransform()
: m_translation(0, 0, 0)
, m_rotation(0, 0, 0)
- , m_scale(1, 1, 1)
+ , m_scale(1)
{
}
@@ -60,14 +61,14 @@ namespace AZ
{
m_translation = transform.GetTranslation();
m_rotation = transform.GetEulerDegrees();
- m_scale = transform.GetScale();
+ m_scale = transform.GetUniformScale();
}
void ExpandedTransform::GetTransform(AZ::Transform& transform) const
{
transform = Transform::CreateTranslation(m_translation);
transform *= AZ::ConvertEulerDegreesToTransform(m_rotation);
- transform.MultiplyByScale(m_scale);
+ transform.MultiplyByUniformScale(m_scale);
}
const AZ::Vector3& ExpandedTransform::GetTranslation() const
@@ -90,12 +91,12 @@ namespace AZ
m_rotation = rotation;
}
- const AZ::Vector3& ExpandedTransform::GetScale() const
+ const float ExpandedTransform::GetScale() const
{
return m_scale;
}
- void ExpandedTransform::SetScale(const AZ::Vector3& scale)
+ void ExpandedTransform::SetScale(const float scale)
{
m_scale = scale;
}
@@ -131,7 +132,7 @@ namespace AZ
m_rotationWidget->setMaximum(360);
m_rotationWidget->setSuffix(" degrees");
- m_scaleWidget = new AzQtComponents::VectorInput(this, 3);
+ m_scaleWidget = new AzToolsFramework::PropertyDoubleSpinCtrl(this);
m_scaleWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_scaleWidget->setMinimum(0);
m_scaleWidget->setMaximum(10000);
@@ -191,13 +192,10 @@ namespace AZ
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, this);
});
- QObject::connect(m_scaleWidget, &AzQtComponents::VectorInput::valueChanged, this, [this]
+ QObject::connect(m_scaleWidget, &AzToolsFramework::PropertyDoubleSpinCtrl::valueChanged, this, [this]
{
- AzQtComponents::VectorInput* widget = this->GetScaleWidget();
- AZ::Vector3 scale;
-
- PopulateVector3(widget, scale);
-
+ AzToolsFramework::PropertyDoubleSpinCtrl* widget = this->GetScaleWidget();
+ float scale = aznumeric_cast(widget->value());
m_transform.SetScale(scale);
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, this);
});
@@ -224,9 +222,7 @@ namespace AZ
m_rotationWidget->setValuebyIndex(m_transform.GetRotation().GetY(), 1);
m_rotationWidget->setValuebyIndex(m_transform.GetRotation().GetZ(), 2);
- m_scaleWidget->setValuebyIndex(m_transform.GetScale().GetX(), 0);
- m_scaleWidget->setValuebyIndex(m_transform.GetScale().GetY(), 1);
- m_scaleWidget->setValuebyIndex(m_transform.GetScale().GetZ(), 2);
+ m_scaleWidget->setValue(m_transform.GetScale());
blockSignals(false);
}
@@ -251,7 +247,7 @@ namespace AZ
return m_rotationWidget;
}
- AzQtComponents::VectorInput* TransformRowWidget::GetScaleWidget()
+ AzToolsFramework::PropertyDoubleSpinCtrl* TransformRowWidget::GetScaleWidget()
{
return m_scaleWidget;
}
diff --git a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.h b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.h
index dc3286f80e..3977d26c7c 100644
--- a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.h
+++ b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.h
@@ -21,6 +21,7 @@
#include
#include
#include
+
#endif
namespace AzQtComponents
@@ -28,6 +29,11 @@ namespace AzQtComponents
class VectorInput;
}
+namespace AzToolsFramework
+{
+ class PropertyDoubleSpinCtrl;
+}
+
namespace AZ
{
namespace SceneAPI
@@ -51,14 +57,14 @@ namespace AZ
const AZ::Vector3& GetRotation() const;
void SetRotation(const AZ::Vector3& translation);
- const AZ::Vector3& GetScale() const;
- void SetScale(const AZ::Vector3& scale);
+ const float GetScale() const;
+ void SetScale(const float scale);
private:
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ::Vector3 m_translation;
AZ::Vector3 m_rotation;
- AZ::Vector3 m_scale;
+ float m_scale;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
@@ -78,7 +84,7 @@ namespace AZ
AzQtComponents::VectorInput* GetTranslationWidget();
AzQtComponents::VectorInput* GetRotationWidget();
- AzQtComponents::VectorInput* GetScaleWidget();
+ AzToolsFramework::PropertyDoubleSpinCtrl* GetScaleWidget();
protected:
ExpandedTransform m_transform;
@@ -87,7 +93,7 @@ namespace AZ
AzQtComponents::VectorInput* m_translationWidget;
AzQtComponents::VectorInput* m_rotationWidget;
- AzQtComponents::VectorInput* m_scaleWidget;
+ AzToolsFramework::PropertyDoubleSpinCtrl* m_scaleWidget;
};
} // namespace SceneUI
} // namespace SceneAPI
diff --git a/Code/Tools/SceneAPI/SceneUI/Tests/RowWidgets/TransformRowWidgetTests.cpp b/Code/Tools/SceneAPI/SceneUI/Tests/RowWidgets/TransformRowWidgetTests.cpp
index 05082f29fb..cda6582e63 100644
--- a/Code/Tools/SceneAPI/SceneUI/Tests/RowWidgets/TransformRowWidgetTests.cpp
+++ b/Code/Tools/SceneAPI/SceneUI/Tests/RowWidgets/TransformRowWidgetTests.cpp
@@ -30,7 +30,7 @@ namespace AZ
Vector3 m_translation = Vector3(10.0f, 20.0f, 30.0f);
Vector3 m_rotation = Vector3(30.0f, 45.0f, 60.0f);
- Vector3 m_scale = Vector3(2.0f, 3.0f, 4.0f);
+ float m_scale = 3.0f;
};
TEST_F(TransformRowWidgetTest, GetTranslation_TranslationInMatrix_TranslationCanBeRetrievedDirectly)
@@ -83,26 +83,22 @@ namespace AZ
TEST_F(TransformRowWidgetTest, GetScale_ScaleInMatrix_ScaleCanBeRetrievedDirectly)
{
- m_transform = Transform::CreateScale(m_scale);
+ m_transform = Transform::CreateUniformScale(m_scale);
m_expanded.SetTransform(m_transform);
- const Vector3& returned = m_expanded.GetScale();
- EXPECT_NEAR(m_scale.GetX(), returned.GetX(), 0.1f);
- EXPECT_NEAR(m_scale.GetY(), returned.GetY(), 0.1f);
- EXPECT_NEAR(m_scale.GetZ(), returned.GetZ(), 0.1f);
+ const float returned = m_expanded.GetScale();
+ EXPECT_NEAR(m_scale, returned, 0.1f);
}
TEST_F(TransformRowWidgetTest, GetScale_ScaleInMatrix_ScaleCanBeRetrievedFromTransform)
{
- m_transform = Transform::CreateScale(m_scale);
+ m_transform = Transform::CreateUniformScale(m_scale);
m_expanded.SetTransform(m_transform);
Transform rebuild;
m_expanded.GetTransform(rebuild);
- Vector3 returned = rebuild.GetScale();
- EXPECT_NEAR(m_scale.GetX(), returned.GetX(), 0.1f);
- EXPECT_NEAR(m_scale.GetY(), returned.GetY(), 0.1f);
- EXPECT_NEAR(m_scale.GetZ(), returned.GetZ(), 0.1f);
+ float returned = rebuild.GetUniformScale();
+ EXPECT_NEAR(m_scale, returned, 0.1f);
}
TEST_F(TransformRowWidgetTest, GetTransform_RotateAndTranslateInMatrix_ReconstructedTransformMatchesOriginal)
@@ -121,7 +117,7 @@ namespace AZ
{
Quaternion quaternion = AZ::ConvertEulerDegreesToQuaternion(m_rotation);
m_transform = Transform::CreateFromQuaternionAndTranslation(quaternion, m_translation);
- m_transform.MultiplyByScale(m_scale);
+ m_transform.MultiplyByUniformScale(m_scale);
m_expanded.SetTransform(m_transform);
Transform rebuild;
diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Viewport/MaterialViewportRenderer.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Viewport/MaterialViewportRenderer.cpp
index e1bfaa3872..b55dcf2088 100644
--- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Viewport/MaterialViewportRenderer.cpp
+++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Viewport/MaterialViewportRenderer.cpp
@@ -16,6 +16,7 @@
#include
#include
+#include
#include
#include
@@ -178,9 +179,10 @@ namespace MaterialEditor
m_shadowCatcherEntity->CreateComponent(AZ::Render::MeshComponentTypeId);
m_shadowCatcherEntity->CreateComponent(AZ::Render::MaterialComponentTypeId);
m_shadowCatcherEntity->CreateComponent(azrtti_typeid());
+ m_shadowCatcherEntity->CreateComponent(azrtti_typeid());
m_shadowCatcherEntity->Activate();
- AZ::TransformBus::Event(m_shadowCatcherEntity->GetId(), &AZ::TransformBus::Events::SetLocalScale, AZ::Vector3{ 100, 100, 1.0 });
+ AZ::NonUniformScaleRequestBus::Event(m_shadowCatcherEntity->GetId(), &AZ::NonUniformScaleRequests::SetScale, AZ::Vector3{ 100, 100, 1.0 });
AZ::Data::AssetId shadowCatcherModelAssetId = RPI::AssetUtils::GetAssetIdForProductPath("materialeditor/viewportmodels/plane_1x1.azmodel", RPI::AssetUtils::TraceLevel::Error);
AZ::Render::MeshComponentRequestBus::Event(m_shadowCatcherEntity->GetId(),
diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp
index c2bcc566e0..6ec780c2ab 100644
--- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp
+++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/PolygonLightDelegate.cpp
@@ -50,7 +50,6 @@ namespace AZ
AZStd::vector vertices = m_shapeBus->GetPolygonPrism()->m_vertexContainer.GetVertices();
Transform transform = GetTransform();
- transform.SetScale(Vector3(transform.GetScale().GetMaxElement())); // Poly Prism only supports uniform scale, so use max element.
AZStd::vector transformedVertices;
transformedVertices.reserve(vertices.size());
diff --git a/Gems/Blast/Code/Tests/BlastFamilyTest.cpp b/Gems/Blast/Code/Tests/BlastFamilyTest.cpp
index 2e6fd7f2bb..7af9f41e9c 100644
--- a/Gems/Blast/Code/Tests/BlastFamilyTest.cpp
+++ b/Gems/Blast/Code/Tests/BlastFamilyTest.cpp
@@ -137,7 +137,7 @@ namespace Blast
.Times(1)
.WillOnce(Return(false));
- AZ::Transform transform = AZ::Transform::CreateScale(AZ::Vector3::CreateOne());
+ AZ::Transform transform = AZ::Transform::CreateUniformScale(1.0f);
blastFamily->Spawn(transform);
}
diff --git a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
index 88c22cf67f..c9455c2fb3 100644
--- a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
+++ b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h
@@ -669,6 +669,9 @@ namespace Blast
MOCK_METHOD1(SetLocalScale, void(const AZ::Vector3&));
MOCK_METHOD0(GetLocalScale, AZ::Vector3());
MOCK_METHOD0(GetWorldScale, AZ::Vector3());
+ MOCK_METHOD1(SetLocalUniformScale, void(float));
+ MOCK_METHOD0(GetLocalUniformScale, float());
+ MOCK_METHOD0(GetWorldUniformScale, float());
MOCK_METHOD0(GetParentId, AZ::EntityId());
MOCK_METHOD0(GetParent, TransformInterface*());
MOCK_METHOD1(SetParent, void(AZ::EntityId));
diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp
index 0aef3f9d4f..3a23241385 100644
--- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp
+++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp
@@ -1157,7 +1157,7 @@ namespace MCommon
void RenderUtil::RenderSphere(const AZ::Vector3& position, float radius, const MCore::RGBAColor& color)
{
// setup the world space matrix of the sphere
- AZ::Transform sphereTransform = AZ::Transform::CreateScale(AZ::Vector3(radius, radius, radius));
+ AZ::Transform sphereTransform = AZ::Transform::CreateUniformScale(radius);
sphereTransform.SetTranslation(position);
// render the sphere
diff --git a/Gems/GradientSignal/Code/Include/GradientSignal/Util.h b/Gems/GradientSignal/Code/Include/GradientSignal/Util.h
index 4e15bdc293..1a8bb00eba 100644
--- a/Gems/GradientSignal/Code/Include/GradientSignal/Util.h
+++ b/Gems/GradientSignal/Code/Include/GradientSignal/Util.h
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include
#include
@@ -64,15 +65,15 @@ namespace GradientSignal
AZ::LerpInverse(bounds.GetMin().GetZ(), bounds.GetMax().GetZ(), point.GetZ()));
}
- inline void GetObbParamsFromShape(const AZ::EntityId& entity, AZ::Aabb& bounds, AZ::Transform& worldToBoundsTransform)
+ inline void GetObbParamsFromShape(const AZ::EntityId& entity, AZ::Aabb& bounds, AZ::Matrix3x4& worldToBoundsTransform)
{
//get bound and transform data for associated shape
bounds = AZ::Aabb::CreateNull();
- worldToBoundsTransform = AZ::Transform::CreateIdentity();
+ AZ::Transform transform = AZ::Transform::CreateIdentity();
if (entity.IsValid())
{
- LmbrCentral::ShapeComponentRequestsBus::Event(entity, &LmbrCentral::ShapeComponentRequestsBus::Events::GetTransformAndLocalBounds, worldToBoundsTransform, bounds);
- worldToBoundsTransform.Invert();
+ LmbrCentral::ShapeComponentRequestsBus::Event(entity, &LmbrCentral::ShapeComponentRequestsBus::Events::GetTransformAndLocalBounds, transform, bounds);
+ worldToBoundsTransform = AZ::Matrix3x4::CreateFromTransform(transform.GetInverse());
}
}
diff --git a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp
index 0b967a6957..6cee088a1c 100644
--- a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp
+++ b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp
@@ -333,7 +333,7 @@ namespace GradientSignal
AZStd::lock_guard lock(m_cacheMutex);
//transforming coordinate into "local" relative space of shape bounds
- outUVW = m_shapeTransformInverse.TransformPoint(inPosition);
+ outUVW = m_shapeTransformInverse * inPosition;
if (!m_configuration.m_advancedMode || !m_configuration.m_is3d)
{
@@ -387,7 +387,7 @@ namespace GradientSignal
void GradientTransformComponent::GetGradientEncompassingBounds(AZ::Aabb& bounds) const
{
bounds = m_shapeBounds;
- bounds.ApplyTransform(m_shapeTransformInverse.GetInverse());
+ bounds.ApplyMatrix3x4(m_shapeTransformInverse.GetInverseFull());
}
void GradientTransformComponent::OnCompositionChanged()
@@ -500,10 +500,11 @@ namespace GradientSignal
m_shapeBounds = AZ::Aabb::CreateFromMinMax(-m_configuration.m_bounds * 0.5f, m_configuration.m_bounds * 0.5f);
//rebuild transform from parameters
- AZ::Quaternion rotation;
- rotation.SetFromEulerDegrees(m_configuration.m_rotate);
- const AZ::Transform shapeTransformFinal(m_configuration.m_translate, rotation, m_configuration.m_scale);
- m_shapeTransformInverse = shapeTransformFinal.GetInverse();
+ AZ::Matrix3x4 shapeTransformFinal;
+ shapeTransformFinal.SetFromEulerDegrees(m_configuration.m_rotate);
+ shapeTransformFinal.SetTranslation(m_configuration.m_translate);
+ shapeTransformFinal.MultiplyByScale(m_configuration.m_scale);
+ m_shapeTransformInverse = shapeTransformFinal.GetInverseFull();
}
AZ::EntityId GradientTransformComponent::GetShapeEntityId() const
diff --git a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.h b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.h
index 15aaf40494..5955da95c7 100644
--- a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.h
+++ b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.h
@@ -15,6 +15,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -172,8 +173,8 @@ namespace GradientSignal
mutable AZStd::recursive_mutex m_cacheMutex;
GradientTransformConfig m_configuration;
AZ::Aabb m_shapeBounds = AZ::Aabb::CreateNull();
- AZ::Transform m_shapeTransformInverse = AZ::Transform::CreateIdentity();
+ AZ::Matrix3x4 m_shapeTransformInverse = AZ::Matrix3x4::CreateIdentity();
LmbrCentral::DependencyMonitor m_dependencyMonitor;
AZStd::atomic_bool m_dirty{ false };
};
-} //namespace GradientSignal
\ No newline at end of file
+} //namespace GradientSignal
diff --git a/Gems/LmbrCentral/Code/Source/Animation/AttachmentComponent.cpp b/Gems/LmbrCentral/Code/Source/Animation/AttachmentComponent.cpp
index 537585f48c..efef5761bc 100644
--- a/Gems/LmbrCentral/Code/Source/Animation/AttachmentComponent.cpp
+++ b/Gems/LmbrCentral/Code/Source/Animation/AttachmentComponent.cpp
@@ -242,14 +242,14 @@ namespace LmbrCentral
{
// apply offset in world-space
finalTransform = m_targetEntityTransform * m_targetBoneTransform;
- finalTransform.SetScale(AZ::Vector3::CreateOne());
+ finalTransform.SetUniformScale(1.0f);
finalTransform *= m_targetOffset;
}
else if (m_scaleSource == AttachmentConfiguration::ScaleSource::TargetEntityScale)
{
// apply offset in target-entity-space (ignoring bone scale)
AZ::Transform boneNoScale = m_targetBoneTransform;
- boneNoScale.SetScale(AZ::Vector3::CreateOne());
+ boneNoScale.SetUniformScale(1.0f);
finalTransform = m_targetEntityTransform * boneNoScale * m_targetOffset;
}
diff --git a/Gems/LmbrCentral/Code/Source/Animation/EditorAttachmentComponent.cpp b/Gems/LmbrCentral/Code/Source/Animation/EditorAttachmentComponent.cpp
index 337da51159..6190f976a0 100644
--- a/Gems/LmbrCentral/Code/Source/Animation/EditorAttachmentComponent.cpp
+++ b/Gems/LmbrCentral/Code/Source/Animation/EditorAttachmentComponent.cpp
@@ -124,7 +124,7 @@ namespace LmbrCentral
{
AZ::Transform offset = AZ::ConvertEulerDegreesToTransform(m_rotationOffset);
offset.SetTranslation(m_positionOffset);
- offset.MultiplyByScale(m_scaleOffset);
+ offset.MultiplyByUniformScale(m_scaleOffset.GetMaxElement());
return offset;
}
diff --git a/Gems/LmbrCentral/Code/Source/Scripting/EditorLookAtComponent.cpp b/Gems/LmbrCentral/Code/Source/Scripting/EditorLookAtComponent.cpp
index ab22514cf8..7a2cc52627 100644
--- a/Gems/LmbrCentral/Code/Source/Scripting/EditorLookAtComponent.cpp
+++ b/Gems/LmbrCentral/Code/Source/Scripting/EditorLookAtComponent.cpp
@@ -169,22 +169,24 @@ namespace LmbrCentral
{
AZ::TransformNotificationBus::MultiHandler::BusDisconnect(GetEntityId());
{
- AZ::Transform currentTM = AZ::Transform::CreateIdentity();
- EBUS_EVENT_ID_RESULT(currentTM, GetEntityId(), AZ::TransformBus, GetWorldTM);
- AZ::Vector3 currentScale = currentTM.ExtractScale();
+ AZ::Transform sourceTM = AZ::Transform::CreateIdentity();
+ AZ::TransformBus::EventResult(sourceTM, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
AZ::Transform targetTM = AZ::Transform::CreateIdentity();
- EBUS_EVENT_ID_RESULT(targetTM, m_targetId, AZ::TransformBus, GetWorldTM);
+ AZ::TransformBus::EventResult(targetTM, m_targetId, &AZ::TransformBus::Events::GetWorldTM);
AZ::Transform lookAtTransform = AZ::Transform::CreateLookAt(
- currentTM.GetTranslation(),
+ sourceTM.GetTranslation(),
targetTM.GetTranslation(),
m_forwardAxis
);
- lookAtTransform.MultiplyByScale(currentScale);
+ // update the rotation and translation for sourceTM based on lookAtTransform, but leave scale unchanged
+ sourceTM.SetRotation(lookAtTransform.GetRotation());
+ sourceTM.SetTranslation(lookAtTransform.GetTranslation());
EBUS_EVENT_ID(GetEntityId(), AZ::TransformBus, SetWorldTM, lookAtTransform);
+ AZ::TransformBus::Event(GetEntityId(), &AZ::TransformBus::Events::SetWorldTM, sourceTM);
}
AZ::TransformNotificationBus::MultiHandler::BusConnect(GetEntityId());
}
diff --git a/Gems/LmbrCentral/Code/Source/Shape/BoxShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/BoxShape.cpp
index 2830f514fe..a2ee4d986f 100644
--- a/Gems/LmbrCentral/Code/Source/Shape/BoxShape.cpp
+++ b/Gems/LmbrCentral/Code/Source/Shape/BoxShape.cpp
@@ -251,7 +251,7 @@ namespace LmbrCentral
const AZ::Transform& currentTransform, const BoxShapeConfig& configuration, const AZ::Vector3& currentNonUniformScale)
{
AZ::Transform worldFromLocalNormalized = currentTransform;
- const float entityScale = worldFromLocalNormalized.ExtractScale().GetMaxElement();
+ const float entityScale = worldFromLocalNormalized.ExtractUniformScale();
m_currentPosition = worldFromLocalNormalized.GetTranslation();
m_scaledDimensions = configuration.m_dimensions * currentNonUniformScale * entityScale;
diff --git a/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp
index 89c5028e93..db5aaf097c 100644
--- a/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp
+++ b/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp
@@ -437,22 +437,18 @@ namespace LmbrCentral
const float height = polygonPrism.GetHeight();
const AZ::Vector3& nonUniformScale = polygonPrism.GetNonUniformScale();
- AZ::Transform worldFromLocalUniformScale = worldFromLocal;
- const float entityScale = worldFromLocalUniformScale.ExtractScale().GetMaxElement();
- worldFromLocalUniformScale *= AZ::Transform::CreateScale(AZ::Vector3(entityScale));
-
AZ::Aabb aabb = AZ::Aabb::CreateNull();
// check base of prism
for (const AZ::Vector2& vertex : vertexContainer.GetVertices())
{
- aabb.AddPoint(worldFromLocalUniformScale.TransformPoint(nonUniformScale * AZ::Vector3(vertex.GetX(), vertex.GetY(), 0.0f)));
+ aabb.AddPoint(worldFromLocal.TransformPoint(nonUniformScale * AZ::Vector3(vertex.GetX(), vertex.GetY(), 0.0f)));
}
// check top of prism
// set aabb to be height of prism - ensure entire polygon prism shape is enclosed in aabb
for (const AZ::Vector2& vertex : vertexContainer.GetVertices())
{
- aabb.AddPoint(worldFromLocalUniformScale.TransformPoint(nonUniformScale * AZ::Vector3(vertex.GetX(), vertex.GetY(), height)));
+ aabb.AddPoint(worldFromLocal.TransformPoint(nonUniformScale * AZ::Vector3(vertex.GetX(), vertex.GetY(), height)));
}
return aabb;
@@ -468,14 +464,10 @@ namespace LmbrCentral
const AZStd::vector& vertices = polygonPrism.m_vertexContainer.GetVertices();
const size_t vertexCount = vertices.size();
- AZ::Transform worldFromLocalWithUniformScale = worldFromLocal;
- const float transformScale = worldFromLocalWithUniformScale.ExtractScale().GetMaxElement();
- worldFromLocalWithUniformScale *= AZ::Transform::CreateScale(AZ::Vector3(transformScale));
-
// transform point to local space
// it's fine to invert the transform including scale here, because it won't affect whether the point is inside the prism
const AZ::Vector3 localPoint =
- worldFromLocalWithUniformScale.GetInverse().TransformPoint(point) / polygonPrism.GetNonUniformScale();
+ worldFromLocal.GetInverse().TransformPoint(point) / polygonPrism.GetNonUniformScale();
// ensure the point is not above or below the prism (in its local space)
if (localPoint.GetZ() < 0.0f || localPoint.GetZ() > polygonPrism.GetHeight())
@@ -534,7 +526,7 @@ namespace LmbrCentral
// but inverting any scale in the transform would mess up the distance, so extract that first and apply scale separately to the
// prism
AZ::Transform worldFromLocalNoScale = worldFromLocal;
- const float transformScale = worldFromLocalNoScale.ExtractScale().GetMaxElement();
+ const float transformScale = worldFromLocalNoScale.ExtractUniformScale();
const AZ::Vector3 combinedScale = transformScale * nonUniformScale;
const float scaledHeight = height * combinedScale.GetZ();
@@ -610,9 +602,9 @@ namespace LmbrCentral
}
// transform ray into local space
- AZ::Transform worldFromLocalNomalized = worldFromLocal;
- const float entityScale = worldFromLocalNomalized.ExtractScale().GetMaxElement();
- const AZ::Transform localFromWorldNormalized = worldFromLocalNomalized.GetInverse();
+ AZ::Transform worldFromLocalNormalized = worldFromLocal;
+ const float entityScale = worldFromLocalNormalized.ExtractUniformScale();
+ const AZ::Transform localFromWorldNormalized = worldFromLocalNormalized.GetInverse();
const float rayLength = 1000.0f;
const AZ::Vector3 localSrc = localFromWorldNormalized.TransformPoint(src);
const AZ::Vector3 localDir = localFromWorldNormalized.TransformVector(dir);
diff --git a/Gems/LmbrCentral/Code/Source/Shape/ShapeDisplay.h b/Gems/LmbrCentral/Code/Source/Shape/ShapeDisplay.h
index 09088f06cd..3591ecde36 100644
--- a/Gems/LmbrCentral/Code/Source/Shape/ShapeDisplay.h
+++ b/Gems/LmbrCentral/Code/Source/Shape/ShapeDisplay.h
@@ -42,15 +42,10 @@ namespace LmbrCentral
return;
}
- // only uniform scale is supported in physics so the debug visuals reflect this fact
- AZ::Transform worldFromLocalWithUniformScale = worldFromLocal;
- const AZ::Vector3 scale = worldFromLocalWithUniformScale.ExtractScale();
- worldFromLocalWithUniformScale.MultiplyByScale(AZ::Vector3(scale.GetMaxElement()));
-
- debugDisplay.PushMatrix(worldFromLocalWithUniformScale);
+ debugDisplay.PushMatrix(worldFromLocal);
drawShape(debugDisplay);
debugDisplay.PopMatrix();
}
-} // namespace LmbrCentral
\ No newline at end of file
+} // namespace LmbrCentral
diff --git a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp
index 6ca2e55de8..2691ab1557 100644
--- a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp
+++ b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp
@@ -216,11 +216,7 @@ namespace LmbrCentral
return AZ::Aabb::CreateNull();
}
- AZ::Transform worldFromLocalUniformScale = m_currentTransform;
- const float maxScale = worldFromLocalUniformScale.ExtractScale().GetMaxElement();
- worldFromLocalUniformScale *= AZ::Transform::CreateScale(AZ::Vector3(maxScale));
-
- return CalculateTubeBounds(*this, worldFromLocalUniformScale);
+ return CalculateTubeBounds(*this, m_currentTransform);
}
void TubeShape::GetTransformAndLocalBounds(AZ::Transform& transform, AZ::Aabb& bounds)
@@ -236,46 +232,38 @@ namespace LmbrCentral
return false;
}
- AZ::Transform worldFromLocalNormalized = m_currentTransform;
- const AZ::Vector3 scale = AZ::Vector3(worldFromLocalNormalized.ExtractScale().GetMaxElement());
- const AZ::Transform localFromWorldNormalized = worldFromLocalNormalized.GetInverse();
- const AZ::Vector3 localPoint = localFromWorldNormalized.TransformPoint(point) * scale.GetReciprocal();
+ const float scale = m_currentTransform.GetUniformScale();
+ const AZ::Vector3 localPoint = m_currentTransform.GetInverse().TransformPoint(point);
const auto address = m_spline->GetNearestAddressPosition(localPoint).m_splineAddress;
const float radiusSq = powf(m_radius, 2.0f);
const float variableRadiusSq =
powf(m_variableRadius.GetElementInterpolated(address, Lerpf), 2.0f);
- return (m_spline->GetPosition(address) - localPoint).GetLengthSq() < (radiusSq + variableRadiusSq) *
- scale.GetMaxElement();
+ return (m_spline->GetPosition(address) - localPoint).GetLengthSq() < (radiusSq + variableRadiusSq) * scale;
}
float TubeShape::DistanceSquaredFromPoint(const AZ::Vector3& point)
{
- AZ::Transform worldFromLocalNormalized = m_currentTransform;
- const AZ::Vector3 maxScale = AZ::Vector3(worldFromLocalNormalized.ExtractScale().GetMaxElement());
- const AZ::Transform localFromWorldNormalized = worldFromLocalNormalized.GetInverse();
- const AZ::Vector3 localPoint = localFromWorldNormalized.TransformPoint(point) * maxScale.GetReciprocal();
+ const float scale = m_currentTransform.GetUniformScale();
+ const AZ::Transform localFromWorld = m_currentTransform.GetInverse();
+ const AZ::Vector3 localPoint = localFromWorld.TransformPoint(point);
const auto splineQueryResult = m_spline->GetNearestAddressPosition(localPoint);
const float variableRadius =
m_variableRadius.GetElementInterpolated(splineQueryResult.m_splineAddress, Lerpf);
- return powf((sqrtf(splineQueryResult.m_distanceSq) - (m_radius + variableRadius)) * maxScale.GetMaxElement(), 2.0f);
+ return powf((sqrtf(splineQueryResult.m_distanceSq) - (m_radius + variableRadius)) * scale, 2.0f);
}
bool TubeShape::IntersectRay(const AZ::Vector3& src, const AZ::Vector3& dir, float& distance)
{
- AZ::Transform transformUniformScale = m_currentTransform;
- const float maxScale = transformUniformScale.ExtractScale().GetMaxElement();
- transformUniformScale *= AZ::Transform::CreateScale(AZ::Vector3(maxScale));
-
- const auto splineQueryResult = IntersectSpline(transformUniformScale, src, dir, *m_spline);
+ const auto splineQueryResult = IntersectSpline(m_currentTransform, src, dir, *m_spline);
const float variableRadius = m_variableRadius.GetElementInterpolated(
splineQueryResult.m_splineAddress, Lerpf);
const float totalRadius = m_radius + variableRadius;
- distance = (splineQueryResult.m_rayDistance - totalRadius) * m_currentTransform.GetScale().GetMaxElement();
+ distance = (splineQueryResult.m_rayDistance - totalRadius) * m_currentTransform.GetUniformScale();
return static_cast(sqrtf(splineQueryResult.m_distanceSq)) < totalRadius;
}
diff --git a/Gems/LmbrCentral/Code/Tests/BoxShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/BoxShapeTest.cpp
index fd1e4ae4f1..24ee8ace2f 100644
--- a/Gems/LmbrCentral/Code/Tests/BoxShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/BoxShapeTest.cpp
@@ -262,7 +262,7 @@ namespace UnitTest
AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisY(), AZ::Constants::QuarterPi),
AZ::Vector3(0.0f, 0.0f, 5.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f)),
+ AZ::Transform::CreateUniformScale(3.0f),
AZ::Vector3(2.0f, 4.0f, 1.0f), entity);
bool rayHit = false;
@@ -295,7 +295,7 @@ namespace UnitTest
{
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateTranslation(AZ::Vector3(2.0f, -5.0f, 3.0f));
- transform.MultiplyByScale(AZ::Vector3(0.5f));
+ transform.MultiplyByUniformScale(0.5f);
const AZ::Vector3 dimensions(2.2f, 1.8f, 0.4f);
const AZ::Vector3 nonUniformScale(0.2f, 2.6f, 1.2f);
CreateBoxWithNonUniformScale(transform, dimensions, nonUniformScale, entity);
@@ -340,7 +340,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.50f, 0.10f, 0.02f, 0.86f), AZ::Vector3(4.0f, 1.0f, -2.0f));
- transform.MultiplyByScale(AZ::Vector3(1.5f));
+ transform.MultiplyByUniformScale(1.5f);
const AZ::Vector3 dimensions(1.2f, 0.7f, 2.1f);
const AZ::Vector3 nonUniformScale(0.8f, 0.6f, 0.7f);
CreateBoxWithNonUniformScale(transform, dimensions, nonUniformScale, entity);
@@ -433,7 +433,7 @@ namespace UnitTest
AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisY(), AZ::Constants::QuarterPi),
AZ::Vector3::CreateZero()) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f)),
+ AZ::Transform::CreateUniformScale(3.0f),
AZ::Vector3(2.0f, 4.0f, 1.0f), entity);
AZ::Aabb aabb;
@@ -483,7 +483,7 @@ namespace UnitTest
AZ::Transform transformIn = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::QuarterPi) * AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisY(), AZ::Constants::QuarterPi),
AZ::Vector3(9.0f, 11.0f, 13.0f));
- transformIn.MultiplyByScale(AZ::Vector3(3.0f));
+ transformIn.MultiplyByUniformScale(3.0f);
CreateBox(transformIn, AZ::Vector3(1.5f, 3.5f, 5.5f), entity);
AZ::Transform transformOut;
@@ -500,7 +500,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transformIn = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.62f, 0.62f, 0.14f, 0.46f), AZ::Vector3(0.8f, -1.2f, 2.7f));
- transformIn.MultiplyByScale(AZ::Vector3(2.0f));
+ transformIn.MultiplyByUniformScale(2.0f);
const AZ::Vector3 nonUniformScale(1.5f, 2.0f, 0.4f);
const AZ::Vector3 boxDimensions(2.0f, 1.7f, 0.5f);
CreateBoxWithNonUniformScale(transformIn, nonUniformScale, boxDimensions, entity);
@@ -531,7 +531,7 @@ namespace UnitTest
AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisZ(), AZ::Constants::QuarterPi),
AZ::Vector3(23.0f, 12.0f, 40.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f)),
+ AZ::Transform::CreateUniformScale(3.0f),
AZ::Vector3(2.0f, 6.0f, 3.5f), entity);
// test some pairs of nearby points which should be just either side of the surface of the box
@@ -551,7 +551,7 @@ namespace UnitTest
AZ::Transform::CreateTranslation(AZ::Vector3(23.0f, 12.0f, 40.0f)) *
AZ::Transform::CreateRotationX(-AZ::Constants::QuarterPi) *
AZ::Transform::CreateRotationZ(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
AZ::Vector3(4.0f, 7.0f, 3.5f), entity);
// test some pairs of nearby points which should be just either side of the surface of the box
@@ -588,8 +588,8 @@ namespace UnitTest
CreateBox(
AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 37.0f, 32.0f)) *
AZ::Transform::CreateRotationZ(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f, 1.0f, 1.0f)),
- AZ::Vector3(4.0f, 2.0f, 10.0f), entity);
+ AZ::Transform::CreateUniformScale(2.0f),
+ AZ::Vector3(6.0f, 1.0f, 5.0f), entity);
float distance;
LmbrCentral::ShapeComponentRequestsBus::EventResult(
@@ -606,8 +606,8 @@ namespace UnitTest
AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 37.0f, 32.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::HalfPi) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f, 1.0f, 1.0f)),
- AZ::Vector3(4.0f, 2.0f, 10.0f), entity);
+ AZ::Transform::CreateUniformScale(0.5f),
+ AZ::Vector3(24.0f, 4.0f, 20.0f), entity);
float distance;
LmbrCentral::ShapeComponentRequestsBus::EventResult(
@@ -621,7 +621,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateRotationY(AZ::DegToRad(30.0f)), AZ::Vector3(3.0f, 4.0f, 5.0f));
- transform.MultiplyByScale(AZ::Vector3(2.0f));
+ transform.MultiplyByUniformScale(2.0f);
const AZ::Vector3 dimensions(2.0f, 3.0f, 1.5f);
const AZ::Vector3 nonUniformScale(1.4f, 2.2f, 0.8f);
CreateBoxWithNonUniformScale(transform, nonUniformScale, dimensions, entity);
@@ -638,7 +638,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.70f, 0.10f, 0.34f, 0.62f), AZ::Vector3(3.0f, -1.0f, 2.0f));
- transform.MultiplyByScale(AZ::Vector3(2.0f));
+ transform.MultiplyByUniformScale(2.0f);
const AZ::Vector3 dimensions(1.2f, 0.8f, 1.7f);
const AZ::Vector3 nonUniformScale(2.4f, 1.3f, 1.8f);
CreateBoxWithNonUniformScale(transform, nonUniformScale, dimensions, entity);
diff --git a/Gems/LmbrCentral/Code/Tests/CapsuleShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/CapsuleShapeTest.cpp
index 9b57cd46c7..3274585e63 100644
--- a/Gems/LmbrCentral/Code/Tests/CapsuleShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/CapsuleShapeTest.cpp
@@ -144,7 +144,7 @@ namespace UnitTest
CreateCapsule(
AZ::Transform::CreateTranslation(AZ::Vector3(-4.0f, -12.0f, -3.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
- AZ::Transform::CreateScale(AZ::Vector3(6.0f)),
+ AZ::Transform::CreateUniformScale(6.0f),
0.25f, 1.5f, entity);
bool rayHit = false;
@@ -208,7 +208,7 @@ namespace UnitTest
TEST_F(CapsuleShapeTest, GetAabb3)
{
AZ::Entity entity;
- CreateCapsule(AZ::Transform::CreateScale(AZ::Vector3(3.5f)), 2.0f, 4.0f, entity);
+ CreateCapsule(AZ::Transform::CreateUniformScale(3.5f), 2.0f, 4.0f, entity);
AZ::Aabb aabb;
LmbrCentral::ShapeComponentRequestsBus::EventResult(
@@ -224,7 +224,7 @@ namespace UnitTest
AZ::Entity entity;
CreateCapsule(
AZ::Transform::CreateTranslation(AZ::Vector3(5.0f, 20.0f, 0.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f)), 1.0f, 5.0f, entity);
+ AZ::Transform::CreateUniformScale(2.5f), 1.0f, 5.0f, entity);
AZ::Aabb aabb;
LmbrCentral::ShapeComponentRequestsBus::EventResult(
@@ -255,7 +255,7 @@ namespace UnitTest
AZ::Transform transformIn = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::HalfPi) *
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisY(), AZ::Constants::QuarterPi), AZ::Vector3(-10.0f, -10.0f, 0.0f));
- transformIn.MultiplyByScale(AZ::Vector3(3.0f));
+ transformIn.MultiplyByUniformScale(3.0f);
CreateCapsule(transformIn, 5.0f, 2.0f, entity);
AZ::Transform transformOut;
@@ -273,7 +273,7 @@ namespace UnitTest
AZ::Transform transformIn = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::HalfPi) *
AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisY(), AZ::Constants::QuarterPi), AZ::Vector3(-10.0f, -10.0f, 0.0f));
- transformIn.MultiplyByScale(AZ::Vector3(3.0f));
+ transformIn.MultiplyByUniformScale(3.0f);
CreateCapsule(transformIn, 2.0f, 5.0f, entity);
AZ::Transform transformOut;
@@ -291,7 +291,7 @@ namespace UnitTest
AZ::Entity entity;
CreateCapsule(
AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f, 1.0f, 1.0f)), // test max scale
+ AZ::Transform::CreateUniformScale(2.5f),
0.5f, 2.0f, entity);
bool inside;
@@ -309,7 +309,7 @@ namespace UnitTest
AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(0.5f)),
+ AZ::Transform::CreateUniformScale(0.5f),
0.5f, 2.0f, entity);
bool inside;
@@ -327,7 +327,7 @@ namespace UnitTest
AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
0.5f, 4.0f, entity);
float distance;
@@ -345,7 +345,7 @@ namespace UnitTest
AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
0.5f, 4.0f, entity);
float distance;
diff --git a/Gems/LmbrCentral/Code/Tests/CylinderShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/CylinderShapeTest.cpp
index 893ed3fcac..115abcf5ff 100644
--- a/Gems/LmbrCentral/Code/Tests/CylinderShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/CylinderShapeTest.cpp
@@ -138,7 +138,7 @@ namespace UnitTest
{ AZ::Transform::CreateTranslation(AZ::Vector3(-14.0f, -14.0f, -1.0f)) *
AZ::Transform::CreateRotationY(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationZ(AZ::Constants::HalfPi) *
- AZ::Transform::CreateScale(AZ::Vector3(4.0f)),
+ AZ::Transform::CreateUniformScale(4.0f),
1.0f, 1.25f },
// Result: hit, distance, epsilon
{ true, 2.5f, 1e-2f }
@@ -203,7 +203,7 @@ namespace UnitTest
// Test case 2
{ // Cylinder: transform, radius, height
{ AZ::Transform::CreateTranslation(AZ::Vector3(-10.0f, -10.0f, 10.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(3.5f)),
+ AZ::Transform::CreateUniformScale(3.5f),
1.0f, 5.0f },
// AABB: min, max
{ AZ::Vector3(-13.5f, -13.5f, 1.25f), AZ::Vector3(-6.5f, -6.5f, 18.75f) } },
@@ -236,7 +236,7 @@ namespace UnitTest
{ AZ::Vector3(-5.0f, -5.0f, -0.5f), AZ::Vector3(5.0f, 5.0f, 0.5f) } },
// Test case 1
{ // Cylinder: transform, radius, height
- { AZ::Transform::CreateTranslation(AZ::Vector3(-10.0f, -10.0f, 10.0f)) * AZ::Transform::CreateScale(AZ::Vector3(3.5f)),
+ { AZ::Transform::CreateTranslation(AZ::Vector3(-10.0f, -10.0f, 10.0f)) * AZ::Transform::CreateUniformScale(3.5f),
5.0f, 5.0f },
// Local bounds: min, max
{ AZ::Vector3(-5.0f, -5.0f, -2.5f), AZ::Vector3(5.0f, 5.0f, 2.5f) } },
@@ -264,7 +264,7 @@ namespace UnitTest
// Test case 0
{ // Cylinder: transform, radius, height
{AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f, 1.0f, 1.0f)), // test max scale
+ AZ::Transform::CreateUniformScale(2.5f),
0.5f, 2.0f},
// Point
AZ::Vector3(27.0f, 28.5f, 40.0f),
@@ -275,7 +275,7 @@ namespace UnitTest
{AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(0.5f)),
+ AZ::Transform::CreateUniformScale(0.5f),
0.5f, 2.0f},
// Point
AZ::Vector3(27.0f, 28.155f, 37.82f),
@@ -316,7 +316,7 @@ namespace UnitTest
{ AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
0.5f, 4.0f },
// Point
AZ::Vector3(27.0f, 28.0f, 41.0f),
@@ -327,7 +327,7 @@ namespace UnitTest
{ AZ::Transform::CreateTranslation(AZ::Vector3(27.0f, 28.0f, 38.0f)) *
AZ::Transform::CreateRotationX(AZ::Constants::HalfPi) *
AZ::Transform::CreateRotationY(AZ::Constants::QuarterPi) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
0.5f, 4.0f },
// Point
AZ::Vector3(22.757f, 32.243f, 38.0f),
diff --git a/Gems/LmbrCentral/Code/Tests/DiskShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/DiskShapeTest.cpp
index 4a39cd966e..c3683cc33b 100644
--- a/Gems/LmbrCentral/Code/Tests/DiskShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/DiskShapeTest.cpp
@@ -307,7 +307,7 @@ namespace UnitTest
AZ::Entity entity;
CreateDisk(
AZ::Transform::CreateTranslation(AZ::Vector3(100.0f, 200.0f, 300.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f)),
+ AZ::Transform::CreateUniformScale(2.5f),
0.5f, entity);
AZ::Aabb aabb;
diff --git a/Gems/LmbrCentral/Code/Tests/PolygonPrismShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/PolygonPrismShapeTest.cpp
index 46c3da90ab..f12ca69425 100644
--- a/Gems/LmbrCentral/Code/Tests/PolygonPrismShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/PolygonPrismShapeTest.cpp
@@ -329,7 +329,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateRotationY(AZ::DegToRad(45.0f)), AZ::Vector3(3.0f, 4.0f, 5.0f));
- transform.MultiplyByScale(AZ::Vector3(1.5f, 1.5f, 1.5f));
+ transform.MultiplyByUniformScale(1.5f);
const float height = 1.2f;
const AZ::Vector3 nonUniformScale(2.0f, 1.2f, 0.5f);
const AZStd::vector vertices =
@@ -447,7 +447,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateRotationY(AZ::DegToRad(45.0f)), AZ::Vector3(3.0f, 4.0f, 5.0f));
- transform.MultiplyByScale(AZ::Vector3(1.5f, 1.5f, 1.5f));
+ transform.MultiplyByUniformScale(1.5f);
const float height = 1.2f;
const AZ::Vector3 nonUniformScale(2.0f, 1.2f, 0.5f);
const AZStd::vector vertices =
@@ -608,7 +608,7 @@ namespace UnitTest
AZ::Entity entity;
CreatePolygonPrism(
AZ::Transform::CreateTranslation(AZ::Vector3(5.0f, 15.0f, 40.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f)), 2.0f,
+ AZ::Transform::CreateUniformScale(3.0f), 2.0f,
AZStd::vector(
{
AZ::Vector2(-2.0f, -2.0f),
@@ -669,7 +669,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateRotationY(AZ::DegToRad(60.0f)), AZ::Vector3(1.0f, 2.5f, -1.0f));
- transform.MultiplyByScale(AZ::Vector3(2.0f, 2.0f, 2.0f));
+ transform.MultiplyByUniformScale(2.0f);
const float height = 1.5f;
const AZ::Vector3 nonUniformScale(0.5f, 1.5f, 2.0f);
@@ -772,7 +772,7 @@ namespace UnitTest
AZ::Entity entity;
CreatePolygonPrism(
AZ::Transform::CreateTranslation(AZ::Vector3(5.0f, 15.0f, 40.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(3.0f)), 1.5f,
+ AZ::Transform::CreateUniformScale(3.0f), 1.5f,
AZStd::vector(
{
AZ::Vector2(-2.0f, -2.0f),
@@ -795,7 +795,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion::CreateRotationX(AZ::DegToRad(30.0f)), AZ::Vector3(2.0f, -5.0f, 3.0f));
- transform.MultiplyByScale(AZ::Vector3(2.0f, 2.0f, 2.0f));
+ transform.MultiplyByUniformScale(2.0f);
const float height = 1.2f;
const AZ::Vector3 nonUniformScale(1.5f, 0.8f, 2.0f);
const AZStd::vector vertices =
diff --git a/Gems/LmbrCentral/Code/Tests/QuadShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/QuadShapeTest.cpp
index d70a9344a4..4b6eae4bb8 100644
--- a/Gems/LmbrCentral/Code/Tests/QuadShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/QuadShapeTest.cpp
@@ -188,7 +188,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transformIn = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.46f, 0.34f, 0.02f, 0.82f), AZ::Vector3(1.7f, -0.4f, 2.3f));
- transformIn.MultiplyByScale(AZ::Vector3(2.2f));
+ transformIn.MultiplyByUniformScale(2.2f);
const AZ::Vector3 nonUniformScale(0.8f, 0.6f, 1.3f);
const float width = 0.7f;
const float height = 1.3f;
@@ -327,7 +327,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.64f, 0.16f, 0.68f, 0.32f), AZ::Vector3(0.4f, -2.3f, -0.9f));
- transform.MultiplyByScale(AZ::Vector3(1.3f));
+ transform.MultiplyByUniformScale(1.3f);
const AZ::Vector3 nonUniformScale(0.7f, 0.5f, 1.3f);
const float width = 0.9f;
const float height = 1.3f;
@@ -384,7 +384,7 @@ namespace UnitTest
AZ::Entity entity;
CreateQuad(
AZ::Transform::CreateTranslation(AZ::Vector3(100.0f, 200.0f, 300.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f)),
+ AZ::Transform::CreateUniformScale(2.5f),
1.0f, 2.0f, entity);
AZ::Aabb aabb;
@@ -425,7 +425,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.44f, 0.24f, 0.48f, 0.72f), AZ::Vector3(3.4f, 1.2f, -2.8f));
- transform.MultiplyByScale(AZ::Vector3(1.5f));
+ transform.MultiplyByUniformScale(1.5f);
const AZ::Vector3 nonUniformScale(1.2f, 1.1f, 0.8f);
const float width = 1.2f;
const float height = 1.7f;
@@ -518,7 +518,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.24f, 0.72f, 0.44f, 0.48f), AZ::Vector3(2.7f, 2.3f, -1.8f));
- transform.MultiplyByScale(AZ::Vector3(1.2f));
+ transform.MultiplyByUniformScale(1.2f);
const AZ::Vector3 nonUniformScale(0.4f, 2.2f, 1.3f);
const float width = 1.6f;
const float height = 0.7f;
@@ -546,7 +546,7 @@ namespace UnitTest
AZ::Entity entity;
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(
AZ::Quaternion(0.70f, 0.10f, 0.34f, 0.62f), AZ::Vector3(3.0f, -1.0f, 2.0f));
- transform.MultiplyByScale(AZ::Vector3(2.0f));
+ transform.MultiplyByUniformScale(2.0f);
const AZ::Vector3 nonUniformScale(2.4f, 1.3f, 1.8f);
const float width = 0.8f;
const float height = 1.4f;
diff --git a/Gems/LmbrCentral/Code/Tests/SphereShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/SphereShapeTest.cpp
index 563bb16caa..b5e45f2cda 100644
--- a/Gems/LmbrCentral/Code/Tests/SphereShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/SphereShapeTest.cpp
@@ -179,7 +179,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(-8.0f, -15.0f, 5.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(5.0f)),
+ AZ::Transform::CreateUniformScale(5.0f),
0.25f, entity);
bool rayHit = false;
@@ -240,7 +240,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(100.0f, 200.0f, 300.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f)),
+ AZ::Transform::CreateUniformScale(2.5f),
0.5f, entity);
AZ::Aabb aabb;
@@ -269,7 +269,7 @@ namespace UnitTest
TEST_F(SphereShapeTest, GetTransformAndLocalBounds2)
{
AZ::Entity entity;
- AZ::Transform transformIn = AZ::Transform::CreateTranslation(AZ::Vector3(100.0f, 200.0f, 300.0f)) * AZ::Transform::CreateScale(AZ::Vector3(2.5f));
+ AZ::Transform transformIn = AZ::Transform::CreateTranslation(AZ::Vector3(100.0f, 200.0f, 300.0f)) * AZ::Transform::CreateUniformScale(2.5f);
CreateSphere(transformIn, 2.0f, entity);
AZ::Transform transformOut;
@@ -287,7 +287,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(-30.0f, -30.0f, 22.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
1.2f, entity);
bool inside;
@@ -303,7 +303,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(-30.0f, -30.0f, 22.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(1.5f)),
+ AZ::Transform::CreateUniformScale(1.5f),
1.6f, entity);
bool inside;
@@ -319,7 +319,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(19.0f, 34.0f, 37.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.0f)),
+ AZ::Transform::CreateUniformScale(2.0f),
1.0f, entity);
float distance;
@@ -335,7 +335,7 @@ namespace UnitTest
AZ::Entity entity;
CreateSphere(
AZ::Transform::CreateTranslation(AZ::Vector3(19.0f, 34.0f, 37.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(0.5f)),
+ AZ::Transform::CreateUniformScale(0.5f),
1.0f, entity);
float distance;
diff --git a/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp b/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp
index 65388d1fe5..b8f58d5d20 100644
--- a/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp
+++ b/Gems/LmbrCentral/Code/Tests/TubeShapeTest.cpp
@@ -139,7 +139,7 @@ namespace UnitTest
AZ::Entity entity;
CreateTube(
AZ::Transform::CreateTranslation(AZ::Vector3(-40.0f, 6.0f, 1.0f)) *
- AZ::Transform::CreateScale(AZ::Vector3(2.5f, 1.0f, 1.0f)), // test max scale
+ AZ::Transform::CreateUniformScale(2.5f),
1.0f,
entity);
diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.cpp
index b0ebb10b0e..54eeb1fcc9 100644
--- a/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.cpp
+++ b/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.cpp
@@ -189,7 +189,7 @@ Quat CAnimAzEntityNode::GetRotate(float time)
}
//////////////////////////////////////////////////////////////////////////
-void CAnimAzEntityNode::SetScale(float time, const Vec3& scale)
+void CAnimAzEntityNode::SetScale(float time, float scale)
{
CAnimComponentNode* transformComponent = GetTransformComponentNode();
if (transformComponent)
@@ -198,7 +198,7 @@ void CAnimAzEntityNode::SetScale(float time, const Vec3& scale)
}
}
-Vec3 CAnimAzEntityNode::GetScale()
+float CAnimAzEntityNode::GetScale()
{
CAnimComponentNode* transformComponent = GetTransformComponentNode();
if (transformComponent)
@@ -206,7 +206,7 @@ Vec3 CAnimAzEntityNode::GetScale()
return transformComponent->GetScale();
}
- return Vec3(.0f, .0f, .0f);
+ return 0.0f;
}
Vec3 CAnimAzEntityNode::GetOffsetPosition(const Vec3& position)
diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.h
index 863d0e927f..d5af311b70 100644
--- a/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.h
+++ b/Gems/Maestro/Code/Source/Cinematics/AnimAZEntityNode.h
@@ -57,14 +57,14 @@ public:
void SetPos(float time, const Vec3& pos) override;
void SetRotate(float time, const Quat& quat) override;
- void SetScale(float time, const Vec3& scale) override;
+ void SetScale(float time, float scale) override;
Vec3 GetOffsetPosition(const Vec3& position) override;
Vec3 GetPos() override;
Quat GetRotate() override;
Quat GetRotate(float time) override;
- Vec3 GetScale() override;
+ float GetScale() override;
//////////////////////////////////////////////////////////////////////////
void Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks);
diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.cpp
index ea7322014c..13a5d4ed63 100644
--- a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.cpp
+++ b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.cpp
@@ -341,10 +341,10 @@ void CAnimComponentNode::ConvertBetweenWorldAndLocalRotation(Quat& rotation, ETr
}
//////////////////////////////////////////////////////////////////////////
-void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(Vec3& scale, ETransformSpaceConversionDirection conversionDirection) const
+void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(float& scale, ETransformSpaceConversionDirection conversionDirection) const
{
AZ::Transform parentTransform = AZ::Transform::Identity();
- AZ::Transform scaleTransform = AZ::Transform::CreateScale(AZ::Vector3(scale.x, scale.y, scale.z));
+ AZ::Transform scaleTransform = AZ::Transform::CreateUniformScale(scale);
GetParentWorldTransform(parentTransform);
if (conversionDirection == eTransformConverstionDirection_toLocalSpace)
@@ -353,8 +353,7 @@ void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(Vec3& scale, ETransfor
}
scaleTransform = parentTransform * scaleTransform;
- AZ::Vector3 vScale = scaleTransform.GetScale();
- scale.Set(vScale.GetX(), vScale.GetY(), vScale.GetZ());
+ scale = scaleTransform.GetUniformScale();
}
//////////////////////////////////////////////////////////////////////////
@@ -457,7 +456,7 @@ Quat CAnimComponentNode::GetRotate()
}
//////////////////////////////////////////////////////////////////////////
-void CAnimComponentNode::SetScale(float time, const Vec3& scale)
+void CAnimComponentNode::SetScale(float time, float scale)
{
if (m_componentTypeId == AZ::Uuid(AZ::EditorTransformComponentTypeId) || m_componentTypeId == AzFramework::TransformComponent::TYPEINFO_Uuid())
{
@@ -468,7 +467,7 @@ void CAnimComponentNode::SetScale(float time, const Vec3& scale)
{
// Scale is in World space, even if the entity is parented - because Component Entity AZ::Transforms do not correctly set
// CBaseObject parenting, so we convert it to Local space here. This should probably be fixed, but for now, we explicitly change from World to Local space here.
- Vec3 localScale(scale);
+ float localScale = scale;
ConvertBetweenWorldAndLocalScale(localScale, eTransformConverstionDirection_toLocalSpace);
scaleTrack->SetValue(time, localScale, bDefault);
}
@@ -480,15 +479,15 @@ void CAnimComponentNode::SetScale(float time, const Vec3& scale)
}
}
-Vec3 CAnimComponentNode::GetScale()
+float CAnimComponentNode::GetScale()
{
Maestro::SequenceComponentRequests::AnimatablePropertyAddress animatableAddress(m_componentId, "Scale");
- Maestro::SequenceComponentRequests::AnimatedVector3Value scaleValue(AZ::Vector3::CreateZero());
+ Maestro::SequenceComponentRequests::AnimatedFloatValue scaleValue(0.0f);
Maestro::SequenceComponentRequestBus::Event(m_pSequence->GetSequenceEntityId(), &Maestro::SequenceComponentRequestBus::Events::GetAnimatedPropertyValue, scaleValue, GetParentAzEntityId(), animatableAddress);
// Always return World scale because Component Entity AZ::Transforms do not correctly set
// CBaseObject parenting. This should probably be fixed, but for now, we explicitly change from Local to World space here.
- Vec3 worldScale(scaleValue.GetVector3Value());
+ float worldScale = scaleValue.GetFloatValue();
ConvertBetweenWorldAndLocalScale(worldScale, eTransformConverstionDirection_toWorldSpace);
return worldScale;
diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h
index 5d83f7ba0d..48913e5b85 100644
--- a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h
+++ b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h
@@ -71,12 +71,12 @@ public:
void SetPos(float time, const Vec3& pos) override;
void SetRotate(float time, const Quat& quat) override;
- void SetScale(float time, const Vec3& scale) override;
+ void SetScale(float time, float scale) override;
Vec3 GetPos() override;
Quat GetRotate() override;
Quat GetRotate(float time) override;
- Vec3 GetScale() override;
+ float GetScale() override;
void Activate(bool bActivate) override;
//////////////////////////////////////////////////////////////////////////
@@ -128,7 +128,7 @@ private:
void GetParentWorldTransform(AZ::Transform& retTransform) const;
void ConvertBetweenWorldAndLocalPosition(Vec3& position, ETransformSpaceConversionDirection conversionDirection) const;
void ConvertBetweenWorldAndLocalRotation(Quat& rotation, ETransformSpaceConversionDirection conversionDirection) const;
- void ConvertBetweenWorldAndLocalScale(Vec3& scale, ETransformSpaceConversionDirection conversionDirection) const;
+ void ConvertBetweenWorldAndLocalScale(float& scale, ETransformSpaceConversionDirection conversionDirection) const;
// Utility function to query the units for a track and set the track multiplier if needed. Returns true if track multiplier was set.
bool SetTrackMultiplier(IAnimTrack* track) const;
diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h
index 0c52ac5a48..f29ba2eab0 100644
--- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h
+++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h
@@ -79,12 +79,12 @@ public:
//////////////////////////////////////////////////////////////////////////
void SetPos([[maybe_unused]] float time, [[maybe_unused]] const Vec3& pos) override {};
void SetRotate([[maybe_unused]] float time, [[maybe_unused]] const Quat& quat) override {};
- void SetScale([[maybe_unused]] float time, [[maybe_unused]] const Vec3& scale) override {};
+ void SetScale([[maybe_unused]] float time, [[maybe_unused]] const float scale) override {};
Vec3 GetPos() override { return Vec3(0, 0, 0); };
Quat GetRotate() override { return Quat(0, 0, 0, 0); };
Quat GetRotate(float /*time*/) override { return Quat(0, 0, 0, 0); };
- Vec3 GetScale() override { return Vec3(0, 0, 0); };
+ float GetScale() override { return 0.0f; };
virtual Matrix34 GetReferenceMatrix() const;
diff --git a/Gems/PhysX/Code/Source/RigidBodyComponent.cpp b/Gems/PhysX/Code/Source/RigidBodyComponent.cpp
index 8984343fe5..6709412ffe 100644
--- a/Gems/PhysX/Code/Source/RigidBodyComponent.cpp
+++ b/Gems/PhysX/Code/Source/RigidBodyComponent.cpp
@@ -203,9 +203,8 @@ namespace PhysX
AZ::Quaternion newRotation = AZ::Quaternion::CreateIdentity();
m_interpolator->GetInterpolated(newPosition, newRotation, deltaTime);
- AZ::Transform interpolatedTransform = AZ::Transform::CreateFromQuaternionAndTranslation(newRotation, newPosition);
- interpolatedTransform.MultiplyByScale(m_initialScale);
- AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetWorldTM, interpolatedTransform);
+ AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetRotationQuaternion, newRotation);
+ AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetWorldTranslation, newPosition);
}
}
@@ -244,14 +243,8 @@ namespace PhysX
}
else
{
- AZ::Transform transform = m_rigidBody->GetTransform();
-
- // Maintain scale (this must be precise).
- AZ::Transform entityTransform = AZ::Transform::Identity();
- AZ::TransformBus::EventResult(entityTransform, GetEntityId(), &AZ::TransformInterface::GetWorldTM);
- transform.MultiplyByScale(m_initialScale);
-
- AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetWorldTM, transform);
+ AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetRotationQuaternion, m_rigidBody->GetOrientation());
+ AZ::TransformBus::Event(GetEntityId(), &AZ::TransformInterface::SetWorldTranslation, m_rigidBody->GetPosition());
}
m_isLastMovementFromKinematicSource = false;
}
@@ -338,8 +331,6 @@ namespace PhysX
m_interpolator = std::make_unique();
m_interpolator->Reset(transform.GetTranslation(), rotation);
- m_initialScale = transform.ExtractScale();
-
Physics::RigidBodyNotificationBus::Event(GetEntityId(), &Physics::RigidBodyNotificationBus::Events::OnPhysicsEnabled);
Physics::WorldBodyNotificationBus::Event(GetEntityId(), &Physics::WorldBodyNotifications::OnPhysicsEnabled);
}
diff --git a/Gems/PhysX/Code/Source/RigidBodyComponent.h b/Gems/PhysX/Code/Source/RigidBodyComponent.h
index c46e136669..6e5a45ea36 100644
--- a/Gems/PhysX/Code/Source/RigidBodyComponent.h
+++ b/Gems/PhysX/Code/Source/RigidBodyComponent.h
@@ -159,7 +159,6 @@ namespace PhysX
AzPhysics::RigidBody* m_rigidBody = nullptr;
AzPhysics::SceneHandle m_attachedSceneHandle = AzPhysics::InvalidSceneHandle;
- AZ::Vector3 m_initialScale = AZ::Vector3::CreateOne();
bool m_staticTransformAtActivation = false; ///< Whether the transform was static when the component last activated.
bool m_isLastMovementFromKinematicSource = false; ///< True when the source of the movement comes from SetKinematicTarget as opposed to coming from a Transform change
bool m_rigidBodyTransformNeedsUpdateOnPhysReEnable = false; ///< True if rigid body transform needs to be synced to the entity's when physics is re-enabled
diff --git a/Gems/PhysX/Code/Source/Utils.cpp b/Gems/PhysX/Code/Source/Utils.cpp
index 767f386b6f..d04db0d37c 100644
--- a/Gems/PhysX/Code/Source/Utils.cpp
+++ b/Gems/PhysX/Code/Source/Utils.cpp
@@ -920,9 +920,9 @@ namespace PhysX
AZ::Vector3 GetTransformScale(AZ::EntityId entityId)
{
- AZ::Vector3 worldScale = AZ::Vector3::CreateOne();
- AZ::TransformBus::EventResult(worldScale, entityId, &AZ::TransformBus::Events::GetWorldScale);
- return worldScale;
+ float worldScale = 1.0f;
+ AZ::TransformBus::EventResult(worldScale, entityId, &AZ::TransformBus::Events::GetWorldUniformScale);
+ return AZ::Vector3(worldScale);
}
AZ::Vector3 GetUniformScale(AZ::EntityId entityId)
diff --git a/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp b/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp
index 51a11c7605..5c8fcb70d5 100644
--- a/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp
+++ b/Gems/PhysX/Code/Tests/ColliderScalingTests.cpp
@@ -68,7 +68,7 @@ namespace PhysXEditorTests
AZ::EntityId editorId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.5f));
+ worldTM.SetUniformScale(1.5f);
worldTM.SetTranslation(AZ::Vector3(5.0f, 6.0f, 7.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(30.0f)));
AZ::TransformBus::Event(editorId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -99,7 +99,7 @@ namespace PhysXEditorTests
AZ::EntityId editorId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.5f));
+ worldTM.SetUniformScale(1.5f);
worldTM.SetTranslation(AZ::Vector3(5.0f, 6.0f, 7.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(30.0f)));
AZ::TransformBus::Event(editorId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -144,7 +144,7 @@ namespace PhysXEditorTests
AZ::EntityId capsuleId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(0.5f));
+ worldTM.SetUniformScale(0.5f);
worldTM.SetTranslation(AZ::Vector3(3.0f, 1.0f, -4.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationY(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(capsuleId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -176,7 +176,7 @@ namespace PhysXEditorTests
AZ::EntityId capsuleId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(0.5f));
+ worldTM.SetUniformScale(0.5f);
worldTM.SetTranslation(AZ::Vector3(3.0f, 1.0f, -4.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationY(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(capsuleId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -222,7 +222,7 @@ namespace PhysXEditorTests
AZ::EntityId sphereId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.2f));
+ worldTM.SetUniformScale(1.2f);
worldTM.SetTranslation(AZ::Vector3(-2.0f, -1.0f, 3.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(sphereId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -254,7 +254,7 @@ namespace PhysXEditorTests
AZ::EntityId sphereId = editorEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.2f));
+ worldTM.SetUniformScale(1.2f);
worldTM.SetTranslation(AZ::Vector3(-2.0f, -1.0f, 3.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(sphereId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
diff --git a/Gems/PhysX/Code/Tests/DebugDrawTests.cpp b/Gems/PhysX/Code/Tests/DebugDrawTests.cpp
index 5b41c37f34..610ba8d6f6 100644
--- a/Gems/PhysX/Code/Tests/DebugDrawTests.cpp
+++ b/Gems/PhysX/Code/Tests/DebugDrawTests.cpp
@@ -32,7 +32,7 @@ namespace PhysXEditorTests
AZ::EntityId boxId = boxEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.5f));
+ worldTM.SetUniformScale(1.5f);
worldTM.SetTranslation(AZ::Vector3(5.0f, 6.0f, 7.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(30.0f)));
AZ::TransformBus::Event(boxId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -61,7 +61,7 @@ namespace PhysXEditorTests
AZ::EntityId boxId = boxEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.2f));
+ worldTM.SetUniformScale(1.2f);
worldTM.SetTranslation(AZ::Vector3(4.0f, -3.0f, 1.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationZ(AZ::DegToRad(45.0f)));
AZ::TransformBus::Event(boxId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -91,7 +91,7 @@ namespace PhysXEditorTests
AZ::EntityId boxId = boxEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.2f));
+ worldTM.SetUniformScale(1.2f);
worldTM.SetTranslation(AZ::Vector3(4.0f, -3.0f, 1.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationZ(AZ::DegToRad(45.0f)));
AZ::TransformBus::Event(boxId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -129,7 +129,7 @@ namespace PhysXEditorTests
AZ::EntityId capsuleId = capsuleEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(0.5f));
+ worldTM.SetUniformScale(0.5f);
worldTM.SetTranslation(AZ::Vector3(3.0f, 1.0f, -4.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationY(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(capsuleId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -158,7 +158,7 @@ namespace PhysXEditorTests
AZ::EntityId capsuleId = capsuleEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.4f));
+ worldTM.SetUniformScale(1.4f);
worldTM.SetTranslation(AZ::Vector3(1.0f, -4.0f, 4.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(45.0f)));
AZ::TransformBus::Event(capsuleId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -189,7 +189,7 @@ namespace PhysXEditorTests
AZ::EntityId sphereId = sphereEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(1.2f));
+ worldTM.SetUniformScale(1.2f);
worldTM.SetTranslation(AZ::Vector3(-2.0f, -1.0f, 3.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)));
AZ::TransformBus::Event(sphereId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
@@ -218,7 +218,7 @@ namespace PhysXEditorTests
AZ::EntityId sphereId = sphereEntity->GetId();
AZ::Transform worldTM;
- worldTM.SetScale(AZ::Vector3(0.8f));
+ worldTM.SetUniformScale(0.8f);
worldTM.SetTranslation(AZ::Vector3(2.0f, -1.0f, 3.0f));
worldTM.SetRotation(AZ::Quaternion::CreateRotationY(AZ::DegToRad(45.0f)));
AZ::TransformBus::Event(sphereId, &AZ::TransformBus::Events::SetWorldTM, worldTM);
diff --git a/Gems/PhysX/Code/Tests/RigidBodyComponentTests.cpp b/Gems/PhysX/Code/Tests/RigidBodyComponentTests.cpp
index eee747d390..4ff88c0b3b 100644
--- a/Gems/PhysX/Code/Tests/RigidBodyComponentTests.cpp
+++ b/Gems/PhysX/Code/Tests/RigidBodyComponentTests.cpp
@@ -38,8 +38,8 @@ namespace PhysXEditorTests
const AZ::Aabb originalAabb = rigidBodyComponent->GetRigidBody()->GetAabb();
// Update the scale
- const AZ::Vector3 scale(2.0f);
- AZ::TransformBus::Event(editorEntity->GetId(), &AZ::TransformInterface::SetLocalScale, scale);
+ float scale = 2.0f;
+ AZ::TransformBus::Event(editorEntity->GetId(), &AZ::TransformInterface::SetLocalUniformScale, scale);
// Trigger editor physics world update so EditorRigidBodyComponent can process scale change
auto* physicsSystem = AZ::Interface::Get();
@@ -89,8 +89,8 @@ namespace PhysXEditorTests
idPair, &PhysX::EditorColliderComponentRequests::SetColliderOffset, offset);
// Update the scale
- const AZ::Vector3 scale(2.0f);
- AZ::TransformBus::Event(editorEntity->GetId(), &AZ::TransformInterface::SetLocalScale, scale);
+ float scale = 2.0f;
+ AZ::TransformBus::Event(editorEntity->GetId(), &AZ::TransformInterface::SetLocalUniformScale, scale);
// Update editor world to let updates to be applied
physicsSystem->Simulate(0.1f);
diff --git a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
index 8af9defff8..ad632b579d 100644
--- a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
+++ b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp
@@ -241,7 +241,7 @@ namespace PhysXEditorTests
SetPolygonPrismHeight(entityId, 2.0f);
// update the transform scale and non-uniform scale
- AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetLocalScale, AZ::Vector3(2.0f));
+ AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetLocalUniformScale, 2.0f);
AZ::NonUniformScaleRequestBus::Event(entityId, &AZ::NonUniformScaleRequests::SetScale, AZ::Vector3(0.5f, 1.5f, 2.0f));
EntityPtr gameEntity = CreateActiveGameEntityFromEditorEntity(editorEntity.get());
@@ -435,8 +435,8 @@ namespace PhysXEditorTests
&LmbrCentral::BoxShapeComponentRequests::GetBoxDimensions);
// update the transform
- const AZ::Vector3 scale(2.0f);
- AZ::TransformBus::Event(editorEntityId, &AZ::TransformInterface::SetLocalScale, scale);
+ const float scale = 2.0f;
+ AZ::TransformBus::Event(editorEntityId, &AZ::TransformInterface::SetLocalUniformScale, scale);
const AZ::Vector3 translation(10.0f, 20.0f, 30.0f);
AZ::TransformBus::Event(editorEntityId, &AZ::TransformInterface::SetWorldTranslation, translation);
@@ -527,10 +527,8 @@ namespace PhysXEditorTests
editorParentEntity->Activate();
// set some scale to parent entity
- const AZ::Vector3 parentScale(2.0f);
- AZ::TransformBus::Event(editorParentEntity->GetId(),
- &AZ::TransformInterface::SetLocalScale,
- parentScale);
+ const float parentScale = 2.0f;
+ AZ::TransformBus::Event(editorParentEntity->GetId(), &AZ::TransformInterface::SetLocalUniformScale, parentScale);
// create an editor child entity with a shape collider component and a box shape component
EntityPtr editorChildEntity = CreateInactiveEditorEntity("ChildEntity");
diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp
index a0db02c3a8..30e55cee49 100644
--- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp
+++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp
@@ -2527,15 +2527,15 @@ namespace ScriptCanvas
{
Data::TransformType copy(source);
AZ::Vector3 pos = copy.GetTranslation();
- AZ::Vector3 scale = copy.ExtractScale();
+ float scale = copy.ExtractUniformScale();
AZ::Vector3 rotation = AZ::ConvertTransformToEulerDegrees(copy);
return AZStd::string::format
( "(Position: X: %f, Y: %f, Z: %f,"
" Rotation: X: %f, Y: %f, Z: %f,"
- " Scale: X: %f, Y: %f, Z: %f)"
+ " Scale: %f)"
, static_cast(pos.GetX()), static_cast(pos.GetY()), static_cast(pos.GetZ())
, static_cast(rotation.GetX()), static_cast(rotation.GetY()), static_cast(rotation.GetZ())
- , static_cast(scale.GetX()), static_cast(scale.GetY()), static_cast(scale.GetZ()));
+ , scale);
}
AZStd::string Datum::ToStringVector2(const AZ::Vector2& source) const
diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/Rotate.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/Rotate.cpp
index c510b55314..2f79d4218a 100644
--- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/Rotate.cpp
+++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/Rotate.cpp
@@ -47,21 +47,10 @@ namespace ScriptCanvas
AZ::Transform currentTransform = AZ::Transform::CreateIdentity();
AZ::TransformBus::EventResult(currentTransform, targetEntity, &AZ::TransformInterface::GetWorldTM);
-
- AZ::Vector3 position = currentTransform.GetTranslation();
- AZ::Quaternion currentRotation = currentTransform.GetRotation();
+ currentTransform.SetRotation((rotation * currentTransform.GetRotation().GetNormalized()));
- AZ::Quaternion newRotation = (rotation * currentRotation);
- newRotation.Normalize();
-
- AZ::Transform newTransform = AZ::Transform::CreateIdentity();
-
- newTransform.SetScale(currentTransform.GetScale());
- newTransform.SetRotation(newRotation);
- newTransform.SetTranslation(position);
-
- AZ::TransformBus::Event(targetEntity, &AZ::TransformInterface::SetWorldTM, newTransform);
+ AZ::TransformBus::Event(targetEntity, &AZ::TransformInterface::SetWorldTM, currentTransform);
}
}
diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp
index 20ea4e1b33..53884f4dd8 100644
--- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp
+++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp
@@ -44,22 +44,12 @@ namespace ScriptCanvas
{
AZ::Quaternion rotation = AZ::ConvertEulerDegreesToQuaternion(angles);
- AZ::Transform currentTransform = AZ::Transform::CreateIdentity();
- AZ::TransformBus::EventResult(currentTransform, targetEntity, &AZ::TransformInterface::GetWorldTM);
+ AZ::Transform transform = AZ::Transform::CreateIdentity();
+ AZ::TransformBus::EventResult(transform, targetEntity, &AZ::TransformInterface::GetWorldTM);
- AZ::Vector3 position = currentTransform.GetTranslation();
- AZ::Quaternion currentRotation = currentTransform.GetRotation();
+ transform.SetRotation((rotation * transform.GetRotation()).GetNormalized());
- AZ::Quaternion newRotation = (rotation * currentRotation);
- newRotation.Normalize();
-
- AZ::Transform newTransform = AZ::Transform::CreateIdentity();
-
- newTransform.CreateScale(currentTransform.ExtractScale());
- newTransform.SetRotation(newRotation);
- newTransform.SetTranslation(position);
-
- AZ::TransformBus::Event(targetEntity, &AZ::TransformInterface::SetWorldTM, newTransform);
+ AZ::TransformBus::Event(targetEntity, &AZ::TransformInterface::SetWorldTM, transform);
}
}
}
diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h
index 6a0f082272..7aafdf584e 100644
--- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h
+++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h
@@ -26,9 +26,9 @@ namespace ScriptCanvas
using namespace MathNodeUtilities;
static const char* k_categoryName = "Math/Transform";
- AZ_INLINE std::tuple ExtractScale(TransformType source)
+ AZ_INLINE std::tuple ExtractScale(TransformType source)
{
- auto scale(source.ExtractScale());
+ auto scale(source.ExtractUniformScale());
return std::make_tuple( scale, source );
}
SCRIPT_CANVAS_GENERIC_FUNCTION_MULTI_RESULTS_NODE(ExtractScale, k_categoryName, "{8DFE5247-0950-4CD1-87E6-0CAAD42F1637}", "returns a vector which is the length of the scale components, and a transform with the scale extracted ", "Source", "Scale", "Extracted");
diff --git a/Gems/StartingPointCamera/Code/Source/CameraLookAtBehaviors/RotateCameraLookAt.cpp b/Gems/StartingPointCamera/Code/Source/CameraLookAtBehaviors/RotateCameraLookAt.cpp
index 2ab7e0bd01..e2e818f3e7 100644
--- a/Gems/StartingPointCamera/Code/Source/CameraLookAtBehaviors/RotateCameraLookAt.cpp
+++ b/Gems/StartingPointCamera/Code/Source/CameraLookAtBehaviors/RotateCameraLookAt.cpp
@@ -58,19 +58,9 @@ namespace Camera
float axisPolarity = m_shouldInvertAxis ? -1.0f : 1.0f;
float rotationAmount = axisPolarity * m_rotationAmount;
- // remove translation and scale
- AZ::Vector3 translation = outLookAtTargetTransform.GetTranslation();
- outLookAtTargetTransform.SetTranslation(AZ::Vector3::CreateZero());
- AZ::Vector3 transformScale = outLookAtTargetTransform.ExtractScale();
-
- // perform our rotation
- AZ::Transform desiredRotationTransform = AZ::Transform::CreateFromQuaternion(AZ::Quaternion::CreateFromAxisAngle(outLookAtTargetTransform.GetBasis(m_axisOfRotation), rotationAmount));
-
- outLookAtTargetTransform = desiredRotationTransform * outLookAtTargetTransform;
-
- // return scale and translate
- outLookAtTargetTransform.SetScale(transformScale);
- outLookAtTargetTransform.SetTranslation(translation);
+ AZ::Quaternion desiredRotation = AZ::Quaternion::CreateFromAxisAngle(
+ outLookAtTargetTransform.GetBasis(m_axisOfRotation), rotationAmount);
+ outLookAtTargetTransform.SetRotation(desiredRotation * outLookAtTargetTransform.GetRotation());
}
void RotateCameraLookAt::Activate(AZ::EntityId entityId)
From 304696fa5cc59b3b517d5545844d2d25d35ee610 Mon Sep 17 00:00:00 2001
From: moudgils
Date: Tue, 27 Apr 2021 19:26:35 -0700
Subject: [PATCH 012/330] Shader compile fixes
---
.../DiffuseComposite_nomsaa.azsl | 8 ++++----
Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.azsl
index 74571b5c6a..c243af0855 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseComposite_nomsaa.azsl
@@ -91,7 +91,7 @@ float3 SampleProbeIrradiance(uint2 probeIrradianceCoords, float depth, float3 no
{
for (int x = -extent; x <= extent; ++x)
{
- float3 downsampledNormal = PassSrg::m_downsampledNormal.Load(int3(probeIrradianceCoords, 0), int2(x, y)).rgb;
+ float3 downsampledNormal = PassSrg::m_downsampledNormal.Load(int3(probeIrradianceCoords + int2(x, y), 0)).rgb;
downsampledNormal = downsampledNormal * 2.0f - 1.0f;
float normalDot = dot(downsampledNormal, normal);
@@ -100,10 +100,10 @@ float3 SampleProbeIrradiance(uint2 probeIrradianceCoords, float depth, float3 no
if (normalDot > NormalMatchTolerance)
{
// the normals are almost identical, if the depth is within the tolerance we can optimize by just taking this sample
- float downsampledDepth = PassSrg::m_downsampledDepth.Load(int3(probeIrradianceCoords, 0), int2(x, y)).r;
+ float downsampledDepth = PassSrg::m_downsampledDepth.Load(int3(probeIrradianceCoords + int2(x, y), 0)).r;
if (abs(depth - downsampledDepth) <= DepthTolerance)
{
- float3 probeIrradiance = PassSrg::m_downsampledProbeIrradiance.Load(int3(probeIrradianceCoords,0), int2(x, y)).rgb;
+ float3 probeIrradiance = PassSrg::m_downsampledProbeIrradiance.Load(int3(probeIrradianceCoords + int2(x, y),0)).rgb;
probeIrradiance = saturate(probeIrradiance);
return probeIrradiance;
}
@@ -115,7 +115,7 @@ float3 SampleProbeIrradiance(uint2 probeIrradianceCoords, float depth, float3 no
}
}
- float3 probeIrradiance = PassSrg::m_downsampledProbeIrradiance.Load(int3(probeIrradianceCoords, 0), closestOffset).rgb;
+ float3 probeIrradiance = PassSrg::m_downsampledProbeIrradiance.Load(int3(probeIrradianceCoords + closestOffset, 0)).rgb;
probeIrradiance = saturate(probeIrradiance);
return probeIrradiance;
}
diff --git a/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp b/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
index 00b5dada69..957c076592 100644
--- a/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
+++ b/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
@@ -308,7 +308,7 @@ namespace AZ
uint32_t exitCode = 0;
bool timedOut = false;
- const AZStd::sys_time_t maxWaitTimeSeconds = 120;
+ const AZStd::sys_time_t maxWaitTimeSeconds = 240;
const AZStd::sys_time_t startTimeSeconds = AZStd::GetTimeNowSecond();
const AZStd::sys_time_t startTime = AZStd::GetTimeNowTicks();
From 12d5288e32ea98420d2585498e2d5fb02c731963 Mon Sep 17 00:00:00 2001
From: puvvadar
Date: Wed, 28 Apr 2021 15:15:14 -0700
Subject: [PATCH 013/330] Add codegen for BehaviorContext binding of RPC Send
functions
---
.../Source/AutoGen/AutoComponent_Header.jinja | 1 +
.../Source/AutoGen/AutoComponent_Source.jinja | 34 +++++++++++++++++++
...tionPlayerInputComponent.AutoComponent.xml | 6 ++--
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja
index f5774b07c0..b2d2792e9b 100644
--- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja
+++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja
@@ -416,6 +416,7 @@ namespace {{ Component.attrib['Namespace'] }}
static void Reflect(AZ::ReflectContext* context);
static void ReflectToEditContext(AZ::ReflectContext* context);
+ static void ReflectToBehaviorContext(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja
index d6907876e1..f2d6ca71c6 100644
--- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja
+++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja
@@ -315,6 +315,22 @@ void {{ ClassName }}::{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(par
{% endmacro %}
{#
+#}
+{% macro ReflectRpcInvocations(Component, ClassName, InvokeFrom, HandleOn) %}
+{% call(Property) AutoComponentMacros.ParseRemoteProcedures(Component, InvokeFrom, HandleOn) %}
+{% if Property.attrib['CanScript']|booleanTrue == true %}
+{% set paramNames = [] %}
+{% set paramTypes = [] %}
+{% set paramDefines = [] %}
+{{ AutoComponentMacros.ParseRpcParams(Property, paramNames, paramTypes, paramDefines) }}
+ ->Method("{{ UpperFirst(Property.attrib['Name']) }}", [](const {{ ClassName }}* self, {{ ', '.join(paramDefines) }}) {
+ self->m_controller->{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(paramNames) }});
+ })
+{% endif %}
+{% endcall %}
+{% endmacro %}
+{#
+
#}
{% macro DeclareRpcHandleCases(Component, ComponentDerived, InvokeFrom, HandleOn, ValidationFunction) %}
{% call(Property) AutoComponentMacros.ParseRemoteProcedures(Component, InvokeFrom, HandleOn) %}
@@ -1114,6 +1130,7 @@ namespace {{ Component.attrib['Namespace'] }}
{{ DefineArchetypePropertyReflection(Component, ComponentBaseName)|indent(16) }};
}
ReflectToEditContext(context);
+ ReflectToBehaviorContext(context);
}
void {{ ComponentBaseName }}::{{ ComponentBaseName }}::ReflectToEditContext(AZ::ReflectContext* context)
@@ -1138,6 +1155,23 @@ namespace {{ Component.attrib['Namespace'] }}
}
}
+ void {{ ComponentBaseName }}::{{ ComponentBaseName }}::ReflectToBehaviorContext(AZ::ReflectContext* context)
+ {
+ AZ::BehaviorContext* behaviorContext = azrtti_cast(context);
+ if (behaviorContext)
+ {
+ behaviorContext->Class<{{ ComponentName }}>("{{ ComponentName }}")
+ ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
+ ->Attribute(AZ::Script::Attributes::Category, "Multiplayer")
+ ->Attribute(AZ::Script::Attributes::Module, "Multiplayer")
+ {{ ReflectRpcInvocations(Component, ComponentName, 'Server', 'Authority')|indent(4) -}}
+ {{ ReflectRpcInvocations(Component, ComponentName, 'Autonomous', 'Authority')|indent(4) -}}
+ {{ ReflectRpcInvocations(Component, ComponentName, 'Authority', 'Autonomous')|indent(4) -}}
+ {{ ReflectRpcInvocations(Component, ComponentName, 'Authority', 'Client')|indent(4) -}}
+ ;
+ }
+ }
+
void {{ ComponentBaseName }}::{{ ComponentBaseName }}::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("{{ ComponentName }}Service"));
diff --git a/Gems/Multiplayer/Code/Source/AutoGen/LocalPredictionPlayerInputComponent.AutoComponent.xml b/Gems/Multiplayer/Code/Source/AutoGen/LocalPredictionPlayerInputComponent.AutoComponent.xml
index d38ebbb1b8..336909a102 100644
--- a/Gems/Multiplayer/Code/Source/AutoGen/LocalPredictionPlayerInputComponent.AutoComponent.xml
+++ b/Gems/Multiplayer/Code/Source/AutoGen/LocalPredictionPlayerInputComponent.AutoComponent.xml
@@ -18,18 +18,18 @@
-
+
-
+
-
+
From 2f4120cdfbbd736d18fdc5f3187a94f6640ed28b Mon Sep 17 00:00:00 2001
From: puvvadar
Date: Mon, 3 May 2021 13:07:11 -0700
Subject: [PATCH 014/330] Update Ctrl+G logic to account for prefab processing
status and timing
---
.../PrefabEditorEntityOwnershipInterface.h | 2 +
.../PrefabEditorEntityOwnershipService.cpp | 5 ++
.../PrefabEditorEntityOwnershipService.h | 2 +
Gems/Multiplayer/Code/CMakeLists.txt | 1 +
.../Code/Include/IMultiplayerTools.h | 39 ++++++++++++
.../MultiplayerEditorSystemComponent.cpp | 63 ++++++++++++-------
.../Editor/MultiplayerEditorSystemComponent.h | 12 +++-
.../Code/Source/MultiplayerToolsModule.cpp | 35 ++++-------
.../Code/Source/MultiplayerToolsModule.h | 27 ++++++++
.../Pipeline/NetworkPrefabProcessor.cpp | 3 +
.../Code/multiplayer_tools_files.cmake | 1 +
11 files changed, 142 insertions(+), 48 deletions(-)
create mode 100644 Gems/Multiplayer/Code/Include/IMultiplayerTools.h
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h
index 19c236f509..4476876b59 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h
@@ -46,6 +46,8 @@ namespace AzToolsFramework
virtual Prefab::InstanceOptionalReference GetRootPrefabInstance() = 0;
+ virtual const AZStd::vector>& GetPlayInEditorAssetData() = 0;
+
virtual bool LoadFromStream(AZ::IO::GenericStream& stream, AZStd::string_view filename) = 0;
virtual bool SaveToStream(AZ::IO::GenericStream& stream, AZStd::string_view filename) = 0;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
index 81233069a9..e81d6bf08e 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp
@@ -321,6 +321,11 @@ namespace AzToolsFramework
return *m_rootInstance;
}
+ const AZStd::vector>& PrefabEditorEntityOwnershipService::GetPlayInEditorAssetData()
+ {
+ return m_playInEditorData.m_assets;
+ }
+
void PrefabEditorEntityOwnershipService::OnEntityRemoved(AZ::EntityId entityId)
{
AzFramework::SliceEntityRequestBus::MultiHandler::BusDisconnect(entityId);
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h
index 9c483e61c5..cf62220e67 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h
@@ -195,6 +195,8 @@ namespace AzToolsFramework
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder) override;
Prefab::InstanceOptionalReference GetRootPrefabInstance() override;
+
+ const AZStd::vector>& GetPlayInEditorAssetData() override;
//////////////////////////////////////////////////////////////////////////
void OnEntityRemoved(AZ::EntityId entityId);
diff --git a/Gems/Multiplayer/Code/CMakeLists.txt b/Gems/Multiplayer/Code/CMakeLists.txt
index 4eeee15c47..46f56ef315 100644
--- a/Gems/Multiplayer/Code/CMakeLists.txt
+++ b/Gems/Multiplayer/Code/CMakeLists.txt
@@ -119,6 +119,7 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
BUILD_DEPENDENCIES
PRIVATE
Gem::Multiplayer.Editor.Static
+ Gem::Multiplayer.Tools
)
endif()
diff --git a/Gems/Multiplayer/Code/Include/IMultiplayerTools.h b/Gems/Multiplayer/Code/Include/IMultiplayerTools.h
new file mode 100644
index 0000000000..c621808f7a
--- /dev/null
+++ b/Gems/Multiplayer/Code/Include/IMultiplayerTools.h
@@ -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
+
+namespace Multiplayer
+{
+ //! IMultiplayer provides insight into the Multiplayer session and its Agents
+ class IMultiplayerTools
+ {
+ public:
+ // NetworkPrefabProcessor is the only class that should be setting process network prefab status
+ friend class NetworkPrefabProcessor;
+
+ AZ_RTTI(IMultiplayerTools, "{E8A80EAB-29CB-4E3B-A0B2-FFCB37060FB0}");
+
+ virtual ~IMultiplayerTools() = default;
+
+ //! Returns if network prefab processing has created currently active or pending spawnables
+ //! @return If network prefab processing has created currently active or pending spawnables
+ virtual bool DidProcessNetworkPrefabs() = 0;
+
+ private:
+ //! Sets if network prefab processing has created currently active or pending spawnables
+ //! @param didProcessNetPrefabs if network prefab processing has created currently active or pending spawnables
+ virtual void SetDidProcessNetworkPrefabs(bool didProcessNetPrefabs) = 0;
+ };
+}
diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
index aec3e7870f..0850b858a2 100644
--- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
+++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
@@ -10,12 +10,14 @@
*
*/
+#include
#include
#include
#include
#include
#include
#include
+#include
namespace Multiplayer
{
@@ -57,12 +59,14 @@ namespace Multiplayer
void MultiplayerEditorSystemComponent::Activate()
{
+ AzFramework::GameEntityContextEventBus::Handler::BusConnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
void MultiplayerEditorSystemComponent::Deactivate()
{
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
+ AzFramework::GameEntityContextEventBus::Handler::BusDisconnect();
}
void MultiplayerEditorSystemComponent::NotifyRegisterViews()
@@ -77,11 +81,42 @@ namespace Multiplayer
{
switch (event)
{
- case eNotify_OnBeginGameMode:
- {
+ case eNotify_OnQuit:
+ AZ_Warning("Multiplayer Editor", m_editor != nullptr, "Multiplayer Editor received On Quit without an Editor pointer.");
+ if (m_editor)
+ {
+ m_editor->UnregisterNotifyListener(this);
+ m_editor = nullptr;
+ }
+ [[fallthrough]];
+ case eNotify_OnEndGameMode:
+ AZ::TickBus::Handler::BusDisconnect();
+ // Kill the configured server if it's active
+ if (m_serverProcess)
+ {
+ m_serverProcess->TerminateProcess(0);
+ m_serverProcess = nullptr;
+ }
+ break;
+ }
+ }
+
+ void MultiplayerEditorSystemComponent::OnGameEntitiesStarted()
+ {
+ // BeginGameMode and Prefab Processing have completed at this point
+ IMultiplayerTools* mpTools = AZ::Interface::Get();
+ if (editorsv_enabled && mpTools != nullptr && mpTools->DidProcessNetworkPrefabs())
+ {
AZ::TickBus::Handler::BusConnect();
- if (editorsv_enabled)
+ auto prefabEditorEntityOwnershipInterface = AZ::Interface::Get();
+ if (!prefabEditorEntityOwnershipInterface)
+ {
+ AZ_Error("MultiplayerEditor", prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface unavailable");
+ }
+ const AZStd::vector>& assetData = prefabEditorEntityOwnershipInterface->GetPlayInEditorAssetData();
+
+ if (assetData.size() > 0)
{
// Assemble the server's path
AZ::CVarFixedString serverProcess = editorsv_process;
@@ -111,33 +146,13 @@ namespace Multiplayer
// Start the configured server if it's available
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
- processLaunchInfo.m_commandlineParameters =
- AZStd::string::format("\"%s\"", serverPath.c_str());
+ processLaunchInfo.m_commandlineParameters = AZStd::string::format("\"%s\"", serverPath.c_str());
processLaunchInfo.m_showWindow = true;
processLaunchInfo.m_processPriority = AzFramework::ProcessPriority::PROCESSPRIORITY_NORMAL;
m_serverProcess = AzFramework::ProcessWatcher::LaunchProcess(
processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
}
- break;
- }
- case eNotify_OnQuit:
- AZ_Warning("Multiplayer Editor", m_editor != nullptr, "Multiplayer Editor received On Quit without an Editor pointer.");
- if (m_editor)
- {
- m_editor->UnregisterNotifyListener(this);
- m_editor = nullptr;
- }
- [[fallthrough]];
- case eNotify_OnEndGameMode:
- AZ::TickBus::Handler::BusDisconnect();
- // Kill the configured server if it's active
- if (m_serverProcess)
- {
- m_serverProcess->TerminateProcess(0);
- m_serverProcess = nullptr;
- }
- break;
}
}
diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
index 8c18a2e57a..31ecdf83a3 100644
--- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
+++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
@@ -34,6 +35,7 @@ namespace Multiplayer
class MultiplayerEditorSystemComponent final
: public AZ::Component
, private AZ::TickBus::Handler
+ , private AzFramework::GameEntityContextEventBus::Handler
, private AzToolsFramework::EditorEvents::Bus::Handler
, private IEditorNotifyListener
{
@@ -66,8 +68,16 @@ namespace Multiplayer
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
int GetTickOrder() override;
//! @}
- //!
+
+ //! EditorEvents::Handler overrides
+ //! @{
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
+ //! @}
+
+ //! GameEntityContextEventBus::Handler overrides
+ //! @{
+ void OnGameEntitiesStarted() override;
+ //! @}
IEditor* m_editor = nullptr;
AzFramework::ProcessWatcher* m_serverProcess = nullptr;
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
index 5a223d6214..a5df3c1dc5 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
+++ b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
@@ -18,32 +18,21 @@
namespace Multiplayer
{
- //! Multiplayer Tools system component provides serialize context reflection for tools-only systems.
- class MultiplayerToolsSystemComponent final
- : public AZ::Component
- {
- public:
- AZ_COMPONENT(MultiplayerToolsSystemComponent, "{65AF5342-0ECE-423B-B646-AF55A122F72B}");
-
- static void Reflect(AZ::ReflectContext* context)
- {
- NetworkPrefabProcessor::Reflect(context);
- }
-
- MultiplayerToolsSystemComponent() = default;
- ~MultiplayerToolsSystemComponent() override = default;
- /// AZ::Component overrides.
- void Activate() override
- {
-
- }
+ void MultiplayerToolsSystemComponent::Reflect(AZ::ReflectContext* context)
+ {
+ NetworkPrefabProcessor::Reflect(context);
+ }
- void Deactivate() override
- {
+ bool MultiplayerToolsSystemComponent::DidProcessNetworkPrefabs()
+ {
+ return m_didProcessNetPrefabs;
+ }
- }
- };
+ void MultiplayerToolsSystemComponent::SetDidProcessNetworkPrefabs(bool didProcessNetPrefabs)
+ {
+ m_didProcessNetPrefabs = didProcessNetPrefabs;
+ }
MultiplayerToolsModule::MultiplayerToolsModule()
: AZ::Module()
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
index 823bd63a1d..82d0415c5a 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
+++ b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
@@ -12,10 +12,37 @@
#pragma once
+#include
#include
+#include
namespace Multiplayer
{
+ class MultiplayerToolsSystemComponent final
+ : public AZ::Component
+ , public IMultiplayerTools
+ {
+ public:
+ AZ_COMPONENT(MultiplayerToolsSystemComponent, "{65AF5342-0ECE-423B-B646-AF55A122F72B}");
+
+ static void Reflect(AZ::ReflectContext* context);
+
+ MultiplayerToolsSystemComponent() = default;
+ ~MultiplayerToolsSystemComponent() override = default;
+
+ /// AZ::Component overrides.
+ void Activate() override {};
+
+ void Deactivate() override {};
+
+ bool DidProcessNetworkPrefabs() override;
+
+ private:
+ void SetDidProcessNetworkPrefabs(bool didProcessNetPrefabs) override;
+
+ bool m_didProcessNetPrefabs = false;
+ };
+
class MultiplayerToolsModule
: public AZ::Module
{
diff --git a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
index 2006272135..8528b3d564 100644
--- a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
+++ b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -29,6 +30,8 @@ namespace Multiplayer
void NetworkPrefabProcessor::Process(PrefabProcessorContext& context)
{
+ IMultiplayerTools* mpTools = AZ::Interface::Get();
+ mpTools->SetDidProcessNetworkPrefabs(false);
context.ListPrefabs([&context](AZStd::string_view prefabName, PrefabDom& prefab) {
ProcessPrefab(context, prefabName, prefab);
});
diff --git a/Gems/Multiplayer/Code/multiplayer_tools_files.cmake b/Gems/Multiplayer/Code/multiplayer_tools_files.cmake
index 1be02fd999..12f12479ba 100644
--- a/Gems/Multiplayer/Code/multiplayer_tools_files.cmake
+++ b/Gems/Multiplayer/Code/multiplayer_tools_files.cmake
@@ -10,6 +10,7 @@
#
set(FILES
+ Include/IMultiplayerTools.h
Source/Multiplayer_precompiled.cpp
Source/Multiplayer_precompiled.h
Source/Pipeline/NetworkPrefabProcessor.cpp
From f5414050e36906541cad6fcf1377918f602ecae6 Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 00:37:53 -0700
Subject: [PATCH 015/330] smoke test cases migration
---
.../Gem/PythonTests/CMakeLists.txt | 15 ++
.../smoke/Editor_NewExistingLevels.py | 155 ++++++++++++++++++
.../Gem/PythonTests/smoke/ImportPathHelper.py | 16 ++
.../Gem/PythonTests/smoke/__init__.py | 10 ++
.../PythonTests/smoke/test_AssetBuilder.py | 44 +++++
.../smoke/test_AssetProcessorBatch.py | 43 +++++
.../PythonTests/smoke/test_AzTestRunner.py | 46 ++++++
.../smoke/test_Editor_NewExistingLevels.py | 34 ++++
.../smoke/test_PythonBindingsExample.py | 45 +++++
.../smoke/test_SerializeContextTools.py | 44 +++++
.../smoke/test_Statictool_Scripts.py | 48 ++++++
11 files changed, 500 insertions(+)
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/__init__.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 6d3727195e..26c425fd79 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -307,3 +307,18 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
#)
endif()
+## Smoke ##
+if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
+ ly_add_pytest(
+ NAME AutomatedTesting::SmokeTest_Periodic
+ TEST_SUITE periodic
+ TEST_SERIAL
+ PATH ${CMAKE_CURRENT_LIST_DIR}/smoke
+ TIMEOUT 3600
+ RUNTIME_DEPENDENCIES
+ AZ::AssetProcessor
+ AZ::PythonBindingsExample
+ Legacy::Editor
+ AutomatedTesting.GameLauncher
+ AutomatedTesting.Assets
+
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py
new file mode 100644
index 0000000000..4e4a037ec9
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py
@@ -0,0 +1,155 @@
+"""
+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.
+
+
+Test case ID: LY-123945
+Test Case Title: Create Test for UI apps- Editor
+URL of the test case: https://jira.agscollab.com/browse/LY-123945
+"""
+
+
+# fmt: off
+class Tests():
+ level_created = ("Level created", "Failed to create level")
+ entity_found = ("New Entity created in level", "Failed to create New Entity in level")
+ mesh_added = ("Mesh Component added", "Failed to add Mesh Component")
+ enter_game_mode = ("Game Mode successfully entered", "Failed to enter in Game Mode")
+ exit_game_mode = ("Game Mode successfully exited", "Failed to exit in Game Mode")
+ level_opened = ("Level opened successfully", "Failed to open level")
+ level_exported = ("Level exported successfully", "Failed to export level")
+ mesh_removed = ("Mesh Component removed", "Failed to remove Mesh Component")
+ entity_deleted = ("Entity deleted", "Failed to delete Entity")
+ level_edits_present = ("Level edits persist after saving", "Failed to save level edits after saving")
+# fmt: on
+
+
+def Editor_NewExistingLevels():
+ """
+ Summary: Perform the below operations on Editor
+
+ 1) Launch & Close editor
+ 2) Create new level
+ 3) Saving and loading levels
+ 4) Level edits persist after saving
+ 5) Export Level
+ 6) Can switch to play mode (ctrl+g) and exit that
+ 7) Run editor python bindings test
+ 8) Create an Entity
+ 9) Delete an Entity
+ 10) Add a component to an Entity
+
+ Expected Behavior:
+ All operations succeed and do not cause a crash
+
+ Test Steps:
+ 1) Launch editor and Create a new level
+ 2) Create a new entity
+ 3) Add Mesh component
+ 4) Verify enter/exit game mode
+ 5) Save, Load and Export level
+ 6) Remove Mesh component
+ 7) Delete entity
+ 8) Open an existing level
+ 9) Create a new entity in an existing level
+ 10) Save, Load and Export an existing level and close editor
+
+ Note:
+ - This test file must be called from the Lumberyard Editor command terminal
+ - Any passed and failed tests are written to the Editor.log file.
+ Parsing the file or running a log_monitor are required to observe the test results.
+
+ :return: None
+ """
+
+ import os
+ import hydra_editor_utils as hydra
+ from utils import TestHelper as helper
+ from utils import Report
+ import azlmbr.bus as bus
+ import azlmbr.editor as editor
+ import azlmbr.legacy.general as general
+ import azlmbr.math as math
+
+ # 1) Launch editor and Create a new level
+ helper.init_idle()
+ test_level_name = "temp_level"
+ general.create_level_no_prompt(test_level_name, 128, 1, 128, False)
+ general.idle_wait(2.0)
+ Report.result(Tests.level_created, general.get_current_level_name() == test_level_name)
+
+ # 2) Create a new entity
+ entity_position = math.Vector3(200.0, 200.0, 38.0)
+ new_entity = hydra.Entity("Entity1")
+ new_entity.create_entity(entity_position, [])
+ test_entity = hydra.find_entity_by_name("Entity1")
+ Report.result(Tests.entity_found, test_entity.IsValid())
+
+ # 3) Add Mesh component
+ new_entity.add_component("Mesh")
+ Report.result(Tests.mesh_added, hydra.has_components(new_entity.id, ["Mesh"]))
+
+ # 4) Verify enter/exit game mode
+ helper.enter_game_mode(Tests.enter_game_mode)
+ helper.exit_game_mode(Tests.exit_game_mode)
+
+ # 5) Save, Load and Export level
+ # Save Level
+ general.save_level()
+ # Open Level
+ general.open_level(test_level_name)
+ Report.result(Tests.level_opened, general.get_current_level_name() == test_level_name)
+ # Export Level
+ general.idle_wait(1.0)
+ general.export_to_engine()
+ level_pak_file = os.path.join("AutomatedTesting", "Levels", test_level_name, "level.pak")
+ Report.result(Tests.level_exported, os.path.exists(level_pak_file))
+
+ # 6) Remove Mesh component
+ new_entity.remove_component("Mesh")
+ Report.result(Tests.mesh_removed, not hydra.has_components(new_entity.id, ["Mesh"]))
+
+ # 7) Delete entity
+ editor.ToolsApplicationRequestBus(bus.Broadcast, "DeleteEntityById", new_entity.id)
+ test_entity = hydra.find_entity_by_name("Entity1")
+ Report.result(Tests.entity_deleted, len(test_entity) == 0)
+
+ # 8) Open an existing level
+ general.open_level(test_level_name)
+ Report.result(Tests.level_opened, general.get_current_level_name() == test_level_name)
+
+ # 9) Create a new entity in an existing level
+ entity_position = math.Vector3(200.0, 200.0, 38.0)
+ new_entity_2 = hydra.Entity("Entity2")
+ new_entity_2.create_entity(entity_position, [])
+ test_entity = hydra.find_entity_by_name("Entity2")
+ Report.result(Tests.entity_found, test_entity.IsValid())
+
+ # 10) Save, Load and Export an existing level
+ # Save Level
+ general.save_level()
+ # Open Level
+ general.open_level(test_level_name)
+ Report.result(Tests.level_opened, general.get_current_level_name() == test_level_name)
+ entity_id = hydra.find_entity_by_name(new_entity_2.name)
+ Report.result(Tests.level_edits_present, entity_id == new_entity_2.id)
+ # Export Level
+ general.export_to_engine()
+ level_pak_file = os.path.join("AutomatedTesting", "Levels", test_level_name, "level.pak")
+ Report.result(Tests.level_exported, os.path.exists(level_pak_file))
+
+
+if __name__ == "__main__":
+ import ImportPathHelper as imports
+
+ imports.init()
+
+ from utils import Report
+
+ Report.start_test(Editor_NewExistingLevels)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py b/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
new file mode 100644
index 0000000000..70bed6e526
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
@@ -0,0 +1,16 @@
+"""
+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.
+"""
+
+def init():
+ import os
+ import sys
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../EditorPythonTestTools/editor_python_test_tools')
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
new file mode 100644
index 0000000000..6ed3dc4bda
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
@@ -0,0 +1,10 @@
+"""
+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.
+"""
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py
new file mode 100644
index 0000000000..da2abff50f
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py
@@ -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.
+"""
+
+"""
+LY-124059 : CLI tool - AssetBuilder
+Launch AssetBuilder and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import ly_test_tools.environment.process_utils as process_utils
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestAssetBuilder(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ def teardown():
+ process_utils.kill_processes_named("AssetBuilder", True)
+
+ request.addfinalizer(teardown)
+
+ @pytest.mark.test_case_id("LY-124059")
+ def test_AssetBuilder(self, request, editor, build_directory):
+ file_path = os.path.join(build_directory, "AssetBuilder")
+ help_message = "AssetBuilder is part of the Asset Processor"
+ # Launch AssetBuilder
+ output = subprocess.run([file_path, "-help"], capture_output=True)
+ assert (
+ len(output.stderr) == 0 and output.returncode == 0
+ ), f"Error occurred while launching {file_path}: {output.stderr}"
+ # Verify help message
+ assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py
new file mode 100644
index 0000000000..ab541b94c1
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py
@@ -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.
+"""
+
+"""
+LY-124061 : CLI tool - AssetProcessorBatch
+Launch AssetProcessorBatch and Shutdown AssetProcessorBatch without any crash
+"""
+
+
+# Import builtin libraries
+import pytest
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../assetpipeline/")
+
+# Import fixtures
+from ap_fixtures.asset_processor_fixture import asset_processor as asset_processor
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.usefixtures("asset_processor")
+@pytest.mark.SUITE_smoke
+class TestsAssetProcessorBatchs(object):
+ @pytest.mark.test_case_id("LY-124061")
+ def test_AssetProcessorBatch(self, asset_processor):
+ """
+ Test Launching AssetProcessorBatch and verifies that is shuts down without issue
+ """
+ # Create a sample asset root so we don't process every asset for every platform
+ asset_processor.create_temp_asset_root()
+ # Launch AssetProcessorBatch, assert batch processing success
+ result, _ = asset_processor.batch_process()
+ assert result, "AP Batch failed"
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py b/AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py
new file mode 100644
index 0000000000..d1bc44fe2f
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py
@@ -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.
+"""
+
+"""
+LY-124062 : CLI tool - AzTestRunner
+Launch AzTestRunner and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import ly_test_tools.environment.process_utils as process_utils
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestAzTestRunner(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ def teardown():
+ process_utils.kill_processes_named("AzTestRunner", True)
+
+ request.addfinalizer(teardown)
+
+ @pytest.mark.test_case_id("LY-124062")
+ def test_AzTestRunner(self, request, editor, build_directory):
+ file_path = os.path.join(build_directory, "AzTestRunner")
+ help_message = "OKAY Symbol found: AzRunUnitTests"
+ # Launch AzTestRunner
+ output = subprocess.run(
+ [file_path, "AzTestRunner.Tests", "AzRunUnitTests", "--gtest_list_tests"], capture_output=True
+ )
+ assert (
+ len(output.stderr) == 0 and output.returncode == 0
+ ), f"Error occurred while launching {file_path}: {output.stderr}"
+ # Verify help message
+ assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py
new file mode 100644
index 0000000000..85d53d098d
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py
@@ -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.
+"""
+
+import pytest
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../automatedtesting_shared")
+
+from automatedtesting_shared.base import TestAutomationBase
+import ly_test_tools.environment.file_system as file_system
+
+
+@pytest.mark.SUITE_smoke
+@pytest.mark.parametrize("launcher_platform", ["windows_editor"])
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.parametrize("level", ["temp_level"])
+class TestAutomation(TestAutomationBase):
+ def test_Editor_NewExistingLevels(self, request, workspace, editor, level, project, launcher_platform):
+ def teardown():
+ file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
+ request.addfinalizer(teardown)
+ file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
+
+ from . import Editor_NewExistingLevels as test_module
+ self._run_test(request, workspace, editor, test_module)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py b/AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py
new file mode 100644
index 0000000000..140e76fc96
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py
@@ -0,0 +1,45 @@
+"""
+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.
+"""
+
+"""
+LY-124064 : CLI tool - PythonBindingsExample
+Launch PythonBindingsExample and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import ly_test_tools.environment.process_utils as process_utils
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestPythonBindingsExample(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ def teardown():
+ process_utils.kill_processes_named("PythonBindingsExample", True)
+
+ request.addfinalizer(teardown)
+
+ @pytest.mark.test_case_id("LY-124064")
+ def test_PythonBindingsExample(self, request, editor, build_directory):
+ file_path = os.path.join(build_directory, "PythonBindingsExample")
+ help_message = "--help Prints the help text"
+ # Launch PythonBindingsExample
+ output = subprocess.run([file_path, "-help"], capture_output=True)
+ assert (
+ len(output.stderr) == 0 and output.returncode == 1
+ ), f"Error occurred while launching {file_path}: {output.stderr}"
+ # Verify help message
+ assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
+
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py b/AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py
new file mode 100644
index 0000000000..763d84625d
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py
@@ -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.
+"""
+
+"""
+LY-124066 : CLI tool - SerializeContextTools
+Launch SerializeContextTools and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import ly_test_tools.environment.process_utils as process_utils
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestSerializeContextTools(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ def teardown():
+ process_utils.kill_processes_named("SerializeContextTools", True)
+
+ request.addfinalizer(teardown)
+
+ @pytest.mark.test_case_id("LY-124066")
+ def test_SerializeContextTools(self, request, editor, build_directory):
+ file_path = os.path.join(build_directory, "SerializeContextTools")
+ help_message = "Converts a file with an ObjectStream to the new JSON"
+ # Launch SerializeContextTools
+ output = subprocess.run([file_path, "-help"], capture_output=True)
+ assert (
+ len(output.stderr) == 0 and output.returncode == 0
+ ), f"Error occurred while launching {file_path}: {output.stderr}"
+ # Verify help message
+ assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
new file mode 100644
index 0000000000..d1ae1d4ee0
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
@@ -0,0 +1,48 @@
+"""
+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.
+"""
+
+"""
+LY-124058: Static tool scripts
+Launch Static tool and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import sys
+
+
+def verify_help_message(static_tool):
+ help_message = ["--help", "show this help message and exit"]
+ output = subprocess.run([sys.executable, static_tool, "-h"], capture_output=True)
+ assert (
+ len(output.stderr) == 0 and output.returncode == 0
+ ), f"Error occurred while launching {static_tool}: {output.stderr}"
+ # verify help message
+ for message in help_message:
+ assert message in str(output.stdout), f"Help Message: {message} is not present"
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestStatictoolScripts(object):
+ @pytest.mark.test_case_id("LY-124058")
+ def test_Statictool_Scripts(self, request, editor):
+ static_tools = [
+ os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "gen_shaders.py"),
+ os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "get_shader_list.py"),
+ os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "pak_shaders.py"),
+ ]
+
+ for tool in static_tools:
+ verify_help_message(tool)
+
\ No newline at end of file
From 4ce7e117a9347e5dc2fc8204bc8ffd6d44530920 Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 00:51:06 -0700
Subject: [PATCH 016/330] "Updating cmakelist.txt to remove extra intendation"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 4 ++--
.../Gem/PythonTests/smoke/test_Statictool_Scripts.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 26c425fd79..e6fff224d3 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -316,9 +316,9 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
PATH ${CMAKE_CURRENT_LIST_DIR}/smoke
TIMEOUT 3600
RUNTIME_DEPENDENCIES
- AZ::AssetProcessor
+ AZ::AssetProcessor
AZ::PythonBindingsExample
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
-
+
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
index d1ae1d4ee0..86f5d67478 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
@@ -45,4 +45,4 @@ class TestStatictoolScripts(object):
for tool in static_tools:
verify_help_message(tool)
-
\ No newline at end of file
+
\ No newline at end of file
From 7eb6cc10b6559511927028d9f6c5514b973a99bb Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Wed, 5 May 2021 08:57:39 +0100
Subject: [PATCH 017/330] Made change affect all modifiable containers.
---
.../Serialization/EditContextConstants.inl | 2 --
.../UI/PropertyEditor/PropertyRowWidget.cpp | 22 +++++++++++++------
.../UI/PropertyEditor/PropertyRowWidget.hxx | 5 +++--
Gems/Vegetation/Code/Source/Descriptor.cpp | 2 --
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl b/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
index 481ae5a91c..90b9ba5afd 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
+++ b/Code/Framework/AzCore/AzCore/Serialization/EditContextConstants.inl
@@ -62,8 +62,6 @@ namespace AZ
const static AZ::Crc32 ButtonTooltip = AZ_CRC("ButtonTooltip", 0x1605a7d2);
const static AZ::Crc32 CheckboxTooltip = AZ_CRC("CheckboxTooltip", 0x1159eb78);
const static AZ::Crc32 CheckboxDefaultValue = AZ_CRC("CheckboxDefaultValue", 0x03f117e6);
- //! Emboldens the text and adds a line above this item within the RPE.
- const static AZ::Crc32 RPESectionSeparator = AZ_CRC("RPESectionSeparator", 0xc6249a95);
//! Affects the display order of a node relative to it's parent/children. Higher values display further down (after) lower values. Default is 0, negative values are allowed. Must be applied as an attribute to the EditorData element
const static AZ::Crc32 DisplayOrder = AZ_CRC("DisplayOrder", 0x23660ec2);
//! Specifies whether the UI should support multi-edit for aggregate instances of this property
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
index 5b02e81e6d..faeae0a06d 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
@@ -315,8 +315,6 @@ namespace AzToolsFramework
}
}
- m_isSectionSeparator = false;
-
RefreshAttributesFromNode(true);
// --------------------- HANDLER discovery:
@@ -962,10 +960,6 @@ namespace AzToolsFramework
{
HandleChangeNotifyAttribute(reader, m_sourceNode ? m_sourceNode->GetParent() : nullptr, m_editingCompleteNotifiers);
}
- else if (attributeName == AZ::Edit::Attributes::RPESectionSeparator)
- {
- m_isSectionSeparator = true;
- }
}
void PropertyRowWidget::SetReadOnlyQueryFunction(const ReadOnlyQueryFunction& readOnlyQueryFunction)
@@ -1340,7 +1334,7 @@ namespace AzToolsFramework
bool PropertyRowWidget::IsSectionSeparator() const
{
- return m_isSectionSeparator;
+ return CanBeReordered();
}
bool PropertyRowWidget::GetAppendDefaultLabelToName()
@@ -1686,6 +1680,20 @@ namespace AzToolsFramework
m_nameLabel->setFilter(m_currentFilterString);
}
+ bool PropertyRowWidget::CanChildrenBeReordered() const
+ {
+ return m_containerEditable;
+ }
+
+ bool PropertyRowWidget::CanBeReordered() const
+ {
+ if (!m_parentRow)
+ {
+ return false;
+ }
+
+ return m_parentRow->CanChildrenBeReordered();
+ }
}
#include "UI/PropertyEditor/moc_PropertyRowWidget.cpp"
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index 2fb695fca5..b6c94dc98b 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -149,6 +149,9 @@ namespace AzToolsFramework
QLabel* GetNameLabel() { return m_nameLabel; }
void SetIndentSize(int w);
void SetAsCustom(bool custom) { m_custom = custom; }
+
+ bool CanChildrenBeReordered() const;
+ bool CanBeReordered() const;
protected:
int CalculateLabelWidth() const;
@@ -232,8 +235,6 @@ namespace AzToolsFramework
int m_treeIndentation = 14;
int m_leafIndentation = 16;
- bool m_isSectionSeparator = false;
-
QIcon m_iconOpen;
QIcon m_iconClosed;
diff --git a/Gems/Vegetation/Code/Source/Descriptor.cpp b/Gems/Vegetation/Code/Source/Descriptor.cpp
index 45ec25038d..ecda8415e7 100644
--- a/Gems/Vegetation/Code/Source/Descriptor.cpp
+++ b/Gems/Vegetation/Code/Source/Descriptor.cpp
@@ -170,8 +170,6 @@ namespace Vegetation
{
edit->Class(
"Vegetation Descriptor", "Details used to create vegetation instances")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::RPESectionSeparator, true)
// For this ComboBox to actually work, there is a PropertyHandler registration in EditorVegetationSystemComponent.cpp
->DataElement(AZ::Edit::UIHandlers::ComboBox, &Descriptor::m_spawnerType, "Instance Spawner", "The type of instances to spawn")
->Attribute(AZ::Edit::Attributes::GenericValueList, &Descriptor::GetSpawnerTypeList)
From 0e666d046c37a305fa89bb335f7bc43bd4a89356 Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 00:57:51 -0700
Subject: [PATCH 018/330] "Adding new line"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 1 +
AutomatedTesting/Gem/PythonTests/smoke/__init__.py | 2 +-
.../Gem/PythonTests/smoke/test_Statictool_Scripts.py | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index e6fff224d3..8dfac40c43 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -321,4 +321,5 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
+
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
index 6ed3dc4bda..79f8fa4422 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
@@ -7,4 +7,4 @@ distribution (the "License"). All use of this software is governed by the Licens
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.
-"""
\ No newline at end of file
+"""
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
index 86f5d67478..92be4abeb9 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
@@ -45,4 +45,5 @@ class TestStatictoolScripts(object):
for tool in static_tools:
verify_help_message(tool)
+
\ No newline at end of file
From 2f153f994e2b5be015f661bf81d99e96c3947bab Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 01:12:38 -0700
Subject: [PATCH 019/330] "Adding new line"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 1 -
AutomatedTesting/Gem/PythonTests/smoke/__init__.py | 2 +-
.../Gem/PythonTests/smoke/test_Statictool_Scripts.py | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 8dfac40c43..e6fff224d3 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -321,5 +321,4 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
-
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
index 79f8fa4422..6ed3dc4bda 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
@@ -7,4 +7,4 @@ distribution (the "License"). All use of this software is governed by the Licens
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.
-"""
+"""
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
index 92be4abeb9..8eac2ff099 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
@@ -45,5 +45,3 @@ class TestStatictoolScripts(object):
for tool in static_tools:
verify_help_message(tool)
-
-
\ No newline at end of file
From 2f0ed6cfb21aac2b99b6b5f303286bccba3ea814 Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 01:17:20 -0700
Subject: [PATCH 020/330] ""
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 1 -
AutomatedTesting/Gem/PythonTests/smoke/__init__.py | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index e6fff224d3..400dca33ce 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -321,4 +321,3 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
-
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
index 6ed3dc4bda..79f8fa4422 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/__init__.py
@@ -7,4 +7,4 @@ distribution (the "License"). All use of this software is governed by the Licens
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.
-"""
\ No newline at end of file
+"""
From 682bdf684743ddc094cf32ab02a5246b63191eef Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 08:50:34 -0700
Subject: [PATCH 021/330] "Changing testsuite"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 400dca33ce..92dcc7dc7f 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -310,8 +310,8 @@ endif()
## Smoke ##
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_pytest(
- NAME AutomatedTesting::SmokeTest_Periodic
- TEST_SUITE periodic
+ NAME AutomatedTesting::SmokeTest
+ TEST_SUITE smoke
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/smoke
TIMEOUT 3600
From 2b511b68a2538326b199a088d7a4d4cfa94581c4 Mon Sep 17 00:00:00 2001
From: darapan
Date: Wed, 5 May 2021 10:26:11 -0700
Subject: [PATCH 022/330] "Adding AssetBundlerBatch test"
---
.../smoke/test_AssetBundlerBatch.py | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py
new file mode 100644
index 0000000000..d361c62f5f
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py
@@ -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.
+"""
+
+"""
+LY-124060 : CLI tool - AssetBundlerBatch
+Launch AssetBundlerBatch and Verify the help message
+"""
+
+import os
+import pytest
+import subprocess
+import ly_test_tools.environment.process_utils as process_utils
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestAssetBundlerBatch(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ def teardown():
+ process_utils.kill_processes_named("AssetBundlerBatch", True)
+
+ request.addfinalizer(teardown)
+
+ @pytest.mark.test_case_id("LY-124060")
+ def test_AssetBundlerBatch(self, request, editor, build_directory):
+ file_path = os.path.join(build_directory, "AssetBundlerBatch")
+ help_message = "Specifies the Seed List file to operate on by path"
+ # Launch AssetBundlerBatch
+ output = subprocess.run([file_path, "--help"], capture_output=True)
+ assert (
+ len(output.stderr) == 0 and output.returncode == 0
+ ), f"Error occurred while launching {file_path}: {output.stderr}"
+ # Verify help message
+ assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
From aa51233536a55816324da9d41fff6afe4e3970c9 Mon Sep 17 00:00:00 2001
From: puvvadar
Date: Thu, 6 May 2021 16:18:13 -0700
Subject: [PATCH 023/330] Add Asset serialization for Ctrl+G and related net
interfaces
---
.../AzNetworking/TcpTransport/TcpSocket.cpp | 4 +-
.../AutoGen/Multiplayer.AutoPackets.xml | 6 ++
.../MultiplayerEditorSystemComponent.cpp | 93 +++++++++++++++++--
.../Editor/MultiplayerEditorSystemComponent.h | 2 +
.../Source/MultiplayerSystemComponent.cpp | 21 +++++
.../Code/Source/MultiplayerSystemComponent.h | 4 +-
.../Code/Source/MultiplayerToolsModule.cpp | 10 ++
.../Code/Source/MultiplayerToolsModule.h | 5 +-
8 files changed, 132 insertions(+), 13 deletions(-)
diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.cpp
index 78020cb09d..e8c30d0816 100644
--- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.cpp
+++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.cpp
@@ -116,8 +116,8 @@ namespace AzNetworking
int32_t TcpSocket::Receive(uint8_t* outData, uint32_t size) const
{
- AZ_Assert(size > 0, "Invalid data size for send");
- AZ_Assert(outData != nullptr, "NULL data pointer passed to send");
+ AZ_Assert(size > 0, "Invalid data size for receive");
+ AZ_Assert(outData != nullptr, "NULL data pointer passed to receive");
if (!IsOpen())
{
return SocketOpResultErrorNotOpen;
diff --git a/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml b/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml
index 5de466899c..21faefa880 100644
--- a/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml
+++ b/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml
@@ -57,4 +57,10 @@
+
+
+
+
+
+
diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
index 0850b858a2..15f00bdf80 100644
--- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
+++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp
@@ -10,23 +10,32 @@
*
*/
+#include
#include
+#include
+#include
#include
#include
+#include
#include
#include
#include
#include
+#include
#include
namespace Multiplayer
{
+ static const AZStd::string_view s_networkInterfaceName("MultiplayerEditorServerInterface");
+
using namespace AzNetworking;
AZ_CVAR(bool, editorsv_enabled, false, nullptr, AZ::ConsoleFunctorFlags::DontReplicate,
"Whether Editor launching a local server to connect to is supported");
AZ_CVAR(AZ::CVarFixedString, editorsv_process, "", nullptr, AZ::ConsoleFunctorFlags::DontReplicate,
"The server executable that should be run. Empty to use the current project's ServerLauncher");
+ AZ_CVAR(AZ::CVarFixedString, sv_serveraddr, "127.0.0.1", nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The address of the server to connect to");
+ AZ_CVAR(uint16_t, sv_port, 30091, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The port that the multiplayer editor gem will bind to for traffic");
void MultiplayerEditorSystemComponent::Reflect(AZ::ReflectContext* context)
{
@@ -61,6 +70,16 @@ namespace Multiplayer
{
AzFramework::GameEntityContextEventBus::Handler::BusConnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
+
+ // Setup a network interface handled by MultiplayerSystemComponent
+ if (m_editorNetworkInterface == nullptr)
+ {
+ AZ::Entity* systemEntity = this->GetEntity();
+ MultiplayerSystemComponent* mpSysComponent = systemEntity->FindComponent();
+
+ m_editorNetworkInterface = AZ::Interface::Get()->CreateNetworkInterface(
+ AZ::Name(s_networkInterfaceName), ProtocolType::Tcp, TrustZone::ExternalClientToServer, *mpSysComponent);
+ }
}
void MultiplayerEditorSystemComponent::Deactivate()
@@ -97,25 +116,52 @@ namespace Multiplayer
m_serverProcess->TerminateProcess(0);
m_serverProcess = nullptr;
}
+ if (m_editorNetworkInterface)
+ {
+ // Disconnect the interface, connection management will clean it up
+ m_editorNetworkInterface->Disconnect(m_editorConnId, AzNetworking::DisconnectReason::TerminatedByUser);
+ m_editorConnId = AzNetworking::InvalidConnectionId;
+ }
break;
}
}
void MultiplayerEditorSystemComponent::OnGameEntitiesStarted()
{
+ auto prefabEditorEntityOwnershipInterface = AZ::Interface::Get();
+ if (!prefabEditorEntityOwnershipInterface)
+ {
+ AZ_Error("MultiplayerEditor", prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface unavailable");
+ }
+ const AZStd::vector>& assetData = prefabEditorEntityOwnershipInterface->GetPlayInEditorAssetData();
+
+ AZStd::vector buffer;
+ AZ::IO::ByteContainerStream byteStream(&buffer);
+
+ // Serialize Asset information and AssetData into a potentially large buffer
+ for (auto asset : assetData)
+ {
+ AZ::Data::AssetId assetId = asset.GetId();
+ AZ::Data::AssetType assetType = asset.GetType();
+ const AZStd::string& assetHint = asset.GetHint();
+ AZ::IO::SizeType assetHintSize = assetHint.size();
+ AZ::Data::AssetLoadBehavior assetLoadBehavior = asset.GetAutoLoadBehavior();
+
+ byteStream.Write(sizeof(AZ::Data::AssetId), reinterpret_cast(&assetId));
+ byteStream.Write(sizeof(AZ::Data::AssetType), reinterpret_cast(&assetType));
+ byteStream.Write(sizeof(assetHintSize), reinterpret_cast(&assetHintSize));
+ byteStream.Write(assetHint.size(), assetHint.c_str());
+ byteStream.Write(sizeof(AZ::Data::AssetLoadBehavior), reinterpret_cast(&assetLoadBehavior));
+
+ AZ::Utils::SaveObjectToStream(byteStream, AZ::DataStream::ST_BINARY, asset.GetData(), asset.GetData()->GetType());
+ }
+
// BeginGameMode and Prefab Processing have completed at this point
IMultiplayerTools* mpTools = AZ::Interface::Get();
if (editorsv_enabled && mpTools != nullptr && mpTools->DidProcessNetworkPrefabs())
{
AZ::TickBus::Handler::BusConnect();
- auto prefabEditorEntityOwnershipInterface = AZ::Interface::Get();
- if (!prefabEditorEntityOwnershipInterface)
- {
- AZ_Error("MultiplayerEditor", prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface unavailable");
- }
- const AZStd::vector>& assetData = prefabEditorEntityOwnershipInterface->GetPlayInEditorAssetData();
-
if (assetData.size() > 0)
{
// Assemble the server's path
@@ -154,6 +200,39 @@ namespace Multiplayer
processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
}
}
+
+ // Now that the server has launched, attempt to connect the NetworkInterface
+ const AZ::CVarFixedString remoteAddress = sv_serveraddr;
+ m_editorConnId = m_editorNetworkInterface->Connect(
+ AzNetworking::IpAddress(remoteAddress.c_str(), sv_port, AzNetworking::ProtocolType::Tcp));
+
+ // Read the buffer into EditorServerInit packets until we've flushed the whole thing
+ byteStream.Seek(0, AZ::IO::GenericStream::SeekMode::ST_SEEK_BEGIN);
+
+ while (byteStream.GetCurPos() < byteStream.GetLength())
+ {
+ MultiplayerPackets::EditorServerInit packet;
+ AzNetworking::TcpPacketEncodingBuffer& outBuffer = packet.ModifyAssetData();
+
+ // Size the packet's buffer appropriately
+ size_t readSize = TcpPacketEncodingBuffer::GetCapacity();
+ size_t byteStreamSize = byteStream.GetLength() - byteStream.GetCurPos();
+ if (byteStreamSize < readSize)
+ {
+ readSize = byteStreamSize;
+ }
+
+ outBuffer.Resize(readSize);
+ byteStream.Read(readSize, outBuffer.GetBuffer());
+
+ // If we've run out of buffer, mark that we're done
+ if (byteStream.GetCurPos() == byteStream.GetLength())
+ {
+ packet.SetLastUpdate(true);
+ }
+ m_editorNetworkInterface->SendReliablePacket(m_editorConnId, packet);
+ }
+
}
void MultiplayerEditorSystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
index 31ecdf83a3..d43d8747b9 100644
--- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
+++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.h
@@ -81,5 +81,7 @@ namespace Multiplayer
IEditor* m_editor = nullptr;
AzFramework::ProcessWatcher* m_serverProcess = nullptr;
+ AzNetworking::ConnectionId m_editorConnId;
+ AzNetworking::INetworkInterface* m_editorNetworkInterface = nullptr;
};
}
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp
index 03c661ab03..3c1e142d96 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp
+++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp
@@ -57,7 +57,9 @@ namespace Multiplayer
using namespace AzNetworking;
static const AZStd::string_view s_networkInterfaceName("MultiplayerNetworkInterface");
+ static const AZStd::string_view s_networkEditorInterfaceName("MultiplayerEditorNetworkInterface");
static constexpr uint16_t DefaultServerPort = 30090;
+ static constexpr uint16_t DefaultServerEditorPort = 30091;
AZ_CVAR(uint16_t, cl_clientport, 0, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The port to bind to for game traffic when connecting to a remote host, a value of 0 will select any available port");
AZ_CVAR(AZ::CVarFixedString, cl_serveraddr, "127.0.0.1", nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The address of the remote server or host to connect to");
@@ -397,6 +399,19 @@ namespace Multiplayer
return false;
}
+ bool MultiplayerSystemComponent::HandleRequest
+ (
+ [[maybe_unused]] AzNetworking::IConnection* connection,
+ [[maybe_unused]] const IPacketHeader& packetHeader,
+ [[maybe_unused]] MultiplayerPackets::EditorServerInit& packet
+ )
+ {
+#if !defined(_RELEASE)
+ // Support Editor Server Init for all non-release targets
+#endif
+ return true;
+ }
+
ConnectResult MultiplayerSystemComponent::ValidateConnect
(
[[maybe_unused]] const IpAddress& remoteAddress,
@@ -492,6 +507,12 @@ namespace Multiplayer
{
if (multiplayerType == MultiplayerAgentType::ClientServer || multiplayerType == MultiplayerAgentType::DedicatedServer)
{
+#if !defined(_RELEASE)
+ m_networkEditorInterface = AZ::Interface::Get()->CreateNetworkInterface(
+ AZ::Name(s_networkEditorInterfaceName), ProtocolType::Tcp, TrustZone::ExternalClientToServer, *this);
+ m_networkEditorInterface->Listen(DefaultServerEditorPort);
+#endif
+
m_initEvent.Signal(m_networkInterface);
const AZ::Aabb worldBounds = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-16384.0f), AZ::Vector3(16384.0f));
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h
index f25e530b61..e77fa129b0 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h
+++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h
@@ -72,7 +72,8 @@ namespace Multiplayer
bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::NotifyClientMigration& packet);
bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::EntityMigration& packet);
bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::ReadyForEntityUpdates& packet);
-
+ bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::EditorServerInit& packet);
+
//! IConnectionListener interface
//! @{
AzNetworking::ConnectResult ValidateConnect(const AzNetworking::IpAddress& remoteAddress, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override;
@@ -109,6 +110,7 @@ namespace Multiplayer
AZ_CONSOLEFUNC(MultiplayerSystemComponent, DumpStats, AZ::ConsoleFunctorFlags::Null, "Dumps stats for the current multiplayer session");
AzNetworking::INetworkInterface* m_networkInterface = nullptr;
+ AzNetworking::INetworkInterface* m_networkEditorInterface = nullptr;
AZ::ConsoleCommandInvokedEvent::Handler m_consoleCommandHandler;
AZ::ThreadSafeDeque m_cvarCommands;
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
index a5df3c1dc5..ae91999a0c 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
+++ b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.cpp
@@ -24,6 +24,16 @@ namespace Multiplayer
NetworkPrefabProcessor::Reflect(context);
}
+ void MultiplayerToolsSystemComponent::Activate()
+ {
+ AZ::Interface::Register(this);
+ }
+
+ void MultiplayerToolsSystemComponent::Deactivate()
+ {
+ AZ::Interface::Unregister(this);
+ }
+
bool MultiplayerToolsSystemComponent::DidProcessNetworkPrefabs()
{
return m_didProcessNetPrefabs;
diff --git a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
index 82d0415c5a..181a971150 100644
--- a/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
+++ b/Gems/Multiplayer/Code/Source/MultiplayerToolsModule.h
@@ -31,9 +31,8 @@ namespace Multiplayer
~MultiplayerToolsSystemComponent() override = default;
/// AZ::Component overrides.
- void Activate() override {};
-
- void Deactivate() override {};
+ void Activate() override;
+ void Deactivate() override;
bool DidProcessNetworkPrefabs() override;
From e2ca84ceb253d0930a006b45c66f745d4f597c8a Mon Sep 17 00:00:00 2001
From: moudgils
Date: Fri, 7 May 2021 17:41:24 -0700
Subject: [PATCH 024/330] More fixes to shaders with the latest dxc
---
.../Assets/Materials/Types/EnhancedPBR_ForwardPass.shader | 3 +--
.../DiffuseProbeGridDownsample_nomsaa.azsl | 4 ++--
Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp | 2 +-
.../Code/Source/Platform/Windows/Vulkan_Traits_Windows.h | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/EnhancedPBR_ForwardPass.shader b/Gems/Atom/Feature/Common/Assets/Materials/Types/EnhancedPBR_ForwardPass.shader
index 7964e3c84a..764b67c82f 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/EnhancedPBR_ForwardPass.shader
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/EnhancedPBR_ForwardPass.shader
@@ -31,8 +31,7 @@
},
"CompilerHints" : {
- "DisableOptimizations" : true,
- "DxcGenerateDebugInfo" : true
+ "DisableOptimizations" : true
},
"ProgramSettings":
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.azsl
index f10fc67da5..d2e73927e0 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridDownsample_nomsaa.azsl
@@ -70,8 +70,8 @@ PSOutput MainPS(VSOutput IN)
{
for (uint x = 0; x < ImageScale; ++x)
{
- float depth = PassSrg::m_depth.Load(int3(screenCoords, 0), int2(x, y)).r;
- float4 encodedNormal = PassSrg::m_normal.Load(int3(screenCoords, 0), int2(x, y));
+ float depth = PassSrg::m_depth.Load(int3(screenCoords + int2(x, y), 0)).r;
+ float4 encodedNormal = PassSrg::m_normal.Load(int3(screenCoords + int2(x, y), 0));
// take the closest depth sample to ensure we're getting the normal closest to the viewer
// (larger depth value due to reverse depth)
diff --git a/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp b/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
index 957c076592..00b5dada69 100644
--- a/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
+++ b/Gems/Atom/RHI/Code/Source/RHI.Edit/Utils.cpp
@@ -308,7 +308,7 @@ namespace AZ
uint32_t exitCode = 0;
bool timedOut = false;
- const AZStd::sys_time_t maxWaitTimeSeconds = 240;
+ const AZStd::sys_time_t maxWaitTimeSeconds = 120;
const AZStd::sys_time_t startTimeSeconds = AZStd::GetTimeNowSecond();
const AZStd::sys_time_t startTime = AZStd::GetTimeNowTicks();
diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/Vulkan_Traits_Windows.h b/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/Vulkan_Traits_Windows.h
index c7c9902115..c1314aaf66 100644
--- a/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/Vulkan_Traits_Windows.h
+++ b/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/Vulkan_Traits_Windows.h
@@ -11,7 +11,7 @@
*/
#pragma once
-#define AZ_TRAIT_ATOM_SHADERBUILDER_DXC "Builders/DirectXShaderCompilerAz/dxc.exe"
+#define AZ_TRAIT_ATOM_SHADERBUILDER_DXC "Builders/DirectXShaderCompiler/dxc.exe"
#define AZ_TRAIT_ATOM_VULKAN_DISABLE_DUAL_SOURCE_BLENDING 0
#define AZ_TRAIT_ATOM_VULKAN_DLL "vulkan.dll"
#define AZ_TRAIT_ATOM_VULKAN_DLL_1 "vulkan-1.dll"
From 1f3d0beb387a68ac5ac87c63aafa5105d1f253b6 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Fri, 7 May 2021 18:51:20 -0700
Subject: [PATCH 025/330] work in progress
---
.../Materials/Types/StandardPBR.materialtype | 15 +
.../Types/StandardPBR_ForwardPass.azsl | 15 +-
.../Types/StandardPBR_LowEndForward.azsl | 15 +
.../Types/StandardPBR_LowEndForward.shader | 53 +++
.../StandardPBR_LowEndForward_EDS.shader | 53 +++
.../Feature/Common/Assets/Passes/Forward.pass | 16 -
.../Assets/Passes/LightAdaptationParent.pass | 146 ++++++++
.../Common/Assets/Passes/LowEndForward.pass | 133 +++++++
.../Common/Assets/Passes/LowEndPipeline.pass | 344 ++++++++++++++++++
.../Common/Assets/Passes/OpaqueParent.pass | 11 +-
.../Assets/Passes/PassTemplates.azasset | 12 +
.../Assets/Passes/PostProcessParent.pass | 90 +----
.../Feature/Common/Assets/Passes/SkyBox.pass | 5 -
.../Atom/Features/PBR/ForwardPassOutput.azsli | 17 +
.../PBR/LowEndForwardPassOutput.azsli | 32 ++
.../Atom/Features/ShaderQualityOptions.azsli | 24 ++
.../Reflections/ReflectionComposite.azsl | 15 +-
.../Common/Assets/Shaders/SkyBox/SkyBox.azsl | 2 -
.../atom_feature_common_asset_files.cmake | 10 +
19 files changed, 887 insertions(+), 121 deletions(-)
create mode 100644 Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
create mode 100644 Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.shader
create mode 100644 Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward_EDS.shader
create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/LightAdaptationParent.pass
create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/LowEndForward.pass
create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/LowEndPipeline.pass
create mode 100644 Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
create mode 100644 Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
index e071a793a5..fa5c94c606 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
@@ -77,6 +77,13 @@
],
"properties": {
"general": [
+ {
+ "id": "useLowEndShader",
+ "displayName": "Use Low End",
+ "description": "Whether to use the low end shader.",
+ "type": "Bool",
+ "defaultValue": false
+ },
{
"id": "applySpecularAA",
"displayName": "Apply Specular AA",
@@ -1175,6 +1182,14 @@
"file": "./StandardPBR_ForwardPass_EDS.shader",
"tag": "ForwardPass_EDS"
},
+ {
+ "file": "./StandardPBR_LowEndForward.shader",
+ "tag": "LowEndForward"
+ },
+ {
+ "file": "./StandardPBR_LowEndForward_EDS.shader",
+ "tag": "LowEndForward_EDS"
+ },
{
"file": "Shaders/Shadow/Shadowmap.shader",
"tag": "Shadowmap"
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
index d3bc72d162..bb4e4cdaab 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
@@ -10,6 +10,8 @@
*
*/
+#include "Atom/Features/ShaderQualityOptions.azsli"
+
#include "StandardPBR_Common.azsli"
// SRGs
@@ -306,13 +308,18 @@ ForwardPassOutputWithDepth StandardPbr_ForwardPassPS(VSOutput IN, bool isFrontFa
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace, depth);
+#ifdef UNIFIED_FORWARD_OUTPUT
+ OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
+ OUT.m_color.a = 1.0f;
+ OUT.m_depth = depth;
+#else
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
OUT.m_specularColor = lightingOutput.m_specularColor;
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_depth = depth;
-
+#endif
return OUT;
}
@@ -324,12 +331,16 @@ ForwardPassOutput StandardPbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace :
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace, depth);
+#ifdef UNIFIED_FORWARD_OUTPUT
+ OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
+ OUT.m_color.a = 1.0f;
+#else
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
OUT.m_specularColor = lightingOutput.m_specularColor;
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
-
+#endif
return OUT;
}
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
new file mode 100644
index 0000000000..a690cbf84a
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
@@ -0,0 +1,15 @@
+/*
+* 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.
+*
+*/
+
+#define QUALITY_LOW_END 1
+
+#include "StandardPBR_ForwardPass.azsl"
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.shader b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.shader
new file mode 100644
index 0000000000..19538e5db3
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.shader
@@ -0,0 +1,53 @@
+{
+ "Source" : "./StandardPBR_LowEndForward.azsl",
+
+ "DepthStencilState" :
+ {
+ "Depth" :
+ {
+ "Enable" : true,
+ "CompareFunc" : "GreaterEqual"
+ },
+ "Stencil" :
+ {
+ "Enable" : true,
+ "ReadMask" : "0x00",
+ "WriteMask" : "0xFF",
+ "FrontFace" :
+ {
+ "Func" : "Always",
+ "DepthFailOp" : "Keep",
+ "FailOp" : "Keep",
+ "PassOp" : "Replace"
+ },
+ "BackFace" :
+ {
+ "Func" : "Always",
+ "DepthFailOp" : "Keep",
+ "FailOp" : "Keep",
+ "PassOp" : "Replace"
+ }
+ }
+ },
+
+ "CompilerHints" : {
+ "DisableOptimizations" : false
+ },
+
+ "ProgramSettings":
+ {
+ "EntryPoints":
+ [
+ {
+ "name": "StandardPbr_ForwardPassVS",
+ "type": "Vertex"
+ },
+ {
+ "name": "StandardPbr_ForwardPassPS",
+ "type": "Fragment"
+ }
+ ]
+ },
+
+ "DrawList" : "lowEndForward"
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward_EDS.shader b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward_EDS.shader
new file mode 100644
index 0000000000..1b5f014d0e
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward_EDS.shader
@@ -0,0 +1,53 @@
+{
+ "Source" : "./StandardPBR_LowEndForward.azsl",
+
+ "DepthStencilState" :
+ {
+ "Depth" :
+ {
+ "Enable" : true,
+ "CompareFunc" : "GreaterEqual"
+ },
+ "Stencil" :
+ {
+ "Enable" : true,
+ "ReadMask" : "0x00",
+ "WriteMask" : "0xFF",
+ "FrontFace" :
+ {
+ "Func" : "Always",
+ "DepthFailOp" : "Keep",
+ "FailOp" : "Keep",
+ "PassOp" : "Replace"
+ },
+ "BackFace" :
+ {
+ "Func" : "Always",
+ "DepthFailOp" : "Keep",
+ "FailOp" : "Keep",
+ "PassOp" : "Replace"
+ }
+ }
+ },
+
+ "CompilerHints" : {
+ "DisableOptimizations" : false
+ },
+
+ "ProgramSettings":
+ {
+ "EntryPoints":
+ [
+ {
+ "name": "StandardPbr_ForwardPassVS",
+ "type": "Vertex"
+ },
+ {
+ "name": "StandardPbr_ForwardPassPS_EDS",
+ "type": "Fragment"
+ }
+ ]
+ },
+
+ "DrawList" : "lowEndForward"
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass b/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
index 31a8ed1879..3dcc90ac5c 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
@@ -148,22 +148,6 @@
},
"LoadAction": "Clear"
}
- },
- {
- "Name": "ScatterDistanceOutput",
- "SlotType": "Output",
- "ScopeAttachmentUsage": "RenderTarget",
- "LoadStoreAction": {
- "ClearValue": {
- "Value": [
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ]
- },
- "LoadAction": "Clear"
- }
}
],
"ImageAttachments": [
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/LightAdaptationParent.pass b/Gems/Atom/Feature/Common/Assets/Passes/LightAdaptationParent.pass
new file mode 100644
index 0000000000..3e804d23e2
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Passes/LightAdaptationParent.pass
@@ -0,0 +1,146 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "LightAdaptationParentTemplate",
+ "PassClass": "ParentPass",
+ "Slots": [
+ // Inputs...
+ {
+ "Name": "LightingInput",
+ "SlotType": "Input"
+ },
+ // SwapChain here is only used to reference the frame height and format
+ {
+ "Name": "SwapChainOutput",
+ "SlotType": "InputOutput"
+ },
+ // Outputs...
+ {
+ "Name": "Output",
+ "SlotType": "Output"
+ },
+ // Debug Outputs...
+ {
+ "Name": "LuminanceMipChainOutput",
+ "SlotType": "Output"
+ }
+ ],
+ "Connections": [
+ {
+ "LocalSlot": "Output",
+ "AttachmentRef": {
+ "Pass": "DisplayMapperPass",
+ "Attachment": "Output"
+ }
+ },
+ {
+ "LocalSlot": "LuminanceMipChainOutput",
+ "AttachmentRef": {
+ "Pass": "DownsampleLuminanceMipChain",
+ "Attachment": "MipChainInputOutput"
+ }
+ }
+ ],
+ "PassRequests": [
+ {
+ "Name": "DownsampleLuminanceMinAvgMax",
+ "TemplateName": "DownsampleLuminanceMinAvgMaxCS",
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "LightingInput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "DownsampleLuminanceMipChain",
+ "TemplateName": "DownsampleMipChainTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "MipChainInputOutput",
+ "AttachmentRef": {
+ "Pass": "DownsampleLuminanceMinAvgMax",
+ "Attachment": "Output"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "DownsampleMipChainPassData",
+ "ShaderAsset": {
+ "FilePath": "Shaders/PostProcessing/DownsampleMinAvgMaxCS.shader"
+ }
+ }
+ },
+ {
+ "Name": "EyeAdaptationPass",
+ "TemplateName": "EyeAdaptationTemplate",
+ "Enabled": false,
+ "Connections": [
+ {
+ "LocalSlot": "SceneLuminanceInput",
+ "AttachmentRef": {
+ "Pass": "DownsampleLuminanceMipChain",
+ "Attachment": "MipChainInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LookModificationTransformPass",
+ "TemplateName": "LookModificationTransformTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "LightingInput"
+ }
+ },
+ {
+ "LocalSlot": "EyeAdaptationDataInput",
+ "AttachmentRef": {
+ "Pass": "EyeAdaptationPass",
+ "Attachment": "EyeAdaptationDataInputOutput"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "DisplayMapperPass",
+ "TemplateName": "DisplayMapperTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "LookModificationTransformPass",
+ "Attachment": "Output"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/LowEndForward.pass b/Gems/Atom/Feature/Common/Assets/Passes/LowEndForward.pass
new file mode 100644
index 0000000000..4b865fcb6d
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Passes/LowEndForward.pass
@@ -0,0 +1,133 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "LowEndForwardPassTemplate",
+ "PassClass": "RasterPass",
+ "Slots": [
+ // Inputs...
+ {
+ "Name": "BRDFTextureInput",
+ "ShaderInputName": "m_brdfMap",
+ "SlotType": "Input",
+ "ScopeAttachmentUsage": "Shader"
+ },
+ {
+ "Name": "DirectionalLightShadowmap",
+ "ShaderInputName": "m_directionalLightShadowmap",
+ "SlotType": "Input",
+ "ScopeAttachmentUsage": "Shader",
+ "ImageViewDesc": {
+ "IsArray": 1
+ }
+ },
+ {
+ "Name": "ExponentialShadowmapDirectional",
+ "ShaderInputName": "m_directionalLightExponentialShadowmap",
+ "SlotType": "Input",
+ "ScopeAttachmentUsage": "Shader",
+ "ImageViewDesc": {
+ "IsArray": 1
+ }
+ },
+ {
+ "Name": "ProjectedShadowmap",
+ "ShaderInputName": "m_projectedShadowmaps",
+ "SlotType": "Input",
+ "ScopeAttachmentUsage": "Shader",
+ "ImageViewDesc": {
+ "IsArray": 1
+ }
+ },
+ {
+ "Name": "ExponentialShadowmapProjected",
+ "ShaderInputName": "m_projectedExponentialShadowmap",
+ "SlotType": "Input",
+ "ScopeAttachmentUsage": "Shader",
+ "ImageViewDesc": {
+ "IsArray": 1
+ }
+ },
+ {
+ "Name": "TileLightData",
+ "SlotType": "Input",
+ "ShaderInputName": "m_tileLightData",
+ "ScopeAttachmentUsage": "Shader"
+ },
+ {
+ "Name": "LightListRemapped",
+ "SlotType": "Input",
+ "ShaderInputName": "m_lightListRemapped",
+ "ScopeAttachmentUsage": "Shader"
+ },
+ // Input/Outputs...
+ {
+ "Name": "DepthStencilInputOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "DepthStencil"
+ },
+ // Outputs...
+ {
+ "Name": "LightingOutput",
+ "SlotType": "Output",
+ "ScopeAttachmentUsage": "RenderTarget",
+ "LoadStoreAction": {
+ "ClearValue": {
+ "Value": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ "LoadAction": "Clear"
+ }
+ }
+ ],
+ "ImageAttachments": [
+ {
+ "Name": "LightingAttachment",
+ "SizeSource": {
+ "Source": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ },
+ "MultisampleSource": {
+ "Pass": "This",
+ "Attachment": "DepthStencilInputOutput"
+ },
+ "ImageDescriptor": {
+ "Format": "R16G16B16A16_FLOAT",
+ "SharedQueueMask": "Graphics"
+ }
+ },
+ {
+ "Name": "BRDFTexture",
+ "Lifetime": "Imported",
+ "AssetRef": {
+ "FilePath": "Textures/BRDFTexture.attimage"
+ }
+ }
+ ],
+ "Connections": [
+ {
+ "LocalSlot": "LightingOutput",
+ "AttachmentRef": {
+ "Pass": "This",
+ "Attachment": "LightingAttachment"
+ }
+ },
+ {
+ "LocalSlot": "BRDFTextureInput",
+ "AttachmentRef": {
+ "Pass": "This",
+ "Attachment": "BRDFTexture"
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/LowEndPipeline.pass b/Gems/Atom/Feature/Common/Assets/Passes/LowEndPipeline.pass
new file mode 100644
index 0000000000..b19569fb9d
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Passes/LowEndPipeline.pass
@@ -0,0 +1,344 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "LowEndPipelineTemplate",
+ "PassClass": "ParentPass",
+ "Slots": [
+ {
+ "Name": "SwapChainOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ }
+ ],
+ "PassRequests": [
+ {
+ "Name": "MorphTargetPass",
+ "TemplateName": "MorphTargetPassTemplate"
+ },
+ {
+ "Name": "SkinningPass",
+ "TemplateName": "SkinningPassTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshOutputStream",
+ "AttachmentRef": {
+ "Pass": "MorphTargetPass",
+ "Attachment": "MorphTargetDeltaOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "DepthPrePass",
+ "TemplateName": "DepthMSAAParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LightCullingPass",
+ "TemplateName": "LightCullingParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "DepthMSAA",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "ShadowPass",
+ "TemplateName": "ShadowParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "ForwardPass",
+ "TemplateName": "LowEndForwardPassTemplate",
+ "Connections": [
+ // Inputs...
+ {
+ "LocalSlot": "DirectionalLightShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ExponentialShadowmapDirectional",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ExponentialShadowmapProjected",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ // Input/Outputs...
+ {
+ "LocalSlot": "DepthStencilInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "RasterPassData",
+ "DrawListTag": "lowEndForward",
+ "PipelineViewTag": "MainCamera",
+ "PassSrgAsset": {
+ "FilePath": "shaderlib/atom/features/pbr/forwardpasssrg.azsli:PassSrg"
+ }
+ }
+ },
+ {
+ "Name": "SkyBoxPass",
+ "TemplateName": "SkyBoxTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "SpecularInputOutput",
+ "AttachmentRef": {
+ "Pass": "ForwardPass",
+ "Attachment": "LightingOutput"
+ }
+ },
+ {
+ "LocalSlot": "SkyBoxDepth",
+ "AttachmentRef": {
+ "Pass": "ForwardPass",
+ "Attachment": "DepthStencilInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "MSAAResolvePass",
+ "TemplateName": "MSAAResolveColorTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "SkyBoxPass",
+ "Attachment": "SpecularInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "TransparentPass",
+ "TemplateName": "TransparentParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "DirectionalShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "DirectionalESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ {
+ "LocalSlot": "DepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "MSAAResolvePass",
+ "Attachment": "Output"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LightAdaptation",
+ "TemplateName": "LightAdaptationParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "LightingInput",
+ "AttachmentRef": {
+ "Pass": "TransparentPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "AuxGeomPass",
+ "TemplateName": "AuxGeomPassTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "ColorInputOutput",
+ "AttachmentRef": {
+ "Pass": "LightAdaptation",
+ "Attachment": "Output"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "RasterPassData",
+ "DrawListTag": "auxgeom",
+ "PipelineViewTag": "MainCamera"
+ }
+ },
+ {
+ "Name": "UIPass",
+ "TemplateName": "UIParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "AuxGeomPass",
+ "Attachment": "ColorInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "CopyToSwapChain",
+ "TemplateName": "FullscreenCopyTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "UIPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "Output",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass b/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
index dda120e164..40d6a51e77 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
@@ -315,13 +315,6 @@
"Attachment": "SpecularInputOutput"
}
},
- {
- "LocalSlot": "ReflectionInputOutput",
- "AttachmentRef": {
- "Pass": "ReflectionsPass",
- "Attachment": "ReflectionOutput"
- }
- },
{
"LocalSlot": "SkyBoxDepth",
"AttachmentRef": {
@@ -338,8 +331,8 @@
{
"LocalSlot": "ReflectionInput",
"AttachmentRef": {
- "Pass": "SkyBoxPass",
- "Attachment": "ReflectionInputOutput"
+ "Pass": "ReflectionsPass",
+ "Attachment": "ReflectionOutput"
}
},
{
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset b/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
index b83ab65ff2..2421d7fbe7 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
+++ b/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
@@ -483,6 +483,18 @@
{
"Name": "UIParentTemplate",
"Path": "Passes/UIParent.pass"
+ },
+ {
+ "Name": "LightAdaptationParentTemplate",
+ "Path": "Passes/LightAdaptationParent.pass"
+ },
+ {
+ "Name": "LowEndForwardPassTemplate",
+ "Path": "Passes/LowEndForward.pass"
+ },
+ {
+ "Name": "LowEndPipelineTemplate",
+ "Path": "Passes/LowEndPipeline.pass"
}
]
}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/PostProcessParent.pass b/Gems/Atom/Feature/Common/Assets/Passes/PostProcessParent.pass
index 37b1ee5c5a..36f7f1e985 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/PostProcessParent.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/PostProcessParent.pass
@@ -40,7 +40,7 @@
{
"LocalSlot": "Output",
"AttachmentRef": {
- "Pass": "DisplayMapperPass",
+ "Pass": "LightAdaptation",
"Attachment": "Output"
}
},
@@ -54,8 +54,8 @@
{
"LocalSlot": "LuminanceMipChainOutput",
"AttachmentRef": {
- "Pass": "DownsampleLuminanceMipChain",
- "Attachment": "MipChainInputOutput"
+ "Pass": "LightAdaptation",
+ "Attachment": "LuminanceMipChainOutput"
}
}
],
@@ -115,94 +115,16 @@
}
]
},
- // Everything before this point deals in raw lighting values
- // ---------------------------------------------------------
- // Everything after starts to map to values we see on screen
{
- "Name": "DownsampleLuminanceMinAvgMax",
- "TemplateName": "DownsampleLuminanceMinAvgMaxCS",
+ "Name": "LightAdaptation",
+ "TemplateName": "LightAdaptationParentTemplate",
"Connections": [
{
- "LocalSlot": "Input",
+ "LocalSlot": "LightingInput",
"AttachmentRef": {
"Pass": "BloomPass",
"Attachment": "InputOutput"
}
- }
- ]
- },
- {
- "Name": "DownsampleLuminanceMipChain",
- "TemplateName": "DownsampleMipChainTemplate",
- "Connections": [
- {
- "LocalSlot": "MipChainInputOutput",
- "AttachmentRef": {
- "Pass": "DownsampleLuminanceMinAvgMax",
- "Attachment": "Output"
- }
- }
- ],
- "PassData": {
- "$type": "DownsampleMipChainPassData",
- "ShaderAsset": {
- "FilePath": "Shaders/PostProcessing/DownsampleMinAvgMaxCS.shader"
- }
- }
- },
- {
- "Name": "EyeAdaptationPass",
- "TemplateName": "EyeAdaptationTemplate",
- "Enabled": false,
- "Connections": [
- {
- "LocalSlot": "SceneLuminanceInput",
- "AttachmentRef": {
- "Pass": "DownsampleLuminanceMipChain",
- "Attachment": "MipChainInputOutput"
- }
- }
- ]
- },
- {
- "Name": "LookModificationTransformPass",
- "TemplateName": "LookModificationTransformTemplate",
- "Enabled": true,
- "Connections": [
- {
- "LocalSlot": "Input",
- "AttachmentRef": {
- "Pass": "BloomPass",
- "Attachment": "InputOutput"
- }
- },
- {
- "LocalSlot": "EyeAdaptationDataInput",
- "AttachmentRef": {
- "Pass": "EyeAdaptationPass",
- "Attachment": "EyeAdaptationDataInputOutput"
- }
- },
- {
- "LocalSlot": "SwapChainOutput",
- "AttachmentRef": {
- "Pass": "Parent",
- "Attachment": "SwapChainOutput"
- }
- }
- ]
- },
- {
- "Name": "DisplayMapperPass",
- "TemplateName": "DisplayMapperTemplate",
- "Enabled": true,
- "Connections": [
- {
- "LocalSlot": "Input",
- "AttachmentRef": {
- "Pass": "LookModificationTransformPass",
- "Attachment": "Output"
- }
},
{
"LocalSlot": "SwapChainOutput",
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
index 57f442e5de..fb16271ba7 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
@@ -12,11 +12,6 @@
"SlotType": "InputOutput",
"ScopeAttachmentUsage": "RenderTarget"
},
- {
- "Name": "ReflectionInputOutput",
- "SlotType": "InputOutput",
- "ScopeAttachmentUsage": "RenderTarget"
- },
{
"Name": "SkyBoxDepth",
"SlotType": "InputOutput",
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/ForwardPassOutput.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/ForwardPassOutput.azsli
index acc215f1c9..5821deb3b1 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/ForwardPassOutput.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/ForwardPassOutput.azsli
@@ -10,6 +10,21 @@
*
*/
+#ifdef UNIFIED_FORWARD_OUTPUT
+
+struct ForwardPassOutput
+{
+ float4 m_color : SV_Target0;
+};
+
+struct ForwardPassOutputWithDepth
+{
+ float4 m_color : SV_Target0;
+ float m_depth : SV_Depth;
+};
+
+#else
+
struct ForwardPassOutput
{
float4 m_diffuseColor : SV_Target0; //!< RGB = Diffuse Lighting, A = Blend Alpha (for blended surfaces) OR A = special encoding of surfaceScatteringFactor, m_subsurfaceScatteringQuality, o_enableSubsurfaceScattering
@@ -30,3 +45,5 @@ struct ForwardPassOutputWithDepth
float4 m_normal : SV_Target4;
float m_depth : SV_Depth;
};
+
+#endif
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
new file mode 100644
index 0000000000..acc215f1c9
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
@@ -0,0 +1,32 @@
+/*
+* 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.
+*
+*/
+
+struct ForwardPassOutput
+{
+ float4 m_diffuseColor : SV_Target0; //!< RGB = Diffuse Lighting, A = Blend Alpha (for blended surfaces) OR A = special encoding of surfaceScatteringFactor, m_subsurfaceScatteringQuality, o_enableSubsurfaceScattering
+ float4 m_specularColor : SV_Target1; //!< RGB = Specular Lighting, A = Unused
+ float4 m_albedo : SV_Target2; //!< RGB = Surface albedo pre-multiplied by other factors that will be multiplied later by diffuse GI, A = specularOcclusion
+ float4 m_specularF0 : SV_Target3; //!< RGB = Specular F0, A = roughness
+ float4 m_normal : SV_Target4; //!< RGB10 = EncodeNormalSignedOctahedron(worldNormal), A2 = multiScatterCompensationEnabled
+};
+
+struct ForwardPassOutputWithDepth
+{
+ // See above for descriptions of special encodings
+
+ float4 m_diffuseColor : SV_Target0;
+ float4 m_specularColor : SV_Target1;
+ float4 m_albedo : SV_Target2;
+ float4 m_specularF0 : SV_Target3;
+ float4 m_normal : SV_Target4;
+ float m_depth : SV_Depth;
+};
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
new file mode 100644
index 0000000000..907e67ada5
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
@@ -0,0 +1,24 @@
+/*
+* 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
+
+// These are a list of quality options to specify as macros (either in azsl or in shader files)
+//
+// QUALITY_LOW_END
+
+#ifdef QUALITY_LOW_END
+
+#define UNIFIED_FORWARD_OUTPUT 1
+
+#endif
+
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
index 92f8c3f638..865d657d85 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
@@ -53,13 +53,22 @@ PSOutput MainPS(VSOutput IN)
uint width, height, samples;
PassSrg::m_reflection.GetDimensions(width, height, samples);
+ float nonZeroSamples = 0.0f;
for (uint sampleIndex = 0; sampleIndex < samples; ++sampleIndex)
{
- reflection += PassSrg::m_reflection.Load(IN.m_position.xy, sampleIndex).rgb;
+ float3 reflectionSample = PassSrg::m_reflection.Load(IN.m_position.xy, sampleIndex).rgb;
+ if(any(reflectionSample))
+ {
+ reflection += reflectionSample;
+ nonZeroSamples += 1.0f;
+ }
+ }
+
+ if(nonZeroSamples != 0.0f)
+ {
+ reflection /= nonZeroSamples;
}
- reflection /= samples;
-
PSOutput OUT;
OUT.m_color = float4(reflection, 1.0f);
return OUT;
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
index 1ee30a4f98..a7de426374 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
@@ -102,7 +102,6 @@ float3 GetCubemapCoords(float3 original)
struct PSOutput
{
float4 m_specular : SV_Target0;
- float4 m_reflection : SV_Target1;
};
PSOutput MainPS(VSOutput input)
@@ -163,6 +162,5 @@ PSOutput MainPS(VSOutput input)
PSOutput OUT;
OUT.m_specular = float4(color, 1.0);
- OUT.m_reflection = float4(color, 1.0);
return OUT;
}
diff --git a/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake b/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
index f14fb4f4a0..6902d456ff 100644
--- a/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
+++ b/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
@@ -52,6 +52,8 @@ set(FILES
Materials/Types/StandardPBR_ForwardPass_EDS.shader
Materials/Types/StandardPBR_HandleOpacityDoubleSided.lua
Materials/Types/StandardPBR_HandleOpacityMode.lua
+ Materials/Types/StandardPBR_LowEndForward.azsl
+ Materials/Types/StandardPBR_LowEndForward.shader
Materials/Types/StandardPBR_ParallaxState.lua
Materials/Types/StandardPBR_Roughness.lua
Materials/Types/StandardPBR_ShaderEnable.lua
@@ -116,6 +118,7 @@ set(FILES
Passes/DiffuseProbeGridBlendDistance.pass
Passes/DiffuseProbeGridBlendIrradiance.pass
Passes/DiffuseProbeGridBorderUpdate.pass
+ Passes/DiffuseProbeGridClassification.pass
Passes/DiffuseProbeGridDownsample.pass
Passes/DiffuseProbeGridRayTracing.pass
Passes/DiffuseProbeGridRelocation.pass
@@ -144,6 +147,7 @@ set(FILES
Passes/FullscreenCopy.pass
Passes/FullscreenOutputOnly.pass
Passes/ImGui.pass
+ Passes/LightAdaptationParent.pass
Passes/LightCulling.pass
Passes/LightCullingHeatmap.pass
Passes/LightCullingParent.pass
@@ -152,6 +156,8 @@ set(FILES
Passes/LightCullingTilePrepareMSAA.pass
Passes/LookModificationComposite.pass
Passes/LookModificationTransform.pass
+ Passes/LowEndForward.pass
+ Passes/LowEndPipeline.pass
Passes/LuminanceHeatmap.pass
Passes/LuminanceHistogramGenerator.pass
Passes/MainPipeline.pass
@@ -179,8 +185,10 @@ set(FILES
Passes/ReflectionScreenSpace.pass
Passes/ReflectionScreenSpaceBlur.pass
Passes/ReflectionScreenSpaceBlurHorizontal.pass
+ Passes/ReflectionScreenSpaceBlurMobile.pass
Passes/ReflectionScreenSpaceBlurVertical.pass
Passes/ReflectionScreenSpaceComposite.pass
+ Passes/ReflectionScreenSpaceMobile.pass
Passes/ReflectionScreenSpaceTrace.pass
Passes/Reflections_nomsaa.pass
Passes/ShadowParent.pass
@@ -205,6 +213,7 @@ set(FILES
ShaderLib/Atom/Features/IndirectRendering.azsli
ShaderLib/Atom/Features/MatrixUtility.azsli
ShaderLib/Atom/Features/ParallaxMapping.azsli
+ ShaderLib/Atom/Features/ShaderQualityOptions.azsli
ShaderLib/Atom/Features/SphericalHarmonicsUtility.azsli
ShaderLib/Atom/Features/SrgSemantics.azsli
ShaderLib/Atom/Features/ColorManagement/TransformColor.azsli
@@ -234,6 +243,7 @@ set(FILES
ShaderLib/Atom/Features/PBR/Hammersley.azsli
ShaderLib/Atom/Features/PBR/LightingOptions.azsli
ShaderLib/Atom/Features/PBR/LightingUtils.azsli
+ ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
ShaderLib/Atom/Features/PBR/TransparentPassSrg.azsli
ShaderLib/Atom/Features/PBR/Lighting/DualSpecularLighting.azsli
ShaderLib/Atom/Features/PBR/Lighting/EnhancedLighting.azsli
From 24aa0f852179f94bce8ae354b66c6804628bd1b7 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Fri, 7 May 2021 20:56:40 -0700
Subject: [PATCH 026/330] skybox pass separation for single vs double output
---
.../Common/Assets/Passes/OpaqueParent.pass | 13 ++++--
.../Assets/Passes/PassTemplates.azasset | 4 ++
.../Feature/Common/Assets/Passes/SkyBox.pass | 5 +++
.../Assets/Passes/SkyBox_TwoOutputs.pass | 43 +++++++++++++++++++
.../Reflections/ReflectionComposite.azsl | 15 ++-----
.../Common/Assets/Shaders/SkyBox/SkyBox.azsl | 11 +++++
.../Shaders/SkyBox/SkyBox_TwoOutputs.azsl | 15 +++++++
.../Shaders/SkyBox/SkyBox_TwoOutputs.shader | 22 ++++++++++
8 files changed, 113 insertions(+), 15 deletions(-)
create mode 100644 Gems/Atom/Feature/Common/Assets/Passes/SkyBox_TwoOutputs.pass
create mode 100644 Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
create mode 100644 Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.shader
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass b/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
index 40d6a51e77..a691fe2534 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/OpaqueParent.pass
@@ -305,7 +305,7 @@
},
{
"Name": "SkyBoxPass",
- "TemplateName": "SkyBoxTemplate",
+ "TemplateName": "SkyBoxTwoOutputsTemplate",
"Enabled": true,
"Connections": [
{
@@ -315,6 +315,13 @@
"Attachment": "SpecularInputOutput"
}
},
+ {
+ "LocalSlot": "ReflectionInputOutput",
+ "AttachmentRef": {
+ "Pass": "ReflectionsPass",
+ "Attachment": "ReflectionOutput"
+ }
+ },
{
"LocalSlot": "SkyBoxDepth",
"AttachmentRef": {
@@ -331,8 +338,8 @@
{
"LocalSlot": "ReflectionInput",
"AttachmentRef": {
- "Pass": "ReflectionsPass",
- "Attachment": "ReflectionOutput"
+ "Pass": "SkyBoxPass",
+ "Attachment": "ReflectionInputOutput"
}
},
{
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset b/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
index 2421d7fbe7..c56e8932b1 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
+++ b/Gems/Atom/Feature/Common/Assets/Passes/PassTemplates.azasset
@@ -92,6 +92,10 @@
"Name": "SkyBoxTemplate",
"Path": "Passes/SkyBox.pass"
},
+ {
+ "Name": "SkyBoxTwoOutputsTemplate",
+ "Path": "Passes/SkyBox_TwoOutputs.pass"
+ },
{
"Name": "UIPassTemplate",
"Path": "Passes/UI.pass"
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
index fb16271ba7..57f442e5de 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
@@ -12,6 +12,11 @@
"SlotType": "InputOutput",
"ScopeAttachmentUsage": "RenderTarget"
},
+ {
+ "Name": "ReflectionInputOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ },
{
"Name": "SkyBoxDepth",
"SlotType": "InputOutput",
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox_TwoOutputs.pass b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox_TwoOutputs.pass
new file mode 100644
index 0000000000..0ed7b39288
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox_TwoOutputs.pass
@@ -0,0 +1,43 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "SkyBoxTwoOutputsTemplate",
+ "PassClass": "FullScreenTriangle",
+ "Slots": [
+ {
+ "Name": "SpecularInputOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ },
+ {
+ "Name": "ReflectionInputOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ },
+ {
+ "Name": "SkyBoxDepth",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "DepthStencil"
+ }
+ ],
+ "PassData": {
+ "$type": "FullscreenTrianglePassData",
+ "ShaderAsset": {
+ "FilePath": "shaders/skybox/skybox_twooutputs.shader"
+ },
+ "PipelineViewTag": "MainCamera",
+ "ShaderDataMappings": {
+ "FloatMappings": [
+ {
+ "Name": "m_sunIntensityMultiplier",
+ "Value": 1.0
+ }
+ ]
+ }
+ }
+ }
+ }
+}
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
index 865d657d85..92f8c3f638 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/Reflections/ReflectionComposite.azsl
@@ -53,22 +53,13 @@ PSOutput MainPS(VSOutput IN)
uint width, height, samples;
PassSrg::m_reflection.GetDimensions(width, height, samples);
- float nonZeroSamples = 0.0f;
for (uint sampleIndex = 0; sampleIndex < samples; ++sampleIndex)
{
- float3 reflectionSample = PassSrg::m_reflection.Load(IN.m_position.xy, sampleIndex).rgb;
- if(any(reflectionSample))
- {
- reflection += reflectionSample;
- nonZeroSamples += 1.0f;
- }
- }
-
- if(nonZeroSamples != 0.0f)
- {
- reflection /= nonZeroSamples;
+ reflection += PassSrg::m_reflection.Load(IN.m_position.xy, sampleIndex).rgb;
}
+ reflection /= samples;
+
PSOutput OUT;
OUT.m_color = float4(reflection, 1.0f);
return OUT;
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
index a7de426374..4b3e9536b7 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
@@ -10,6 +10,11 @@
*
*/
+// Static Options:
+//
+// SKYBOX_TWO_OUTPUTS - Allows the skybox to render to two rendertargets instead of one
+
+
#include
#include
#include
@@ -102,6 +107,9 @@ float3 GetCubemapCoords(float3 original)
struct PSOutput
{
float4 m_specular : SV_Target0;
+#ifdef SKYBOX_TWO_OUTPUTS
+ float4 m_reflection : SV_Target1;
+#endif
};
PSOutput MainPS(VSOutput input)
@@ -162,5 +170,8 @@ PSOutput MainPS(VSOutput input)
PSOutput OUT;
OUT.m_specular = float4(color, 1.0);
+#ifdef SKYBOX_TWO_OUTPUTS
+ OUT.m_reflection = float4(color, 1.0);
+#endif
return OUT;
}
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
new file mode 100644
index 0000000000..99d7b45e4c
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
@@ -0,0 +1,15 @@
+/*
+* 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.
+*
+*/
+
+#define SKYBOX_TWO_OUTPUTS
+
+#include "SkyBox.azsl"
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.shader b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.shader
new file mode 100644
index 0000000000..ec80d4a20e
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.shader
@@ -0,0 +1,22 @@
+{
+ "Source" : "SkyBox_TwoOutputs",
+
+ "DepthStencilState" : {
+ "Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
+ },
+
+ "ProgramSettings":
+ {
+ "EntryPoints":
+ [
+ {
+ "name": "MainVS",
+ "type": "Vertex"
+ },
+ {
+ "name": "MainPS",
+ "type": "Fragment"
+ }
+ ]
+ }
+}
From cb245730a1f214c4891817b11bb617166f73c7b7 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Sun, 9 May 2021 23:01:24 -0700
Subject: [PATCH 027/330] work in progress
---
.../Types/StandardPBR_LowEndForward.azsl | 2 ++
.../Feature/Common/Assets/Passes/Forward.pass | 20 -------------------
.../Feature/Common/Assets/Passes/SkyBox.pass | 5 -----
.../Shaders/SkyBox/SkyBox_TwoOutputs.azsl | 2 ++
.../atom_feature_common_asset_files.cmake | 4 ++++
5 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
index a690cbf84a..c87faffcbe 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_LowEndForward.azsl
@@ -10,6 +10,8 @@
*
*/
+// NOTE: This file is a temporary workaround until .shader files can #define macros for their .azsl files
+
#define QUALITY_LOW_END 1
#include "StandardPBR_ForwardPass.azsl"
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass b/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
index 3dcc90ac5c..b66e3bb4e1 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/Forward.pass
@@ -222,19 +222,6 @@
"AssetRef": {
"FilePath": "Textures/BRDFTexture.attimage"
}
- },
- {
- "Name": "ScatterDistanceImage",
- "SizeSource": {
- "Source": {
- "Pass": "Parent",
- "Attachment": "SwapChainOutput"
- }
- },
- "ImageDescriptor": {
- "Format": "R11G11B10_FLOAT",
- "SharedQueueMask": "Graphics"
- }
}
],
"Connections": [
@@ -279,13 +266,6 @@
"Pass": "This",
"Attachment": "BRDFTexture"
}
- },
- {
- "LocalSlot": "ScatterDistanceOutput",
- "AttachmentRef": {
- "Pass": "This",
- "Attachment": "ScatterDistanceImage"
- }
}
]
}
diff --git a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
index 57f442e5de..fb16271ba7 100644
--- a/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
+++ b/Gems/Atom/Feature/Common/Assets/Passes/SkyBox.pass
@@ -12,11 +12,6 @@
"SlotType": "InputOutput",
"ScopeAttachmentUsage": "RenderTarget"
},
- {
- "Name": "ReflectionInputOutput",
- "SlotType": "InputOutput",
- "ScopeAttachmentUsage": "RenderTarget"
- },
{
"Name": "SkyBoxDepth",
"SlotType": "InputOutput",
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
index 99d7b45e4c..feacd2f44f 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox_TwoOutputs.azsl
@@ -10,6 +10,8 @@
*
*/
+// NOTE: This file is a temporary workaround until .shader files can #define macros for their .azsl files
+
#define SKYBOX_TWO_OUTPUTS
#include "SkyBox.azsl"
diff --git a/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake b/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
index 6902d456ff..7419c1e669 100644
--- a/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
+++ b/Gems/Atom/Feature/Common/Assets/atom_feature_common_asset_files.cmake
@@ -54,6 +54,7 @@ set(FILES
Materials/Types/StandardPBR_HandleOpacityMode.lua
Materials/Types/StandardPBR_LowEndForward.azsl
Materials/Types/StandardPBR_LowEndForward.shader
+ Materials/Types/StandardPBR_LowEndForward_EDS.shader
Materials/Types/StandardPBR_ParallaxState.lua
Materials/Types/StandardPBR_Roughness.lua
Materials/Types/StandardPBR_ShaderEnable.lua
@@ -194,6 +195,7 @@ set(FILES
Passes/ShadowParent.pass
Passes/Skinning.pass
Passes/SkyBox.pass
+ Passes/SkyBox_TwoOutputs.pass
Passes/SMAA1xApplyLinearHDRColor.pass
Passes/SMAA1xApplyPerceptualColor.pass
Passes/SMAABlendingWeightCalculation.pass
@@ -483,4 +485,6 @@ set(FILES
Shaders/SkinnedMesh/LinearSkinningPassSRG.azsli
Shaders/SkyBox/SkyBox.azsl
Shaders/SkyBox/SkyBox.shader
+ Shaders/SkyBox/SkyBox_TwoOutputs.azsl
+ Shaders/SkyBox/SkyBox_TwoOutputs.shader
)
From d1eae23347c095333ed5c83a934a407de192d9c2 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Mon, 10 May 2021 17:26:46 +0100
Subject: [PATCH 028/330] reduced cursor size.
---
.../Components/FancyDocking.cpp | 2 +-
.../Components/Widgets/TabWidget.cpp | 4 +-
.../img/UI20/Cursors/Grab_release.svg | 40 +++++++++----------
.../Components/img/UI20/Cursors/Grabbing.svg | 40 +++++++++++--------
4 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
index b89a220b1a..1a7512a4fc 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FancyDocking.cpp
@@ -160,7 +160,7 @@ namespace AzQtComponents
QObject::connect(m_dropZoneHoverFadeInTimer, &QTimer::timeout, this, &FancyDocking::onDropZoneHoverFadeInUpdate);
m_dropZoneHoverFadeInTimer->setInterval(g_FancyDockingConstants.dropZoneHoverFadeUpdateIntervalMS);
QIcon dragIcon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
- m_dragCursor = QCursor(dragIcon.pixmap(32), 10, 5);
+ m_dragCursor = QCursor(dragIcon.pixmap(16), 5, 2);
}
FancyDocking::~FancyDocking()
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
index a0006d7979..48fb47d7e6 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp
@@ -422,10 +422,10 @@ namespace AzQtComponents
AzQtComponents::Style::addClass(this, g_emptyStyleClass);
QIcon icon = QIcon(QStringLiteral(":/Cursors/Grab_release.svg"));
- m_hoverCursor = QCursor(icon.pixmap(32), 10, 5);
+ m_hoverCursor = QCursor(icon.pixmap(16), 5, 2);
icon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
- m_dragCursor = QCursor(icon.pixmap(32), 10, 5);
+ m_dragCursor = QCursor(icon.pixmap(16), 5, 2);
this->setCursor(m_hoverCursor);
}
diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
index c0da9b802f..ad89e7d1b1 100644
--- a/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
+++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cursors/Grab_release.svg
@@ -1,5 +1,5 @@
-
+
From 92ef82f9331dee683f3d4df7869c27d913321420 Mon Sep 17 00:00:00 2001
From: pereslav
Date: Mon, 10 May 2021 19:52:23 +0100
Subject: [PATCH 029/330] Added handling parented net entities
---
.../EntityReplicationManager.cpp | 6 ++---
.../NetworkEntity/NetworkEntityManager.cpp | 26 ++++++++++++++++++-
.../Pipeline/NetworkPrefabProcessor.cpp | 4 +++
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp
index 74bdcd5cf0..64eb3fcc6a 100644
--- a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp
+++ b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/EntityReplicationManager.cpp
@@ -550,10 +550,10 @@ namespace Multiplayer
{
replicatorEntity = entityList[0];
}
-
- AZ_Assert(replicatorEntity != nullptr, "Failed to create entity from prefab %s", prefabEntityId.m_prefabName.GetCStr());
- if (replicatorEntity == nullptr)
+ else
{
+ AZ_Assert(false, "There should be exactly one created entity out of prefab %s, index %d. Got: %d",
+ prefabEntityId.m_prefabName.GetCStr(), prefabEntityId.m_entityOffset, entityList.size());
return false;
}
}
diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp
index ce55f66caa..3bcd613d8b 100644
--- a/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp
+++ b/Gems/Multiplayer/Code/Source/NetworkEntity/NetworkEntityManager.cpp
@@ -334,15 +334,39 @@ namespace Multiplayer
const AzFramework::Spawnable::EntityList& entities = spawnable.GetEntities();
size_t entitiesSize = entities.size();
+ using EntityIdMap = AZStd::unordered_map;
+ EntityIdMap originalToCloneIdMap;
+
for (size_t i = 0; i < entitiesSize; ++i)
{
- AZ::Entity* clone = serializeContext->CloneObject(entities[i].get());
+ AZ::Entity* originalEntity = entities[i].get();
+ AZ::Entity* clone = serializeContext->CloneObject(originalEntity);
AZ_Assert(clone != nullptr, "Failed to clone spawnable entity.");
+
clone->SetId(AZ::Entity::MakeId());
+ originalToCloneIdMap[originalEntity->GetId()] = clone->GetId();
+
NetBindComponent* netBindComponent = clone->FindComponent();
if (netBindComponent != nullptr)
{
+ // Update TransformComponent parent Id. It is guaranteed for the entities array to be sorted from parent->child here.
+ auto* transformComponent = clone->FindComponent();
+ AZ::EntityId parentId = transformComponent->GetParentId();
+ if (parentId.IsValid())
+ {
+ auto it = originalToCloneIdMap.find(parentId);
+ if (it != originalToCloneIdMap.end())
+ {
+ transformComponent->SetParentRelative(it->second);
+ }
+ else
+ {
+ AZ_Warning("NetworkEntityManager", false, "Entity %s doesn't have the parent entity %s present in network.spawnable",
+ clone->GetName().c_str(), parentId.ToString().data());
+ }
+ }
+
PrefabEntityId prefabEntityId;
prefabEntityId.m_prefabName = m_networkPrefabLibrary.GetPrefabNameFromAssetId(spawnable.GetId());
prefabEntityId.m_entityOffset = aznumeric_cast(i);
diff --git a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
index 4962d16fb4..56201bd5fd 100644
--- a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
+++ b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp
@@ -59,6 +59,7 @@ namespace Multiplayer
return result;
}
+
void NetworkPrefabProcessor::ProcessPrefab(PrefabProcessorContext& context, AZStd::string_view prefabName, PrefabDom& prefab)
{
using namespace AzToolsFramework::Prefab;
@@ -175,6 +176,9 @@ namespace Multiplayer
(*it)->InvalidateDependencies();
(*it)->EvaluateDependencies();
}
+
+ SpawnableUtils::SortEntitiesByTransformHierarchy(*networkSpawnable);
+
context.GetProcessedObjects().push_back(AZStd::move(object));
}
else
From 89bb0edb3082b40de3c9b3737ad31e845b4cdf75 Mon Sep 17 00:00:00 2001
From: Chris Santora
Date: Mon, 10 May 2021 23:04:56 -0700
Subject: [PATCH 030/330] ATOM-15518 Change Multilayer PBR To Use Lerp Base
Blending
Changed to lerp-based blending, with an implicit base layer.
Renamed some variables to be more clear (blendWeight instead of blendMask, since the weights could come from vertex colors instead of a texture).
Updated DefaultBlendMask_layers.png to better suit the new layering model. It has a black background and overlapping R, G, and B areas.
Updated some of the test materials UV transforms to better fit the new DefaultBlendMask_layers image.
Added a new test object, which is a plane that has painted vertices.
Note that I updated test criteria in AtomSampleViewer to account for these changes as well.
---
.../Types/StandardMultilayerPBR.materialtype | 2 +-
.../Types/StandardMultilayerPBR_Common.azsli | 77 +++++++++++--------
...tandardMultilayerPBR_DepthPass_WithPS.azsl | 2 +-
.../StandardMultilayerPBR_ForwardPass.azsl | 39 +++++-----
...tandardMultilayerPBR_Shadowmap_WithPS.azsl | 2 +-
.../Textures/DefaultBlendMask_layers.png | 4 +-
.../001_ManyFeatures.material | 12 ++-
.../002_ParallaxPdo.material | 3 +-
...aterial => 003_Debug_BlendSource.material} | 2 +-
.../TestData/Objects/PaintedPlane.fbx | 3 +
10 files changed, 86 insertions(+), 60 deletions(-)
rename Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/{003_Debug_BlendMaskValues.material => 003_Debug_BlendSource.material} (86%)
create mode 100644 Gems/Atom/TestData/TestData/Objects/PaintedPlane.fbx
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
index e2119dcf12..3e95846b6e 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
@@ -204,7 +204,7 @@
"displayName": "Debug Draw Mode",
"description": "Enables various debug view features.",
"type": "Enum",
- "enumValues": [ "None", "BlendMaskValues", "DepthMaps" ],
+ "enumValues": [ "None", "BlendSource", "DepthMaps" ],
"defaultValue": "None",
"connection": {
"type": "ShaderOption",
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
index ba0eaf2ac1..f1f6d90e14 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
@@ -42,7 +42,7 @@ COMMON_SRG_INPUTS_PARALLAX(prefix)
ShaderResourceGroup MaterialSrg : SRG_PerMaterial
{
- Texture2D m_blendMaskTexture;
+ Texture2D m_blendMaskTexture;
uint m_blendMaskUvIndex;
// Auto-generate material SRG fields for common inputs for each layer
@@ -113,7 +113,7 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
// ------ Shader Options ----------------------------------------
-enum class DebugDrawMode { None, BlendMaskValues, DepthMaps };
+enum class DebugDrawMode { None, BlendSource, DepthMaps };
option DebugDrawMode o_debugDrawMode;
enum class BlendMaskSource { TextureMap, VertexColors, Fallback };
@@ -127,6 +127,10 @@ option bool o_blendMask_isBound;
// ------ Blend Utilities ----------------------------------------
+// This is mainly used to pass extra data to the GetDepth callback function during the parallax depth search.
+// But since we have it, we use it in some other functions as well rather than passing it around.
+static float3 s_blendMaskFromVertexStream;
+
//! Returns the BlendMaskSource that will actually be used when rendering (not necessarily the same BlendMaskSource specified by the user)
BlendMaskSource GetFinalBlendMaskSource()
{
@@ -151,40 +155,63 @@ BlendMaskSource GetFinalBlendMaskSource()
}
}
-//! Return the final blend mask values to be used for rendering, based on the available data and configuration.
-float3 GetBlendMaskValues(float2 uv, float3 vertexBlendMask)
+//! Return the raw blend source values directly from the blend mask or vertex colors, depending on the available data and configuration.
+//! layer1 is an implicit base layer
+//! layer2 is weighted by r
+//! layer3 is weighted by g
+//! b is reserved for perhaps a dedicated puddle layer
+float3 GetBlendSourceValues(float2 uv)
{
- float3 blendMaskValues;
+ float3 blendSourceValues = float3(0,0,0);
switch(GetFinalBlendMaskSource())
{
case BlendMaskSource::TextureMap:
- blendMaskValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, uv).rgb;
+ blendSourceValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, uv).rgb;
break;
case BlendMaskSource::VertexColors:
- blendMaskValues = vertexBlendMask;
- break;
- case BlendMaskSource::Fallback:
- blendMaskValues = float3(1,1,1);
+ blendSourceValues = s_blendMaskFromVertexStream;
break;
}
- blendMaskValues = blendMaskValues / (blendMaskValues.r + blendMaskValues.g + blendMaskValues.b);
+ return blendSourceValues;
+}
+
+//! Return the final blend mask values to be used for rendering, based on the available data and configuration.
+//! @return The blend weights for each layer.
+//! Even though layer1 not explicitly specified in the blend source data, it is explicitly included with the returned values.
+//! layer1 = r
+//! layer2 = g
+//! layer3 = b
+float3 GetBlendWeights(float2 uv)
+{
+ float3 blendSourceValues = GetBlendSourceValues(uv);
- return blendMaskValues;
+ // Calculate blend weights such that multiplying and adding them with layer data is equivalent
+ // to lerping between each layer.
+ // final = lerp(final, layer1, blendWeights.r)
+ // final = lerp(final, layer2, blendWeights.g)
+ // final = lerp(final, layer3, blendWeights.b)
+
+ float3 blendWeights;
+ blendWeights.b = blendSourceValues.g;
+ blendWeights.g = (1.0 - blendSourceValues.g) * blendSourceValues.r;
+ blendWeights.r = (1.0 - blendSourceValues.g) * (1.0 - blendSourceValues.r);
+
+ return blendWeights;
}
-float BlendLayers(float layer1, float layer2, float layer3, float3 blendMaskValues)
+float BlendLayers(float layer1, float layer2, float layer3, float3 blendWeights)
{
- return dot(float3(layer1, layer2, layer3), blendMaskValues);
+ return dot(float3(layer1, layer2, layer3), blendWeights);
}
-float2 BlendLayers(float2 layer1, float2 layer2, float2 layer3, float3 blendMaskValues)
+float2 BlendLayers(float2 layer1, float2 layer2, float2 layer3, float3 blendWeights)
{
- return layer1 * blendMaskValues.r + layer2 * blendMaskValues.g + layer3 * blendMaskValues.b;
+ return layer1 * blendWeights.r + layer2 * blendWeights.g + layer3 * blendWeights.b;
}
-float3 BlendLayers(float3 layer1, float3 layer2, float3 layer3, float3 blendMaskValues)
+float3 BlendLayers(float3 layer1, float3 layer2, float3 layer3, float3 blendWeights)
{
- return layer1 * blendMaskValues.r + layer2 * blendMaskValues.g + layer3 * blendMaskValues.b;
+ return layer1 * blendWeights.r + layer2 * blendWeights.g + layer3 * blendWeights.b;
}
// ------ Parallax Utilities ----------------------------------------
@@ -203,16 +230,6 @@ bool ShouldHandleParallaxInDepthShaders()
return ShouldHandleParallax() && o_parallax_enablePixelDepthOffset;
}
-// These static values are used to pass extra data to the GetDepth callback function during the parallax depth search.
-static float3 s_blendMaskFromVertexStream;
-
-//! Setup static variables that are needed by the GetDepth callback function
-//! @param vertexBlendMask the blend mask values from the vertex input stream.
-void GetDepth_Setup(float3 vertexBlendMask)
-{
- s_blendMaskFromVertexStream = vertexBlendMask;
-}
-
// Callback function for ParallaxMapping.azsli
DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
{
@@ -260,8 +277,8 @@ DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
// Note, when the blend source is BlendMaskSource::VertexColors, parallax will not be able to blend correctly between layers. It will end up using the same blend mask values
// for every UV position when searching for the intersection. This leads to smearing artifacts at the transition point, but these won't be so noticeable as long as
// you have a small depth factor relative to the size of the blend transition.
- float3 blendMaskValues = GetBlendMaskValues(uv, s_blendMaskFromVertexStream);
+ float3 blendWeights = GetBlendWeights(uv);
- float depth = BlendLayers(layerDepthValues.r, layerDepthValues.g, layerDepthValues.b, blendMaskValues);
+ float depth = BlendLayers(layerDepthValues.r, layerDepthValues.g, layerDepthValues.b, blendWeights);
return DepthResultAbsolute(depth);
}
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.azsl
index ae156d7313..178deca8a2 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.azsl
@@ -108,7 +108,7 @@ PSDepthOutput MainPS(VSDepthOutput IN, bool isFrontFace : SV_IsFrontFace)
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, float3(0, 0, 0) };
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents, 1);
- GetDepth_Setup(IN.m_blendMask);
+ s_blendMaskFromVertexStream = IN.m_blendMask;
float depth;
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
index a83ea629e4..a690c0569a 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
@@ -134,6 +134,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
{
depth = IN.m_position.z;
+ s_blendMaskFromVertexStream = IN.m_blendMask;
+
// ------- Tangents & Bitangets -------
// We support two UV streams, but only a single stream of tangent/bitangent. So for UV[1+] we generated the tangent/bitangent in screen-space.
@@ -156,15 +158,14 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ------- Debug Modes -------
- if(o_debugDrawMode == DebugDrawMode::BlendMaskValues)
+ if(o_debugDrawMode == DebugDrawMode::BlendSource)
{
- float3 blendMaskValues = GetBlendMaskValues(IN.m_uv[MaterialSrg::m_blendMaskUvIndex], IN.m_blendMask);
- return DebugOutput(blendMaskValues);
+ float3 blendSource = GetBlendSourceValues(IN.m_uv[MaterialSrg::m_blendMaskUvIndex]);
+ return DebugOutput(blendSource);
}
if(o_debugDrawMode == DebugDrawMode::DepthMaps)
{
- GetDepth_Setup(IN.m_blendMask);
float depth = GetNormalizedDepth(-MaterialSrg::m_displacementMax, -MaterialSrg::m_displacementMin, IN.m_uv[MaterialSrg::m_parallaxUvIndex], float2(0,0), float2(0,0));
return DebugOutput(float3(depth,depth,depth));
}
@@ -176,8 +177,6 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// Parallax mapping's non uniform uv transformations break screen space subsurface scattering, disable it when subsurface scatteirng is enabled
if(ShouldHandleParallax())
{
- GetDepth_Setup(IN.m_blendMask);
-
float3x3 uvMatrix = MaterialSrg::m_parallaxUvIndex == 0 ? MaterialSrg::m_uvMatrix : CreateIdentity3x3();
float3x3 uvMatrixInverse = MaterialSrg::m_parallaxUvIndex == 0 ? MaterialSrg::m_uvMatrixInverse : CreateIdentity3x3();
@@ -218,13 +217,13 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ------- Calculate Layer Blend Mask Values -------
// Now that any parallax has been calculated, we calculate the blend factors for any layers that are impacted by the parallax.
- float3 blendMaskValues = GetBlendMaskValues(IN.m_uv[MaterialSrg::m_blendMaskUvIndex], IN.m_blendMask);
+ float3 blendWeights = GetBlendWeights(IN.m_uv[MaterialSrg::m_blendMaskUvIndex]);
// ------- Normal -------
- float3 layer1_normalFactor = MaterialSrg::m_layer1_m_normalFactor * blendMaskValues.r;
- float3 layer2_normalFactor = MaterialSrg::m_layer2_m_normalFactor * blendMaskValues.g;
- float3 layer3_normalFactor = MaterialSrg::m_layer3_m_normalFactor * blendMaskValues.b;
+ float3 layer1_normalFactor = MaterialSrg::m_layer1_m_normalFactor * blendWeights.r;
+ float3 layer2_normalFactor = MaterialSrg::m_layer2_m_normalFactor * blendWeights.g;
+ float3 layer3_normalFactor = MaterialSrg::m_layer3_m_normalFactor * blendWeights.b;
float3x3 layer1_uvMatrix = MaterialSrg::m_layer1_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer1_m_uvMatrix : CreateIdentity3x3();
float3x3 layer2_uvMatrix = MaterialSrg::m_layer2_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer2_m_uvMatrix : CreateIdentity3x3();
float3x3 layer3_uvMatrix = MaterialSrg::m_layer3_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer3_m_uvMatrix : CreateIdentity3x3();
@@ -249,7 +248,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
float3 layer1_baseColor = BlendBaseColor(layer1_sampledColor, MaterialSrg::m_layer1_m_baseColor.rgb, MaterialSrg::m_layer1_m_baseColorFactor, o_layer1_o_baseColorTextureBlendMode, o_layer1_o_baseColor_useTexture);
float3 layer2_baseColor = BlendBaseColor(layer2_sampledColor, MaterialSrg::m_layer2_m_baseColor.rgb, MaterialSrg::m_layer2_m_baseColorFactor, o_layer2_o_baseColorTextureBlendMode, o_layer2_o_baseColor_useTexture);
float3 layer3_baseColor = BlendBaseColor(layer3_sampledColor, MaterialSrg::m_layer3_m_baseColor.rgb, MaterialSrg::m_layer3_m_baseColorFactor, o_layer3_o_baseColorTextureBlendMode, o_layer3_o_baseColor_useTexture);
- float3 baseColor = BlendLayers(layer1_baseColor, layer2_baseColor, layer3_baseColor, blendMaskValues);
+ float3 baseColor = BlendLayers(layer1_baseColor, layer2_baseColor, layer3_baseColor, blendWeights);
if(o_parallax_highlightClipping && displacementIsClipped)
{
@@ -264,7 +263,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
float layer1_metallic = GetMetallicInput(MaterialSrg::m_layer1_m_metallicMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_metallicMapUvIndex], MaterialSrg::m_layer1_m_metallicFactor, o_layer1_o_metallic_useTexture);
float layer2_metallic = GetMetallicInput(MaterialSrg::m_layer2_m_metallicMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_metallicMapUvIndex], MaterialSrg::m_layer2_m_metallicFactor, o_layer2_o_metallic_useTexture);
float layer3_metallic = GetMetallicInput(MaterialSrg::m_layer3_m_metallicMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_metallicMapUvIndex], MaterialSrg::m_layer3_m_metallicFactor, o_layer3_o_metallic_useTexture);
- metallic = BlendLayers(layer1_metallic, layer2_metallic, layer3_metallic, blendMaskValues);
+ metallic = BlendLayers(layer1_metallic, layer2_metallic, layer3_metallic, blendWeights);
}
// ------- Specular -------
@@ -272,7 +271,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
float layer1_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer1_m_specularF0Map, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_specularF0MapUvIndex], MaterialSrg::m_layer1_m_specularF0Factor, o_layer1_o_specularF0_useTexture);
float layer2_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer2_m_specularF0Map, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_specularF0MapUvIndex], MaterialSrg::m_layer2_m_specularF0Factor, o_layer2_o_specularF0_useTexture);
float layer3_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer3_m_specularF0Map, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_specularF0MapUvIndex], MaterialSrg::m_layer3_m_specularF0Factor, o_layer3_o_specularF0_useTexture);
- float specularF0Factor = BlendLayers(layer1_specularF0Factor, layer2_specularF0Factor, layer3_specularF0Factor, blendMaskValues);
+ float specularF0Factor = BlendLayers(layer1_specularF0Factor, layer2_specularF0Factor, layer3_specularF0Factor, blendWeights);
surface.SetAlbedoAndSpecularF0(baseColor, specularF0Factor, metallic);
@@ -281,7 +280,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
float layer1_roughness = GetRoughnessInput(MaterialSrg::m_layer1_m_roughnessMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_roughnessMapUvIndex], MaterialSrg::m_layer1_m_roughnessFactor, MaterialSrg::m_layer1_m_roughnessLowerBound, MaterialSrg::m_layer1_m_roughnessUpperBound, o_layer1_o_roughness_useTexture);
float layer2_roughness = GetRoughnessInput(MaterialSrg::m_layer2_m_roughnessMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_roughnessMapUvIndex], MaterialSrg::m_layer2_m_roughnessFactor, MaterialSrg::m_layer2_m_roughnessLowerBound, MaterialSrg::m_layer2_m_roughnessUpperBound, o_layer2_o_roughness_useTexture);
float layer3_roughness = GetRoughnessInput(MaterialSrg::m_layer3_m_roughnessMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_roughnessMapUvIndex], MaterialSrg::m_layer3_m_roughnessFactor, MaterialSrg::m_layer3_m_roughnessLowerBound, MaterialSrg::m_layer3_m_roughnessUpperBound, o_layer3_o_roughness_useTexture);
- surface.roughnessLinear = BlendLayers(layer1_roughness, layer2_roughness, layer3_roughness, blendMaskValues);
+ surface.roughnessLinear = BlendLayers(layer1_roughness, layer2_roughness, layer3_roughness, blendWeights);
surface.CalculateRoughnessA();
@@ -314,19 +313,19 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
float3 layer1_emissive = GetEmissiveInput(MaterialSrg::m_layer1_m_emissiveMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_emissiveMapUvIndex], MaterialSrg::m_layer1_m_emissiveIntensity, MaterialSrg::m_layer1_m_emissiveColor.rgb, o_layer1_o_emissiveEnabled, o_layer1_o_emissive_useTexture);
float3 layer2_emissive = GetEmissiveInput(MaterialSrg::m_layer2_m_emissiveMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_emissiveMapUvIndex], MaterialSrg::m_layer2_m_emissiveIntensity, MaterialSrg::m_layer2_m_emissiveColor.rgb, o_layer2_o_emissiveEnabled, o_layer2_o_emissive_useTexture);
float3 layer3_emissive = GetEmissiveInput(MaterialSrg::m_layer3_m_emissiveMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_emissiveMapUvIndex], MaterialSrg::m_layer3_m_emissiveIntensity, MaterialSrg::m_layer3_m_emissiveColor.rgb, o_layer3_o_emissiveEnabled, o_layer3_o_emissive_useTexture);
- lightingData.emissiveLighting = BlendLayers(layer1_emissive, layer2_emissive, layer3_emissive, blendMaskValues);
+ lightingData.emissiveLighting = BlendLayers(layer1_emissive, layer2_emissive, layer3_emissive, blendWeights);
// ------- Occlusion -------
float layer1_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer1_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer1_m_diffuseOcclusionFactor, o_layer1_o_diffuseOcclusion_useTexture);
float layer2_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer2_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer2_m_diffuseOcclusionFactor, o_layer2_o_diffuseOcclusion_useTexture);
float layer3_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer3_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer3_m_diffuseOcclusionFactor, o_layer3_o_diffuseOcclusion_useTexture);
- lightingData.diffuseAmbientOcclusion = BlendLayers(layer1_diffuseAmbientOcclusion, layer2_diffuseAmbientOcclusion, layer3_diffuseAmbientOcclusion, blendMaskValues);
+ lightingData.diffuseAmbientOcclusion = BlendLayers(layer1_diffuseAmbientOcclusion, layer2_diffuseAmbientOcclusion, layer3_diffuseAmbientOcclusion, blendWeights);
float layer1_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer1_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer1_m_specularOcclusionFactor, o_layer1_o_specularOcclusion_useTexture);
float layer2_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer2_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer2_m_specularOcclusionFactor, o_layer2_o_specularOcclusion_useTexture);
float layer3_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer3_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer3_m_specularOcclusionFactor, o_layer3_o_specularOcclusion_useTexture);
- lightingData.specularOcclusion = BlendLayers(layer1_specularOcclusion, layer2_specularOcclusion, layer3_specularOcclusion, blendMaskValues);
+ lightingData.specularOcclusion = BlendLayers(layer1_specularOcclusion, layer2_specularOcclusion, layer3_specularOcclusion, blendWeights);
// ------- Clearcoat -------
@@ -385,11 +384,11 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// --- Blend Layers ---
- surface.clearCoat.factor = BlendLayers(layer1_clearCoatFactor, layer2_clearCoatFactor, layer3_clearCoatFactor, blendMaskValues);
- surface.clearCoat.roughness = BlendLayers(layer1_clearCoatRoughness, layer2_clearCoatRoughness, layer3_clearCoatRoughness, blendMaskValues);
+ surface.clearCoat.factor = BlendLayers(layer1_clearCoatFactor, layer2_clearCoatFactor, layer3_clearCoatFactor, blendWeights);
+ surface.clearCoat.roughness = BlendLayers(layer1_clearCoatRoughness, layer2_clearCoatRoughness, layer3_clearCoatRoughness, blendWeights);
// [GFX TODO][ATOM-14592] This is not the right way to blend the normals. We need to use ReorientTangentSpaceNormal(), and that requires GetClearCoatInputs() to return the normal in TS instead of WS.
- surface.clearCoat.normal = BlendLayers(layer1_clearCoatNormal, layer2_clearCoatNormal, layer3_clearCoatNormal, blendMaskValues);
+ surface.clearCoat.normal = BlendLayers(layer1_clearCoatNormal, layer2_clearCoatNormal, layer3_clearCoatNormal, blendWeights);
surface.clearCoat.normal = normalize(surface.clearCoat.normal);
// manipulate base layer f0 if clear coat is enabled
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl
index 325937b228..2ab4c50841 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl
@@ -107,7 +107,7 @@ PSDepthOutput MainPS(VertexOutput IN, bool isFrontFace : SV_IsFrontFace)
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, float3(0, 0, 0) };
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents, 1);
- GetDepth_Setup(IN.m_blendMask);
+ s_blendMaskFromVertexStream = IN.m_blendMask;
float depth;
diff --git a/Gems/Atom/Feature/Common/Assets/Textures/DefaultBlendMask_layers.png b/Gems/Atom/Feature/Common/Assets/Textures/DefaultBlendMask_layers.png
index d1606516af..5e60261dd7 100644
--- a/Gems/Atom/Feature/Common/Assets/Textures/DefaultBlendMask_layers.png
+++ b/Gems/Atom/Feature/Common/Assets/Textures/DefaultBlendMask_layers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:f74ffab6ee15906158d27cbd2e5556e8fcdfd7820c0d0fd4b403de8a7af81662
-size 5651
+oid sha256:6660fa05dbf1e90298472fb41d99fff80a80de64ee88d17af4d0df3bdafb1ff6
+size 52877
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
index b2a3eac890..b85705fcb8 100644
--- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
@@ -134,8 +134,14 @@
"enable": true
},
"uv": {
- "offsetU": -0.2800000011920929,
- "rotateDegrees": 39.599998474121097
+ "center": [
+ 0.10000000149011612,
+ 0.20000000298023225
+ ],
+ "offsetU": 0.23000000417232514,
+ "offsetV": -0.23999999463558198,
+ "rotateDegrees": 39.599998474121097,
+ "scale": 1.100000023841858
}
}
-}
+}
\ No newline at end of file
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
index e7903a8c91..f6c881aee5 100644
--- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
@@ -30,6 +30,7 @@
"layer2_parallax": {
"enable": true,
"factor": 0.05299999937415123,
+ "offset": -0.024000000208616258,
"textureMap": "TestData/Textures/cc0/Rock030_2K_Displacement.jpg"
},
"layer2_roughness": {
@@ -49,4 +50,4 @@
"pdo": true
}
}
-}
+}
\ No newline at end of file
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendMaskValues.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendSource.material
similarity index 86%
rename from Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendMaskValues.material
rename to Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendSource.material
index 94a1ec6a30..cdd21212c9 100644
--- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendMaskValues.material
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/003_Debug_BlendSource.material
@@ -5,7 +5,7 @@
"propertyLayoutVersion": 3,
"properties": {
"general": {
- "debugDrawMode": "BlendMaskValues"
+ "debugDrawMode": "BlendSource"
}
}
}
diff --git a/Gems/Atom/TestData/TestData/Objects/PaintedPlane.fbx b/Gems/Atom/TestData/TestData/Objects/PaintedPlane.fbx
new file mode 100644
index 0000000000..be30ca4639
--- /dev/null
+++ b/Gems/Atom/TestData/TestData/Objects/PaintedPlane.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:053a7cd73b37c815900f87abd524830e6f23eee75d3b72fb866e86498d528159
+size 36156
From 7276253c4225dd09dc0208693815abffe7ac672c Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Tue, 11 May 2021 08:20:44 +0100
Subject: [PATCH 031/330] renamed function
---
.../AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp | 4 ++--
.../AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
index faeae0a06d..85784d61e0 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp
@@ -126,7 +126,7 @@ namespace AzToolsFramework
{
QStylePainter p(this);
- if (IsSectionSeparator())
+ if (IsReorderableRow())
{
const QPen linePen(QColor(0x3B3E3F));
p.setPen(linePen);
@@ -1332,7 +1332,7 @@ namespace AzToolsFramework
return canBeTopLevel(this);
}
- bool PropertyRowWidget::IsSectionSeparator() const
+ bool PropertyRowWidget::IsReorderableRow() const
{
return CanBeReordered();
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index b6c94dc98b..58bf3bb9f0 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -83,7 +83,7 @@ namespace AzToolsFramework
PropertyRowWidget* GetParentRow() const { return m_parentRow; }
int GetLevel() const;
bool IsTopLevel() const;
- bool IsSectionSeparator() const;
+ bool IsReorderableRow() const;
// Remove the default label and append the text to the name label.
bool GetAppendDefaultLabelToName();
From 8e4d0d73dcea7f50d05a9318011de9a07e0d88e6 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Tue, 11 May 2021 01:29:53 -0700
Subject: [PATCH 032/330] Good working state, but material always emmits low
end draw item
---
.../Materials/Types/StandardPBR.materialtype | 24 ++--
.../Atom/Features/PBR/Lights/Ibl.azsli | 108 ++++++------------
.../Atom/Features/ShaderQualityOptions.azsli | 3 +-
.../Code/Include/Atom/RPI.Public/Pass/Pass.h | 1 +
.../RPI/Code/Source/RPI.Public/Pass/Pass.cpp | 4 +-
5 files changed, 59 insertions(+), 81 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
index 1612bf43b0..47d8a9d9d5 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
@@ -1304,9 +1304,11 @@
"textureProperty": "baseColor.textureMap",
"useTextureProperty": "baseColor.useTexture",
"dependentProperties": ["baseColor.textureMapUv", "baseColor.textureBlendMode"],
- "shaderTags": [
+ "shaderTags": [
"ForwardPass",
- "ForwardPass_EDS"
+ "ForwardPass_EDS",
+ "LowEndForward",
+ "LowEndForward_EDS"
],
"shaderOption": "o_baseColor_useTexture"
}
@@ -1317,9 +1319,11 @@
"textureProperty": "metallic.textureMap",
"useTextureProperty": "metallic.useTexture",
"dependentProperties": ["metallic.textureMapUv"],
- "shaderTags": [
+ "shaderTags": [
"ForwardPass",
- "ForwardPass_EDS"
+ "ForwardPass_EDS",
+ "LowEndForward",
+ "LowEndForward_EDS"
],
"shaderOption": "o_metallic_useTexture"
}
@@ -1330,9 +1334,11 @@
"textureProperty": "specularF0.textureMap",
"useTextureProperty": "specularF0.useTexture",
"dependentProperties": ["specularF0.textureMapUv"],
- "shaderTags": [
+ "shaderTags": [
"ForwardPass",
- "ForwardPass_EDS"
+ "ForwardPass_EDS",
+ "LowEndForward",
+ "LowEndForward_EDS"
],
"shaderOption": "o_specularF0_useTexture"
}
@@ -1343,9 +1349,11 @@
"textureProperty": "normal.textureMap",
"useTextureProperty": "normal.useTexture",
"dependentProperties": ["normal.textureMapUv", "normal.factor", "normal.flipX", "normal.flipY"],
- "shaderTags": [
+ "shaderTags": [
"ForwardPass",
- "ForwardPass_EDS"
+ "ForwardPass_EDS",
+ "LowEndForward",
+ "LowEndForward_EDS"
],
"shaderOption": "o_normal_useTexture"
}
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
index 7400005508..721c48835d 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
@@ -18,32 +18,30 @@
#include
#include
-void ApplyIblDiffuse(
+float3 GetIblDiffuse(
float3 normal,
float3 albedo,
- float3 diffuseResponse,
- out float3 outDiffuse)
+ float3 diffuseResponse)
{
float3 irradianceDir = MultiplyVectorQuaternion(normal, SceneSrg::m_iblOrientation);
float3 diffuseSample = SceneSrg::m_diffuseEnvMap.Sample(SceneSrg::m_samplerEnv, GetCubemapCoords(irradianceDir)).rgb;
- outDiffuse = diffuseResponse * albedo * diffuseSample;
+ return diffuseResponse * albedo * diffuseSample;
}
-void ApplyIblSpecular(
+float3 GetIblSpecular(
float3 position,
float3 normal,
float3 specularF0,
float roughnessLinear,
float3 dirToCamera,
- float2 brdf,
- out float3 outSpecular)
+ float2 brdf)
{
float3 reflectDir = reflect(-dirToCamera, normal);
reflectDir = MultiplyVectorQuaternion(reflectDir, SceneSrg::m_iblOrientation);
// global
- outSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughnessLinear)).rgb;
+ float3 outSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughnessLinear)).rgb;
outSpecular *= (specularF0 * brdf.x + brdf.y);
// reflection probe
@@ -72,86 +70,54 @@ void ApplyIblSpecular(
outSpecular = lerp(outSpecular, probeSpecular, blendAmount);
}
+ return outSpecular;
}
void ApplyIBL(Surface surface, inout LightingData lightingData)
{
- if (o_opacity_mode == OpacityMode::Blended || o_opacity_mode == OpacityMode::TintedTransparent)
+#ifdef FORCE_IBL_IN_FORWARD_PASS
+ bool useDiffuseIbl = true;
+ bool useSpecularIbl = true;
+ bool useIbl = true;
+#else
+ bool useDiffuseIbl = (o_opacity_mode == OpacityMode::Blended || o_opacity_mode == OpacityMode::TintedTransparent);
+ bool useSpecularIbl = (useDiffuseIbl || o_meshUseForwardPassIBLSpecular || o_materialUseForwardPassIBLSpecular);
+ bool useIbl = o_enableIBL && (useDiffuseIbl || useSpecularIbl);
+#endif
+
+ if(useIbl)
{
- // transparencies currently require IBL in the forward pass
- if (o_enableIBL)
+ float iblExposureFactor = pow(2.0, SceneSrg::m_iblExposure);
+
+ if(useDiffuseIbl)
{
- float3 iblDiffuse = 0.0f;
- ApplyIblDiffuse(
- surface.normal,
- surface.albedo,
- lightingData.diffuseResponse,
- iblDiffuse);
-
- float3 iblSpecular = 0.0f;
- ApplyIblSpecular(
- surface.position,
- surface.normal,
- surface.specularF0,
- surface.roughnessLinear,
- lightingData.dirToCamera,
- lightingData.brdf,
- iblSpecular);
-
- // Adjust IBL lighting by exposure.
- float iblExposureFactor = pow(2.0, SceneSrg::m_iblExposure);
+ float3 iblDiffuse = GetIblDiffuse(surface.normal, surface.albedo, lightingData.diffuseResponse);
lightingData.diffuseLighting += (iblDiffuse * iblExposureFactor * lightingData.diffuseAmbientOcclusion);
- lightingData.specularLighting += (iblSpecular * iblExposureFactor);
}
- }
- else if (o_meshUseForwardPassIBLSpecular || o_materialUseForwardPassIBLSpecular)
- {
- if (o_enableIBL)
- {
- float3 iblSpecular = 0.0f;
- ApplyIblSpecular(
- surface.position,
- surface.normal,
- surface.specularF0,
- surface.roughnessLinear,
- lightingData.dirToCamera,
- lightingData.brdf,
- iblSpecular);
+ if(useSpecularIbl)
+ {
+ float3 iblSpecular = GetIblSpecular(surface.position, surface.normal, surface.specularF0, surface.roughnessLinear, lightingData.dirToCamera, lightingData.brdf);
iblSpecular *= lightingData.multiScatterCompensation;
- if (o_clearCoat_feature_enabled)
+ if (o_clearCoat_feature_enabled && surface.clearCoat.factor > 0.0f)
{
- if (surface.clearCoat.factor > 0.0f)
- {
- float clearCoatNdotV = saturate(dot(surface.clearCoat.normal, lightingData.dirToCamera));
- clearCoatNdotV = max(clearCoatNdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
- float2 clearCoatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(surface.clearCoat.roughness, clearCoatNdotV)).rg;
-
- // clear coat uses fixed IOR = 1.5 represents polyurethane which is the most common material for gloss clear coat
- // coat layer assumed to be dielectric thus don't need multiple scattering compensation
- float3 clearCoatSpecularF0 = float3(0.04f, 0.04f, 0.04f);
- float3 clearCoatIblSpecular = 0.0f;
+ float clearCoatNdotV = saturate(dot(surface.clearCoat.normal, lightingData.dirToCamera));
+ clearCoatNdotV = max(clearCoatNdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
+ float2 clearCoatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(surface.clearCoat.roughness, clearCoatNdotV)).rg;
- ApplyIblSpecular(
- surface.position,
- surface.clearCoat.normal,
- clearCoatSpecularF0,
- surface.clearCoat.roughness,
- lightingData.dirToCamera,
- clearCoatBrdf,
- clearCoatIblSpecular);
+ // clear coat uses fixed IOR = 1.5 represents polyurethane which is the most common material for gloss clear coat
+ // coat layer assumed to be dielectric thus don't need multiple scattering compensation
+ float3 clearCoatSpecularF0 = float3(0.04f, 0.04f, 0.04f);
+ float3 clearCoatIblSpecular = GetIblSpecular(surface.position, surface.clearCoat.normal, clearCoatSpecularF0, surface.clearCoat.roughness, lightingData.dirToCamera, clearCoatBrdf);
- clearCoatIblSpecular *= surface.clearCoat.factor;
+ clearCoatIblSpecular *= surface.clearCoat.factor;
- // attenuate base layer energy
- float3 clearCoatResponse = FresnelSchlickWithRoughness(clearCoatNdotV, clearCoatSpecularF0, surface.clearCoat.roughness) * surface.clearCoat.factor;
- iblSpecular = iblSpecular * (1.0 - clearCoatResponse) * (1.0 - clearCoatResponse) + clearCoatIblSpecular;
- }
+ // attenuate base layer energy
+ float3 clearCoatResponse = FresnelSchlickWithRoughness(clearCoatNdotV, clearCoatSpecularF0, surface.clearCoat.roughness) * surface.clearCoat.factor;
+ iblSpecular = iblSpecular * (1.0 - clearCoatResponse) * (1.0 - clearCoatResponse) + clearCoatIblSpecular;
}
-
- float iblExposureFactor = pow(2.0f, SceneSrg::m_iblExposure);
lightingData.specularLighting += (iblSpecular * iblExposureFactor);
}
}
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
index 907e67ada5..d6fb259548 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
@@ -18,7 +18,8 @@
#ifdef QUALITY_LOW_END
-#define UNIFIED_FORWARD_OUTPUT 1
+#define UNIFIED_FORWARD_OUTPUT 1
+#define FORCE_IBL_IN_FORWARD_PASS 1
#endif
diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h
index b0d6bd4117..1cba71ae7e 100644
--- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h
+++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h
@@ -381,6 +381,7 @@ namespace AZ
uint64_t m_createdByPassRequest : 1;
uint64_t m_initialized : 1;
uint64_t m_enabled : 1;
+ uint64_t m_parentEnabled : 1;
uint64_t m_alreadyCreated : 1;
uint64_t m_alreadyReset : 1;
uint64_t m_alreadyPrepared : 1;
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/Pass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/Pass.cpp
index 9401d1a9e0..f93d661b0f 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/Pass.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/Pass.cpp
@@ -93,11 +93,12 @@ namespace AZ
void Pass::SetEnabled(bool enabled)
{
m_flags.m_enabled = enabled;
+ OnHierarchyChange();
}
bool Pass::IsEnabled() const
{
- return m_flags.m_enabled;
+ return m_flags.m_enabled && (m_flags.m_parentEnabled || m_parent == nullptr);
}
// --- Error Logging ---
@@ -140,6 +141,7 @@ namespace AZ
}
// Set new tree depth and path
+ m_flags.m_parentEnabled = m_parent->IsEnabled();
m_treeDepth = m_parent->m_treeDepth + 1;
m_path = ConcatPassName(m_parent->m_path, m_name);
m_flags.m_partOfHierarchy = m_parent->m_flags.m_partOfHierarchy;
From b08643d9da90d0215ed5b22efcc3716fdaa90622 Mon Sep 17 00:00:00 2001
From: sphrose <82213493+sphrose@users.noreply.github.com>
Date: Tue, 11 May 2021 11:24:51 +0100
Subject: [PATCH 033/330] Use renamed functions in stylesheet.
---
.../AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx | 2 +-
Code/Sandbox/Editor/Style/Editor.qss | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
index 58bf3bb9f0..1c17cab69f 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx
@@ -44,7 +44,7 @@ namespace AzToolsFramework
Q_PROPERTY(bool hasChildRows READ HasChildRows);
Q_PROPERTY(bool isTopLevel READ IsTopLevel);
Q_PROPERTY(int getLevel READ GetLevel);
- Q_PROPERTY(bool isSectionSeparator READ IsSectionSeparator);
+ Q_PROPERTY(bool canBeReordered READ CanBeReordered);
Q_PROPERTY(bool appendDefaultLabelToName READ GetAppendDefaultLabelToName WRITE AppendDefaultLabelToName)
public:
AZ_CLASS_ALLOCATOR(PropertyRowWidget, AZ::SystemAllocator, 0)
diff --git a/Code/Sandbox/Editor/Style/Editor.qss b/Code/Sandbox/Editor/Style/Editor.qss
index 7887560105..fa7d67dd43 100644
--- a/Code/Sandbox/Editor/Style/Editor.qss
+++ b/Code/Sandbox/Editor/Style/Editor.qss
@@ -38,7 +38,7 @@ AzToolsFramework--ComponentPaletteWidget > QTreeView
background-color: #222222;
}
-AzToolsFramework--PropertyRowWidget[isSectionSeparator="true"] QLabel#Name
+AzToolsFramework--PropertyRowWidget[canBeReordered="true"] QLabel#Name
{
font-weight: bold;
}
From dbe16c6a164cf89342749efbbd2d0785d473a37a Mon Sep 17 00:00:00 2001
From: darapan
Date: Tue, 11 May 2021 05:07:16 -0700
Subject: [PATCH 034/330] "fixing review comments"
---
...s.py => Editor_NewExistingLevels_Works.py} | 17 +++++---------
.../Gem/PythonTests/smoke/ImportPathHelper.py | 16 -------------
....py => test_CLITool_AssetBuilder_Works.py} | 7 +++---
...> test_CLITool_AssetBundlerBatch_Works.py} | 7 +++---
...test_CLITool_AssetProcessorBatch_Works.py} | 23 +++++--------------
....py => test_CLITool_AzTestRunner_Works.py} | 7 +++---
...st_CLITool_PythonBindingsExample_Works.py} | 8 +++----
...st_CLITool_SerializeContextTools_Works.py} | 7 +++---
...=> test_Editor_NewExistingLevels_Works.py} | 6 +++--
...> test_StaticTools_GenPakShaders_Works.py} | 7 +++---
10 files changed, 34 insertions(+), 71 deletions(-)
rename AutomatedTesting/Gem/PythonTests/smoke/{Editor_NewExistingLevels.py => Editor_NewExistingLevels_Works.py} (93%)
delete mode 100644 AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
rename AutomatedTesting/Gem/PythonTests/smoke/{test_AssetBuilder.py => test_CLITool_AssetBuilder_Works.py} (89%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_AssetBundlerBatch.py => test_CLITool_AssetBundlerBatch_Works.py} (89%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_AssetProcessorBatch.py => test_CLITool_AssetProcessorBatch_Works.py} (54%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_AzTestRunner.py => test_CLITool_AzTestRunner_Works.py} (90%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_PythonBindingsExample.py => test_CLITool_PythonBindingsExample_Works.py} (87%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_SerializeContextTools.py => test_CLITool_SerializeContextTools_Works.py} (88%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_Editor_NewExistingLevels.py => test_Editor_NewExistingLevels_Works.py} (88%)
rename AutomatedTesting/Gem/PythonTests/smoke/{test_Statictool_Scripts.py => test_StaticTools_GenPakShaders_Works.py} (90%)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py
similarity index 93%
rename from AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py
rename to AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py
index 4e4a037ec9..ce46da494c 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py
@@ -9,9 +9,7 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-Test case ID: LY-123945
Test Case Title: Create Test for UI apps- Editor
-URL of the test case: https://jira.agscollab.com/browse/LY-123945
"""
@@ -30,7 +28,7 @@ class Tests():
# fmt: on
-def Editor_NewExistingLevels():
+def Editor_NewExistingLevels_Works():
"""
Summary: Perform the below operations on Editor
@@ -69,9 +67,9 @@ def Editor_NewExistingLevels():
"""
import os
- import hydra_editor_utils as hydra
- from utils import TestHelper as helper
- from utils import Report
+ import editor_python_test_tools.hydra_editor_utils as hydra
+ from editor_python_test_tools.utils import TestHelper as helper
+ from editor_python_test_tools.utils import Report
import azlmbr.bus as bus
import azlmbr.editor as editor
import azlmbr.legacy.general as general
@@ -146,10 +144,7 @@ def Editor_NewExistingLevels():
if __name__ == "__main__":
- import ImportPathHelper as imports
- imports.init()
+ from editor_python_test_tools.utils import Report
- from utils import Report
-
- Report.start_test(Editor_NewExistingLevels)
+ Report.start_test(Editor_NewExistingLevels_Works)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py b/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
deleted file mode 100644
index 70bed6e526..0000000000
--- a/AutomatedTesting/Gem/PythonTests/smoke/ImportPathHelper.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-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.
-"""
-
-def init():
- import os
- import sys
- sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
- sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../EditorPythonTestTools/editor_python_test_tools')
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py
similarity index 89%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py
index da2abff50f..e20809b1b8 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBuilder.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124059 : CLI tool - AssetBuilder
+CLI tool - AssetBuilder
Launch AssetBuilder and Verify the help message
"""
@@ -23,7 +23,7 @@ import ly_test_tools.environment.process_utils as process_utils
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestAssetBuilder(object):
+class TestCLIToolAssetBuilderWorks(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request):
def teardown():
@@ -31,8 +31,7 @@ class TestAssetBuilder(object):
request.addfinalizer(teardown)
- @pytest.mark.test_case_id("LY-124059")
- def test_AssetBuilder(self, request, editor, build_directory):
+ def test_CLITool_AssetBuilder_Works(self, request, editor, build_directory):
file_path = os.path.join(build_directory, "AssetBuilder")
help_message = "AssetBuilder is part of the Asset Processor"
# Launch AssetBuilder
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py
similarity index 89%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py
index d361c62f5f..8a20715b3f 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetBundlerBatch.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124060 : CLI tool - AssetBundlerBatch
+CLI tool - AssetBundlerBatch
Launch AssetBundlerBatch and Verify the help message
"""
@@ -23,7 +23,7 @@ import ly_test_tools.environment.process_utils as process_utils
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestAssetBundlerBatch(object):
+class TestCLIToolAssetBundlerBatchWorks(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request):
def teardown():
@@ -31,8 +31,7 @@ class TestAssetBundlerBatch(object):
request.addfinalizer(teardown)
- @pytest.mark.test_case_id("LY-124060")
- def test_AssetBundlerBatch(self, request, editor, build_directory):
+ def test_CLITool_AssetBundlerBatch_Works(self, request, editor, build_directory):
file_path = os.path.join(build_directory, "AssetBundlerBatch")
help_message = "Specifies the Seed List file to operate on by path"
# Launch AssetBundlerBatch
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py
similarity index 54%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py
index ab541b94c1..30e681050c 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_AssetProcessorBatch.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py
@@ -10,34 +10,23 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124061 : CLI tool - AssetProcessorBatch
+CLI tool - AssetProcessorBatch
Launch AssetProcessorBatch and Shutdown AssetProcessorBatch without any crash
"""
# Import builtin libraries
import pytest
-import os
-import sys
-
-sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../assetpipeline/")
-
-# Import fixtures
-from ap_fixtures.asset_processor_fixture import asset_processor as asset_processor
+from ly_test_tools.o3de.asset_processor import AssetProcessor
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
-@pytest.mark.usefixtures("asset_processor")
@pytest.mark.SUITE_smoke
-class TestsAssetProcessorBatchs(object):
- @pytest.mark.test_case_id("LY-124061")
- def test_AssetProcessorBatch(self, asset_processor):
+class TestsCLIToolAssetProcessorBatchWorks(object):
+ def test_CLITool_AssetProcessorBatch_Works(self, workspace):
"""
Test Launching AssetProcessorBatch and verifies that is shuts down without issue
"""
- # Create a sample asset root so we don't process every asset for every platform
- asset_processor.create_temp_asset_root()
- # Launch AssetProcessorBatch, assert batch processing success
- result, _ = asset_processor.batch_process()
- assert result, "AP Batch failed"
+ asset_processor = AssetProcessor(workspace)
+ asset_processor.batch_process()
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py
similarity index 90%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py
index d1bc44fe2f..5983cd7496 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_AzTestRunner.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124062 : CLI tool - AzTestRunner
+CLI tool - AzTestRunner
Launch AzTestRunner and Verify the help message
"""
@@ -23,7 +23,7 @@ import ly_test_tools.environment.process_utils as process_utils
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestAzTestRunner(object):
+class TestCLIToolAzTestRunnerWorks(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request):
def teardown():
@@ -31,8 +31,7 @@ class TestAzTestRunner(object):
request.addfinalizer(teardown)
- @pytest.mark.test_case_id("LY-124062")
- def test_AzTestRunner(self, request, editor, build_directory):
+ def test_CLITool_AzTestRunner_Works(self, request, editor, build_directory):
file_path = os.path.join(build_directory, "AzTestRunner")
help_message = "OKAY Symbol found: AzRunUnitTests"
# Launch AzTestRunner
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py
similarity index 87%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py
index 140e76fc96..68d12d0e70 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_PythonBindingsExample.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124064 : CLI tool - PythonBindingsExample
+CLI tool - PythonBindingsExample
Launch PythonBindingsExample and Verify the help message
"""
@@ -23,7 +23,7 @@ import ly_test_tools.environment.process_utils as process_utils
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestPythonBindingsExample(object):
+class TestCLIToolPythonBindingsExampleWorks(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request):
def teardown():
@@ -31,8 +31,7 @@ class TestPythonBindingsExample(object):
request.addfinalizer(teardown)
- @pytest.mark.test_case_id("LY-124064")
- def test_PythonBindingsExample(self, request, editor, build_directory):
+ def test_CLITool_PythonBindingsExample_Works(self, request, editor, build_directory):
file_path = os.path.join(build_directory, "PythonBindingsExample")
help_message = "--help Prints the help text"
# Launch PythonBindingsExample
@@ -42,4 +41,3 @@ class TestPythonBindingsExample(object):
), f"Error occurred while launching {file_path}: {output.stderr}"
# Verify help message
assert help_message in str(output.stdout), f"Help Message: {help_message} is not present"
-
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py
similarity index 88%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py
index 763d84625d..94178ca9d6 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_SerializeContextTools.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124066 : CLI tool - SerializeContextTools
+CLI tool - SerializeContextTools
Launch SerializeContextTools and Verify the help message
"""
@@ -23,7 +23,7 @@ import ly_test_tools.environment.process_utils as process_utils
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestSerializeContextTools(object):
+class TestCLIToolSerializeContextToolsWorks(object):
@pytest.fixture(autouse=True)
def setup_teardown(self, request):
def teardown():
@@ -31,8 +31,7 @@ class TestSerializeContextTools(object):
request.addfinalizer(teardown)
- @pytest.mark.test_case_id("LY-124066")
- def test_SerializeContextTools(self, request, editor, build_directory):
+ def test_CLITool_SerializeContextTools_Works(self, request, editor, build_directory):
file_path = os.path.join(build_directory, "SerializeContextTools")
help_message = "Converts a file with an ObjectStream to the new JSON"
# Launch SerializeContextTools
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py
similarity index 88%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py
index 85d53d098d..510734a4a2 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py
@@ -24,11 +24,13 @@ import ly_test_tools.environment.file_system as file_system
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["temp_level"])
class TestAutomation(TestAutomationBase):
- def test_Editor_NewExistingLevels(self, request, workspace, editor, level, project, launcher_platform):
+ def test_Editor_NewExistingLevels_Works(self, request, workspace, editor, level, project, launcher_platform):
def teardown():
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
+
request.addfinalizer(teardown)
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
- from . import Editor_NewExistingLevels as test_module
+ from . import Editor_NewExistingLevels_Works as test_module
+
self._run_test(request, workspace, editor, test_module)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py b/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py
similarity index 90%
rename from AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
rename to AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py
index 8eac2ff099..05b91a602d 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_Statictool_Scripts.py
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py
@@ -10,7 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
"""
-LY-124058: Static tool scripts
+Static tool scripts
Launch Static tool and Verify the help message
"""
@@ -34,9 +34,8 @@ def verify_help_message(static_tool):
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.SUITE_smoke
-class TestStatictoolScripts(object):
- @pytest.mark.test_case_id("LY-124058")
- def test_Statictool_Scripts(self, request, editor):
+class TestStaticToolsGenPakShadersWorks(object):
+ def test_StaticTools_GenPakShaders_Works(self, request, editor):
static_tools = [
os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "gen_shaders.py"),
os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "get_shader_list.py"),
From d48df87bda8d653025e4a9c6fc8f45e873cbf443 Mon Sep 17 00:00:00 2001
From: darapan
Date: Tue, 11 May 2021 05:20:06 -0700
Subject: [PATCH 035/330] "Updating Cmake"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 127db8e7e6..2a0a7f8008 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -399,3 +399,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
+ COMPONENT
+ Smoke
+ )
+endif()
\ No newline at end of file
From 006f4d2e8294da878161ce9db571e55b84fe2dc9 Mon Sep 17 00:00:00 2001
From: darapan
Date: Tue, 11 May 2021 05:34:38 -0700
Subject: [PATCH 036/330] "Adding Ap Test"
---
.../Gem/PythonTests/CMakeLists.txt | 2 +-
.../test_UIApps_AssetProcessor_CheckIdle.py | 41 +++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index 2a0a7f8008..e91190f8e7 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -402,4 +402,4 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
COMPONENT
Smoke
)
-endif()
\ No newline at end of file
+endif()
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py b/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py
new file mode 100644
index 0000000000..0f5f870461
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py
@@ -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.
+"""
+
+"""
+UI Apps: AssetProcessor
+Open AssetProcessor, Wait until AssetProcessor is Idle
+Close AssetProcessor.
+"""
+
+
+import pytest
+from ly_test_tools.o3de.asset_processor import AssetProcessor
+
+
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.usefixtures("automatic_process_killer")
+@pytest.mark.SUITE_smoke
+class TestsUIAppsAssetProcessorCheckIdle(object):
+ @pytest.fixture(autouse=True)
+ def setup_teardown(self, request):
+ self.asset_processor = None
+
+ def teardown():
+ self.asset_processor.stop()
+
+ request.addfinalizer(teardown)
+
+ def test_UIApps_AssetProcessor_CheckIdle(self, workspace):
+ """
+ Test Launching AssetProcessorBatch and verifies that is shuts down without issue
+ """
+ self.asset_processor = AssetProcessor(workspace)
+ self.asset_processor.gui_process()
From f7641f3d3845dad3acb219b727521a4ab26fc8a1 Mon Sep 17 00:00:00 2001
From: darapan
Date: Tue, 11 May 2021 10:56:42 -0700
Subject: [PATCH 037/330] "Changing TIMEOUT in cmakelist.txt"
---
AutomatedTesting/Gem/PythonTests/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
index e91190f8e7..a81630b880 100644
--- a/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/CMakeLists.txt
@@ -392,7 +392,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
TEST_SUITE smoke
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/smoke
- TIMEOUT 3600
+ TIMEOUT 1500
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
AZ::PythonBindingsExample
From 85e4f0d65ff5d5b7b6e1ba9759cace1907f60634 Mon Sep 17 00:00:00 2001
From: rgba16f <82187279+rgba16f@users.noreply.github.com>
Date: Tue, 11 May 2021 16:24:28 -0500
Subject: [PATCH 038/330] Fix AzFramework::g_defaultSceneEntityDebugDisplayId
not working for the AtomDebugDisplayViewportInstance
---
Code/Sandbox/Editor/EditorViewportWidget.cpp | 9 +++++
.../Code/Source/AtomBridgeSystemComponent.cpp | 38 +++++++------------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/Code/Sandbox/Editor/EditorViewportWidget.cpp b/Code/Sandbox/Editor/EditorViewportWidget.cpp
index 3803867870..631a93af92 100644
--- a/Code/Sandbox/Editor/EditorViewportWidget.cpp
+++ b/Code/Sandbox/Editor/EditorViewportWidget.cpp
@@ -452,6 +452,15 @@ void EditorViewportWidget::Update()
return;
}
+ static bool sentOnWindowCreated = false;
+ if (!sentOnWindowCreated && windowHandle()->isActive())
+ {
+ sentOnWindowCreated = true;
+ AzFramework::WindowSystemNotificationBus::Broadcast(
+ &AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated,
+ reinterpret_cast(winId()));
+ }
+
m_updatingCameraPosition = true;
auto transform = LYTransformToAZTransform(m_Camera.GetMatrix());
m_renderViewport->GetViewportContext()->SetCameraTransform(transform);
diff --git a/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomBridgeSystemComponent.cpp b/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomBridgeSystemComponent.cpp
index 90731488f4..9148cdba6f 100644
--- a/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomBridgeSystemComponent.cpp
+++ b/Gems/AtomLyIntegration/AtomBridge/Code/Source/AtomBridgeSystemComponent.cpp
@@ -91,13 +91,9 @@ namespace AZ
AZ_UNUSED(dependent);
}
- static const AZ::Crc32 mainViewportEntityDebugDisplayId = AZ_CRC_CE("MainViewportEntityDebugDisplayId");
-
void AtomBridgeSystemComponent::Init()
{
-#if defined(ENABLE_ATOM_DEBUG_DISPLAY) && ENABLE_ATOM_DEBUG_DISPLAY
AZ::RPI::ViewportContextManagerNotificationsBus::Handler::BusConnect();
-#endif
}
void AtomBridgeSystemComponent::Activate()
@@ -112,9 +108,7 @@ namespace AZ
void AtomBridgeSystemComponent::Deactivate()
{
-#if defined(ENABLE_ATOM_DEBUG_DISPLAY) && ENABLE_ATOM_DEBUG_DISPLAY
AZ::RPI::ViewportContextManagerNotificationsBus::Handler::BusDisconnect();
-#endif
RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
// Check if scene is emptry since scene might be released already when running AtomSampleViewer
if (scene)
@@ -193,36 +187,32 @@ namespace AZ
renderPipeline = bootstrapScene->GetDefaultRenderPipeline();
renderPipeline->SetDefaultView(m_view);
-
- auto auxGeomFP = bootstrapScene->GetFeatureProcessor();
- if (auxGeomFP)
- {
- auxGeomFP->GetOrCreateDrawQueueForView(m_view.get());
- }
-
-#if defined(ENABLE_ATOM_DEBUG_DISPLAY) && ENABLE_ATOM_DEBUG_DISPLAY
- // Make default AtomDebugDisplayViewportInterface for the scene
- AZStd::shared_ptr mainEntityDebugDisplay = AZStd::make_shared(mainViewportEntityDebugDisplayId);
- m_activeViewportsList[mainViewportEntityDebugDisplayId] = mainEntityDebugDisplay;
-#endif
}
+ else
+ {
+ m_view = renderPipeline->GetDefaultView();
+ }
+ auto auxGeomFP = bootstrapScene->GetFeatureProcessor();
+ if (auxGeomFP)
+ {
+ auxGeomFP->GetOrCreateDrawQueueForView(m_view.get());
+ }
+
+ // Make default AtomDebugDisplayViewportInterface for the scene
+ AZStd::shared_ptr mainEntityDebugDisplay = AZStd::make_shared(AzFramework::g_defaultSceneEntityDebugDisplayId);
+ m_activeViewportsList[AzFramework::g_defaultSceneEntityDebugDisplayId] = mainEntityDebugDisplay;
}
void AtomBridgeSystemComponent::OnViewportContextAdded(AZ::RPI::ViewportContextPtr viewportContext)
{
-#if defined(ENABLE_ATOM_DEBUG_DISPLAY) && ENABLE_ATOM_DEBUG_DISPLAY
AZStd::shared_ptr viewportDebugDisplay = AZStd::make_shared(viewportContext);
m_activeViewportsList[viewportContext->GetId()] = viewportDebugDisplay;
-#endif
}
void AtomBridgeSystemComponent::OnViewportContextRemoved(AzFramework::ViewportId viewportId)
{
-#if defined(ENABLE_ATOM_DEBUG_DISPLAY) && ENABLE_ATOM_DEBUG_DISPLAY
+ AZ_Assert(viewportId != AzFramework::g_defaultSceneEntityDebugDisplayId, "Error trying to remove the default scene draw instance");
m_activeViewportsList.erase(viewportId);
-#else
- AZ_UNUSED(viewportId);
-#endif
}
From 9775822778ec2cf8003ea86f455906f75bce1c14 Mon Sep 17 00:00:00 2001
From: scottr
Date: Tue, 11 May 2021 16:09:16 -0700
Subject: [PATCH 039/330] [cpack_installer] remove wxs file ext from lfs filter
---
.gitattributes | 1 -
1 file changed, 1 deletion(-)
diff --git a/.gitattributes b/.gitattributes
index 1755def66a..55b43e4ba7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -115,5 +115,4 @@
*.wav filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.wem filter=lfs diff=lfs merge=lfs -text
-*.wxs filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
From 9faf35b529d942dffe1b9fce7d9310be8de9edf8 Mon Sep 17 00:00:00 2001
From: Chris Santora
Date: Tue, 11 May 2021 17:09:41 -0700
Subject: [PATCH 040/330] Refactor in prepration for ATOM-14688 "Disable
Individual Layers"
Refactored StandardMultilayerPBR to collate all the code for each layer into a couple structs and utility functions. This makes the code easier to maintain, and in particular will make it easy for me to add Enable flags for the layers in a subsequent commit.
Also removed subsurface scattering and translucency from StandardMultilayerPBR, according to ATOM-4120 "Stabilize Standard PBR Regarding Subsurface and Translucency".
Squashed commit of the following:
commit a6052d6ad4f70183d0ce72e84c7dc5512dc24d5e
Author: Chris Santora
Date: Tue May 11 16:32:15 2021 -0700
Got the refactor finally working. I had change it to blend the baseColor, spec factor, and metalness before converting to albedo and spec, in order to get exactly the same results as before.
commit 42d6da7f405097dea07b6ed0426d6a662b61440d
Author: Chris Santora
Date: Tue May 11 15:58:38 2021 -0700
Fixed clear coat issue due to LightingData initialized too late.
commit 358194a5caf6f9eb99b0e5345ad5f7768b244a93
Author: Chris Santora
Date: Tue May 11 15:18:30 2021 -0700
Fixed a couple issues.
commit adb431f8113b945057959db288a7ee2dd825dd69
Author: Chris Santora
Date: Tue May 11 12:42:12 2021 -0700
WIP refactor of StandardMultilayerPBR to collate the code for each layer. Also removed subsurface scattering from multilayer.
---
.../Types/StandardMultilayerPBR.materialtype | 207 ---------
.../Types/StandardMultilayerPBR_Common.azsli | 18 -
.../StandardMultilayerPBR_ForwardPass.azsl | 400 ++++++++++--------
.../PBR/Surfaces/StandardSurface.azsli | 14 +
4 files changed, 245 insertions(+), 394 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
index 3e95846b6e..90a599c6f9 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
@@ -23,11 +23,6 @@
"displayName": "UVs",
"description": "Properties for configuring UV transforms for the entire material, including the blend masks."
},
- {
- "id": "subsurfaceScattering",
- "displayName": "Subsurface Scattering",
- "description": "Properties for configuring subsurface scattering effects."
- },
{
// Note: this property group is used in the DiffuseGlobalIllumination pass, it is not read by the StandardPBR shader
"id": "irradiance",
@@ -467,183 +462,6 @@
"step": 0.1
}
],
- "subsurfaceScattering": [
- {
- "id": "enableSubsurfaceScattering",
- "displayName": "Subsurface Scattering",
- "description": "Enable subsurface scattering feature, this will disable metallic and parallax mapping property due to incompatibility",
- "type": "Bool",
- "defaultValue": false,
- "connection": {
- "type": "ShaderOption",
- "id": "o_enableSubsurfaceScattering"
- }
- },
- {
- "id": "subsurfaceScatterFactor",
- "displayName": " Factor",
- "description": "Strength factor for scaling percentage of subsurface scattering effect applied",
- "type": "float",
- "defaultValue": 1.0,
- "min": 0.0,
- "max": 1.0,
- "connection": {
- "type": "ShaderInput",
- "id": "m_subsurfaceScatteringFactor"
- }
- },
- {
- "id": "influenceMap",
- "displayName": " Influence Map",
- "description": "Use texture map to control the strength of subsurface scattering",
- "type": "Image",
- "connection": {
- "type": "ShaderInput",
- "id": "m_subsurfaceScatteringInfluenceMap"
- }
- },
- {
- "id": "useInfluenceMap",
- "displayName": " Use Influence Map",
- "description": "Whether to use the texture map as influence mask.",
- "type": "Bool",
- "defaultValue": true
- },
- {
- "id": "influenceMapUv",
- "displayName": " UV",
- "description": "Influence map UV set",
- "type": "Enum",
- "enumIsUv": true,
- "defaultValue": "Tiled",
- "connection": {
- "type": "ShaderInput",
- "id": "m_subsurfaceScatteringInfluenceMapUvIndex"
- }
- },
- {
- "id": "scatterColor",
- "displayName": " Scatter color",
- "description": "Color of volume light traveled through",
- "type": "Color",
- "defaultValue": [ 1.0, 0.27, 0.13 ]
- },
- {
- "id": "scatterDistance",
- "displayName": " Scatter distance",
- "description": "How far light traveled inside the volume",
- "type": "float",
- "defaultValue": 8,
- "min": 0.0,
- "softMax": 20.0
- },
- {
- "id": "quality",
- "displayName": " Quality",
- "description": "How much percent of sample will be used for each pixel, more samples improve quality and reduce artifacts, especially when the scatter distance is relatively large, but slow down computation time, 1.0 = full set 200 samples per pixel",
- "type": "float",
- "defaultValue": 0.4,
- "min": 0.2,
- "max": 1.0,
- "connection": {
- "type": "ShaderInput",
- "id": "m_subsurfaceScatteringQuality"
- }
- },
- {
- "id": "transmissionMode",
- "displayName": "Transmission",
- "description": "Algorithm used for calculating transmission",
- "type": "Enum",
- "enumValues": [ "None", "ThickObject", "ThinObject" ],
- "defaultValue": "None",
- "connection": {
- "type": "ShaderOption",
- "id": "o_transmission_mode"
- }
- },
- {
- "id": "thickness",
- "displayName": " Thickness",
- "description": "Normalized global thickness, the maxima between this value (multiplied by thickness map if enabled) and thickness from shadow map (if applicable) will be used as final thickness of pixel",
- "type": "float",
- "defaultValue": 0.5,
- "min": 0.0,
- "max": 1.0
- },
- {
- "id": "thicknessMap",
- "displayName": " Thickness Map",
- "description": "Use a greyscale texture for per pixel thickness",
- "type": "Image",
- "connection": {
- "type": "ShaderInput",
- "id": "m_transmissionThicknessMap"
- }
- },
- {
- "id": "useThicknessMap",
- "displayName": " Use Thickness Map",
- "description": "Whether to use the thickness map",
- "type": "Bool",
- "defaultValue": true
- },
- {
- "id": "thicknessMapUv",
- "displayName": " UV",
- "description": "Thickness map UV set",
- "type": "Enum",
- "enumIsUv": true,
- "defaultValue": "Tiled",
- "connection": {
- "type": "ShaderInput",
- "id": "m_transmissionThicknessMapUvIndex"
- }
- },
- {
- "id": "transmissionTint",
- "displayName": " Transmission Tint",
- "description": "Color of the volume light travelling through",
- "type": "Color",
- "defaultValue": [ 1.0, 0.8, 0.6 ]
- },
- {
- "id": "transmissionPower",
- "displayName": " Power",
- "description": "How much transmitted light scatter radially ",
- "type": "float",
- "defaultValue": 6.0,
- "min": 0.0,
- "softMax": 20.0
- },
- {
- "id": "transmissionDistortion",
- "displayName": " Distortion",
- "description": "How much light direction distorted towards surface normal",
- "type": "float",
- "defaultValue": 0.1,
- "min": 0.0,
- "max": 1.0
- },
- {
- "id": "transmissionAttenuation",
- "displayName": " Attenuation",
- "description": "How fast transmitted light fade with thickness",
- "type": "float",
- "defaultValue": 4.0,
- "min": 0.0,
- "softMax": 20.0
- },
- {
- "id": "transmissionScale",
- "displayName": " Scale",
- "description": "Strength of transmission",
- "type": "float",
- "defaultValue": 3.0,
- "min": 0.0,
- "softMax": 20.0
- }
- ],
"irradiance": [
// Note: this property group is used in the DiffuseGlobalIllumination pass, it is not read by the StandardPBR shader
{
@@ -2844,25 +2662,6 @@
"file": "StandardMultilayerPBR_ShaderEnable.lua"
}
},
- {
- // Preprocess & build parameter set for subsurface scattering and translucency
- "type": "HandleSubsurfaceScatteringParameters",
- "args": {
- "mode": "subsurfaceScattering.transmissionMode",
- "scale" : "subsurfaceScattering.transmissionScale",
- "power" : "subsurfaceScattering.transmissionPower",
- "distortion" : "subsurfaceScattering.transmissionDistortion",
- "attenuation" : "subsurfaceScattering.transmissionAttenuation",
- "tintColor" : "subsurfaceScattering.transmissionTint",
- "thickness" : "subsurfaceScattering.thickness",
- "enabled": "subsurfaceScattering.enableSubsurfaceScattering",
- "scatterDistanceColor" : "subsurfaceScattering.scatterColor",
- "scatterDistanceIntensity" : "subsurfaceScattering.scatterDistance",
- "scatterDistanceShaderInput" : "m_scatterDistance",
- "parametersShaderInput" : "m_transmissionParams",
- "tintThickenssShaderInput" : "m_transmissionTintThickness"
- }
- },
{
"type": "Lua",
"args": {
@@ -2875,12 +2674,6 @@
"file": "StandardMultilayerPBR_Parallax.lua"
}
},
- {
- "type": "Lua",
- "args": {
- "file": "StandardPBR_SubsurfaceState.lua"
- }
- },
//##############################################################################################
// Layer 1 Functors
//##############################################################################################
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
index f1f6d90e14..8c7b49214b 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
@@ -91,24 +91,6 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
MipFilter = Linear;
};
- // Parameters for subsurface scattering
- float m_subsurfaceScatteringFactor;
- float m_subsurfaceScatteringQuality;
- float3 m_scatterDistance;
- Texture2D m_subsurfaceScatteringInfluenceMap;
- uint m_subsurfaceScatteringInfluenceMapUvIndex;
-
- // Parameters for transmission
-
- // Elements of m_transmissionParams:
- // Thick object mode: (attenuation coefficient, power, distortion, scale)
- // Thin object mode: (float3 scatter distance, scale)
- float4 m_transmissionParams;
-
- // (float3 TintColor, thickness)
- float4 m_transmissionTintThickness;
- Texture2D m_transmissionThicknessMap;
- uint m_transmissionThicknessMapUvIndex;
}
// ------ Shader Options ----------------------------------------
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
index a690c0569a..9e5a2e623a 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
@@ -55,7 +55,6 @@ DEFINE_LAYER_OPTIONS(o_layer1_)
DEFINE_LAYER_OPTIONS(o_layer2_)
DEFINE_LAYER_OPTIONS(o_layer3_)
-#include "MaterialInputs/SubsurfaceInput.azsli"
#include "MaterialInputs/TransmissionInput.azsli"
#include "StandardMultilayerPBR_Common.azsli"
@@ -127,6 +126,181 @@ VSOutput ForwardPassVS(VSInput IN)
return OUT;
}
+//! Collects all the raw Standard material inputs for a single layer. See ProcessStandardMaterialInputs().
+struct StandardMaterialInputs
+{
+ COMMON_SRG_INPUTS_BASE_COLOR()
+ COMMON_SRG_INPUTS_ROUGHNESS()
+ COMMON_SRG_INPUTS_METALLIC()
+ COMMON_SRG_INPUTS_SPECULAR_F0()
+ COMMON_SRG_INPUTS_NORMAL()
+ COMMON_SRG_INPUTS_CLEAR_COAT()
+ COMMON_SRG_INPUTS_OCCLUSION()
+ COMMON_SRG_INPUTS_EMISSIVE()
+ // Note parallax is omitted here because that requires special handling.
+
+ bool m_normal_useTexture;
+ bool m_baseColor_useTexture;
+ bool m_metallic_useTexture;
+ bool m_specularF0_useTexture;
+ bool m_roughness_useTexture;
+ bool m_emissiveEnabled;
+ bool m_emissive_useTexture;
+ bool m_diffuseOcclusion_useTexture;
+ bool m_specularOcclusion_useTexture;
+ bool m_clearCoatEnabled;
+ bool m_clearCoat_factor_useTexture;
+ bool m_clearCoat_roughness_useTexture;
+ bool m_clearCoat_normal_useTexture;
+
+ TextureBlendMode m_baseColorTextureBlendMode;
+
+ float2 m_vertexUv[UvSetCount];
+ float3x3 m_uvMatrix;
+ float m_normal;
+ float3 m_tangents[UvSetCount];
+ float3 m_bitangents[UvSetCount];
+
+ sampler m_sampler;
+
+ bool m_isFrontFace;
+};
+
+//! Holds the final processed material inputs, after all flags have been checked, textures have been sampled, factors have been applied, etc.
+//! This data is ready to be copied into a Surface and/or LightingData struct for the lighting system to consume.
+class ProcessedMaterialInputs
+{
+ float3 m_normalTS; //!< Normal in tangent-space
+ float3 m_baseColor;
+ float3 m_specularF0Factor;
+ float m_metallic;
+ float m_roughness;
+ float3 m_emissiveLighting;
+ float m_diffuseAmbientOcclusion;
+ float m_specularOcclusion;
+ ClearCoatSurfaceData m_clearCoat;
+
+ void InitializeToZero()
+ {
+ m_normalTS = float3(0,0,0);
+ m_baseColor = float3(0,0,0);
+ m_specularF0Factor = float3(0,0,0);
+ m_metallic = 0.0f;
+ m_roughness = 0.0f;
+ m_emissiveLighting = float3(0,0,0);
+ m_diffuseAmbientOcclusion = 0;
+ m_specularOcclusion = 0;
+ m_clearCoat.InitializeToZero();
+ }
+};
+
+//! Processes the set of Standard material inputs for a single layer.
+//! The FILL_STANDARD_MATERIAL_INPUTS() macro below can be used to fill the StandardMaterialInputs struct.
+ProcessedMaterialInputs ProcessStandardMaterialInputs(StandardMaterialInputs inputs)
+{
+ ProcessedMaterialInputs result;
+
+ float2 transformedUv[UvSetCount];
+ transformedUv[0] = mul(inputs.m_uvMatrix, float3(inputs.m_vertexUv[0], 1.0)).xy;
+ transformedUv[1] = inputs.m_vertexUv[1];
+
+ float3x3 normalUvMatrix = inputs.m_normalMapUvIndex == 0 ? inputs.m_uvMatrix : CreateIdentity3x3();
+ result.m_normalTS = GetNormalInputTS(inputs.m_normalMap, inputs.m_sampler, transformedUv[inputs.m_normalMapUvIndex], inputs.m_flipNormalX, inputs.m_flipNormalY, normalUvMatrix, inputs.m_normal_useTexture, inputs.m_normalFactor);
+
+ float3 sampledBaseColor = GetBaseColorInput(inputs.m_baseColorMap, inputs.m_sampler, transformedUv[inputs.m_baseColorMapUvIndex], inputs.m_baseColor.rgb, inputs.m_baseColor_useTexture);
+ result.m_baseColor = BlendBaseColor(sampledBaseColor, inputs.m_baseColor.rgb, inputs.m_baseColorFactor, inputs.m_baseColorTextureBlendMode, inputs.m_baseColor_useTexture);
+ result.m_specularF0Factor = GetSpecularInput(inputs.m_specularF0Map, inputs.m_sampler, transformedUv[inputs.m_specularF0MapUvIndex], inputs.m_specularF0Factor, inputs.m_specularF0_useTexture);
+ result.m_metallic = GetMetallicInput(inputs.m_metallicMap, inputs.m_sampler, transformedUv[inputs.m_metallicMapUvIndex], inputs.m_metallicFactor, inputs.m_metallic_useTexture);
+ result.m_roughness = GetRoughnessInput(inputs.m_roughnessMap, MaterialSrg::m_sampler, transformedUv[inputs.m_roughnessMapUvIndex], inputs.m_roughnessFactor, inputs.m_roughnessLowerBound, inputs.m_roughnessUpperBound, inputs.m_roughness_useTexture);
+
+ result.m_emissiveLighting = GetEmissiveInput(inputs.m_emissiveMap, inputs.m_sampler, transformedUv[inputs.m_emissiveMapUvIndex], inputs.m_emissiveIntensity, inputs.m_emissiveColor.rgb, inputs.m_emissiveEnabled, inputs.m_emissive_useTexture);
+ result.m_diffuseAmbientOcclusion = GetOcclusionInput(inputs.m_diffuseOcclusionMap, inputs.m_sampler, transformedUv[inputs.m_diffuseOcclusionMapUvIndex], inputs.m_diffuseOcclusionFactor, inputs.m_diffuseOcclusion_useTexture);
+ result.m_specularOcclusion = GetOcclusionInput(inputs.m_specularOcclusionMap, MaterialSrg::m_sampler, transformedUv[inputs.m_specularOcclusionMapUvIndex], inputs.m_specularOcclusionFactor, inputs.m_specularOcclusion_useTexture);
+
+ result.m_clearCoat.InitializeToZero();
+ if(inputs.m_clearCoatEnabled)
+ {
+ float3x3 clearCoatUvMatrix = inputs.m_clearCoatNormalMapUvIndex == 0 ? inputs.m_uvMatrix : CreateIdentity3x3();
+
+ GetClearCoatInputs(inputs.m_clearCoatInfluenceMap, transformedUv[inputs.m_clearCoatInfluenceMapUvIndex], inputs.m_clearCoatFactor, inputs.m_clearCoat_factor_useTexture,
+ inputs.m_clearCoatRoughnessMap, transformedUv[inputs.m_clearCoatRoughnessMapUvIndex], inputs.m_clearCoatRoughness, inputs.m_clearCoat_roughness_useTexture,
+ inputs.m_clearCoatNormalMap, transformedUv[inputs.m_clearCoatNormalMapUvIndex], inputs.m_normal, inputs.m_clearCoat_normal_useTexture, inputs.m_clearCoatNormalStrength,
+ clearCoatUvMatrix, inputs.m_tangents[inputs.m_clearCoatNormalMapUvIndex], inputs.m_bitangents[inputs.m_clearCoatNormalMapUvIndex],
+ inputs.m_sampler, inputs.m_isFrontFace,
+ result.m_clearCoat.factor, result.m_clearCoat.roughness, result.m_clearCoat.normal);
+ }
+
+ return result;
+}
+
+//! Fills a StandardMaterialInputs struct with data from the MaterialSrg, shader options, and local vertex data.
+#define FILL_STANDARD_MATERIAL_INPUTS(inputs, srgLayerPrefix, optionsLayerPrefix, blendWeight) \
+ inputs.m_sampler = MaterialSrg::m_sampler; \
+ inputs.m_vertexUv = IN.m_uv; \
+ inputs.m_uvMatrix = srgLayerPrefix##m_uvMatrix; \
+ inputs.m_normal = IN.m_normal; \
+ inputs.m_tangents = tangents; \
+ inputs.m_bitangents = bitangents; \
+ inputs.m_isFrontFace = isFrontFace; \
+ \
+ inputs.m_normalMapUvIndex = srgLayerPrefix##m_normalMapUvIndex; \
+ inputs.m_normalMap = srgLayerPrefix##m_normalMap; \
+ inputs.m_flipNormalX = srgLayerPrefix##m_flipNormalX; \
+ inputs.m_flipNormalY = srgLayerPrefix##m_flipNormalY; \
+ inputs.m_normal_useTexture = optionsLayerPrefix##o_normal_useTexture; \
+ inputs.m_normalFactor = srgLayerPrefix##m_normalFactor * blendWeight; \
+ inputs.m_baseColorMap = srgLayerPrefix##m_baseColorMap; \
+ inputs.m_baseColorMapUvIndex = srgLayerPrefix##m_baseColorMapUvIndex; \
+ inputs.m_baseColor = srgLayerPrefix##m_baseColor; \
+ inputs.m_baseColor_useTexture = optionsLayerPrefix##o_baseColor_useTexture; \
+ inputs.m_baseColorFactor = srgLayerPrefix##m_baseColorFactor; \
+ inputs.m_baseColorTextureBlendMode = optionsLayerPrefix##o_baseColorTextureBlendMode; \
+ inputs.m_metallicMap = srgLayerPrefix##m_metallicMap; \
+ inputs.m_metallicMapUvIndex = srgLayerPrefix##m_metallicMapUvIndex; \
+ inputs.m_metallicFactor = srgLayerPrefix##m_metallicFactor; \
+ inputs.m_metallic_useTexture = optionsLayerPrefix##o_metallic_useTexture; \
+ inputs.m_specularF0Map = srgLayerPrefix##m_specularF0Map; \
+ inputs.m_specularF0MapUvIndex = srgLayerPrefix##m_specularF0MapUvIndex; \
+ inputs.m_specularF0Factor = srgLayerPrefix##m_specularF0Factor; \
+ inputs.m_specularF0_useTexture = optionsLayerPrefix##o_specularF0_useTexture; \
+ inputs.m_roughnessMap = srgLayerPrefix##m_roughnessMap; \
+ inputs.m_roughnessMapUvIndex = srgLayerPrefix##m_roughnessMapUvIndex; \
+ inputs.m_roughnessFactor = srgLayerPrefix##m_roughnessFactor; \
+ inputs.m_roughnessLowerBound = srgLayerPrefix##m_roughnessLowerBound; \
+ inputs.m_roughnessUpperBound = srgLayerPrefix##m_roughnessUpperBound; \
+ inputs.m_roughness_useTexture = optionsLayerPrefix##o_roughness_useTexture; \
+ \
+ inputs.m_emissiveMap = srgLayerPrefix##m_emissiveMap; \
+ inputs.m_emissiveMapUvIndex = srgLayerPrefix##m_emissiveMapUvIndex; \
+ inputs.m_emissiveIntensity = srgLayerPrefix##m_emissiveIntensity; \
+ inputs.m_emissiveColor = srgLayerPrefix##m_emissiveColor; \
+ inputs.m_emissiveEnabled = optionsLayerPrefix##o_emissiveEnabled; \
+ inputs.m_emissive_useTexture = optionsLayerPrefix##o_emissive_useTexture; \
+ \
+ inputs.m_diffuseOcclusionMap = srgLayerPrefix##m_diffuseOcclusionMap; \
+ inputs.m_diffuseOcclusionMapUvIndex = srgLayerPrefix##m_diffuseOcclusionMapUvIndex; \
+ inputs.m_diffuseOcclusionFactor = srgLayerPrefix##m_diffuseOcclusionFactor; \
+ inputs.m_diffuseOcclusion_useTexture = optionsLayerPrefix##o_diffuseOcclusion_useTexture; \
+ \
+ inputs.m_specularOcclusionMap = srgLayerPrefix##m_specularOcclusionMap; \
+ inputs.m_specularOcclusionMapUvIndex = srgLayerPrefix##m_specularOcclusionMapUvIndex; \
+ inputs.m_specularOcclusionFactor = srgLayerPrefix##m_specularOcclusionFactor; \
+ inputs.m_specularOcclusion_useTexture = optionsLayerPrefix##o_specularOcclusion_useTexture; \
+ \
+ inputs.m_clearCoatEnabled = o_clearCoat_feature_enabled && optionsLayerPrefix##o_clearCoat_enabled; \
+ inputs.m_clearCoatInfluenceMap = srgLayerPrefix##m_clearCoatInfluenceMap; \
+ inputs.m_clearCoatInfluenceMapUvIndex = srgLayerPrefix##m_clearCoatInfluenceMapUvIndex; \
+ inputs.m_clearCoatFactor = srgLayerPrefix##m_clearCoatFactor; \
+ inputs.m_clearCoat_factor_useTexture = optionsLayerPrefix##o_clearCoat_factor_useTexture; \
+ inputs.m_clearCoatRoughnessMap = srgLayerPrefix##m_clearCoatRoughnessMap; \
+ inputs.m_clearCoatRoughnessMapUvIndex = srgLayerPrefix##m_clearCoatRoughnessMapUvIndex; \
+ inputs.m_clearCoatRoughness = srgLayerPrefix##m_clearCoatRoughness; \
+ inputs.m_clearCoat_roughness_useTexture = optionsLayerPrefix##o_clearCoat_roughness_useTexture; \
+ inputs.m_clearCoatNormalMap = srgLayerPrefix##m_clearCoatNormalMap; \
+ inputs.m_clearCoatNormalMapUvIndex = srgLayerPrefix##m_clearCoatNormalMapUvIndex; \
+ inputs.m_clearCoat_normal_useTexture = optionsLayerPrefix##o_clearCoat_normal_useTexture; \
+ inputs.m_clearCoatNormalStrength = srgLayerPrefix##m_clearCoatNormalStrength;
+
// ---------- Pixel Shader ----------
@@ -174,7 +348,6 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
bool displacementIsClipped = false;
- // Parallax mapping's non uniform uv transformations break screen space subsurface scattering, disable it when subsurface scatteirng is enabled
if(ShouldHandleParallax())
{
float3x3 uvMatrix = MaterialSrg::m_parallaxUvIndex == 0 ? MaterialSrg::m_uvMatrix : CreateIdentity3x3();
@@ -197,108 +370,70 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
}
}
- Surface surface;
- surface.position = IN.m_worldPosition;
-
- // ------- Setup the per-layer UV transforms -------
-
- float2 uvLayer1[UvSetCount];
- float2 uvLayer2[UvSetCount];
- float2 uvLayer3[UvSetCount];
-
- // Only UV0 will be applied transforms from each layer.
- uvLayer1[0] = mul(MaterialSrg::m_layer1_m_uvMatrix, float3(IN.m_uv[0], 1.0)).xy;
- uvLayer2[0] = mul(MaterialSrg::m_layer2_m_uvMatrix, float3(IN.m_uv[0], 1.0)).xy;
- uvLayer3[0] = mul(MaterialSrg::m_layer3_m_uvMatrix, float3(IN.m_uv[0], 1.0)).xy;
- uvLayer1[1] = IN.m_uv[1];
- uvLayer2[1] = IN.m_uv[1];
- uvLayer3[1] = IN.m_uv[1];
-
// ------- Calculate Layer Blend Mask Values -------
// Now that any parallax has been calculated, we calculate the blend factors for any layers that are impacted by the parallax.
float3 blendWeights = GetBlendWeights(IN.m_uv[MaterialSrg::m_blendMaskUvIndex]);
- // ------- Normal -------
-
- float3 layer1_normalFactor = MaterialSrg::m_layer1_m_normalFactor * blendWeights.r;
- float3 layer2_normalFactor = MaterialSrg::m_layer2_m_normalFactor * blendWeights.g;
- float3 layer3_normalFactor = MaterialSrg::m_layer3_m_normalFactor * blendWeights.b;
- float3x3 layer1_uvMatrix = MaterialSrg::m_layer1_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer1_m_uvMatrix : CreateIdentity3x3();
- float3x3 layer2_uvMatrix = MaterialSrg::m_layer2_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer2_m_uvMatrix : CreateIdentity3x3();
- float3x3 layer3_uvMatrix = MaterialSrg::m_layer3_m_normalMapUvIndex == 0 ? MaterialSrg::m_layer3_m_uvMatrix : CreateIdentity3x3();
- float3 layer1_normalTS = GetNormalInputTS(MaterialSrg::m_layer1_m_normalMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_normalMapUvIndex], MaterialSrg::m_layer1_m_flipNormalX, MaterialSrg::m_layer1_m_flipNormalY, layer1_uvMatrix, o_layer1_o_normal_useTexture, layer1_normalFactor);
- float3 layer2_normalTS = GetNormalInputTS(MaterialSrg::m_layer2_m_normalMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_normalMapUvIndex], MaterialSrg::m_layer2_m_flipNormalX, MaterialSrg::m_layer2_m_flipNormalY, layer2_uvMatrix, o_layer2_o_normal_useTexture, layer2_normalFactor);
- float3 layer3_normalTS = GetNormalInputTS(MaterialSrg::m_layer3_m_normalMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_normalMapUvIndex], MaterialSrg::m_layer3_m_flipNormalX, MaterialSrg::m_layer3_m_flipNormalY, layer3_uvMatrix, o_layer3_o_normal_useTexture, layer3_normalFactor);
-
- float3 normalTS = ReorientTangentSpaceNormal(layer1_normalTS, layer2_normalTS);
- normalTS = ReorientTangentSpaceNormal(normalTS, layer3_normalTS);
- // [GFX TODO][ATOM-14591]: This will only work if the normal maps all use the same UV stream. We would need to add support for having them in different UV streams.
- surface.normal = normalize(TangentSpaceToWorld(normalTS, IN.m_normal, tangents[MaterialSrg::m_parallaxUvIndex], bitangents[MaterialSrg::m_parallaxUvIndex]));
-
- // ------- Base Color -------
-
- float2 layer1_baseColorUv = uvLayer1[MaterialSrg::m_layer1_m_baseColorMapUvIndex];
- float2 layer2_baseColorUv = uvLayer2[MaterialSrg::m_layer2_m_baseColorMapUvIndex];
- float2 layer3_baseColorUv = uvLayer3[MaterialSrg::m_layer3_m_baseColorMapUvIndex];
-
- float3 layer1_sampledColor = GetBaseColorInput(MaterialSrg::m_layer1_m_baseColorMap, MaterialSrg::m_sampler, layer1_baseColorUv, MaterialSrg::m_layer1_m_baseColor.rgb, o_layer1_o_baseColor_useTexture);
- float3 layer2_sampledColor = GetBaseColorInput(MaterialSrg::m_layer2_m_baseColorMap, MaterialSrg::m_sampler, layer2_baseColorUv, MaterialSrg::m_layer2_m_baseColor.rgb, o_layer2_o_baseColor_useTexture);
- float3 layer3_sampledColor = GetBaseColorInput(MaterialSrg::m_layer3_m_baseColorMap, MaterialSrg::m_sampler, layer3_baseColorUv, MaterialSrg::m_layer3_m_baseColor.rgb, o_layer3_o_baseColor_useTexture);
- float3 layer1_baseColor = BlendBaseColor(layer1_sampledColor, MaterialSrg::m_layer1_m_baseColor.rgb, MaterialSrg::m_layer1_m_baseColorFactor, o_layer1_o_baseColorTextureBlendMode, o_layer1_o_baseColor_useTexture);
- float3 layer2_baseColor = BlendBaseColor(layer2_sampledColor, MaterialSrg::m_layer2_m_baseColor.rgb, MaterialSrg::m_layer2_m_baseColorFactor, o_layer2_o_baseColorTextureBlendMode, o_layer2_o_baseColor_useTexture);
- float3 layer3_baseColor = BlendBaseColor(layer3_sampledColor, MaterialSrg::m_layer3_m_baseColor.rgb, MaterialSrg::m_layer3_m_baseColorFactor, o_layer3_o_baseColorTextureBlendMode, o_layer3_o_baseColor_useTexture);
- float3 baseColor = BlendLayers(layer1_baseColor, layer2_baseColor, layer3_baseColor, blendWeights);
-
- if(o_parallax_highlightClipping && displacementIsClipped)
+ // ------- Layer 1 (base layer) -----------
+
+ ProcessedMaterialInputs lightingInputLayer1;
{
- ApplyParallaxClippingHighlight(baseColor);
+ StandardMaterialInputs inputs;
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer1_, o_layer1_, blendWeights.r)
+ lightingInputLayer1 = ProcessStandardMaterialInputs(inputs);
}
+
+ // ----------- Layer 2 -----------
- // ------- Metallic -------
-
- float metallic = 0;
- if(!o_enableSubsurfaceScattering) // If subsurface scattering is enabled skip texture lookup for metallic, as this quantity won't be used anyway
+ ProcessedMaterialInputs lightingInputLayer2;
{
- float layer1_metallic = GetMetallicInput(MaterialSrg::m_layer1_m_metallicMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_metallicMapUvIndex], MaterialSrg::m_layer1_m_metallicFactor, o_layer1_o_metallic_useTexture);
- float layer2_metallic = GetMetallicInput(MaterialSrg::m_layer2_m_metallicMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_metallicMapUvIndex], MaterialSrg::m_layer2_m_metallicFactor, o_layer2_o_metallic_useTexture);
- float layer3_metallic = GetMetallicInput(MaterialSrg::m_layer3_m_metallicMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_metallicMapUvIndex], MaterialSrg::m_layer3_m_metallicFactor, o_layer3_o_metallic_useTexture);
- metallic = BlendLayers(layer1_metallic, layer2_metallic, layer3_metallic, blendWeights);
+ StandardMaterialInputs inputs;
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer2_, o_layer2_, blendWeights.g)
+ lightingInputLayer2 = ProcessStandardMaterialInputs(inputs);
}
- // ------- Specular -------
-
- float layer1_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer1_m_specularF0Map, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_specularF0MapUvIndex], MaterialSrg::m_layer1_m_specularF0Factor, o_layer1_o_specularF0_useTexture);
- float layer2_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer2_m_specularF0Map, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_specularF0MapUvIndex], MaterialSrg::m_layer2_m_specularF0Factor, o_layer2_o_specularF0_useTexture);
- float layer3_specularF0Factor = GetSpecularInput(MaterialSrg::m_layer3_m_specularF0Map, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_specularF0MapUvIndex], MaterialSrg::m_layer3_m_specularF0Factor, o_layer3_o_specularF0_useTexture);
- float specularF0Factor = BlendLayers(layer1_specularF0Factor, layer2_specularF0Factor, layer3_specularF0Factor, blendWeights);
-
- surface.SetAlbedoAndSpecularF0(baseColor, specularF0Factor, metallic);
+ // ----------- Layer 3 -----------
- // ------- Roughness -------
+ ProcessedMaterialInputs lightingInputLayer3;
+ {
+ StandardMaterialInputs inputs;
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer3_, o_layer3_, blendWeights.b)
+ lightingInputLayer3 = ProcessStandardMaterialInputs(inputs);
+ }
- float layer1_roughness = GetRoughnessInput(MaterialSrg::m_layer1_m_roughnessMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_roughnessMapUvIndex], MaterialSrg::m_layer1_m_roughnessFactor, MaterialSrg::m_layer1_m_roughnessLowerBound, MaterialSrg::m_layer1_m_roughnessUpperBound, o_layer1_o_roughness_useTexture);
- float layer2_roughness = GetRoughnessInput(MaterialSrg::m_layer2_m_roughnessMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_roughnessMapUvIndex], MaterialSrg::m_layer2_m_roughnessFactor, MaterialSrg::m_layer2_m_roughnessLowerBound, MaterialSrg::m_layer2_m_roughnessUpperBound, o_layer2_o_roughness_useTexture);
- float layer3_roughness = GetRoughnessInput(MaterialSrg::m_layer3_m_roughnessMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_roughnessMapUvIndex], MaterialSrg::m_layer3_m_roughnessFactor, MaterialSrg::m_layer3_m_roughnessLowerBound, MaterialSrg::m_layer3_m_roughnessUpperBound, o_layer3_o_roughness_useTexture);
- surface.roughnessLinear = BlendLayers(layer1_roughness, layer2_roughness, layer3_roughness, blendWeights);
+ // ------- Combine all layers ---------
+
+ Surface surface;
+ surface.position = IN.m_worldPosition;
+ surface.transmission.InitializeToZero();
- surface.CalculateRoughnessA();
+ // ------- Combine Normals ---------
- // ------- Subsurface -------
+ float3 normalTS = lightingInputLayer1.m_normalTS;
+ normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer2.m_normalTS);
+ normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer3.m_normalTS);
+ // [GFX TODO][ATOM-14591]: This will only work if the normal maps all use the same UV stream. We would need to add support for having them in different UV streams.
+ surface.normal = normalize(TangentSpaceToWorld(normalTS, IN.m_normal, tangents[MaterialSrg::m_parallaxUvIndex], bitangents[MaterialSrg::m_parallaxUvIndex]));
+
+ // ------- Combine Albedo, roughness, specular, roughness ---------
- float2 subsurfaceUv = IN.m_uv[MaterialSrg::m_subsurfaceScatteringInfluenceMapUvIndex];
- float surfaceScatteringFactor = GetSubsurfaceInput(MaterialSrg::m_subsurfaceScatteringInfluenceMap, MaterialSrg::m_sampler, subsurfaceUv, MaterialSrg::m_subsurfaceScatteringFactor);
+ float3 baseColor = BlendLayers(lightingInputLayer1.m_baseColor, lightingInputLayer2.m_baseColor, lightingInputLayer3.m_baseColor, blendWeights);
+ float3 specularF0Factor = BlendLayers(lightingInputLayer1.m_specularF0Factor, lightingInputLayer2.m_specularF0Factor, lightingInputLayer3.m_specularF0Factor, blendWeights);
+ float3 metallic = BlendLayers(lightingInputLayer1.m_metallic, lightingInputLayer2.m_metallic, lightingInputLayer3.m_metallic, blendWeights);
+
+ if(o_parallax_highlightClipping && displacementIsClipped)
+ {
+ ApplyParallaxClippingHighlight(baseColor);
+ }
- // ------- Transmission -------
+ surface.SetAlbedoAndSpecularF0(baseColor, specularF0Factor, metallic);
- float2 transmissionUv = IN.m_uv[MaterialSrg::m_transmissionThicknessMapUvIndex];
- float4 transmissionTintThickness = GeTransmissionInput(MaterialSrg::m_transmissionThicknessMap, MaterialSrg::m_sampler, transmissionUv, MaterialSrg::m_transmissionTintThickness);
- surface.transmission.tint = transmissionTintThickness.rgb;
- surface.transmission.thickness = transmissionTintThickness.w;
- surface.transmission.transmissionParams = MaterialSrg::m_transmissionParams;
+ surface.roughnessLinear = BlendLayers(lightingInputLayer1.m_roughness, lightingInputLayer2.m_roughness, lightingInputLayer3.m_roughness, blendWeights);
+ surface.CalculateRoughnessA();
+
+ // ------- Init and Combine Lighting Data -------
- // ------- Lighting Data -------
-
LightingData lightingData;
// Light iterator
@@ -307,88 +442,22 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// Directional light shadow coordinates
lightingData.shadowCoords = IN.m_shadowCoords;
-
- // ------- Emissive -------
- float3 layer1_emissive = GetEmissiveInput(MaterialSrg::m_layer1_m_emissiveMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_emissiveMapUvIndex], MaterialSrg::m_layer1_m_emissiveIntensity, MaterialSrg::m_layer1_m_emissiveColor.rgb, o_layer1_o_emissiveEnabled, o_layer1_o_emissive_useTexture);
- float3 layer2_emissive = GetEmissiveInput(MaterialSrg::m_layer2_m_emissiveMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_emissiveMapUvIndex], MaterialSrg::m_layer2_m_emissiveIntensity, MaterialSrg::m_layer2_m_emissiveColor.rgb, o_layer2_o_emissiveEnabled, o_layer2_o_emissive_useTexture);
- float3 layer3_emissive = GetEmissiveInput(MaterialSrg::m_layer3_m_emissiveMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_emissiveMapUvIndex], MaterialSrg::m_layer3_m_emissiveIntensity, MaterialSrg::m_layer3_m_emissiveColor.rgb, o_layer3_o_emissiveEnabled, o_layer3_o_emissive_useTexture);
- lightingData.emissiveLighting = BlendLayers(layer1_emissive, layer2_emissive, layer3_emissive, blendWeights);
+ lightingData.emissiveLighting = BlendLayers(lightingInputLayer1.m_emissiveLighting, lightingInputLayer2.m_emissiveLighting, lightingInputLayer3.m_emissiveLighting, blendWeights);
+ lightingData.specularOcclusion = BlendLayers(lightingInputLayer1.m_specularOcclusion, lightingInputLayer2.m_specularOcclusion, lightingInputLayer3.m_specularOcclusion, blendWeights);
+ lightingData.diffuseAmbientOcclusion = BlendLayers(lightingInputLayer1.m_diffuseAmbientOcclusion, lightingInputLayer2.m_diffuseAmbientOcclusion, lightingInputLayer3.m_diffuseAmbientOcclusion, blendWeights);
- // ------- Occlusion -------
-
- float layer1_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer1_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer1_m_diffuseOcclusionFactor, o_layer1_o_diffuseOcclusion_useTexture);
- float layer2_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer2_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer2_m_diffuseOcclusionFactor, o_layer2_o_diffuseOcclusion_useTexture);
- float layer3_diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_layer3_m_diffuseOcclusionMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_diffuseOcclusionMapUvIndex], MaterialSrg::m_layer3_m_diffuseOcclusionFactor, o_layer3_o_diffuseOcclusion_useTexture);
- lightingData.diffuseAmbientOcclusion = BlendLayers(layer1_diffuseAmbientOcclusion, layer2_diffuseAmbientOcclusion, layer3_diffuseAmbientOcclusion, blendWeights);
-
- float layer1_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer1_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer1[MaterialSrg::m_layer1_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer1_m_specularOcclusionFactor, o_layer1_o_specularOcclusion_useTexture);
- float layer2_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer2_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer2[MaterialSrg::m_layer2_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer2_m_specularOcclusionFactor, o_layer2_o_specularOcclusion_useTexture);
- float layer3_specularOcclusion = GetOcclusionInput(MaterialSrg::m_layer3_m_specularOcclusionMap, MaterialSrg::m_sampler, uvLayer3[MaterialSrg::m_layer3_m_specularOcclusionMapUvIndex], MaterialSrg::m_layer3_m_specularOcclusionFactor, o_layer3_o_specularOcclusion_useTexture);
- lightingData.specularOcclusion = BlendLayers(layer1_specularOcclusion, layer2_specularOcclusion, layer3_specularOcclusion, blendWeights);
+ lightingData.CalculateMultiscatterCompensation(surface.specularF0, o_specularF0_enableMultiScatterCompensation);
- // ------- Clearcoat -------
+ // ------- Combine Clearcoat -------
if(o_clearCoat_feature_enabled)
{
- // --- Layer 1 ---
-
- float layer1_clearCoatFactor = 0.0f;
- float layer1_clearCoatRoughness = 0.0f;
- float3 layer1_clearCoatNormal = float3(0.0, 0.0, 0.0);
- if(o_layer1_o_clearCoat_enabled)
- {
- float3x3 layer1_uvMatrix = MaterialSrg::m_layer1_m_clearCoatNormalMapUvIndex == 0 ? MaterialSrg::m_layer1_m_uvMatrix : CreateIdentity3x3();
-
- GetClearCoatInputs(MaterialSrg::m_layer1_m_clearCoatInfluenceMap, uvLayer1[MaterialSrg::m_layer1_m_clearCoatInfluenceMapUvIndex], MaterialSrg::m_layer1_m_clearCoatFactor, o_layer1_o_clearCoat_factor_useTexture,
- MaterialSrg::m_layer1_m_clearCoatRoughnessMap, uvLayer1[MaterialSrg::m_layer1_m_clearCoatRoughnessMapUvIndex], MaterialSrg::m_layer1_m_clearCoatRoughness, o_layer1_o_clearCoat_roughness_useTexture,
- MaterialSrg::m_layer1_m_clearCoatNormalMap, uvLayer1[MaterialSrg::m_layer1_m_clearCoatNormalMapUvIndex], IN.m_normal, o_layer1_o_clearCoat_normal_useTexture, MaterialSrg::m_layer1_m_clearCoatNormalStrength,
- layer1_uvMatrix, tangents[MaterialSrg::m_layer1_m_clearCoatNormalMapUvIndex], bitangents[MaterialSrg::m_layer1_m_clearCoatNormalMapUvIndex],
- MaterialSrg::m_sampler, isFrontFace,
- layer1_clearCoatFactor, layer1_clearCoatRoughness, layer1_clearCoatNormal);
- }
-
- // --- Layer 2 ---
-
- float layer2_clearCoatFactor = 0.0f;
- float layer2_clearCoatRoughness = 0.0f;
- float3 layer2_clearCoatNormal = float3(0.0, 0.0, 0.0);
- if(o_layer2_o_clearCoat_enabled)
- {
- float3x3 layer2_uvMatrix = MaterialSrg::m_layer2_m_clearCoatNormalMapUvIndex == 0 ? MaterialSrg::m_layer2_m_uvMatrix : CreateIdentity3x3();
-
- GetClearCoatInputs(MaterialSrg::m_layer2_m_clearCoatInfluenceMap, uvLayer2[MaterialSrg::m_layer2_m_clearCoatInfluenceMapUvIndex], MaterialSrg::m_layer2_m_clearCoatFactor, o_layer2_o_clearCoat_factor_useTexture,
- MaterialSrg::m_layer2_m_clearCoatRoughnessMap, uvLayer2[MaterialSrg::m_layer2_m_clearCoatRoughnessMapUvIndex], MaterialSrg::m_layer2_m_clearCoatRoughness, o_layer2_o_clearCoat_roughness_useTexture,
- MaterialSrg::m_layer2_m_clearCoatNormalMap, uvLayer2[MaterialSrg::m_layer2_m_clearCoatNormalMapUvIndex], IN.m_normal, o_layer2_o_clearCoat_normal_useTexture, MaterialSrg::m_layer2_m_clearCoatNormalStrength,
- layer2_uvMatrix, tangents[MaterialSrg::m_layer2_m_clearCoatNormalMapUvIndex], bitangents[MaterialSrg::m_layer2_m_clearCoatNormalMapUvIndex],
- MaterialSrg::m_sampler, isFrontFace,
- layer2_clearCoatFactor, layer2_clearCoatRoughness, layer2_clearCoatNormal);
- }
-
- // --- Layer 3 ---
-
- float layer3_clearCoatFactor = 0.0f;
- float layer3_clearCoatRoughness = 0.0f;
- float3 layer3_clearCoatNormal = float3(0.0, 0.0, 0.0);
- if(o_layer3_o_clearCoat_enabled)
- {
- float3x3 layer3_uvMatrix = MaterialSrg::m_layer3_m_clearCoatNormalMapUvIndex == 0 ? MaterialSrg::m_layer3_m_uvMatrix : CreateIdentity3x3();
-
- GetClearCoatInputs(MaterialSrg::m_layer3_m_clearCoatInfluenceMap, uvLayer3[MaterialSrg::m_layer3_m_clearCoatInfluenceMapUvIndex], MaterialSrg::m_layer3_m_clearCoatFactor, o_layer3_o_clearCoat_factor_useTexture,
- MaterialSrg::m_layer3_m_clearCoatRoughnessMap, uvLayer3[MaterialSrg::m_layer3_m_clearCoatRoughnessMapUvIndex], MaterialSrg::m_layer3_m_clearCoatRoughness, o_layer3_o_clearCoat_roughness_useTexture,
- MaterialSrg::m_layer3_m_clearCoatNormalMap, uvLayer3[MaterialSrg::m_layer3_m_clearCoatNormalMapUvIndex], IN.m_normal, o_layer3_o_clearCoat_normal_useTexture, MaterialSrg::m_layer3_m_clearCoatNormalStrength,
- layer3_uvMatrix, tangents[MaterialSrg::m_layer3_m_clearCoatNormalMapUvIndex], bitangents[MaterialSrg::m_layer3_m_clearCoatNormalMapUvIndex],
- MaterialSrg::m_sampler, isFrontFace,
- layer3_clearCoatFactor, layer3_clearCoatRoughness, layer3_clearCoatNormal);
- }
-
- // --- Blend Layers ---
-
- surface.clearCoat.factor = BlendLayers(layer1_clearCoatFactor, layer2_clearCoatFactor, layer3_clearCoatFactor, blendWeights);
- surface.clearCoat.roughness = BlendLayers(layer1_clearCoatRoughness, layer2_clearCoatRoughness, layer3_clearCoatRoughness, blendWeights);
+ surface.clearCoat.factor = BlendLayers(lightingInputLayer1.m_clearCoat.factor, lightingInputLayer2.m_clearCoat.factor, lightingInputLayer3.m_clearCoat.factor, blendWeights);
+ surface.clearCoat.roughness = BlendLayers(lightingInputLayer1.m_clearCoat.roughness, lightingInputLayer2.m_clearCoat.roughness, lightingInputLayer3.m_clearCoat.roughness, blendWeights);
// [GFX TODO][ATOM-14592] This is not the right way to blend the normals. We need to use ReorientTangentSpaceNormal(), and that requires GetClearCoatInputs() to return the normal in TS instead of WS.
- surface.clearCoat.normal = BlendLayers(layer1_clearCoatNormal, layer2_clearCoatNormal, layer3_clearCoatNormal, blendWeights);
+ surface.clearCoat.normal = BlendLayers(lightingInputLayer1.m_clearCoat.normal, lightingInputLayer2.m_clearCoat.normal, lightingInputLayer3.m_clearCoat.normal, blendWeights);
surface.clearCoat.normal = normalize(surface.clearCoat.normal);
// manipulate base layer f0 if clear coat is enabled
@@ -408,11 +477,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// Clear coat layer has fixed IOR = 1.5 and transparent => F0 = (1.5 - 1)^2 / (1.5 + 1)^2 = 0.04
lightingData.diffuseResponse *= 1.0 - (FresnelSchlickWithRoughness(lightingData.NdotV, float3(0.04, 0.04, 0.04), surface.clearCoat.roughness) * surface.clearCoat.factor);
}
-
- // ------- Multiscatter -------
-
- lightingData.CalculateMultiscatterCompensation(surface.specularF0, o_specularF0_enableMultiScatterCompensation);
-
+
// ------- Lighting Calculation -------
// Apply Decals
@@ -425,17 +490,14 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
ApplyIBL(surface, lightingData);
// Finalize Lighting
- lightingData.FinalizeLighting(surface.transmission.tint);
+ lightingData.FinalizeLighting(0);
const float alpha = 1.0;
PbrLightingOutput lightingOutput = GetPbrLightingOutput(surface, lightingData, alpha);
- // Pack factor and quality, drawback: because of precision limit of float16 cannot represent exact 1, maximum representable value is 0.9961
- uint factorAndQuality = dot(round(float2(saturate(surfaceScatteringFactor), MaterialSrg::m_subsurfaceScatteringQuality) * 255), float2(256, 1));
- lightingOutput.m_diffuseColor.w = factorAndQuality * (o_enableSubsurfaceScattering ? 1.0 : -1.0);
-
+ lightingOutput.m_diffuseColor.w = -1; // Disable subsurface scattering
return lightingOutput;
}
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Surfaces/StandardSurface.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Surfaces/StandardSurface.azsli
index bb63d27df0..85d9370d2b 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Surfaces/StandardSurface.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Surfaces/StandardSurface.azsli
@@ -32,6 +32,8 @@ class Surface
float roughnessA; //!< Actual roughness value ( a.k.a. "alpha roughness") to be used in microfacet calculations
float roughnessA2; //!< Alpha roughness ^ 2 (i.e. roughnessA * roughnessA), used in GGX, cached here for perfromance
+ void InitializeToZero();
+
//! Applies specular anti-aliasing to roughnessA2
void ApplySpecularAA();
@@ -43,6 +45,18 @@ class Surface
};
+void Surface::InitializeToZero()
+{
+ clearCoat.InitializeToZero();
+ transmission.InitializeToZero();
+ position = float3(0,0,0);
+ normal = float3(0,0,0);
+ albedo = float3(0,0,0);
+ specularF0 = float3(0,0,0);
+ roughnessLinear = 0.0f;
+ roughnessA = 0.0f;
+ roughnessA2 = 0.0f;
+}
// Specular Anti-Aliasing technique from this paper:
// http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
From 275bb1bfeccabb816880960c6afe61ff80e9fb58 Mon Sep 17 00:00:00 2001
From: Chris Santora
Date: Tue, 11 May 2021 17:25:53 -0700
Subject: [PATCH 041/330] ATOM-14688 Disable Individual Layers
Added flags for enabling StandardMultilayerPBR layers 2 and 3. This makes it easy to create a two-layer material, or to flip layers off and on for debugging.
---
.../Types/StandardMultilayerPBR.materialtype | 22 +++++++
.../Types/StandardMultilayerPBR_Common.azsli | 62 +++++++++++++------
.../StandardMultilayerPBR_ForwardPass.azsl | 20 +++++-
.../001_ManyFeatures.material | 4 ++
.../001_ManyFeatures_Layer2Off.material | 11 ++++
.../001_ManyFeatures_Layer3Off.material | 11 ++++
.../002_ParallaxPdo.material | 4 ++
7 files changed, 113 insertions(+), 21 deletions(-)
create mode 100644 Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer2Off.material
create mode 100644 Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer3Off.material
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
index 90a599c6f9..b49c66346f 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
@@ -295,6 +295,28 @@
}
],
"blend": [
+ {
+ "id": "enableLayer2",
+ "displayName": "Enable Layer 2",
+ "description": "Whether to enable layer 2.",
+ "type": "Bool",
+ "defaultValue": false,
+ "connection": {
+ "type": "ShaderOption",
+ "id": "o_layer2_enabled"
+ }
+ },
+ {
+ "id": "enableLayer3",
+ "displayName": "Enable Layer 3",
+ "description": "Whether to enable layer 3.",
+ "type": "Bool",
+ "defaultValue": false,
+ "connection": {
+ "type": "ShaderOption",
+ "id": "o_layer3_enabled"
+ }
+ },
{
"id": "blendSource",
"displayName": "Blend Source",
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
index 8c7b49214b..d2314efefe 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_Common.azsli
@@ -95,6 +95,9 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
// ------ Shader Options ----------------------------------------
+option bool o_layer2_enabled;
+option bool o_layer3_enabled;
+
enum class DebugDrawMode { None, BlendSource, DepthMaps };
option DebugDrawMode o_debugDrawMode;
@@ -146,14 +149,27 @@ float3 GetBlendSourceValues(float2 uv)
{
float3 blendSourceValues = float3(0,0,0);
- switch(GetFinalBlendMaskSource())
+ if(o_layer2_enabled || o_layer3_enabled)
{
- case BlendMaskSource::TextureMap:
- blendSourceValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, uv).rgb;
- break;
- case BlendMaskSource::VertexColors:
- blendSourceValues = s_blendMaskFromVertexStream;
- break;
+ switch(GetFinalBlendMaskSource())
+ {
+ case BlendMaskSource::TextureMap:
+ blendSourceValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, uv).rgb;
+ break;
+ case BlendMaskSource::VertexColors:
+ blendSourceValues = s_blendMaskFromVertexStream;
+ break;
+ }
+
+ if(!o_layer2_enabled)
+ {
+ blendSourceValues.r = 0.0;
+ }
+
+ if(!o_layer3_enabled)
+ {
+ blendSourceValues.g = 0.0;
+ }
}
return blendSourceValues;
@@ -167,18 +183,26 @@ float3 GetBlendSourceValues(float2 uv)
//! layer3 = b
float3 GetBlendWeights(float2 uv)
{
- float3 blendSourceValues = GetBlendSourceValues(uv);
+ float3 blendWeights;
+
+ if(o_layer2_enabled || o_layer3_enabled)
+ {
+ float3 blendSourceValues = GetBlendSourceValues(uv);
- // Calculate blend weights such that multiplying and adding them with layer data is equivalent
- // to lerping between each layer.
- // final = lerp(final, layer1, blendWeights.r)
- // final = lerp(final, layer2, blendWeights.g)
- // final = lerp(final, layer3, blendWeights.b)
+ // Calculate blend weights such that multiplying and adding them with layer data is equivalent
+ // to lerping between each layer.
+ // final = lerp(final, layer1, blendWeights.r)
+ // final = lerp(final, layer2, blendWeights.g)
+ // final = lerp(final, layer3, blendWeights.b)
- float3 blendWeights;
- blendWeights.b = blendSourceValues.g;
- blendWeights.g = (1.0 - blendSourceValues.g) * blendSourceValues.r;
- blendWeights.r = (1.0 - blendSourceValues.g) * (1.0 - blendSourceValues.r);
+ blendWeights.b = blendSourceValues.g;
+ blendWeights.g = (1.0 - blendSourceValues.g) * blendSourceValues.r;
+ blendWeights.r = (1.0 - blendSourceValues.g) * (1.0 - blendSourceValues.r);
+ }
+ else
+ {
+ blendWeights = float3(1,0,0);
+ }
return blendWeights;
}
@@ -230,7 +254,7 @@ DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
layerDepthValues.r -= MaterialSrg::m_layer1_m_depthOffset;
}
- if(o_layer2_o_useDepthMap)
+ if(o_layer2_enabled && o_layer2_o_useDepthMap)
{
float2 layerUv = uv;
if(MaterialSrg::m_parallaxUvIndex == 0)
@@ -243,7 +267,7 @@ DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
layerDepthValues.g -= MaterialSrg::m_layer2_m_depthOffset;
}
- if(o_layer3_o_useDepthMap)
+ if(o_layer3_enabled && o_layer3_o_useDepthMap)
{
float2 layerUv = uv;
if(MaterialSrg::m_parallaxUvIndex == 0)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
index 9e5a2e623a..8d5d32940d 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
@@ -387,20 +387,30 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ----------- Layer 2 -----------
ProcessedMaterialInputs lightingInputLayer2;
+ if(o_layer2_enabled)
{
StandardMaterialInputs inputs;
FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer2_, o_layer2_, blendWeights.g)
lightingInputLayer2 = ProcessStandardMaterialInputs(inputs);
}
+ else
+ {
+ lightingInputLayer2.InitializeToZero();
+ }
// ----------- Layer 3 -----------
ProcessedMaterialInputs lightingInputLayer3;
+ if(o_layer3_enabled)
{
StandardMaterialInputs inputs;
FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer3_, o_layer3_, blendWeights.b)
lightingInputLayer3 = ProcessStandardMaterialInputs(inputs);
}
+ else
+ {
+ lightingInputLayer3.InitializeToZero();
+ }
// ------- Combine all layers ---------
@@ -411,8 +421,14 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ------- Combine Normals ---------
float3 normalTS = lightingInputLayer1.m_normalTS;
- normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer2.m_normalTS);
- normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer3.m_normalTS);
+ if(o_layer2_enabled)
+ {
+ normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer2.m_normalTS);
+ }
+ if(o_layer3_enabled)
+ {
+ normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer3.m_normalTS);
+ }
// [GFX TODO][ATOM-14591]: This will only work if the normal maps all use the same UV stream. We would need to add support for having them in different UV streams.
surface.normal = normalize(TangentSpaceToWorld(normalTS, IN.m_normal, tangents[MaterialSrg::m_parallaxUvIndex], bitangents[MaterialSrg::m_parallaxUvIndex]));
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
index b85705fcb8..d9a4aabe2a 100644
--- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material
@@ -4,6 +4,10 @@
"parentMaterial": "",
"propertyLayoutVersion": 3,
"properties": {
+ "blend": {
+ "enableLayer2": true,
+ "enableLayer3": true
+ },
"layer1_baseColor": {
"color": [
0.3495536744594574,
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer2Off.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer2Off.material
new file mode 100644
index 0000000000..d91cfb34eb
--- /dev/null
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer2Off.material
@@ -0,0 +1,11 @@
+{
+ "description": "",
+ "materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
+ "parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material",
+ "propertyLayoutVersion": 3,
+ "properties": {
+ "blend": {
+ "enableLayer2": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer3Off.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer3Off.material
new file mode 100644
index 0000000000..3ee48df612
--- /dev/null
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures_Layer3Off.material
@@ -0,0 +1,11 @@
+{
+ "description": "",
+ "materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
+ "parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material",
+ "propertyLayoutVersion": 3,
+ "properties": {
+ "blend": {
+ "enableLayer3": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
index f6c881aee5..0bf4177db9 100644
--- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
+++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material
@@ -4,6 +4,10 @@
"parentMaterial": "",
"propertyLayoutVersion": 3,
"properties": {
+ "blend": {
+ "enableLayer2": true,
+ "enableLayer3": true
+ },
"layer1_baseColor": {
"textureMap": "TestData/Textures/cc0/bark1_col.jpg"
},
From c777e2e35301cd0054fe39e8fdccb5e632d48a21 Mon Sep 17 00:00:00 2001
From: scottr
Date: Tue, 11 May 2021 18:07:19 -0700
Subject: [PATCH 042/330] [cpack_installer] some cpack cleanup and prep for
online installer support (pre/post build steps)
---
cmake/Packaging.cmake | 28 +++++++++++++------
.../Platform/Windows/PackagingPostBuild.cmake | 12 ++++++++
.../Platform/Windows/Packaging_windows.cmake | 8 ++++--
.../Windows/platform_windows_files.cmake | 1 +
4 files changed, 38 insertions(+), 11 deletions(-)
create mode 100644 cmake/Platform/Windows/PackagingPostBuild.cmake
diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake
index 4f6565edc7..e398ea7509 100644
--- a/cmake/Packaging.cmake
+++ b/cmake/Packaging.cmake
@@ -13,28 +13,38 @@ if(NOT PAL_TRAIT_BUILD_CPACK_SUPPORTED)
return()
endif()
-ly_get_absolute_pal_filename(pal_dir ${CMAKE_SOURCE_DIR}/cmake/Platform/${PAL_HOST_PLATFORM_NAME})
-include(${pal_dir}/Packaging_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
-
-# if we get here and the generator hasn't been set, then a non fatal error occurred disabling packaging support
-if(NOT CPACK_GENERATOR)
- return()
-endif()
+# set the common cpack variables first so they are accessible via configure_file
+# when the platforms specific properties are applied below
+set(LY_INSTALLER_DOWNLOAD_URL "" CACHE PATH "URL embded into the installer to download additional artifacts")
set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${LY_VERSION_STRING}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Installation Tool")
string(TOLOWER ${PROJECT_NAME} _project_name_lower)
-set(CPACK_PACKAGE_FILE_NAME "${_project_name_lower}_installer")
+set(CPACK_PACKAGE_FILE_NAME "${_project_name_lower}_${LY_VERSION_STRING}_installer")
set(DEFAULT_LICENSE_NAME "Apache-2.0")
-set(DEFAULT_LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
+set(DEFAULT_LICENSE_FILE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_LICENSE ${DEFAULT_LICENSE_FILE})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_VERSION}")
+# custom cpack cache variables for use in pre/post build scripts
+set(CPACK_SOURCE_DIR ${CMAKE_SOURCE_DIR}/cmake)
+set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR}/installer)
+set(CPACK_DOWNLOAD_URL ${LY_INSTALLER_DOWNLOAD_URL})
+
+# attempt to apply platform specific settings
+ly_get_absolute_pal_filename(pal_dir ${CMAKE_SOURCE_DIR}/cmake/Platform/${PAL_HOST_PLATFORM_NAME})
+include(${pal_dir}/Packaging_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
+
+# if we get here and the generator hasn't been set, then a non fatal error occurred disabling packaging support
+if(NOT CPACK_GENERATOR)
+ return()
+endif()
+
# IMPORTANT: required to be included AFTER setting all property overrides
include(CPack REQUIRED)
diff --git a/cmake/Platform/Windows/PackagingPostBuild.cmake b/cmake/Platform/Windows/PackagingPostBuild.cmake
new file mode 100644
index 0000000000..fe57904003
--- /dev/null
+++ b/cmake/Platform/Windows/PackagingPostBuild.cmake
@@ -0,0 +1,12 @@
+#
+# 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.
+#
+
+message(STATUS "Hello from CPack post build!")
diff --git a/cmake/Platform/Windows/Packaging_windows.cmake b/cmake/Platform/Windows/Packaging_windows.cmake
index 8aa6f2386d..ba3ce011a4 100644
--- a/cmake/Platform/Windows/Packaging_windows.cmake
+++ b/cmake/Platform/Windows/Packaging_windows.cmake
@@ -32,7 +32,7 @@ set(CPACK_GENERATOR "WIX")
# however, they are unique for each run. instead, let's do the auto generation here and add it to
# the cache for run persistence. an additional cache file will be used to store the information on
# the original generation so we still have the ability to detect if they are still being used.
-set(_guid_cache_file "${CMAKE_BINARY_DIR}/installer/wix_guid_cache.cmake")
+set(_guid_cache_file "${CPACK_BINARY_DIR}/wix_guid_cache.cmake")
if(NOT EXISTS ${_guid_cache_file})
set(_wix_guid_namespace "6D43F57A-2917-4AD9-B758-1F13CDB08593")
@@ -89,4 +89,8 @@ endif()
set(CPACK_WIX_PRODUCT_GUID ${LY_WIX_PRODUCT_GUID})
set(CPACK_WIX_UPGRADE_GUID ${LY_WIX_UPGRADE_GUID})
-set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/Platform/Windows/PackagingTemplate.wxs.in")
+set(CPACK_WIX_TEMPLATE "${CPACK_SOURCE_DIR}/Platform/Windows/PackagingTemplate.wxs.in")
+
+set(CPACK_POST_BUILD_SCRIPTS
+ ${CPACK_SOURCE_DIR}/Platform/Windows/PackagingPostBuild.cmake
+)
diff --git a/cmake/Platform/Windows/platform_windows_files.cmake b/cmake/Platform/Windows/platform_windows_files.cmake
index 2fc869b43e..579621d5ea 100644
--- a/cmake/Platform/Windows/platform_windows_files.cmake
+++ b/cmake/Platform/Windows/platform_windows_files.cmake
@@ -24,5 +24,6 @@ set(FILES
PALDetection_windows.cmake
Install_windows.cmake
Packaging_windows.cmake
+ PackagingPostBuild.cmake
PackagingTemplate.wxs.in
)
From f5e91c6e4284f00e64db5cc4ba4e0678be111b1c Mon Sep 17 00:00:00 2001
From: antonmic
Date: Wed, 12 May 2021 10:39:18 -0700
Subject: [PATCH 043/330] Added low end shaders in StandardPBR_ShaderEnable.lua
---
.../Assets/Materials/Types/StandardPBR_ShaderEnable.lua | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua
index 7c3d989c35..2733713122 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua
@@ -29,26 +29,33 @@ function Process(context)
local depthPass = context:GetShaderByTag("DepthPass")
local shadowMap = context:GetShaderByTag("Shadowmap")
local forwardPassEDS = context:GetShaderByTag("ForwardPass_EDS")
+ local lowEndForwardEDS = context:GetShaderByTag("LowEndForward_EDS")
+
local depthPassWithPS = context:GetShaderByTag("DepthPass_WithPS")
local shadowMapWitPS = context:GetShaderByTag("Shadowmap_WithPS")
local forwardPass = context:GetShaderByTag("ForwardPass")
+ local lowEndForward = context:GetShaderByTag("LowEndForward")
if parallaxEnabled and parallaxPdoEnabled then
depthPass:SetEnabled(false)
shadowMap:SetEnabled(false)
forwardPassEDS:SetEnabled(false)
+ lowEndForwardEDS:SetEnabled(false)
depthPassWithPS:SetEnabled(true)
shadowMapWitPS:SetEnabled(true)
forwardPass:SetEnabled(true)
+ lowEndForward:SetEnabled(true)
else
depthPass:SetEnabled(opacityMode == OpacityMode_Opaque)
shadowMap:SetEnabled(opacityMode == OpacityMode_Opaque)
forwardPassEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
+ lowEndForwardEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
depthPassWithPS:SetEnabled(opacityMode == OpacityMode_Cutout)
shadowMapWitPS:SetEnabled(opacityMode == OpacityMode_Cutout)
forwardPass:SetEnabled(opacityMode == OpacityMode_Cutout)
+ lowEndForward:SetEnabled(opacityMode == OpacityMode_Cutout)
end
context:GetShaderByTag("DepthPassTransparentMin"):SetEnabled((opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
From 92b7099d78953eef8552633201b98d8f07597529 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Wed, 12 May 2021 11:10:13 -0700
Subject: [PATCH 044/330] Some clean up
---
.../Common/Assets/Materials/Types/StandardPBR.materialtype | 7 -------
.../Assets/Materials/Types/StandardPBR_ForwardPass.azsl | 4 ++--
.../Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli | 3 +++
.../ShaderLib/Atom/Features/ShaderQualityOptions.azsli | 4 +---
Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl | 6 ++----
5 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
index 47d8a9d9d5..a9a3e9e09b 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR.materialtype
@@ -77,13 +77,6 @@
],
"properties": {
"general": [
- {
- "id": "useLowEndShader",
- "displayName": "Use Low End",
- "description": "Whether to use the low end shader.",
- "type": "Bool",
- "defaultValue": false
- },
{
"id": "applySpecularAA",
"displayName": "Apply Specular AA",
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
index 1e6fafda9b..7ae5934d4f 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ForwardPass.azsl
@@ -321,7 +321,7 @@ ForwardPassOutputWithDepth StandardPbr_ForwardPassPS(VSOutput IN, bool isFrontFa
#ifdef UNIFIED_FORWARD_OUTPUT
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
- OUT.m_color.a = 1.0f;
+ OUT.m_color.a = lightingOutput.m_diffuseColor.a;
OUT.m_depth = depth;
#else
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
@@ -344,7 +344,7 @@ ForwardPassOutput StandardPbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace :
#ifdef UNIFIED_FORWARD_OUTPUT
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
- OUT.m_color.a = 1.0f;
+ OUT.m_color.a = lightingOutput.m_diffuseColor.a;
#else
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
OUT.m_specularColor = lightingOutput.m_specularColor;
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
index 721c48835d..3e3544fe9e 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/Ibl.azsli
@@ -12,6 +12,9 @@
#pragma once
+// --- Static Options Available ---
+// FORCE_IBL_IN_FORWARD_PASS - forces IBL lighting to be run in the forward pass, used in pipelines that don't have a reflection pass
+
#include
#include
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
index d6fb259548..6e89269f8d 100644
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
+++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/ShaderQualityOptions.azsli
@@ -12,9 +12,7 @@
#pragma once
-// These are a list of quality options to specify as macros (either in azsl or in shader files)
-//
-// QUALITY_LOW_END
+// This file translates quality option macros like QUALITY_LOW_END to their relevant settings
#ifdef QUALITY_LOW_END
diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
index 4b3e9536b7..1bebb2ec47 100644
--- a/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
+++ b/Gems/Atom/Feature/Common/Assets/Shaders/SkyBox/SkyBox.azsl
@@ -10,10 +10,8 @@
*
*/
-// Static Options:
-//
-// SKYBOX_TWO_OUTPUTS - Allows the skybox to render to two rendertargets instead of one
-
+// --- Static Options Available ---
+// SKYBOX_TWO_OUTPUTS - Skybox renders to two rendertargets instead of one (SkyBox_TwoOutputs.pass writes to specular and reflection targets)
#include
#include
From b52388f5ebfb5af09505a99fe1e416ae12907dd0 Mon Sep 17 00:00:00 2001
From: antonmic
Date: Wed, 12 May 2021 11:11:45 -0700
Subject: [PATCH 045/330] Remove unused file
---
.../PBR/LowEndForwardPassOutput.azsli | 32 -------------------
1 file changed, 32 deletions(-)
delete mode 100644 Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
deleted file mode 100644
index acc215f1c9..0000000000
--- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/LowEndForwardPassOutput.azsli
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-* 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.
-*
-*/
-
-struct ForwardPassOutput
-{
- float4 m_diffuseColor : SV_Target0; //!< RGB = Diffuse Lighting, A = Blend Alpha (for blended surfaces) OR A = special encoding of surfaceScatteringFactor, m_subsurfaceScatteringQuality, o_enableSubsurfaceScattering
- float4 m_specularColor : SV_Target1; //!< RGB = Specular Lighting, A = Unused
- float4 m_albedo : SV_Target2; //!< RGB = Surface albedo pre-multiplied by other factors that will be multiplied later by diffuse GI, A = specularOcclusion
- float4 m_specularF0 : SV_Target3; //!< RGB = Specular F0, A = roughness
- float4 m_normal : SV_Target4; //!< RGB10 = EncodeNormalSignedOctahedron(worldNormal), A2 = multiScatterCompensationEnabled
-};
-
-struct ForwardPassOutputWithDepth
-{
- // See above for descriptions of special encodings
-
- float4 m_diffuseColor : SV_Target0;
- float4 m_specularColor : SV_Target1;
- float4 m_albedo : SV_Target2;
- float4 m_specularF0 : SV_Target3;
- float4 m_normal : SV_Target4;
- float m_depth : SV_Depth;
-};
From 53188a12da7d3ce90de64a0d184b6a5f9df613d8 Mon Sep 17 00:00:00 2001
From: Chris Santora
Date: Wed, 12 May 2021 17:06:57 -0700
Subject: [PATCH 046/330] Made StandardMultilayerPBR hide a layer's property
groups when that layer is disabled.
ATOM-14688 Disable Individual Layers
- Added new SetMaterialPropertyGroupVisibility functions to the material functors.
- Updated the MaterialFunctor::EditorContext to include parameters for handling material property group metadata.
- Updated the material inspector(s) to apply the property group visiblity changes from the material functor, to hide or show the property groups.
- Moved some code from MaterialPropertyDescriptor.h/cpp to a new MaterialDynamicMetadata.h/cpp, since these aren't really related to the MaterialPropertyDescriptor code. It's more for material functors to use.
- Also fixed the casing for the "GetMaterialPropertyValue_Image" lua function, since I was already in this code (ATOM-14793 "Fix Inconsistent Casing For LuaMaterialFunctorRuntimeContext")
Tested in MaterialEditor and in in the main Editor's MaterialComponent property override inspector.
---
.../DetailMapsCommonFunctor.lua | 8 +-
.../Materials/Types/Skin_WrinkleMaps.lua | 4 +-
.../Types/StandardMultilayerPBR.materialtype | 6 ++
.../StandardMultilayerPBR_LayerEnable.lua | 49 +++++++++
...StandardMultilayerPBR_ParallaxPerLayer.lua | 4 +-
.../Types/StandardPBR_ClearCoatState.lua | 4 +-
.../Types/StandardPBR_EmissiveState.lua | 4 +-
.../Types/StandardPBR_HandleOpacityMode.lua | 2 +-
.../Types/StandardPBR_ParallaxState.lua | 4 +-
.../Materials/Types/StandardPBR_Roughness.lua | 4 +-
.../Types/StandardPBR_SubsurfaceState.lua | 4 +-
.../RPI.Reflect/Material/LuaMaterialFunctor.h | 2 +
.../Material/MaterialDynamicMetadata.h | 100 ++++++++++++++++++
.../RPI.Reflect/Material/MaterialFunctor.h | 20 +++-
.../Material/MaterialPropertyDescriptor.h | 47 --------
.../RPI.Public/Material/MaterialSystem.cpp | 1 +
.../Material/LuaMaterialFunctor.cpp | 17 ++-
.../Material/MaterialDynamicMetadata.cpp | 50 +++++++++
.../RPI.Reflect/Material/MaterialFunctor.cpp | 96 ++++++++++++-----
.../Material/MaterialPropertyDescriptor.cpp | 14 ---
.../Material/LuaMaterialFunctorTests.cpp | 76 ++++++++++++-
.../MaterialPropertySerializerTests.cpp | 1 +
.../RPI/Code/atom_rpi_reflect_files.cmake | 2 +
.../DynamicProperty/DynamicProperty.h | 6 +-
.../Inspector/InspectorRequestBus.h | 6 ++
.../Inspector/InspectorWidget.h | 3 +
.../Code/Source/Inspector/InspectorWidget.cpp | 27 +++++
.../MaterialDocumentNotificationBus.h | 7 ++
.../Document/MaterialDocumentRequestBus.h | 5 +
.../Code/Source/Document/MaterialDocument.cpp | 58 ++++++++--
.../Code/Source/Document/MaterialDocument.h | 21 +++-
.../MaterialInspector/MaterialInspector.cpp | 16 ++-
.../MaterialInspector/MaterialInspector.h | 1 +
.../EditorMaterialComponentInspector.cpp | 25 +++--
34 files changed, 553 insertions(+), 141 deletions(-)
create mode 100644 Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_LayerEnable.lua
create mode 100644 Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialDynamicMetadata.h
create mode 100644 Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/MaterialDynamicMetadata.cpp
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/MaterialInputs/DetailMapsCommonFunctor.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/MaterialInputs/DetailMapsCommonFunctor.lua
index 15e4b4f416..e1a3dd6f29 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/MaterialInputs/DetailMapsCommonFunctor.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/MaterialInputs/DetailMapsCommonFunctor.lua
@@ -35,16 +35,16 @@ end
function Process(context)
local isFeatureEnabled = context:GetMaterialPropertyValue_bool("detailLayerGroup.enableDetailLayer")
- local blendMaskTexture = context:GetMaterialPropertyValue_image("detailLayerGroup.blendDetailMask")
+ local blendMaskTexture = context:GetMaterialPropertyValue_Image("detailLayerGroup.blendDetailMask")
local blendMaskTextureEnabled = context:GetMaterialPropertyValue_bool("detailLayerGroup.enableDetailMaskTexture")
context:SetShaderOptionValue_bool("o_detail_blendMask_useTexture", isFeatureEnabled and blendMaskTextureEnabled and blendMaskTexture ~= nil)
local baseColorDetailEnabled = context:GetMaterialPropertyValue_bool("detailLayerGroup.enableBaseColor")
- local baseColorDetailTexture = context:GetMaterialPropertyValue_image("detailLayerGroup.baseColorDetailMap")
+ local baseColorDetailTexture = context:GetMaterialPropertyValue_Image("detailLayerGroup.baseColorDetailMap")
context:SetShaderOptionValue_bool("o_detail_baseColor_useTexture", isFeatureEnabled and baseColorDetailEnabled and baseColorDetailTexture ~= nil)
local normalDetailEnabled = context:GetMaterialPropertyValue_bool("detailLayerGroup.enableNormals")
- local normalDetailTexture = context:GetMaterialPropertyValue_image("detailLayerGroup.normalDetailMap")
+ local normalDetailTexture = context:GetMaterialPropertyValue_Image("detailLayerGroup.normalDetailMap")
context:SetShaderOptionValue_bool("o_detail_normal_useTexture", isFeatureEnabled and normalDetailEnabled and normalDetailTexture ~= nil)
end
@@ -78,7 +78,7 @@ function ProcessEditor(context)
context:SetMaterialPropertyVisibility("detailUV.rotateDegrees", mainVisibility)
context:SetMaterialPropertyVisibility("detailUV.scale", mainVisibility)
- local blendMaskTexture = context:GetMaterialPropertyValue_image("detailLayerGroup.blendDetailMask")
+ local blendMaskTexture = context:GetMaterialPropertyValue_Image("detailLayerGroup.blendDetailMask")
if(nil == blendMaskTexture) then
context:SetMaterialPropertyVisibility("detailLayerGroup.enableDetailMaskTexture", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("detailLayerGroup.blendDetailMaskUv", MaterialPropertyVisibility_Hidden)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/Skin_WrinkleMaps.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/Skin_WrinkleMaps.lua
index d77918f521..9e1bc3763a 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/Skin_WrinkleMaps.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/Skin_WrinkleMaps.lua
@@ -65,8 +65,8 @@ function Process(context)
for i=1,MAX_WRINKLE_LAYER_COUNT do
if(i <= count) then
- isBaseColorTextureMissing = isBaseColorEnabled and nil == context:GetMaterialPropertyValue_image("wrinkleLayers.baseColorMap" .. i)
- isNormalTextureMissing = isNormalEnabled and nil == context:GetMaterialPropertyValue_image("wrinkleLayers.normalMap" .. i)
+ isBaseColorTextureMissing = isBaseColorEnabled and nil == context:GetMaterialPropertyValue_Image("wrinkleLayers.baseColorMap" .. i)
+ isNormalTextureMissing = isNormalEnabled and nil == context:GetMaterialPropertyValue_Image("wrinkleLayers.normalMap" .. i)
context:SetShaderOptionValue_bool("o_wrinkleLayers_baseColor_useTexture" .. i, not isBaseColorTextureMissing)
context:SetShaderOptionValue_bool("o_wrinkleLayers_normal_useTexture" .. i, not isNormalTextureMissing)
else
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
index b49c66346f..a2854e8902 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR.materialtype
@@ -2684,6 +2684,12 @@
"file": "StandardMultilayerPBR_ShaderEnable.lua"
}
},
+ {
+ "type": "Lua",
+ "args": {
+ "file": "StandardMultilayerPBR_LayerEnable.lua"
+ }
+ },
{
"type": "Lua",
"args": {
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_LayerEnable.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_LayerEnable.lua
new file mode 100644
index 0000000000..f60aac6149
--- /dev/null
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_LayerEnable.lua
@@ -0,0 +1,49 @@
+--------------------------------------------------------------------------------------
+--
+-- 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.
+--
+--
+----------------------------------------------------------------------------------------------------
+
+-- This functor hides the properties for disabled material layers.
+
+function GetMaterialPropertyDependencies()
+ return {
+ "blend.enableLayer2",
+ "blend.enableLayer3"
+ }
+end
+
+function SetLayerVisibility(context, layerNamePrefix, isVisible)
+
+ local visibility = MaterialPropertyGroupVisibility_Enabled
+ if(not isVisible) then
+ visibility = MaterialPropertyGroupVisibility_Hidden
+ end
+
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "baseColor", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "metallic", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "roughness", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "specularF0", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "normal", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "clearCoat", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "occlusion", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "emissive", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "parallax", visibility)
+ context:SetMaterialPropertyGroupVisibility(layerNamePrefix .. "uv", visibility)
+end
+
+function ProcessEditor(context)
+ local enableLayer2 = context:GetMaterialPropertyValue_bool("blend.enableLayer2")
+ local enableLayer3 = context:GetMaterialPropertyValue_bool("blend.enableLayer3")
+
+ SetLayerVisibility(context, "layer2_", context:GetMaterialPropertyValue_bool("blend.enableLayer2"))
+ SetLayerVisibility(context, "layer3_", context:GetMaterialPropertyValue_bool("blend.enableLayer3"))
+end
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua
index 119dfed436..bd56292229 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua
@@ -24,7 +24,7 @@ end
function Process(context)
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
- local textureMap = context:GetMaterialPropertyValue_image("parallax.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
context:SetShaderOptionValue_bool("o_useDepthMap", enable and textureMap ~= nil)
end
@@ -37,7 +37,7 @@ function ProcessEditor(context)
context:SetMaterialPropertyVisibility("parallax.textureMap", MaterialPropertyVisibility_Hidden)
end
- local textureMap = context:GetMaterialPropertyValue_image("parallax.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
local visibility = MaterialPropertyVisibility_Enabled
if(not enable or textureMap == nil) then
visibility = MaterialPropertyVisibility_Hidden
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatState.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatState.lua
index 8289291ef4..ffa00d7efd 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatState.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatState.lua
@@ -34,7 +34,7 @@ function GetShaderOptionDependencies()
end
function UpdateUseTextureState(context, clearCoatEnabled, textureMapPropertyName, useTexturePropertyName, shaderOptionName)
- local textureMap = context:GetMaterialPropertyValue_image(textureMapPropertyName)
+ local textureMap = context:GetMaterialPropertyValue_Image(textureMapPropertyName)
local useTextureMap = context:GetMaterialPropertyValue_bool(useTexturePropertyName)
context:SetShaderOptionValue_bool(shaderOptionName, clearCoatEnabled and useTextureMap and textureMap ~= nil)
end
@@ -50,7 +50,7 @@ end
-- Note this logic matches that of the UseTextureFunctor class.
function UpdateTextureDependentPropertyVisibility(context, textureMapPropertyName, useTexturePropertyName, uvPropertyName)
- local textureMap = context:GetMaterialPropertyValue_image(textureMapPropertyName)
+ local textureMap = context:GetMaterialPropertyValue_Image(textureMapPropertyName)
local useTexture = context:GetMaterialPropertyValue_bool(useTexturePropertyName)
if(textureMap == nil) then
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_EmissiveState.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_EmissiveState.lua
index a8ac2e8a4a..7ee5876adb 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_EmissiveState.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_EmissiveState.lua
@@ -22,7 +22,7 @@ end
function Process(context)
local enable = context:GetMaterialPropertyValue_bool("emissive.enable")
- local textureMap = context:GetMaterialPropertyValue_image("emissive.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("emissive.textureMap")
local useTextureMap = context:GetMaterialPropertyValue_bool("emissive.useTexture")
context:SetShaderOptionValue_bool("o_emissiveEnabled", enable)
@@ -47,7 +47,7 @@ function ProcessEditor(context)
context:SetMaterialPropertyVisibility("emissive.textureMapUv", mainVisibility)
if(enable) then
- local textureMap = context:GetMaterialPropertyValue_image("emissive.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("emissive.textureMap")
local useTextureMap = context:GetMaterialPropertyValue_bool("emissive.useTexture")
if(textureMap == nil) then
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_HandleOpacityMode.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_HandleOpacityMode.lua
index 6cc595d712..541b1ac1ce 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_HandleOpacityMode.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_HandleOpacityMode.lua
@@ -90,7 +90,7 @@ function ProcessEditor(context)
context:SetMaterialPropertyVisibility("opacity.textureMap", MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility("opacity.textureMapUv", MaterialPropertyVisibility_Hidden)
else
- local textureMap = context:GetMaterialPropertyValue_image("opacity.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("opacity.textureMap")
if(nil == textureMap) then
context:SetMaterialPropertyVisibility("opacity.textureMapUv", MaterialPropertyVisibility_Disabled)
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ParallaxState.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ParallaxState.lua
index 0287e1105e..e6689da327 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ParallaxState.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ParallaxState.lua
@@ -22,7 +22,7 @@ end
function Process(context)
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
- local textureMap = context:GetMaterialPropertyValue_image("parallax.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
context:SetShaderOptionValue_bool("o_parallax_feature_enabled", enable)
context:SetShaderOptionValue_bool("o_useDepthMap", enable and textureMap ~= nil)
end
@@ -36,7 +36,7 @@ function ProcessEditor(context)
context:SetMaterialPropertyVisibility("parallax.textureMap", MaterialPropertyVisibility_Hidden)
end
- local textureMap = context:GetMaterialPropertyValue_image("parallax.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
local visibility = MaterialPropertyVisibility_Enabled
if(not enable or textureMap == nil) then
visibility = MaterialPropertyVisibility_Hidden
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_Roughness.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_Roughness.lua
index 4887bc47e8..222e69cd3d 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_Roughness.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_Roughness.lua
@@ -21,13 +21,13 @@ function GetShaderOptionDependencies()
end
function Process(context)
- local textureMap = context:GetMaterialPropertyValue_image("roughness.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("roughness.textureMap")
local useTexture = context:GetMaterialPropertyValue_bool("roughness.useTexture")
context:SetShaderOptionValue_bool("o_roughness_useTexture", useTexture and textureMap ~= nil)
end
function ProcessEditor(context)
- local textureMap = context:GetMaterialPropertyValue_image("roughness.textureMap")
+ local textureMap = context:GetMaterialPropertyValue_Image("roughness.textureMap")
local useTexture = context:GetMaterialPropertyValue_bool("roughness.useTexture")
if(nil == textureMap) then
diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_SubsurfaceState.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_SubsurfaceState.lua
index fb07ac89a3..d8a69ba355 100644
--- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_SubsurfaceState.lua
+++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_SubsurfaceState.lua
@@ -35,7 +35,7 @@ TransmissionMode_ThickObject = 1
TransmissionMode_ThinObject = 2
function UpdateUseTextureState(context, subsurfaceScatteringEnabled, textureMapPropertyName, useTexturePropertyName, shaderOptionName)
- local textureMap = context:GetMaterialPropertyValue_image(textureMapPropertyName)
+ local textureMap = context:GetMaterialPropertyValue_Image(textureMapPropertyName)
local useTextureMap = context:GetMaterialPropertyValue_bool(useTexturePropertyName)
context:SetShaderOptionValue_bool(shaderOptionName, subsurfaceScatteringEnabled and useTextureMap and textureMap ~= nil)
end
@@ -53,7 +53,7 @@ function UpdateTextureDependentPropertyVisibility(context, featureEnabled, textu
context:SetMaterialPropertyVisibility(useTexturePropertyName, MaterialPropertyVisibility_Hidden)
context:SetMaterialPropertyVisibility(uvPropertyName, MaterialPropertyVisibility_Hidden)
else
- local textureMap = context:GetMaterialPropertyValue_image(textureMapPropertyName)
+ local textureMap = context:GetMaterialPropertyValue_Image(textureMapPropertyName)
local useTextureMap = context:GetMaterialPropertyValue_bool(useTexturePropertyName)
if(textureMap == nil) then
diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/LuaMaterialFunctor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/LuaMaterialFunctor.h
index 44de79ff22..396ba14810 100644
--- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/LuaMaterialFunctor.h
+++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/LuaMaterialFunctor.h
@@ -329,6 +329,8 @@ namespace AZ
bool SetMaterialPropertySoftMaxValue(const char* name, Type value);
bool SetMaterialPropertyDescription(const char* name, const char* description);
+
+ bool SetMaterialPropertyGroupVisibility(const char* name, MaterialPropertyGroupVisibility visibility);
private:
diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialDynamicMetadata.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialDynamicMetadata.h
new file mode 100644
index 0000000000..b74e330665
--- /dev/null
+++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialDynamicMetadata.h
@@ -0,0 +1,100 @@
+/*
+* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
+* its licensors.
+*
+* For complete copyright and license terms please see the LICENSE at the root of this
+* distribution (the "License"). All use of this software is governed by the License,
+* or, if provided, by the license below or the license accompanying this file. Do not
+* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*
+*/
+#pragma once
+
+#include
+#include
+#include
+
+namespace AZ
+{
+ namespace RPI
+ {
+ // Normally we wouldn't want editor-related code mixed in with runtime code, but
+ // since this data can be modified dynamically, keeping it in the runtime makes
+ // the overall material functor design simpler and more user-friendly.
+
+
+ //! Visibility for each material property.
+ //! If the data field is empty, use default as editable.
+ enum class MaterialPropertyVisibility : uint32_t
+ {
+ Enabled, //!< The property is visible and editable
+ Disabled, //!< The property is visible but non-editable
+ Hidden, //!< The property is invisible
+
+ Default = Enabled
+ };
+
+ struct MaterialPropertyRange
+ {
+ MaterialPropertyRange() = default;
+ MaterialPropertyRange(
+ const MaterialPropertyValue& max,
+ const MaterialPropertyValue& min,
+ const MaterialPropertyValue& softMax,
+ const MaterialPropertyValue& softMin
+ )
+ : m_max(max)
+ , m_min(min)
+ , m_softMax(softMax)
+ , m_softMin(softMin)
+ {}
+
+ MaterialPropertyValue m_max;
+ MaterialPropertyValue m_min;
+ MaterialPropertyValue m_softMax;
+ MaterialPropertyValue m_softMin;
+ };
+
+ //! Used by material functors to dynamically control property metadata in tools.
+ //! For example, show/hide a property based on some other 'enable' flag property.
+ struct MaterialPropertyDynamicMetadata
+ {
+ AZ_TYPE_INFO(MaterialPropertyDynamicMetadata, "{A89F215F-3235-499F-896C-9E63ACC1D657}");
+
+ AZ::RPI::MaterialPropertyVisibility m_visibility;
+ AZStd::string m_description;
+ AZ::RPI::MaterialPropertyRange m_propertyRange;
+ };
+
+ //! Visibility for each material property group.
+ enum class MaterialPropertyGroupVisibility : uint32_t
+ {
+ // Note it's helpful to keep these values aligned with MaterialPropertyVisibility in part because in lua it would be easy to accidentally use
+ // MaterialPropertyVisibility instead of MaterialPropertyGroupVisibility resulting in sneaky bugs. Also, if the enums end up being the same in
+ // the future, we could just merge them into one.
+
+ Enabled, //!< The property is visible and editable
+ //Disabled, //!< The property is visible but non-editable (reserved for possible future use, to match MaterialPropertyVisibility)
+ Hidden=2, //!< The property is invisible
+
+ Default = Enabled
+ };
+
+ //! Used by material functors to dynamically control property group metadata in tools.
+ //! For example, show/hide an entire property group based on some 'enable' flag property.
+ struct MaterialPropertyGroupDynamicMetadata
+ {
+ AZ_TYPE_INFO(MaterialPropertyGroupDynamicMetadata, "{F94009F7-48A3-4CE0-AF64-D5A86890ACD4}");
+
+ AZ::RPI::MaterialPropertyGroupVisibility m_visibility;
+ };
+
+ void ReflectMaterialDynamicMetadata(ReflectContext* context);
+
+ } // namespace RPI
+
+ AZ_TYPE_INFO_SPECIALIZE(RPI::MaterialPropertyVisibility, "{318B43A2-79E3-4502-8FD0-5815209EA123}");
+ AZ_TYPE_INFO_SPECIALIZE(RPI::MaterialPropertyGroupVisibility, "{B803958B-DE64-4FBF-AC00-CF781611BE37}");
+} // namespace AZ
+
diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialFunctor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialFunctor.h
index d17c7634a2..6b9b34aa1b 100644
--- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialFunctor.h
+++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialFunctor.h
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
namespace AZ
{
@@ -147,6 +148,8 @@ namespace AZ
public:
const MaterialPropertyDynamicMetadata* GetMaterialPropertyMetadata(const Name& propertyName) const;
const MaterialPropertyDynamicMetadata* GetMaterialPropertyMetadata(const MaterialPropertyIndex& index) const;
+
+ const MaterialPropertyGroupDynamicMetadata* GetMaterialPropertyGroupMetadata(const Name& propertyName) const;
//! Get the property value. The type must be one of those in MaterialPropertyValue.
//! Otherwise, a compile error will be reported.
@@ -178,6 +181,8 @@ namespace AZ
bool SetMaterialPropertySoftMaxValue(const Name& propertyName, const MaterialPropertyValue& max);
bool SetMaterialPropertySoftMaxValue(const MaterialPropertyIndex& index, const MaterialPropertyValue& max);
+
+ bool SetMaterialPropertyGroupVisibility(const Name& propertyGroupName, MaterialPropertyGroupVisibility visibility);
// [GFX TODO][ATOM-4168] Replace the workaround for unlink-able RPI.Public classes in MaterialFunctor
// const AZStd::vector&, AZStd::unordered_map&, RHI::ConstPtr
@@ -185,18 +190,23 @@ namespace AZ
EditorContext(
const AZStd::vector& propertyValues,
RHI::ConstPtr materialPropertiesLayout,
- AZStd::unordered_map& metadata,
- AZStd::unordered_set& outChangedProperties,
+ AZStd::unordered_map& propertyMetadata,
+ AZStd::unordered_map& propertyGroupMetadata,
+ AZStd::unordered_set& updatedPropertiesOut,
+ AZStd::unordered_set& updatedPropertyGroupsOut,
const MaterialPropertyFlags* materialPropertyDependencies
);
private:
- AZStd::list_iterator> QueryMaterialMetadata(const Name& propertyName) const;
+ AZStd::list_iterator> QueryMaterialPropertyMetadata(const Name& propertyName) const;
+ AZStd::list_iterator> QueryMaterialPropertyGroupMetadata(const Name& propertyGroupName) const;
const AZStd::vector& m_materialPropertyValues;
RHI::ConstPtr m_materialPropertiesLayout;
- AZStd::unordered_map& m_metadata;
- AZStd::unordered_set& m_outChangedProperties;
+ AZStd::unordered_map& m_propertyMetadata;
+ AZStd::unordered_map& m_propertyGroupMetadata;
+ AZStd::unordered_set& m_updatedPropertiesOut;
+ AZStd::unordered_set& m_updatedPropertyGroupsOut;
const MaterialPropertyFlags* m_materialPropertyDependencies = nullptr;
};
diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h
index d73ce2334b..fab72d5f96 100644
--- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h
+++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h
@@ -81,52 +81,6 @@ namespace AZ
AZStd::string GetMaterialPropertyDataTypeString(AZ::TypeId typeId);
- //! Visibility for each material property.
- //! If the data field is empty, use default as editable.
- enum class MaterialPropertyVisibility : uint32_t
- {
- Enabled, //< The property is visible and editable
- Disabled, //< The property is visible but non-editable
- Hidden, //< The property is invisible
-
- Default = Enabled
- };
-
- struct MaterialPropertyRange
- {
- MaterialPropertyRange() = default;
- MaterialPropertyRange(
- const MaterialPropertyValue& max,
- const MaterialPropertyValue& min,
- const MaterialPropertyValue& softMax,
- const MaterialPropertyValue& softMin
- )
- : m_max(max)
- , m_min(min)
- , m_softMax(softMax)
- , m_softMin(softMin)
- {}
-
- MaterialPropertyValue m_max;
- MaterialPropertyValue m_min;
- MaterialPropertyValue m_softMax;
- MaterialPropertyValue m_softMin;
- };
-
- //! Used by material functors to dynamically control property metadata in tools.
- //! For example, show/hide a property based on some other 'enable' flag property.
- //! Normally we wouldn't want editor-related code mixed in with runtime code, but
- //! since this data can be modified dynamically, keeping it in the runtime makes
- //! the overall material functor design simpler and more user-friendly.
- struct MaterialPropertyDynamicMetadata
- {
- AZ_TYPE_INFO(MaterialPropertyDynamicMetadata, "{A89F215F-3235-499F-896C-9E63ACC1D657}");
-
- AZ::RPI::MaterialPropertyVisibility m_visibility;
- AZStd::string m_description;
- AZ::RPI::MaterialPropertyRange m_propertyRange;
- };
-
//! A material property is any data input to a material, like a bool, float, Vector, Image, Buffer, etc.
//! This descriptor defines a single input property, including it's name ID, and how it maps
//! to the shader system.
@@ -171,7 +125,6 @@ namespace AZ
} // namespace RPI
AZ_TYPE_INFO_SPECIALIZE(RPI::MaterialPropertyOutputType, "{42A6E5E8-0FE6-4D7B-884A-1F478E4ADD97}");
- AZ_TYPE_INFO_SPECIALIZE(RPI::MaterialPropertyVisibility, "{318B43A2-79E3-4502-8FD0-5815209EA123}");
AZ_TYPE_INFO_SPECIALIZE(RPI::MaterialPropertyDataType, "{3D903D5C-C6AA-452E-A2F8-8948D30833FF}");
} // namespace AZ
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/MaterialSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/MaterialSystem.cpp
index e7e04b271d..f1751a02e2 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/MaterialSystem.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/MaterialSystem.cpp
@@ -32,6 +32,7 @@ namespace AZ
MaterialPropertiesLayout::Reflect(context);
MaterialFunctor::Reflect(context);
LuaMaterialFunctor::Reflect(context);
+ ReflectMaterialDynamicMetadata(context);
}
void MaterialSystem::GetAssetHandlers(AssetHandlerPtrList& assetHandlers)
diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/LuaMaterialFunctor.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/LuaMaterialFunctor.cpp
index 7ab3489666..7db5f12560 100644
--- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/LuaMaterialFunctor.cpp
+++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Material/LuaMaterialFunctor.cpp
@@ -63,6 +63,7 @@ namespace AZ
behaviorContext->Class();
MaterialPropertyDescriptor::Reflect(behaviorContext);
+ ReflectMaterialDynamicMetadata(behaviorContext);
LuaMaterialFunctorRenderStates::Reflect(behaviorContext);
LuaMaterialFunctorShaderItem::Reflect(behaviorContext);
@@ -255,7 +256,7 @@ namespace AZ
// Specialize for type Image* because that will be more intuitive within Lua.
// The script can then check the result for nil without calling "get()".
- // For example, "GetMaterialPropertyValue_image(name) == nil" rather than "GetMaterialPropertyValue_image(name):get() == nil"
+ // For example, "GetMaterialPropertyValue_Image(name) == nil" rather than "GetMaterialPropertyValue_Image(name):get() == nil"
template<>
Image* LuaMaterialFunctorCommonContext::GetMaterialPropertyValue(const char* name) const
{
@@ -278,7 +279,7 @@ namespace AZ
->Method("GetMaterialPropertyValue_Vector3", &LuaMaterialFunctorRuntimeContext::GetMaterialPropertyValue)
->Method("GetMaterialPropertyValue_Vector4", &LuaMaterialFunctorRuntimeContext::GetMaterialPropertyValue