Add support for depth clamping

This commit is contained in:
Jérôme Leclercq
2021-07-09 00:22:08 +02:00
parent 3a3279246f
commit 8458301a64
12 changed files with 74 additions and 2 deletions

View File

@@ -115,6 +115,28 @@ namespace Nz
InvalidatePipeline();
}
/*!
* \brief Enable/Disable depth clamp for this material
*
* When enabled, all fragments generated by this material will be clamped to znear or zfar
* instead of being clipped out when outside this range.
*
* This can be useful to prevent clipping near or far primitives.
*
* \param depthClamp Defines if this material will use depth clamping
*
* \remark Invalidates the pipeline
* \remark Depth clamping requires RenderDeviceFeatures::depthClamping to be true
*
* \see IsDepthClampEnabled
*/
inline void Material::EnableDepthClamp(bool depthClamp)
{
m_pipelineInfo.depthClamp = depthClamp;
InvalidatePipeline();
}
/*!
* \brief Enable/Disable depth sorting for this material
*
@@ -524,6 +546,15 @@ namespace Nz
return m_pipelineInfo.depthBuffer;
}
/*!
* \brief Checks whether this material has depth clamping enabled
* \return true If it is the case
*/
inline bool Material::IsDepthClampEnabled() const
{
return false;
}
/*!
* \brief Checks whether this material has depth sorting enabled
* \return true If it is the case