Graphics/Material(Pipeline): Remove leftovers attributes

This commit is contained in:
Jérôme Leclercq 2021-07-13 14:38:09 +02:00
parent 46dfa503eb
commit 90df17d45a
5 changed files with 1 additions and 180 deletions

View File

@ -43,16 +43,11 @@ namespace Nz
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);
inline void EnableOption(std::size_t optionIndex, bool enable);
inline void EnableReflectionMapping(bool reflection);
inline void EnableScissorTest(bool scissorTest);
inline void EnableShadowCasting(bool castShadows);
inline void EnableShadowReceive(bool receiveShadows);
inline void EnableStencilTest(bool stencilTest);
inline void EnableVertexColor(bool vertexColor);
inline void EnsurePipelineUpdate() const;
@ -80,21 +75,16 @@ namespace Nz
inline std::vector<UInt8>& GetUniformBufferData(std::size_t bufferIndex);
inline bool HasTexture(std::size_t textureIndex) const;
inline bool HasVertexColor() const;
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;
inline bool IsOptionEnabled(std::size_t optionIndex) const;
inline bool IsReflectionMappingEnabled() const;
inline bool IsScissorTestEnabled() const;
inline bool IsStencilTestEnabled() const;
inline bool IsShadowCastingEnabled() const;
inline bool IsShadowReceiveEnabled() const;
inline void SetDepthCompareFunc(RendererComparison depthFunc);
inline void SetBlendEquation(BlendEquation colorMode, BlendEquation alphaMode);
@ -145,7 +135,6 @@ namespace Nz
ShaderBindingPtr m_shaderBinding;
mutable bool m_pipelineUpdated;
bool m_shaderBindingUpdated;
bool m_shadowCastingEnabled;
};
}

View File

