#version 120
uniform sampler2D iChannel0;

uniform sampler2D noiseTexture;
uniform vec2 noiseOffset;
uniform vec2 noiseScale;

uniform float disintegration;

#include "shaders/logic.glsl"

void main()
{
    vec4 c = texture2D(iChannel0, mod(gl_TexCoord[0].xy,1.0));

    float noise = texture2D(noiseTexture, mod(floor((gl_FragCoord.xy + noiseOffset)*0.5)*2.0*noiseScale,1.0)).r;

	gl_FragColor = c*gl_Color*lt(noise,disintegration);
}