Remove Material::EnableAlphaTest (superseded by conditions)

This commit is contained in:
Jérôme Leclercq 2021-01-03 10:48:47 +01:00
parent ef1f4c770a
commit a801754f6e
5 changed files with 14 additions and 33 deletions

View File

@ -9,6 +9,20 @@
namespace Nz namespace Nz
{ {
/*!
* \brief Enable/Disable alpha test for this material
*
* When enabled, all objects using this material will be rendered using alpha testing,
* rejecting pixels if their alpha component is under a defined threshold.
* This allows some kind of transparency with a much cheaper cost as it doesn't prevent any optimization (as deferred rendering or batching).
*
* \param alphaTest Defines if this material will use alpha testing
*
* \remark Invalidates the pipeline
*
* \see IsAlphaTestEnabled
* \see SetAlphaThreshold
*/
inline void BasicMaterial::EnableAlphaTest(bool alphaTest) inline void BasicMaterial::EnableAlphaTest(bool alphaTest)
{ {
NazaraAssert(HasAlphaTest(), "Material has no alpha test condition"); NazaraAssert(HasAlphaTest(), "Material has no alpha test condition");

View File

@ -38,7 +38,6 @@ namespace Nz
inline void Configure(std::shared_ptr<MaterialPipeline> pipeline); inline void Configure(std::shared_ptr<MaterialPipeline> pipeline);
inline void Configure(const MaterialPipelineInfo& pipelineInfo); inline void Configure(const MaterialPipelineInfo& pipelineInfo);
inline void EnableAlphaTest(bool alphaTest);
inline void EnableBlending(bool blending); inline void EnableBlending(bool blending);
inline void EnableColorWrite(bool colorWrite); inline void EnableColorWrite(bool colorWrite);
inline void EnableCondition(std::size_t conditionIndex, bool enable); inline void EnableCondition(std::size_t conditionIndex, bool enable);

View File

@ -53,27 +53,6 @@ namespace Nz
InvalidatePipeline(); InvalidatePipeline();
} }
/*!
* \brief Enable/Disable alpha test for this material
*
* When enabled, all objects using this material will be rendered using alpha testing,
* rejecting pixels if their alpha component is under a defined threshold.
* This allows some kind of transparency with a much cheaper cost as it doesn't prevent any optimization (as deferred rendering or batching).
*
* \param alphaTest Defines if this material will use alpha testing
*
* \remark Invalidates the pipeline
*
* \see IsAlphaTestEnabled
* \see SetAlphaThreshold
*/
inline void Material::EnableAlphaTest(bool alphaTest)
{
m_pipelineInfo.alphaTest = alphaTest;
InvalidatePipeline();
}
/*! /*!
* \brief Enable/Disable blending for this material * \brief Enable/Disable blending for this material
* *
@ -489,15 +468,6 @@ namespace Nz
return m_pipelineInfo.hasVertexColor; return m_pipelineInfo.hasVertexColor;
} }
/*!
* \brief Checks whether this material has alpha test enabled
* \return true If it is the case
*/
inline bool Material::IsAlphaTestEnabled() const
{
return m_pipelineInfo.alphaTest;
}
/*! /*!
* \brief Checks whether this material has blending enabled * \brief Checks whether this material has blending enabled
* \return true If it is the case * \return true If it is the case

View File

@ -27,7 +27,6 @@ namespace Nz
Nz::UInt64 enabledConditions = 0; Nz::UInt64 enabledConditions = 0;
}; };
bool alphaTest = false;
bool depthSorting = false; bool depthSorting = false;
bool hasVertexColor = false; bool hasVertexColor = false;
bool reflectionMapping = false; bool reflectionMapping = false;

View File

@ -76,7 +76,6 @@ namespace std
#define NazaraPipelineMember(member) Nz::HashCombine(seed, pipelineInfo.member) #define NazaraPipelineMember(member) Nz::HashCombine(seed, pipelineInfo.member)
#define NazaraPipelineBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++) #define NazaraPipelineBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++)
NazaraPipelineBoolMember(alphaTest);
NazaraPipelineBoolMember(depthSorting); NazaraPipelineBoolMember(depthSorting);
NazaraPipelineBoolMember(hasVertexColor); NazaraPipelineBoolMember(hasVertexColor);
NazaraPipelineBoolMember(reflectionMapping); NazaraPipelineBoolMember(reflectionMapping);