kernel spinBlur < namespace : "codeonwort"; vendor : "codeonwort"; version : 1; > { input image4 src; output pixel4 dst; parameter float centerX< minValue : -2000.0; maxValue : 2000.0; defaultValue : 200.0; >; parameter float centerY< minValue : -2000.0; maxValue : 2000.0; defaultValue : 200.0; >; parameter int steps< minValue : 1; maxValue : 100; defaultValue : 50; >; parameter float precision< minValue : 1.0; maxValue : 50.0; defaultValue : 1.0; >; void evaluatePixel() { pixel2 coord = outCoord(); dst = sampleNearest(src, coord); float dx = coord.x - centerX; float dy = coord.y - centerY; float d = precision / sqrt(dx * dx + dy * dy); dx *= d; dy *= d; for(int i = 0 ; i < steps ; i++){ pixel4 other = sampleNearest(src, float2(coord.x -= dy, coord.y += dx)); dst = (dst + other) / 2.0; dx = coord.x - centerX; dy = coord.y - centerY; dx *= d; dy *= d; } } }