X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpostprocessor.cpp;fp=source%2Fpostprocessor.cpp;h=6af069e97df613c76fda5a4ed8399b88c4e69b87;hb=860aec7bfaabbad139d27dd7f4738984276e6676;hp=ffc753e4b11ed658280b647e05af688ccec0039b;hpb=917db342def84f9ce925df3cb27043b92ef2bfda;p=libs%2Fgl.git 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)