Update asciiart.glsl

This commit is contained in:
myownfriend
2014-05-20 23:39:48 -04:00
parent 38669a1d16
commit a26673163f

View File

@ -1,4 +1,5 @@
uniform sampler2D samp8; // textures // textures
uniform sampler2D samp8;
uniform sampler2D samp9; uniform sampler2D samp9;
const int char_width = 8; const int char_width = 8;
@ -18,21 +19,25 @@ void main()
vec2 char_pos = floor(uv0*resolution.xy/char_dim); vec2 char_pos = floor(uv0*resolution.xy/char_dim);
vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim; vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim;
float mindiff = float(char_width*char_height) * 100.0; // just a big number // just a big number
float mindiff = float(char_width*char_height) * 100.0;
float minc = 0.0; float minc = 0.0;
vec4 mina = vec4(0.0, 0.0, 0.0, 0.0); vec4 mina = vec4(0.0, 0.0, 0.0, 0.0);
vec4 minb = vec4(0.0, 0.0, 0.0, 0.0); vec4 minb = vec4(0.0, 0.0, 0.0, 0.0);
for(int i=0; i<char_count; i++) { for(int i=0; i<char_count; i++)
{
vec4 ff = vec4(0.0, 0.0, 0.0, 0.0); vec4 ff = vec4(0.0, 0.0, 0.0, 0.0);
vec4 f = vec4(0.0, 0.0, 0.0, 0.0); vec4 f = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ft = vec4(0.0, 0.0, 0.0, 0.0); vec4 ft = vec4(0.0, 0.0, 0.0, 0.0);
vec4 t = vec4(0.0, 0.0, 0.0, 0.0); vec4 t = vec4(0.0, 0.0, 0.0, 0.0);
vec4 tt = vec4(0.0, 0.0, 0.0, 0.0); vec4 tt = vec4(0.0, 0.0, 0.0, 0.0);
for(int x=0; x<char_width; x++) { for(int x=0; x<char_width; x++)
for(int y=0; y<char_height; y++) { {
for(int y=0; y<char_height; y++)
{
vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5; vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5;
vec4 tex = texture(samp9, tex_pos * resolution.zw); vec4 tex = texture(samp9, tex_pos * resolution.zw);