Objects that wrap always-on state should restore default states when
unbound.
Enable/disable of otherwise global state should be exposed through
binding, not a flag in an object.
}
}
-void Material::unbind()
-{
- set_current(0);
-}
-
Material::Loader::Loader(Material &m):
DataFile::ObjectLoader<Material>(m)
Stores OpenGL material properties. Since OpenGL does not support material
objects, application of material is done with several calls to glMaterial.
*/
-class Material: public Bindable<Material>
+class Material: public BindableWithDefault<Material>
{
public:
class Loader: public DataFile::ObjectLoader<Material>
const Color &get_emission() const { return emission; }
float get_shininess() const { return shininess; }
void bind() const;
-
- static void unbind();
};
} // namespace GL
}
WindingTest::WindingTest():
- test(false),
winding(COUNTERCLOCKWISE)
{ }
WindingTest::WindingTest(FaceWinding w):
- test(true),
winding(w)
{ }
{
if(set_current(this))
{
- if(test)
- {
- glEnable(GL_CULL_FACE);
- glFrontFace(winding);
- }
- else
- glDisable(GL_CULL_FACE);
+ glEnable(GL_CULL_FACE);
+ glFrontFace(winding);
}
}
const WindingTest &WindingTest::get_reverse() const
{
- if(!test)
- return *this;
- else if(winding==CLOCKWISE)
+ if(winding==CLOCKWISE)
return counterclockwise();
else
return clockwise();
class WindingTest: public Bindable<WindingTest>
{
private:
- bool test;
FaceWinding winding;
public: