Sha256: f26a3a3960eb1665942ca2698565b58805b21a52c36f1f37cbbff9a6a8bd49b9
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports"], factory); } else if (typeof exports !== "undefined") { factory(exports); } else { var mod = { exports: {} }; factory(mod.exports); global.RGBShiftShader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.RGBShiftShader = void 0; /** * RGB Shift Shader * Shifts red and blue channels from center in opposite directions * Ported from http://kriss.cx/tom/2009/05/rgb-shift/ * by Tom Butterworth / http://kriss.cx/tom/ * * amount: shift distance (1 is width of input) * angle: shift angle in radians */ var RGBShiftShader = { uniforms: { 'tDiffuse': { value: null }, 'amount': { value: 0.005 }, 'angle': { value: 0.0 } }, vertexShader: /* glsl */ "\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}", fragmentShader: /* glsl */ "\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float amount;\n\t\tuniform float angle;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec2 offset = amount * vec2( cos(angle), sin(angle));\n\t\t\tvec4 cr = texture2D(tDiffuse, vUv + offset);\n\t\t\tvec4 cga = texture2D(tDiffuse, vUv);\n\t\t\tvec4 cb = texture2D(tDiffuse, vUv - offset);\n\t\t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n\n\t\t}" }; _exports.RGBShiftShader = RGBShiftShader; });
Version data entries
4 entries across 4 versions & 1 rubygems