moved essential resources out of the assets directory and into the jar

This commit is contained in:
minjaesong
2022-01-28 10:30:08 +09:00
parent e3b82ae5b6
commit 956c9d44e1
61 changed files with 72 additions and 142 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

View File

@@ -1,14 +0,0 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
vec4 color = texture2D(u_texture, v_texCoords).rgba;
color.r = floor(15.0 * color.r + 0.5) / 15.0;
color.g = floor(15.0 * color.g + 0.5) / 15.0;
color.b = floor(15.0 * color.b + 0.5) / 15.0;
// a: passthrough
gl_FragColor = color;
}

View File

@@ -1,14 +0,0 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
v_color = a_color;
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

View File

@@ -1,52 +0,0 @@
/**
* Blue Noise texture created by Christoph Peters, released under CC0
* http://momentsingraphics.de/BlueNoise.html
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
vec4 gammaIn(vec4 col) {
return pow(col, vec4(2.2));
}
vec4 gammaOut(vec4 col) {
return pow(col, vec4(1.0 / 2.2));
}
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_pattern;
uniform ivec2 rnd = ivec2(0,0);
float quant = 255.0; // 64 steps -> 63.0; 256 steps -> 255.0
vec4 quantiser = vec4(quant);
vec4 quantiserDivider = vec4(1.0 / quant);
vec2 boolean = vec2(0.0, 1.0);
vec4 halfvec = vec4(0.5);
vec2 patternsize = vec2(1.0/512.0, 1.0/512.0);
vec4 nearestColour(vec4 inColor) {
return floor(quantiser * inColor + halfvec) * quantiserDivider;
}
vec4 getDitherredDot(vec4 inColor) {
vec4 bayerThreshold = vec4(texture2D(u_pattern, (gl_FragCoord.xy + rnd) * patternsize) - 0.5);
return nearestColour(bayerThreshold * quantiserDivider + inColor);
}
void main(void) {
// create texture coordinates based on pixelSize //
vec4 inColor = v_color * texture2D(u_texture, v_texCoords);
vec4 selvec = getDitherredDot(inColor);
// gl_FragColor = inColor * boolean.yyyx + boolean.xxxy;
gl_FragColor = selvec * boolean.yyyx + inColor * boolean.xxxy; // use quantised RGB but not the A
}

View File

@@ -1,43 +0,0 @@
/**
* Blue Noise texture created by Christoph Peters, released under CC0
* http://momentsingraphics.de/BlueNoise.html
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_pattern;
uniform ivec2 rnd = ivec2(0,0);
float quant = 127.0; // 64 steps -> 63.0; 256 steps -> 255.0
vec4 quantiser = vec4(quant);
vec4 quantiserDivider = vec4(1.0 / quant);
vec2 boolean = vec2(0.0, 1.0);
vec4 halfvec = vec4(0.5);
vec2 patternsize = vec2(1.0/512.0, 1.0/512.0);
vec4 nearestColour(vec4 inColor) {
return floor(quantiser * inColor + halfvec) * quantiserDivider;
}
vec4 getDitherredDot(vec4 inColor) {
vec4 bayerThreshold = vec4(texture2D(u_pattern, (gl_FragCoord.xy + rnd) * patternsize) - 0.5);
return nearestColour(bayerThreshold * quantiserDivider + inColor);
}
void main(void) {
// create texture coordinates based on pixelSize //
vec4 inColor = v_color * (texture2D(u_texture, v_texCoords)).aaaa;
vec4 selvec = getDitherredDot(inColor);
gl_FragColor = selvec * boolean.yyyx + boolean.xxxy; // use quantised RGB but not the A
}

View File

@@ -1,43 +0,0 @@
/**
* Blue Noise texture created by Christoph Peters, released under CC0
* http://momentsingraphics.de/BlueNoise.html
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_pattern;
uniform ivec2 rnd = ivec2(0,0);
float quant = 127.0; // 64 steps -> 63.0; 256 steps -> 255.0
vec4 quantiser = vec4(quant);
vec4 quantiserDivider = vec4(1.0 / quant);
vec2 boolean = vec2(0.0, 1.0);
vec4 halfvec = vec4(0.5);
vec2 patternsize = vec2(1.0/512.0, 1.0/512.0);
vec4 nearestColour(vec4 inColor) {
return floor(quantiser * inColor + halfvec) * quantiserDivider;
}
vec4 getDitherredDot(vec4 inColor) {
vec4 bayerThreshold = vec4(texture2D(u_pattern, (gl_FragCoord.xy + rnd) * patternsize) - 0.5);
return nearestColour(bayerThreshold * quantiserDivider + inColor);
}
void main(void) {
// create texture coordinates based on pixelSize //
vec4 inColor = v_color * (texture2D(u_texture, v_texCoords));
vec4 selvec = getDitherredDot(inColor);
gl_FragColor = selvec * boolean.yyyx + boolean.xxxy; // use quantised RGB but not the A
}

View File

@@ -1,66 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_pattern;
uniform vec4 topColor;
uniform vec4 bottomColor;
uniform float parallax = 0.0; // +1.0: all top col, -1.0: all bototm col, 0.0: normal grad
uniform float parallax_size = 1.0/3.0; // 0: no parallax
// inverted zoom; this value must set to (1f/zoom)
uniform float zoomInv = 1.0;
float quant = 63.0; // 64 steps -> 63.0; 256 steps -> 255.0
vec4 quantiser = vec4(quant);
vec4 quantiserDivider = vec4(1.0 / quant);
vec2 boolean = vec2(0.0, 1.0);
vec4 halfvec = vec4(0.5);
vec2 patternsize = vec2(1.0/512.0, 1.0/512.0);
vec4 nearestColour(vec4 inColor) {
return floor(quantiser * inColor + halfvec) * quantiserDivider;
}
vec4 getDitherredDot(vec4 inColor) {
vec4 bayerThreshold = vec4(texture2D(u_pattern, gl_FragCoord.xy * patternsize) - 0.5);
return nearestColour(inColor + bayerThreshold * quantiserDivider);
}
void main(void) {
float scale = v_texCoords.y * (1.0 - parallax_size) + (parallax_size / 2.0) + (parallax * parallax_size / 2.0);
float zoomSamplePoint = (1.0 - zoomInv) / 2.0;// will never quite exceed 0.5
// I don't even know if it works, and also not sure if I actually want it
vec4 newBottom = mix(bottomColor, topColor, zoomSamplePoint);
vec4 newTop = mix(topColor, bottomColor, zoomSamplePoint);
vec4 inColor = v_color * mix(newBottom, newTop, scale);
vec4 selvec = getDitherredDot(inColor);
gl_FragColor = selvec;
}
/*
UV mapping coord.y
-+ <- 1.0 =
D| = // parallax of +1
i| = =
s| = // parallax of 0
p| = =
.| = // parallax of -1
-+ <- 0.0 =
*/

