//
// Created by sebastian on 30.07.26.
//

#ifndef COLORRACE_MATERIAL_H
#define COLORRACE_MATERIAL_H
#include <array>
#include <memory>

#include "loader/assets/AssetTypes.h"
#include "loader/textures/Texture2D.h"


namespace engine {

    class Material {
    public:
        Material() = default;
        Material(std::array<std::shared_ptr<Texture2D>, static_cast<size_t>(TextureType::Count)> textures,
                  float shininess, float opacity)
            : m_textures(std::move(textures)), m_shininess(shininess), m_opacity(opacity) {}

        void bind() const {
            for (size_t i = 0; i < m_textures.size(); ++i) {
                if (m_textures[i]) m_textures[i]->bind(static_cast<unsigned int>(i));
            }
        }

        [[nodiscard]] float getShininess() const { return m_shininess; }
        [[nodiscard]] float getOpacity() const { return m_opacity; }

    private:
        std::array<std::shared_ptr<Texture2D>, static_cast<size_t>(TextureType::Count)> m_textures;
        float m_shininess = 1.0f;
        float m_opacity = 1.0f;
    };

}


#endif //COLORRACE_MATERIAL_H
