16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 14:49:19 +02:00

GLES support

This commit is contained in:
milek7
2018-10-16 20:32:45 +02:00
parent f8857158ce
commit d16d96f2b2
77 changed files with 5601 additions and 26893 deletions

View File

@@ -1,5 +1,3 @@
#version 330
in vec2 f_coord;
#texture (tex1, 0, sRGB_A)

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
@@ -9,15 +7,20 @@ uniform sampler2D tex1;
#include <common>
#include <tonemapping.glsl>
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
gl_FragData[0] = tex_color * param[0];
out_color = tex_color * param[0];
#else
gl_FragData[0] = tonemap(tex_color * param[0]);
out_color = tonemap(tex_color * param[0]);
#endif
#if MOTIONBLUR_ENABLED
gl_FragData[1] = vec4(0.0f);
out_motion = vec4(0.0f);
#endif
}

View File

@@ -1,18 +1,21 @@
#version 330
in vec3 f_color;
#include <common>
#include <tonemapping.glsl>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
void main()
{
#if POSTFX_ENABLED
gl_FragData[0] = vec4(f_color, 1.0f);
out_color = vec4(f_color, 1.0f);
#else
gl_FragData[0] = tonemap(vec4(f_color, 1.0f));
out_color = tonemap(vec4(f_color, 1.0f));
#endif
#if MOTIONBLUR_ENABLED
gl_FragData[1] = vec4(0.0f);
out_motion = vec4(0.0f);
#endif
}

View File

@@ -1,11 +1,14 @@
#version 330
#include <common>
#include <tonemapping.glsl>
in vec4 f_clip_pos;
in vec4 f_clip_future_pos;
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
void main()
{
float x = (gl_PointCoord.x - 0.5f) * 2.0f;
@@ -15,16 +18,16 @@ void main()
discard;
vec4 color = vec4(param[0].rgb * emission, mix(param[0].a, 0.0f, dist * 2.0f));
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, 0.0f);
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 1) in vec3 v_normal;
layout(location = 2) in vec2 v_coord;
@@ -15,4 +13,5 @@ void main()
f_clip_future_pos = (projection * future * modelview) * vec4(v_vert, 1.0f);
gl_Position = f_clip_pos;
gl_PointSize = param[1].x;
}

View File

@@ -11,7 +11,7 @@ float calc_shadow()
//sampler PCF + PCF
float shadow = 0.0;
vec2 texel = 1.0 / textureSize(shadowmap, 0);
vec2 texel = vec2(1.0) / vec2(textureSize(shadowmap, 0));
for (float y = -1.5; y <= 1.5; y += 1.0)
for (float x = -1.5; x <= 1.5; x += 1.0)
shadow += texture(shadowmap, coords.xyz + vec3(vec2(x, y) * texel, 0.0));

View File

@@ -1,8 +1,8 @@
#version 330
#include <common>
layout(location = 0) out vec4 out_color;
void main()
{
gl_FragData[0] = vec4(1.0f);
out_color = vec4(1.0f);
}

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
#include <common>

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
@@ -10,15 +8,20 @@ uniform sampler2D tex1;
#include <common>
#include <tonemapping.glsl>
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
gl_FragData[0] = tex_color * param[0];
out_color = tex_color * param[0];
#else
gl_FragData[0] = tonemap(tex_color * param[0]);
out_color = tonemap(tex_color * param[0]);
#endif
#if MOTIONBLUR_ENABLED
gl_FragData[1] = vec4(0.0f);
out_motion = vec4(0.0f);
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
@@ -26,6 +24,11 @@ uniform samplerCube envmap;
#include <light_common.glsl>
#include <tonemapping.glsl>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
void main()
{
vec4 tex_color = vec4(pow(param[0].rgb, vec3(2.2)), param[0].a);
@@ -64,16 +67,16 @@ void main()
vec4 color = vec4(apply_fog(result * tex_color.rgb), tex_color.a * alpha_mult);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, 0.0f);
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
@@ -26,6 +24,11 @@ uniform sampler2DShadow shadowmap;
uniform samplerCube envmap;
#endif
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
#include <light_common.glsl>
#include <tonemapping.glsl>
@@ -70,9 +73,9 @@ void main()
vec4 color = vec4(apply_fog(result * tex_color.rgb), tex_color.a * alpha_mult);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
@@ -80,7 +83,7 @@ void main()
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, tex_color.a * alpha_mult);
out_motion = vec4(a - b, 0.0f, tex_color.a * alpha_mult);
}
#endif
}

View File

@@ -1,17 +1,20 @@
#version 330
#include <common>
#include <tonemapping.glsl>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
void main()
{
vec4 color = vec4(1.0, 0.0, 1.0, 1.0);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
gl_FragData[1] = vec4(0.0f);
out_motion = vec4(0.0f);
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
@@ -11,6 +9,11 @@ in vec4 f_clip_future_pos;
#include <common>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
#param (color, 0, 0, 4, diffuse)
#param (diffuse, 1, 0, 1, diffuse)
#param (specular, 1, 1, 1, specular)
@@ -75,16 +78,16 @@ void main()
vec4 color = vec4(apply_fog(result * tex_color.rgb), tex_color.a * alpha_mult);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, 0.0f);
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
in vec3 f_normal;
in vec2 f_coord;
in vec4 f_pos;
@@ -10,6 +8,11 @@ in vec4 f_clip_future_pos;
#include <common>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
#param (color, 0, 0, 4, diffuse)
#param (diffuse, 1, 0, 1, diffuse)
#param (specular, 1, 1, 1, specular)
@@ -73,16 +76,16 @@ void main()
vec4 color = vec4(apply_fog(result * tex_color.rgb), tex_color.a * alpha_mult);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, 0.0f);
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}

