31 lines
536 B
C++
31 lines
536 B
C++
#include "material.hpp"
|
|
|
|
namespace Fan
|
|
{
|
|
|
|
void Material::bind() const
|
|
{
|
|
shader->bind();
|
|
|
|
// Diffuse (slot 0)
|
|
if (diffuse_map) {
|
|
diffuse_map->bind(0);
|
|
} else {
|
|
Texture::unbind(0);
|
|
}
|
|
shader->set_int("u_material.diffuse", 0);
|
|
|
|
// Specular (slot 1)
|
|
if (specular_map) {
|
|
specular_map->bind(1);
|
|
} else {
|
|
Texture::unbind(1);
|
|
}
|
|
shader->set_int("u_material.specular", 1);
|
|
|
|
// Shininess
|
|
shader->set_float("u_material.shininess", shininess);
|
|
}
|
|
|
|
} // namespace Fan
|