Binary file not shown.

View File

@@ -1,20 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
uniform sampler2D tex1; // lightmap texture
uniform vec2 tex1Offset;
void main() {
vec4 colorTex0 = texture2D(u_texture, v_texCoords); // world texture
vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (RGBA)
colorTex1 = vec4(colorTex1.www, 1.0);
gl_FragColor = colorTex0 * colorTex1;
}

View File

@@ -1,34 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
int bayer[36] = int[](
192,78,21,120,163,14,
234,142,184,248,56,106,
64,7,92,35,149,206,
128,170,220,199,85,28,
241,49,113,0,135,177,
42,156,213,71,227,99
);
float bayerSize = 6.0;
float bayerDivider = 256;
vec2 boolean = vec2(0.0, 1.0);
void main() {
vec4 inColor = v_color * (texture2D(u_texture, v_texCoords));
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
float bayerThreshold = float(bayer[int(entry.y) * int(bayerSize) + int(entry.x)]) / bayerDivider;
float alpha = inColor.a;
vec4 selvec = vec4(0.0, 0.0, 0.0, (alpha > bayerThreshold) ? 1.0 : 0.0);
gl_FragColor = inColor * boolean.yyyx + selvec;
// gl_FragColor = inColor;
}

View File

@@ -1,9 +0,0 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
vec2 boolean = vec2(0.0, 1.0);
void main(void) {
gl_FragColor = texture2D(u_texture, v_texCoords).aaaa * boolean.yyyx + boolean.xxxy;
}

View File

@@ -1,18 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
uniform sampler2D tex1; // glow texture, SHOULD contain alpha of all 1.0
void main(void) {
vec4 colorTex0 = texture2D(u_texture, v_texCoords); // lightmap (RGB) pre-mixed
vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (A) pre-mixed
gl_FragColor = vec4(max(colorTex0.rgb, colorTex1.rgb), colorTex0.a);
}

View File

@@ -1,14 +0,0 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans; // camera.combined
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
v_color = a_color;
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

View File

@@ -1,35 +0,0 @@
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 iResolution;
uniform float flip;
uniform vec2 direction;
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
void main() {
vec2 uv = vec2(gl_FragCoord.xy / iResolution.xy);
if (flip == 1.0) {
uv.y = 1.0 - uv.y;
}
gl_FragColor = blur(u_texture, uv, iResolution.xy, direction);
}

View File

@@ -1,14 +0,0 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
v_color = a_color;
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

View File