View File

@@ -1,10 +1,13 @@
#version 330
#include <common>
#include <tonemapping.glsl>
flat in vec3 f_normal_raw;
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
void main()
{
float x = (gl_PointCoord.x - 0.5f) * 2.0f;
@@ -16,11 +19,11 @@ void main()
// color data space is shared with normals, ugh
vec4 color = vec4(pow(f_normal_raw.bgr, vec3(2.2)), 1.0f);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
gl_FragData[1] = vec4(0.0f);
out_motion = vec4(0.0f);
#endif
}

View File

@@ -1,8 +1,8 @@
#version 330
#include <common>
layout(location = 0) out vec4 out_color;
void main()
{
gl_FragColor = vec4(param[0].rgb, 1.0);
out_color = vec4(param[0].rgb, 1.0);
}

View File

@@ -1,6 +1,5 @@
#version 330 core
in vec2 f_coords;
layout(location = 0) out vec4 out_color;
#texture (color_tex, 0, RGB)
uniform sampler2D color_tex;
@@ -26,5 +25,5 @@ void main()
}
oResult /= float(nSamples);
gl_FragData[0] = oResult;
out_color = oResult;
}

View File

@@ -1,8 +1,7 @@
#version 330 core
out vec4 FragColor;
in vec2 f_coords;
layout(location = 0) out vec4 out_color;
#texture (tex1, 0, RGB)
uniform sampler2D tex1;
@@ -14,5 +13,5 @@ void main()
vec3 hdr_color = texture(tex1, texcoord).xyz;
vec3 mapped = tonemap(hdr_color);
gl_FragColor = vec4(mapped, 1.0);
out_color = vec4(mapped, 1.0);
}

View File

@@ -1,5 +1,3 @@
#version 330
in vec2 f_coord;
#texture (tex1, 0, sRGB_A)
@@ -7,6 +5,11 @@ uniform sampler2D tex1;
#include <common>
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
in vec4 f_clip_pos;
in vec4 f_clip_future_pos;
@@ -17,16 +20,16 @@ void main()
vec4 tex_color = texture(tex1, vec2(f_coord.x, f_coord.y + param[1].x));
vec4 color = tex_color * param[0];
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
{
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;
gl_FragData[1] = vec4(a - b, 0.0f, tex_color.a * alpha_mult);
out_motion = vec4(a - b, 0.0f, tex_color.a * alpha_mult);
}
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 1) in vec2 v_coord;

View File

@@ -1,5 +1,3 @@
#version 330 core
const vec2 vert[4] = vec2[]
(
vec2(-1.0, 1.0),

View File

@@ -1,5 +1,3 @@
#version 330
in vec2 f_coord;
void main()

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 2) in vec2 v_coord;

View File

@@ -1,19 +1,22 @@
#version 330
#include <common>
in vec4 f_clip_pos;
in vec4 f_clip_future_pos;
layout(location = 0) out vec4 out_color;
#if MOTIONBLUR_ENABLED
layout(location = 1) out vec4 out_motion;
#endif
#include <tonemapping.glsl>
void main()
{
vec4 color = vec4(pow(param[0].rgb, vec3(2.2)), param[0].a);
#if POSTFX_ENABLED
gl_FragData[0] = color;
out_color = color;
#else
gl_FragData[0] = tonemap(color);
out_color = tonemap(color);
#endif
#if MOTIONBLUR_ENABLED
@@ -21,7 +24,7 @@ void main()
vec2 a = (f_clip_future_pos.xy / f_clip_future_pos.w) * 0.5 + 0.5;;
vec2 b = (f_clip_pos.xy / f_clip_pos.w) * 0.5 + 0.5;;
gl_FragData[1] = vec4(a - b, 0.0f, 0.0f);
out_motion = vec4(a - b, 0.0f, 0.0f);
}
#endif
}

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 1) in vec3 v_normal;
layout(location = 2) in vec2 v_coord;

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 1) in vec3 v_color;

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
layout(location = 1) in vec3 v_normal;
layout(location = 2) in vec2 v_coord;
@@ -31,6 +29,7 @@ void main()
f_clip_future_pos = (projection * future * modelview) * vec4(v_vert, 1.0f);
gl_Position = f_clip_pos;
gl_PointSize = param[1].x;
vec3 T = normalize(modelviewnormal * v_tangent.xyz);
vec3 B = normalize(modelviewnormal * cross(v_normal, v_tangent.xyz) * v_tangent.w);

View File

@@ -1,5 +1,3 @@
#version 330
layout(location = 0) in vec3 v_vert;
#include <common>