mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-15 18:12:08 -05:00
Upload files to "semag/mind/assets/shaders"
This commit is contained in:
parent
3882f09cbf
commit
e6f52bb86b
16
semag/mind/assets/shaders/default.vertex
Normal file
16
semag/mind/assets/shaders/default.vertex
Normal file
@ -0,0 +1,16 @@
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord0;
|
||||
attribute vec4 a_color;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
uniform vec2 u_viewportInverse;
|
||||
|
||||
void main() {
|
||||
gl_Position = u_projTrans * a_position;
|
||||
v_texCoord = a_texCoord0;
|
||||
v_color = a_color;
|
||||
}
|
44
semag/mind/assets/shaders/outline.fragment
Normal file
44
semag/mind/assets/shaders/outline.fragment
Normal file
@ -0,0 +1,44 @@
|
||||
#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_lighten;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
bool id(vec4 v){
|
||||
return v.a > 0.1 && !(v.r < 0.01 && v.g < 0.01 && v.b < 0.01);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 T = v_texCoord.xy;
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
bool any = false;
|
||||
|
||||
float step = 1.0;
|
||||
|
||||
vec4 c = texture2D(u_texture, T);
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(id(texture2D(u_texture, T + vec2(0, step) * v)) || id(texture2D(u_texture, T + vec2(0, -step) * v)) ||
|
||||
id(texture2D(u_texture, T + vec2(step, 0) * v)) || id(texture2D(u_texture, T + vec2(-step, 0) * v))))
|
||||
any = true;
|
||||
|
||||
if(any){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
if((c.r < 0.01 && c.g < 0.01 && c.b < 0.01)){
|
||||
c = vec4(0.0);
|
||||
}
|
||||
gl_FragColor = mix(c, vec4(1.0, 1.0, 1.0, c.a), u_lighten) * v_color;
|
||||
}
|
||||
}
|
60
semag/mind/assets/shaders/pattern.fragment
Normal file
60
semag/mind/assets/shaders/pattern.fragment
Normal file
@ -0,0 +1,60 @@
|
||||
#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;
|
||||
}
|
||||
}
|
78
semag/mind/assets/shaders/shield.fragment
Normal file
78
semag/mind/assets/shaders/shield.fragment
Normal file
@ -0,0 +1,78 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
#endif
|
||||
|
||||
#define MAX_HITS 64
|
||||
#define HIT_RADIUS 12.0
|
||||
#define ALPHA 0.18
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform float u_time;
|
||||
uniform float u_scaling;
|
||||
uniform float u_dp;
|
||||
uniform vec2 u_offset;
|
||||
uniform int u_hitamount;
|
||||
uniform vec3 u_hits[MAX_HITS];
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
float round(float f){
|
||||
return float(int(f));
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 T = v_texCoord.xy;
|
||||
|
||||
vec2 coords = (T * u_texsize) + u_offset;
|
||||
|
||||
T += vec2(sin(coords.y / 3.0 + u_time / 20.0) / 240.0, sin(coords.x / 3.0 + u_time / 20.0) / 240.0) * u_scaling;
|
||||
|
||||
float si = 1.0 + sin(u_time / 20.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.5;
|
||||
|
||||
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{
|
||||
|
||||
if(color.a > 0.1){
|
||||
if(mod(coords.x / u_dp + coords.y / u_dp + sin(round(coords.x / u_dp) / 5.0) * 3.0 + sin(round(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
|
||||
color *= 1.65;
|
||||
}
|
||||
|
||||
color.a = ALPHA;
|
||||
|
||||
for(int i = 0; i < MAX_HITS; i ++){
|
||||
if(i >= u_hitamount) break;
|
||||
vec3 hit = u_hits[i];
|
||||
float rad = hit.z * HIT_RADIUS;
|
||||
float fin = 1.0 - hit.z;
|
||||
|
||||
if(abs(distance(vec2(hit.x, hit.y), coords - u_texsize/2.0) - rad) < 1.0){
|
||||
color = mix(color, u_color* vec4(si, si, si, 1.0), (1.0 * fin));
|
||||
color.a = ALPHA + 0.82 *fin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user