<commit_before>//
//  BlurNode.cpp
//  Cinder-Pipeline
//
//  Created by <NAME> on 22 Apr 2014.
//  Copyright 2014 Chorded Constructions. All rights reserved.
//

#include "BlurNode.h"

using namespace Cinder::Pipeline;

// taken from https://github.com/paulhoux/Cinder-Samples/blob/master/BloomingNeon/assets/blur_frag.glsl
const std::string FragmentShaderBlur = R"(
    #version 120
    uniform sampler2D image;
    uniform vec2 sampleOffset;

    void main() {
        vec2 position = gl_TexCoord[0].st;
        vec4 sum = vec4(0.0);
        sum += texture2D(image, position + -10.0 * sampleOffset) * 0.009167927656011385;
        sum += texture2D(image, position +  -9.0 * sampleOffset) * 0.014053461291849008;
        sum += texture2D(image, position +  -8.0 * sampleOffset) * 0.020595286319257878;
        sum += texture2D(image, position +  -7.0 * sampleOffset) * 0.028855245532226279;
        sum += texture2D(image, position +  -6.0 * sampleOffset) * 0.038650411513543079;
        sum += texture2D(image, position +  -5.0 * sampleOffset) * 0.049494378859311142;
        sum += texture2D(image, position +  -4.0 * sampleOffset) * 0.060594058578763078;
        sum += texture2D(image, position +  -3.0 * sampleOffset) * 0.070921288047096992;
        sum += texture2D(image, position +  -2.0 * sampleOffset) * 0.079358891804948081;
        sum += texture2D(image, position +  -1.0 * sampleOffset) * 0.084895951965930902;
        sum += texture2D(image, position +   0.0 * sampleOffset) * 0.086826196862124602;
        sum += texture2D(image, position +  +1.0 * sampleOffset) * 0.084895951965930902;
        sum += texture2D(image, position +  +2.0 * sampleOffset) * 0.079358891804948081;
        sum += texture2D(image, position +  +3.0 * sampleOffset) * 0.070921288047096992;
        sum += texture2D(image, position +  +4.0 * sampleOffset) * 0.060594058578763078;
        sum += texture2D(image, position +  +5.0 * sampleOffset) * 0.049494378859311142;
        sum += texture2D(image, position +  +6.0 * sampleOffset) * 0.038650411513543079;
        sum += texture2D(image, position +  +7.0 * sampleOffset) * 0.028855245532226279;
        sum += texture2D(image, position +  +8.0 * sampleOffset) * 0.020595286319257878;
        sum += texture2D(image, position +  +9.0 * sampleOffset) * 0.014053461291849008;
        sum += texture2D(image, position + +10.0 * sampleOffset) * 0.009167927656011385;
        gl_FragColor = sum;
    }
)";

BlurNodeRef BlurNode::create() {
    return BlurNodeRef(new BlurNode());
}

BlurNode::BlurNode() {
    setupShader(sVertexShaderPassThrough, FragmentShaderBlur);
}

BlurNode::~BlurNode() {
}

void BlurNode::render(gl::Fbo& inputFBO, const int inputFBOAttachment, gl::Fbo& outputFBO, const int outputFBOAttachment) {
    glDrawBuffer(GL_COLOR_ATTACHMENT0 + outputFBOAttachment);
    inputFBO.bindTexture(0, inputFBOAttachment); {
        mShader->bind(); {
            mShader->uniform("image", 0);
            mShader->uniform("sampleOffset", mSampleOffset);
            gl::drawSolidRect(outputFBO.getBounds());
        } mShader->unbind();
    } inputFBO.unbindTexture();
}<commit_msg>add an amount to the blur shader, currently pegged at 100%<commit_after>//
//  BlurNode.cpp
//  Cinder-Pipeline
//
//  Created by <NAME> on 22 Apr 2014.
//  Copyright 2014 Chorded Constructions. All rights reserved.
//

#include "BlurNode.h"

using namespace Cinder::Pipeline;

// taken from https://github.com/paulhoux/Cinder-Samples/blob/master/BloomingNeon/assets/blur_frag.glsl
const std::string FragmentShaderBlur = R"(
    #version 120
    uniform sampler2D image;
    uniform vec2 sampleOffset;
    uniform float amount;

    void main() {
        vec2 position = gl_TexCoord[0].st;
        vec4 color = texture2D(image, position);

        vec4 sum = vec4(0.0);
        sum += texture2D(image, position + -10.0 * sampleOffset) * 0.009167927656011385;
        sum += texture2D(image, position +  -9.0 * sampleOffset) * 0.014053461291849008;
        sum += texture2D(image, position +  -8.0 * sampleOffset) * 0.020595286319257878;
        sum += texture2D(image, position +  -7.0 * sampleOffset) * 0.028855245532226279;
        sum += texture2D(image, position +  -6.0 * sampleOffset) * 0.038650411513543079;
        sum += texture2D(image, position +  -5.0 * sampleOffset) * 0.049494378859311142;
        sum += texture2D(image, position +  -4.0 * sampleOffset) * 0.060594058578763078;
        sum += texture2D(image, position +  -3.0 * sampleOffset) * 0.070921288047096992;
        sum += texture2D(image, position +  -2.0 * sampleOffset) * 0.079358891804948081;
        sum += texture2D(image, position +  -1.0 * sampleOffset) * 0.084895951965930902;
        sum += texture2D(image, position +   0.0 * sampleOffset) * 0.086826196862124602;
        sum += texture2D(image, position +  +1.0 * sampleOffset) * 0.084895951965930902;
        sum += texture2D(image, position +  +2.0 * sampleOffset) * 0.079358891804948081;
        sum += texture2D(image, position +  +3.0 * sampleOffset) * 0.070921288047096992;
        sum += texture2D(image, position +  +4.0 * sampleOffset) * 0.060594058578763078;
        sum += texture2D(image, position +  +5.0 * sampleOffset) * 0.049494378859311142;
        sum += texture2D(image, position +  +6.0 * sampleOffset) * 0.038650411513543079;
        sum += texture2D(image, position +  +7.0 * sampleOffset) * 0.028855245532226279;
        sum += texture2D(image, position +  +8.0 * sampleOffset) * 0.020595286319257878;
        sum += texture2D(image, position +  +9.0 * sampleOffset) * 0.014053461291849008;
        sum += texture2D(image, position + +10.0 * sampleOffset) * 0.009167927656011385;

        gl_FragColor = mix(color, sum, clamp(amount, 0.0, 1.0));
    }
)";

BlurNodeRef BlurNode::create() {
    return BlurNodeRef(new BlurNode());
}

BlurNode::BlurNode() {
    setupShader(sVertexShaderPassThrough, FragmentShaderBlur);
}

BlurNode::~BlurNode() {
}

void BlurNode::render(gl::Fbo& inputFBO, const int inputFBOAttachment, gl::Fbo& outputFBO, const int outputFBOAttachment) {
    glDrawBuffer(GL_COLOR_ATTACHMENT0 + outputFBOAttachment);
    inputFBO.bindTexture(0, inputFBOAttachment); {
        mShader->bind(); {
            mShader->uniform("image", 0);
            mShader->uniform("sampleOffset", mSampleOffset);
            mShader->uniform("amount", 1.0f);
            gl::drawSolidRect(outputFBO.getBounds());
        } mShader->unbind();
    } inputFBO.unbindTexture();
}
{'fraction_non_alphanumeric': 0.1334054722522801, 'fraction_numerical': 0.15257381357242233, 'mean_word_length': 3.2932979429329796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '868209', 'n_tokens_mistral': 2798, 'n_tokens_neox': 2256, 'n_words': 433}