no message
This commit is contained in:
22
data/shaders/alpha_mask.frag
Normal file
22
data/shaders/alpha_mask.frag
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D mask_tex;
|
||||
|
||||
uniform float offset_x;
|
||||
uniform float offset_y;
|
||||
uniform float resolution_x;
|
||||
uniform float resolution_y;
|
||||
uniform float mask_resolution_x;
|
||||
uniform float mask_resolution_y;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 col = texture2D(tex, texCoord);
|
||||
vec2 mask_coords = vec2((texCoord.x*resolution_x + offset_x)/mask_resolution_x, (texCoord.y*resolution_y + offset_y)/mask_resolution_y);
|
||||
vec4 mask = texture2D(mask_tex, mask_coords);
|
||||
fragColor = vec4(col.rgb, col.a*mask.a);
|
||||
}
|
||||
11
data/shaders/color.frag
Normal file
11
data/shaders/color.frag
Normal file
@@ -0,0 +1,11 @@
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec4 myColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 c = myColor * color;
|
||||
gl_FragColor = texture2D(tex, texCoord) * c;
|
||||
}
|
||||
11
data/shaders/common.frag
Normal file
11
data/shaders/common.frag
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
fragColor = texture2D(tex, texCoord) * color;
|
||||
}
|
||||
14
data/shaders/common.vert
Normal file
14
data/shaders/common.vert
Normal file
@@ -0,0 +1,14 @@
|
||||
attribute vec3 gpu_Vertex;
|
||||
attribute vec2 gpu_TexCoord;
|
||||
attribute vec4 gpu_Color;
|
||||
uniform mat4 gpu_ModelViewProjectionMatrix;
|
||||
|
||||
varying vec4 color;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
color = gpu_Color;
|
||||
texCoord = vec2(gpu_TexCoord);
|
||||
gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 1.0);
|
||||
}
|
||||
51
data/shaders/marching_ants.frag
Normal file
51
data/shaders/marching_ants.frag
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
uniform float resolution_x;
|
||||
uniform float resolution_y;
|
||||
|
||||
uniform float screen_w;
|
||||
uniform float screen_h;
|
||||
|
||||
uniform float time;
|
||||
uniform float zoom;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float x_offset = 1.0/(screen_w*zoom) + 1.0/(resolution_x*zoom);
|
||||
float y_offset = 1.0/(screen_h*zoom) + 1.0/(resolution_y*zoom);
|
||||
|
||||
vec4 center = texture2D(tex, texCoord);
|
||||
vec4 left = texture2D(tex, vec2(texCoord.s - x_offset, texCoord.t));
|
||||
vec4 right = texture2D(tex, vec2(texCoord.s + x_offset, texCoord.t));
|
||||
vec4 up = texture2D(tex, vec2(texCoord.s, texCoord.t - y_offset));
|
||||
vec4 down = texture2D(tex, vec2(texCoord.s, texCoord.t + y_offset));
|
||||
|
||||
bool is_image_edge = (texCoord.s - x_offset < 0 || texCoord.s + x_offset > 1 || texCoord.t - y_offset < 0 || texCoord.t + y_offset > 1);
|
||||
|
||||
if(left.a != right.a || left.a != up.a || left.a != down.a || (center.a > 0.5 && is_image_edge))
|
||||
{
|
||||
if(center.a > 0.5)
|
||||
{
|
||||
float speed = 0.6;
|
||||
float ant_size = 10;
|
||||
float black_to_white_ratio = 0.5;
|
||||
float ant_position = (gl_FragCoord.x + gl_FragCoord.y);
|
||||
float t = step(black_to_white_ratio, mod(time*speed + ant_position/ant_size, 1.0));
|
||||
|
||||
fragColor = vec4(t, t, t, 1);
|
||||
}
|
||||
else
|
||||
fragColor = vec4(1, 1, 1, 1);
|
||||
}
|
||||
else if(center.a < 0.5)
|
||||
{
|
||||
fragColor = vec4(0, 0, 0, 0.1);
|
||||
}
|
||||
else
|
||||
discard;
|
||||
}
|
||||
8
data/shaders/untextured.frag
Normal file
8
data/shaders/untextured.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 120
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = color;
|
||||
}
|
||||
13
data/shaders/untextured.vert
Normal file
13
data/shaders/untextured.vert
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 120
|
||||
|
||||
attribute vec3 gpu_Vertex;
|
||||
attribute vec4 gpu_Color;
|
||||
uniform mat4 gpu_ModelViewProjectionMatrix;
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
color = gpu_Color;
|
||||
gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user