Sha256: 82d327682d08e87eddef1522095f67be9d63a6fe67a29eef5f10131cc28353ad

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 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.PixelShader = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.PixelShader = void 0;

  /**
   * Pixelation shader
   */
  var PixelShader = {
    uniforms: {
      'tDiffuse': {
        value: null
      },
      'resolution': {
        value: null
      },
      'pixelSize': {
        value: 1
      }
    },
    vertexShader:
    /* glsl */
    "\n\n\t\tvarying highp vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\t\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 pixelSize;\n\t\tuniform vec2 resolution;\n\n\t\tvarying highp vec2 vUv;\n\n\t\tvoid main(){\n\n\t\t\tvec2 dxy = pixelSize / resolution;\n\t\t\tvec2 coord = dxy * floor( vUv / dxy );\n\t\t\tgl_FragColor = texture2D(tDiffuse, coord);\n\n\t\t}"
  };
  _exports.PixelShader = PixelShader;
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-js_wrap-three-0.1.5 lib-opal/js_wrap/three/shaders/PixelShader.js
opal-js_wrap-three-0.1.4 lib-opal/js_wrap/three/shaders/PixelShader.js
opal-js_wrap-three-0.1.3 lib-opal/js_wrap/three/shaders/PixelShader.js
opal-js_wrap-three-0.1.2 lib-opal/js_wrap/three/shaders/PixelShader.js