Sha256: 3f2354eb3b4c2ea11b6fc3383f1f257f7ff6e824084990cc082e52414d5c96b6
Contents?: true
Size: 1.58 KB
Versions: 4
Compression:
Stored size: 1.58 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.SepiaShader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.SepiaShader = void 0; /** * Sepia tone shader * based on glfx.js sepia shader * https://github.com/evanw/glfx.js */ var SepiaShader = { uniforms: { 'tDiffuse': { value: null }, 'amount': { value: 1.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 float amount;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 color = texture2D( tDiffuse, vUv );\n\t\t\tvec3 c = color.rgb;\n\n\t\t\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );\n\t\t\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );\n\t\t\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );\n\n\t\t\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );\n\n\t\t}" }; _exports.SepiaShader = SepiaShader; });
Version data entries
4 entries across 4 versions & 1 rubygems