@@ -1,37 +0,0 @@
#ifdef GL_ES
precision highp float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 iResolution;
uniform float flip;
uniform vec2 direction;
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.411764705882353) * direction;
vec2 off2 = vec2(3.2941176470588234) * direction;
vec2 off3 = vec2(5.176470588235294) * direction;
color += texture2D(image, uv) * 0.1964825501511404;
color += texture2D(image, uv + (off1 / resolution)) * 0.2969069646728344;
color += texture2D(image, uv - (off1 / resolution)) * 0.2969069646728344;
color += texture2D(image, uv + (off2 / resolution)) * 0.09447039785044732;
color += texture2D(image, uv - (off2 / resolution)) * 0.09447039785044732;
color += texture2D(image, uv + (off3 / resolution)) * 0.010381362401148057;
color += texture2D(image, uv - (off3 / resolution)) * 0.010381362401148057;
return color;
}
void main() {
vec2 uv = vec2(gl_FragCoord.xy / iResolution.xy);
if (flip == 1.0) {
uv.y = 1.0 - uv.y;
}
gl_FragColor = blur(u_texture, uv, iResolution.xy, direction);
}

View File

@@ -1,59 +0,0 @@
/**
* Blue Noise texture created by Christoph Peters, released under CC0
* http://momentsingraphics.de/BlueNoise.html
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_pattern;
uniform ivec2 rnd = ivec2(0,0);
float quant = 127.0; // 64 steps -> 63.0; 256 steps -> 255.0
vec4 quantiser = vec4(quant);
vec4 quantiserDivider = vec4(1.0 / quant);
vec2 boolean = vec2(0.0, 1.0);
vec4 halfvec = vec4(0.5);
vec2 patternsize = vec2(1.0/512.0, 1.0/512.0);
vec4 nearestColour(vec4 inColor) {
return floor(quantiser * inColor + halfvec) * quantiserDivider;
}
vec4 getDitherredDot(vec4 inColor) {
vec4 bayerThreshold = vec4(texture2D(u_pattern, (gl_FragCoord.xy + rnd) * patternsize) - 0.5);
return nearestColour(bayerThreshold * quantiserDivider + inColor);
}
uniform vec2 iResolution;
uniform float flip;
uniform vec2 direction;
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
void main() {
vec2 uv = vec2(gl_FragCoord.xy / iResolution.xy);
if (flip == 1.0) { uv.y = 1.0 - uv.y; }
vec4 inColor = blur(u_texture, uv, iResolution.xy, direction);
vec4 selvec = getDitherredDot(inColor);
gl_FragColor = selvec; // quantise all four RGBA
}

View File

@@ -1,31 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
// that, or simply 0.5, depending on how your uv coord works
uniform vec2 halfpixel = vec2(0.0, 0.0);
vec2 doublex = vec2(2.0, 0.0);
vec2 doubley = vec2(0.0, 2.0);
vec2 twister = vec2(1.0, -1.0);
vec2 boolean = vec2(1.0, 0.0);
void main() {
vec4 sum = texture2D(u_texture, v_texCoords) +
texture2D(u_texture, v_texCoords + halfpixel) +
texture2D(u_texture, v_texCoords - halfpixel) +
texture2D(u_texture, v_texCoords + halfpixel * twister) +
texture2D(u_texture, v_texCoords - halfpixel * twister) +
texture2D(u_texture, v_texCoords + halfpixel * boolean.xy) +
texture2D(u_texture, v_texCoords - halfpixel * boolean.xy) +
texture2D(u_texture, v_texCoords + halfpixel * boolean.yx) +
texture2D(u_texture, v_texCoords - halfpixel * boolean.yx) ;
gl_FragColor = sum / 9.0;
}

View File

@@ -1,31 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
// that, or simply 0.5, depending on how your uv coord works
uniform vec2 halfpixel = vec2(0.0, 0.0);
vec2 doublex = vec2(2.0, 0.0);
vec2 doubley = vec2(0.0, 2.0);
vec2 twister = vec2(1.0, -1.0);
vec2 boolean = vec2(1.0, 0.0);
void main() {
vec4 sum = texture2D(u_texture, v_texCoords) +
texture2D(u_texture, v_texCoords + halfpixel) +
texture2D(u_texture, v_texCoords - halfpixel) +
texture2D(u_texture, v_texCoords + halfpixel * twister) +
texture2D(u_texture, v_texCoords - halfpixel * twister) +
texture2D(u_texture, v_texCoords + halfpixel * boolean.xy) +
texture2D(u_texture, v_texCoords - halfpixel * boolean.xy) +
texture2D(u_texture, v_texCoords + halfpixel * boolean.yx) +
texture2D(u_texture, v_texCoords - halfpixel * boolean.yx) ;
gl_FragColor = sum / 9.0;
}

View File

@@ -1,45 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 resolution;
uniform vec3 phosphor_colour = vec3(1.3, 0.8567, 0.0);
vec3 scanline_darkening = vec3(0.66, 0.66, 0.66);
// 0: every odd line will get darkened; 1: every even line will get darkened
uniform float alternative_scanline = 0.0; // 1.0: true
uniform float blur_blend = 0.5;
void main(void) {
vec4 color = texture2D(u_texture, v_texCoords).rgba;
vec4 color_pre = texture2D(u_texture, (v_texCoords + (vec2(-1.0, 0.0) / resolution))).rgba;
vec4 color_next = texture2D(u_texture, (v_texCoords + (vec2( 1.0, 0.0) / resolution))).rgba;
color = color * (1.0 - blur_blend) + color_pre * (blur_blend / 2.0) + color_next * (blur_blend / 2.0);
bool is_scanline = mod(int(gl_FragCoord.y), 2) == int(alternative_scanline);
float color_luminosity = (
3.0 * color.r +
4.0 * color.g +
1.0 * color.b
) / 8.0;
// out colour
vec3 out_color = vec3(color_luminosity) * phosphor_colour;
if (is_scanline) {
out_color = out_color * scanline_darkening;
}
gl_FragColor = vec4(out_color, 1);
//gl_FragColor = texture2D(u_texture, v_texCoords);
}

View File

@@ -1,17 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_EXT_gpu_shader4 : enable
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
vec4 inColor = texture2D(u_texture, v_texCoords);
ivec4 bytes = ivec4(255.0 * inColor);
ivec4 mask = ivec4(0x55);
gl_FragColor = (bytes ^ mask) / 255.0;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,13 +0,0 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
vec2 boolean = vec2(0.0, 1.0);
vec4 desaturate = vec4(0.2126, 0.7152, 0.0722, 0.0);
void main(void) {
vec4 incolour = texture2D(u_texture, v_texCoords);
float lum = dot(incolour * desaturate, boolean.yyyx) * 0.5 + 0.5;
gl_FragColor = v_color * (vec4(lum) * boolean.yyyx + incolour * boolean.xxxy);
}

View File

@@ -1,61 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
// "steps" of R, G and B. Must be integer && equal or greater than 2
uniform float rcount = 8.0;
uniform float gcount = 8.0;
uniform float bcount = 8.0;
uniform float acount = 1.0;
//int bayer[14 * 14] = int[](131,187,8,78,50,18,134,89,155,102,29,95,184,73,22,86,113,171,142,105,34,166,9,60,151,128,40,110,168,137,45,28,64,188,82,54,124,189,80,13,156,56,7,61,186,121,154,6,108,177,24,100,38,176,93,123,83,148,96,17,88,133,44,145,69,161,139,72,30,181,115,27,163,47,178,65,164,14,120,48,5,127,153,52,190,58,126,81,116,21,106,77,173,92,191,63,99,12,76,144,4,185,37,149,192,39,135,23,117,31,170,132,35,172,103,66,129,79,3,97,57,159,70,141,53,94,114,20,49,158,19,146,169,122,183,11,104,180,2,165,152,87,182,118,91,42,67,25,84,147,43,85,125,68,16,136,71,10,193,112,160,138,51,111,162,26,194,46,174,107,41,143,33,74,1,101,195,15,75,140,109,90,32,62,157,98,167,119,179,59,36,130,175,55,0,150);
//float bayerSize = 14.0;
int bayer[4 * 4] = int[](0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5);
float bayerSize = 4.0;
float bayerDivider = bayerSize * bayerSize;
vec4 gammaIn(vec4 col) {
return pow(col, vec4(2.2));
}
vec4 gammaOut(vec4 col) {
return pow(col, vec4(1.0 / 2.2));
}
vec4 nearestColour(vec4 incolor) {
vec4 rgbaCounts = vec4(rcount, gcount, bcount, acount);
vec4 color = incolor;
color.r = floor((rgbaCounts.r - 1.0) * color.r + 0.5) / (rgbaCounts.r - 1.0);
color.g = floor((rgbaCounts.g - 1.0) * color.g + 0.5) / (rgbaCounts.g - 1.0);
color.b = floor((rgbaCounts.b - 1.0) * color.b + 0.5) / (rgbaCounts.b - 1.0);
color.a = 1.0;//floor((rgbaCounts.a - 1.0) * color.a + 0.5) / (rgbaCounts.a - 1.0);
return color;
}
void main(void) {
float spread = 1.0 / (0.299 * (rcount - 1.0) + 0.587 * (gcount - 1.0) + 0.114 * (bcount - 1.0)); // this spread value is optimised one -- try your own values for various effects!
// create texture coordinates based on pixelSize //
vec4 inColor = (texture2D(u_texture, v_texCoords));
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
vec4 outColor = nearestColour(inColor + spread * (bayer[int(entry.y) * int(bayerSize) + int(entry.x)] / bayerDivider - 0.5));
gl_FragColor = outColor;
}

View File

@@ -1,25 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
// that, or simply 0.5, depending on how your uv coord works
uniform vec2 halfpixel = vec2(0.0, 0.0);
vec2 twister = vec2(1.0, -1.0);
void main() {
vec4 sum = texture2D(u_texture, v_texCoords) * 4.0;
sum += texture2D(u_texture, v_texCoords - halfpixel);
sum += texture2D(u_texture, v_texCoords + halfpixel);
sum += texture2D(u_texture, v_texCoords - halfpixel * twister);
sum += texture2D(u_texture, v_texCoords + halfpixel * twister);
gl_FragColor = sum / 8.0;
// gl_FragColor = texture2D(u_texture, v_texCoords);
}

View File

@@ -1,30 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
// recommended value: n / vec2(fbo_width, fbo_height) where n is something like {0.5, 1, 2, 4, ... }
// that, or simply 0.5, depending on how your uv coord works
uniform vec2 halfpixel = vec2(0.0, 0.0);
vec2 doublex = vec2(2.0, 0.0);
vec2 doubley = vec2(0.0, 2.0);
vec2 twister = vec2(1.0, -1.0);
void main() {
vec4 sum = texture2D(u_texture, v_texCoords - halfpixel * doublex);
sum += texture2D(u_texture, v_texCoords - halfpixel * twister) * 2.0;
sum += texture2D(u_texture, v_texCoords + halfpixel * doubley);
sum += texture2D(u_texture, v_texCoords + halfpixel) * 2.0;
sum += texture2D(u_texture, v_texCoords + halfpixel * doublex);
sum += texture2D(u_texture, v_texCoords + halfpixel * twister) * 2.0;
sum += texture2D(u_texture, v_texCoords - halfpixel * doubley);
sum += texture2D(u_texture, v_texCoords - halfpixel) * 2.0;
gl_FragColor = sum / 12.0;
// gl_FragColor = texture2D(u_texture, v_texCoords);
}

View File

@@ -1,39 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform float rcount = 64.0;
uniform float gcount = 64.0;
uniform float bcount = 64.0;
uniform float acount = 1.0;
uniform vec2 circleCentrePoint;
uniform vec2 colorCentrePoint;
uniform float circleSize;
void main() {
vec2 screenCoord = gl_FragCoord.xy;
float distToCircleCentre =
(screenCoord.x - circleCentrePoint.x + 0.5) * (screenCoord.x - circleCentrePoint.x + 0.5) +
(screenCoord.y - circleCentrePoint.y + 0.5) * (screenCoord.y - circleCentrePoint.y + 0.5);
float circleSizeSqr = circleSize * circleSize / 4;
if (distToCircleCentre <= circleSizeSqr) {
gl_FragColor = vec4(0.993, 0.993, 0.993, 1.0);
}
else if (distToCircleCentre <= circleSizeSqr + 200) { // dunno why it's 200; 2000 makes 10px feather
gl_FragColor = vec4(0.993, 0.993, 0.993, 1 - (distToCircleCentre - circleSizeSqr) / 200);
}
else {
gl_FragColor = vec4(0,0,0,1);
}
}

View File

@@ -1,14 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
gl_FragColor = vec4(texture2D(u_texture, v_texCoords).rgb, 1.0);
}

View File

@@ -1,16 +0,0 @@
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform mat4 u_projTrans;
void main() {
vec3 color = texture2D(u_texture, v_texCoords).rgb;
float gray = (3.0 * color.r + 4.0 * color.g + color.b) / 8.0;
vec3 grayscale = vec3(gray);
gl_FragColor = vec4(grayscale, 1.0);
}

View File

@@ -1,14 +0,0 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
v_color = a_color;
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

View File

@@ -1,108 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
// all 3 must have the same dimension!
// the divisor of 2 input and an output must be the same. I.e. either divide all by 4, or not.
uniform sampler2D shades;
uniform sampler2D lights;
// WARNING -- Gdx.Color.toIntBits returns ABGR, but GLSL expects RGBA. Use the function Color.toRGBA() in LightmapRenderNew
uniform sampler2D u_texture;
uniform vec2 outSize;
uniform float multiplier = 4.0; // if divided by four, put 4.0 in there
#define TRAVERSE_SIZE 128 // should be good for screen size up to 1920 for tile size of 16
vec4 sampleFrom(sampler2D from, vec2 which) {
return texture2D(from, which / outSize);
}
int traceRayCount(vec2 delta) {
vec2 absDelta = abs(delta);
int arraySize = int(max(absDelta.x, absDelta.y));
return arraySize + 1;
}
vec2[TRAVERSE_SIZE] traceRay(int arraySize, vec2 from, vec2 to) {
vec2 delta = to - from;
vec2[TRAVERSE_SIZE] returnArray;
int arri = 0;
// if the line is not vertical...
if (delta.x != 0) {
float deltaError = abs(delta.y / delta.x);
float error = 0.0;
float traceY = from.y;
for (float traceX = from.x; traceX <= to.x; traceX++) {
// plot(traceX, traceY)
returnArray[arri] = vec2(traceX, traceY);
arri = arri + 1;
error = error + deltaError;
if (error >= 0.5) {
traceY = traceY + sign(delta.y);
error = error - 1.0;
}
}
}
else {
for (float traceY = from.y; traceY <= to.y; traceY++) {
returnArray[arri] = vec2(from.x, traceY);
}
}
return returnArray;
}
void main() {
// this code will produce y-flipped image. It's your job to flip it again (e.g. using y-flipped fullscreen quad)
// Nice try, but it kills GPU :(
// reason: looks like traceRayCount() returns value greater than TRAVERSE_SIZE.
// even if I make traceRayCount() to return constant 3, I get less than 1 fps on GTX 970.
vec4 outColor = vec4(0.0,0.0,0.0,0.0);
// 1. pick a light source
for (int y = 0; y < int(outSize.y); y++) {
for (int x = 0; x < int(outSize.x); x++) {
vec2 from = vec2(x + 0.5, y + 0.5); // +0.5 is used because gl_FragCoord does
vec2 to = gl_FragCoord.xy;
vec2 delta = to - from;
int traceCount = traceRayCount(delta);
vec4 light = sampleFrom(lights, from);
// 2. get a trace path
vec2[TRAVERSE_SIZE] returnArray = traceRay(traceCount, from, to);
// 2.1 get angular darkening coefficient
vec2 unitVec = delta / max(delta.x, delta.y);
float angularDimming = sqrt(unitVec.x * unitVec.x + unitVec.y * unitVec.y);
//float angularDimming = 1.0; // TODO depends on the angle of (lightPos, gl_FragCoord.x)
// 3. traverse the light path to dim the "light"
// var "light" will be attenuated after this loop
for (int i = 0; i < traceCount; i++) {
vec4 shade = sampleFrom(shades, returnArray[i]) * angularDimming;
light = light - shade;
}
// 4. mix the incoming light into the light buffer.
outColor = max(outColor, light);
}
}
gl_FragColor = outColor * multiplier;
//gl_FragColor = vec4(0,1,0,1);
//gl_FragColor = sampleFrom(lights, gl_FragCoord.xy) * multiplier;
}

View File

@@ -1,9 +0,0 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
vec4 color = texture2D(u_texture, vec2(v_texCoords.x, 1.0 - v_texCoords.y));
vec4 alphamul = vec4(1.0, 1.0, 1.0, 0.5 * (1.0 - v_texCoords.y));
gl_FragColor = color * alphamul;
}

View File

@@ -1,9 +0,0 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
vec2 boolean = vec2(0.0, 1.0);
void main(void) {
gl_FragColor = texture2D(u_texture, v_texCoords).rgba * boolean.yyyx + boolean.xxxy;
}

View File

@@ -1,21 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
uniform sampler2D tex1; // lightmap texture
uniform vec2 tex1Offset;
uniform vec2 tex1Resolution;
void main() {
vec4 colorTex0 = texture2D(u_texture, v_texCoords + vec2(0.5, 0.5)); // world texture
vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (RGBA)
colorTex1 = vec4(colorTex1.xyz, 1.0);
gl_FragColor = colorTex0 * colorTex1;
}

View File

@@ -1,38 +0,0 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float parallax = 0.0; // +1.0: all top col, -1.0: all bototm col, 0.0: normal grad
uniform float parallax_size = 1.0/3.0; // 0: no parallax
void main(void) {
float scale = v_texCoords.y * (1.0 - parallax_size) + (parallax_size / 2.0) + (parallax * parallax_size / 2.0);
float inR = mix(bottomColor.r, topColor.r, scale);
float inG = mix(bottomColor.g, topColor.g, scale);
float inB = mix(bottomColor.b, topColor.b, scale);
gl_FragColor = vec4(inR, inG, inB, 1.0);
}
/*
UV mapping coord.y
-+ <- 1.0 =
D| = // parallax of +1
i| = =
s| = // parallax of 0
p| = =
.| = // parallax of -1
-+ <- 0.0 =
*/

