From 90df17d45adfe063a2aa67cfc8e890244b501ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Tue, 13 Jul 2021 14:38:09 +0200 Subject: [PATCH] Graphics/Material(Pipeline): Remove leftovers attributes --- include/Nazara/Graphics/Material.hpp | 11 -- include/Nazara/Graphics/Material.inl | 150 ------------------- include/Nazara/Graphics/MaterialPipeline.hpp | 5 - include/Nazara/Graphics/MaterialPipeline.inl | 12 -- src/Nazara/Graphics/Material.cpp | 3 +- 5 files changed, 1 insertion(+), 180 deletions(-) diff --git a/include/Nazara/Graphics/Material.hpp b/include/Nazara/Graphics/Material.hpp index a6aa8572b..94a3c141c 100644 --- a/include/Nazara/Graphics/Material.hpp +++ b/include/Nazara/Graphics/Material.hpp @@ -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& 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; }; } diff --git a/include/Nazara/Graphics/Material.inl b/include/Nazara/Graphics/Material.inl index 021d1a987..565740531 100644 --- a/include/Nazara/Graphics/Material.inl +++ b/include/Nazara/Graphics/Material.inl @@ -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(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 * diff --git a/include/Nazara/Graphics/MaterialPipeline.hpp b/include/Nazara/Graphics/MaterialPipeline.hpp index 3922a5b98..c636b4e89 100644 --- a/include/Nazara/Graphics/MaterialPipeline.hpp +++ b/include/Nazara/Graphics/MaterialPipeline.hpp @@ -27,11 +27,6 @@ namespace Nz Nz::UInt64 enabledOptions = 0; }; - bool depthSorting = false; - bool hasVertexColor = false; - bool reflectionMapping = false; - bool shadowReceive = true; - std::vector shaders; std::shared_ptr settings; }; diff --git a/include/Nazara/Graphics/MaterialPipeline.inl b/include/Nazara/Graphics/MaterialPipeline.inl index 8677754fa..928230f9c 100644 --- a/include/Nazara/Graphics/MaterialPipeline.inl +++ b/include/Nazara/Graphics/MaterialPipeline.inl @@ -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) diff --git a/src/Nazara/Graphics/Material.cpp b/src/Nazara/Graphics/Material.cpp index 30fddbd1b..be7a01ba2 100644 --- a/src/Nazara/Graphics/Material.cpp +++ b/src/Nazara/Graphics/Material.cpp @@ -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;