Files
qad/qglengine/shaders/selection_frame.glsl

25 lines
606 B
GLSL

// vert //
void main(void) {
qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform();
}
// frag //
uniform vec2 dt, size;
uniform float thickness;
void main(void) {
vec2 frame_size = size / dt;
vec2 pix_pos = qgl_FragTexture * frame_size;
vec2 frame = vec2(1) + step(pix_pos, vec2(thickness)) - step(pix_pos, frame_size - vec2(thickness));
vec2 line = frame * step(0.5, fract(pix_pos.yx / thickness / 4.));
float fc = max(frame.x, frame.y);
float fl = max(line.x , line.y );
fl = mix(1, fl, fc);
qgl_FragColor = vec4(vec3(fl), fc * 0.8 + 0.2);
//qgl_FragColor = vec4(vec3(fl,0),1);
}