Initial commit
This commit is contained in:
30
src/material.cpp
Normal file
30
src/material.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "material.hpp"
|
||||
|
||||
namespace Fan
|
||||
{
|
||||
|
||||
void Material::bind() const
|
||||
{
|
||||
shader->use();
|
||||
|
||||
// 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
|
||||
Reference in New Issue
Block a user