X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftests.cpp;h=8e24bb52facc436a0a75451a57726737a574bb22;hp=f8489ede9cfee6787520265d1bc5e1b5cc655a4a;hb=HEAD;hpb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8 diff --git a/source/tests.cpp b/source/tests.cpp deleted file mode 100644 index f8489ede..00000000 --- a/source/tests.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "tests.h" - -namespace Msp { -namespace GL { - -AlphaTest::AlphaTest(): - pred(ALWAYS), - ref(0) -{ } - -AlphaTest::AlphaTest(Predicate p, float r): - pred(p), - ref(r) -{ } - -void AlphaTest::bind() const -{ - if(set_current(this)) - { - glEnable(GL_ALPHA_TEST); - glAlphaFunc(pred, ref); - } -} - -void AlphaTest::unbind() -{ - if(set_current(0)) - glDisable(GL_ALPHA_TEST); -} - - -DepthTest::DepthTest(): - write(true), - pred(LESS) -{ } - -DepthTest::DepthTest(Predicate p, bool w): - write(w), - pred(p) -{ } - -void DepthTest::bind() const -{ - if(set_current(this)) - { - glEnable(GL_DEPTH_TEST); - glDepthFunc(pred); - glDepthMask(write); - } -} - -const DepthTest &DepthTest::lequal() -{ - static DepthTest test(LEQUAL); - return test; -} - -void DepthTest::unbind() -{ - if(set_current(0)) - { - glDisable(GL_DEPTH_TEST); - // Allow glClear(GL_DEPTH_BUFFER_BIT) to work - glDepthMask(true); - } -} - - -ScissorTest::ScissorTest(): - left(0), - bottom(0), - width(1), - height(1) -{ } - -ScissorTest::ScissorTest(int l, int b, unsigned w, unsigned h): - left(l), - bottom(b), - width(w), - height(h) -{ } - -void ScissorTest::bind() const -{ - if(set_current(this)) - { - glEnable(GL_SCISSOR_TEST); - glScissor(left, bottom, width, height); - } -} - -void ScissorTest::unbind() -{ - if(set_current(0)) - glDisable(GL_SCISSOR_TEST); -} - -} // namespace GL -} // namespace Msp