Sha256: 9c8cb1e72ed74a4d0308d07d4b5efbd9dee2ca403b991cb5f05d9133b2d7ef63
Contents?: true
Size: 1.6 KB
Versions: 4
Compression:
Stored size: 1.6 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.DOFMipMapShader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.DOFMipMapShader = void 0; /** * Depth-of-field shader using mipmaps * - from Matt Handley @applmak * - requires power-of-2 sized render target with enabled mipmaps */ var DOFMipMapShader = { uniforms: { 'tColor': { value: null }, 'tDepth': { value: null }, 'focus': { value: 1.0 }, 'maxblur': { 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 focus;\n\t\tuniform float maxblur;\n\n\t\tuniform sampler2D tColor;\n\t\tuniform sampler2D tDepth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 depth = texture2D( tDepth, vUv );\n\n\t\t\tfloat factor = depth.x - focus;\n\n\t\t\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );\n\n\t\t\tgl_FragColor = col;\n\t\t\tgl_FragColor.a = 1.0;\n\n\t\t}" }; _exports.DOFMipMapShader = DOFMipMapShader; });
Version data entries
4 entries across 4 versions & 1 rubygems