(function()
{
    function RedColorObj()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'const mat3 redMatrix = mat3(0.9588, 0.3, 0.1, 0.1, 0.3, 0.1, 0.1, 0.3, 0.1);',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * redMatrix, 1.0);',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    RedColorObj.prototype = Object.create(PIXI.Filter.prototype);
    RedColorObj.prototype.constructor = RedColorObj;

    this.RedColorObj = RedColorObj;

    function BlackColorObj(_init_color)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 colorShadow;',
                'uniform float colorAlpha;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
                '    gl_FragColor.r = colorShadow[0];',
                '    gl_FragColor.g = colorShadow[1];',
                '    gl_FragColor.b = colorShadow[2];',
                '    gl_FragColor.a = colorAlpha;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                colorShadow:{ type: 'v3', value: _init_color},
                colorAlpha:{ type: '1f', value: 1.0}
            }
        );
    }

    BlackColorObj.prototype = Object.create(PIXI.Filter.prototype);
    BlackColorObj.prototype.constructor = BlackColorObj;

    this.BlackColorObj = BlackColorObj;

    Object.defineProperties(ProcessingPlan.prototype, {
        colorAlpha: {
            get: function ()
            {
                return this.uniforms.colorAlpha;
            },
            set: function (value)
            {
                console.log(value);
                this.uniforms.colorAlpha = value;
            }
        }
    });

	 function BlackColorObj2(_init_alpha)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 colorShadow;',
                'uniform float colorAlpha;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
                '    gl_FragColor.r = 0.0;',
                '    gl_FragColor.g = 0.0;',
                '    gl_FragColor.b = 0.0;',
                '    gl_FragColor.a = colorAlpha;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                colorAlpha:{ type: '1f', value: _init_alpha}
            }
        );
    }

    BlackColorObj2.prototype = Object.create(PIXI.Filter.prototype);
    BlackColorObj2.prototype.constructor = BlackColorObj2;

    this.BlackColorObj2 = BlackColorObj2;


    function UpdateColorPlan(_init_color1,_init_color2,_init_color3)
    {
        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 color_01;',
                'uniform vec3 color_02;',
                'uniform vec3 color_03;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a >= 0.0 &&  gl_FragColor.r >= 0.76 &&  gl_FragColor.r <= 0.78  && gl_FragColor.g >= 0.80 &&  gl_FragColor.g <= 0.82)',
                '    {',
                '       gl_FragColor.r = color_01[0];',
                '       gl_FragColor.g = color_01[1];',
                '       gl_FragColor.b = color_01[2];',
                '    } else ',
                '    if(gl_FragColor.a >= 0.0 &&  gl_FragColor.r >= 0.46 &&  gl_FragColor.r <= 0.48  && gl_FragColor.g >= 0.50 &&  gl_FragColor.g <= 0.52 )',
                '    {',
                '       gl_FragColor.r = color_02[0];',
                '       gl_FragColor.g = color_02[1];',
                '       gl_FragColor.b = color_02[2];',
                '    } else ',
                '    if(gl_FragColor.a >= 0.0 &&  gl_FragColor.r >= 0.29 &&  gl_FragColor.r <= 0.31  && gl_FragColor.g >= 0.32 &&  gl_FragColor.g <= 0.34)',
                '    {',
                '       gl_FragColor.r = color_03[0];',
                '       gl_FragColor.g = color_03[1];',
                '       gl_FragColor.b = color_03[2];',
                '    } ',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                color_01:{ type: 'v3', value: _init_color1},
                color_02:{ type: 'v3', value: _init_color2},
                color_03:{ type: 'v3', value: _init_color3}
            }
        );
    }

    UpdateColorPlan.prototype = Object.create(PIXI.Filter.prototype);
    UpdateColorPlan.prototype.constructor = UpdateColorPlan;

    this.UpdateColorPlan = UpdateColorPlan;

    function BloodPlan1()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
                '    gl_FragColor.r = 0.53;',
                '    gl_FragColor.g = 0.19;',
                '    gl_FragColor.b = 0.19;',
                '    gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    BloodPlan1.prototype = Object.create(PIXI.Filter.prototype);
    BloodPlan1.prototype.constructor = BloodPlan1;

    this.BloodPlan1 = BloodPlan1;

    function BloodDamage()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
                '    gl_FragColor.r = 0.73;',
                '    gl_FragColor.g = 0.17;',
                '    gl_FragColor.b = 0.19;',
                '    gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    BloodDamage.prototype = Object.create(PIXI.Filter.prototype);
    BloodDamage.prototype.constructor = BloodDamage;

    this.BloodDamage = BloodDamage;

    function ProcessingMainPlan()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 1.0 && gl_FragColor.a != 0.0 )',
                '    {',
                '       gl_FragColor.r = gl_FragColor.r*(1.0/gl_FragColor.a);',
                '       gl_FragColor.g = gl_FragColor.g*(1.0/gl_FragColor.a);',
                '       gl_FragColor.b = gl_FragColor.b*(1.0/gl_FragColor.a);',
                '       gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    ProcessingMainPlan.prototype = Object.create(PIXI.Filter.prototype);
    ProcessingMainPlan.prototype.constructor = ProcessingMainPlan;

    this.ProcessingMainPlan = ProcessingMainPlan;

    function ProcessingShadow(_colorInit)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 colorCustom;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 1.0 && gl_FragColor.a != 0.0 )',
                '    {',
                '       gl_FragColor.r = colorCustom[0];',
                '       gl_FragColor.g = colorCustom[1];',
                '       gl_FragColor.b = colorCustom[2];',
                '       gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                colorCustom:{ type: 'v3', value: _colorInit}
            }
        );
    }

    ProcessingShadow.prototype = Object.create(PIXI.Filter.prototype);
    ProcessingShadow.prototype.constructor = ProcessingShadow;

    this.ProcessingShadow = ProcessingShadow;


    function ProcessingPlan(_init_proc)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform float proc;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a >= proc-0.05 && gl_FragColor.a <= proc+0.05)',
                '    {',
                '       gl_FragColor.a = 1.0;',
                '    }',
                '    else {',
                '       gl_FragColor.r = 0.0;',
                '       gl_FragColor.g = 0.0;',
                '       gl_FragColor.b = 0.0;',
                '       gl_FragColor.a = 0.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                proc:{ type: '1f', value: _init_proc}
            }
        );
    }

    ProcessingPlan.prototype = Object.create(PIXI.Filter.prototype);
    ProcessingPlan.prototype.constructor = ProcessingPlan;

    this.ProcessingPlan = ProcessingPlan;

    Object.defineProperties(ProcessingPlan.prototype, {
        proc: {
            get: function ()
            {
                return this.uniforms.proc;
            },
            set: function (value)
            {
                this.uniforms.proc = value;
            }
        }
    });

    function OnlyShadow()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0 && gl_FragColor.r >= 0.1215686 && gl_FragColor.r <= 0.12156865)',
                '    {',
