2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format off */
|
2017-12-04 13:41:34 +01:00
|
|
|
[vertex]
|
|
|
|
|
2018-08-24 14:50:59 +02:00
|
|
|
layout(location = 0) in highp vec4 vertex_attrib;
|
2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format on */
|
2018-08-24 14:50:59 +02:00
|
|
|
layout(location = 4) in vec2 uv_in;
|
2017-12-04 13:41:34 +01:00
|
|
|
|
|
|
|
out vec2 uv_interp;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
|
|
|
uv_interp = uv_in;
|
|
|
|
gl_Position = vertex_attrib;
|
|
|
|
}
|
|
|
|
|
2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format off */
|
2017-12-04 13:41:34 +01:00
|
|
|
[fragment]
|
|
|
|
|
|
|
|
#if !defined(GLES_OVER_GL)
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
in vec2 uv_interp;
|
2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format on */
|
2017-12-04 13:41:34 +01:00
|
|
|
uniform sampler2D source_specular; //texunit:0
|
|
|
|
uniform sampler2D source_ssr; //texunit:1
|
|
|
|
|
|
|
|
uniform vec2 pixel_size;
|
|
|
|
|
|
|
|
in vec2 uv2_interp;
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
2018-08-24 14:50:59 +02:00
|
|
|
vec4 specular = texture(source_specular, uv_interp);
|
2017-12-04 13:41:34 +01:00
|
|
|
|
|
|
|
#ifdef USE_SSR
|
2018-08-24 14:50:59 +02:00
|
|
|
vec4 ssr = textureLod(source_ssr, uv_interp, 0.0);
|
|
|
|
specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a);
|
2017-12-04 13:41:34 +01:00
|
|
|
#endif
|
|
|
|
|
2018-08-24 14:50:59 +02:00
|
|
|
frag_color = vec4(specular.rgb, 1.0);
|
2017-12-04 13:41:34 +01:00
|
|
|
}
|