From 48d5a2f591b2c58599948d59062688d8e3990d1d Mon Sep 17 00:00:00 2001 From: milek7 Date: Thu, 18 Oct 2018 20:42:00 +0200 Subject: [PATCH] add missing shaders --- shaders/celestial.frag | 25 +++++++++++++++++++++++++ shaders/celestial.vert | 28 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 shaders/celestial.frag create mode 100644 shaders/celestial.vert diff --git a/shaders/celestial.frag b/shaders/celestial.frag new file mode 100644 index 00000000..7ef0756f --- /dev/null +++ b/shaders/celestial.frag @@ -0,0 +1,25 @@ +in vec2 f_coord; + +#texture (tex1, 0, sRGB_A) +uniform sampler2D tex1; + +#include +#include + +layout(location = 0) out vec4 out_color; +#if MOTIONBLUR_ENABLED +layout(location = 1) out vec4 out_motion; +#endif + +void main() +{ + vec4 tex_color = texture(tex1, f_coord); +#if POSTFX_ENABLED + out_color = tex_color * param[0]; +#else + out_color = tonemap(tex_color * param[0]); +#endif +#if MOTIONBLUR_ENABLED + out_motion = vec4(0.0f); +#endif +} diff --git a/shaders/celestial.vert b/shaders/celestial.vert new file mode 100644 index 00000000..168ba49f --- /dev/null +++ b/shaders/celestial.vert @@ -0,0 +1,28 @@ +const vec2 vert[4] = vec2[] +( + vec2(-1.0, 1.0), + vec2(-1.0, -1.0), + vec2( 1.0, 1.0), + vec2( 1.0, -1.0) +); + +out vec2 f_coord; + +#include + +void main() +{ + gl_Position = projection * (vec4(param[1].xyz, 1.0) + vec4(vert[gl_VertexID] * param[1].w, 0.0, 0.0)); + + vec2 coord = param[2].xy; + float size = param[2].z; + + if (gl_VertexID == 0) + f_coord = vec2(coord.x, coord.y); + if (gl_VertexID == 1) + f_coord = vec2(coord.x, coord.y - size); + if (gl_VertexID == 2) + f_coord = vec2(coord.x + size, coord.y); + if (gl_VertexID == 3) + f_coord = vec2(coord.x + size, coord.y - size); +}