//                '    gl_FragColor.r = 0.12;',
//                '    gl_FragColor.g = 0.12;',
//                '    gl_FragColor.b = 0.12;',
                '    gl_FragColor.a = 1.0;',
                '    } else {',
                '    gl_FragColor.r = 0.0;',
                '    gl_FragColor.g = 0.0;',
                '    gl_FragColor.b = 0.0;',
                '    gl_FragColor.a = 0.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    OnlyShadow.prototype = Object.create(PIXI.Filter.prototype);
    OnlyShadow.prototype.constructor = OnlyShadow;

    this.OnlyShadow = OnlyShadow;

    function MaskColorPlan()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
                '    gl_FragColor.r = 1.0;',
                '    gl_FragColor.g = 1.0;',
                '    gl_FragColor.b = 1.0;',
                '    gl_FragColor.a = 1.0;',
                '    } else {',
                '    gl_FragColor.r = 0.0;',
                '    gl_FragColor.g = 0.0;',
                '    gl_FragColor.b = 0.0;',
                '    gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    MaskColorPlan.prototype = Object.create(PIXI.Filter.prototype);
    MaskColorPlan.prototype.constructor = MaskColorPlan;

    this.MaskColorPlan = MaskColorPlan;

    function NewColor(_colorInit)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 colorCustom;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0 && gl_FragColor.r == 0.0 && gl_FragColor.g == 0.0 && gl_FragColor.b == 0.0)',
                '    {',
                '    gl_FragColor.r = colorCustom[0];',
                '    gl_FragColor.g = colorCustom[1];',
                '    gl_FragColor.b = colorCustom[2];',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                colorCustom:{ type: 'v3', value: _colorInit}
            }
        );
    }

    NewColor.prototype = Object.create(PIXI.Filter.prototype);
    NewColor.prototype.constructor = NewColor;
    this.NewColor = NewColor;

    function UpdateColorObj(_colorInit)
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'uniform vec3 colorCustom;',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0)',
                '    {',
//               '       gl_FragColor = vec4(colorCustom[0],0.81,0.63,1.0);',
                '       gl_FragColor.r = colorCustom[0];',
                '       gl_FragColor.g = colorCustom[1];',
                '       gl_FragColor.b = colorCustom[2];',
                '       gl_FragColor.a = 1.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
                colorCustom:{ type: 'v3', value: _colorInit}
            }
        );

//        this.uniforms.red = 0.1;
    }

    UpdateColorObj.prototype = Object.create(PIXI.Filter.prototype);
    UpdateColorObj.prototype.constructor = UpdateColorObj;

    this.UpdateColorObj = UpdateColorObj;

    Object.defineProperties(UpdateColorObj.prototype, {
        colorCustom: {
            get: function ()
            {
                return this.uniforms.colorCustom;
            },
            set: function (value)
            {
                this.uniforms.colorCustom = value;
            }
        }
    });

    function DellWhiteObj()
    {

        PIXI.Filter.call(this,
            // vertex shader
            null,
            // fragment shader
            [
                'precision mediump float;',
                'varying vec2 vTextureCoord;',
                'uniform sampler2D uSampler; //diffuse map',
                'void main() {',
                '    gl_FragColor = texture2D(uSampler, vTextureCoord);',
                '    if(gl_FragColor.a != 0.0 && gl_FragColor.r == 0.0 && gl_FragColor.g == 0.0 && gl_FragColor.b == 0.0)',
                '    {',
                '    gl_FragColor.a = 0.0;',
                '    }',
                '}'
            ].join('\n'),
            // custom uniforms
            {
            }
        );
    }

    DellWhiteObj.prototype = Object.create(PIXI.Filter.prototype);
    DellWhiteObj.prototype.constructor = DellWhiteObj;

    this.DellWhiteObj = DellWhiteObj;
})(this);