Sha256: c7708bae3fe4bd5859bdf6c9d0acf48a296a6b7737d762d862a383df77bef7e0
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.MirrorShader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.MirrorShader = void 0; /** * Mirror Shader * Copies half the input to the other half * * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom) */ var MirrorShader = { uniforms: { 'tDiffuse': { value: null }, 'side': { value: 1 } }, 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 int side;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec2 p = vUv;\n\t\t\tif (side == 0){\n\t\t\t\tif (p.x > 0.5) p.x = 1.0 - p.x;\n\t\t\t}else if (side == 1){\n\t\t\t\tif (p.x < 0.5) p.x = 1.0 - p.x;\n\t\t\t}else if (side == 2){\n\t\t\t\tif (p.y < 0.5) p.y = 1.0 - p.y;\n\t\t\t}else if (side == 3){\n\t\t\t\tif (p.y > 0.5) p.y = 1.0 - p.y;\n\t\t\t}\n\t\t\tvec4 color = texture2D(tDiffuse, p);\n\t\t\tgl_FragColor = color;\n\n\t\t}" }; _exports.MirrorShader = MirrorShader; });
Version data entries
4 entries across 4 versions & 1 rubygems