Renderer: Add proper support for blending
This commit is contained in:
@@ -58,7 +58,12 @@ namespace Nz
|
||||
inline void EnsurePipelineUpdate() const;
|
||||
|
||||
inline RendererComparison GetDepthCompareFunc() const;
|
||||
inline BlendFunc GetDstBlend() const;
|
||||
inline BlendEquation GetBlendAlphaModeEquation() const;
|
||||
inline BlendEquation GetBlendColorModeEquation() const;
|
||||
inline BlendFunc GetBlendDstAlphaFunc() const;
|
||||
inline BlendFunc GetBlendDstColorFunc() const;
|
||||
inline BlendFunc GetBlendSrcAlphaFunc() const;
|
||||
inline BlendFunc GetBlendSrcColorFunc() const;
|
||||
inline FaceSide GetFaceCulling() const;
|
||||
inline FaceFilling GetFaceFilling() const;
|
||||
inline float GetLineWidth() const;
|
||||
@@ -67,7 +72,6 @@ namespace Nz
|
||||
inline float GetPointSize() const;
|
||||
inline const std::shared_ptr<const MaterialSettings>& GetSettings() const;
|
||||
inline const std::shared_ptr<UberShader>& GetShader(ShaderStageType shaderStage) const;
|
||||
inline BlendFunc GetSrcBlend() const;
|
||||
inline const std::shared_ptr<Texture>& GetTexture(std::size_t textureIndex) const;
|
||||
inline const TextureSamplerInfo& GetTextureSampler(std::size_t textureIndex) const;
|
||||
inline const std::shared_ptr<AbstractBuffer>& GetUniformBuffer(std::size_t bufferIndex) const;
|
||||
@@ -91,12 +95,12 @@ namespace Nz
|
||||
inline bool IsShadowReceiveEnabled() const;
|
||||
|
||||
inline void SetDepthCompareFunc(RendererComparison depthFunc);
|
||||
inline void SetDstBlend(BlendFunc func);
|
||||
inline void SetBlendEquation(BlendEquation colorMode, BlendEquation alphaMode);
|
||||
inline void SetBlendFunc(BlendFunc srcColor, BlendFunc dstColor, BlendFunc srcAlpha, BlendFunc dstAlpha);
|
||||
inline void SetFaceCulling(FaceSide faceSide);
|
||||
inline void SetFaceFilling(FaceFilling filling);
|
||||
inline void SetLineWidth(float lineWidth);
|
||||
inline void SetPointSize(float pointSize);
|
||||
inline void SetSrcBlend(BlendFunc func);
|
||||
inline void SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture);
|
||||
inline void SetTextureSampler(std::size_t textureIndex, TextureSamplerInfo samplerInfo);
|
||||
inline void SetUniformBuffer(std::size_t bufferIndex, std::shared_ptr<AbstractBuffer> uniformBuffer);
|
||||
|
||||
@@ -336,16 +336,34 @@ namespace Nz
|
||||
return m_pipelineInfo.depthCompare;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the dst in blend
|
||||
*
|
||||
* \return Function for dst blending
|
||||
*
|
||||
* \see SetDstBlend
|
||||
*/
|
||||
inline BlendFunc Material::GetDstBlend() const
|
||||
inline BlendEquation Material::GetBlendAlphaModeEquation() const
|
||||
{
|
||||
return m_pipelineInfo.dstBlend;
|
||||
return m_pipelineInfo.blend.modeAlpha;
|
||||
}
|
||||
|
||||
inline BlendEquation Material::GetBlendColorModeEquation() const
|
||||
{
|
||||
return m_pipelineInfo.blend.modeColor;
|
||||
}
|
||||
|
||||
inline BlendFunc Material::GetBlendDstAlphaFunc() const
|
||||
{
|
||||
return m_pipelineInfo.blend.dstAlpha;
|
||||
}
|
||||
|
||||
inline BlendFunc Material::GetBlendDstColorFunc() const
|
||||
{
|
||||
return m_pipelineInfo.blend.dstColor;
|
||||
}
|
||||
|
||||
inline BlendFunc Material::GetBlendSrcAlphaFunc() const
|
||||
{
|
||||
return m_pipelineInfo.blend.srcAlpha;
|
||||
}
|
||||
|
||||
inline BlendFunc Material::GetBlendSrcColorFunc() const
|
||||
{
|
||||
return m_pipelineInfo.blend.srcColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -421,15 +439,6 @@ namespace Nz
|
||||
return m_pipelineInfo.shaders[UnderlyingCast(shaderStage)].uberShader;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the src in blend
|
||||
* \return Function for src blending
|
||||
*/
|
||||
inline BlendFunc Material::GetSrcBlend() const
|
||||
{
|
||||
return m_pipelineInfo.srcBlend;
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<Texture>& Material::GetTexture(std::size_t textureIndex) const
|
||||
{
|
||||
NazaraAssert(textureIndex < m_textures.size(), "Invalid texture index");
|
||||
@@ -596,16 +605,20 @@ namespace Nz
|
||||
InvalidatePipeline();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the dst in blend
|
||||
*
|
||||
* \param func Function for dst blending
|
||||
*
|
||||
* \remark Invalidates the pipeline
|
||||
*/
|
||||
inline void Material::SetDstBlend(BlendFunc func)
|
||||
inline void Material::SetBlendEquation(BlendEquation colorMode, BlendEquation alphaMode)
|
||||
{
|
||||
m_pipelineInfo.dstBlend = func;
|
||||
m_pipelineInfo.blend.modeAlpha = alphaMode;
|
||||
m_pipelineInfo.blend.modeColor = colorMode;
|
||||
|
||||
InvalidatePipeline();
|
||||
}
|
||||
|
||||
inline void Material::SetBlendFunc(BlendFunc srcColor, BlendFunc dstColor, BlendFunc srcAlpha, BlendFunc dstAlpha)
|
||||
{
|
||||
m_pipelineInfo.blend.dstAlpha = dstAlpha;
|
||||
m_pipelineInfo.blend.dstColor = dstColor;
|
||||
m_pipelineInfo.blend.srcAlpha = srcAlpha;
|
||||
m_pipelineInfo.blend.srcColor = srcColor;
|
||||
|
||||
InvalidatePipeline();
|
||||
}
|
||||
@@ -674,22 +687,6 @@ namespace Nz
|
||||
InvalidatePipeline();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the src in blend
|
||||
*
|
||||
* \param func Function for src blending
|
||||
*
|
||||
* \remark Invalidates the pipeline
|
||||
*
|
||||
* \see GetSrcBlend
|
||||
*/
|
||||
inline void Material::SetSrcBlend(BlendFunc func)
|
||||
{
|
||||
m_pipelineInfo.srcBlend = func;
|
||||
|
||||
InvalidatePipeline();
|
||||
}
|
||||
|
||||
inline void Material::SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture)
|
||||
{
|
||||
NazaraAssert(textureIndex < m_textures.size(), "Invalid texture index");
|
||||
|
||||
Reference in New Issue
Block a user