Merge branch 'main' into jckand/FoundationAuto

This commit is contained in:
jckand
2021-04-23 10:09:39 -05:00
132 changed files with 1145 additions and 940 deletions
+21 -3
View File
@@ -327,7 +327,16 @@ struct IMovieCallback
*/
struct IAnimTrack
{
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}")
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}");
AZ_CLASS_ALLOCATOR(IAnimTrack, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimTrack>();
}
}
//! Flags that can be set on animation track.
enum EAnimTrackFlags
@@ -594,7 +603,16 @@ struct IAnimNodeOwner
struct IAnimNode
{
public:
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}")
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}");
AZ_CLASS_ALLOCATOR(IAnimNode, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimNode>();
}
}
//////////////////////////////////////////////////////////////////////////
// Supported params.
@@ -922,7 +940,7 @@ struct IAnimSequence
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimSequence>();
}
@@ -279,7 +279,7 @@ namespace AzToolsFramework
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder)
{
AZStd::unique_ptr<Prefab::Instance> createdPrefabInstance =
m_prefabSystemComponent->CreatePrefab(entities, AZStd::move(nestedPrefabInstances), filePath);
m_prefabSystemComponent->CreatePrefab(entities, AZStd::move(nestedPrefabInstances), filePath, nullptr, false);
if (createdPrefabInstance)
{
@@ -321,7 +321,6 @@ namespace AzToolsFramework
removedNestedInstance = AZStd::move(nestedInstanceIterator->second);
removedNestedInstance->m_parent = nullptr;
removedNestedInstance->m_alias = InstanceAlias();
m_nestedInstances.erase(instanceAlias);
}
@@ -396,6 +395,14 @@ namespace AzToolsFramework
}
}
void Instance::GetNestedInstances(const AZStd::function<void(AZStd::unique_ptr<Instance>&)>& callback)
{
for (auto& [instanceAlias, instance] : m_nestedInstances)
{
callback(instance);
}
}
void Instance::GetEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback)
{
for (auto& [entityAlias, entity] : m_entities)
@@ -114,6 +114,7 @@ namespace AzToolsFramework
void GetConstEntities(const AZStd::function<bool(const AZ::Entity&)>& callback);
void GetNestedEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback);
void GetEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback);
void GetNestedInstances(const AZStd::function<void(AZStd::unique_ptr<Instance>&)>& callback);
/**
* Gets the alias for a given EnitityId in the Instance DOM.
@@ -101,6 +101,10 @@ namespace AzToolsFramework
nestedInstance->GetInstanceAlias(), nestedInstance->GetLinkId(), undoBatch.GetUndoBatch());
}
PrefabUndoHelpers::UpdatePrefabInstance(
commonRootEntityOwningInstance->get(), "Update prefab instance", commonRootInstanceDomBeforeCreate,
undoBatch.GetUndoBatch());
auto prefabEditorEntityOwnershipInterface = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (!prefabEditorEntityOwnershipInterface)
{
@@ -118,13 +122,21 @@ namespace AzToolsFramework
"(A null instance is returned)."));
}
PrefabUndoHelpers::UpdatePrefabInstance(
commonRootEntityOwningInstance->get(), "Update prefab instance", commonRootInstanceDomBeforeCreate, undoBatch.GetUndoBatch());
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
instanceToCreate->get().GetNestedInstances([&](AZStd::unique_ptr<Instance>& nestedInstance) {
AZ_Assert(nestedInstance, "Invalid nested instance found in the new prefab created.");
EntityOptionalReference nestedInstanceContainerEntity = nestedInstance->GetContainerEntity();
AZ_Assert(
nestedInstanceContainerEntity, "Invalid container entity found for the nested instance used in prefab creation.");
CreateLink(
{&nestedInstanceContainerEntity->get()}, *nestedInstance, instanceToCreate->get().GetTemplateId(),
undoBatch.GetUndoBatch(), containerEntityId);
});
CreateLink(
topLevelEntities, instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(),
commonRootEntityId);
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
// Change top level entities to be parented to the container entity
// Mark them as dirty so this change is correctly applied to the template
@@ -225,19 +237,7 @@ namespace AzToolsFramework
PrefabOperationResult PrefabPublicHandler::SavePrefab(AZ::IO::Path filePath)
{
auto prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
if (!prefabSystemComponentInterface)
{
AZ_Assert(
false,
"Prefab - PrefabPublicHandler - "
"Prefab System Component Interface could not be found. "
"Check that it is being correctly initialized.");
return AZ::Failure(
AZStd::string("SavePrefab - Internal error (Prefab System Component Interface could not be found)."));
}
auto templateId = prefabSystemComponentInterface->GetTemplateIdFromFilePath(filePath.c_str());
auto templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(filePath.c_str());
if (templateId == InvalidTemplateId)
{
@@ -438,26 +438,14 @@ namespace AzToolsFramework
PrefabRequestResult PrefabPublicHandler::HasUnsavedChanges(AZ::IO::Path prefabFilePath) const
{
auto prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
if (!prefabSystemComponentInterface)
{
AZ_Assert(
false,
"Prefab - PrefabPublicHandler - "
"Prefab System Component Interface could not be found. "
"Check that it is being correctly initialized.");
return AZ::Failure(
AZStd::string("HasUnsavedChanges - Internal error (Prefab System Component Interface could not be found)."));
}
auto templateId = prefabSystemComponentInterface->GetTemplateIdFromFilePath(prefabFilePath.c_str());
auto templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(prefabFilePath.c_str());
if (templateId == InvalidTemplateId)
{
return AZ::Failure(AZStd::string("HasUnsavedChanges - Path error. Path could be invalid, or the prefab may not be loaded in this level."));
}
return AZ::Success(prefabSystemComponentInterface->IsTemplateDirty(templateId));
return AZ::Success(m_prefabSystemComponentInterface->IsTemplateDirty(templateId));
}
PrefabOperationResult PrefabPublicHandler::DeleteEntitiesInInstance(const EntityIdList& entityIds)
@@ -91,8 +91,9 @@ namespace AzToolsFramework
m_instanceUpdateExecutor.UpdateTemplateInstancesInQueue();
}
AZStd::unique_ptr<Instance> PrefabSystemComponent::CreatePrefab(const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity)
AZStd::unique_ptr<Instance> PrefabSystemComponent::CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity, bool shouldCreateLinks)
{
AZ::IO::Path relativeFilePath = m_prefabLoader.GetRelativePathToProject(filePath);
if (GetTemplateIdFromFilePath(relativeFilePath) != InvalidTemplateId)
@@ -123,7 +124,7 @@ namespace AzToolsFramework
newInstance->SetTemplateSourcePath(relativeFilePath);
newInstance->SetContainerEntityName(relativeFilePath.Stem().Native());
TemplateId newTemplateId = CreateTemplateFromInstance(*newInstance);
TemplateId newTemplateId = CreateTemplateFromInstance(*newInstance, shouldCreateLinks);
if (newTemplateId == InvalidTemplateId)
{
AZ_Error("Prefab", false,
@@ -289,7 +290,7 @@ namespace AzToolsFramework
return newInstance;
}
TemplateId PrefabSystemComponent::CreateTemplateFromInstance(Instance& instance)
TemplateId PrefabSystemComponent::CreateTemplateFromInstance(Instance& instance, bool shouldCreateLinks)
{
// We will register the template to match the path the instance has
const AZ::IO::Path& templateSourcePath = instance.GetTemplateSourcePath();
@@ -323,14 +324,15 @@ namespace AzToolsFramework
return InvalidTemplateId;
}
if (!GenerateLinksForNewTemplate(newTemplateId, instance))
if (shouldCreateLinks)
{
// Clear new template and any links associated with it
RemoveTemplate(newTemplateId);
return InvalidTemplateId;
if (!GenerateLinksForNewTemplate(newTemplateId, instance))
{
// Clear new template and any links associated with it
RemoveTemplate(newTemplateId);
return InvalidTemplateId;
}
}
return newTemplateId;
}
@@ -187,17 +187,22 @@ namespace AzToolsFramework
* @param entities A vector of entities that will be used in the new instance. May be empty
* @param instances A vector of Prefab Instances that will be nested in the new instance, will be consumed and moved.
* May be empty
* @param filePath the path to associate the template of the new instance to
* @param filePath the path to associate the template of the new instance to.
* @param containerEntity The container entity for the prefab to be created. It will be created if a nullptr is provided.
* @param shouldCreateLinks The flag indicating if links should be created between the templates of the instance
* and its nested instances.
* @return A pointer to the newly created instance. nullptr on failure
*/
AZStd::unique_ptr<Instance> CreatePrefab(const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr) override;
AZStd::unique_ptr<Instance> CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr,
bool ShouldCreateLinks = true) override;
PrefabDom& FindTemplateDom(TemplateId templateId) override;
/**
* Updates a template with the given updated DOM.
*
*
* @param templateId The id of the template to update.
* @param updatedDom The DOM to update the template with.
*/
@@ -260,9 +265,11 @@ namespace AzToolsFramework
/**
* Takes a prefab instance and generates a new Prefab Template
* along with any new Prefab Links representing any of the nested instances present
* @param instance The instance used to generate the new Template
* @param instance The instance used to generate the new Template.
* @param shouldCreateLinks The flag indicating if links should be created between the templates of the instance
* and its nested instances.
*/
TemplateId CreateTemplateFromInstance(Instance& instance);
TemplateId CreateTemplateFromInstance(Instance& instance, bool shouldCreateLinks);
/**
* Connect two templates with given link, and a nested instance value iterator
@@ -61,7 +61,7 @@ namespace AzToolsFramework
virtual AZStd::unique_ptr<Instance> InstantiatePrefab(const TemplateId& templateId) = 0;
virtual AZStd::unique_ptr<Instance> CreatePrefab(const AZStd::vector<AZ::Entity*>& entities,
AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume, AZ::IO::PathView filePath,
AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr) = 0;
AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr, bool ShouldCreateLinks = true) = 0;
};
@@ -311,7 +311,6 @@ ForwardPassOutputWithDepth EnhancedPbr_ForwardPassPS(VSOutput IN, bool isFrontFa
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
OUT.m_depth = depth;
return OUT;
@@ -330,7 +329,6 @@ ForwardPassOutput EnhancedPbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace :
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
return OUT;
@@ -337,7 +337,6 @@ ForwardPassOutput SkinPS(VSOutput IN)
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
return OUT;
@@ -394,7 +394,6 @@ ForwardPassOutputWithDepth ForwardPassPS(VSOutput IN, bool isFrontFace : SV_IsFr
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
OUT.m_depth = depth;
return OUT;
@@ -413,7 +412,6 @@ ForwardPassOutput ForwardPassPS_EDS(VSOutput IN, bool isFrontFace : SV_IsFrontFa
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
return OUT;
@@ -26,4 +26,5 @@ end
function Process(context)
local enable = context:GetMaterialPropertyValue_bool("clearCoat.enable")
context:SetShaderOptionValue_bool("o_clearCoat_feature_enabled", enable)
context:SetShaderOptionValue_bool("o_materialUseForwardPassIBLSpecular", enable)
end
@@ -312,7 +312,6 @@ ForwardPassOutputWithDepth StandardPbr_ForwardPassPS(VSOutput IN, bool isFrontFa
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
OUT.m_depth = depth;
return OUT;
@@ -331,7 +330,6 @@ ForwardPassOutput StandardPbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace :
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = lightingOutput.m_scatterDistance;
return OUT;
@@ -68,7 +68,7 @@
"ShaderAsset": {
"FilePath": "Shaders/DiffuseGlobalIllumination/DiffuseComposite.shader"
},
"StencilRef": 1,
"StencilRef": 128, // See RenderCommon.h and DiffuseComposite.shader
"PipelineViewTag": "MainCamera"
}
}
@@ -48,7 +48,7 @@
"ShaderAsset": {
"FilePath": "Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen.shader"
},
"StencilRef": 1,
"StencilRef": 128, // See RenderCommon.h and DiffuseGlobalFullscreen.shader
"PipelineViewTag": "MainCamera"
}
}
@@ -43,7 +43,7 @@
"ShaderAsset": {
"FilePath": "Shaders/DiffuseGlobalIllumination/DiffuseGlobalFullscreen_nomsaa.shader"
},
"StencilRef": 1,
"StencilRef": 128, // See RenderCommon.h and DiffuseGlobalFullscreen.shader
"PipelineViewTag": "MainCamera"
}
}
@@ -148,22 +148,6 @@
"LoadAction": "Clear"
}
},
{
"Name": "ClearCoatNormalOutput",
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"ClearValue": {
"Value": [
0.0,
0.0,
0.0,
0.0
]
},
"LoadAction": "Clear"
}
},
{
"Name": "ScatterDistanceOutput",
"SlotType": "Output",
@@ -274,23 +258,6 @@
"FilePath": "Textures/BRDFTexture.attimage"
}
},
{
"Name": "ClearCoatNormalImage",
"SizeSource": {
"Source": {
"Pass": "Parent",
"Attachment": "Output"
}
},
"MultisampleSource": {
"Pass": "This",
"Attachment": "DepthStencilInputOutput"
},
"ImageDescriptor": {
"Format": "R16G16B16A16_FLOAT",
"SharedQueueMask": "Graphics"
}
},
{
"Name": "ScatterDistanceImage",
"SizeSource": {
@@ -352,13 +319,6 @@
"Attachment": "BRDFTexture"
}
},
{
"LocalSlot": "ClearCoatNormalOutput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "ClearCoatNormalImage"
}
},
{
"LocalSlot": "ScatterDistanceOutput",
"AttachmentRef": {
@@ -296,7 +296,7 @@
"ShaderAsset": {
"FilePath": "Shaders/Reflections/ReflectionComposite.shader"
},
"StencilRef": 1
"StencilRef": 1 // See RenderCommon.h and ReflectionComposite.shader
}
},
{
@@ -149,22 +149,6 @@
"LoadAction": "Clear"
}
},
{
"Name": "ClearCoatNormalOutput",
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"ClearValue": {
"Value": [
0.0,
0.0,
0.0,
0.0
]
},
"LoadAction": "Clear"
}
},
{
"Name": "ScatterDistanceOutput",
"SlotType": "Output",
@@ -255,19 +239,6 @@
"FilePath": "Textures/BRDFTexture.attimage"
}
},
{
"Name": "ClearCoatNormalImage",
"SizeSource": {
"Source": {
"Pass": "Parent",
"Attachment": "SwapChainOutput"
}
},
"ImageDescriptor": {
"Format": "R16G16B16A16_FLOAT",
"SharedQueueMask": "Graphics"
}
},
{
"Name": "ScatterDistanceImage",
"SizeSource": {
@@ -325,13 +296,6 @@
"Attachment": "BRDFTexture"
}
},
{
"LocalSlot": "ClearCoatNormalOutput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "ClearCoatNormalImage"
}
},
{
"LocalSlot": "ScatterDistanceOutput",
"AttachmentRef": {
@@ -106,14 +106,6 @@
"LoadAction": "Clear"
}
},
{
"Name": "ClearCoatNormalOutput",
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"LoadAction": "Clear"
}
},
{
"Name": "ScatterDistanceOutput",
"SlotType": "Output",
@@ -226,22 +218,6 @@
"AssetRef": {
"FilePath": "Textures/BRDFTexture.attimage"
}
},
{
"Name": "ClearCoatNormalImage",
"SizeSource": {
"Source": {
"Pass": "Parent",
"Attachment": "SwapChainOutput"
}
},
"ImageDescriptor": {
"Format": "R16G16B16A16_FLOAT",
"MultisampleState": {
"samples": 2
},
"SharedQueueMask": "Graphics"
}
}
],
"Connections": [
@@ -293,13 +269,6 @@
"Pass": "This",
"Attachment": "BRDFTexture"
}
},
{
"LocalSlot": "ClearCoatNormalOutput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "ClearCoatNormalImage"
}
}
]
}
@@ -149,22 +149,6 @@
"LoadAction": "Clear"
}
},
{
"Name": "ClearCoatNormalOutput",
"SlotType": "Output",
"ScopeAttachmentUsage": "RenderTarget",
"LoadStoreAction": {
"ClearValue": {
"Value": [
0.0,
0.0,
0.0,
0.0
]
},
"LoadAction": "Clear"
}
},
{
"Name": "ScatterDistanceOutput",
"SlotType": "Output",
@@ -275,23 +259,6 @@
"FilePath": "Textures/BRDFTexture.attimage"
}
},
{
"Name": "ClearCoatNormalImage",
"SizeSource": {
"Source": {
"Pass": "Parent",
"Attachment": "SwapChainOutput"
}
},
"MultisampleSource": {
"Pass": "This",
"Attachment": "DepthStencilInputOutput"
},
"ImageDescriptor": {
"Format": "R16G16B16A16_FLOAT",
"SharedQueueMask": "Graphics"
}
},
{
"Name": "ScatterDistanceImage",
"SizeSource": {
@@ -353,13 +320,6 @@
"Attachment": "BRDFTexture"
}
},
{
"LocalSlot": "ClearCoatNormalOutput",
"AttachmentRef": {
"Pass": "This",
"Attachment": "ClearCoatNormalImage"
}
},
{
"LocalSlot": "ScatterDistanceOutput",
"AttachmentRef": {
@@ -187,13 +187,6 @@
"Attachment": "AlbedoOutput"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "ForwardMSAAPass",
"Attachment": "ClearCoatNormalOutput"
}
},
{
"LocalSlot": "DepthStencilInputOutput",
"AttachmentRef": {
@@ -269,7 +262,7 @@
"ShaderAsset": {
"FilePath": "Shaders/Reflections/ReflectionComposite.shader"
},
"StencilRef": 1,
"StencilRef": 1, // See RenderCommon.h and ReflectionComposite.shader
"PipelineViewTag": "MainCamera"
}
},
@@ -33,11 +33,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ReflectionBlendWeightInput",
"SlotType": "Input",
@@ -27,11 +27,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ReflectionBlendWeightInput",
"SlotType": "Input",
@@ -27,11 +27,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "BRDFTextureInput",
"ShaderInputName": "m_brdfMap",
@@ -27,11 +27,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ReflectionBlendWeightInput",
"SlotType": "Input",
@@ -22,11 +22,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "DepthStencilInputOutput",
"SlotType": "InputOutput",
@@ -139,13 +134,6 @@
"Attachment": "AlbedoInput"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
},
{
"LocalSlot": "ReflectionBlendWeightInput",
"AttachmentRef": {
@@ -159,7 +147,7 @@
"ShaderAsset": {
"FilePath": "Shaders/Reflections/ReflectionGlobalFullscreen.shader"
},
"StencilRef": 15,
"StencilRef": 3, // See RenderCommon.h and ReflectionGlobalFullscreen.shader
"PipelineViewTag": "MainCamera"
}
},
@@ -203,13 +191,6 @@
"Attachment": "SpecularF0Input"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
},
{
"LocalSlot": "ReflectionBlendWeightInput",
"AttachmentRef": {
@@ -266,13 +247,6 @@
"Pass": "Parent",
"Attachment": "SpecularF0Input"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
}
],
"PassData": {
@@ -17,11 +17,6 @@
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "ClearCoatNormalInput",
"SlotType": "Input",
"ScopeAttachmentUsage": "Shader"
},
{
"Name": "DepthStencilInputOutput",
"SlotType": "InputOutput",
@@ -127,13 +122,6 @@
"Attachment": "SpecularF0Input"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
},
{
"LocalSlot": "ReflectionBlendWeightInput",
"AttachmentRef": {
@@ -147,7 +135,7 @@
"ShaderAsset": {
"FilePath": "Shaders/Reflections/ReflectionGlobalFullscreen_nomsaa.shader"
},
"StencilRef": 15,
"StencilRef": 3, // See RenderCommon.h and ReflectionGlobalFullscreen_nomsaa.shader
"PipelineViewTag": "MainCamera"
}
},
@@ -191,13 +179,6 @@
"Attachment": "SpecularF0Input"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
},
{
"LocalSlot": "ReflectionBlendWeightInput",
"AttachmentRef": {
@@ -254,13 +235,6 @@
"Pass": "Parent",
"Attachment": "SpecularF0Input"
}
},
{
"LocalSlot": "ClearCoatNormalInput",
"AttachmentRef": {
"Pass": "Parent",
"Attachment": "ClearCoatNormalInput"
}
}
],
"PassData": {
@@ -17,8 +17,7 @@ struct ForwardPassOutput
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
float4 m_clearCoatNormal : SV_Target5; //!< RG = EncodeNormalSphereMap(clearCoatNormal), B = clearCoatFactor, A = clearCoatRoughness
float3 m_scatterDistance : SV_Target6;
float3 m_scatterDistance : SV_Target5;
};
struct ForwardPassOutputWithDepth
@@ -30,7 +29,6 @@ struct ForwardPassOutputWithDepth
float4 m_albedo : SV_Target2;
float4 m_specularF0 : SV_Target3;
float4 m_normal : SV_Target4;
float4 m_clearCoatNormal : SV_Target5;
float3 m_scatterDistance : SV_Target6;
float3 m_scatterDistance : SV_Target5;
float m_depth : SV_Depth;
};
@@ -18,7 +18,11 @@
#include <Atom/Features/PBR/Lights/LightTypesCommon.azsli>
#include <Atom/Features/PBR/LightingUtils.azsli>
void ApplyIblDiffuse(float3 normal, float3 albedo, float3 diffuseResponse, out float3 outDiffuse)
void ApplyIblDiffuse(
float3 normal,
float3 albedo,
float3 diffuseResponse,
out float3 outDiffuse)
{
float3 irradianceDir = MultiplyVectorQuaternion(normal, SceneSrg::m_iblOrientation);
float3 diffuseSample = SceneSrg::m_diffuseEnvMap.Sample(SceneSrg::m_samplerEnv, GetCubemapCoords(irradianceDir)).rgb;
@@ -26,10 +30,18 @@ void ApplyIblDiffuse(float3 normal, float3 albedo, float3 diffuseResponse, out f
outDiffuse = diffuseResponse * albedo * diffuseSample;
}
void ApplyIblSpecular(float3 position, float3 normal, float3 specularF0, float roughnessLinear, float3 specularResponse, float3 dirToCamera, float2 brdf, out float3 outSpecular)
void ApplyIblSpecular(
float3 position,
float3 normal,
float3 specularF0,
float roughnessLinear,
float3 dirToCamera,
float2 brdf,
out float3 outSpecular)
{
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;
outSpecular *= (specularF0 * brdf.x + brdf.y);
@@ -70,9 +82,21 @@ void ApplyIBL(Surface surface, inout LightingData lightingData)
if (o_enableIBL)
{
float3 iblDiffuse = 0.0f;
ApplyIblDiffuse(
surface.normal,
surface.albedo,
lightingData.diffuseResponse,
iblDiffuse);
float3 iblSpecular = 0.0f;
ApplyIblDiffuse(surface.normal, surface.albedo, lightingData.diffuseResponse, iblDiffuse);
ApplyIblSpecular(surface.position, surface.normal, surface.specularF0, surface.roughnessLinear, lightingData.specularResponse, lightingData.dirToCamera, lightingData.brdf, iblSpecular);
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);
@@ -85,7 +109,47 @@ void ApplyIBL(Surface surface, inout LightingData lightingData)
if (o_enableIBL)
{
float3 iblSpecular = 0.0f;
ApplyIblSpecular(surface.position, surface.normal, surface.specularF0, surface.roughnessLinear, lightingData.specularResponse, lightingData.dirToCamera, lightingData.brdf, iblSpecular);
ApplyIblSpecular(
surface.position,
surface.normal,
surface.specularF0,
surface.roughnessLinear,
lightingData.dirToCamera,
lightingData.brdf,
iblSpecular);
iblSpecular *= lightingData.multiScatterCompensation;
if (o_clearCoat_feature_enabled)
{
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;
ApplyIblSpecular(
surface.position,
surface.clearCoat.normal,
clearCoatSpecularF0,
surface.clearCoat.roughness,
lightingData.dirToCamera,
clearCoatBrdf,
clearCoatIblSpecular);
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;
}
}
float iblExposureFactor = pow(2.0f, SceneSrg::m_iblExposure);
lightingData.specularLighting += (iblSpecular * iblExposureFactor);
@@ -15,11 +15,11 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "LessEqual",
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
@@ -15,11 +15,11 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "LessEqual",
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
@@ -15,11 +15,11 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "LessEqual",
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
@@ -15,11 +15,11 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x80",
"WriteMask" : "0x00",
"FrontFace" :
{
"Func" : "LessEqual",
"Func" : "Equal",
"DepthFailOp" : "Keep",
"FailOp" : "Keep",
"PassOp" : "Keep"
@@ -17,7 +17,7 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x00",
"FrontFace" :
{
@@ -45,8 +45,7 @@ ShaderResourceGroup PassSrg : SRG_PerPass
Texture2DMS<float> m_depth;
Texture2DMS<float4> m_normal; // RGB10 = EncodeNormalSignedOctahedron(worldNormal), A2 = multiScatterCompensationEnabled
Texture2DMS<float4> m_specularF0; // RGB8 = SpecularF0, A8 = Roughness
Texture2DMS<float4> m_albedo; // RGB = Not used here, A = specularOcclusion
Texture2DMS<float4> m_clearCoatNormal; // R16G16 = Normal (Packed), B16A16 = (factor, perceptual roughness)
Texture2DMS<float4> m_albedo; // RGB8 = Albedo, A = specularOcclusion
Texture2DMS<float> m_blendWeight;
Texture2D<float2> m_brdfMap;
@@ -109,34 +108,6 @@ PSOutput MainPS(VSOutput IN, in uint sampleIndex : SV_SampleIndex)
float3 multiScatterCompensation = GetMultiScatterCompensation(specularF0, brdf, multiScatterCompensationEnabled);
float3 specular = blendWeight * globalSpecular * multiScatterCompensation * (specularF0 * brdf.x + brdf.y);
float4 encodedClearCoatNormal = PassSrg::m_clearCoatNormal.Load(IN.m_position.xy, sampleIndex);
if(encodedClearCoatNormal.z > 0.0)
{
float3 clearCoatNormal = DecodedNormalSphereMap(encodedClearCoatNormal.xy);
float factor = encodedClearCoatNormal.z;
float roughness = encodedClearCoatNormal.w;
// recompute reflection direction based on coat's normal
float3 reflectDir = reflect(-dirToCamera, clearCoatNormal);
reflectDir = MultiplyVectorQuaternion(reflectDir, SceneSrg::m_iblOrientation);
float NdotV = saturate(dot(clearCoatNormal, dirToCamera));
NdotV = max(NdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
float3 coatGlobalSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughness)).rgb;
float2 coatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(roughness, NdotV)).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 clearCoat = blendWeight * coatGlobalSpecular * (float3(0.04, 0.04, 0.04) * coatBrdf.x + coatBrdf.y) * factor;
// attenuate base layer energy
float3 coatResponse = FresnelSchlickWithRoughness(NdotV, float3(0.04, 0.04, 0.04), roughness) * factor;
specular = specular * (1.0 - coatResponse) * (1.0 - coatResponse) + clearCoat;
}
// apply exposure setting
specular *= pow(2.0, SceneSrg::m_iblExposure);
@@ -15,7 +15,7 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x00",
"FrontFace" :
{
@@ -49,7 +49,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass
Texture2D<float> m_depth;
Texture2D<float4> m_normal; // RGB10 = Normal (Encoded), A2 = Flags
Texture2D<float4> m_specularF0; // RGB8 = SpecularF0, A8 = Roughness
Texture2D<float4> m_clearCoatNormal; // R16G16 = Normal (Packed), B16A16 = (factor, perceptual roughness)
Texture2D<float> m_blendWeight;
Texture2D<float2> m_brdfMap;
@@ -126,34 +125,6 @@ PSOutput MainPS(VSOutput IN)
float3 multiScatterCompensation = GetMultiScatterCompensation(specularF0, brdf, multiScatterCompensationEnabled);
float3 specular = blendWeight * globalSpecular * multiScatterCompensation * (specularF0 * brdf.x + brdf.y);
float4 encodedClearCoatNormal = PassSrg::m_clearCoatNormal.Load(int3(IN.m_position.xy, 0));
if(encodedClearCoatNormal.z > 0.0)
{
float3 clearCoatNormal = DecodedNormalSphereMap(encodedClearCoatNormal.xy);
float factor = encodedClearCoatNormal.z;
float roughness = encodedClearCoatNormal.w;
// recompute reflection direction based on coat's normal
float3 reflectDir = reflect(-dirToCamera, clearCoatNormal);
reflectDir = MultiplyVectorQuaternion(reflectDir, SceneSrg::m_iblOrientation);
float NdotV = saturate(dot(clearCoatNormal, dirToCamera));
NdotV = max(NdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
float3 coatGlobalSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughness)).rgb;
float2 coatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(roughness, NdotV)).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 clearCoat = blendWeight * coatGlobalSpecular * (float3(0.04, 0.04, 0.04) * coatBrdf.x + coatBrdf.y) * factor;
// attenuate base layer energy
float3 coatResponse = FresnelSchlickWithRoughness(NdotV, float3(0.04, 0.04, 0.04), roughness) * factor;
specular = specular * (1.0 - coatResponse) * (1.0 - coatResponse) + clearCoat;
}
// apply exposure setting
specular *= pow(2.0, SceneSrg::m_iblExposure);
@@ -15,7 +15,7 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x00",
"BackFace" :
{
@@ -61,40 +61,5 @@ bool ComputeProbeSpecular(float2 screenCoords, float3 positionWS, float3 aabbMin
float3 multiScatterCompensation = GetMultiScatterCompensation(specularF0, brdf, multiScatterCompensationEnabled);
specular = probeSpecular * multiScatterCompensation * (specularF0.xyz * brdf.x + brdf.y);
// compute clear coat specular amount
float4 encodedClearCoatNormal = PassSrg::m_clearCoatNormal.Load(screenCoords, sampleIndex);
if(encodedClearCoatNormal.z > 0.0)
{
float3 clearCoatNormal = DecodedNormalSphereMap(encodedClearCoatNormal.xy);
float factor = encodedClearCoatNormal.z;
float roughness = encodedClearCoatNormal.w;
// recompute reflection direction based on coat's normal
float3 reflectDir = reflect(-dirToCamera, clearCoatNormal);
// compute parallax corrected reflection vector, if necessary
// clear coat uses different normal from bottom layer, so reflection direction should be recalculated
float3 localReflectDir = reflectDir;
if (ObjectSrg::m_useParallaxCorrection)
{
localReflectDir = ApplyParallaxCorrection(ObjectSrg::m_outerAabbMin, ObjectSrg::m_outerAabbMax, ObjectSrg::m_aabbPos, positionWS, reflectDir);
}
float NdotV = saturate(dot(clearCoatNormal, dirToCamera));
NdotV = max(NdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
float3 coatProbeSpecular = ObjectSrg::m_reflectionCubeMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(localReflectDir), GetRoughnessMip(roughness)).rgb;
float2 coatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(roughness, NdotV)).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 clearCoat = coatProbeSpecular * (float3(0.04, 0.04, 0.04) * coatBrdf.x + coatBrdf.y) * factor;
// attenuate base layer energy
float3 coatResponse = FresnelSchlickWithRoughness(NdotV, float3(0.04, 0.04, 0.04), roughness) * factor;
specular = specular * (1.0 - coatResponse) * (1.0 - coatResponse) + clearCoat;
}
return true;
}
@@ -28,7 +28,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass
Texture2DMS<float> m_depth;
Texture2DMS<float4> m_normal;
Texture2DMS<float4> m_specularF0;
Texture2DMS<float4> m_clearCoatNormal;
Texture2D<float2> m_brdfMap;
Sampler LinearSampler
@@ -15,7 +15,7 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x00",
"BackFace" :
{
@@ -30,7 +30,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass
Texture2DMS<float> m_depth;
Texture2DMS<float4> m_normal;
Texture2DMS<float4> m_specularF0;
Texture2DMS<float4> m_clearCoatNormal;
Texture2DMS<float> m_blendWeight;
Texture2D<float2> m_brdfMap;
@@ -15,7 +15,7 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x00",
"BackFace" :
{
@@ -17,8 +17,8 @@
// This shader stencils the pixels covered by inner probe volumes. This will
// exclude them from blending operations in the later passes since inner volumes
// always blend at 100%. Note that this shader only considers pixels that were
// stenciled with the UseSpecularIBLPass value when they were rendered in the forward pass.
// It increases the stencil value if they are in an inner volume (i.e., makes their stencil > 1).
// stenciled with the UseIBLSpecularPass value when they were rendered in the forward pass.
// It increases the stencil value if they are in an inner volume.
#include <viewsrg.srgi>
@@ -17,8 +17,8 @@
"Stencil" :
{
"Enable" : true,
"ReadMask" : "0xFF",
"WriteMask" : "0xFF",
"ReadMask" : "0x7F",
"WriteMask" : "0x7F",
"FrontFace" :
{
"Func" : "Less",
@@ -99,6 +99,7 @@ namespace AZ
bool m_rayTracingEnabled = true;
bool m_visible = true;
bool m_useForwardPassIblSpecular = false;
bool m_hasForwardPassIblSpecularMaterial = false;
};
//! This feature processor handles static and dynamic non-skinned meshes.
@@ -240,6 +240,8 @@ namespace AZ
{
meshHandle->m_materialAssignments = materials;
}
meshHandle->m_objectSrgNeedsUpdate = true;
}
}
@@ -560,6 +562,8 @@ namespace AZ
drawPacketListOut.clear();
drawPacketListOut.reserve(meshCount);
m_hasForwardPassIblSpecularMaterial = false;
for (size_t meshIndex = 0; meshIndex < meshCount; ++meshIndex)
{
Data::Instance<RPI::Material> material = modelLod.GetMeshes()[meshIndex].m_material;
@@ -615,7 +619,16 @@ namespace AZ
AZ_Warning("MeshDrawPacket", false, "Failed to set o_meshUseForwardPassIBLSpecular on mesh draw packet");
}
drawPacket.SetStencilRef(m_useForwardPassIblSpecular || MaterialRequiresForwardPassIblSpecular(material) ? Render::StencilRefs::None : Render::StencilRefs::UseIBLSpecularPass);
bool materialRequiresForwardPassIblSpecular = MaterialRequiresForwardPassIblSpecular(material);
// track whether any materials in this mesh require ForwardPassIblSpecular, we need this information when the ObjectSrg is updated
m_hasForwardPassIblSpecularMaterial |= materialRequiresForwardPassIblSpecular;
// stencil bits
uint8_t stencilRef = m_useForwardPassIblSpecular || materialRequiresForwardPassIblSpecular ? Render::StencilRefs::None : Render::StencilRefs::UseIBLSpecularPass;
stencilRef |= Render::StencilRefs::UseDiffuseGIPass;
drawPacket.SetStencilRef(stencilRef);
drawPacket.SetSortKey(m_sortKey);
drawPacket.Update(*m_scene, false);
drawPacketListOut.emplace_back(AZStd::move(drawPacket));
@@ -907,7 +920,9 @@ namespace AZ
return;
}
if (m_useForwardPassIblSpecular)
ReflectionProbeFeatureProcessor* reflectionProbeFeatureProcessor = m_scene->GetFeatureProcessor<ReflectionProbeFeatureProcessor>();
if (reflectionProbeFeatureProcessor && (m_useForwardPassIblSpecular || m_hasForwardPassIblSpecularMaterial))
{
// retrieve probe constant indices
AZ::RHI::ShaderInputConstantIndex posConstantIndex = m_shaderResourceGroup->FindShaderInputConstantIndex(Name("m_reflectionProbeData.m_aabbPos"));
@@ -940,7 +955,6 @@ namespace AZ
TransformServiceFeatureProcessor* transformServiceFeatureProcessor = m_scene->GetFeatureProcessor<TransformServiceFeatureProcessor>();
Transform transform = transformServiceFeatureProcessor->GetTransformForId(m_objectId);
ReflectionProbeFeatureProcessor* reflectionProbeFeatureProcessor = m_scene->GetFeatureProcessor<ReflectionProbeFeatureProcessor>();
ReflectionProbeFeatureProcessor::ReflectionProbeVector reflectionProbes;
reflectionProbeFeatureProcessor->FindReflectionProbes(transform.GetTranslation(), reflectionProbes);
@@ -968,10 +982,25 @@ namespace AZ
bool MeshDataInstance::MaterialRequiresForwardPassIblSpecular(Data::Instance<RPI::Material> material) const
{
RPI::MaterialPropertyIndex propertyIndex = material->FindPropertyIndex(AZ::Name("general.forwardPassIBLSpecular"));
if (propertyIndex.IsValid())
// look for a shader that has the o_materialUseForwardPassIBLSpecular option set
// Note: this should be changed to have the material automatically set the forwardPassIBLSpecular
// property and look for that instead of the shader option.
// [GFX TODO][ATOM-5040] Address Property Metadata Feedback Loop
for (auto& shaderItem : material->GetShaderCollection())
{
return material->GetPropertyValue<bool>(propertyIndex);
if (shaderItem.IsEnabled())
{
RPI::ShaderOptionIndex index = shaderItem.GetShaderOptionGroup().GetShaderOptionLayout()->FindShaderOptionIndex(Name{ "o_materialUseForwardPassIBLSpecular" });
if (index.IsValid())
{
RPI::ShaderOptionValue value = shaderItem.GetShaderOptionGroup().GetValue(Name{ "o_materialUseForwardPassIBLSpecular" });
if (value.GetIndex() == 1)
{
return true;
}
}
}
}
return false;
@@ -22,13 +22,31 @@ namespace AZ
{
const uint32_t None = 0x00;
// The MeshFeatureProcessor sets this stencil bit on any geometry that should receive IBL specular in the reflections pass,
// otherwise IBL specular is rendered in the Forward pass.
// The Reflections pass only renders to areas with this stencil bit set.
// UseIBLSpecularPass
//
// Pass Range: Forward -> Reflections.
// Note: The Reflections pass may also overwrite other bits in the stencil buffer.
const uint32_t UseIBLSpecularPass = 0xF;
// The MeshFeatureProcessor sets the UseIBLSpecularPass stencil value on any geometry that should receive IBL Specular
// in the Reflections pass, otherwise IBL specular is rendered in the Forward pass. The Reflections pass only renders
// to areas with these stencil bits set.
//
// Used in pass range: Forward -> Reflections
//
// Notes:
// - Two bits are needed here (0x3) so that the ReflectionProbeStencilPass can use "Less" on its stencil test to
// properly handle the DecrSat on the FrontFace stencil operation depth-fail.
// - The ReflectionProbeStencilPass pass may overwrite other bits in the stencil buffer, depending on the amount of
// reflection probe volume nesting in the content.
// - New stencil bits for other purposes should be added to the most signficant bits and masked out of the Reflection passes.
// This is necessary to allow the most amount of bits to be used by the ReflectionProbeStencilPass for nested probe volumes.
// - The Reflection passes currently use 0x7F for the ReadMask and WriteMask to exclude the UseDiffuseGIPass stencil bit (see below).
// If other stencil bits are added then these masks will need to be updated.
const uint32_t UseIBLSpecularPass = 0x3;
// UseDiffuseGIPass
//
// The MeshFeatureProcessor sets this stencil bit on any geometry that should receive Diffuse GI in the DiffuseGlobalIllumination pass.
//
// Used in pass range: Forward -> DiffuseGlobalIllumination
const uint32_t UseDiffuseGIPass = 0x80;
}
}
}
@@ -21,7 +21,7 @@ namespace AZ
namespace RPI
{
ViewportContext::ViewportContext(ViewportContextManager* manager, AzFramework::ViewportId id, const AZ::Name& name, RHI::Device& device, AzFramework::NativeWindowHandle nativeWindow, ScenePtr renderScene)
: m_rootScene(renderScene)
: m_rootScene(nullptr)
, m_id(id)
, m_windowContext(AZStd::make_shared<WindowContext>())
, m_manager(manager)
@@ -33,6 +33,8 @@ namespace AZ
nativeWindow,
&AzFramework::WindowRequestBus::Events::GetClientAreaSize);
AzFramework::WindowNotificationBus::Handler::BusConnect(nativeWindow);
SetRenderScene(renderScene);
}
ViewportContext::~ViewportContext()
@@ -188,7 +188,6 @@ ForwardPassOutput AutoBrick_ForwardPassPS(VSOutput IN)
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = float3(0,0,0);
return OUT;
@@ -85,7 +85,6 @@ ForwardPassOutput MinimalPBR_MainPassPS(VSOutput IN)
OUT.m_specularF0 = lightingOutput.m_specularF0;
OUT.m_albedo = lightingOutput.m_albedo;
OUT.m_normal = lightingOutput.m_normal;
OUT.m_clearCoatNormal = lightingOutput.m_clearCoatNormal;
OUT.m_scatterDistance = float3(0,0,0);
return OUT;
@@ -88,11 +88,14 @@ void CAnimAzEntityNode::SetSkipInterpolatedCameraNode(const bool skipNodeCameraA
}
//////////////////////////////////////////////////////////////////////////
void CAnimAzEntityNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimAzEntityNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimAzEntityNode, CAnimNode>()
->Version(1)
->Field("Entity", &CAnimAzEntityNode::m_entityId);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimAzEntityNode, CAnimNode>()
->Version(1)
->Field("Entity", &CAnimAzEntityNode::m_entityId);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -74,7 +74,7 @@ public:
// will be animating these components during interpolation.
void SetSkipInterpolatedCameraNode(const bool skipNodeCameraAnimation) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
@@ -651,12 +651,15 @@ void CAnimComponentNode::AddPropertyToParamInfoMap(const CAnimParamType& paramTy
}
//////////////////////////////////////////////////////////////////////////
void CAnimComponentNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimComponentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimComponentNode, CAnimNode>()
->Version(1)
->Field("ComponentID", &CAnimComponentNode::m_componentId)
->Field("ComponentTypeID", &CAnimComponentNode::m_componentTypeId);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimComponentNode, CAnimNode>()
->Version(1)
->Field("ComponentID", &CAnimComponentNode::m_componentId)
->Field("ComponentTypeID", &CAnimComponentNode::m_componentTypeId);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ public:
m_skipComponentAnimationUpdates = skipAnimationUpdates;
}
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
// functions involved in the process to parse and store component behavior context animated properties
@@ -67,10 +67,13 @@ void CAnimEnvironmentNode::Initialize()
}
}
//////////////////////////////////////////////////////////////////////////
void CAnimEnvironmentNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimEnvironmentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimEnvironmentNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimEnvironmentNode, CAnimNode>()
->Version(1);
}
}
void CAnimEnvironmentNode::Animate(SAnimContext& ac)
@@ -40,7 +40,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -272,17 +272,32 @@ bool CAnimNode::RemoveTrack(IAnimTrack* pTrack)
}
//////////////////////////////////////////////////////////////////////////
void CAnimNode::Reflect(AZ::SerializeContext* serializeContext)
static bool AnimNodeVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<CAnimNode>()
->Version(2)
->Field("ID", &CAnimNode::m_id)
->Field("Name", &CAnimNode::m_name)
->Field("Flags", &CAnimNode::m_flags)
->Field("Tracks", &CAnimNode::m_tracks)
->Field("Parent", &CAnimNode::m_parentNodeId)
->Field("Type", &CAnimNode::m_nodeType)
->Field("Expanded", &CAnimNode::m_expanded);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimNode>());
}
return true;
}
void CAnimNode::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimNode, IAnimNode>()
->Version(3, &AnimNodeVersionConverter)
->Field("ID", &CAnimNode::m_id)
->Field("Name", &CAnimNode::m_name)
->Field("Flags", &CAnimNode::m_flags)
->Field("Tracks", &CAnimNode::m_tracks)
->Field("Parent", &CAnimNode::m_parentNodeId)
->Field("Type", &CAnimNode::m_nodeType)
->Field("Expanded", &CAnimNode::m_expanded);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -162,7 +162,7 @@ public:
void SetExpanded(bool expanded) override;
bool GetExpanded() const override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual void UpdateDynamicParamsInternal() {};
@@ -36,8 +36,11 @@ CAnimParamType CAnimNodeGroup::GetParamType([[maybe_unused]] unsigned int nIndex
}
//////////////////////////////////////////////////////////////////////////
void CAnimNodeGroup::Reflect(AZ::SerializeContext* serializeContext)
void CAnimNodeGroup::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimNodeGroup, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimNodeGroup, CAnimNode>()
->Version(1);
}
}
@@ -34,7 +34,7 @@ public:
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_ANIMNODEGROUP_H
#endif // CRYINCLUDE_CRYMOVIE_ANIMNODEGROUP_H
@@ -453,8 +453,11 @@ void CAnimPostFXNode::OnReset()
}
//////////////////////////////////////////////////////////////////////////
void CAnimPostFXNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimPostFXNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimPostFXNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimPostFXNode, CAnimNode>()
->Version(1);
}
}
@@ -63,7 +63,7 @@ public:
void InitPostLoad(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -291,10 +291,13 @@ void CAnimScreenFaderNode::Serialize
}
//////////////////////////////////////////////////////////////////////////
void CAnimScreenFaderNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimScreenFaderNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimScreenFaderNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimScreenFaderNode, CAnimNode>()
->Version(1);
}
}
//-----------------------------------------------------------------------------
@@ -56,7 +56,7 @@ public:
bool IsAnyTextureVisible() const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -837,9 +837,7 @@ static bool AnimSequenceVersionConverter(
void CAnimSequence::Reflect(AZ::ReflectContext* context)
{
IAnimSequence::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimSequence, IAnimSequence>()
->Version(IAnimSequence::kSequenceVersion, &AnimSequenceVersionConverter)
@@ -17,101 +17,104 @@
#include "AnimSerializer.h"
void AnimSerializer::ReflectAnimTypes(AZ::SerializeContext* context)
void AnimSerializer::ReflectAnimTypes(AZ::ReflectContext* context)
{
// Reflection for Maestro's AZ_TYPE_INFO'ed classes
context->Class<CAnimParamType>()
->Version(1)
->Field("Type", &CAnimParamType::m_type)
->Field("Name", &CAnimParamType::m_name);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
{
// Reflection for Maestro's AZ_TYPE_INFO'ed classes
serializeContext->Class<CAnimParamType>()
->Version(1)
->Field("Type", &CAnimParamType::m_type)
->Field("Name", &CAnimParamType::m_name);
context->Class<Range>()
->Field("Start", &Range::start)
->Field("End", &Range::end);
serializeContext->Class<Range>()
->Field("Start", &Range::start)
->Field("End", &Range::end);
// Curve Key classes
context->Class<IKey>()
->Field("Time", &IKey::time)
->Field("Flags", &IKey::flags);
// Curve Key classes
serializeContext->Class<IKey>()
->Field("Time", &IKey::time)
->Field("Flags", &IKey::flags);
context->Class<AZ::IAssetBlendKey, ITimeRangeKey>()
->Field("AssetId", &AZ::IAssetBlendKey::m_assetId)
->Field("Description", &AZ::IAssetBlendKey::m_description)
->Field("BlendInTime", &AZ::IAssetBlendKey::m_blendInTime)
->Field("BlendOutTime", &AZ::IAssetBlendKey::m_blendOutTime);
serializeContext->Class<AZ::IAssetBlendKey, ITimeRangeKey>()
->Field("AssetId", &AZ::IAssetBlendKey::m_assetId)
->Field("Description", &AZ::IAssetBlendKey::m_description)
->Field("BlendInTime", &AZ::IAssetBlendKey::m_blendInTime)
->Field("BlendOutTime", &AZ::IAssetBlendKey::m_blendOutTime);
context->Class<IBoolKey, IKey>();
serializeContext->Class<IBoolKey, IKey>();
context->Class<ICaptureKey, IKey>()
->Field("Duration", &ICaptureKey::duration)
->Field("TimeStep", &ICaptureKey::timeStep)
->Field("Folder", &ICaptureKey::folder)
->Field("Once", &ICaptureKey::once)
->Field("FilePrefix", &ICaptureKey::prefix);
serializeContext->Class<ICaptureKey, IKey>()
->Field("Duration", &ICaptureKey::duration)
->Field("TimeStep", &ICaptureKey::timeStep)
->Field("Folder", &ICaptureKey::folder)
->Field("Once", &ICaptureKey::once)
->Field("FilePrefix", &ICaptureKey::prefix);
context->Class<ICharacterKey, ITimeRangeKey>()
->Field("Animation", &ICharacterKey::m_animation)
->Field("BlendGap", &ICharacterKey::m_bBlendGap)
->Field("PlayInPlace", &ICharacterKey::m_bInPlace);
serializeContext->Class<ICharacterKey, ITimeRangeKey>()
->Field("Animation", &ICharacterKey::m_animation)
->Field("BlendGap", &ICharacterKey::m_bBlendGap)
->Field("PlayInPlace", &ICharacterKey::m_bInPlace);
context->Class<ICommentKey, IKey>()
->Field("Comment", &ICommentKey::m_strComment)
->Field("Duration", &ICommentKey::m_duration)
->Field("Font", &ICommentKey::m_strFont)
->Field("Color", &ICommentKey::m_color)
->Field("Size", &ICommentKey::m_size)
->Field("Align", &ICommentKey::m_align);
serializeContext->Class<ICommentKey, IKey>()
->Field("Comment", &ICommentKey::m_strComment)
->Field("Duration", &ICommentKey::m_duration)
->Field("Font", &ICommentKey::m_strFont)
->Field("Color", &ICommentKey::m_color)
->Field("Size", &ICommentKey::m_size)
->Field("Align", &ICommentKey::m_align);
context->Class<IConsoleKey, IKey>()
->Field("Command", &IConsoleKey::command);
serializeContext->Class<IConsoleKey, IKey>()
->Field("Command", &IConsoleKey::command);
context->Class<IDiscreteFloatKey, IKey>()
->Field("Value", &IDiscreteFloatKey::m_fValue);
serializeContext->Class<IDiscreteFloatKey, IKey>()
->Field("Value", &IDiscreteFloatKey::m_fValue);
context->Class<IEventKey, IKey>()
->Field("Event", &IEventKey::event)
->Field("EventValue", &IEventKey::eventValue)
->Field("Anim", &IEventKey::animation)
->Field("Target", &IEventKey::target)
->Field("Length", &IEventKey::duration);
serializeContext->Class<IEventKey, IKey>()
->Field("Event", &IEventKey::event)
->Field("EventValue", &IEventKey::eventValue)
->Field("Anim", &IEventKey::animation)
->Field("Target", &IEventKey::target)
->Field("Length", &IEventKey::duration);
context->Class<ILookAtKey, IKey>()
->Field("LookAtNodeName", &ILookAtKey::szSelection)
->Field("LookPose", &ILookAtKey::lookPose)
->Field("Duration", &ILookAtKey::fDuration)
->Field("SmoothTime", &ILookAtKey::smoothTime);
serializeContext->Class<ILookAtKey, IKey>()
->Field("LookAtNodeName", &ILookAtKey::szSelection)
->Field("LookPose", &ILookAtKey::lookPose)
->Field("Duration", &ILookAtKey::fDuration)
->Field("SmoothTime", &ILookAtKey::smoothTime);
context->Class<IScreenFaderKey, IKey>()
->Field("FadeTime", &IScreenFaderKey::m_fadeTime)
->Field("FadeColor", &IScreenFaderKey::m_fadeColor)
->Field("FadeType", &IScreenFaderKey::m_fadeType)
->Field("FadeChangeType", &IScreenFaderKey::m_fadeChangeType)
->Field("Texture", &IScreenFaderKey::m_strTexture)
->Field("useCurColor", &IScreenFaderKey::m_bUseCurColor);
serializeContext->Class<IScreenFaderKey, IKey>()
->Field("FadeTime", &IScreenFaderKey::m_fadeTime)
->Field("FadeColor", &IScreenFaderKey::m_fadeColor)
->Field("FadeType", &IScreenFaderKey::m_fadeType)
->Field("FadeChangeType", &IScreenFaderKey::m_fadeChangeType)
->Field("Texture", &IScreenFaderKey::m_strTexture)
->Field("useCurColor", &IScreenFaderKey::m_bUseCurColor);
context->Class<ISelectKey, IKey>()
->Field("SelectedName", &ISelectKey::szSelection)
->Field("SelectedEntityId", &ISelectKey::cameraAzEntityId)
->Field("Duration", &ISelectKey::fDuration)
->Field("BlendTime", &ISelectKey::fBlendTime);
serializeContext->Class<ISelectKey, IKey>()
->Field("SelectedName", &ISelectKey::szSelection)
->Field("SelectedEntityId", &ISelectKey::cameraAzEntityId)
->Field("Duration", &ISelectKey::fDuration)
->Field("BlendTime", &ISelectKey::fBlendTime);
context->Class<ISequenceKey, IKey>()
->Field("Node", &ISequenceKey::szSelection)
->Field("SequenceEntityId", &ISequenceKey::sequenceEntityId)
->Field("OverrideTimes", &ISequenceKey::bOverrideTimes)
->Field("StartTime", &ISequenceKey::fStartTime)
->Field("EndTime", &ISequenceKey::fEndTime);
serializeContext->Class<ISequenceKey, IKey>()
->Field("Node", &ISequenceKey::szSelection)
->Field("SequenceEntityId", &ISequenceKey::sequenceEntityId)
->Field("OverrideTimes", &ISequenceKey::bOverrideTimes)
->Field("StartTime", &ISequenceKey::fStartTime)
->Field("EndTime", &ISequenceKey::fEndTime);
context->Class<ISoundKey, IKey>()
->Field("StartTrigger", &ISoundKey::sStartTrigger)
->Field("StopTrigger", &ISoundKey::sStopTrigger)
->Field("Duration", &ISoundKey::fDuration)
->Field("Color", &ISoundKey::customColor);
serializeContext->Class<ISoundKey, IKey>()
->Field("StartTrigger", &ISoundKey::sStartTrigger)
->Field("StopTrigger", &ISoundKey::sStopTrigger)
->Field("Duration", &ISoundKey::fDuration)
->Field("Color", &ISoundKey::customColor);
context->Class<ITimeRangeKey, IKey>()
->Field("Duration", &ITimeRangeKey::m_duration)
->Field("Start", &ITimeRangeKey::m_startTime)
->Field("End", &ITimeRangeKey::m_endTime)
->Field("Speed", &ITimeRangeKey::m_speed)
->Field("Loop", &ITimeRangeKey::m_bLoop);
serializeContext->Class<ITimeRangeKey, IKey>()
->Field("Duration", &ITimeRangeKey::m_duration)
->Field("Start", &ITimeRangeKey::m_startTime)
->Field("End", &ITimeRangeKey::m_endTime)
->Field("Speed", &ITimeRangeKey::m_speed)
->Field("Loop", &ITimeRangeKey::m_bLoop);
}
}
@@ -11,11 +11,11 @@
*/
#pragma once
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/RTTI/ReflectContext.h>
class AnimSerializer
{
public:
//! Reflection for Maestro's AZ_TYPE_INFO'ed classes
static void ReflectAnimTypes(AZ::SerializeContext* context);
static void ReflectAnimTypes(AZ::ReflectContext* context);
};
@@ -370,7 +370,7 @@ public:
m_id = id;
}
static void Reflect(AZ::SerializeContext* serializeContext) {}
static void Reflect([[maybe_unused]] AZ::ReflectContext* context) {}
protected:
@@ -404,34 +404,39 @@ inline bool TAnimSplineTrack<Vec2>::VersionConverter(AZ::SerializeContext& conte
AZ::SerializeContext::DataElementNode& classElement)
{
bool result = true;
if (classElement.GetVersion() == 1)
if (classElement.GetVersion() < 5)
{
bool converted = false;
classElement.AddElement(context, "BaseClass1", azrtti_typeid<IAnimTrack>());
int splineElementIdx = classElement.FindElement(AZ_CRC("Spline", 0x35f655e9));
if (splineElementIdx != -1)
if (classElement.GetVersion() == 1)
{
// Find & copy the raw pointer node
AZ::SerializeContext::DataElementNode& splinePtrNodeRef = classElement.GetSubElement(splineElementIdx);
AZ::SerializeContext::DataElementNode splinePtrNodeCopy = splinePtrNodeRef;
bool converted = false;
// Reset the node, then convert it to an intrusive pointer
splinePtrNodeRef = AZ::SerializeContext::DataElementNode();
if (splinePtrNodeRef.Convert<AZStd::intrusive_ptr<spline::TrackSplineInterpolator<Vec2>>>(context, "Spline"))
int splineElementIdx = classElement.FindElement(AZ_CRC("Spline", 0x35f655e9));
if (splineElementIdx != -1)
{
// Use the standard name used with the smart pointers serialization
// (smart pointers are serialized as containers with one element);
// Set the intrusive pointer to the raw pointer value
splinePtrNodeCopy.SetName(AZ::SerializeContext::IDataContainer::GetDefaultElementName());
splinePtrNodeRef.AddElement(splinePtrNodeCopy);
// Find & copy the raw pointer node
AZ::SerializeContext::DataElementNode& splinePtrNodeRef = classElement.GetSubElement(splineElementIdx);
AZ::SerializeContext::DataElementNode splinePtrNodeCopy = splinePtrNodeRef;
converted = true;
// Reset the node, then convert it to an intrusive pointer
splinePtrNodeRef = AZ::SerializeContext::DataElementNode();
if (splinePtrNodeRef.Convert<AZStd::intrusive_ptr<spline::TrackSplineInterpolator<Vec2>>>(context, "Spline"))
{
// Use the standard name used with the smart pointers serialization
// (smart pointers are serialized as containers with one element);
// Set the intrusive pointer to the raw pointer value
splinePtrNodeCopy.SetName(AZ::SerializeContext::IDataContainer::GetDefaultElementName());
splinePtrNodeRef.AddElement(splinePtrNodeCopy);
converted = true;
}
}
}
// Did not convert. Discard unknown versions if failed to convert, and hope for the best
AZ_Assert(converted, "Failed to convert TUiAnimSplineTrack<Vec2> version %d to the current version", classElement.GetVersion());
result = converted;
// Did not convert. Discard unknown versions if failed to convert, and hope for the best
AZ_Assert(converted, "Failed to convert TUiAnimSplineTrack<Vec2> version %d to the current version", classElement.GetVersion());
result = converted;
}
}
return result;
@@ -439,31 +444,34 @@ inline bool TAnimSplineTrack<Vec2>::VersionConverter(AZ::SerializeContext& conte
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimSplineTrack<Vec2>::Reflect(AZ::SerializeContext* serializeContext)
inline void TAnimSplineTrack<Vec2>::Reflect(AZ::ReflectContext* context)
{
spline::SplineKey<Vec2>::Reflect(serializeContext);
spline::SplineKeyEx<Vec2>::Reflect(serializeContext);
spline::TrackSplineInterpolator<Vec2>::Reflect(serializeContext);
BezierSplineVec2::Reflect(serializeContext);
serializeContext->Class<TAnimSplineTrack<Vec2> >()
->Version(4, &TAnimSplineTrack<Vec2>::VersionConverter)
->Field("Flags", &TAnimSplineTrack<Vec2>::m_flags)
->Field("DefaultValue", &TAnimSplineTrack<Vec2>::m_defaultValue)
->Field("ParamType", &TAnimSplineTrack<Vec2>::m_nParamType)
->Field("Spline", &TAnimSplineTrack<Vec2>::m_spline)
->Field("Id", &TAnimSplineTrack<Vec2>::m_id);
AZ::EditContext* ec = serializeContext->GetEditContext();
// Preventing the default value from being pushed to slice to keep it from dirtying the slice when updated internally
if (ec)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
ec->Class<TAnimSplineTrack<Vec2>>("TAnimSplineTrack Vec2", "Specialization track for Vec2 AnimSpline")->
DataElement(AZ::Edit::UIHandlers::Vector2, &TAnimSplineTrack<Vec2>::m_defaultValue, "DefaultValue", "")->
spline::SplineKey<Vec2>::Reflect(serializeContext);
spline::SplineKeyEx<Vec2>::Reflect(serializeContext);
spline::TrackSplineInterpolator<Vec2>::Reflect(serializeContext);
BezierSplineVec2::Reflect(serializeContext);
serializeContext->Class<TAnimSplineTrack<Vec2>, IAnimTrack>()
->Version(5, &TAnimSplineTrack<Vec2>::VersionConverter)
->Field("Flags", &TAnimSplineTrack<Vec2>::m_flags)
->Field("DefaultValue", &TAnimSplineTrack<Vec2>::m_defaultValue)
->Field("ParamType", &TAnimSplineTrack<Vec2>::m_nParamType)
->Field("Spline", &TAnimSplineTrack<Vec2>::m_spline)
->Field("Id", &TAnimSplineTrack<Vec2>::m_id);
AZ::EditContext* ec = serializeContext->GetEditContext();
// Preventing the default value from being pushed to slice to keep it from dirtying the slice when updated internally
if (ec)
{
ec->Class<TAnimSplineTrack<Vec2>>("TAnimSplineTrack Vec2", "Specialization track for Vec2 AnimSpline")->
DataElement(AZ::Edit::UIHandlers::Vector2, &TAnimSplineTrack<Vec2>::m_defaultValue, "DefaultValue", "")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide)->
Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushable);
}
}
}
#endif // CRYINCLUDE_CRYMOVIE_ANIMSPLINETRACK_VEC2SPECIALIZATION_H
@@ -249,7 +249,7 @@ public:
m_id = id;
}
static void Reflect([[maybe_unused]] AZ::SerializeContext* serializeContext) {}
static void Reflect([[maybe_unused]] AZ::ReflectContext* context) {}
protected:
void CheckValid()
@@ -163,16 +163,31 @@ float CAssetBlendTrack::GetKeyDuration(int key) const
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<AZ::IAssetBlendKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool AssetBlendTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<AZ::IAssetBlendKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<AZ::IAssetBlendKey>::m_flags)
->Field("Range", &TAnimTrack<AZ::IAssetBlendKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<AZ::IAssetBlendKey>::m_nParamType)
->Field("Keys", &TAnimTrack<AZ::IAssetBlendKey>::m_keys)
->Field("Id", &TAnimTrack<AZ::IAssetBlendKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<AZ::IAssetBlendKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<AZ::IAssetBlendKey>, IAnimTrack>()
->Version(3, &AssetBlendTrackVersionConverter)
->Field("Flags", &TAnimTrack<AZ::IAssetBlendKey>::m_flags)
->Field("Range", &TAnimTrack<AZ::IAssetBlendKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<AZ::IAssetBlendKey>::m_nParamType)
->Field("Keys", &TAnimTrack<AZ::IAssetBlendKey>::m_keys)
->Field("Id", &TAnimTrack<AZ::IAssetBlendKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -277,10 +292,13 @@ float CAssetBlendTrack::GetEndTime() const
}
//////////////////////////////////////////////////////////////////////////
void CAssetBlendTrack::Reflect(AZ::SerializeContext* serializeContext)
void CAssetBlendTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<AZ::IAssetBlendKey>::Reflect(serializeContext);
TAnimTrack<AZ::IAssetBlendKey>::Reflect(context);
serializeContext->Class<CAssetBlendTrack, TAnimTrack<AZ::IAssetBlendKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAssetBlendTrack, TAnimTrack<AZ::IAssetBlendKey>>()
->Version(1);
}
}
@@ -47,7 +47,7 @@ public:
float GetEndTime() const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
@@ -98,24 +98,42 @@ bool CBoolTrack::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTr
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IBoolKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool BoolTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IBoolKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IBoolKey>::m_flags)
->Field("Range", &TAnimTrack<IBoolKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IBoolKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IBoolKey>::m_keys)
->Field("Id", &TAnimTrack<IBoolKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IBoolKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IBoolKey>, IAnimTrack>()
->Version(3, &BoolTrackVersionConverter)
->Field("Flags", &TAnimTrack<IBoolKey>::m_flags)
->Field("Range", &TAnimTrack<IBoolKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IBoolKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IBoolKey>::m_keys)
->Field("Id", &TAnimTrack<IBoolKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::Reflect(AZ::SerializeContext* serializeContext)
void CBoolTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IBoolKey>::Reflect(serializeContext);
TAnimTrack<IBoolKey>::Reflect(context);
serializeContext->Class<CBoolTrack, TAnimTrack<IBoolKey> >()
->Version(1)
->Field("DefaultValue", &CBoolTrack::m_bDefaultValue);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CBoolTrack, TAnimTrack<IBoolKey>>()
->Version(1)
->Field("DefaultValue", &CBoolTrack::m_bDefaultValue);
}
}
@@ -45,7 +45,7 @@ public:
bool Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks = true) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
bool m_bDefaultValue;
@@ -151,8 +151,11 @@ void CAnimCVarNode::Animate(SAnimContext& ec)
}
//////////////////////////////////////////////////////////////////////////
void CAnimCVarNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimCVarNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimCVarNode,CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimCVarNode, CAnimNode>()
->Version(1);
}
}
@@ -41,7 +41,7 @@ public:
int GetDefaultKeyTangentFlags() const override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -71,23 +71,41 @@ void CCaptureTrack::GetKeyInfo(int key, const char*& description, float& duratio
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICaptureKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CaptureTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICaptureKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICaptureKey>::m_flags)
->Field("Range", &TAnimTrack<ICaptureKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICaptureKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICaptureKey>::m_keys)
->Field("Id", &TAnimTrack<ICaptureKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICaptureKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICaptureKey>, IAnimTrack>()
->Version(3, &CaptureTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICaptureKey>::m_flags)
->Field("Range", &TAnimTrack<ICaptureKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICaptureKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICaptureKey>::m_keys)
->Field("Id", &TAnimTrack<ICaptureKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CCaptureTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCaptureTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICaptureKey>::Reflect(serializeContext);
TAnimTrack<ICaptureKey>::Reflect(context);
serializeContext->Class<CCaptureTrack, TAnimTrack<ICaptureKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCaptureTrack, TAnimTrack<ICaptureKey>>()
->Version(1);
}
}
@@ -33,7 +33,7 @@ public:
void SerializeKey(ICaptureKey& key, XmlNodeRef& keyNode, bool bLoading);
void GetKeyInfo(int key, const char*& description, float& duration);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_CAPTURETRACK_H
@@ -150,16 +150,31 @@ float CCharacterTrack::GetKeyDuration(int key) const
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICharacterKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CharacterTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICharacterKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICharacterKey>::m_flags)
->Field("Range", &TAnimTrack<ICharacterKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICharacterKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICharacterKey>::m_keys)
->Field("Id", &TAnimTrack<ICharacterKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICharacterKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICharacterKey>, IAnimTrack>()
->Version(3, &CharacterTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICharacterKey>::m_flags)
->Field("Range", &TAnimTrack<ICharacterKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICharacterKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICharacterKey>::m_keys)
->Field("Id", &TAnimTrack<ICharacterKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -169,11 +184,14 @@ AnimValueType CCharacterTrack::GetValueType()
}
//////////////////////////////////////////////////////////////////////////
void CCharacterTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCharacterTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICharacterKey>::Reflect(serializeContext);
TAnimTrack<ICharacterKey>::Reflect(context);
serializeContext->Class<CCharacterTrack, TAnimTrack<ICharacterKey> >()
->Version(1)
->Field("AnimationLayer", &CCharacterTrack::m_iAnimationLayer);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCharacterTrack, TAnimTrack<ICharacterKey>>()
->Version(1)
->Field("AnimationLayer", &CCharacterTrack::m_iAnimationLayer);
}
}
@@ -51,7 +51,7 @@ public:
float GetEndTime() const { return m_timeRange.end; }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
int m_iAnimationLayer;
@@ -107,10 +107,13 @@ void CCommentNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmpty
}
//////////////////////////////////////////////////////////////////////////
void CCommentNode::Reflect(AZ::SerializeContext* serializeContext)
void CCommentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CCommentNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCommentNode, CAnimNode>()
->Version(1);
}
}
//-----------------------------------------------------------------------------
@@ -49,7 +49,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -78,23 +78,41 @@ void CCommentTrack::SerializeKey(ICommentKey& key, XmlNodeRef& keyNode, bool bLo
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICommentKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CommentTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICommentKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICommentKey>::m_flags)
->Field("Range", &TAnimTrack<ICommentKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICommentKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICommentKey>::m_keys)
->Field("Id", &TAnimTrack<ICommentKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICommentKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICommentKey>, IAnimTrack>()
->Version(3, &CommentTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICommentKey>::m_flags)
->Field("Range", &TAnimTrack<ICommentKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICommentKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICommentKey>::m_keys)
->Field("Id", &TAnimTrack<ICommentKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CCommentTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCommentTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICommentKey>::Reflect(serializeContext);
TAnimTrack<ICommentKey>::Reflect(context);
serializeContext->Class<CCommentTrack, TAnimTrack<ICommentKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCommentTrack, TAnimTrack<ICommentKey>>()
->Version(1);
}
}
@@ -40,7 +40,7 @@ public:
//!
void ValidateKeyOrder() { CheckValid(); }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_COMMENTTRACK_H
@@ -604,16 +604,31 @@ void CCompoundSplineTrack::SetId(unsigned int id)
}
//////////////////////////////////////////////////////////////////////////
void CCompoundSplineTrack::Reflect(AZ::SerializeContext* serializeContext)
static bool CompoundSplineTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<CCompoundSplineTrack>()
->Version(3)
->Field("Flags", &CCompoundSplineTrack::m_flags)
->Field("ParamType", &CCompoundSplineTrack::m_nParamType)
->Field("NumSubTracks", &CCompoundSplineTrack::m_nDimensions)
->Field("SubTracks", &CCompoundSplineTrack::m_subTracks)
->Field("SubTrackNames", &CCompoundSplineTrack::m_subTrackNames)
->Field("ValueType", &CCompoundSplineTrack::m_valueType)
->Field("Expanded", &CCompoundSplineTrack::m_expanded)
->Field("Id", &CCompoundSplineTrack::m_id);
if (rootElement.GetVersion() < 4)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
void CCompoundSplineTrack::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCompoundSplineTrack, IAnimTrack>()
->Version(4, &CompoundSplineTrackVersionConverter)
->Field("Flags", &CCompoundSplineTrack::m_flags)
->Field("ParamType", &CCompoundSplineTrack::m_nParamType)
->Field("NumSubTracks", &CCompoundSplineTrack::m_nDimensions)
->Field("SubTracks", &CCompoundSplineTrack::m_subTracks)
->Field("SubTrackNames", &CCompoundSplineTrack::m_subTrackNames)
->Field("ValueType", &CCompoundSplineTrack::m_valueType)
->Field("Expanded", &CCompoundSplineTrack::m_expanded)
->Field("Id", &CCompoundSplineTrack::m_id);
}
}
@@ -157,7 +157,7 @@ public:
unsigned int GetId() const override;
void SetId(unsigned int id) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
int m_refCount;
@@ -47,23 +47,41 @@ void CConsoleTrack::GetKeyInfo(int key, const char*& description, float& duratio
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IConsoleKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool ConsoleTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IConsoleKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IConsoleKey>::m_flags)
->Field("Range", &TAnimTrack<IConsoleKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IConsoleKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IConsoleKey>::m_keys)
->Field("Id", &TAnimTrack<IConsoleKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IConsoleKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IConsoleKey>, IAnimTrack>()
->Version(3, &ConsoleTrackVersionConverter)
->Field("Flags", &TAnimTrack<IConsoleKey>::m_flags)
->Field("Range", &TAnimTrack<IConsoleKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IConsoleKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IConsoleKey>::m_keys)
->Field("Id", &TAnimTrack<IConsoleKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CConsoleTrack::Reflect(AZ::SerializeContext* serializeContext)
void CConsoleTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IConsoleKey>::Reflect(serializeContext);
TAnimTrack<IConsoleKey>::Reflect(context);
serializeContext->Class<CConsoleTrack, TAnimTrack<IConsoleKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CConsoleTrack, TAnimTrack<IConsoleKey> >()
->Version(1);
}
}
@@ -35,7 +35,7 @@ public:
void GetKeyInfo(int key, const char*& description, float& duration);
void SerializeKey(IConsoleKey& key, XmlNodeRef& keyNode, bool bLoading);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_CONSOLETRACK_H
@@ -112,8 +112,11 @@ void CAnimEventNode::OnReset()
}
//////////////////////////////////////////////////////////////////////////
void CAnimEventNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimEventNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimEventNode, CAnimNode>()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimEventNode, CAnimNode>()
->Version(1);
}
}
@@ -42,7 +42,7 @@ public:
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
//! Last animated key in track.
@@ -103,10 +103,13 @@ void CEventTrack::InitPostLoad(IAnimSequence* sequence)
}
//////////////////////////////////////////////////////////////////////////
void CEventTrack::Reflect(AZ::SerializeContext* serializeContext)
void CEventTrack::Reflect(AZ::ReflectContext* context)
{
// Note the template base class TAnimTrack<IEventKey>::Reflect() is reflected by CTrackEventTrack::Reflect()
serializeContext->Class<CEventTrack, TAnimTrack<IEventKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CEventTrack, TAnimTrack<IEventKey>>()
->Version(1);
}
}
@@ -42,7 +42,7 @@ public:
void SetKey(int index, IKey* key);
void InitPostLoad(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
AZStd::intrusive_ptr<IAnimStringTable> m_pStrings;
@@ -156,23 +156,41 @@ void CGotoTrack::SetKeyAtTime(float time, IKey* key)
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IDiscreteFloatKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool GotoTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IDiscreteFloatKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IDiscreteFloatKey>::m_flags)
->Field("Range", &TAnimTrack<IDiscreteFloatKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IDiscreteFloatKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IDiscreteFloatKey>::m_keys)
->Field("Id", &TAnimTrack<IDiscreteFloatKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IDiscreteFloatKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IDiscreteFloatKey>, IAnimTrack>()
->Version(3, &GotoTrackVersionConverter)
->Field("Flags", &TAnimTrack<IDiscreteFloatKey>::m_flags)
->Field("Range", &TAnimTrack<IDiscreteFloatKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IDiscreteFloatKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IDiscreteFloatKey>::m_keys)
->Field("Id", &TAnimTrack<IDiscreteFloatKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CGotoTrack::Reflect(AZ::SerializeContext* serializeContext)
void CGotoTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IDiscreteFloatKey>::Reflect(serializeContext);
TAnimTrack<IDiscreteFloatKey>::Reflect(context);
serializeContext->Class<CGotoTrack, TAnimTrack<IDiscreteFloatKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CGotoTrack, TAnimTrack<IDiscreteFloatKey>>()
->Version(1);
}
}
@@ -40,7 +40,7 @@ public:
void SerializeKey(IDiscreteFloatKey& key, XmlNodeRef& keyNode, bool bLoading);
void GetKeyInfo(int key, const char*& description, float& duration);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
void SetKeyAtTime(float time, IKey* key);
@@ -172,8 +172,11 @@ bool CLayerNode::GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo&
}
//////////////////////////////////////////////////////////////////////////
void CLayerNode::Reflect(AZ::SerializeContext* serializeContext)
void CLayerNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CLayerNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CLayerNode, CAnimNode>()
->Version(1);
}
}
@@ -52,7 +52,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -79,24 +79,42 @@ void CLookAtTrack::GetKeyInfo(int key, const char*& description, float& duration
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ILookAtKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool LookAtTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ILookAtKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ILookAtKey>::m_flags)
->Field("Range", &TAnimTrack<ILookAtKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ILookAtKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ILookAtKey>::m_keys)
->Field("Id", &TAnimTrack<ILookAtKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ILookAtKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ILookAtKey>, IAnimTrack>()
->Version(3, &LookAtTrackVersionConverter)
->Field("Flags", &TAnimTrack<ILookAtKey>::m_flags)
->Field("Range", &TAnimTrack<ILookAtKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ILookAtKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ILookAtKey>::m_keys)
->Field("Id", &TAnimTrack<ILookAtKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CLookAtTrack::Reflect(AZ::SerializeContext* serializeContext)
void CLookAtTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ILookAtKey>::Reflect(serializeContext);
TAnimTrack<ILookAtKey>::Reflect(context);
serializeContext->Class<CLookAtTrack, TAnimTrack<ILookAtKey> >()
->Version(1)
->Field("AnimationLayer", &CLookAtTrack::m_iAnimationLayer);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CLookAtTrack, TAnimTrack<ILookAtKey>>()
->Version(1)
->Field("AnimationLayer", &CLookAtTrack::m_iAnimationLayer);
}
}
@@ -41,7 +41,7 @@ public:
int GetAnimationLayerIndex() const { return m_iAnimationLayer; }
void SetAnimationLayerIndex(int index) { m_iAnimationLayer = index; }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
int m_iAnimationLayer;
};

Some files were not shown because too many files have changed in this diff Show More