]> git.tdb.fi Git - libs/demoscene.git/commitdiff
Load FadeOverlay's shader from builtin resources
authorMikko Rasa <tdb@tdb.fi>
Wed, 12 Jun 2019 18:59:25 +0000 (21:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 12 Jun 2019 18:59:25 +0000 (21:59 +0300)
data/fade.glsl [new file with mode: 0644]
source/fadeoverlay.cpp
source/fadeoverlay.h

diff --git a/data/fade.glsl b/data/fade.glsl
new file mode 100644 (file)
index 0000000..4680ef0
--- /dev/null
@@ -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);
+}
index ee7ca7f3c3e8ed65e0821cf4121257cea25e52bb..e54ccf9f96d64a5282f9fa2154d220453bdf8cc1 100644 (file)
@@ -3,15 +3,16 @@
 #include <msp/gl/texture2d.h>
 #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<GL::Program>("fade.glsl")),
+       shprog(Resources::get_builtins().get<GL::Program>("fade.glsl")),
        color(0.0f, 0.0f, 0.0f, 0.0f)
 {
        shdata.uniform("color", color);
index a0b365b6c698c3a4477c1bb5162635fd1e7418be..29897165427efc276bb1987cc38c6a014c9be634 100644 (file)
@@ -48,7 +48,7 @@ private:
        Msp::GL::Color color;
 
 public:
-       FadeOverlay(Msp::DataFile::Collection &);
+       FadeOverlay();
 
        void set_color(const Msp::GL::Color &);