SparrowRenderer/phongmaterial.cpp

22 lines
501 B
C++

#include "phongmaterial.h"
#include "texture.h"
#define TEX_ID 0
void PhongMaterial::bindAttributes()
{
shader->bindVec3(shader->getLocation("materialKd"), kd);
shader->bindVec3(shader->getLocation("materialKs"), ks);
shader->bindFloat(shader->getLocation("materialNs"), ns);
if(tex != NULL)
{
tex->bind(TEX_ID);
shader->bindInteger(shader->getLocation("baseTexture"), TEX_ID);
}
}
void PhongMaterial::setTexture(Texture* myTexture)
{
tex = myTexture;
}