View File

@@ -1,112 +0,0 @@
/*
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_EXT_gpu_shader4 : enable
//layout(origin_upper_left) in vec4 gl_FragCoord; // commented; requires #version 150 or later
// gl_FragCoord is origin to bottom-left
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 screenDimension;
uniform vec2 tilesInAxes; // size of the tilemap texture; vec2(tiles_in_horizontal, tiles_in_vertical)
uniform sampler2D tilemap; // RGBA8888
uniform sampler2D tilesAtlas; // terrain, wire, fluids, etc.
uniform sampler2D tilesBlendAtlas; // alternative terrain for the weather mix (e.g. yellowed grass)
uniform float tilesBlend = 0.0; // percentage of blending [0f..1f]. 0: draws tilesAtlas, 1: draws tilesBlendAtlas
uniform vec2 tilesInAtlas = vec2(256.0, 256.0);
uniform vec2 atlasTexSize = vec2(4096.0, 4096.0);
vec2 _tilesInAtlas = vec2(1.0, 1.0) / tilesInAtlas;
vec2 tileSizeInPx = atlasTexSize * _tilesInAtlas; // should be like ivec2(16.0, 16.0)
vec2 _tileSizeInPx = vec2(1.0, 1.0) / tileSizeInPx; // should be like ivec2(0.06125, 0.06125)
uniform vec4 colourFilter = vec4(1, 1, 1, 1); // used by WALL to darken it
uniform ivec2 cameraTranslation = ivec2(0, 0); // used to offset the drawing; it's integer because we want the drawing to be pixel-aligned
uniform float drawBreakage = 1.0; // set it to 0f to not draw breakage, 1f to draw it; NEVER set to any other values.
uniform float mulBlendIntensity = 1.0; // used my MUL-blending drawings; works about the same way as the Layer Opacity slider of Photoshop/Krita/etc.
const vec2 bc = vec2(1.0, 0.0); //binary constant
ivec2 getTileXY(int tileNumber) {
return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x));
}
// return: int=0xaarrggbb
int _colToInt(vec4 color) {
return int(color.b * 255) | (int(color.g * 255) << 8) | (int(color.r * 255) << 16) | (int(color.a * 255) << 24);
}
// 0x0rggbb where int=0xaarrggbb
// return: [0..1048575]
int getTileFromColor(vec4 color) {
return _colToInt(color) & 0xFFFFF;
}
// 0x00r00000 where int=0xaarrggbb
// return: [0..15]
int getBreakageFromColor(vec4 color) {
return (_colToInt(color) >> 20) & 0xF;
}
void main() {
// READ THE FUCKING MANUAL, YOU DONKEY !! //
// This code purposedly uses flipped fragcoord. //
// Make sure you don't use gl_FragCoord unknowingly! //
// Remember, if there's a compile error, shader SILENTLY won't do anything //
// default gl_FragCoord takes half-integer (represeting centre of the pixel) -- could be useful for phys solver?
// This one, however, takes exact integer by rounding down. //
vec2 overscannedScreenDimension = tilesInAxes * tileSizeInPx; // how many tiles will fit into a screen; one used by the tileFromMap; we need this because screen size is not integer multiple of the tile size
vec2 flippedFragCoord = vec2(gl_FragCoord.x, screenDimension.y - gl_FragCoord.y) + cameraTranslation; // NO IVEC2!!; this flips Y
// get required tile numbers //
vec4 tileFromMap = texture2D(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number
int tile = getTileFromColor(tileFromMap);
int breakage = getBreakageFromColor(tileFromMap);
ivec2 tileXY = getTileXY(tile);
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the contents of the atlas
// calculate the UV coord value for texture sampling //
// don't really need highp here; read the GLES spec
vec2 uvCoordForTile = (mod(flippedFragCoord, tileSizeInPx) * _tileSizeInPx) * _tilesInAtlas; // 0..0.00390625 regardless of tile position in atlas
vec2 uvCoordOffsetTile = tileXY * _tilesInAtlas; // where the tile starts in the atlas, using uv coord (0..1)
vec2 uvCoordOffsetBreakage = breakageXY * _tilesInAtlas;
// get final UV coord for the actual sampling //
vec2 finalUVCoordForTile = uvCoordForTile + uvCoordOffsetTile;// where we should be actually looking for in atlas, using UV coord (0..1)
vec2 finalUVCoordForBreakage = uvCoordForTile + uvCoordOffsetBreakage;
// blending a breakage tex with main tex //
vec4 tileCol = texture2D(tilesAtlas, finalUVCoordForTile);
vec4 tileAltCol = texture2D(tilesBlendAtlas, finalUVCoordForTile);
vec4 finalTile = mix(tileCol, tileAltCol, tilesBlend);
vec4 finalBreakage = drawBreakage * texture2D(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw
vec4 finalColor =mix(finalTile, finalBreakage, finalBreakage.a) * bc.xxxy + (finalTile * bc.yyyx);
gl_FragColor = mix(colourFilter, colourFilter * finalColor, mulBlendIntensity);
}

View File

@@ -1,123 +0,0 @@
/*
*/
#version 120
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_EXT_gpu_shader4 : enable
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 screenDimension;
uniform vec2 tilesInAxes; // size of the tilemap texture; vec2(tiles_in_horizontal, tiles_in_vertical)
uniform sampler2D tilemap; // RGBA8888
uniform sampler2D tilesAtlas; // terrain, wire, fluids, etc.
uniform sampler2D tilesBlendAtlas; // alternative terrain for the weather mix (e.g. yellowed grass)
uniform float tilesBlend = 0.0; // percentage of blending [0f..1f]. 0: draws tilesAtlas, 1: draws tilesBlendAtlas
uniform vec2 tilesInAtlas = vec2(256.0, 256.0);
uniform vec2 atlasTexSize = vec2(4096.0, 4096.0);
vec2 _tilesInAtlas = vec2(1.0, 1.0) / tilesInAtlas;
vec2 tileSizeInPx = atlasTexSize * _tilesInAtlas; // should be like ivec2(16.0, 16.0)
vec2 _tileSizeInPx = vec2(1.0, 1.0) / tileSizeInPx; // should be like ivec2(0.06125, 0.06125)
uniform vec4 colourFilter = vec4(1, 1, 1, 1); // used by WALL to darken it
uniform ivec2 cameraTranslation = ivec2(0, 0); // used to offset the drawing; it's integer because we want the drawing to be pixel-aligned
uniform float drawBreakage = 1.0; // set it to 0f to not draw breakage, 1f to draw it; NEVER set to any other values.
uniform float mulBlendIntensity = 1.0; // used my MUL-blending drawings; works about the same way as the Layer Opacity slider of Photoshop/Krita/etc.
const vec2 bc = vec2(1.0, 0.0); //binary constant
// man the traditional bayer crosshatch pattern looks really good on tiles...
int bayer[16] = int[](
0,8,2,10,
12,4,14,6,
3,11,1,9,
15,7,13,5
);
float bayerSize = 4.0;
float bayerDivider = 16;
ivec2 getTileXY(int tileNumber) {
return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x));
}
// return: int=0xaarrggbb
int _colToInt(vec4 color) {
return int(color.b * 255) | (int(color.g * 255) << 8) | (int(color.r * 255) << 16) | (int(color.a * 255) << 24);
}
// 0x0rggbb where int=0xaarrggbb
// return: [0..1048575]
int getTileFromColor(vec4 color) {
return _colToInt(color) & 0xFFFFF;
}
// 0x00r00000 where int=0xaarrggbb
// return: [0..15]
int getBreakageFromColor(vec4 color) {
return (_colToInt(color) >> 20) & 0xF;
}
void main() {
// READ THE FUCKING MANUAL, YOU DONKEY !! //
// This code purposedly uses flipped fragcoord. //
// Make sure you don't use gl_FragCoord unknowingly! //
// Remember, if there's a compile error, shader SILENTLY won't do anything //
// default gl_FragCoord takes half-integer (represeting centre of the pixel) -- could be useful for phys solver?
// This one, however, takes exact integer by rounding down. //
vec2 overscannedScreenDimension = tilesInAxes * tileSizeInPx; // how many tiles will fit into a screen; one used by the tileFromMap; we need this because screen size is not integer multiple of the tile size
vec2 flippedFragCoord = vec2(gl_FragCoord.x, screenDimension.y - gl_FragCoord.y) + cameraTranslation; // NO IVEC2!!; this flips Y
// get required tile numbers //
vec4 tileFromMap = texture2D(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number
int tile = getTileFromColor(tileFromMap);
int breakage = getBreakageFromColor(tileFromMap);
ivec2 tileXY = getTileXY(tile);
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the contents of the atlas
// calculate the UV coord value for texture sampling //
// don't really need highp here; read the GLES spec
vec2 uvCoordForTile = (mod(flippedFragCoord, tileSizeInPx) * _tileSizeInPx) * _tilesInAtlas; // 0..0.00390625 regardless of tile position in atlas
vec2 uvCoordOffsetTile = tileXY * _tilesInAtlas; // where the tile starts in the atlas, using uv coord (0..1)
vec2 uvCoordOffsetBreakage = breakageXY * _tilesInAtlas;
// get final UV coord for the actual sampling //
vec2 finalUVCoordForTile = uvCoordForTile + uvCoordOffsetTile;// where we should be actually looking for in atlas, using UV coord (0..1)
vec2 finalUVCoordForBreakage = uvCoordForTile + uvCoordOffsetBreakage;
// blending a breakage tex with main tex //
vec4 tileCol = texture2D(tilesAtlas, finalUVCoordForTile);
vec4 tileAltCol = texture2D(tilesBlendAtlas, finalUVCoordForTile);
vec4 finalTile = mix(tileCol, tileAltCol, tilesBlend);
vec4 finalBreakage = drawBreakage * texture2D(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw
vec4 finalColor =mix(finalTile, finalBreakage, finalBreakage.a) * bc.xxxy + (finalTile * bc.yyyx);
vec4 undithered = mix(colourFilter, colourFilter * finalColor, mulBlendIntensity);
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
float bayerThreshold = float(bayer[int(entry.y) * int(bayerSize) + int(entry.x)]) / bayerDivider;
gl_FragColor = undithered * bc.xxxy + vec4((undithered.a > bayerThreshold) ? 1.0 : 0.0) * bc.yyyx;
}