Files
utad-3d/src/material.h
2025-10-14 11:45:46 +02:00

58 lines
1.0 KiB
C++

#ifndef MATERIAL_H_
#define MATERIAL_H_
#include <memory>
#include "../lib/glm/glm.hpp"
class Shader;
class Texture;
class Material {
public:
Material(const std::shared_ptr<Texture>& tex = nullptr,
const std::shared_ptr<Shader>& shader = nullptr);
~Material() = default;
[[nodiscard]] const std::shared_ptr<Shader>& shader() const;
[[nodiscard]] std::shared_ptr<Shader>& shader();
void set_shader(const std::shared_ptr<Shader>& shader);
[[nodiscard]] const std::shared_ptr<Texture>& texture() const
{
return texture_;
}
void set_texture(const std::shared_ptr<Texture>& tex)
{
texture_ = tex;
}
[[nodiscard]] const glm::vec4& color() const
{
return color_;
}
void set_color(const glm::vec4& color)
{
color_ = color;
}
[[nodiscard]] uint8_t shininess() const
{
return shininess_;
}
void set_shininess(uint8_t shininess)
{
shininess_ = shininess;
}
void prepare();
private:
std::shared_ptr<Shader> shader_;
std::shared_ptr<Texture> texture_;
glm::vec4 color_;
uint8_t shininess_;
};
#endif // MATERIAL_H_