Graphics/Material: Add PrimitiveMode support

This commit is contained in:
Jérôme Leclercq 2021-06-20 13:42:00 +02:00
parent d6248a061d
commit e073e1a44d
2 changed files with 15 additions and 0 deletions

View File

@ -68,6 +68,7 @@ namespace Nz
inline const std::shared_ptr<MaterialPipeline>& GetPipeline() const;
inline const MaterialPipelineInfo& GetPipelineInfo() const;
inline float GetPointSize() const;
inline PrimitiveMode GetPrimitiveMode() const;
inline const std::shared_ptr<const MaterialSettings>& GetSettings() const;
inline const std::shared_ptr<UberShader>& GetShader(ShaderStageType shaderStage) const;
inline ShaderBinding& GetShaderBinding();
@ -100,6 +101,7 @@ namespace Nz
inline void SetFaceFilling(FaceFilling filling);
inline void SetLineWidth(float lineWidth);
inline void SetPointSize(float pointSize);
inline void SetPrimitiveMode(PrimitiveMode mode);
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);

View File

@ -425,6 +425,11 @@ namespace Nz
return m_pipelineInfo.pointSize;
}
inline PrimitiveMode Material::GetPrimitiveMode() const
{
return m_pipelineInfo.primitiveMode;
}
inline const std::shared_ptr<const MaterialSettings>& Material::GetSettings() const
{
return m_settings;
@ -693,6 +698,14 @@ namespace Nz
InvalidatePipeline();
}
inline void Material::SetPrimitiveMode(PrimitiveMode mode)
{
m_pipelineInfo.primitiveMode = mode;
InvalidatePipeline();
}
inline void Material::SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture)
{
NazaraAssert(textureIndex < m_textures.size(), "Invalid texture index");