From: Mikko Rasa Date: Wed, 12 Jun 2019 18:59:25 +0000 (+0300) Subject: Load FadeOverlay's shader from builtin resources X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b8e89ca72ec17461c6d91bf107a7e4b08cf9eff1;p=libs%2Fdemoscene.git Load FadeOverlay's shader from builtin resources --- diff --git a/data/fade.glsl b/data/fade.glsl new file mode 100644 index 0000000..4680ef0 --- /dev/null +++ b/data/fade.glsl @@ -0,0 +1,10 @@ +import postprocess; + +uniform vec4 color; + +#pragma MSP stage(fragment) +void main() +{ + vec4 tex_sample = texture(source, texcoord); + frag_color = mix(tex_sample, color, color.a); +} diff --git a/source/fadeoverlay.cpp b/source/fadeoverlay.cpp index ee7ca7f..e54ccf9 100644 --- a/source/fadeoverlay.cpp +++ b/source/fadeoverlay.cpp @@ -3,15 +3,16 @@ #include #include "demo.h" #include "fadeoverlay.h" +#include "resources.h" using namespace std; namespace Msp { namespace DemoScene { -FadeOverlay::FadeOverlay(DataFile::Collection &resources): +FadeOverlay::FadeOverlay(): mesh(get_fullscreen_quad()), - shprog(resources.get("fade.glsl")), + shprog(Resources::get_builtins().get("fade.glsl")), color(0.0f, 0.0f, 0.0f, 0.0f) { shdata.uniform("color", color); diff --git a/source/fadeoverlay.h b/source/fadeoverlay.h index a0b365b..2989716 100644 --- a/source/fadeoverlay.h +++ b/source/fadeoverlay.h @@ -48,7 +48,7 @@ private: Msp::GL::Color color; public: - FadeOverlay(Msp::DataFile::Collection &); + FadeOverlay(); void set_color(const Msp::GL::Color &);