1/* global define, require */ 2(function (root, factory) { 3 'use strict'; 4 5 if (typeof define === 'function' && define.amd) { 6 // AMD. Register as an anonymous module. 7 define(['seriously'], factory); 8 } else if (typeof exports === 'object') { 9 // Node/CommonJS 10 factory(require('seriously')); 11 } else { 12 if (!root.Seriously) { 13 root.Seriously = { plugin: function (name, opt) { this[name] = opt; } }; 14 } 15 factory(root.Seriously); 16 } 17}(window, function (Seriously) { 18 'use strict'; 19 20 Seriously.plugin('linear-transfer', { 21 commonShader: true, 22 shader: function (inputs, shaderSource) { 23 shaderSource.fragment = [ 24 'precision mediump float;', 25 26 'varying vec2 vTexCoord;', 27 28 'uniform sampler2D source;', 29 'uniform vec4 slope;', 30 'uniform vec4 intercept;', 31 32 'const vec3 half3 = vec3(0.5);', 33 34 'void main(void) {', 35 ' vec4 pixel = texture2D(source, vTexCoord);', 36 ' gl_FragColor = pixel * slope + intercept;', 37 '}' 38 ].join('\n'); 39 return shaderSource; 40 }, 41 inPlace: true, 42 inputs: { 43 source: { 44 type: 'image', 45 uniform: 'source' 46 }, 47 slope: { 48 type: 'vector', 49 dimensions: 4, 50 uniform: 'slope', 51 defaultValue: [1, 1, 1, 1] 52 }, 53 intercept: { 54 type: 'vector', 55 uniform: 'intercept', 56 dimensions: 4, 57 defaultValue: [0, 0, 0, 0] 58 } 59 }, 60 title: 'Linear Transfer', 61 description: 'For each color channel: [slope] * [value] + [intercept]' 62 }); 63}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.