@ -137,26 +137,6 @@ namespace Nz
InvalidatePipeline();
}
/*!
* \brief Enable/Disable depth sorting for this material
*
* When enabled, all objects using this material will be rendered far from near
* This is useful with translucent objects, but will reduces performance as it breaks batching
*
* \param depthSorting Defines if this material will use depth sorting
*
* \remark Depth sorting may not be perfect (may be object-sorting instead of triangle-sorting)
* \remark Invalidates the pipeline
*
* \see IsDepthSortingEnabled
*/
inline void Material::EnableDepthSorting(bool depthSorting)
{
m_pipelineInfo.depthSorting = depthSorting;
InvalidatePipeline();
}
/*!
* \brief Enable/Disable depth writing for this material
*
@ -211,31 +191,6 @@ namespace Nz
}
}
/*!
* \brief Enable/Disable reflection mapping for this material
*
* When enabled, the material will render reflections from the object environment according to the reflection mode.
* Whether or not this is expensive depends of the reflection mode and size.
*
* Please note this is only a hint for the render technique, and reflections can be forcefully enabled or disabled depending on the material shader.
*
* Use SetReflectionMode and SetReflectionSize to control reflection quality.
*
* \param reflection Defines if this material should use reflection mapping
*
* \remark May invalidates the pipeline
*
* \see IsReflectionMappingEnabled
* \see SetReflectionMode
* \see SetReflectionSize
*/
inline void Material::EnableReflectionMapping(bool reflection)
{
m_pipelineInfo.reflectionMapping = reflection;
InvalidatePipeline();
}
/*!
* \brief Enable/Disable scissor test for this material
*
@ -255,45 +210,6 @@ namespace Nz
InvalidatePipeline();
}
/*!
* \brief Enable/Disable shadow casting for this material
*
* When enabled, all objects using this material will be allowed to cast shadows upon any objects using a material with shadow receiving enabled.
* The depth material replaces this one when rendering shadows.
*
* \param castShadows Defines if this material will be allowed to cast shadows
*
* \remark Does not invalidate the pipeline
*
* \see EnableShadowReceive
* \see IsShadowCastingEnabled
* \see SetDepthMaterial
*/
inline void Material::EnableShadowCasting(bool castShadows)
{
// Has no influence on pipeline
m_shadowCastingEnabled = castShadows;
}
/*!
* \brief Enable/Disable shadow receiving for this material
*
* When enabled, all objects using this material will be allowed to be casted shadows upon themselves
* Disabling this can be helpful to prevent some rendering artifacts (especially with translucent objects)
*
* \param receiveShadows Defines if this material will be able to receive shadows
*
* \remark Invalidates the pipeline
*
* \see IsShadowReceiveEnabled
*/
inline void Material::EnableShadowReceive(bool receiveShadows)
{
m_pipelineInfo.shadowReceive = receiveShadows;
InvalidatePipeline();
}
/*!
* \brief Enable/Disable stencil test for this material
*
@ -312,25 +228,6 @@ namespace Nz
InvalidatePipeline();
}
/*!
* \brief Enable/Disable vertex coloring on this material
*
* This is a temporary option, until the new material pipeline system is ready, allowing to enable vertex coloring.
* This option only works with meshes using vertex colors.
*
* \param vertexColor Defines if this material will use vertex color or not
*
* \remark Invalidates the pipeline
*
* \see HasVertexColor
*/
inline void Material::EnableVertexColor(bool vertexColor)
{
m_pipelineInfo.hasVertexColor = vertexColor;
InvalidatePipeline();
}
/*!
* \brief Ensures the pipeline gets updated
*
@ -510,15 +407,6 @@ namespace Nz
return GetTexture(textureIndex) != nullptr;
}
/*!
* \brief Checks whether this material uses vertex coloring
* \return true If it is the case
*/
inline bool Material::HasVertexColor() const
{
return m_pipelineInfo.hasVertexColor;
}
/*!
* \brief Checks whether this material has blending enabled
* \return true If it is the case
@ -555,15 +443,6 @@ namespace Nz
return m_pipelineInfo.depthClamp;
}
/*!
* \brief Checks whether this material has depth sorting enabled
* \return true If it is the case
*/
inline bool Material::IsDepthSortingEnabled() const
{
return m_pipelineInfo.depthSorting;
}
/*!
* \brief Checks whether this material has depth writing enabled
* \return true If it is the case
@ -587,17 +466,6 @@ namespace Nz
return TestBit<UInt64>(m_enabledOptions, optionIndex);
}
/*!
* \brief Checks whether this material has reflection mapping enabled
* \return true If it is the case
*
* \see EnableReflectionMapping
*/
inline bool Material::IsReflectionMappingEnabled() const
{
return m_pipelineInfo.reflectionMapping;
}
/*!
* \brief Checks whether this material has scissor test enabled
* \return true If it is the case
@ -616,24 +484,6 @@ namespace Nz
return m_pipelineInfo.stencilTest;
}
/*!
* \brief Checks whether this material cast shadow
* \return true If it is the case
*/
inline bool Material::IsShadowCastingEnabled() const
{
return m_shadowCastingEnabled;
}
/*!
* \brief Checks whether this material receive shadow
* \return true If it is the case
*/
inline bool Material::IsShadowReceiveEnabled() const
{
return m_pipelineInfo.shadowReceive;
}
/*!
* \brief Sets the depth functor
*

View File

@ -27,11 +27,6 @@ namespace Nz
Nz::UInt64 enabledOptions = 0;
};
bool depthSorting = false;
bool hasVertexColor = false;
bool reflectionMapping = false;
bool shadowReceive = true;
std::vector<Shader> shaders;
std::shared_ptr<const MaterialSettings> settings;
};

View File

@ -29,12 +29,6 @@ namespace Nz
return false;
#define NazaraPipelineMember(field) if (lhs.field != rhs.field) return false
#define NazaraPipelineBoolMember NazaraPipelineMember
NazaraPipelineBoolMember(depthSorting);
NazaraPipelineBoolMember(hasVertexColor);
NazaraPipelineBoolMember(reflectionMapping);
NazaraPipelineBoolMember(shadowReceive);
NazaraPipelineMember(settings);
@ -48,7 +42,6 @@ namespace Nz
}
#undef NazaraPipelineMember
#undef NazaraPipelineBoolMember
return true;
}
@ -76,11 +69,6 @@ namespace std
#define NazaraPipelineMember(member) Nz::HashCombine(seed, pipelineInfo.member)
#define NazaraPipelineBoolMember(member) parameterHash |= ((pipelineInfo.member) ? 1U : 0U) << (parameterIndex++)
NazaraPipelineBoolMember(depthSorting);
NazaraPipelineBoolMember(hasVertexColor);
NazaraPipelineBoolMember(reflectionMapping);
NazaraPipelineBoolMember(shadowReceive);
NazaraPipelineMember(settings.get()); //< Hash pointer
for (const auto& shader : pipelineInfo.shaders)

View File

@ -30,8 +30,7 @@ namespace Nz
m_settings(std::move(settings)),
m_enabledOptions(0),
m_pipelineUpdated(false),
m_shaderBindingUpdated(false),
m_shadowCastingEnabled(true)
m_shaderBindingUpdated(false)
{
m_pipelineInfo.settings = m_settings;