// Copyright (C) 2017 Jérôme Leclercq // This file is part of the "Nazara Engine - Graphics module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_PHONG_LIGHTING_MATERIAL_HPP #define NAZARA_PHONG_LIGHTING_MATERIAL_HPP #include #include namespace Nz { class NAZARA_GRAPHICS_API PhongLightingMaterial { friend class MaterialPipeline; public: PhongLightingMaterial(Material& material); inline const std::shared_ptr& GetAlphaMap() const; float GetAlphaThreshold() const; Color GetAmbientColor() const; Color GetDiffuseColor() const; inline const std::shared_ptr& GetDiffuseMap() const; inline TextureSampler& GetDiffuseSampler(); inline const TextureSampler& GetDiffuseSampler() const; inline const std::shared_ptr& GetEmissiveMap() const; inline const std::shared_ptr& GetHeightMap() const; inline const std::shared_ptr& GetNormalMap() const; float GetShininess() const; Color GetSpecularColor() const; inline const std::shared_ptr& GetSpecularMap() const; inline TextureSampler& GetSpecularSampler(); inline const TextureSampler& GetSpecularSampler() const; inline bool HasAlphaMap() const; inline bool HasAlphaThreshold() const; inline bool HasAmbientColor() const; inline bool HasDiffuseColor() const; inline bool HasDiffuseMap() const; inline bool HasEmissiveMap() const; inline bool HasHeightMap() const; inline bool HasNormalMap() const; inline bool HasShininess() const; inline bool HasSpecularColor() const; inline bool HasSpecularMap() const; inline void SetAlphaMap(std::shared_ptr alphaMap); void SetAlphaThreshold(float alphaThreshold); void SetAmbientColor(const Color& ambient); void SetDiffuseColor(const Color& diffuse); inline void SetDiffuseMap(std::shared_ptr diffuseMap); inline void SetDiffuseSampler(const TextureSampler& sampler); inline void SetEmissiveMap(std::shared_ptr textureName); inline void SetHeightMap(std::shared_ptr textureName); inline void SetNormalMap(std::shared_ptr textureName); void SetShininess(float shininess); void SetSpecularColor(const Color& specular); inline void SetSpecularMap(std::shared_ptr specularMap); inline void SetSpecularSampler(const TextureSampler& sampler); static const std::shared_ptr& GetSettings(); private: struct PhongUniformOffsets { std::size_t alphaThreshold; std::size_t shininess; std::size_t ambientColor; std::size_t diffuseColor; std::size_t specularColor; }; struct TextureIndexes { std::size_t alpha; std::size_t diffuse; std::size_t emissive; std::size_t height; std::size_t normal; std::size_t specular; }; static bool Initialize(); static void Uninitialize(); Material& m_material; std::size_t m_phongUniformIndex; TextureIndexes m_textureIndexes; PhongUniformOffsets m_phongUniformOffsets; static std::shared_ptr s_materialSettings; static std::size_t s_phongUniformBlockIndex; static TextureIndexes s_textureIndexes; static PhongUniformOffsets s_phongUniformOffsets; }; } #include #endif // NAZARA_PHONG_LIGHTING_MATERIAL_HPP