diff --git a/examples/shader-ast-noise/src/index.ts b/examples/shader-ast-noise/src/index.ts index 0112b17656..0e93ea7370 100644 --- a/examples/shader-ast-noise/src/index.ts +++ b/examples/shader-ast-noise/src/index.ts @@ -40,7 +40,7 @@ const JS = targetJS(); const mainImage = defn( "vec4", "mainImage", - [["vec2", "fragCoord"], ["vec2", "res"], ["float", "time"]], + ["vec2", "vec2", "float"], (fragCoord, res, time) => { let uv: Vec2Sym; let col: FloatSym; diff --git a/examples/shader-ast-raymarch/src/index.ts b/examples/shader-ast-raymarch/src/index.ts index c4d0298539..23e9bdcc73 100644 --- a/examples/shader-ast-raymarch/src/index.ts +++ b/examples/shader-ast-raymarch/src/index.ts @@ -56,7 +56,7 @@ const JS = targetJS(); // scene definition for raymarch function. uses SDF primitive functions // included in "standard library" bundled with shader-ast pkg -const scene = defn("vec2", "scene", [["vec3"]], (pos) => { +const scene = defn("vec2", "scene", ["vec3"], (pos) => { let d1: FloatSym; let d2: FloatSym; let d3: FloatSym; @@ -89,7 +89,7 @@ const scene = defn("vec2", "scene", [["vec3"]], (pos) => { const mainImage = defn( "vec4", "mainImage", - [["vec2"], ["vec2"], ["vec3"], ["vec3"]], + ["vec2", "vec2", "vec3", "vec3"], (frag, res, eyePos, lightDir) => { let dir: Vec3Sym; let result: Vec2Sym; diff --git a/examples/shader-ast-sdf2d/src/index.ts b/examples/shader-ast-sdf2d/src/index.ts index c6b799a674..9e7c85bd00 100644 --- a/examples/shader-ast-sdf2d/src/index.ts +++ b/examples/shader-ast-sdf2d/src/index.ts @@ -41,7 +41,7 @@ const JS = targetJS(); // scene definition for raymarch function. uses SDF primitive functions // included in "standard library" bundled with shader-ast pkg -const scene = defn("float", "scene", [["vec2"]], (pos) => { +const scene = defn("float", "scene", ["vec2"], (pos) => { let d1: FloatSym; let d2: FloatSym; let d3: FloatSym; @@ -69,30 +69,25 @@ const scene = defn("float", "scene", [["vec2"]], (pos) => { // main fragment shader function // again uses several shader-ast std lib helpers -const mainImage = defn( - "vec4", - "mainImage", - [["vec2", "fragCoord"], ["vec2", "res"]], - (frag, res) => { - let uv: Vec2Sym; - let d: FloatSym; - let f = 100; - return [ - (uv = sym(mul(aspectCorrectedUV(frag, res), float(2)))), - (d = sym(scene(uv))), - ret( - vec4( - vec3( - fit1101(cos(mul(d, float(f)))), - fit1101(cos(mul(d, float(f * 1.02)))), - fit1101(cos(mul(d, float(f * 1.05)))) - ), - 1 - ) +const mainImage = defn("vec4", "mainImage", ["vec2", "vec2"], (frag, res) => { + let uv: Vec2Sym; + let d: FloatSym; + let f = 100; + return [ + (uv = sym(mul(aspectCorrectedUV(frag, res), float(2)))), + (d = sym(scene(uv))), + ret( + vec4( + vec3( + fit1101(cos(mul(d, float(f)))), + fit1101(cos(mul(d, float(f * 1.02)))), + fit1101(cos(mul(d, float(f * 1.05)))) + ), + 1 ) - ]; - } -); + ) + ]; +}); // build call graph for given entry function, sort in topological order // and bundle all functions in a global scope for code generation... diff --git a/examples/shader-ast-tunnel/src/index.ts b/examples/shader-ast-tunnel/src/index.ts index 89e68f38c0..b9618d4510 100644 --- a/examples/shader-ast-tunnel/src/index.ts +++ b/examples/shader-ast-tunnel/src/index.ts @@ -46,12 +46,7 @@ const JS = targetJS(); const mainImage = defn( "vec4", "mainImage", - [ - ["vec2", "fragCoord"], - ["vec2", "res"], - ["float", "time"], - ["sampler2D", "tex"] - ], + ["vec2", "vec2", "float", "sampler2D"], (frag, res, time, tex) => { let p: Vec2Sym; let uv: Vec2Sym; diff --git a/examples/webgl-msdf/src/index.ts b/examples/webgl-msdf/src/index.ts index 56917cd584..be22a7c4c2 100644 --- a/examples/webgl-msdf/src/index.ts +++ b/examples/webgl-msdf/src/index.ts @@ -29,7 +29,7 @@ import { map } from "@thi.ng/transducers"; import { AttribPool, GLType } from "@thi.ng/vector-pools"; import { fit3, - madd, + madd3, mixN, mulN, ReadonlyVec, @@ -256,8 +256,8 @@ const app = () => { if (!body) return; adaptDPI(el, window.innerWidth, window.innerHeight); // prettier-ignore - const eye = madd( - null, + const eye = madd3( + [], mouse.deref() || ZERO3, [2, 0.5, 0], [0, -4, 5] diff --git a/packages/adjacency/CHANGELOG.md b/packages/adjacency/CHANGELOG.md index 2a616b3526..76d163fea2 100644 --- a/packages/adjacency/CHANGELOG.md +++ b/packages/adjacency/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.16...@thi.ng/adjacency@0.1.17) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/adjacency + + + + + ## [0.1.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.15...@thi.ng/adjacency@0.1.16) (2019-07-07) **Note:** Version bump only for package @thi.ng/adjacency diff --git a/packages/adjacency/package.json b/packages/adjacency/package.json index 6cacd4db0e..9801466e65 100644 --- a/packages/adjacency/package.json +++ b/packages/adjacency/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/adjacency", - "version": "0.1.16", + "version": "0.1.17", "description": "Sparse & bitwise adjacency matrices for directed / undirected graphs", "module": "./index.js", "main": "./lib/index.js", @@ -24,7 +24,7 @@ "pub": "yarn build && yarn publish --access public" }, "devDependencies": { - "@thi.ng/vectors": "^3.0.0", + "@thi.ng/vectors": "^3.0.1", "@types/mocha": "^5.2.6", "@types/node": "^12.0.8", "mocha": "^6.1.4", diff --git a/packages/color/CHANGELOG.md b/packages/color/CHANGELOG.md index 06c5c8c108..6b05ea6c8f 100644 --- a/packages/color/CHANGELOG.md +++ b/packages/color/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.2.0...@thi.ng/color@0.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/color + + + + + # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.21...@thi.ng/color@0.2.0) (2019-07-07) diff --git a/packages/color/package.json b/packages/color/package.json index a0d2d4aa39..2e3a351cf6 100644 --- a/packages/color/package.json +++ b/packages/color/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/color", - "version": "0.2.0", + "version": "0.2.1", "description": "Raw, array-based, color ops, conversions, opt. type wrappers, multi-color gradients", "module": "./index.js", "main": "./lib/index.js", @@ -39,7 +39,7 @@ "@thi.ng/math": "^1.4.0", "@thi.ng/strings": "^1.2.0", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "alpha", diff --git a/packages/geom-accel/CHANGELOG.md b/packages/geom-accel/CHANGELOG.md index 2057d99ae4..6c49fe1e4b 100644 --- a/packages/geom-accel/CHANGELOG.md +++ b/packages/geom-accel/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.2.0...@thi.ng/geom-accel@1.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-accel + + + + + # [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.17...@thi.ng/geom-accel@1.2.0) (2019-07-07) diff --git a/packages/geom-accel/package.json b/packages/geom-accel/package.json index 935f727bd5..5a96ff7fdd 100644 --- a/packages/geom-accel/package.json +++ b/packages/geom-accel/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-accel", - "version": "1.2.0", + "version": "1.2.1", "description": "nD spatial indexing data structures", "module": "./index.js", "main": "./lib/index.js", @@ -34,11 +34,11 @@ "dependencies": { "@thi.ng/api": "^6.3.0", "@thi.ng/arrays": "^0.2.0", - "@thi.ng/geom-api": "^0.2.4", + "@thi.ng/geom-api": "^0.2.5", "@thi.ng/heaps": "^1.1.0", "@thi.ng/math": "^1.4.0", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-api/CHANGELOG.md b/packages/geom-api/CHANGELOG.md index c1f0585079..8b26dc3156 100644 --- a/packages/geom-api/CHANGELOG.md +++ b/packages/geom-api/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.2.4...@thi.ng/geom-api@0.2.5) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-api + + + + + ## [0.2.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.2.3...@thi.ng/geom-api@0.2.4) (2019-07-07) **Note:** Version bump only for package @thi.ng/geom-api diff --git a/packages/geom-api/package.json b/packages/geom-api/package.json index 0b51598bf3..12cb61efdf 100644 --- a/packages/geom-api/package.json +++ b/packages/geom-api/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-api", - "version": "0.2.4", + "version": "0.2.5", "description": "Shared type & interface declarations for @thi.ng/geom packages", "module": "./index.js", "main": "./lib/index.js", @@ -33,7 +33,7 @@ }, "dependencies": { "@thi.ng/api": "^6.3.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "ES6", diff --git a/packages/geom-arc/CHANGELOG.md b/packages/geom-arc/CHANGELOG.md index e67ff1b8b3..d22f8e510a 100644 --- a/packages/geom-arc/CHANGELOG.md +++ b/packages/geom-arc/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.2.0...@thi.ng/geom-arc@0.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-arc + + + + + # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.17...@thi.ng/geom-arc@0.2.0) (2019-07-07) diff --git a/packages/geom-arc/package.json b/packages/geom-arc/package.json index 38a359184a..ad445a11b6 100644 --- a/packages/geom-arc/package.json +++ b/packages/geom-arc/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-arc", - "version": "0.2.0", + "version": "0.2.1", "description": "2D circular / elliptic arc operations", "module": "./index.js", "main": "./lib/index.js", @@ -33,10 +33,10 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-resample": "^0.2.0", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-resample": "^0.2.1", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-clip/CHANGELOG.md b/packages/geom-clip/CHANGELOG.md index 53678fc2f9..81d2dc4fa5 100644 --- a/packages/geom-clip/CHANGELOG.md +++ b/packages/geom-clip/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.1.0...@thi.ng/geom-clip@0.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-clip + + + + + # [0.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.19...@thi.ng/geom-clip@0.1.0) (2019-07-07) diff --git a/packages/geom-clip/package.json b/packages/geom-clip/package.json index d639419dfb..48e95868b8 100644 --- a/packages/geom-clip/package.json +++ b/packages/geom-clip/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-clip", - "version": "0.1.0", + "version": "0.1.1", "description": "2D line & convex polygon clipping (Liang-Barsky / Sutherland-Hodgeman)", "module": "./index.js", "main": "./lib/index.js", @@ -32,10 +32,10 @@ "typescript": "^3.5.2" }, "dependencies": { - "@thi.ng/geom-isec": "^0.3.0", - "@thi.ng/geom-poly-utils": "^0.1.18", + "@thi.ng/geom-isec": "^0.3.1", + "@thi.ng/geom-poly-utils": "^0.1.19", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-closest-point/CHANGELOG.md b/packages/geom-closest-point/CHANGELOG.md index 53feedd876..9799ae1923 100644 --- a/packages/geom-closest-point/CHANGELOG.md +++ b/packages/geom-closest-point/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.3.0...@thi.ng/geom-closest-point@0.3.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-closest-point + + + + + # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.2.3...@thi.ng/geom-closest-point@0.3.0) (2019-07-07) diff --git a/packages/geom-closest-point/package.json b/packages/geom-closest-point/package.json index df63a482be..c3dcd7cdb1 100644 --- a/packages/geom-closest-point/package.json +++ b/packages/geom-closest-point/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-closest-point", - "version": "0.3.0", + "version": "0.3.1", "description": "Closest point / proximity helpers", "module": "./index.js", "main": "./lib/index.js", @@ -33,7 +33,7 @@ }, "dependencies": { "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "ES6", diff --git a/packages/geom-hull/CHANGELOG.md b/packages/geom-hull/CHANGELOG.md index db462a5eb7..dd5502e761 100644 --- a/packages/geom-hull/CHANGELOG.md +++ b/packages/geom-hull/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.0.21](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.20...@thi.ng/geom-hull@0.0.21) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-hull + + + + + ## [0.0.20](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.19...@thi.ng/geom-hull@0.0.20) (2019-07-07) **Note:** Version bump only for package @thi.ng/geom-hull diff --git a/packages/geom-hull/package.json b/packages/geom-hull/package.json index 31fae02ec9..204f0f6cea 100644 --- a/packages/geom-hull/package.json +++ b/packages/geom-hull/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-hull", - "version": "0.0.20", + "version": "0.0.21", "description": "Fast 2D convex hull (Graham Scan)", "module": "./index.js", "main": "./lib/index.js", @@ -33,7 +33,7 @@ }, "dependencies": { "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-isec/CHANGELOG.md b/packages/geom-isec/CHANGELOG.md index cc6c174655..9a3f97610a 100644 --- a/packages/geom-isec/CHANGELOG.md +++ b/packages/geom-isec/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.3.0...@thi.ng/geom-isec@0.3.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-isec + + + + + # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.2.0...@thi.ng/geom-isec@0.3.0) (2019-07-07) diff --git a/packages/geom-isec/package.json b/packages/geom-isec/package.json index 4783ea8778..1b71568278 100644 --- a/packages/geom-isec/package.json +++ b/packages/geom-isec/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-isec", - "version": "0.3.0", + "version": "0.3.1", "description": "2D/3D shape intersection checks", "module": "./index.js", "main": "./lib/index.js", @@ -33,10 +33,10 @@ }, "dependencies": { "@thi.ng/api": "^6.3.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-closest-point": "^0.3.0", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-closest-point": "^0.3.1", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-isoline/CHANGELOG.md b/packages/geom-isoline/CHANGELOG.md index f8f33a181b..8e1ad8401b 100644 --- a/packages/geom-isoline/CHANGELOG.md +++ b/packages/geom-isoline/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.19](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.18...@thi.ng/geom-isoline@0.1.19) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-isoline + + + + + ## [0.1.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.17...@thi.ng/geom-isoline@0.1.18) (2019-07-07) **Note:** Version bump only for package @thi.ng/geom-isoline diff --git a/packages/geom-isoline/package.json b/packages/geom-isoline/package.json index 860b9a8ebf..cf80306317 100644 --- a/packages/geom-isoline/package.json +++ b/packages/geom-isoline/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-isoline", - "version": "0.1.18", + "version": "0.1.19", "description": "Fast 2D contour line extraction / generation", "module": "./index.js", "main": "./lib/index.js", @@ -33,7 +33,7 @@ }, "dependencies": { "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-poly-utils/CHANGELOG.md b/packages/geom-poly-utils/CHANGELOG.md index 43b410168e..41535fd288 100644 --- a/packages/geom-poly-utils/CHANGELOG.md +++ b/packages/geom-poly-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.19](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.18...@thi.ng/geom-poly-utils@0.1.19) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-poly-utils + + + + + ## [0.1.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.17...@thi.ng/geom-poly-utils@0.1.18) (2019-07-07) diff --git a/packages/geom-poly-utils/package.json b/packages/geom-poly-utils/package.json index b8f3bb747d..a9518ee817 100644 --- a/packages/geom-poly-utils/package.json +++ b/packages/geom-poly-utils/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-poly-utils", - "version": "0.1.18", + "version": "0.1.19", "description": "Polygon / triangle analysis & processing utilities", "module": "./index.js", "main": "./lib/index.js", @@ -33,9 +33,9 @@ }, "dependencies": { "@thi.ng/errors": "^1.1.0", - "@thi.ng/geom-api": "^0.2.4", + "@thi.ng/geom-api": "^0.2.5", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-resample/CHANGELOG.md b/packages/geom-resample/CHANGELOG.md index 9784037ed3..6356a7b7c3 100644 --- a/packages/geom-resample/CHANGELOG.md +++ b/packages/geom-resample/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.2.0...@thi.ng/geom-resample@0.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-resample + + + + + # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.17...@thi.ng/geom-resample@0.2.0) (2019-07-07) diff --git a/packages/geom-resample/package.json b/packages/geom-resample/package.json index 3a5baac7d5..3d1f7d225d 100644 --- a/packages/geom-resample/package.json +++ b/packages/geom-resample/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-resample", - "version": "0.2.0", + "version": "0.2.1", "description": "Customizable nD polyline interpolation, re-sampling, splitting & nearest point computation", "module": "./index.js", "main": "./lib/index.js", @@ -33,10 +33,10 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-closest-point": "^0.3.0", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-closest-point": "^0.3.1", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-splines/CHANGELOG.md b/packages/geom-splines/CHANGELOG.md index a8bb7e79cd..81a95267d7 100644 --- a/packages/geom-splines/CHANGELOG.md +++ b/packages/geom-splines/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.2.0...@thi.ng/geom-splines@0.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-splines + + + + + # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.17...@thi.ng/geom-splines@0.2.0) (2019-07-07) diff --git a/packages/geom-splines/package.json b/packages/geom-splines/package.json index 07adef3397..bb74378a38 100644 --- a/packages/geom-splines/package.json +++ b/packages/geom-splines/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-splines", - "version": "0.2.0", + "version": "0.2.1", "description": "nD cubic & quadratic curve analysis, conversion, interpolation, splitting", "module": "./index.js", "main": "./lib/index.js", @@ -33,11 +33,11 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-arc": "^0.2.0", - "@thi.ng/geom-resample": "^0.2.0", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-arc": "^0.2.1", + "@thi.ng/geom-resample": "^0.2.1", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-subdiv-curve/CHANGELOG.md b/packages/geom-subdiv-curve/CHANGELOG.md index e3cb5de442..25886d55a2 100644 --- a/packages/geom-subdiv-curve/CHANGELOG.md +++ b/packages/geom-subdiv-curve/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.17...@thi.ng/geom-subdiv-curve@0.1.18) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-subdiv-curve + + + + + ## [0.1.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.16...@thi.ng/geom-subdiv-curve@0.1.17) (2019-07-07) **Note:** Version bump only for package @thi.ng/geom-subdiv-curve diff --git a/packages/geom-subdiv-curve/package.json b/packages/geom-subdiv-curve/package.json index b0da46cb40..d2c8535f16 100644 --- a/packages/geom-subdiv-curve/package.json +++ b/packages/geom-subdiv-curve/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-subdiv-curve", - "version": "0.1.17", + "version": "0.1.18", "description": "Freely customizable, iterative subdivision curves for open / closed input geometries", "module": "./index.js", "main": "./lib/index.js", @@ -32,9 +32,9 @@ "typescript": "^3.5.2" }, "dependencies": { - "@thi.ng/geom-api": "^0.2.4", + "@thi.ng/geom-api": "^0.2.5", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-tessellate/CHANGELOG.md b/packages/geom-tessellate/CHANGELOG.md index 87fd584dc3..367d66d41d 100644 --- a/packages/geom-tessellate/CHANGELOG.md +++ b/packages/geom-tessellate/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.2.0...@thi.ng/geom-tessellate@0.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-tessellate + + + + + # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.17...@thi.ng/geom-tessellate@0.2.0) (2019-07-07) diff --git a/packages/geom-tessellate/package.json b/packages/geom-tessellate/package.json index 9fcfc33214..fcb1a6c4a3 100644 --- a/packages/geom-tessellate/package.json +++ b/packages/geom-tessellate/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-tessellate", - "version": "0.2.0", + "version": "0.2.1", "description": "2D/3D polygon tessellators", "module": "./index.js", "main": "./lib/index.js", @@ -33,11 +33,11 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-isec": "^0.3.0", - "@thi.ng/geom-poly-utils": "^0.1.18", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-isec": "^0.3.1", + "@thi.ng/geom-poly-utils": "^0.1.19", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom-voronoi/CHANGELOG.md b/packages/geom-voronoi/CHANGELOG.md index 8910c82ab8..bb1aefcdd8 100644 --- a/packages/geom-voronoi/CHANGELOG.md +++ b/packages/geom-voronoi/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.19](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.18...@thi.ng/geom-voronoi@0.1.19) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom-voronoi + + + + + ## [0.1.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.17...@thi.ng/geom-voronoi@0.1.18) (2019-07-07) **Note:** Version bump only for package @thi.ng/geom-voronoi diff --git a/packages/geom-voronoi/package.json b/packages/geom-voronoi/package.json index 4b2250138d..e8692a3a4b 100644 --- a/packages/geom-voronoi/package.json +++ b/packages/geom-voronoi/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-voronoi", - "version": "0.1.18", + "version": "0.1.19", "description": "Fast, incremental 2D Delaunay & Voronoi mesh implementation", "module": "./index.js", "main": "./lib/index.js", @@ -34,12 +34,12 @@ "dependencies": { "@thi.ng/api": "^6.3.0", "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-clip": "^0.1.0", - "@thi.ng/geom-isec": "^0.3.0", - "@thi.ng/geom-poly-utils": "^0.1.18", + "@thi.ng/geom-clip": "^0.1.1", + "@thi.ng/geom-isec": "^0.3.1", + "@thi.ng/geom-poly-utils": "^0.1.19", "@thi.ng/math": "^1.4.0", "@thi.ng/quad-edge": "^0.2.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/geom/CHANGELOG.md b/packages/geom/CHANGELOG.md index 2e9b0cb87b..91d0b805a7 100644 --- a/packages/geom/CHANGELOG.md +++ b/packages/geom/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.6.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.6.0...@thi.ng/geom@1.6.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/geom + + + + + # [1.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.5.0...@thi.ng/geom@1.6.0) (2019-07-07) diff --git a/packages/geom/package.json b/packages/geom/package.json index 086210c695..d1fcebfa13 100644 --- a/packages/geom/package.json +++ b/packages/geom/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom", - "version": "1.6.0", + "version": "1.6.1", "description": "2D geometry types, polymorphic operations, SVG generation", "module": "./index.js", "main": "./lib/index.js", @@ -39,24 +39,24 @@ "@thi.ng/defmulti": "^1.1.0", "@thi.ng/equiv": "^1.0.7", "@thi.ng/errors": "^1.1.0", - "@thi.ng/geom-api": "^0.2.4", - "@thi.ng/geom-arc": "^0.2.0", - "@thi.ng/geom-clip": "^0.1.0", - "@thi.ng/geom-closest-point": "^0.3.0", - "@thi.ng/geom-hull": "^0.0.20", - "@thi.ng/geom-isec": "^0.3.0", - "@thi.ng/geom-poly-utils": "^0.1.18", - "@thi.ng/geom-resample": "^0.2.0", - "@thi.ng/geom-splines": "^0.2.0", - "@thi.ng/geom-subdiv-curve": "^0.1.17", - "@thi.ng/geom-tessellate": "^0.2.0", + "@thi.ng/geom-api": "^0.2.5", + "@thi.ng/geom-arc": "^0.2.1", + "@thi.ng/geom-clip": "^0.1.1", + "@thi.ng/geom-closest-point": "^0.3.1", + "@thi.ng/geom-hull": "^0.0.21", + "@thi.ng/geom-isec": "^0.3.1", + "@thi.ng/geom-poly-utils": "^0.1.19", + "@thi.ng/geom-resample": "^0.2.1", + "@thi.ng/geom-splines": "^0.2.1", + "@thi.ng/geom-subdiv-curve": "^0.1.18", + "@thi.ng/geom-tessellate": "^0.2.1", "@thi.ng/hiccup": "^3.2.0", - "@thi.ng/hiccup-svg": "^3.2.0", + "@thi.ng/hiccup-svg": "^3.2.1", "@thi.ng/math": "^1.4.0", - "@thi.ng/matrices": "^0.5.0", + "@thi.ng/matrices": "^0.5.1", "@thi.ng/random": "^1.1.8", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/hdom-canvas/CHANGELOG.md b/packages/hdom-canvas/CHANGELOG.md index 9384f979a3..c07734cf70 100644 --- a/packages/hdom-canvas/CHANGELOG.md +++ b/packages/hdom-canvas/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.1.0...@thi.ng/hdom-canvas@2.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.18...@thi.ng/hdom-canvas@2.1.0) (2019-07-07) diff --git a/packages/hdom-canvas/package.json b/packages/hdom-canvas/package.json index 1d99572ba0..a5451556b9 100644 --- a/packages/hdom-canvas/package.json +++ b/packages/hdom-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom-canvas", - "version": "2.1.0", + "version": "2.1.1", "description": "Declarative canvas scenegraph & visualization for @thi.ng/hdom", "module": "./index.js", "main": "./lib/index.js", @@ -34,7 +34,7 @@ "dependencies": { "@thi.ng/api": "^6.3.0", "@thi.ng/checks": "^2.2.0", - "@thi.ng/color": "^0.2.0", + "@thi.ng/color": "^0.2.1", "@thi.ng/diff": "^3.2.0", "@thi.ng/hdom": "^8.0.0" }, diff --git a/packages/hiccup-svg/CHANGELOG.md b/packages/hiccup-svg/CHANGELOG.md index 9a95d0b1cb..cbbb089424 100644 --- a/packages/hiccup-svg/CHANGELOG.md +++ b/packages/hiccup-svg/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-svg@3.2.0...@thi.ng/hiccup-svg@3.2.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/hiccup-svg + + + + + # [3.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-svg@3.1.22...@thi.ng/hiccup-svg@3.2.0) (2019-07-07) diff --git a/packages/hiccup-svg/package.json b/packages/hiccup-svg/package.json index df023459f1..db89f164d9 100644 --- a/packages/hiccup-svg/package.json +++ b/packages/hiccup-svg/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup-svg", - "version": "3.2.0", + "version": "3.2.1", "description": "SVG element functions for @thi.ng/hiccup & @thi.ng/hdom", "module": "./index.js", "main": "./lib/index.js", @@ -33,7 +33,7 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/color": "^0.2.0", + "@thi.ng/color": "^0.2.1", "@thi.ng/hiccup": "^3.2.0" }, "keywords": [ diff --git a/packages/lsys/CHANGELOG.md b/packages/lsys/CHANGELOG.md index 1418f5292f..c263135d48 100644 --- a/packages/lsys/CHANGELOG.md +++ b/packages/lsys/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/lsys@0.2.15...@thi.ng/lsys@0.2.16) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/lsys + + + + + ## [0.2.15](https://github.com/thi-ng/umbrella/compare/@thi.ng/lsys@0.2.14...@thi.ng/lsys@0.2.15) (2019-07-07) **Note:** Version bump only for package @thi.ng/lsys diff --git a/packages/lsys/package.json b/packages/lsys/package.json index 07ed264ac5..0b05a20a94 100644 --- a/packages/lsys/package.json +++ b/packages/lsys/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/lsys", - "version": "0.2.15", + "version": "0.2.16", "description": "Functional, extensible L-System architecture w/ support for probabilistic rules", "module": "./index.js", "main": "./lib/index.js", @@ -38,7 +38,7 @@ "@thi.ng/math": "^1.4.0", "@thi.ng/random": "^1.1.8", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "axiom", diff --git a/packages/matrices/CHANGELOG.md b/packages/matrices/CHANGELOG.md index fa720909a3..caec2dd60e 100644 --- a/packages/matrices/CHANGELOG.md +++ b/packages/matrices/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.5.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/matrices@0.5.0...@thi.ng/matrices@0.5.1) (2019-07-08) + + +### Bug Fixes + +* **matrices:** mixQ result handling ([cc9ab35](https://github.com/thi-ng/umbrella/commit/cc9ab35)) + + + + + # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/matrices@0.4.0...@thi.ng/matrices@0.5.0) (2019-07-07) diff --git a/packages/matrices/package.json b/packages/matrices/package.json index cb03d0fefc..7b7182d14a 100644 --- a/packages/matrices/package.json +++ b/packages/matrices/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/matrices", - "version": "0.5.0", + "version": "0.5.1", "description": "Matrix & quaternion operations for 2D/3D geometry processing", "module": "./index.js", "main": "./lib/index.js", @@ -35,7 +35,7 @@ "@thi.ng/api": "^6.3.0", "@thi.ng/checks": "^2.2.0", "@thi.ng/math": "^1.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2D", diff --git a/packages/matrices/src/mixq.ts b/packages/matrices/src/mixq.ts index 8486ed77d6..c9645127b7 100644 --- a/packages/matrices/src/mixq.ts +++ b/packages/matrices/src/mixq.ts @@ -37,7 +37,8 @@ export const mixQ = ( u = Math.sin(theta * (1 - t)) / stheta; v = Math.sin(theta * t) / stheta; } - return maddN4(null, b, v, mulN4(out, a, u)); + !out && (out = a); + return maddN4(out, b, v, mulN4(out, a, u)); } return a !== out ? set4(out, a) : out; }; diff --git a/packages/poisson/CHANGELOG.md b/packages/poisson/CHANGELOG.md index 65fd50ab70..032ed4e61c 100644 --- a/packages/poisson/CHANGELOG.md +++ b/packages/poisson/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/poisson@0.2.17...@thi.ng/poisson@0.2.18) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/poisson + + + + + ## [0.2.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/poisson@0.2.16...@thi.ng/poisson@0.2.17) (2019-07-07) **Note:** Version bump only for package @thi.ng/poisson diff --git a/packages/poisson/package.json b/packages/poisson/package.json index d69c915daa..afaf749430 100644 --- a/packages/poisson/package.json +++ b/packages/poisson/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/poisson", - "version": "0.2.17", + "version": "0.2.18", "description": "nD Poisson-disc sampling w/ support for spatial density functions and custom PRNGs", "module": "./index.js", "main": "./lib/index.js", @@ -33,9 +33,9 @@ }, "dependencies": { "@thi.ng/checks": "^2.2.0", - "@thi.ng/geom-api": "^0.2.4", + "@thi.ng/geom-api": "^0.2.5", "@thi.ng/random": "^1.1.8", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "2d", diff --git a/packages/resolve-map/CHANGELOG.md b/packages/resolve-map/CHANGELOG.md index a51af696a5..51197e615a 100644 --- a/packages/resolve-map/CHANGELOG.md +++ b/packages/resolve-map/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@4.1.1...@thi.ng/resolve-map@4.1.2) (2019-07-08) + + +### Bug Fixes + +* **resolve-map:** fix [#97](https://github.com/thi-ng/umbrella/issues/97), update to consider trailing comma & whitespace ([de9532b](https://github.com/thi-ng/umbrella/commit/de9532b)) + + + + + +## [4.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@4.1.0...@thi.ng/resolve-map@4.1.1) (2019-07-08) + + +### Bug Fixes + +* **resolve-map:** fix [#97](https://github.com/thi-ng/umbrella/issues/97), update fn arg destructuring ([e68dc19](https://github.com/thi-ng/umbrella/commit/e68dc19)) + + + + + # [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@4.0.12...@thi.ng/resolve-map@4.1.0) (2019-07-07) diff --git a/packages/resolve-map/package.json b/packages/resolve-map/package.json index 93793dfa9a..86ee823985 100644 --- a/packages/resolve-map/package.json +++ b/packages/resolve-map/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/resolve-map", - "version": "4.1.0", + "version": "4.1.2", "description": "DAG resolution of vanilla objects & arrays with internally linked values", "module": "./index.js", "main": "./lib/index.js", diff --git a/packages/resolve-map/src/index.ts b/packages/resolve-map/src/index.ts index bfd2e1186e..dff5ce607a 100644 --- a/packages/resolve-map/src/index.ts +++ b/packages/resolve-map/src/index.ts @@ -244,7 +244,8 @@ const resolveFunction = ( let res; if (match) { const args = match[2] - .replace(/\s/g, "") + // remove white space and trailing comma + .replace(/\s|(,\s*$)/g, "") .split(/,/g) .map((k) => k.split(":")[0]) .reduce((acc: any, k) => ((acc[k] = resolve(k)), acc), {}); diff --git a/packages/resolve-map/test/index.ts b/packages/resolve-map/test/index.ts index f4c66b8915..85d0dddda0 100644 --- a/packages/resolve-map/test/index.ts +++ b/packages/resolve-map/test/index.ts @@ -2,7 +2,6 @@ import * as tx from "@thi.ng/transducers"; import * as assert from "assert"; import { resolve, ResolveFn } from "../src/index"; - describe("resolve-map", () => { it("simple", () => { assert.deepEqual(resolve({ a: 1, b: "@a" }), { a: 1, b: 1 }); @@ -146,4 +145,39 @@ describe("resolve-map", () => { } ); }); + + it("destructures w/ local renames", () => { + assert.deepEqual(resolve({ a: 1, b: ({ a: aa }: any) => aa }), { + a: 1, + b: 1 + }); + }); + + it("destructures w/ trailing comma", () => { + assert.deepEqual( + // since prettier is running over this file + // build function dynamically to force trailing comma + resolve({ a: 1, b: 2, c: new Function("{a,b,}", "return a + b") }), + { a: 1, b: 2, c: 3 }, + "comma only" + ); + assert.deepEqual( + resolve({ + a: 1, + b: 2, + c: new Function("{ a, b, }", "return a + b") + }), + { a: 1, b: 2, c: 3 }, + "comma & whitespaces" + ); + assert.deepEqual( + resolve({ + a: 1, + b: 2, + c: new Function("{ a, b: bb, }", "return a + bb") + }), + { a: 1, b: 2, c: 3 }, + "comma & whitespaces & rename" + ); + }); }); diff --git a/packages/rstream-graph/CHANGELOG.md b/packages/rstream-graph/CHANGELOG.md index b9e4555aa2..b3cc67fab8 100644 --- a/packages/rstream-graph/CHANGELOG.md +++ b/packages/rstream-graph/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@3.1.1...@thi.ng/rstream-graph@3.1.2) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/rstream-graph + + + + + +## [3.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@3.1.0...@thi.ng/rstream-graph@3.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/rstream-graph + + + + + # [3.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@3.0.26...@thi.ng/rstream-graph@3.1.0) (2019-07-07) diff --git a/packages/rstream-graph/package.json b/packages/rstream-graph/package.json index c6bbef2ad2..7574ae7a95 100644 --- a/packages/rstream-graph/package.json +++ b/packages/rstream-graph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-graph", - "version": "3.1.0", + "version": "3.1.2", "description": "Declarative dataflow graph construction for @thi.ng/rstream", "module": "./index.js", "main": "./lib/index.js", @@ -36,7 +36,7 @@ "@thi.ng/checks": "^2.2.0", "@thi.ng/errors": "^1.1.0", "@thi.ng/paths": "^2.1.0", - "@thi.ng/resolve-map": "^4.1.0", + "@thi.ng/resolve-map": "^4.1.2", "@thi.ng/rstream": "^2.5.0", "@thi.ng/transducers": "^5.4.0" }, diff --git a/packages/shader-ast-glsl/CHANGELOG.md b/packages/shader-ast-glsl/CHANGELOG.md index 1de245579d..7acacdb90b 100644 --- a/packages/shader-ast-glsl/CHANGELOG.md +++ b/packages/shader-ast-glsl/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-glsl@0.1.0...@thi.ng/shader-ast-glsl@0.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/shader-ast-glsl + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/shader-ast-glsl/package.json b/packages/shader-ast-glsl/package.json index 35662840ce..fcd5aea64d 100644 --- a/packages/shader-ast-glsl/package.json +++ b/packages/shader-ast-glsl/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/shader-ast-glsl", - "version": "0.1.0", + "version": "0.1.1", "description": "Customizable GLSL code generator for @thi.ng/shader-ast", "module": "./index.js", "main": "./lib/index.js", @@ -35,7 +35,7 @@ "@thi.ng/api": "^6.3.0", "@thi.ng/checks": "^2.2.0", "@thi.ng/errors": "^1.1.0", - "@thi.ng/shader-ast": "^0.1.0" + "@thi.ng/shader-ast": "^0.1.1" }, "keywords": [ "AST", diff --git a/packages/shader-ast-js/CHANGELOG.md b/packages/shader-ast-js/CHANGELOG.md index 831175bcdb..faecd05e1c 100644 --- a/packages/shader-ast-js/CHANGELOG.md +++ b/packages/shader-ast-js/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-js@0.1.0...@thi.ng/shader-ast-js@0.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/shader-ast-js + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/shader-ast-js/README.md b/packages/shader-ast-js/README.md index 319f01d8e5..3b658375db 100644 --- a/packages/shader-ast-js/README.md +++ b/packages/shader-ast-js/README.md @@ -84,7 +84,7 @@ import { targetJS } from "@thi.ng/shader-ast-js"; const js = targetJS(); -const hello = defn("vec4", "hello", [["float"]], (n) => [ +const hello = defn("vec4", "hello", ["float"], (n) => [ ret(vec4(mul(vec3(1, 2, 3), n), -1)) ]); diff --git a/packages/shader-ast-js/package.json b/packages/shader-ast-js/package.json index 20e889dd51..1d75e159d0 100644 --- a/packages/shader-ast-js/package.json +++ b/packages/shader-ast-js/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/shader-ast-js", - "version": "0.1.0", + "version": "0.1.1", "description": "Customizable JS code generator, compiler & runtime for @thi.ng/shader-ast", "module": "./index.js", "main": "./lib/index.js", @@ -36,9 +36,9 @@ "@thi.ng/checks": "^2.2.0", "@thi.ng/errors": "^1.1.0", "@thi.ng/math": "^1.4.0", - "@thi.ng/matrices": "^0.5.0", - "@thi.ng/shader-ast": "^0.1.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/matrices": "^0.5.1", + "@thi.ng/shader-ast": "^0.1.1", + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "AST", diff --git a/packages/shader-ast-stdlib/CHANGELOG.md b/packages/shader-ast-stdlib/CHANGELOG.md index 6ac0457092..3402e93ab7 100644 --- a/packages/shader-ast-stdlib/CHANGELOG.md +++ b/packages/shader-ast-stdlib/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.1.0...@thi.ng/shader-ast-stdlib@0.1.1) (2019-07-08) + + +### Bug Fixes + +* **shader-ast-stdlib:** update incomplete cartesian3, refactor cartesian2 ([3299d59](https://github.com/thi-ng/umbrella/commit/3299d59)) + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/shader-ast-stdlib/README.md b/packages/shader-ast-stdlib/README.md index b607c30f0b..e93d22bec4 100644 --- a/packages/shader-ast-stdlib/README.md +++ b/packages/shader-ast-stdlib/README.md @@ -250,7 +250,7 @@ import { additive, aspectCorrectedUV, fit1101, snoise2 } from "@thi.ng/shader-as const mainImage = defn( "vec4", "mainImage", - [["vec2"], ["vec2"], ["float"]], + ["vec2", "vec2", "float"], (frag, res, time) => { let uv; let noise; diff --git a/packages/shader-ast-stdlib/package.json b/packages/shader-ast-stdlib/package.json index 07529f254e..80f267248e 100644 --- a/packages/shader-ast-stdlib/package.json +++ b/packages/shader-ast-stdlib/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/shader-ast-stdlib", - "version": "0.1.0", + "version": "0.1.1", "description": "Useful functions for GPGPU / shader programming w/ @thi.ng/shader-ast", "module": "./index.js", "main": "./lib/index.js", @@ -32,7 +32,7 @@ "typescript": "^3.5.2" }, "dependencies": { - "@thi.ng/shader-ast": "^0.1.0" + "@thi.ng/shader-ast": "^0.1.1" }, "keywords": [ "AST", diff --git a/packages/shader-ast-stdlib/src/color/linear-srgb.ts b/packages/shader-ast-stdlib/src/color/linear-srgb.ts index b42b3f321a..2cd4056d70 100644 --- a/packages/shader-ast-stdlib/src/color/linear-srgb.ts +++ b/packages/shader-ast-stdlib/src/color/linear-srgb.ts @@ -19,6 +19,20 @@ const $ = (t: Term, x: FloatTerm): Term => { vec4: vec4(x, x, x, 1) }[t.type]; +/** + * Inline function. Converts sRGB color term (1D-4D) to linear space via + * `pow(rgb, GAMMA)`, where gamma is hardcoded to 2.2. For vec4 args, + * the `w` component (alpha) remains unchanged. + * + * @param x + */ export const toLinear = (x: Term) => pow(x, $(x, GAMMA)); +/** + * Inline function. Converts linear color term (1D-4D) to sRGB via + * `pow(rgb, 1.0 / GAMMA)`, where gamma is hardcoded to 2.2. For vec4 + * args, the `w` component (alpha) remains unchanged. + * + * @param x + */ export const toSRGB = (x: Term) => pow(x, $(x, INV_GAMMA)); diff --git a/packages/shader-ast-stdlib/src/fog/exp.ts b/packages/shader-ast-stdlib/src/fog/exp.ts index 1099fa26cf..c0f93f743e 100644 --- a/packages/shader-ast-stdlib/src/fog/exp.ts +++ b/packages/shader-ast-stdlib/src/fog/exp.ts @@ -10,12 +10,15 @@ import { import { clamp01 } from "../math/clamp"; /** + * Computes exponential fog factor [0..1], based on given fully + * saturated fog distance and density. + * * @param dist float * @param density float */ export const fogExp = defn( "float", "fogExp", - [["float"], ["float"]], + ["float", "float"], (dist, density) => [ret(sub(FLOAT1, clamp01(exp(mul(neg(density), dist)))))] ); diff --git a/packages/shader-ast-stdlib/src/fog/exp2.ts b/packages/shader-ast-stdlib/src/fog/exp2.ts index 4f35f0d9f4..7ca8b31dac 100644 --- a/packages/shader-ast-stdlib/src/fog/exp2.ts +++ b/packages/shader-ast-stdlib/src/fog/exp2.ts @@ -10,13 +10,17 @@ import { import { clamp01 } from "../math/clamp"; /** + * Similar to `fogExp()`. Computes exponential fog factor [0..1], based + * on given fully saturated fog distance and density. Uses `exp2()` + * internally. + * * @param dist float * @param density float */ export const fogExp2 = defn( "float", "fogExp2", - [["float"], ["float"]], + ["float", "float"], (dist, density) => [ assign(density, mul(density, dist)), ret(sub(FLOAT1, clamp01(exp2(mul(mul(density, density), -Math.LOG2E))))) diff --git a/packages/shader-ast-stdlib/src/fog/linear.ts b/packages/shader-ast-stdlib/src/fog/linear.ts index c10da9f2b0..33a4e3b2a3 100644 --- a/packages/shader-ast-stdlib/src/fog/linear.ts +++ b/packages/shader-ast-stdlib/src/fog/linear.ts @@ -1,13 +1,11 @@ -import { - defn, - div, - FLOAT1, - ret, - sub -} from "@thi.ng/shader-ast"; +import { defn, ret } from "@thi.ng/shader-ast"; import { clamp01 } from "../math/clamp"; +import { fitNorm1 } from "../math/fit"; /** + * Computes linear fog factor [0..1], based on given fog min/max + * distances. + * * @param dist float * @param start float * @param end float @@ -16,8 +14,6 @@ import { clamp01 } from "../math/clamp"; export const fogLinear = defn( "float", "fogLinear", - [["float"], ["float"], ["float"]], - (dist, start, end) => [ - ret(sub(FLOAT1, clamp01(div(sub(end, dist), sub(end, start))))) - ] + ["float", "float", "float"], + (dist, start, end) => [ret(clamp01(fitNorm1(dist, start, end)))] ); diff --git a/packages/shader-ast-stdlib/src/light/trilight.ts b/packages/shader-ast-stdlib/src/light/trilight.ts index 24fd3e1886..8c610d0b2a 100644 --- a/packages/shader-ast-stdlib/src/light/trilight.ts +++ b/packages/shader-ast-stdlib/src/light/trilight.ts @@ -28,7 +28,7 @@ import { export const trilight = defn( "vec3", "trilight", - [["vec3"], ["vec3"], ["vec3"], ["vec3"], ["vec3"]], + ["vec3", "vec3", "vec3", "vec3", "vec3"], (n, l, c1, c2, c3) => { let d: FloatSym; return [ diff --git a/packages/shader-ast-stdlib/src/math/additive.ts b/packages/shader-ast-stdlib/src/math/additive.ts index 21ef762686..d3bf7b345c 100644 --- a/packages/shader-ast-stdlib/src/math/additive.ts +++ b/packages/shader-ast-stdlib/src/math/additive.ts @@ -43,7 +43,7 @@ export const additive = ( oct = 4, name = "additive" ) => - defn("float", name, [[type], [type], ["float"]], (pos, shift, decay) => { + defn("float", name, [[type], [type], "float"], (pos, shift, decay) => { let n: FloatSym; let amp: FloatSym; return [ diff --git a/packages/shader-ast-stdlib/src/math/cartesian.ts b/packages/shader-ast-stdlib/src/math/cartesian.ts index 6f7a6ad8db..fc6170b784 100644 --- a/packages/shader-ast-stdlib/src/math/cartesian.ts +++ b/packages/shader-ast-stdlib/src/math/cartesian.ts @@ -7,7 +7,6 @@ import { mul, ret, sym, - vec2, Vec2Sym, Vec2Term, vec3 @@ -15,20 +14,21 @@ import { import { cossin } from "./sincos"; /** - * Converts 2D polar vector `v` to cartesian coordinates. See `polar2()` - * for reverse operation. + * Converts 2D polar vector `v`, i.e. `[r,θ]` (angle in radians) to + * cartesian coordinates. See `polar2()` for reverse operation. * * @param v */ -export const cartesian2 = (v: Vec2Term) => mul(cossin($y(v)), vec2($x(v))); +export const cartesian2 = (v: Vec2Term) => mul(cossin($y(v)), $x(v)); /** - * Converts 3D polar vector `v` to cartesian coordinates. See `polar3()` - * for reverse operation. + * Converts 3D polar/spherical vector `v`, i.e. `[r,θ,ϕ]` (angles in + * radians) to cartesian coordinates. See `polar3()` for reverse + * operation. * * @param v */ -export const cartesian3 = defn("vec3", "cartesian3", [["vec3"]], (v) => { +export const cartesian3 = defn("vec3", "cartesian3", ["vec3"], (v) => { let r: FloatSym; let t: Vec2Sym; let p: Vec2Sym; @@ -36,6 +36,12 @@ export const cartesian3 = defn("vec3", "cartesian3", [["vec3"]], (v) => { (r = sym($x(v))), (t = sym(cossin($y(v)))), (p = sym(cossin($z(v)))), - ret(vec3(mul(mul(r, $x(t)), $x(p)))) + ret( + vec3( + mul(mul(r, $x(t)), $x(p)), + mul(mul(r, $x(t)), $y(p)), + mul(r, $y(t)) + ) + ) ]; }); diff --git a/packages/shader-ast-stdlib/src/math/fit.ts b/packages/shader-ast-stdlib/src/math/fit.ts index 74d875cf61..97599eec53 100644 --- a/packages/shader-ast-stdlib/src/math/fit.ts +++ b/packages/shader-ast-stdlib/src/math/fit.ts @@ -1,16 +1,37 @@ import { add, + defn, + div, + FLOAT0, FLOAT05, FLOAT1, FLOAT2, mix, mul, + neq, Op2, Prim, + ret, sub, - Term + Term, + ternary } from "@thi.ng/shader-ast"; +/** + * Returns normalized value of `x` WRT to interval [a,b]. Returns 0, if + * `a` equals `b`. + * + * @param x + * @param a + * @param b + */ +export const fitNorm1 = defn( + "float", + "fitNorm1", + ["float", "float", "float"], + (x, a, b) => [ret(ternary(neq(a, b), div(sub(x, a), sub(b, a)), FLOAT0))] +); + /** * Inline function. Fits value `a` in [0..1] interval to new interval * [b..c]. No clamping performed. Same as `mix(b, c, a)` diff --git a/packages/shader-ast-stdlib/src/math/magsq.ts b/packages/shader-ast-stdlib/src/math/magsq.ts index a99dffc7f8..05d6ce8fbe 100644 --- a/packages/shader-ast-stdlib/src/math/magsq.ts +++ b/packages/shader-ast-stdlib/src/math/magsq.ts @@ -1,13 +1,13 @@ import { defn, dot, ret } from "@thi.ng/shader-ast"; -export const magSq2 = defn("float", "magSq2", [["vec2"]], (v) => [ +export const magSq2 = defn("float", "magSq2", ["vec2"], (v) => [ ret(dot(v, v)) ]); -export const magSq3 = defn("float", "magSq3", [["vec3"]], (v) => [ +export const magSq3 = defn("float", "magSq3", ["vec3"], (v) => [ ret(dot(v, v)) ]); -export const magSq4 = defn("float", "magSq4", [["vec4"]], (v) => [ +export const magSq4 = defn("float", "magSq4", ["vec4"], (v) => [ ret(dot(v, v)) ]); diff --git a/packages/shader-ast-stdlib/src/math/orthogonal.ts b/packages/shader-ast-stdlib/src/math/orthogonal.ts index 3aeec9fb74..78b82c9c7a 100644 --- a/packages/shader-ast-stdlib/src/math/orthogonal.ts +++ b/packages/shader-ast-stdlib/src/math/orthogonal.ts @@ -34,7 +34,7 @@ export const perpendicularCW = (v: Vec2Term) => vec2($y(v), neg($x(v))); * * http://lolengine.net/blog/2013/09/21/picking-orthogonal-vector-combing-coconuts */ -export const orthogonal3 = defn("vec3", "orthogonal3", [["vec3"]], (v) => [ +export const orthogonal3 = defn("vec3", "orthogonal3", ["vec3"], (v) => [ ret( ternary( gt(abs($x(v)), abs($z(v))), diff --git a/packages/shader-ast-stdlib/src/math/polar.ts b/packages/shader-ast-stdlib/src/math/polar.ts index fae7cf6b97..00ea0ee74f 100644 --- a/packages/shader-ast-stdlib/src/math/polar.ts +++ b/packages/shader-ast-stdlib/src/math/polar.ts @@ -20,7 +20,7 @@ import { * * @param v */ -export const polar2 = defn("vec2", "polar2", [["vec2"]], (v) => [ +export const polar2 = defn("vec2", "polar2", ["vec2"], (v) => [ ret(vec2(length(v), atan(div($y(v), $x(v))))) ]); @@ -31,7 +31,7 @@ export const polar2 = defn("vec2", "polar2", [["vec2"]], (v) => [ * * @param v */ -export const polar3 = defn("vec3", "polar3", [["vec3"]], (v) => { +export const polar3 = defn("vec3", "polar3", ["vec3"], (v) => { let r: FloatSym; return [ (r = sym(length(v))), diff --git a/packages/shader-ast-stdlib/src/matrix/lookat.ts b/packages/shader-ast-stdlib/src/matrix/lookat.ts index 17eaa787a8..330a2fe5a2 100644 --- a/packages/shader-ast-stdlib/src/matrix/lookat.ts +++ b/packages/shader-ast-stdlib/src/matrix/lookat.ts @@ -23,7 +23,7 @@ import { export const lookat = defn( "mat4", "lookat", - [["vec3"], ["vec3"], ["vec3"]], + ["vec3", "vec3", "vec3"], (eye, target, up) => { let x: Vec3Sym; let y: Vec3Sym; diff --git a/packages/shader-ast-stdlib/src/matrix/rotation.ts b/packages/shader-ast-stdlib/src/matrix/rotation.ts index b0e1d232b5..e83f5e6138 100644 --- a/packages/shader-ast-stdlib/src/matrix/rotation.ts +++ b/packages/shader-ast-stdlib/src/matrix/rotation.ts @@ -13,12 +13,12 @@ import { import { perpendicularCCW } from "../math/orthogonal"; import { cossin } from "../math/sincos"; -export const rotation2 = defn("mat2", "rotation2", [["float"]], (theta) => { +export const rotation2 = defn("mat2", "rotation2", ["float"], (theta) => { let cs: Vec2Term; return [(cs = sym(cossin(theta))), ret(mat2(cs, perpendicularCCW(cs)))]; }); -export const rotationX3 = defn("mat3", "rotationX3", [["float"]], (theta) => { +export const rotationX3 = defn("mat3", "rotationX3", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), @@ -26,7 +26,7 @@ export const rotationX3 = defn("mat3", "rotationX3", [["float"]], (theta) => { ]; }); -export const rotationY3 = defn("mat3", "rotationY3", [["float"]], (theta) => { +export const rotationY3 = defn("mat3", "rotationY3", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), @@ -34,7 +34,7 @@ export const rotationY3 = defn("mat3", "rotationY3", [["float"]], (theta) => { ]; }); -export const rotationZ3 = defn("mat3", "rotationZ3", [["float"]], (theta) => { +export const rotationZ3 = defn("mat3", "rotationZ3", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), @@ -42,7 +42,7 @@ export const rotationZ3 = defn("mat3", "rotationZ3", [["float"]], (theta) => { ]; }); -export const rotationX4 = defn("mat4", "rotationX4", [["float"]], (theta) => { +export const rotationX4 = defn("mat4", "rotationX4", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), @@ -69,7 +69,7 @@ export const rotationX4 = defn("mat4", "rotationX4", [["float"]], (theta) => { ]; }); -export const rotationY4 = defn("mat4", "rotationY4", [["float"]], (theta) => { +export const rotationY4 = defn("mat4", "rotationY4", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), @@ -96,7 +96,7 @@ export const rotationY4 = defn("mat4", "rotationY4", [["float"]], (theta) => { ]; }); -export const rotationZ4 = defn("mat4", "rotationZ4", [["float"]], (theta) => { +export const rotationZ4 = defn("mat4", "rotationZ4", ["float"], (theta) => { let cs: Vec2Term; return [ (cs = sym(cossin(theta))), diff --git a/packages/shader-ast-stdlib/src/noise/hash.ts b/packages/shader-ast-stdlib/src/noise/hash.ts index 41e4b2c82f..3d55d45524 100644 --- a/packages/shader-ast-stdlib/src/noise/hash.ts +++ b/packages/shader-ast-stdlib/src/noise/hash.ts @@ -26,7 +26,7 @@ import { * * @param p */ -export const hash2 = defn("vec2", "hash2", [["vec2"]], (p) => [ +export const hash2 = defn("vec2", "hash2", ["vec2"], (p) => [ ret(fract(mul(sin(mul(p, mat2(127.1, 311.7, 269.5, 183.3))), 43758.5453))) ]); @@ -35,7 +35,7 @@ export const hash2 = defn("vec2", "hash2", [["vec2"]], (p) => [ * * @param p */ -export const hash3 = defn("vec3", "hash3", [["vec2"]], (p) => [ +export const hash3 = defn("vec3", "hash3", ["vec2"], (p) => [ ret( fract( mul( @@ -62,7 +62,7 @@ const H4 = vec4(0.1031, 0.103, 0.0973, 0.1099); * * @param p */ -export const hash11 = defn("float", "hash11", [["float"]], (p) => { +export const hash11 = defn("float", "hash11", ["float"], (p) => { let x: FloatSym; return [ (x = sym(fract(mul(p, 0.1031)))), @@ -79,7 +79,7 @@ export const hash11 = defn("float", "hash11", [["float"]], (p) => { * * @param p */ -export const hash12 = defn("float", "hash12", [["vec2"]], (p) => { +export const hash12 = defn("float", "hash12", ["vec2"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul($(p, "xyx"), 0.1031)))), @@ -95,7 +95,7 @@ export const hash12 = defn("float", "hash12", [["vec2"]], (p) => { * * @param p */ -export const hash13 = defn("float", "hash13", [["vec3"]], (p) => { +export const hash13 = defn("float", "hash13", ["vec3"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul($(p, "xyx"), 0.1031)))), @@ -111,7 +111,7 @@ export const hash13 = defn("float", "hash13", [["vec3"]], (p) => { * * @param p */ -export const hash21 = defn("vec2", "hash21", [["float"]], (p) => { +export const hash21 = defn("vec2", "hash21", ["float"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul(vec3(p), H)))), @@ -127,7 +127,7 @@ export const hash21 = defn("vec2", "hash21", [["float"]], (p) => { * * @param p */ -export const hash22 = defn("vec2", "hash22", [["vec2"]], (p) => { +export const hash22 = defn("vec2", "hash22", ["vec2"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul($(p, "xyx"), H)))), @@ -143,7 +143,7 @@ export const hash22 = defn("vec2", "hash22", [["vec2"]], (p) => { * * @param p */ -export const hash23 = defn("vec2", "hash23", [["vec3"]], (p) => { +export const hash23 = defn("vec2", "hash23", ["vec3"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul(p, H)))), @@ -159,7 +159,7 @@ export const hash23 = defn("vec2", "hash23", [["vec3"]], (p) => { * * @param p */ -export const hash31 = defn("vec3", "hash31", [["float"]], (p) => { +export const hash31 = defn("vec3", "hash31", ["float"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul(p, H)))), @@ -175,7 +175,7 @@ export const hash31 = defn("vec3", "hash31", [["float"]], (p) => { * * @param p */ -export const hash32 = defn("vec3", "hash32", [["vec2"]], (p) => { +export const hash32 = defn("vec3", "hash32", ["vec2"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul($(p, "xyx"), H)))), @@ -191,7 +191,7 @@ export const hash32 = defn("vec3", "hash32", [["vec2"]], (p) => { * * @param p */ -export const hash33 = defn("vec3", "hash33", [["vec3"]], (p) => { +export const hash33 = defn("vec3", "hash33", ["vec3"], (p) => { let x: Vec3Sym; return [ (x = sym(fract(mul(p, H)))), @@ -207,7 +207,7 @@ export const hash33 = defn("vec3", "hash33", [["vec3"]], (p) => { * * @param p */ -export const hash41 = defn("vec4", "hash41", [["float"]], (p) => { +export const hash41 = defn("vec4", "hash41", ["float"], (p) => { let x: Vec4Sym; return [ (x = sym(fract(mul(p, H4)))), @@ -223,7 +223,7 @@ export const hash41 = defn("vec4", "hash41", [["float"]], (p) => { * * @param p */ -export const hash42 = defn("vec4", "hash42", [["vec2"]], (p) => { +export const hash42 = defn("vec4", "hash42", ["vec2"], (p) => { let x: Vec4Sym; return [ (x = sym(fract(mul($(p, "xyxy"), H4)))), @@ -239,7 +239,7 @@ export const hash42 = defn("vec4", "hash42", [["vec2"]], (p) => { * * @param p */ -export const hash43 = defn("vec4", "hash43", [["vec3"]], (p) => { +export const hash43 = defn("vec4", "hash43", ["vec3"], (p) => { let x: Vec4Sym; return [ (x = sym(fract(mul($(p, "xyzx"), H4)))), @@ -255,7 +255,7 @@ export const hash43 = defn("vec4", "hash43", [["vec3"]], (p) => { * * @param p */ -export const hash44 = defn("vec4", "hash44", [["vec4"]], (p) => { +export const hash44 = defn("vec4", "hash44", ["vec4"], (p) => { let x: Vec4Sym; return [ (x = sym(fract(mul(p, H4)))), diff --git a/packages/shader-ast-stdlib/src/noise/permute.ts b/packages/shader-ast-stdlib/src/noise/permute.ts index d6a2d44905..11c426d164 100644 --- a/packages/shader-ast-stdlib/src/noise/permute.ts +++ b/packages/shader-ast-stdlib/src/noise/permute.ts @@ -8,18 +8,18 @@ import { ret } from "@thi.ng/shader-ast"; -export const permute = defn("float", "permute", [["float"]], (v) => [ +export const permute = defn("float", "permute", ["float"], (v) => [ ret(mod(mul(v, add(mul(v, float(34)), FLOAT1)), float(289))) ]); -export const permute2 = defn("vec2", "permute2", [["vec2"]], (v) => [ +export const permute2 = defn("vec2", "permute2", ["vec2"], (v) => [ ret(mod(mul(v, add(mul(v, float(34)), FLOAT1)), float(289))) ]); -export const permute3 = defn("vec3", "permute3", [["vec3"]], (v) => [ +export const permute3 = defn("vec3", "permute3", ["vec3"], (v) => [ ret(mod(mul(v, add(mul(v, float(34)), FLOAT1)), float(289))) ]); -export const permute4 = defn("vec4", "permute4", [["vec4"]], (v) => [ +export const permute4 = defn("vec4", "permute4", ["vec4"], (v) => [ ret(mod(mul(v, add(mul(v, float(34)), FLOAT1)), float(289))) ]); diff --git a/packages/shader-ast-stdlib/src/noise/simplex2.ts b/packages/shader-ast-stdlib/src/noise/simplex2.ts index 5e127c08c7..5a9e1873b1 100644 --- a/packages/shader-ast-stdlib/src/noise/simplex2.ts +++ b/packages/shader-ast-stdlib/src/noise/simplex2.ts @@ -37,7 +37,7 @@ import { permute3 } from "./permute"; * * https://github.com/ashima/webgl-noise */ -export const snoise2 = defn("float", "snoise2", [["vec2"]], (v) => { +export const snoise2 = defn("float", "snoise2", ["vec2"], (v) => { let C: Vec4Sym; let i: Vec2Sym; let i1: Vec2Sym; diff --git a/packages/shader-ast-stdlib/src/noise/voronoi2.ts b/packages/shader-ast-stdlib/src/noise/voronoi2.ts index 047212cc38..d51162fa07 100644 --- a/packages/shader-ast-stdlib/src/noise/voronoi2.ts +++ b/packages/shader-ast-stdlib/src/noise/voronoi2.ts @@ -52,7 +52,7 @@ import { hash32 } from "./hash"; export const voronoise2 = defn( "float", "voronoise2", - [["vec2"], ["float"], ["float"]], + ["vec2", "float", "float"], (x, u, v) => { let p: Vec2Sym; let f: Vec2Sym; diff --git a/packages/shader-ast-stdlib/src/noise/worley2.ts b/packages/shader-ast-stdlib/src/noise/worley2.ts index b075fa6505..ebab23b0a6 100644 --- a/packages/shader-ast-stdlib/src/noise/worley2.ts +++ b/packages/shader-ast-stdlib/src/noise/worley2.ts @@ -31,14 +31,14 @@ import { permute3 } from "./permute"; export const worleyDist = defn( "vec3", "worleyDist", - [["vec3"], ["vec3"]], + ["vec3", "vec3"], (a, b) => [ret(add(mul(a, a), mul(b, b)))] ); export const worleyDistManhattan = defn( "vec3", "worleyDistManhatten", - [["vec3"], ["vec3"]], + ["vec3", "vec3"], (a, b) => [ret(add(abs(a), abs(b)))] ); @@ -56,7 +56,7 @@ export const worleyDistManhattan = defn( * @param distFn */ export const worley2 = (distFn: Func2<"vec3", "vec3", "vec3">) => - defn("vec2", "worley2", [["vec2"], ["float"]], (P, jitter) => { + defn("vec2", "worley2", ["vec2", "float"], (P, jitter) => { const K = float(1 / 7); const Ko = float(3 / 7); const oI = sym(vec3(-1, 0, 1)); diff --git a/packages/shader-ast-stdlib/src/raymarch/ao.ts b/packages/shader-ast-stdlib/src/raymarch/ao.ts index 230dab4c41..0d7749dc7f 100644 --- a/packages/shader-ast-stdlib/src/raymarch/ao.ts +++ b/packages/shader-ast-stdlib/src/raymarch/ao.ts @@ -29,7 +29,7 @@ import { clamp01 } from "../math/clamp"; * @param numSamples */ export const raymarchAO = (scene: RaymarchScene, numSamples = 5) => - defn("float", "raymarchAO", [["vec3"], ["vec3"]], (p, n) => { + defn("float", "raymarchAO", ["vec3", "vec3"], (p, n) => { let r: FloatSym; let w: FloatSym; let d0: FloatSym; diff --git a/packages/shader-ast-stdlib/src/raymarch/direction.ts b/packages/shader-ast-stdlib/src/raymarch/direction.ts index 612bd93afd..d6f1a4a120 100644 --- a/packages/shader-ast-stdlib/src/raymarch/direction.ts +++ b/packages/shader-ast-stdlib/src/raymarch/direction.ts @@ -22,7 +22,7 @@ import { export const raymarchDir = defn( "vec3", "raymarchDir", - [["vec2"], ["vec2"], ["float"]], + ["vec2", "vec2", "float"], (frag, res, fov) => { let uv: Vec2Sym; return [ diff --git a/packages/shader-ast-stdlib/src/raymarch/normal.ts b/packages/shader-ast-stdlib/src/raymarch/normal.ts index c727df7a77..78967fa938 100644 --- a/packages/shader-ast-stdlib/src/raymarch/normal.ts +++ b/packages/shader-ast-stdlib/src/raymarch/normal.ts @@ -24,7 +24,7 @@ import { RaymarchScene } from "../api"; * @param name */ export const raymarchNormal = (scene: RaymarchScene, name = "raymarchNormal") => - defn("vec3", name, [["vec3"], ["float"]], (p, smooth) => { + defn("vec3", name, ["vec3", "float"], (p, smooth) => { let dn: Vec2Sym; const comp = (id: Swizzle2_3) => sub($x(scene(add(p, $(dn, id)))), $x(scene(sub(p, $(dn, id))))); diff --git a/packages/shader-ast-stdlib/src/raymarch/scene.ts b/packages/shader-ast-stdlib/src/raymarch/scene.ts index 74f064cb6e..8a0e099176 100644 --- a/packages/shader-ast-stdlib/src/raymarch/scene.ts +++ b/packages/shader-ast-stdlib/src/raymarch/scene.ts @@ -51,7 +51,7 @@ export const raymarchScene = ( bias: 0.7, ..._opts }; - return defn("vec2", opts.name, [["vec3"], ["vec3"]], (pos, dir) => { + return defn("vec2", opts.name, ["vec3", "vec3"], (pos, dir) => { let total: FloatSym; let res: Vec2Sym; return [ diff --git a/packages/shader-ast-stdlib/src/screen/uv.ts b/packages/shader-ast-stdlib/src/screen/uv.ts index 0e33c13347..5b119ed8f0 100644 --- a/packages/shader-ast-stdlib/src/screen/uv.ts +++ b/packages/shader-ast-stdlib/src/screen/uv.ts @@ -22,7 +22,7 @@ import { fit0111 } from "../math/fit"; export const aspectCorrectedUV = defn( "vec2", "aspectCorrectedUV", - [["vec2"], ["vec2"]], + ["vec2", "vec2"], (pos, res) => { let uv: Vec2Sym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/box.ts b/packages/shader-ast-stdlib/src/sdf/box.ts index 30ca4cc4b3..80c453b799 100644 --- a/packages/shader-ast-stdlib/src/sdf/box.ts +++ b/packages/shader-ast-stdlib/src/sdf/box.ts @@ -25,7 +25,7 @@ import { maxComp2, maxComp3 } from "../math/maxcomp"; export const sdfBox2 = defn( "float", "sdRect", - [["vec2"], ["vec2"]], + ["vec2", "vec2"], (p, size) => { let d: Vec2Sym; return [ @@ -44,7 +44,7 @@ export const sdfBox2 = defn( export const sdfBox3 = defn( "float", "sdAABB", - [["vec3"], ["vec3"]], + ["vec3", "vec3"], (p, size) => { let d: Vec3Sym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/cylinder.ts b/packages/shader-ast-stdlib/src/sdf/cylinder.ts index 423d1444b7..256bc58dac 100644 --- a/packages/shader-ast-stdlib/src/sdf/cylinder.ts +++ b/packages/shader-ast-stdlib/src/sdf/cylinder.ts @@ -27,7 +27,7 @@ import { maxComp2 } from "../math/maxcomp"; export const sdfCylinder = defn( "float", "sdCylinder", - [["vec3"], ["float"], ["float"]], + ["vec3", "float", "float"], (p, h, r) => { let d: Vec2Sym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/line.ts b/packages/shader-ast-stdlib/src/sdf/line.ts index 4c4ddd9b68..8d814e4ea4 100644 --- a/packages/shader-ast-stdlib/src/sdf/line.ts +++ b/packages/shader-ast-stdlib/src/sdf/line.ts @@ -37,7 +37,7 @@ const line = (p: Sym, a: Sym, b: Sym) => { export const sdfLine2 = defn( "float", "sdLine2", - [["vec2"], ["vec2"], ["vec2"]], + ["vec2", "vec2", "vec2"], line ); @@ -49,6 +49,6 @@ export const sdfLine2 = defn( export const sdfLine3 = defn( "float", "sdLine3", - [["vec3"], ["vec3"], ["vec3"]], + ["vec3", "vec3", "vec3"], line ); diff --git a/packages/shader-ast-stdlib/src/sdf/plane.ts b/packages/shader-ast-stdlib/src/sdf/plane.ts index 5e6f69ded8..9dcfa8dfa4 100644 --- a/packages/shader-ast-stdlib/src/sdf/plane.ts +++ b/packages/shader-ast-stdlib/src/sdf/plane.ts @@ -15,7 +15,7 @@ import { export const sdfPlane2 = defn( "float", "sdPlane", - [["vec2"], ["vec2"], ["float"]], + ["vec2", "vec2", "float"], (p, n, w) => [ret(add(dot(p, n), w))] ); @@ -29,6 +29,6 @@ export const sdfPlane2 = defn( export const sdfPlane3 = defn( "float", "sdPlane", - [["vec3"], ["vec3"], ["float"]], + ["vec3", "vec3", "float"], (p, n, w) => [ret(add(dot(p, n), w))] ); diff --git a/packages/shader-ast-stdlib/src/sdf/repeat.ts b/packages/shader-ast-stdlib/src/sdf/repeat.ts index 81b3adf4d6..7b41448209 100644 --- a/packages/shader-ast-stdlib/src/sdf/repeat.ts +++ b/packages/shader-ast-stdlib/src/sdf/repeat.ts @@ -16,7 +16,7 @@ import { export const sdfRepeat2 = defn( "vec2", "sdTxRepeat3", - [["vec2"], ["vec2"]], + ["vec2", "vec2"], (p, c) => [ret(sub(mod(p, c), mul(c, FLOAT05)))] ); @@ -29,6 +29,6 @@ export const sdfRepeat2 = defn( export const sdfRepeat3 = defn( "vec3", "sdTxRepeat3", - [["vec3"], ["vec3"]], + ["vec3", "vec3"], (p, c) => [ret(sub(mod(p, c), mul(c, FLOAT05)))] ); diff --git a/packages/shader-ast-stdlib/src/sdf/smooth-isec.ts b/packages/shader-ast-stdlib/src/sdf/smooth-isec.ts index 2cf8ea3772..cae005e90a 100644 --- a/packages/shader-ast-stdlib/src/sdf/smooth-isec.ts +++ b/packages/shader-ast-stdlib/src/sdf/smooth-isec.ts @@ -20,7 +20,7 @@ import { fit1101 } from "../math/fit"; export const sdfSmoothIntersect = defn( "float", "sdOpSmoothIntersect", - [["float"], ["float"], ["float"]], + ["float", "float", "float"], (a, b, k) => { let h: FloatSym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/smooth-sub.ts b/packages/shader-ast-stdlib/src/sdf/smooth-sub.ts index 23417af025..a49b8588c9 100644 --- a/packages/shader-ast-stdlib/src/sdf/smooth-sub.ts +++ b/packages/shader-ast-stdlib/src/sdf/smooth-sub.ts @@ -21,7 +21,7 @@ import { fit1101 } from "../math/fit"; export const sdfSmoothSubtract = defn( "float", "sdOpSmoothSubtract", - [["float"], ["float"], ["float"]], + ["float", "float", "float"], (a, b, k) => { let h: FloatSym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/smooth-union.ts b/packages/shader-ast-stdlib/src/sdf/smooth-union.ts index 4d4def8423..6b3efeb699 100644 --- a/packages/shader-ast-stdlib/src/sdf/smooth-union.ts +++ b/packages/shader-ast-stdlib/src/sdf/smooth-union.ts @@ -19,7 +19,7 @@ import { fit1101 } from "../math/fit"; export const sdfSmoothUnion = defn( "float", "sdOpSmoothUnion", - [["float"], ["float"], ["float"]], + ["float", "float", "float"], (a, b, k) => { let h: FloatSym; return [ diff --git a/packages/shader-ast-stdlib/src/sdf/sphere.ts b/packages/shader-ast-stdlib/src/sdf/sphere.ts index 480728b8ba..0fafd8b157 100644 --- a/packages/shader-ast-stdlib/src/sdf/sphere.ts +++ b/packages/shader-ast-stdlib/src/sdf/sphere.ts @@ -14,7 +14,7 @@ import { export const sdfCircle = defn( "float", "sdCircle", - [["vec2"], ["float"]], + ["vec2", "float"], (p, r) => [ret(sub(length(p), r))] ); @@ -27,6 +27,6 @@ export const sdfCircle = defn( export const sdfSphere = defn( "float", "sdSphere", - [["vec3"], ["float"]], + ["vec3", "float"], (p, r) => [ret(sub(length(p), r))] ); diff --git a/packages/shader-ast-stdlib/src/sdf/torus.ts b/packages/shader-ast-stdlib/src/sdf/torus.ts index 6324a3e805..b0fa7ed16b 100644 --- a/packages/shader-ast-stdlib/src/sdf/torus.ts +++ b/packages/shader-ast-stdlib/src/sdf/torus.ts @@ -19,7 +19,7 @@ import { export const sdfTorus = defn( "float", "sdTorus", - [["vec3"], ["float"], ["float"]], + ["vec3", "float", "float"], (p, r1, r2) => [ ret(sub(length(vec2(sub(length($(p, "xz")), r2), $y(p))), r1)) ] diff --git a/packages/shader-ast-stdlib/src/sdf/tri.ts b/packages/shader-ast-stdlib/src/sdf/tri.ts index 2bab477cb8..069a3ee78b 100644 --- a/packages/shader-ast-stdlib/src/sdf/tri.ts +++ b/packages/shader-ast-stdlib/src/sdf/tri.ts @@ -28,7 +28,7 @@ import { cross2 } from "../math/cross2"; export const sdfTriangle2 = defn( "float", "sdTriangle", - [["vec2"], ["vec2"], ["vec2"], ["vec2"]], + ["vec2", "vec2", "vec2", "vec2"], (p, a, b, c) => { let e0: Vec2Sym, e1: Vec2Sym, e2: Vec2Sym; let v0: Vec2Sym, v1: Vec2Sym, v2: Vec2Sym; diff --git a/packages/shader-ast-stdlib/src/tex/index-uv.ts b/packages/shader-ast-stdlib/src/tex/index-uv.ts index f99a390db2..14d602d2be 100644 --- a/packages/shader-ast-stdlib/src/tex/index-uv.ts +++ b/packages/shader-ast-stdlib/src/tex/index-uv.ts @@ -43,7 +43,7 @@ export const indexToUV = defn( export const uvToIndex = defn( "int", "uvToIndex", - [["vec2"], ["int", "width", { prec: "highp" }]], + ["vec2", ["int", "width", { prec: "highp" }]], (uv, width) => [ ret( add( diff --git a/packages/shader-ast/CHANGELOG.md b/packages/shader-ast/CHANGELOG.md index 03a80630ef..9a35676b53 100644 --- a/packages/shader-ast/CHANGELOG.md +++ b/packages/shader-ast/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast@0.1.0...@thi.ng/shader-ast@0.1.1) (2019-07-08) + + +### Bug Fixes + +* **shader-ast:** fix [#98](https://github.com/thi-ng/umbrella/issues/98), update defn() arg lists, add/update docs ([bcfbcfd](https://github.com/thi-ng/umbrella/commit/bcfbcfd)) + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/shader-ast/README.md b/packages/shader-ast/README.md index 1fa3aa6c8c..978f7fe063 100644 --- a/packages/shader-ast/README.md +++ b/packages/shader-ast/README.md @@ -337,7 +337,7 @@ other TS/JS function and will return a function call AST node with the supplied args. ```ts -// example from @thi.ng/shader-ast-stdlib +// example based on @thi.ng/shader-ast-stdlib /** * Computes Lambert term, optionally using Half-Lambertian, @@ -355,7 +355,7 @@ const lambert = defn( // function name "lambert", // args (incl. optional name and other opts) - [["vec3"], ["vec3"], ["bool"]], + ["vec3", "vec3", "bool"], // function body (n, ldir, bidir) => { // pre-declare local var @@ -386,6 +386,25 @@ correct order. Since `defn` returns a standard TS/JS function, all arguments will be automatically type checked at call sites (in TypeScript only). +#### Function arguments + +Function argument lists are given as arrays, with each item either: + +1. an AST type string, e.g. `"float"` +2. a tuple of `[type, name?, opts?]`, e.g. `["vec2", "bar", { q: "out" }]` + +If no name is specified, an auto-generated one will be used. Generally, +this is preferable, since these names are only used for code generation +purposes and in most cases only need to be machine readable... + +The body function (last arg given to `defn`), is called with +instantiated, typed symbols representing each arg and can use any name +within that function (also as shown in the above example). + +See `SymOpts` interface in +[api.ts](https://github.com/thi-ng/umbrella/tree/master/packages/shader-ast/src/api.ts) +for more details about the options object... + #### Inline functions If no function local variables are required and/or inlining is desired, @@ -402,9 +421,36 @@ then inserted at the call site: * @param k */ const sinc = (x: FloatTerm, k: FloatTerm) => - div(sin(mul(k,x)), mul(k, x)); + div(sin(mul(x,k)), mul(x, k)); ``` +**Performance tip for INLINE functions only:** Since the `FloatTerm` +type (or similarly any other `XXXTerm` type) refers to any expression +evaluating to a `"float"`, in some cases (like this `sinc()` example) it +might be better to only accept `FloatSym` arguments, since this ensures +the arg expressions are not causing duplicate evaluation. For example: + +```ts +sinc(length(mul(vec3(1,2,3), 100)), float(10)); +``` + +...will be expanded to: + +```ts +div( + sin(mul(length(mul(vec3(1,2,3), 100)),k)), + mul(length(mul(vec3(1,2,3), 100)), k) +); +``` + +...which is not desirable. + +If, however, the inline function asks for `FloatSym` args, the caller is +forced to supply variables and so is also responsible to pre-define +them... Alternatively, the function could be re-defined via `defn` to +avoid such issues altogether (but then causes an additional function +call at runtime - nothing comes for free!). + ### Global scope #### Input / output variables / declarations diff --git a/packages/shader-ast/package.json b/packages/shader-ast/package.json index 72b0242f73..5da3f9afd0 100644 --- a/packages/shader-ast/package.json +++ b/packages/shader-ast/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/shader-ast", - "version": "0.1.0", + "version": "0.1.1", "description": "DSL to define shader code in TypeScript and cross-compile to GLSL, JS and other targets", "module": "./index.js", "main": "./lib/index.js", diff --git a/packages/shader-ast/src/api.ts b/packages/shader-ast/src/api.ts index e1961fa4ed..b814cbdac0 100644 --- a/packages/shader-ast/src/api.ts +++ b/packages/shader-ast/src/api.ts @@ -282,7 +282,7 @@ export type Swizzle2 = Swizzle2_1 | Swizzle2_2 | Swizzle2_3 | Swizzle2_4; export type Swizzle3 = Swizzle3_1 | Swizzle3_2 | Swizzle3_3 | Swizzle3_4; export type Swizzle4 = Swizzle4_1 | Swizzle4_2 | Swizzle4_3 | Swizzle4_4; -export type Arg = [A, string?, SymOpts?]; +export type Arg = A | [A, string?, SymOpts?]; export type Arg1 = [Arg]; export type Arg2 = [Arg, Arg]; export type Arg3 = [ diff --git a/packages/shader-ast/src/ast.ts b/packages/shader-ast/src/ast.ts index f16e7d39d8..be1cf81006 100644 --- a/packages/shader-ast/src/ast.ts +++ b/packages/shader-ast/src/ast.ts @@ -1196,12 +1196,15 @@ export const program = (body: (Sym | Func)[]) => { return scope(syms.concat(g.sort()), true); }; -const defArg = ([type, id, opts]: Arg): FuncArg => ({ - tag: "arg", - type, - id: id || gensym(), - opts: { q: "in", ...opts } -}); +const defArg = (a: Arg): FuncArg => { + const [type, id, opts] = isString(a) ? <[T, string?, SymOpts?]>[a] : a; + return { + tag: "arg", + type, + id: id || gensym(), + opts: { q: "in", ...opts } + }; +}; /** * Defines a new function with up to 8 typed checked arguments. diff --git a/packages/shader-ast/src/optimize.ts b/packages/shader-ast/src/optimize.ts index 0205a08b75..4a41c77d93 100644 --- a/packages/shader-ast/src/optimize.ts +++ b/packages/shader-ast/src/optimize.ts @@ -24,7 +24,7 @@ const replaceNode = (node: any, next: any) => { * Currently, only scalar operations are supported / considered. * * ``` - * const foo = defn("float", "foo", [["float"]], (x) => [ + * const foo = defn("float", "foo", ["float"], (x) => [ * ret(mul(x, add(neg(float(10)), float(42))))] * ) * diff --git a/packages/vector-pools/CHANGELOG.md b/packages/vector-pools/CHANGELOG.md index 8d0cf50e23..6437621855 100644 --- a/packages/vector-pools/CHANGELOG.md +++ b/packages/vector-pools/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/vector-pools@1.0.0...@thi.ng/vector-pools@1.0.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/vector-pools + + + + + # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/vector-pools@0.2.16...@thi.ng/vector-pools@1.0.0) (2019-07-07) diff --git a/packages/vector-pools/package.json b/packages/vector-pools/package.json index eb1fa6b3bc..a28c588b33 100644 --- a/packages/vector-pools/package.json +++ b/packages/vector-pools/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/vector-pools", - "version": "1.0.0", + "version": "1.0.1", "description": "Data structures for managing & working with strided, memory mapped vectors", "module": "./index.js", "main": "./lib/index.js", @@ -37,7 +37,7 @@ "@thi.ng/checks": "^2.2.0", "@thi.ng/malloc": "^4.0.0", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "ES6", diff --git a/packages/vectors/CHANGELOG.md b/packages/vectors/CHANGELOG.md index fa70205459..0d4863d5ab 100644 --- a/packages/vectors/CHANGELOG.md +++ b/packages/vectors/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/vectors@3.0.0...@thi.ng/vectors@3.0.1) (2019-07-08) + + +### Bug Fixes + +* **vectors:** reflect output handling ([8ec12a4](https://github.com/thi-ng/umbrella/commit/8ec12a4)) + + + + + # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/vectors@2.5.6...@thi.ng/vectors@3.0.0) (2019-07-07) diff --git a/packages/vectors/package.json b/packages/vectors/package.json index db13921454..abae0e8b0e 100644 --- a/packages/vectors/package.json +++ b/packages/vectors/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/vectors", - "version": "3.0.0", + "version": "3.0.1", "description": "Optimized 2d/3d/4d and arbitrary length vector operations", "module": "./index.js", "main": "./lib/index.js", diff --git a/packages/vectors/src/reflect.ts b/packages/vectors/src/reflect.ts index 5b7d295b1e..d22f13d293 100644 --- a/packages/vectors/src/reflect.ts +++ b/packages/vectors/src/reflect.ts @@ -2,4 +2,5 @@ import { VecOpVV } from "./api"; import { dot } from "./dot"; import { maddN } from "./maddn"; -export const reflect: VecOpVV = (out, a, b) => maddN(out, b, -2 * dot(a, b), a); +export const reflect: VecOpVV = (out, a, b) => + maddN(out || a, b, -2 * dot(a, b), a); diff --git a/packages/webgl-msdf/CHANGELOG.md b/packages/webgl-msdf/CHANGELOG.md index 62955ab839..82d27b800c 100644 --- a/packages/webgl-msdf/CHANGELOG.md +++ b/packages/webgl-msdf/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl-msdf@0.1.0...@thi.ng/webgl-msdf@0.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/webgl-msdf + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/webgl-msdf/package.json b/packages/webgl-msdf/package.json index 08c0037361..ad2d6bb333 100644 --- a/packages/webgl-msdf/package.json +++ b/packages/webgl-msdf/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/webgl-msdf", - "version": "0.1.0", + "version": "0.1.1", "description": "TODO", "module": "./index.js", "main": "./lib/index.js", @@ -33,11 +33,11 @@ }, "dependencies": { "@thi.ng/api": "^6.3.0", - "@thi.ng/shader-ast": "^0.1.0", + "@thi.ng/shader-ast": "^0.1.1", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vector-pools": "^1.0.0", - "@thi.ng/vectors": "^3.0.0", - "@thi.ng/webgl": "^0.1.0" + "@thi.ng/vector-pools": "^1.0.1", + "@thi.ng/vectors": "^3.0.1", + "@thi.ng/webgl": "^0.1.1" }, "keywords": [ "ES6", diff --git a/packages/webgl-msdf/src/shader.ts b/packages/webgl-msdf/src/shader.ts index 40cec5d80d..5ef47ed058 100644 --- a/packages/webgl-msdf/src/shader.ts +++ b/packages/webgl-msdf/src/shader.ts @@ -36,14 +36,14 @@ export interface MSDFShaderOpts { color: boolean; } -export const median3 = defn("float", "median3", [["vec3"]], (v) => [ +export const median3 = defn("float", "median3", ["vec3"], (v) => [ ret(max(min($x(v), $y(v)), min(max($x(v), $y(v)), $z(v)))) ]); export const msdfSample = defn( "vec2", "msdfSample", - [["sampler2D"], ["vec2"]], + ["sampler2D", "vec2"], (tex, uv) => { let sd: FloatSym; let w: FloatSym; diff --git a/packages/webgl/CHANGELOG.md b/packages/webgl/CHANGELOG.md index ce881f2ac6..c9c78f261c 100644 --- a/packages/webgl/CHANGELOG.md +++ b/packages/webgl/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.1.0...@thi.ng/webgl@0.1.1) (2019-07-08) + +**Note:** Version bump only for package @thi.ng/webgl + + + + + # 0.1.0 (2019-07-07) diff --git a/packages/webgl/package.json b/packages/webgl/package.json index a73379dcb3..62277213d2 100644 --- a/packages/webgl/package.json +++ b/packages/webgl/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/webgl", - "version": "0.1.0", + "version": "0.1.1", "description": "WebGL abstraction layer", "module": "./index.js", "main": "./lib/index.js", @@ -38,13 +38,13 @@ "@thi.ng/checks": "^2.2.0", "@thi.ng/equiv": "^1.0.7", "@thi.ng/errors": "^1.1.0", - "@thi.ng/matrices": "^0.5.0", - "@thi.ng/shader-ast": "^0.1.0", - "@thi.ng/shader-ast-glsl": "^0.1.0", - "@thi.ng/shader-ast-stdlib": "^0.1.0", + "@thi.ng/matrices": "^0.5.1", + "@thi.ng/shader-ast": "^0.1.1", + "@thi.ng/shader-ast-glsl": "^0.1.1", + "@thi.ng/shader-ast-stdlib": "^0.1.1", "@thi.ng/transducers": "^5.4.0", - "@thi.ng/vector-pools": "^1.0.0", - "@thi.ng/vectors": "^3.0.0" + "@thi.ng/vector-pools": "^1.0.1", + "@thi.ng/vectors": "^3.0.1" }, "keywords": [ "declarative", diff --git a/scripts/make-example b/scripts/make-example index 9c5982b500..3e2b9a9a20 100755 --- a/scripts/make-example +++ b/scripts/make-example @@ -29,6 +29,7 @@ cat << EOF > $MODULE/package.json "scripts": { "clean": "rm -rf .cache build out", "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", + "build:webpack": "../../node_modules/.bin/webpack --mode production", "start": "parcel index.html -p 8080 --open" }, "devDependencies": { @@ -110,3 +111,30 @@ Please refer to the [example build instructions](https://github.com/thi-ng/umbre © 2018 $AUTHOR // Apache Software License 2.0 EOF + +echo "writing webpack.config.js..." +cat << EOF > $MODULE/webpack.config.js +module.exports = { + entry: "./src/index.ts", + output: { + filename: "bundle.[hash].js", + path: __dirname + "/out" + }, + resolve: { + extensions: [".ts", ".js"] + }, + module: { + rules: [ + { + test: /\.(png|jpg|gif)$/, + loader: "file-loader", + options: { name: "[path][hash].[ext]" } + }, + { test: /\.ts$/, use: "ts-loader" } + ] + }, + node: { + process: false + } +}; +EOF diff --git a/scripts/make-module b/scripts/make-module index 1023cb9a08..9aba5ce65e 100755 --- a/scripts/make-module +++ b/scripts/make-module @@ -57,15 +57,15 @@ cat << EOF > $MODULE/package.json "pub": "yarn build && yarn publish --access public" }, "devDependencies": { - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.15", - "mocha": "^5.2.0", - "nyc": "^13.1.0", - "typedoc": "^0.14.0", - "typescript": "^3.2.2" + "@types/mocha": "^5.2.6", + "@types/node": "^12.0.8", + "mocha": "^6.1.4", + "nyc": "^14.0.0", + "typedoc": "^0.14.2", + "typescript": "^3.5.2" }, "dependencies": { - "@thi.ng/api": "^5.0.1" + "@thi.ng/api": "^6.3.0" }, "keywords": [ "ES6",