X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterial.cpp;h=0359ab3f332fd41b90590d229efe0391c7c22c70;hb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;hp=eee1ebc6152057d8799db1a118fa3dcda2bfcd2c;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;p=libs%2Fgl.git diff --git a/source/material.cpp b/source/material.cpp index eee1ebc6..0359ab3f 100644 --- a/source/material.cpp +++ b/source/material.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include "gl.h" #include "material.h" @@ -46,24 +39,21 @@ void Material::set_shininess(float s) 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(m)