diff --git a/examples/antialiasing.js b/examples/antialiasing.js new file mode 100644 index 0000000..34a4d18 --- /dev/null +++ b/examples/antialiasing.js @@ -0,0 +1,211 @@ +const createContext = require('../') +const io = require('pex-io') +const createCamera = require('pex-cam/perspective') +const createOrbiter = require('pex-cam/orbiter') +const canvasScreenshot = require('canvas-screenshot') +const mat4 = require('pex-math/mat4') +const GUI = require('pex-gui') +const createCube = require('primitive-cube') +const createPlane = require('primitive-plane') +const glsl = require('glslify') + +// Tests +// [X] antialias +// [X] SAMPLE_ALPHA_TO_COVERAGE +// [X] FXAA +// [ ] SMAA +// [ ] MSAA +// [ ] TAA + +// Setup context +const ctx = createContext({ antialias: true, alpha: false }) + +// ctx.gl.canvas.style.backgroundColor = '#f00' + +const camera = createCamera({ + fov: Math.PI / 4, + aspect: ctx.gl.canvas.width / ctx.gl.canvas.height, + near: 0.1, + far: 10, + position: [0, 0, 1.5] + // position: [0, 0, 0.2] +}) +createOrbiter({ camera }) + +// Commands +const clearCmd = { + pass: ctx.pass({ + clearColor: [1, 0, 0, 1], + clearDepth: 1 + }) +} + +// const geometry = createPlane() +const geometry = createCube() + +const vert = ` +attribute vec3 aPosition; +attribute vec3 aNormal; +attribute vec2 aTexCoord0; + +uniform mat4 uProjectionMatrix; +uniform mat4 uViewMatrix; +uniform mat4 uModelMatrix; + +varying vec3 vNormal; +varying vec2 vTexCoord0; + +void main() { + vNormal = aNormal; + vTexCoord0 = aTexCoord0; + mat4 modelViewMatrix = uViewMatrix * uModelMatrix; + gl_Position = uProjectionMatrix * modelViewMatrix * vec4(aPosition, 1.0); +} +` + +const frag = glsl` +#ifdef GL_ES +precision highp float; +#endif + +#pragma glslify: fxaa = require(glsl-fxaa) + +varying vec3 vNormal; +varying vec2 vTexCoord0; + +uniform vec2 uResolution; +uniform float uAlphaTest; +uniform sampler2D uBaseColorMap; +uniform bool uFXAAEnabled; + +void main() { + vec2 fragCoord = vTexCoord0 * uResolution; + vec4 texelColor = texture2D(uBaseColorMap, vTexCoord0); + + gl_FragColor = texelColor; + + if (gl_FragColor.a < uAlphaTest) discard; + + // FXAA + if (uFXAAEnabled) gl_FragColor = fxaa(uBaseColorMap, fragCoord, uResolution); +} +` + +const drawCmd = { + // pass: ctx.pass({ + // clearColor: [0, 0, 1, 1], + // clearDepth: 1 + // }), + pipeline: ctx.pipeline({ + vert, + frag, + depthTest: true, + cullFace: false, + // blend: true, + // blendSrcRGBFactor: ctx.BlendFactor.SrcAlpha, + // blendSrcAlphaFactor: ctx.BlendFactor.One, + // blendDstRGBFactor: ctx.BlendFactor.OneMinusSrcAlpha, + // blendDstAlphaFactor: ctx.BlendFactor.One, + primitive: ctx.Primitive.Triangles + }), + attributes: { + aPosition: ctx.vertexBuffer(geometry.positions), + aNormal: ctx.vertexBuffer(geometry.normals), + aTexCoord0: ctx.vertexBuffer(geometry.uvs) + }, + indices: ctx.indexBuffer(geometry.cells), + uniforms: { + uProjectionMatrix: camera.projectionMatrix, + uViewMatrix: camera.viewMatrix, + uModelMatrix: mat4.create(), + uResolution: [ctx.gl.canvas.width, ctx.gl.canvas.height], + uBaseColorMap: null, + uAlphaTest: 0.5, + uFXAAEnabled: false + } +} + +// GUI +const STATE = { + fxaa: false, + sampleAlphaToCoverage: false, + sampleA2CValue: 1.0, + baseColorMap: false, + screenshotFlag: false +} + +const gui = new GUI(ctx) +gui.addHeader('Settings') +gui.addButton('Screenshot', () => (STATE.screenshotFlag = true)) +gui.addParam('A2C', STATE, 'sampleAlphaToCoverage', {}, () => { + if (STATE.sampleAlphaToCoverage) { + ctx.gl.enable(ctx.gl.SAMPLE_ALPHA_TO_COVERAGE) + ctx.gl.sampleCoverage(1, false) + } else { + ctx.gl.disable(ctx.gl.SAMPLE_ALPHA_TO_COVERAGE) + } +}) +gui.addParam('A2C value', STATE, 'sampleA2CValue', { min: 0, max: 1, step: 0.5 }, () => { + if (STATE.sampleAlphaToCoverage) ctx.gl.sampleCoverage(STATE.sampleA2CValue, false) +}) +gui.addParam('FXAA', STATE, 'fxaa', {}, () => { + drawCmd.uniforms.uFXAAEnabled = STATE.fxaa +}) + +// Load textures +Promise.all([ + io.loadImage('assets/images/brush-pack-1-3.png'), + io.loadImage('assets/images/diffuse.png'), + io.loadImage('assets/images/checker.png'), + io.loadImage('assets/images/checker.jpg') +]).then((images) => { + const textures = images.map((image) => + ctx.texture2D({ + data: image, + width: image.width, + height: image.height, + pixelFormat: ctx.PixelFormat.RGBA8, + encoding: ctx.Encoding.SRGB, + min: ctx.Filter.Linear, + mag: ctx.Filter.Linear, + wrap: ctx.Wrap.ClampToEdge, + flipY: true + // min: ctx.Filter.LinearMipmapLinear, + // mipmap: true, + }) + ) + drawCmd.uniforms.uBaseColorMap = STATE.baseColorMap = textures[0] + + gui.addTexture2DList('Base Color Map', STATE, 'baseColorMap', textures, 2, () => { + drawCmd.uniforms.uBaseColorMap = STATE.baseColorMap + }) + + // Frame + ctx.frame(() => { + ctx.submit(clearCmd) + ctx.submit(drawCmd) + + gui.draw() + + if (STATE.screenshotFlag) { + STATE.screenshotFlag = false + canvasScreenshot(ctx.gl.canvas) + } + }) +}) + +// Events +window.addEventListener('resize', () => { + const W = window.innerWidth + const H = window.innerHeight + + ctx.set({ + width: W, + height: H + }) + camera.set({ + aspect: W / H + }) + + drawCmd.uniforms.uResolution = [W, H] +}) diff --git a/examples/assets/images/brush-pack-1-3.png b/examples/assets/images/brush-pack-1-3.png new file mode 100644 index 0000000..54efb66 Binary files /dev/null and b/examples/assets/images/brush-pack-1-3.png differ diff --git a/examples/assets/images/checker.jpg b/examples/assets/images/checker.jpg new file mode 100644 index 0000000..3912f1a Binary files /dev/null and b/examples/assets/images/checker.jpg differ diff --git a/examples/assets/images/checker.png b/examples/assets/images/checker.png new file mode 100644 index 0000000..42a96a1 Binary files /dev/null and b/examples/assets/images/checker.png differ diff --git a/examples/assets/images/diffuse.png b/examples/assets/images/diffuse.png new file mode 100644 index 0000000..aea77cf Binary files /dev/null and b/examples/assets/images/diffuse.png differ diff --git a/examples/package-lock.json b/examples/package-lock.json index 0a3ef2a..15bb87b 100644 --- a/examples/package-lock.json +++ b/examples/package-lock.json @@ -4,6 +4,14 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@choojs/findup": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@choojs/findup/-/findup-0.2.1.tgz", + "integrity": "sha512-YstAqNb0MCN8PjdLCDfRsBcGVRN41f3vgLvaI0IrIcBp4AqILRSS0DeWNGkicC+f/zRIPJLc+9RURVSepwvfBw==", + "requires": { + "commander": "^2.15.1" + } + }, "JSONStream": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", @@ -14,9 +22,9 @@ } }, "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" }, "acorn-dynamic-import": { "version": "3.0.0", @@ -24,13 +32,6 @@ "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", "requires": { "acorn": "^5.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" - } } }, "acorn-node": { @@ -67,7 +68,7 @@ }, "ansi-regex": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", + "resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", "integrity": "sha1-DY6UaWej2BQ/k+JOKYUl/BsiNfk=" }, "ansi-styles": { @@ -292,16 +293,46 @@ } }, "binary-extensions": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", - "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.12.0.tgz", + "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==" }, "bl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.0.tgz", - "integrity": "sha1-E5fn7ELF9dw4dHDFAONKn2vp6pg=", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", "requires": { - "readable-stream": "^2.0.5" + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } } }, "bn.js": { @@ -531,9 +562,9 @@ } }, "browserify": { - "version": "16.2.2", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.2.2.tgz", - "integrity": "sha512-fMES05wq1Oukts6ksGUU2TMVHHp06LyQt0SIwbXIHm7waSrQmNBZePsU0iM/4f94zbvb/wHma+D1YrdzWYnF/A==", + "version": "16.2.3", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.2.3.tgz", + "integrity": "sha512-zQt/Gd1+W+IY+h/xX2NYMW4orQWhqSwyV+xsblycTtpOuB27h1fZhhNQuipJ4t79ohw4P4mMem0jp/ZkISQtjQ==", "requires": { "JSONStream": "^1.0.3", "assert": "^1.4.0", @@ -898,6 +929,14 @@ } } }, + "canvas-screenshot": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/canvas-screenshot/-/canvas-screenshot-1.0.0.tgz", + "integrity": "sha512-KzXfgXshXutU18rsXGSscnMDAtbmidZOjEwLux4/dDUeJQLBIT4WT6UDQa3Pp1LveZzk7i/KgBSvuLeg944o4Q==", + "requires": { + "file-extension": "^4.0.5" + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -1000,11 +1039,6 @@ "object-visit": "^1.0.0" } }, - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=" - }, "combine-source-map": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", @@ -1032,9 +1066,9 @@ } }, "commander": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz", - "integrity": "sha1-0SG7roYNmZKj1Re6lvVliOR8Z4E=" + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", + "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==" }, "common-shake": { "version": "2.1.0", @@ -1446,11 +1480,11 @@ } }, "duplexify": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.0.tgz", - "integrity": "sha1-GqdzAC4VeEV+nZ1KULDMquvL1gQ=", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", "requires": { - "end-of-stream": "1.0.0", + "end-of-stream": "^1.0.0", "inherits": "^2.0.1", "readable-stream": "^2.0.0", "stream-shift": "^1.0.0" @@ -1788,11 +1822,11 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "falafel": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.0.0.tgz", - "integrity": "sha1-dX1HxTWYIDvtxV3C+AFfQ7gtWLA=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.1.0.tgz", + "integrity": "sha1-lrsXdh2rqU9G0AFzizzt86Z/4Gw=", "requires": { - "acorn": "^3.0.0", + "acorn": "^5.0.0", "foreach": "^2.0.5", "isarray": "0.0.1", "object-keys": "^1.0.6" @@ -1820,6 +1854,11 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, + "file-extension": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/file-extension/-/file-extension-4.0.5.tgz", + "integrity": "sha512-l0rOL3aKkoi6ea7MNZe6OHgqYYpn48Qfflr8Pe9G9JPPTx5A+sfboK91ZufzIs59/lPqh351l0eb6iKU9J5oGg==" + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -1837,15 +1876,6 @@ "repeat-string": "^1.5.2" } }, - "findup": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/findup/-/findup-0.1.5.tgz", - "integrity": "sha1-itkpozk7rGJ5V6fl3kYjsGsOLOs=", - "requires": { - "colors": "~0.6.0-1", - "commander": "~2.1.0" - } - }, "flatten": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", @@ -2433,7 +2463,7 @@ "dependencies": { "pex-math": { "version": "git://github.com/variablestudio/pex-math.git#1cdb0a0672f3a73be417499de4d5c03d56458565", - "integrity": "sha1-LsaG2nOJQWBzxDQtHcqLwZ+UmAY=" + "from": "pex-math@git://github.com/variablestudio/pex-math.git#1cdb0a0672f3a73be417499de4d5c03d56458565" } } }, @@ -2517,16 +2547,40 @@ "integrity": "sha1-EQ/Yl9Byn2OYMHOBVn0JRJQb8is=" }, "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.2", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "glob-base": { @@ -2546,6 +2600,11 @@ "is-glob": "^2.0.0" } }, + "glsl-fxaa": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/glsl-fxaa/-/glsl-fxaa-3.0.0.tgz", + "integrity": "sha1-9DIij7qdKopyQJQ8WT0gwxdvO5M=" + }, "glsl-gamma": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/glsl-gamma/-/glsl-gamma-2.0.0.tgz", @@ -2566,6 +2625,11 @@ "resolved": "https://registry.npmjs.org/glsl-inverse/-/glsl-inverse-1.0.0.tgz", "integrity": "sha1-EsCx0GX1WERNHm/q95td34qRiuY=" }, + "glsl-noise": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/glsl-noise/-/glsl-noise-0.0.0.tgz", + "integrity": "sha1-NndF86MzgsDu7Ey1S36Zz8HXZws=" + }, "glsl-resolve": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/glsl-resolve/-/glsl-resolve-0.0.1.tgz", @@ -2642,9 +2706,9 @@ "integrity": "sha1-RtHf6Yx1vX1QTAXX0RsbPpzJOxA=" }, "glsl-tokenizer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/glsl-tokenizer/-/glsl-tokenizer-2.1.2.tgz", - "integrity": "sha1-cgMHUi4DxXrzXABVGVDEpw7y37k=", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/glsl-tokenizer/-/glsl-tokenizer-2.1.4.tgz", + "integrity": "sha512-AkZgCYSRJVeVcg/n/D7q3WWyyf0CR+BXPxdM+kzE0ov8lf8BL6jWhL2+ZrCV5J6yHKTJUyW+pW8yltzGFb5wKw==", "requires": { "through2": "^0.6.3" }, @@ -2682,14 +2746,14 @@ "integrity": "sha1-Y6RKJIJur7x4B9fGzR1ZHAGWrpA=" }, "glslify": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/glslify/-/glslify-6.0.1.tgz", - "integrity": "sha1-og6bJHDa3ltr2leIXvDMNVqk2lU=", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-6.3.1.tgz", + "integrity": "sha512-3Hy85N8NmpDprwAxZaOC9k+DBXEwblVZ+yHIyt1QYg5dIrYaiGorz2WWBRxdUzapjDsxdhQ1ad9GSlIebxeBmA==", "requires": { "bl": "^1.0.0", "concat-stream": "^1.5.2", "duplexify": "^3.4.5", - "falafel": "^2.0.0", + "falafel": "^2.1.0", "from2": "^2.3.0", "glsl-resolve": "0.0.1", "glsl-token-whitespace-trim": "^1.0.0", @@ -2698,7 +2762,7 @@ "minimist": "^1.2.0", "resolve": "^1.1.5", "stack-trace": "0.0.9", - "static-eval": "^1.1.1", + "static-eval": "^2.0.0", "tape": "^4.6.0", "through2": "^2.0.1", "xtend": "^4.0.0" @@ -2722,12 +2786,12 @@ } }, "glslify-deps": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.0.tgz", - "integrity": "sha1-CyI0yOqePT/X9rPLfwOuWea1Glk=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.1.tgz", + "integrity": "sha512-Ogm179MCazwIRyEqs3g3EOY4Y3XIAa0yl8J5RE9rJC6QH1w8weVOp2RZu0mvnYy/2xIas1w166YR2eZdDkWQxg==", "requires": { + "@choojs/findup": "^0.2.0", "events": "^1.0.2", - "findup": "^0.1.5", "glsl-resolve": "0.0.1", "glsl-tokenizer": "^2.0.0", "graceful-fs": "^4.1.2", @@ -2973,11 +3037,6 @@ "xtend": "^4.0.0" }, "dependencies": { - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" - }, "acorn-node": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.5.2.tgz", @@ -3803,9 +3862,9 @@ } }, "object-inspect": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.2.1.tgz", - "integrity": "sha1-O2Iibrj21EF1HH2PIqIP+ArJ3D8=" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" }, "object-keys": { "version": "1.0.11", @@ -3884,7 +3943,7 @@ }, "opn": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz", + "resolved": "http://registry.npmjs.org/opn/-/opn-3.0.3.tgz", "integrity": "sha1-ttmec5n3jWXDuq/+8fsojpuFJDo=", "requires": { "object-assign": "^4.0.1" @@ -4032,9 +4091,9 @@ "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=" }, "pbkdf2": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", - "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", "requires": { "create-hash": "^1.1.2", "create-hmac": "^1.1.4", @@ -4044,9 +4103,9 @@ } }, "pem": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/pem/-/pem-1.13.0.tgz", - "integrity": "sha512-lu3uToByrBXs+PYTA2lgdX/5Mtm5GUKf0rZI0QaJHbo6N3nZliBcSTuQIAvHdwbRtCrFSow8Eq0g0NBxPIQgaw==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/pem/-/pem-1.13.1.tgz", + "integrity": "sha512-gA/kl8/MWWBaVRRv8M4iRkaJXEbp0L9NyG5ggZlbvQxylZAq5K5wGesAZifs89kwL/m4EGdekXtBMOzXM9rv7w==", "requires": { "es6-promisify": "^6.0.0", "md5": "^2.2.1", @@ -4171,12 +4230,12 @@ }, "pex-geom": { "version": "git://github.com/variablestudio/pex-geom.git#11ce6d5c5ff64302d421de4aaae27ae18132b8e0", - "integrity": "sha1-zZJdPKb61lS3WLQ2C6jSpZRge84=" + "from": "pex-geom@git://github.com/variablestudio/pex-geom.git#11ce6d5c5ff64302d421de4aaae27ae18132b8e0" }, "pex-gui": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pex-gui/-/pex-gui-2.2.0.tgz", - "integrity": "sha512-w9TZRpQsZuUnddeekeavWGbZgaNIBtCmFWW2LlYSEJbDgMwC8RLWl2+y/5As2JL+uUkHoNAi9MSjJ+CL/4dRkQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pex-gui/-/pex-gui-2.3.0.tgz", + "integrity": "sha512-/ylL2sN3RbQoBvm7/tlBKeKsAHuIiJpjRVAfJ8vTEwwZ7KqM6ksME2cleJnkqLsDPSFkflBi8vWGGxIFkzMZ0w==", "requires": { "float-hsl2rgb": "^1.0.2", "float-rgb2hsl": "^1.0.1", @@ -4188,9 +4247,9 @@ } }, "pex-io": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/pex-io/-/pex-io-1.5.0.tgz", - "integrity": "sha1-ttBNzggomMViUzvPqieL4zNwegE=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pex-io/-/pex-io-2.1.0.tgz", + "integrity": "sha512-dzct9DO6qptu7kC2yBU7BpxBFYrg7/74ucpDyxQE264hOFl7ns2gUhqRyJe4bw+hNBQpS2kAqNmSxN6S/VPGfg==", "requires": { "is-plask": "^1.1.0", "plask-wrap": "^1.0.0" @@ -4289,7 +4348,7 @@ }, "pretty-ms": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", "integrity": "sha1-QlfCVt8/sLRR1q/6qwIYhBJpgdw=", "requires": { "is-finite": "^1.0.1", @@ -4302,6 +4361,11 @@ "resolved": "https://registry.npmjs.org/primitive-cube/-/primitive-cube-2.0.0.tgz", "integrity": "sha1-XoNEVcg1E8q5jQTkK+d8WAzcVwc=" }, + "primitive-plane": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/primitive-plane/-/primitive-plane-2.0.0.tgz", + "integrity": "sha1-hdwqhYMV0XNdXehxB8iKRAibyd0=" + }, "primitive-sphere": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/primitive-sphere/-/primitive-sphere-3.0.0.tgz", @@ -5244,9 +5308,9 @@ "integrity": "sha1-LH+jjMfjejQRp3zY55LeRI+faXU=" }, "static-eval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-1.1.1.tgz", - "integrity": "sha1-yoEwIQNUzxPZpyK8fpI3eEV7sZI=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-2.0.0.tgz", + "integrity": "sha512-6flshd3F1Gwm+Ksxq463LtFd1liC77N/PX1FVVc3OzL3hAmo2fwHFbuArkcfi7s9rTNsLEhcRmXGFZhlgy40uw==", "requires": { "escodegen": "^1.8.1" } @@ -5613,29 +5677,88 @@ } }, "tape": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/tape/-/tape-4.6.3.tgz", - "integrity": "sha1-Y353WB6ass4XV36b1M5PV1gG2LY=", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-4.9.1.tgz", + "integrity": "sha512-6fKIXknLpoe/Jp4rzHKFPpJUHDHDqn8jus99IfPnHIjyz78HYlefTGD3b5EkbQzuLfaEvmfPK3IolLgq2xT3kw==", "requires": { "deep-equal": "~1.0.1", "defined": "~1.0.0", - "for-each": "~0.3.2", - "function-bind": "~1.1.0", - "glob": "~7.1.1", - "has": "~1.0.1", + "for-each": "~0.3.3", + "function-bind": "~1.1.1", + "glob": "~7.1.2", + "has": "~1.0.3", "inherits": "~2.0.3", "minimist": "~1.2.0", - "object-inspect": "~1.2.1", - "resolve": "~1.1.7", + "object-inspect": "~1.6.0", + "resolve": "~1.7.1", "resumer": "~0.0.0", "string.prototype.trim": "~1.1.2", "through": "~2.3.8" }, "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "requires": { + "path-parse": "^1.0.5" + } } } }, diff --git a/examples/package.json b/examples/package.json index 9657fc1..8d3f45a 100644 --- a/examples/package.json +++ b/examples/package.json @@ -12,22 +12,26 @@ "baboon-image": "^2.1.0", "budo": "^11.3.2", "bunny": "^1.0.1", + "canvas-screenshot": "^1.0.0", "flatten": "^1.0.2", "geom-center-and-normalize": "^1.0.1", "geom-normals": "^1.0.1", "geom-split-vertices": "^1.0.0", + "glsl-fxaa": "^3.0.0", "glsl-gamma": "^2.0.0", "glsl-inverse": "^1.0.0", + "glsl-noise": "0.0.0", "glsl-transpose": "^1.0.0", - "glslify": "^6.0.1", + "glslify": "^6.3.1", "normals": "^1.1.0", "pex-cam": "^2.6.0", - "pex-gui": "^2.2.0", - "pex-io": "^1.5.0", + "pex-gui": "^2.3.0", + "pex-io": "^2.1.0", "pex-materials": "^1.1.1", "pex-math": "^2.1.0", "pex-random": "^1.0.1", "primitive-cube": "^2.0.0", + "primitive-plane": "^2.0.0", "primitive-sphere": "^3.0.0", "raf": "^3.3.0", "simplex-noise": "^2.3.0",