Shader cleanup
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 211 B |
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
|
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 840 B |
@@ -1,40 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform vec2 u_uv;
|
|
||||||
uniform vec2 u_uv2;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
bool id(vec2 coords, vec4 base){
|
|
||||||
vec4 target = texture2D(u_texture, coords);
|
|
||||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v){
|
|
||||||
float step = 1.0;
|
|
||||||
vec4 base = texture2D(u_texture, T);
|
|
||||||
return base.a > 0.1 &&
|
|
||||||
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
|
||||||
id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base));
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec2 t = v_texCoord.xy;
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
vec2 coord = t / v;
|
|
||||||
vec4 c = texture2D(u_texture, t);
|
|
||||||
|
|
||||||
if(cont(t, v)){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
attribute vec4 a_position;
|
|
||||||
attribute vec4 a_color;
|
|
||||||
attribute vec2 a_texCoord0;
|
|
||||||
uniform mat4 u_projectionViewMatrix;
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoords;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
v_color = a_color;
|
|
||||||
v_color.a = v_color.a * (255.0/254.0);
|
|
||||||
v_texCoords = a_texCoord0;
|
|
||||||
gl_Position = u_projectionViewMatrix * a_position;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
uniform vec4 u_color;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
|
||||||
|
|
||||||
c = mix(c, vec4(v_color.r, v_color.g, v_color.b, c.a), v_color.a);
|
|
||||||
|
|
||||||
gl_FragColor = c * vec4(v_color.rgb, 1.0);
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform vec2 u_uv;
|
|
||||||
uniform vec2 u_uv2;
|
|
||||||
uniform float u_progress;
|
|
||||||
uniform float u_time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
const float chunk = 4.0;
|
|
||||||
const float start = 0.7;
|
|
||||||
const float end = 0.9;
|
|
||||||
|
|
||||||
float rand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
float round(float f){
|
|
||||||
return float(int(f / chunk)) * chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool id(vec2 coords, vec4 base, float basediff){
|
|
||||||
vec4 target = texture2D(u_texture, coords);
|
|
||||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v, float basediff){
|
|
||||||
float step = 1.0;
|
|
||||||
vec4 base = texture2D(u_texture, T);
|
|
||||||
return base.a > 0.1 &&
|
|
||||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
|
||||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool complete(vec2 coords){
|
|
||||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
|
||||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
|
||||||
float fr = (r-start)*(1.0/(end-start));
|
|
||||||
|
|
||||||
vec2 next = rc + chunk/2.0;
|
|
||||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y));
|
|
||||||
return rdst / (chunk/2.0) < fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 t = v_texCoord.xy;
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
|
|
||||||
bool any = false;
|
|
||||||
|
|
||||||
vec2 coords = (v_texCoord-u_uv) / v;
|
|
||||||
|
|
||||||
|
|
||||||
float value = coords.x + coords.y;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, t);
|
|
||||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
|
||||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
|
||||||
|
|
||||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
|
||||||
|
|
||||||
const float scl = 10.0;
|
|
||||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
|
||||||
|
|
||||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(r > end){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if((cont(t, v, 100.0) && mod(u_time / 1.5 + value, 20.0) < 5.0 && color.a > 0.1) ||
|
|
||||||
(complete(coords) && (!complete(coords + vec2(1.0, 0.0)) || !complete(coords + vec2(-1.0, 0.0)) || !complete(coords + vec2(0.0, 1.0))
|
|
||||||
|| !complete(coords + vec2(0.0, -1.0))))){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(r > start && color.a > 0.1){
|
|
||||||
float fr = (r-start)*(1.0/(end-start));
|
|
||||||
|
|
||||||
vec2 next = rc + chunk/2.0;
|
|
||||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y));
|
|
||||||
if(rdst / (chunk/2.0) < fr){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform vec2 u_uv;
|
|
||||||
uniform vec2 u_uv2;
|
|
||||||
uniform float u_progress;
|
|
||||||
uniform float u_time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
float diff(vec4 target, vec4 base){
|
|
||||||
return (max(target.a / base.a, max(target.r / base.r, max(target.g / base.g, target.b / base.b))) -
|
|
||||||
min (target.a / base.a, min(target.r / base.r, min(target.g / base.g, target.b / base.b)))) * 4.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool id(vec2 coords, vec4 base, float basediff){
|
|
||||||
vec4 target = texture2D(u_texture, coords);
|
|
||||||
return (diff(target, base)) > basediff - basediff*u_progress
|
|
||||||
|| (basediff < 5.0 && (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v, float basediff){
|
|
||||||
float step = 1.0;
|
|
||||||
vec4 base = texture2D(u_texture, T);
|
|
||||||
return base.a > 0.1 &&
|
|
||||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
|
||||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
|
||||||
}
|
|
||||||
|
|
||||||
float rand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 t = v_texCoord.xy;
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
vec2 coords = (v_texCoord-u_uv) / v;
|
|
||||||
float value = coords.x + coords.y;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, t);
|
|
||||||
|
|
||||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
|
||||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
|
||||||
|
|
||||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(cont(t, v, 6.0)){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if(cont(t, v, 3.0) && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform vec2 u_uv;
|
|
||||||
uniform vec2 u_uv2;
|
|
||||||
uniform float u_progress;
|
|
||||||
uniform float u_time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
|
|
||||||
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
|
|
||||||
|
|
||||||
float snoise(vec3 v){
|
|
||||||
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
|
|
||||||
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
|
|
||||||
|
|
||||||
// First corner
|
|
||||||
vec3 i = floor(v + dot(v, C.yyy) );
|
|
||||||
vec3 x0 = v - i + dot(i, C.xxx) ;
|
|
||||||
|
|
||||||
// Other corners
|
|
||||||
vec3 g = step(x0.yzx, x0.xyz);
|
|
||||||
vec3 l = 1.0 - g;
|
|
||||||
vec3 i1 = min( g.xyz, l.zxy );
|
|
||||||
vec3 i2 = max( g.xyz, l.zxy );
|
|
||||||
|
|
||||||
// x0 = x0 - 0. + 0.0 * C
|
|
||||||
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
|
|
||||||
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
|
|
||||||
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
|
|
||||||
|
|
||||||
// Permutations
|
|
||||||
i = mod(i, 289.0 );
|
|
||||||
vec4 p = permute( permute( permute(
|
|
||||||
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
|
|
||||||
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
|
|
||||||
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
|
|
||||||
|
|
||||||
// Gradients
|
|
||||||
// ( N*N points uniformly over a square, mapped onto an octahedron.)
|
|
||||||
float n_ = 1.0/7.0; // N=7
|
|
||||||
vec3 ns = n_ * D.wyz - D.xzx;
|
|
||||||
|
|
||||||
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
|
|
||||||
|
|
||||||
vec4 x_ = floor(j * ns.z);
|
|
||||||
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
|
|
||||||
|
|
||||||
vec4 x = x_ *ns.x + ns.yyyy;
|
|
||||||
vec4 y = y_ *ns.x + ns.yyyy;
|
|
||||||
vec4 h = 1.0 - abs(x) - abs(y);
|
|
||||||
|
|
||||||
vec4 b0 = vec4( x.xy, y.xy );
|
|
||||||
vec4 b1 = vec4( x.zw, y.zw );
|
|
||||||
|
|
||||||
vec4 s0 = floor(b0)*2.0 + 1.0;
|
|
||||||
vec4 s1 = floor(b1)*2.0 + 1.0;
|
|
||||||
vec4 sh = -step(h, vec4(0.0));
|
|
||||||
|
|
||||||
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
|
|
||||||
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
|
|
||||||
|
|
||||||
vec3 p0 = vec3(a0.xy,h.x);
|
|
||||||
vec3 p1 = vec3(a0.zw,h.y);
|
|
||||||
vec3 p2 = vec3(a1.xy,h.z);
|
|
||||||
vec3 p3 = vec3(a1.zw,h.w);
|
|
||||||
|
|
||||||
//Normalise gradients
|
|
||||||
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
|
||||||
p0 *= norm.x;
|
|
||||||
p1 *= norm.y;
|
|
||||||
p2 *= norm.z;
|
|
||||||
p3 *= norm.w;
|
|
||||||
|
|
||||||
// Mix final noise value
|
|
||||||
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
|
||||||
m = m * m;
|
|
||||||
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
|
||||||
dot(p2,x2), dot(p3,x3) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 t = v_texCoord.xy;
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
|
|
||||||
vec2 coords = (v_texCoord-u_uv) / v;
|
|
||||||
|
|
||||||
const float scl = 10.0;
|
|
||||||
float result = (snoise(vec3(coords.x / scl, coords.y / scl, u_time/400000.0)) + 1.0)/2.0;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, t);
|
|
||||||
|
|
||||||
if(result < u_progress){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if(result < u_progress*2.0 && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform vec2 u_uv;
|
|
||||||
uniform vec2 u_uv2;
|
|
||||||
uniform float u_progress;
|
|
||||||
uniform float u_time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
const float chunk = 4.0;
|
|
||||||
|
|
||||||
bool id(vec2 coords, vec4 base, float basediff){
|
|
||||||
vec4 target = texture2D(u_texture, coords);
|
|
||||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v, float basediff){
|
|
||||||
float step = 1.0;
|
|
||||||
vec4 base = texture2D(u_texture, T);
|
|
||||||
return base.a > 0.1 &&
|
|
||||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
|
||||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
|
||||||
}
|
|
||||||
|
|
||||||
float rand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
float round(float f){
|
|
||||||
return float(int(f / chunk)) * chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
|
|
||||||
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
|
|
||||||
|
|
||||||
float snoise(vec3 v){
|
|
||||||
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
|
|
||||||
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
|
|
||||||
|
|
||||||
// First corner
|
|
||||||
vec3 i = floor(v + dot(v, C.yyy) );
|
|
||||||
vec3 x0 = v - i + dot(i, C.xxx) ;
|
|
||||||
|
|
||||||
// Other corners
|
|
||||||
vec3 g = step(x0.yzx, x0.xyz);
|
|
||||||
vec3 l = 1.0 - g;
|
|
||||||
vec3 i1 = min( g.xyz, l.zxy );
|
|
||||||
vec3 i2 = max( g.xyz, l.zxy );
|
|
||||||
|
|
||||||
// x0 = x0 - 0. + 0.0 * C
|
|
||||||
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
|
|
||||||
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
|
|
||||||
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
|
|
||||||
|
|
||||||
// Permutations
|
|
||||||
i = mod(i, 289.0 );
|
|
||||||
vec4 p = permute( permute( permute(
|
|
||||||
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
|
|
||||||
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
|
|
||||||
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
|
|
||||||
|
|
||||||
// Gradients
|
|
||||||
// ( N*N points uniformly over a square, mapped onto an octahedron.)
|
|
||||||
float n_ = 1.0/7.0; // N=7
|
|
||||||
vec3 ns = n_ * D.wyz - D.xzx;
|
|
||||||
|
|
||||||
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
|
|
||||||
|
|
||||||
vec4 x_ = floor(j * ns.z);
|
|
||||||
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
|
|
||||||
|
|
||||||
vec4 x = x_ *ns.x + ns.yyyy;
|
|
||||||
vec4 y = y_ *ns.x + ns.yyyy;
|
|
||||||
vec4 h = 1.0 - abs(x) - abs(y);
|
|
||||||
|
|
||||||
vec4 b0 = vec4( x.xy, y.xy );
|
|
||||||
vec4 b1 = vec4( x.zw, y.zw );
|
|
||||||
|
|
||||||
vec4 s0 = floor(b0)*2.0 + 1.0;
|
|
||||||
vec4 s1 = floor(b1)*2.0 + 1.0;
|
|
||||||
vec4 sh = -step(h, vec4(0.0));
|
|
||||||
|
|
||||||
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
|
|
||||||
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
|
|
||||||
|
|
||||||
vec3 p0 = vec3(a0.xy,h.x);
|
|
||||||
vec3 p1 = vec3(a0.zw,h.y);
|
|
||||||
vec3 p2 = vec3(a1.xy,h.z);
|
|
||||||
vec3 p3 = vec3(a1.zw,h.w);
|
|
||||||
|
|
||||||
//Normalise gradients
|
|
||||||
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
|
||||||
p0 *= norm.x;
|
|
||||||
p1 *= norm.y;
|
|
||||||
p2 *= norm.z;
|
|
||||||
p3 *= norm.w;
|
|
||||||
|
|
||||||
// Mix final noise value
|
|
||||||
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
|
||||||
m = m * m;
|
|
||||||
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
|
||||||
dot(p2,x2), dot(p3,x3) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 t = v_texCoord.xy;
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
|
|
||||||
bool any = false;
|
|
||||||
|
|
||||||
vec2 coords = (v_texCoord-u_uv) / v;
|
|
||||||
|
|
||||||
/*
|
|
||||||
const float scl = 10.0;
|
|
||||||
float result = (snoise(vec3(coords.x / scl, coords.y / scl, u_time/400000.0)) + 1.0)/2.0;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, t);
|
|
||||||
|
|
||||||
if(result < u_progress){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if(result < u_progress*2.0 && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
float value = coords.x + coords.y;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, t);
|
|
||||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
|
||||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
|
||||||
|
|
||||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
|
||||||
|
|
||||||
const float start = 0.7;
|
|
||||||
const float end = 0.9;
|
|
||||||
|
|
||||||
const float scl = 10.0;
|
|
||||||
float result = snoise(vec3(coords.x / scl, coords.y / scl, u_time/400.0))*2.0;
|
|
||||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
|
||||||
|
|
||||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(r > end){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if(cont(t, v, 100.0) && mod(u_time / 1.5 + value, 20.0) < 5.0 && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(r > start && color.a > 0.1){
|
|
||||||
float fr = (r-start)*(1.0/(end-start));
|
|
||||||
|
|
||||||
vec2 next = rc + chunk/2.0;
|
|
||||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y)) + result;
|
|
||||||
if(rdst / (chunk/2.0) < fr){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if(mod(u_time / 1.5 + value, 30.0) < 15.0 && color.a > 0.1){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
}else if(cont(t, v, 3.0)){
|
|
||||||
gl_FragColor = color;
|
|
||||||
}else if(cont(t, v, 1.5)){
|
|
||||||
gl_FragColor = u_color;
|
|
||||||
//}else if(mix(rand(vec2(dst)) * u_progress, 1.0, u_progress) > 0.5){
|
|
||||||
// gl_FragColor = texture2D(u_texture, T);
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision highp float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define s2 vec4(255.0, 165.0, 0.0, 255.0) / 255.0
|
|
||||||
#define s1 vec4(255.0, 121.0, 62.0, 255.0) / 255.0
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec2 camerapos;
|
|
||||||
uniform vec2 screensize;
|
|
||||||
uniform float time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
float round(float num, float f){
|
|
||||||
return float(int(num / f)) * f;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
|
||||||
|
|
||||||
float snoise(vec2 v){
|
|
||||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
||||||
-0.577350269189626, 0.024390243902439);
|
|
||||||
vec2 i = floor(v + dot(v, C.yy) );
|
|
||||||
vec2 x0 = v - i + dot(i, C.xx);
|
|
||||||
vec2 i1;
|
|
||||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
||||||
vec4 x12 = x0.xyxy + C.xxzz;
|
|
||||||
x12.xy -= i1;
|
|
||||||
i = mod(i, 289.0);
|
|
||||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
|
||||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
|
||||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
|
||||||
dot(x12.zw,x12.zw)), 0.0);
|
|
||||||
m = m*m ;
|
|
||||||
m = m*m ;
|
|
||||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
||||||
vec3 h = abs(x) - 0.5;
|
|
||||||
vec3 ox = floor(x + 0.5);
|
|
||||||
vec3 a0 = x - ox;
|
|
||||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
|
||||||
vec3 g;
|
|
||||||
g.x = a0.x * x0.x + h.x * x0.y;
|
|
||||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
||||||
return 130.0 * dot(m, g);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 c = v_texCoord.xy;
|
|
||||||
vec4 color = texture2D(u_texture, c);
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
|
||||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
|
||||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
|
||||||
|
|
||||||
float stime = time / 5.0;
|
|
||||||
|
|
||||||
float mscl = 30.0;
|
|
||||||
float mth = 5.0;
|
|
||||||
|
|
||||||
//if there's something actually there
|
|
||||||
if(color.r > 0.01){
|
|
||||||
vec4 old = color;
|
|
||||||
color = texture2D(u_texture, c + vec2(sin(stime/3.0 + coords.y/0.75) * v.x, 0.0)) * vec4(0.9, 0.9, 1, 1.0);
|
|
||||||
color.a = 1.0;
|
|
||||||
|
|
||||||
if(color.r < 0.01){
|
|
||||||
color = old;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float bs = 1.0;
|
|
||||||
|
|
||||||
float n1 = snoise(coords / (20.0 * bs) + vec2(time) / 250.0);
|
|
||||||
float n2 = snoise((coords + vec2(632.0)) / (9.0 * bs) + vec2(0.0, -time) / 220.0);
|
|
||||||
float n3 = snoise((coords + vec2(2233.0)) / (15.0 * bs) + vec2(time, 0.0) / 290.0);
|
|
||||||
|
|
||||||
float r = (n1 + n2 + n3) / 3.0;
|
|
||||||
|
|
||||||
if(r < -0.5){
|
|
||||||
color = s2;
|
|
||||||
}else if(r < -0.2){
|
|
||||||
color = s1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = color;
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ void main() {
|
|||||||
|
|
||||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||||
|
|
||||||
c = mix(c, vec4(u_color.r, u_color.g, u_color.b, c.a), v_color.a);
|
c = mix(c, vec4(u_color.rgb, c.a), v_color.a);
|
||||||
|
|
||||||
gl_FragColor = c * vec4(v_color.rgb, 1.0);
|
gl_FragColor = c * vec4(v_color.rgb, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision highp float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define s1 vec4(63.0, 63.0, 63.0, 255.0) / 255.0
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec2 camerapos;
|
|
||||||
uniform vec2 screensize;
|
|
||||||
uniform float time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
float round(float num, float f){
|
|
||||||
return float(int(num / f)) * f;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
|
||||||
|
|
||||||
float snoise(vec2 v){
|
|
||||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
||||||
-0.577350269189626, 0.024390243902439);
|
|
||||||
vec2 i = floor(v + dot(v, C.yy) );
|
|
||||||
vec2 x0 = v - i + dot(i, C.xx);
|
|
||||||
vec2 i1;
|
|
||||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
||||||
vec4 x12 = x0.xyxy + C.xxzz;
|
|
||||||
x12.xy -= i1;
|
|
||||||
i = mod(i, 289.0);
|
|
||||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
|
||||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
|
||||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
|
||||||
dot(x12.zw,x12.zw)), 0.0);
|
|
||||||
m = m*m ;
|
|
||||||
m = m*m ;
|
|
||||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
||||||
vec3 h = abs(x) - 0.5;
|
|
||||||
vec3 ox = floor(x + 0.5);
|
|
||||||
vec3 a0 = x - ox;
|
|
||||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
|
||||||
vec3 g;
|
|
||||||
g.x = a0.x * x0.x + h.x * x0.y;
|
|
||||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
||||||
return 130.0 * dot(m, g);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 c = v_texCoord.xy;
|
|
||||||
vec4 color = texture2D(u_texture, c);
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
|
||||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
|
||||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
|
||||||
|
|
||||||
float stime = time / 5.0;
|
|
||||||
|
|
||||||
float mscl = 30.0;
|
|
||||||
float mth = 5.0;
|
|
||||||
|
|
||||||
//if there's something actually there
|
|
||||||
if(color.r > 0.01){
|
|
||||||
vec4 old = color;
|
|
||||||
color = texture2D(u_texture, c + vec2(sin(stime/3.0 + coords.y/0.75) * v.x, 0.0)) * vec4(0.9, 0.9, 1, 1.0);
|
|
||||||
color.a = 1.0;
|
|
||||||
|
|
||||||
if(color.r < 0.01){
|
|
||||||
color = old;
|
|
||||||
}
|
|
||||||
|
|
||||||
float n1 = snoise(coords / 22.0 + vec2(-time) / 540.0);
|
|
||||||
float n2 = snoise((coords + vec2(632.0)) / 8.0 + vec2(0.0, time) / 510.0);
|
|
||||||
|
|
||||||
float r = (n1 + n2) / 2.0;
|
|
||||||
|
|
||||||
if(r < -0.3 && r > -0.6){
|
|
||||||
color *= 1.4;
|
|
||||||
color.a = 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = color;
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec4 u_color;
|
|
||||||
uniform vec2 u_texsize;
|
|
||||||
uniform float u_time;
|
|
||||||
uniform vec2 u_offset;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 T = v_texCoord.xy;
|
|
||||||
vec2 coords = (T * u_texsize) + u_offset;
|
|
||||||
|
|
||||||
float si = 1.0 + sin(u_time / 20.0 /*+ (coords.x + coords.y) / 30.0*/) / 8.0;
|
|
||||||
|
|
||||||
vec4 color = texture2D(u_texture, T) * vec4(si, si, si, 1.0);
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
|
||||||
|
|
||||||
bool any = false;
|
|
||||||
|
|
||||||
float thickness = 1.0;
|
|
||||||
float step = 1.0;
|
|
||||||
|
|
||||||
if(texture2D(u_texture, T).a < 0.1 &&
|
|
||||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
|
||||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.1 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.1))
|
|
||||||
any = true;
|
|
||||||
|
|
||||||
if(any){
|
|
||||||
gl_FragColor = u_color * vec4(si, si, si, 1.0);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
//coords.x = float(int(coords.x));
|
|
||||||
if(color.a > 0.1){
|
|
||||||
float x = coords.x;
|
|
||||||
float y = coords.y;
|
|
||||||
float time = u_time;
|
|
||||||
float w = 1.0;
|
|
||||||
float h = 1.0;
|
|
||||||
float f1 = sin(2.0*time+(y/4.0*cos(time/3.0)+(x/2.0)-w/4.0)*((y/3.0)-h/4.0)/w);
|
|
||||||
float f2 = -2.0*cos(11.0*time/9.0-11.0*pow(y, x)/9.0);
|
|
||||||
|
|
||||||
color.r = (f2 + f1) / 4.0*abs(cos(2.0*(x-y)/w + time));
|
|
||||||
color.g = (f2 + f1) /(3.0 + color.r);
|
|
||||||
color.b = (f2 + f1) /(2.5 + color.g);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision highp float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define s1 vec4(63.0, 63.0, 63.0, 255.0) / 255.0
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec2 u_center;
|
|
||||||
uniform vec2 camerapos;
|
|
||||||
uniform vec2 screensize;
|
|
||||||
uniform float time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
float round(float num, float f){
|
|
||||||
return float(int(num / f)) * f;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
|
||||||
|
|
||||||
float snoise(vec2 v){
|
|
||||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
||||||
-0.577350269189626, 0.024390243902439);
|
|
||||||
vec2 i = floor(v + dot(v, C.yy) );
|
|
||||||
vec2 x0 = v - i + dot(i, C.xx);
|
|
||||||
vec2 i1;
|
|
||||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
||||||
vec4 x12 = x0.xyxy + C.xxzz;
|
|
||||||
x12.xy -= i1;
|
|
||||||
i = mod(i, 289.0);
|
|
||||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
|
||||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
|
||||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
|
||||||
dot(x12.zw,x12.zw)), 0.0);
|
|
||||||
m = m*m ;
|
|
||||||
m = m*m ;
|
|
||||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
||||||
vec3 h = abs(x) - 0.5;
|
|
||||||
vec3 ox = floor(x + 0.5);
|
|
||||||
vec3 a0 = x - ox;
|
|
||||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
|
||||||
vec3 g;
|
|
||||||
g.x = a0.x * x0.x + h.x * x0.y;
|
|
||||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
||||||
return 130.0 * dot(m, g);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 c = v_texCoord.xy;
|
|
||||||
vec4 color = texture2D(u_texture, c);
|
|
||||||
|
|
||||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
|
||||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
|
||||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
|
||||||
|
|
||||||
float stime = time / 5.0;
|
|
||||||
|
|
||||||
float mscl = 30.0;
|
|
||||||
float mth = 5.0;
|
|
||||||
|
|
||||||
//if there's something actually there
|
|
||||||
if(color.a > 0.01){
|
|
||||||
vec2 diff = camerapos + screensize/2.0 - u_center;
|
|
||||||
|
|
||||||
float dst = mod((distance(coords, camerapos + screensize/2.0 - diff/5.0) + time * 2.0 + snoise(coords / 100.0) * 10.0), 150.0);
|
|
||||||
|
|
||||||
if(dst < 40.0){
|
|
||||||
color = vec4(vec3(0.2), 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = color;
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision highp float;
|
|
||||||
precision mediump int;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
uniform vec2 u_center;
|
|
||||||
uniform vec2 camerapos;
|
|
||||||
uniform vec2 screensize;
|
|
||||||
uniform float time;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoord;
|
|
||||||
|
|
||||||
const float tau = 6.28318530717958647692;
|
|
||||||
const float tscl = 0.4;
|
|
||||||
|
|
||||||
// Gamma correction
|
|
||||||
#define GAMMA (2.2)
|
|
||||||
|
|
||||||
vec3 ToLinear(vec3 col ){
|
|
||||||
// simulate a monitor, converting colour values into light values
|
|
||||||
return pow( col, vec3(GAMMA) );
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 ToGamma(vec3 col ){
|
|
||||||
// convert back into colour values, so the correct light will come out of the monitor
|
|
||||||
return pow( col, vec3(1.0/GAMMA) );
|
|
||||||
}
|
|
||||||
|
|
||||||
float srand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 Noise(ivec2 x ){
|
|
||||||
return vec4(srand((vec2(x)+0.5)/256.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(){
|
|
||||||
vec4 resultc = texture2D(u_texture, v_texCoord.xy);
|
|
||||||
|
|
||||||
if(resultc.a > 0.0){
|
|
||||||
|
|
||||||
vec2 coords = v_texCoord.xy*screensize;
|
|
||||||
|
|
||||||
vec3 ray;
|
|
||||||
ray.xy = 2.0*(coords-screensize.xy*.5)/screensize.x;
|
|
||||||
ray.z = 1.0;
|
|
||||||
|
|
||||||
float literallyzero = 0.000000000001;
|
|
||||||
|
|
||||||
float offset = time/60.0*.5 * tscl + camerapos.x * u_center.x * resultc.r * literallyzero;
|
|
||||||
float speed2 = 0.3;
|
|
||||||
float speed = speed2+.1;
|
|
||||||
offset += .1;
|
|
||||||
offset *= 2.0;
|
|
||||||
|
|
||||||
vec3 col = vec3(0.0);
|
|
||||||
|
|
||||||
vec3 stp = ray/max(abs(ray.x),abs(ray.y));
|
|
||||||
|
|
||||||
vec3 pos = 2.0*stp+.5;
|
|
||||||
for ( int i=0; i < 20; i++){
|
|
||||||
float z = Noise(ivec2(pos.xy)).x;
|
|
||||||
z = fract(z-offset);
|
|
||||||
float d = 50.0*z-pos.z;
|
|
||||||
float w = pow(max(0.0,1.0-8.0*length(fract(pos.xy)-.5)),2.0);
|
|
||||||
vec3 c = max(vec3(0),vec3(1.0-abs(d+speed2*.5)/speed,1.0-abs(d)/speed,1.0-abs(d-speed2*.5)/speed));
|
|
||||||
col += 1.5*(1.0-z)*c*w;
|
|
||||||
pos += stp;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 color = ToGamma(col);
|
|
||||||
|
|
||||||
if(color.r > 0.3 && color.b > 0.3){
|
|
||||||
color = vec3(240.0, 245.0, 255.0) / 255.0;
|
|
||||||
}else{
|
|
||||||
color = vec3(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = vec4(color,1.0);
|
|
||||||
}else{
|
|
||||||
gl_FragColor = vec4(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,22 +17,19 @@ uniform vec2 u_texsize;
|
|||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
bool id(vec4 v){
|
#define SPACE 0.75
|
||||||
return v.a > 0.1;
|
#define RADIUS 5.0
|
||||||
}
|
|
||||||
|
|
||||||
bool id(vec2 coords, vec4 base){
|
bool cont(vec2 t, vec2 v){
|
||||||
vec4 target = texture2D(u_texture, coords);
|
|
||||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cont(vec2 T, vec2 v){
|
for(float cx = -RADIUS; cx <= RADIUS; cx ++){
|
||||||
vec4 base = texture2D(u_texture, T);
|
for(float cy = -RADIUS; cy <= RADIUS; cy ++){
|
||||||
return base.a > 0.1 &&
|
if(cx*cx + cy*cy <= RADIUS * RADIUS && texture2D(u_texture, v_texCoord.xy + vec2(cx, cy) * v * SPACE).a <= 0.001){
|
||||||
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
return true;
|
||||||
id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base) ||
|
}
|
||||||
id(T + vec2(step, step) * v, base) || id(T + vec2(-step, -step) * v, base) ||
|
}
|
||||||
id(T + vec2(step, -step) * v, base) || id(T + vec2(-step, step) * v, base));
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
#endif
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoords;
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
uniform float u_time;
|
|
||||||
|
|
||||||
float round(float f, float v){
|
|
||||||
return float(int(f / v)) * v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(){
|
|
||||||
vec2 r = v_texCoords.xy;
|
|
||||||
vec4 c = v_color * texture2D(u_texture, v_texCoords.xy);
|
|
||||||
gl_FragColor = c * vec4(vec3(round(1.0 + sin((r.x + r.y) * 404.0 + u_time / 20.0) / 10.0, 0.05)), 1.0);
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
@@ -206,16 +206,13 @@ public class Mechs implements ContentList{
|
|||||||
public void draw(Player player){
|
public void draw(Player player){
|
||||||
if(player.shootHeat <= 0.01f) return;
|
if(player.shootHeat <= 0.01f) return;
|
||||||
|
|
||||||
float alpha = Draw.getColor().a;
|
|
||||||
Shaders.build.progress = player.shootHeat;
|
Shaders.build.progress = player.shootHeat;
|
||||||
Shaders.build.region = armorRegion;
|
Shaders.build.region = armorRegion;
|
||||||
Shaders.build.time = Time.time() / 10f;
|
Shaders.build.time = Time.time() / 10f;
|
||||||
Shaders.build.color.set(Pal.accent).a = player.shootHeat;
|
Shaders.build.color.set(Pal.accent).a = player.shootHeat;
|
||||||
Draw.shader(Shaders.build);
|
Draw.shader(Shaders.build);
|
||||||
Draw.alpha(1f);
|
|
||||||
Draw.rect(armorRegion, player.x, player.y, player.rotation);
|
Draw.rect(armorRegion, player.x, player.y, player.rotation);
|
||||||
Draw.shader(Shaders.mix);
|
Draw.shader();
|
||||||
Draw.color(1f, 1f, 1f, alpha);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,16 +292,11 @@ public class Mechs implements ContentList{
|
|||||||
public void draw(Player player){
|
public void draw(Player player){
|
||||||
float scl = scld(player);
|
float scl = scld(player);
|
||||||
if(scl < 0.01f) return;
|
if(scl < 0.01f) return;
|
||||||
float alpha = Draw.getColor().a;
|
|
||||||
Draw.shader();
|
|
||||||
Draw.color(Pal.lancerLaser);
|
Draw.color(Pal.lancerLaser);
|
||||||
Draw.alpha(scl/2f);
|
Draw.alpha(scl/2f);
|
||||||
Draw.blend(Blending.additive);
|
Draw.blend(Blending.additive);
|
||||||
Draw.rect(shield, player.x + Mathf.range(scl/2f), player.y + Mathf.range(scl/2f), player.rotation - 90);
|
Draw.rect(shield, player.x + Mathf.range(scl/2f), player.y + Mathf.range(scl/2f), player.rotation - 90);
|
||||||
Draw.blend();
|
Draw.blend();
|
||||||
Draw.shader(Shaders.mix);
|
|
||||||
Draw.color();
|
|
||||||
Draw.alpha(alpha);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float scld(Player player){
|
float scld(Player player){
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ public class Control implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !ui.chatfrag.chatOpen()){
|
if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !ui.chatfrag.chatOpen()){
|
||||||
renderer.takeMapScreenshot();
|
//renderer.takeMapScreenshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package io.anuke.mindustry.core;
|
|||||||
|
|
||||||
import io.anuke.arc.ApplicationListener;
|
import io.anuke.arc.ApplicationListener;
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.Consumer;
|
||||||
import io.anuke.arc.function.Predicate;
|
import io.anuke.arc.function.Predicate;
|
||||||
import io.anuke.arc.graphics.Camera;
|
import io.anuke.arc.graphics.Camera;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
|
import io.anuke.arc.graphics.Pixmap;
|
||||||
|
import io.anuke.arc.graphics.PixmapIO;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.Lines;
|
import io.anuke.arc.graphics.g2d.Lines;
|
||||||
import io.anuke.arc.graphics.g2d.SpriteBatch;
|
import io.anuke.arc.graphics.g2d.SpriteBatch;
|
||||||
@@ -13,9 +16,7 @@ import io.anuke.arc.graphics.glutils.FrameBuffer;
|
|||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.Rectangle;
|
import io.anuke.arc.math.geom.Rectangle;
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
import io.anuke.arc.math.geom.Vector2;
|
||||||
import io.anuke.arc.util.ScreenRecorder;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.arc.util.Tmp;
|
|
||||||
import io.anuke.arc.util.pooling.Pools;
|
import io.anuke.arc.util.pooling.Pools;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
@@ -256,12 +257,8 @@ public class Renderer implements ApplicationListener{
|
|||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawUnder);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawUnder);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team && !p.isDead(), Unit::drawUnder);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team && !p.isDead(), Unit::drawUnder);
|
||||||
|
|
||||||
Shaders.mix.color.set(Color.WHITE);
|
|
||||||
|
|
||||||
Draw.shader(Shaders.mix, true);
|
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawAll);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawAll);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawAll);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawAll);
|
||||||
Draw.shader();
|
|
||||||
blocks.drawTeamBlocks(Layer.turret, team);
|
blocks.drawTeamBlocks(Layer.turret, team);
|
||||||
|
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawOver);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawOver);
|
||||||
@@ -296,31 +293,38 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void takeMapScreenshot(){
|
public void takeMapScreenshot(){
|
||||||
//TODO fix/implement
|
//TODO implement properly
|
||||||
/*
|
|
||||||
float vpW = camera.width, vpH = camera.height;
|
float vpW = camera.width, vpH = camera.height;
|
||||||
int w = world.width()*tilesize, h = world.height()*tilesize;
|
int w = world.width()*tilesize, h = world.height()*tilesize;
|
||||||
int pw = pixelSurface.width(), ph = pixelSurface.height();
|
|
||||||
disableUI = true;
|
disableUI = true;
|
||||||
pixelSurface.setSize(w, h, true);
|
|
||||||
Graphics.getEffectSurface().setSize(w, h, true);
|
FrameBuffer buffer = new FrameBuffer(w, h);
|
||||||
|
Vector2 prev = camera.position.cpy();
|
||||||
|
|
||||||
camera.width = w;
|
camera.width = w;
|
||||||
camera.height = h;
|
camera.height = h;
|
||||||
camera.position.x = w/2f + tilesize/2f;
|
camera.position.x = w/2f + tilesize/2f;
|
||||||
camera.position.y = h/2f + tilesize/2f;
|
camera.position.y = h/2f + tilesize/2f;
|
||||||
|
|
||||||
|
buffer.begin();
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
blocks.drawShadows();
|
||||||
|
|
||||||
|
buffer.end();
|
||||||
|
|
||||||
disableUI = false;
|
disableUI = false;
|
||||||
camera.width = vpW;
|
camera.width = vpW;
|
||||||
camera.height = vpH;
|
camera.height = vpH;
|
||||||
|
|
||||||
pixelSurface.getBuffer().begin();
|
buffer.begin();
|
||||||
byte[] lines = ScreenUtils.getFrameBufferPixels(0, 0, w, h, true);
|
byte[] lines = ScreenUtils.getFrameBufferPixels(0, 0, w, h, true);
|
||||||
for(int i = 0; i < lines.length; i+= 4){
|
for(int i = 0; i < lines.length; i+= 4){
|
||||||
lines[i + 3] = (byte)255;
|
lines[i + 3] = (byte)255;
|
||||||
}
|
}
|
||||||
pixelSurface.getBuffer().end();
|
buffer.end();
|
||||||
|
|
||||||
Pixmap fullPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
|
Pixmap fullPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
|
||||||
|
|
||||||
@@ -329,10 +333,10 @@ public class Renderer implements ApplicationListener{
|
|||||||
PixmapIO.writePNG(file, fullPixmap);
|
PixmapIO.writePNG(file, fullPixmap);
|
||||||
fullPixmap.dispose();
|
fullPixmap.dispose();
|
||||||
|
|
||||||
pixelSurface.setSize(pw, ph, false);
|
buffer.dispose();
|
||||||
Graphics.getEffectSurface().setSize(pw, ph, false);
|
camera.position.set(prev);
|
||||||
|
|
||||||
ui.showInfoFade(Core.bundle.format("screenshot", file.toString()));*/
|
ui.showInfoFade(Core.bundle.format("screenshot", file.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import io.anuke.mindustry.entities.Units;
|
|||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||||
|
|
||||||
@@ -113,13 +112,13 @@ public abstract class FlyingUnit extends BaseUnit{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
|
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
|
||||||
Draw.rect(type.region, x, y, rotation - 90);
|
Draw.rect(type.region, x, y, rotation - 90);
|
||||||
|
|
||||||
drawWeapons();
|
drawWeapons();
|
||||||
drawItems();
|
drawItems();
|
||||||
|
|
||||||
Draw.alpha(1f);
|
Draw.mixcol();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawWeapons(){
|
public void drawWeapons(){
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import io.anuke.mindustry.entities.Units;
|
|||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
|
||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
import io.anuke.mindustry.world.blocks.Floor;
|
||||||
@@ -109,14 +108,14 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
|
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
|
||||||
|
|
||||||
float ft = Mathf.sin(walkTime * type.speed*5f, 6f, 2f + type.hitsize/15f);
|
float ft = Mathf.sin(walkTime * type.speed*5f, 6f, 2f + type.hitsize/15f);
|
||||||
|
|
||||||
Floor floor = getFloorOn();
|
Floor floor = getFloorOn();
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
|
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
@@ -127,9 +126,9 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.tint(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
|
Draw.color(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
|
||||||
}else{
|
}else{
|
||||||
Draw.tint(Color.WHITE);
|
Draw.color(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.rect(type.baseRegion, x, y, baseRotation - 90);
|
Draw.rect(type.baseRegion, x, y, baseRotation - 90);
|
||||||
@@ -146,7 +145,7 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
|
|
||||||
drawItems();
|
drawItems();
|
||||||
|
|
||||||
Draw.alpha(1f);
|
Draw.mixcol();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import io.anuke.mindustry.entities.traits.TargetTrait;
|
|||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
|
||||||
import io.anuke.mindustry.input.Binding;
|
import io.anuke.mindustry.input.Binding;
|
||||||
import io.anuke.mindustry.io.TypeIO;
|
import io.anuke.mindustry.io.TypeIO;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
@@ -285,11 +284,11 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
Floor floor = getFloorOn();
|
Floor floor = getFloorOn();
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
|
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
|
||||||
|
|
||||||
if(!mech.flying){
|
if(!mech.flying){
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
|
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float boostTrnsY = -boostHeat * 3f;
|
float boostTrnsY = -boostHeat * 3f;
|
||||||
@@ -309,9 +308,9 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.tint(Color.WHITE, floor.liquidColor, drownTime);
|
Draw.color(Color.WHITE, floor.liquidColor, drownTime);
|
||||||
}else{
|
}else{
|
||||||
Draw.tint(Color.WHITE);
|
Draw.color(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.rect(mech.region, x, y, rotation - 90);
|
Draw.rect(mech.region, x, y, rotation - 90);
|
||||||
@@ -344,13 +343,12 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.alpha(1f);
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawStats(){
|
public void drawStats(){
|
||||||
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf()));
|
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf()));
|
||||||
Draw.alpha(hitTime / hitDuration);
|
|
||||||
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,7 +365,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
|
|
||||||
public void drawStats(){
|
public void drawStats(){
|
||||||
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf()*5f, 1f - healthf()));
|
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf()*5f, 1f - healthf()));
|
||||||
Draw.alpha(hitTime);
|
|
||||||
Draw.rect(getPowerCellRegion(), x, y, rotation - 90);
|
Draw.rect(getPowerCellRegion(), x, y, rotation - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,43 @@ import io.anuke.arc.graphics.glutils.Shader;
|
|||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.Matrix3;
|
import io.anuke.arc.math.Matrix3;
|
||||||
import io.anuke.arc.util.Disposable;
|
import io.anuke.arc.util.Disposable;
|
||||||
|
import io.anuke.arc.util.Strings;
|
||||||
|
|
||||||
//TODO this class is a trainwreck, remove it
|
//TODO this class is a trainwreck, remove it
|
||||||
public class IndexedRenderer implements Disposable{
|
public class IndexedRenderer implements Disposable{
|
||||||
private final static int vsize = 5;
|
private final static int vsize = 5;
|
||||||
|
|
||||||
private Shader program = BatchShader.create();
|
private Shader program = new Shader(
|
||||||
|
Strings.join("\n",
|
||||||
|
"attribute vec4 " + Shader.POSITION_ATTRIBUTE + ";",
|
||||||
|
"attribute vec4 " + Shader.COLOR_ATTRIBUTE + ";",
|
||||||
|
"attribute vec2 " + Shader.TEXCOORD_ATTRIBUTE + "0;",
|
||||||
|
"uniform mat4 u_projTrans;",
|
||||||
|
"varying vec4 v_color;",
|
||||||
|
"varying vec2 v_texCoords;",
|
||||||
|
"",
|
||||||
|
"void main(){",
|
||||||
|
" v_color = " + Shader.COLOR_ATTRIBUTE + ";",
|
||||||
|
" v_color.a = v_color.a * (255.0/254.0);",
|
||||||
|
" v_texCoords = " + Shader.TEXCOORD_ATTRIBUTE + "0;",
|
||||||
|
" gl_Position = u_projTrans * " + Shader.POSITION_ATTRIBUTE + ";",
|
||||||
|
"}"),
|
||||||
|
Strings.join("\n",
|
||||||
|
"#ifdef GL_ES",
|
||||||
|
"#define LOWP lowp",
|
||||||
|
"precision mediump float;",
|
||||||
|
"#else",
|
||||||
|
"#define LOWP ",
|
||||||
|
"#endif",
|
||||||
|
"",
|
||||||
|
"varying LOWP vec4 v_color;",
|
||||||
|
"varying vec2 v_texCoords;",
|
||||||
|
"uniform sampler2D u_texture;",
|
||||||
|
"",
|
||||||
|
"void main(){",
|
||||||
|
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);",
|
||||||
|
"}"
|
||||||
|
));
|
||||||
private Mesh mesh;
|
private Mesh mesh;
|
||||||
private float[] tmpVerts = new float[vsize * 6];
|
private float[] tmpVerts = new float[vsize * 6];
|
||||||
private float[] vertices;
|
private float[] vertices;
|
||||||
|
|||||||
@@ -10,23 +10,17 @@ import io.anuke.arc.util.Time;
|
|||||||
public class Shaders{
|
public class Shaders{
|
||||||
public static Shadow shadow;
|
public static Shadow shadow;
|
||||||
public static BlockBuild blockbuild;
|
public static BlockBuild blockbuild;
|
||||||
public static BlockPreview blockpreview;
|
|
||||||
public static Shield shield;
|
public static Shield shield;
|
||||||
public static UnitBuild build;
|
public static UnitBuild build;
|
||||||
public static MixShader mix;
|
|
||||||
public static Shader fullMix;
|
|
||||||
public static FogShader fog;
|
public static FogShader fog;
|
||||||
public static MenuShader menu;
|
public static MenuShader menu;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
shadow = new Shadow();
|
shadow = new Shadow();
|
||||||
blockbuild = new BlockBuild();
|
blockbuild = new BlockBuild();
|
||||||
blockpreview = new BlockPreview();
|
|
||||||
shield = new Shield();
|
shield = new Shield();
|
||||||
build = new UnitBuild();
|
build = new UnitBuild();
|
||||||
mix = new MixShader();
|
|
||||||
fog = new FogShader();
|
fog = new FogShader();
|
||||||
fullMix = new LoadShader("fullmix", "default");
|
|
||||||
menu = new MenuShader();
|
menu = new MenuShader();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,27 +49,13 @@ public class Shaders{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MixShader extends LoadShader{
|
|
||||||
public Color color = new Color(Color.WHITE);
|
|
||||||
|
|
||||||
public MixShader(){
|
|
||||||
super("mix", "default");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(){
|
|
||||||
super.apply();
|
|
||||||
setUniformf("u_color", color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class UnitBuild extends LoadShader{
|
public static class UnitBuild extends LoadShader{
|
||||||
public float progress, time;
|
public float progress, time;
|
||||||
public Color color = new Color();
|
public Color color = new Color();
|
||||||
public TextureRegion region;
|
public TextureRegion region;
|
||||||
|
|
||||||
public UnitBuild(){
|
public UnitBuild(){
|
||||||
super("build", "default");
|
super("unitbuild", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -126,23 +106,6 @@ public class Shaders{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlockPreview extends LoadShader{
|
|
||||||
public Color color = new Color();
|
|
||||||
public TextureRegion region = new TextureRegion();
|
|
||||||
|
|
||||||
public BlockPreview(){
|
|
||||||
super("blockpreview", "default");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(){
|
|
||||||
setUniformf("u_color", color);
|
|
||||||
setUniformf("u_uv", region.getU(), region.getV());
|
|
||||||
setUniformf("u_uv2", region.getU2(), region.getV2());
|
|
||||||
setUniformf("u_texsize", region.getTexture().getWidth(), region.getTexture().getHeight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Shield extends LoadShader{
|
public static class Shield extends LoadShader{
|
||||||
|
|
||||||
public Shield(){
|
public Shield(){
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import io.anuke.mindustry.entities.type.Player;
|
|||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.entities.type.TileEntity;
|
||||||
import io.anuke.mindustry.entities.type.Unit;
|
import io.anuke.mindustry.entities.type.Unit;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
|
||||||
import io.anuke.mindustry.input.PlaceUtils.NormalizeDrawResult;
|
import io.anuke.mindustry.input.PlaceUtils.NormalizeDrawResult;
|
||||||
import io.anuke.mindustry.input.PlaceUtils.NormalizeResult;
|
import io.anuke.mindustry.input.PlaceUtils.NormalizeResult;
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||||
@@ -175,7 +174,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
float offset = request.block.offset();
|
float offset = request.block.offset();
|
||||||
TextureRegion region = request.block.icon(Icon.full);
|
TextureRegion region = request.block.icon(Icon.full);
|
||||||
|
|
||||||
Draw.alpha(Mathf.clamp((1f - request.scale) / 0.5f));
|
Draw.mixcol(Pal.accent, Mathf.clamp((1f - request.scale) / 0.5f));
|
||||||
Draw.tint(Color.WHITE, Pal.breakInvalid, request.redness);
|
Draw.tint(Color.WHITE, Pal.breakInvalid, request.redness);
|
||||||
|
|
||||||
Draw.rect(region, tile.worldx() + offset, tile.worldy() + offset,
|
Draw.rect(region, tile.worldx() + offset, tile.worldy() + offset,
|
||||||
@@ -183,7 +182,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
region.getHeight() * request.scale * Draw.scl,
|
region.getHeight() * request.scale * Draw.scl,
|
||||||
request.block.rotate ? request.rotation * 90 : 0);
|
request.block.rotate ? request.rotation * 90 : 0);
|
||||||
|
|
||||||
Draw.alpha(1f);
|
Draw.mixcol(Pal.accent, 1f);
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 4; i++){
|
||||||
Point2 p = Geometry.d8edge[i];
|
Point2 p = Geometry.d8edge[i];
|
||||||
float poffset = -Math.max(request.block.size-1, 0)/2f * tilesize;
|
float poffset = -Math.max(request.block.size-1, 0)/2f * tilesize;
|
||||||
@@ -194,7 +193,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}else{
|
}else{
|
||||||
float rad = (tile.block().size * tilesize / 2f - 1) * request.scale;
|
float rad = (tile.block().size * tilesize / 2f - 1) * request.scale;
|
||||||
Draw.alpha(0f);
|
Draw.mixcol();
|
||||||
//draw removing request
|
//draw removing request
|
||||||
Draw.tint(Pal.removeBack);
|
Draw.tint(Pal.removeBack);
|
||||||
Lines.square(tile.drawx(), tile.drawy()-1, rad);
|
Lines.square(tile.drawx(), tile.drawy()-1, rad);
|
||||||
@@ -289,9 +288,6 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
public void drawOutlined(){
|
public void drawOutlined(){
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
|
||||||
Shaders.mix.color.set(Pal.accent);
|
|
||||||
Draw.shader(Shaders.mix);
|
|
||||||
|
|
||||||
//draw removals
|
//draw removals
|
||||||
for(PlaceRequest request : removals){
|
for(PlaceRequest request : removals){
|
||||||
Tile tile = request.tile();
|
Tile tile = request.tile();
|
||||||
@@ -323,13 +319,12 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
//draw last placed request
|
//draw last placed request
|
||||||
if(!request.remove && request == lastPlaced && request.block != null){
|
if(!request.remove && request == lastPlaced && request.block != null){
|
||||||
Draw.alpha(0f);
|
Draw.mixcol();
|
||||||
request.block.drawPlace(tile.x, tile.y, rotation, validPlace(tile.x, tile.y, request.block, rotation));
|
request.block.drawPlace(tile.x, tile.y, rotation, validPlace(tile.x, tile.y, request.block, rotation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.shader();
|
Draw.mixcol();
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
|
|
||||||
//Draw lines
|
//Draw lines
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class MechPad extends Block{
|
|||||||
TextureRegion region = mech.iconRegion;
|
TextureRegion region = mech.iconRegion;
|
||||||
|
|
||||||
if(entity.player.mech == mech){
|
if(entity.player.mech == mech){
|
||||||
region = (entity.player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop).iconRegion;
|
region = (entity.player.mech == Mechs.starterDesktop ? Mechs.starterMobile : Mechs.starterDesktop).iconRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shaders.build.region = region;
|
Shaders.build.region = region;
|
||||||
|
|||||||