ATOM-13216 Delete Deprecated Functors
Removed unused PropertyVisibilityFunctor and ShaderEnableFunctormain
parent
7e023c3676
commit
c84989832d
@ -1,77 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PropertyVisibilityFunctor.h"
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void PropertyVisibilityFunctor::Reflect(ReflectContext* context)
|
||||
{
|
||||
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<Action>()
|
||||
->Version(1)
|
||||
->Field("triggerProperty", &Action::m_triggerPropertyIndex)
|
||||
->Field("triggerValue", &Action::m_triggerValue)
|
||||
->Field("visibility", &Action::m_visibility)
|
||||
;
|
||||
serializeContext->Class<PropertyVisibilityFunctor, RPI::MaterialFunctor>()
|
||||
->Version(1)
|
||||
->Field("actions", &PropertyVisibilityFunctor::m_actions)
|
||||
->Field("affectedProperties", &PropertyVisibilityFunctor::m_affectedProperties)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyVisibilityFunctor::Process(EditorContext& context)
|
||||
{
|
||||
bool visibilityApplied = false;
|
||||
RPI::MaterialPropertyVisibility lastAppliedVisibility;
|
||||
|
||||
for (const auto& action : m_actions)
|
||||
{
|
||||
bool willSetVisibility = false;
|
||||
if (action.m_triggerValue.Is<bool>() || action.m_triggerValue.Is<int32_t>() || action.m_triggerValue.Is<uint32_t>())
|
||||
{
|
||||
willSetVisibility = action.m_triggerValue == context.GetMaterialPropertyValue(action.m_triggerPropertyIndex);
|
||||
}
|
||||
else if (action.m_triggerValue.Is<float>())
|
||||
{
|
||||
willSetVisibility = AZ::IsClose(action.m_triggerValue.GetValue<float>(),
|
||||
context.GetMaterialPropertyValue<float>(action.m_triggerPropertyIndex),
|
||||
std::numeric_limits<float>::epsilon());
|
||||
}
|
||||
else // for types Vector2, Vector3, Vector4, Color, Image
|
||||
{
|
||||
AZ_Error("PropertyVisibilityFunctor", false, "Unsupported property data type as an enable property.");
|
||||
}
|
||||
|
||||
if (willSetVisibility)
|
||||
{
|
||||
visibilityApplied = true;
|
||||
lastAppliedVisibility = action.m_visibility;
|
||||
}
|
||||
}
|
||||
|
||||
if (visibilityApplied)
|
||||
{
|
||||
for (const auto& propertyIndex : m_affectedProperties)
|
||||
{
|
||||
context.SetMaterialPropertyVisibility(propertyIndex, lastAppliedVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
@ -1,49 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
//! Materials can use this functor to control when and how to set the visibility of a group of properties.
|
||||
class PropertyVisibilityFunctor final
|
||||
: public RPI::MaterialFunctor
|
||||
{
|
||||
friend class PropertyVisibilityFunctorSourceData;
|
||||
public:
|
||||
AZ_RTTI(AZ::Render::PropertyVisibilityFunctor, "{2582B36F-FA7C-450F-B46A-39AAE18356A0}", RPI::MaterialFunctor);
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
void Process(EditorContext& context) override;
|
||||
|
||||
private:
|
||||
struct Action
|
||||
{
|
||||
AZ_TYPE_INFO(AZ::Render::PropertyVisibilityFunctor::Action, "{5DF4D981-9D0C-4040-A6C5-52E1D0BD876B}");
|
||||
|
||||
RPI::MaterialPropertyIndex m_triggerPropertyIndex; //! The control property for affected properties.
|
||||
RPI::MaterialPropertyValue m_triggerValue; //! The trigger value of the control property.
|
||||
RPI::MaterialPropertyVisibility m_visibility; //! The visibility of affected properties when the trigger value is hit.
|
||||
};
|
||||
// Material property inputs...
|
||||
AZStd::vector<Action> m_actions; //! The actions that describes when and what to do with visibilities.
|
||||
AZStd::vector<RPI::MaterialPropertyIndex> m_affectedProperties; //! The properties that are affected by actions.
|
||||
};
|
||||
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
@ -1,100 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PropertyVisibilityFunctorSourceData.h"
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroupLayout.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <Atom/RPI.Edit/Material/MaterialUtils.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void PropertyVisibilityFunctorSourceData::Reflect(ReflectContext* context)
|
||||
{
|
||||
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<ActionSourceData>()
|
||||
->Version(1)
|
||||
->Field("triggerProperty", &ActionSourceData::m_triggerPropertyName)
|
||||
->Field("triggerValue", &ActionSourceData::m_triggerValue)
|
||||
->Field("visibility", &ActionSourceData::m_visibility)
|
||||
;
|
||||
serializeContext->Class<PropertyVisibilityFunctorSourceData>()
|
||||
->Version(2)
|
||||
->Field("actions", &PropertyVisibilityFunctorSourceData::m_actions)
|
||||
->Field("affectedProperties", &PropertyVisibilityFunctorSourceData::m_affectedPropertyNames)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
RPI::MaterialFunctorSourceData::FunctorResult PropertyVisibilityFunctorSourceData::CreateFunctor(const EditorContext& context) const
|
||||
{
|
||||
using namespace RPI;
|
||||
|
||||
RPI::Ptr<PropertyVisibilityFunctor> functor = aznew PropertyVisibilityFunctor;
|
||||
|
||||
functor->m_actions.reserve(m_actions.size());
|
||||
|
||||
for (const auto& actionSource : m_actions)
|
||||
{
|
||||
functor->m_actions.emplace_back();
|
||||
PropertyVisibilityFunctor::Action& action = functor->m_actions.back();
|
||||
action.m_triggerPropertyIndex = context.FindMaterialPropertyIndex(AZ::Name{ actionSource.m_triggerPropertyName });
|
||||
if (action.m_triggerPropertyIndex.IsNull())
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
AddMaterialPropertyDependency(functor, action.m_triggerPropertyIndex);
|
||||
|
||||
if (!actionSource.m_triggerValue.Resolve(*context.GetMaterialPropertiesLayout(), Name{ actionSource.m_triggerPropertyName }))
|
||||
{
|
||||
// Error is reported in Resolve().
|
||||
return Failure();
|
||||
}
|
||||
|
||||
const MaterialPropertyDescriptor* propertyDescriptor = context.GetMaterialPropertiesLayout()->GetPropertyDescriptor(action.m_triggerPropertyIndex);
|
||||
// Enum type should resolve further to a unit32_t from the string source.
|
||||
if (propertyDescriptor->GetDataType() == RPI::MaterialPropertyDataType::Enum)
|
||||
{
|
||||
if (!RPI::MaterialUtils::ResolveMaterialPropertyEnumValue(
|
||||
propertyDescriptor,
|
||||
Name(actionSource.m_triggerValue.GetValue().GetValue<AZStd::string>()),
|
||||
action.m_triggerValue))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
action.m_triggerValue = actionSource.m_triggerValue.GetValue();
|
||||
}
|
||||
|
||||
action.m_visibility = actionSource.m_visibility;
|
||||
}
|
||||
|
||||
functor->m_affectedProperties.reserve(m_affectedPropertyNames.size());
|
||||
for (const AZStd::string& name : m_affectedPropertyNames)
|
||||
{
|
||||
RPI::MaterialPropertyIndex index = context.FindMaterialPropertyIndex(AZ::Name{ name });
|
||||
if (index.IsNull())
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_affectedProperties.push_back(index);
|
||||
}
|
||||
|
||||
return Success(RPI::Ptr<MaterialFunctor>(functor));
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
@ -1,48 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PropertyVisibilityFunctor.h"
|
||||
#include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
|
||||
#include <Atom/RPI.Edit/Material/MaterialPropertyValueSourceData.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
//! Builds a PropertyVisibilityFunctor.
|
||||
//! Materials can use this functor to control whether a specific property group will be enabled.
|
||||
class PropertyVisibilityFunctorSourceData final
|
||||
: public RPI::MaterialFunctorSourceData
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AZ::Render::PropertyVisibilityFunctorSourceData, "{B44E6929-8FFF-405F-9056-B9B811F97676}", RPI::MaterialFunctorSourceData);
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
FunctorResult CreateFunctor(const EditorContext& context) const override;
|
||||
private:
|
||||
struct ActionSourceData
|
||||
{
|
||||
AZ_TYPE_INFO(AZ::Render::PropertyVisibilityFunctorSourceData::ActionSourceData, "{70E01DA6-0B42-4CCB-AAD0-51980DB43F62}");
|
||||
AZStd::string m_triggerPropertyName; //! The control property for affected properties.
|
||||
RPI::MaterialPropertyValueSourceData m_triggerValue; //! The trigger value of the control property.
|
||||
RPI::MaterialPropertyVisibility m_visibility; //! The visibility of affected properties when the trigger value is hit.
|
||||
};
|
||||
// Material property inputs...
|
||||
AZStd::vector<ActionSourceData> m_actions; //! The actions that describes when and what to do with visibilities.
|
||||
AZStd::vector<AZStd::string> m_affectedPropertyNames; //! The properties that are affected by actions.
|
||||
};
|
||||
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
@ -1,74 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "./ShaderEnableFunctor.h"
|
||||
#include <Atom/RPI.Public/Material/Material.h>
|
||||
#include <Atom/RPI.Reflect/Image/Image.h>
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroup.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void ShaderEnableFunctor::Reflect(ReflectContext* context)
|
||||
{
|
||||
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<ShaderEnableFunctor, RPI::MaterialFunctor>()
|
||||
->Version(4)
|
||||
->Field("opacityModeIndex", &ShaderEnableFunctor::m_opacityModeIndex)
|
||||
->Field("parallaxEnableIndex", &ShaderEnableFunctor::m_parallaxEnableIndex)
|
||||
->Field("parallaxPdoEnableIndex", &ShaderEnableFunctor::m_parallaxPdoEnableIndex)
|
||||
->Field("shadowShaderNoPSIndex", &ShaderEnableFunctor::m_shadowShaderNoPSIndex)
|
||||
->Field("shadowShaderWithPSIndex", &ShaderEnableFunctor::m_shadowShaderWithPSIndex)
|
||||
->Field("depthShaderNoPSIndex", &ShaderEnableFunctor::m_depthShaderNoPSIndex)
|
||||
->Field("depthShaderWithPSIndex", &ShaderEnableFunctor::m_depthShaderWithPSIndex)
|
||||
->Field("pbrShaderNoEdsIndex", &ShaderEnableFunctor::m_pbrShaderNoEdsIndex)
|
||||
->Field("pbrShaderWithEdsIndex", &ShaderEnableFunctor::m_pbrShaderWithEdsIndex)
|
||||
->Field("depthShaderTransparentMin", &ShaderEnableFunctor::m_depthShaderTransparentMin)
|
||||
->Field("depthShaderTransparentMax", &ShaderEnableFunctor::m_depthShaderTransparentMax)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderEnableFunctor::Process(RuntimeContext& context)
|
||||
{
|
||||
unsigned int opacityMode = context.GetMaterialPropertyValue<uint32_t>(m_opacityModeIndex);
|
||||
bool parallaxEnabled = context.GetMaterialPropertyValue<bool>(m_parallaxEnableIndex);
|
||||
bool parallaxPdoEnabled = context.GetMaterialPropertyValue<bool>(m_parallaxPdoEnableIndex);
|
||||
|
||||
if (parallaxEnabled && parallaxPdoEnabled)
|
||||
{
|
||||
context.SetShaderEnabled(m_depthShaderNoPSIndex, false);
|
||||
context.SetShaderEnabled(m_shadowShaderNoPSIndex, false);
|
||||
context.SetShaderEnabled(m_pbrShaderWithEdsIndex, false);
|
||||
|
||||
context.SetShaderEnabled(m_depthShaderWithPSIndex, true);
|
||||
context.SetShaderEnabled(m_shadowShaderWithPSIndex, true);
|
||||
context.SetShaderEnabled(m_pbrShaderNoEdsIndex, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.SetShaderEnabled(m_depthShaderNoPSIndex, opacityMode == OpacityMode::Opaque );
|
||||
context.SetShaderEnabled(m_shadowShaderNoPSIndex, opacityMode == OpacityMode::Opaque);
|
||||
context.SetShaderEnabled(m_pbrShaderWithEdsIndex, opacityMode == OpacityMode::Opaque || opacityMode == OpacityMode::Blended || opacityMode == OpacityMode::TintedTransparent);
|
||||
|
||||
context.SetShaderEnabled(m_depthShaderWithPSIndex, opacityMode == OpacityMode::Cutout);
|
||||
context.SetShaderEnabled(m_shadowShaderWithPSIndex, opacityMode == OpacityMode::Cutout);
|
||||
context.SetShaderEnabled(m_pbrShaderNoEdsIndex, opacityMode == OpacityMode::Cutout);
|
||||
}
|
||||
|
||||
context.SetShaderEnabled(m_depthShaderTransparentMin, opacityMode == OpacityMode::Blended || opacityMode == OpacityMode::TintedTransparent);
|
||||
context.SetShaderEnabled(m_depthShaderTransparentMax, opacityMode == OpacityMode::Blended || opacityMode == OpacityMode::TintedTransparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,63 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
|
||||
#include <Atom/RHI.Reflect/Limits.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
enum OpacityMode
|
||||
{
|
||||
Opaque = 0,
|
||||
Cutout,
|
||||
Blended,
|
||||
TintedTransparent,
|
||||
};
|
||||
|
||||
//! Select shadow and depth shader based on opacity mode and parallax state
|
||||
//! Opaque: Enable shader without PS
|
||||
//! Cutout or Parallax enable: Enable shader with PS
|
||||
//! Blended: Disable both
|
||||
//! TintedTransparent: Disable both
|
||||
class ShaderEnableFunctor final
|
||||
: public RPI::MaterialFunctor
|
||||
{
|
||||
friend class ShaderEnableFunctorSourceData;
|
||||
public:
|
||||
AZ_RTTI(ShaderEnableFunctor, "{2079A693-FE4F-46A7-95C0-09D88AC156D0}", RPI::MaterialFunctor);
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
void Process(RuntimeContext& context) override;
|
||||
|
||||
private:
|
||||
RPI::MaterialPropertyIndex m_opacityModeIndex;
|
||||
RPI::MaterialPropertyIndex m_parallaxEnableIndex;
|
||||
RPI::MaterialPropertyIndex m_parallaxPdoEnableIndex;
|
||||
|
||||
uint32_t m_shadowShaderNoPSIndex = -1;
|
||||
uint32_t m_shadowShaderWithPSIndex = -1;
|
||||
uint32_t m_depthShaderNoPSIndex = -1;
|
||||
uint32_t m_depthShaderWithPSIndex = -1;
|
||||
uint32_t m_pbrShaderWithEdsIndex = -1;
|
||||
uint32_t m_pbrShaderNoEdsIndex = -1;
|
||||
// The following are used by the light culling system to produce min/max depth bounds
|
||||
uint32_t m_depthShaderTransparentMin = -1;
|
||||
uint32_t m_depthShaderTransparentMax = -1;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,116 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "./ShaderEnableFunctorSourceData.h"
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroupLayout.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void ShaderEnableFunctorSourceData::Reflect(ReflectContext* context)
|
||||
{
|
||||
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<ShaderEnableFunctorSourceData>()
|
||||
->Version(5)
|
||||
->Field("opacityMode", &ShaderEnableFunctorSourceData::m_opacityMode)
|
||||
->Field("parallaxEnable", &ShaderEnableFunctorSourceData::m_parallaxEnable)
|
||||
->Field("parallaxPdoEnable", &ShaderEnableFunctorSourceData::m_parallaxPdoEnable)
|
||||
->Field("shadowShaderNoPSIndex", &ShaderEnableFunctorSourceData::m_shadowShaderNoPSIndex)
|
||||
->Field("shadowShaderWithPSIndex", &ShaderEnableFunctorSourceData::m_shadowShaderWithPSIndex)
|
||||
->Field("depthShaderNoPSIndex", &ShaderEnableFunctorSourceData::m_depthShaderNoPSIndex)
|
||||
->Field("depthShaderWithPSIndex", &ShaderEnableFunctorSourceData::m_depthShaderWithPSIndex)
|
||||
->Field("pbrShaderNoEdsIndex", &ShaderEnableFunctorSourceData::m_pbrShaderNoEdsIndex)
|
||||
->Field("pbrShaderWithEdsIndex", &ShaderEnableFunctorSourceData::m_pbrShaderWithEdsIndex)
|
||||
->Field("depthShaderTransparentMin", &ShaderEnableFunctorSourceData::m_depthShaderTransparentMin)
|
||||
->Field("depthShaderTransparentMax", &ShaderEnableFunctorSourceData::m_depthShaderTransparentMax)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
RPI::MaterialFunctorSourceData::FunctorResult ShaderEnableFunctorSourceData::CreateFunctor(const RuntimeContext& context) const
|
||||
{
|
||||
RPI::Ptr<ShaderEnableFunctor> functor = aznew ShaderEnableFunctor;
|
||||
|
||||
functor->m_opacityModeIndex = context.FindMaterialPropertyIndex(Name{ m_opacityMode });
|
||||
if (functor->m_opacityModeIndex.IsNull())
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
AddMaterialPropertyDependency(functor, functor->m_opacityModeIndex);
|
||||
|
||||
functor->m_parallaxEnableIndex = context.FindMaterialPropertyIndex(Name{ m_parallaxEnable });
|
||||
if (functor->m_parallaxEnableIndex.IsNull())
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
AddMaterialPropertyDependency(functor, functor->m_parallaxEnableIndex);
|
||||
|
||||
functor->m_parallaxPdoEnableIndex = context.FindMaterialPropertyIndex(Name{ m_parallaxPdoEnable });
|
||||
if (functor->m_parallaxPdoEnableIndex.IsNull())
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
AddMaterialPropertyDependency(functor, functor->m_parallaxPdoEnableIndex);
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_shadowShaderWithPSIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_shadowShaderWithPSIndex = m_shadowShaderWithPSIndex;
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_shadowShaderNoPSIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_shadowShaderNoPSIndex = m_shadowShaderNoPSIndex;
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_depthShaderWithPSIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_depthShaderWithPSIndex = m_depthShaderWithPSIndex;
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_depthShaderNoPSIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_depthShaderNoPSIndex = m_depthShaderNoPSIndex;
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_pbrShaderNoEdsIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_pbrShaderNoEdsIndex = m_pbrShaderNoEdsIndex;
|
||||
|
||||
if (!context.CheckShaderIndexValid(m_pbrShaderWithEdsIndex))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_pbrShaderWithEdsIndex = m_pbrShaderWithEdsIndex;
|
||||
if (!context.CheckShaderIndexValid(m_depthShaderTransparentMin))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_depthShaderTransparentMin = m_depthShaderTransparentMin;
|
||||
if (!context.CheckShaderIndexValid(m_depthShaderTransparentMax))
|
||||
{
|
||||
return Failure();
|
||||
}
|
||||
functor->m_depthShaderTransparentMax = m_depthShaderTransparentMax;
|
||||
|
||||
return Success(RPI::Ptr<RPI::MaterialFunctor>(functor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,52 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./ShaderEnableFunctor.h"
|
||||
#include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class ShaderEnableFunctor;
|
||||
|
||||
//! Builds a ShaderEnableFunctor
|
||||
class ShaderEnableFunctorSourceData final
|
||||
: public RPI::MaterialFunctorSourceData
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(ShaderEnableFunctorSourceData, "{63775ECB-5C3E-44D3-B175-4537BF76C3A7}", RPI::MaterialFunctorSourceData);
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
FunctorResult CreateFunctor(const RuntimeContext& context) const override;
|
||||
|
||||
private:
|
||||
|
||||
AZStd::string m_opacityMode;
|
||||
AZStd::string m_parallaxEnable;
|
||||
AZStd::string m_parallaxPdoEnable;
|
||||
|
||||
uint32_t m_shadowShaderNoPSIndex = -1;
|
||||
uint32_t m_shadowShaderWithPSIndex = -1;
|
||||
uint32_t m_depthShaderNoPSIndex = -1;
|
||||
uint32_t m_depthShaderWithPSIndex = -1;
|
||||
uint32_t m_pbrShaderWithEdsIndex = -1;
|
||||
uint32_t m_pbrShaderNoEdsIndex = -1;
|
||||
// The following are used by the light culling system to produce min/max depth bounds
|
||||
uint32_t m_depthShaderTransparentMin = -1;
|
||||
uint32_t m_depthShaderTransparentMax = -1;
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue