X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpostprocessor.cpp;h=6af069e97df613c76fda5a4ed8399b88c4e69b87;hp=ffc753e4b11ed658280b647e05af688ccec0039b;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hpb=47bfbdc8cf844aa079995fca34a3b906b49a4f66 diff --git a/source/postprocessor.cpp b/source/postprocessor.cpp index ffc753e4..6af069e9 100644 --- a/source/postprocessor.cpp +++ b/source/postprocessor.cpp @@ -1,12 +1,15 @@ #include "mesh.h" #include "meshbuilder.h" #include "postprocessor.h" +#include "sampler.h" #include "shader.h" namespace Msp { namespace GL { WeakPtr PostProcessor::fullscreen_quad; +WeakPtr PostProcessor::nearest_sampler; +WeakPtr PostProcessor::linear_sampler; void PostProcessor::render(Renderer &, const Texture2D &color, const Texture2D &depth) { @@ -15,8 +18,7 @@ void PostProcessor::render(Renderer &, const Texture2D &color, const Texture2D & RefPtr PostProcessor::get_fullscreen_quad() { - RefPtr mesh; - mesh = fullscreen_quad; + RefPtr mesh = fullscreen_quad; if(!mesh) { mesh = new Mesh(VERTEX2); @@ -32,6 +34,32 @@ RefPtr PostProcessor::get_fullscreen_quad() return mesh; } +RefPtr PostProcessor::get_nearest_sampler() +{ + RefPtr sampler = nearest_sampler; + if(!sampler) + { + sampler = new Sampler; + sampler->set_filter(NEAREST); + sampler->set_wrap(CLAMP_TO_EDGE); + nearest_sampler = sampler; + } + return sampler; +} + +RefPtr PostProcessor::get_linear_sampler() +{ + RefPtr sampler = linear_sampler; + if(!sampler) + { + sampler = new Sampler; + sampler->set_filter(LINEAR); + sampler->set_wrap(CLAMP_TO_EDGE); + linear_sampler = sampler; + } + return sampler; +} + PostProcessor::Template::Template(): size_divisor(1)