Add support for depth clamping
This commit is contained in:
@@ -42,6 +42,7 @@ namespace Nz
|
||||
inline void EnableBlending(bool blending);
|
||||
inline void EnableColorWrite(bool colorWrite);
|
||||
inline void EnableDepthBuffer(bool depthBuffer);
|
||||
inline void EnableDepthClamp(bool depthClamp);
|
||||
inline void EnableDepthSorting(bool depthSorting);
|
||||
inline void EnableDepthWrite(bool depthWrite);
|
||||
inline void EnableFaceCulling(bool faceCulling);
|
||||
@@ -84,6 +85,7 @@ namespace Nz
|
||||
inline bool IsBlendingEnabled() const;
|
||||
inline bool IsColorWriteEnabled() const;
|
||||
inline bool IsDepthBufferEnabled() const;
|
||||
inline bool IsDepthClampEnabled() const;
|
||||
inline bool IsDepthSortingEnabled() const;
|
||||
inline bool IsDepthWriteEnabled() const;
|
||||
inline bool IsFaceCullingEnabled() const;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Nz::GL
|
||||
|
||||
enum class Extension
|
||||
{
|
||||
DepthClamp,
|
||||
SpirV,
|
||||
TextureCompressionS3tc,
|
||||
TextureFilterAnisotropic,
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Nz
|
||||
struct RenderDeviceFeatures
|
||||
{
|
||||
bool anisotropicFiltering = false;
|
||||
bool depthClamping = false;
|
||||
bool nonSolidFaceFilling = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#ifndef NAZARA_RENDERPIPELINE_HPP
|
||||
#define NAZARA_RENDERPIPELINE_HPP
|
||||
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -26,6 +26,8 @@ namespace Nz
|
||||
std::vector<VertexBufferData> vertexBuffers;
|
||||
};
|
||||
|
||||
class RenderDevice;
|
||||
|
||||
class NAZARA_RENDERER_API RenderPipeline
|
||||
{
|
||||
public:
|
||||
@@ -33,6 +35,9 @@ namespace Nz
|
||||
virtual ~RenderPipeline();
|
||||
|
||||
virtual const RenderPipelineInfo& GetPipelineInfo() const = 0;
|
||||
|
||||
protected:
|
||||
static void ValidatePipelineInfo(const RenderDevice& device, RenderPipelineInfo& pipelineInfo);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace Nz
|
||||
bool blending = false;
|
||||
bool colorWrite = true;
|
||||
bool depthBuffer = false;
|
||||
bool depthClamp = false;
|
||||
bool depthWrite = true;
|
||||
bool faceCulling = false;
|
||||
bool scissorTest = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Nz
|
||||
NazaraRenderStateBoolMember(blending);
|
||||
NazaraRenderStateBoolMember(colorWrite);
|
||||
NazaraRenderStateBoolMember(depthBuffer);
|
||||
NazaraRenderStateBoolMember(depthClamp);
|
||||
NazaraRenderStateBoolMember(faceCulling);
|
||||
NazaraRenderStateBoolMember(scissorTest);
|
||||
NazaraRenderStateBoolMember(stencilTest);
|
||||
@@ -95,6 +96,7 @@ namespace std
|
||||
NazaraRenderStateBool(blending);
|
||||
NazaraRenderStateBool(colorWrite);
|
||||
NazaraRenderStateBool(depthBuffer);
|
||||
NazaraRenderStateBool(depthClamp);
|
||||
NazaraRenderStateBool(faceCulling);
|
||||
NazaraRenderStateBool(scissorTest);
|
||||
NazaraRenderStateBool(stencilTest);
|
||||
|
||||
Reference in New Issue
Block a user