-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include "gl.h"
#include "material.h"
void Material::bind() const
{
- if(current!=this)
+ if(set_current(this))
{
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
- current = this;
}
}
void Material::unbind()
{
- current = 0;
+ set_current(0);
}
-const Material *Material::current = 0;
-
Material::Loader::Loader(Material &m):
DataFile::ObjectLoader<Material>(m)