@thi.ng/shader-ast-stdlib 0.10.0 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.10.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.6...@thi.ng/shader-ast-stdlib@0.10.7) (2021-10-28)
7
+
8
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.10.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.5...@thi.ng/shader-ast-stdlib@0.10.6) (2021-10-28)
15
+
16
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.10.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.4...@thi.ng/shader-ast-stdlib@0.10.5) (2021-10-28)
23
+
24
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.10.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.3...@thi.ng/shader-ast-stdlib@0.10.4) (2021-10-25)
31
+
32
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
33
+
34
+
35
+
36
+
37
+
38
+ ## [0.10.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.2...@thi.ng/shader-ast-stdlib@0.10.3) (2021-10-15)
39
+
40
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
41
+
42
+
43
+
44
+
45
+
46
+ ## [0.10.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.1...@thi.ng/shader-ast-stdlib@0.10.2) (2021-10-15)
47
+
48
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
49
+
50
+
51
+
52
+
53
+
54
+ ## [0.10.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.10.0...@thi.ng/shader-ast-stdlib@0.10.1) (2021-10-13)
55
+
56
+ **Note:** Version bump only for package @thi.ng/shader-ast-stdlib
57
+
58
+
59
+
60
+
61
+
6
62
  # [0.10.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/shader-ast-stdlib@0.9.4...@thi.ng/shader-ast-stdlib@0.10.0) (2021-10-12)
7
63
 
8
64
 
package/README.md CHANGED
@@ -95,10 +95,11 @@ ES module import:
95
95
 
96
96
  [Skypack documentation](https://docs.skypack.dev/)
97
97
 
98
- For NodeJS (v14.6+):
98
+ For Node.js REPL:
99
99
 
100
100
  ```text
101
- node --experimental-specifier-resolution=node --experimental-repl-await
101
+ # with flag only for < v16
102
+ node --experimental-repl-await
102
103
 
103
104
  > const shaderAstStdlib = await import("@thi.ng/shader-ast-stdlib");
104
105
  ```
@@ -126,7 +127,7 @@ A selection:
126
127
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/shader-ast/shader-ast-raymarch.jpg" width="240"/> | WebGL & JS canvas2D raymarch shader cross-compilation | [Demo](https://demo.thi.ng/umbrella/shader-ast-raymarch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-raymarch) |
127
128
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-sdf2d.jpg" width="240"/> | WebGL & JS canvas 2D SDF | [Demo](https://demo.thi.ng/umbrella/shader-ast-sdf2d/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-sdf2d) |
128
129
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-tunnel.jpg" width="240"/> | WebGL & Canvas2D textured tunnel shader | [Demo](https://demo.thi.ng/umbrella/shader-ast-tunnel/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-tunnel) |
129
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-workers.jpg" width="240"/> | Fork-join worker-based raymarch renderer | [Demo](https://demo.thi.ng/umbrella/shader-ast-workers/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-workers) |
130
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-workers.jpg" width="240"/> | Fork-join worker-based raymarch renderer (JS/CPU only) | [Demo](https://demo.thi.ng/umbrella/shader-ast-workers/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-workers) |
130
131
  | | Minimal multi-pass / GPGPU example | [Demo](https://demo.thi.ng/umbrella/webgl-multipass/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-multipass) |
131
132
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-shadertoy.jpg" width="240"/> | Shadertoy-like WebGL setup | [Demo](https://demo.thi.ng/umbrella/webgl-shadertoy/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-shadertoy) |
132
133
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-ssao.jpg" width="240"/> | WebGL screenspace ambient occlusion | [Demo](https://demo.thi.ng/umbrella/webgl-ssao/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-ssao) |
@@ -273,12 +274,12 @@ usually seen in shader code and not easily achievable via the usual
273
274
  string templating approach used by most other GLSL libraries.
274
275
 
275
276
  For example, the
276
- [`additive()`](https://github.com/thi-ng/umbrella/blob/develop/packages/shader-ast-stdlib/src/math/additive.ts#L21)
277
- HOF takes a single-arg scalar function and a number of octaves. It
278
- returns a new function which computes the summed value of `fn` over the
279
- given number octaves, with a user defined phase shift & decay factor
280
- (per octave). This can be used for additive wave synthesis, multi-octave
281
- noise or any other similar use cases...
277
+ [`additive()`](https://docs.thi.ng/umbrella/shader-ast-stdlib/modules.html#additive)
278
+ HOF takes a single-arg scalar function and a number of octaves. It returns a new
279
+ function which computes the summed value of `fn` over the given number octaves,
280
+ with a user defined phase shift & decay factor (per octave). This can be used
281
+ for additive wave synthesis, multi-octave noise or any other similar use
282
+ cases...
282
283
 
283
284
  Due to the way user defined AST functions keep track of their own call
284
285
  graph, the anonymous function returned by `additive` does not need to be
@@ -1,6 +1,6 @@
1
1
  import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
2
  import { add, div, mul } from "@thi.ng/shader-ast/ast/ops";
3
- import { clamp01 } from "../math/clamp";
3
+ import { clamp01 } from "../math/clamp.js";
4
4
  /**
5
5
  * Filmic HDR -> LDR mapping based on ACES.
6
6
  *
package/color/levels.js CHANGED
@@ -5,7 +5,7 @@ import { float, FLOAT0, FLOAT05, FLOAT1, vec3, VEC3_0, VEC3_1, } from "@thi.ng/s
5
5
  import { lt, madd, mul, reciprocal, sub } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $x, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { max, min, pow } from "@thi.ng/shader-ast/builtin/math";
8
- import { fit01, fitClamped } from "../math/fit";
8
+ import { fit01, fitClamped } from "../math/fit.js";
9
9
  /**
10
10
  * Takes normalized `mid` level and converts it into an exponent for gamma
11
11
  * correction using {@link levelAdjustGamma}.
@@ -2,7 +2,7 @@ import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
2
  import { FLOAT0, FLOAT1, vec4 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { add, mul, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $w } from "@thi.ng/shader-ast/ast/swizzle";
5
- import { clamp01 } from "../math/clamp";
5
+ import { clamp01 } from "../math/clamp.js";
6
6
  const coeff = (f, a, b) => (f === ZERO ? FLOAT0 : f === ONE ? a : mul(a, f($w(a), $w(b))));
7
7
  /**
8
8
  * Higher-order Porter-Duff alpha compositing operator. See
package/fog/exp.js CHANGED
@@ -2,7 +2,7 @@ import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
2
  import { FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { mul, neg, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { exp } from "@thi.ng/shader-ast/builtin/math";
5
- import { clamp01 } from "../math/clamp";
5
+ import { clamp01 } from "../math/clamp.js";
6
6
  /**
7
7
  * Computes exponential fog factor [0..1], based on given fully
8
8
  * saturated fog distance and density.
package/fog/exp2.js CHANGED
@@ -3,7 +3,7 @@ import { defn, ret } from "@thi.ng/shader-ast/ast/function";
3
3
  import { FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
4
4
  import { mul, sub } from "@thi.ng/shader-ast/ast/ops";
5
5
  import { exp2 } from "@thi.ng/shader-ast/builtin/math";
6
- import { clamp01 } from "../math/clamp";
6
+ import { clamp01 } from "../math/clamp.js";
7
7
  /**
8
8
  * Similar to {@link fogExp}. Computes exponential fog factor [0..1],
9
9
  * based on given fully saturated fog distance and density. Uses
package/fog/linear.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
- import { clamp01 } from "../math/clamp";
3
- import { fitNorm1 } from "../math/fit";
2
+ import { clamp01 } from "../math/clamp.js";
3
+ import { fitNorm1 } from "../math/fit.js";
4
4
  /**
5
5
  * Computes linear fog factor [0..1], based on given fog min/max
6
6
  * distances.
package/index.d.ts CHANGED
@@ -1,69 +1,69 @@
1
- export * from "./api";
2
- export * from "./color/aces-film";
3
- export * from "./color/levels";
4
- export * from "./color/linear-srgb";
5
- export * from "./color/luminance";
6
- export * from "./color/porter-duff";
7
- export * from "./color/rgbe";
8
- export * from "./fog/exp";
9
- export * from "./fog/exp2";
10
- export * from "./fog/linear";
11
- export * from "./light/lambert";
12
- export * from "./light/trilight";
13
- export * from "./math/additive";
14
- export * from "./math/cartesian";
15
- export * from "./math/clamp";
16
- export * from "./math/cross2";
17
- export * from "./math/dist-chebyshev";
18
- export * from "./math/dist-manhattan";
19
- export * from "./math/fit";
20
- export * from "./math/magsq";
21
- export * from "./math/maxcomp";
22
- export * from "./math/mincomp";
23
- export * from "./math/mix-cubic";
24
- export * from "./math/mix-quadratic";
25
- export * from "./math/orthogonal";
26
- export * from "./math/osc";
27
- export * from "./math/polar";
28
- export * from "./math/sincos";
29
- export * from "./matrix/lookat";
30
- export * from "./matrix/mvp";
31
- export * from "./matrix/normal";
32
- export * from "./matrix/rotation";
33
- export * from "./noise/curl3";
34
- export * from "./noise/hash";
35
- export * from "./noise/permute";
36
- export * from "./noise/simplex2";
37
- export * from "./noise/simplex3";
38
- export * from "./noise/voronoi2";
39
- export * from "./noise/worley2";
40
- export * from "./raymarch/ao";
41
- export * from "./raymarch/direction";
42
- export * from "./raymarch/normal";
43
- export * from "./raymarch/point-at";
44
- export * from "./raymarch/scene";
45
- export * from "./screen/uv";
46
- export * from "./sdf/annular";
47
- export * from "./sdf/box";
48
- export * from "./sdf/cylinder";
49
- export * from "./sdf/isec";
50
- export * from "./sdf/line";
51
- export * from "./sdf/mirror";
52
- export * from "./sdf/plane";
53
- export * from "./sdf/polyhedra";
54
- export * from "./sdf/repeat";
55
- export * from "./sdf/repeat-polar";
56
- export * from "./sdf/round";
57
- export * from "./sdf/smooth-isec";
58
- export * from "./sdf/smooth-sub";
59
- export * from "./sdf/smooth-union";
60
- export * from "./sdf/sphere";
61
- export * from "./sdf/sub";
62
- export * from "./sdf/torus";
63
- export * from "./sdf/tri";
64
- export * from "./sdf/union";
65
- export * from "./tex/blur";
66
- export * from "./tex/index-coord";
67
- export * from "./tex/index-uv";
68
- export * from "./tex/read-index";
1
+ export * from "./api.js";
2
+ export * from "./color/aces-film.js";
3
+ export * from "./color/levels.js";
4
+ export * from "./color/linear-srgb.js";
5
+ export * from "./color/luminance.js";
6
+ export * from "./color/porter-duff.js";
7
+ export * from "./color/rgbe.js";
8
+ export * from "./fog/exp.js";
9
+ export * from "./fog/exp2.js";
10
+ export * from "./fog/linear.js";
11
+ export * from "./light/lambert.js";
12
+ export * from "./light/trilight.js";
13
+ export * from "./math/additive.js";
14
+ export * from "./math/cartesian.js";
15
+ export * from "./math/clamp.js";
16
+ export * from "./math/cross2.js";
17
+ export * from "./math/dist-chebyshev.js";
18
+ export * from "./math/dist-manhattan.js";
19
+ export * from "./math/fit.js";
20
+ export * from "./math/magsq.js";
21
+ export * from "./math/maxcomp.js";
22
+ export * from "./math/mincomp.js";
23
+ export * from "./math/mix-cubic.js";
24
+ export * from "./math/mix-quadratic.js";
25
+ export * from "./math/orthogonal.js";
26
+ export * from "./math/osc.js";
27
+ export * from "./math/polar.js";
28
+ export * from "./math/sincos.js";
29
+ export * from "./matrix/lookat.js";
30
+ export * from "./matrix/mvp.js";
31
+ export * from "./matrix/normal.js";
32
+ export * from "./matrix/rotation.js";
33
+ export * from "./noise/curl3.js";
34
+ export * from "./noise/hash.js";
35
+ export * from "./noise/permute.js";
36
+ export * from "./noise/simplex2.js";
37
+ export * from "./noise/simplex3.js";
38
+ export * from "./noise/voronoi2.js";
39
+ export * from "./noise/worley2.js";
40
+ export * from "./raymarch/ao.js";
41
+ export * from "./raymarch/direction.js";
42
+ export * from "./raymarch/normal.js";
43
+ export * from "./raymarch/point-at.js";
44
+ export * from "./raymarch/scene.js";
45
+ export * from "./screen/uv.js";
46
+ export * from "./sdf/annular.js";
47
+ export * from "./sdf/box.js";
48
+ export * from "./sdf/cylinder.js";
49
+ export * from "./sdf/isec.js";
50
+ export * from "./sdf/line.js";
51
+ export * from "./sdf/mirror.js";
52
+ export * from "./sdf/plane.js";
53
+ export * from "./sdf/polyhedra.js";
54
+ export * from "./sdf/repeat.js";
55
+ export * from "./sdf/repeat-polar.js";
56
+ export * from "./sdf/round.js";
57
+ export * from "./sdf/smooth-isec.js";
58
+ export * from "./sdf/smooth-sub.js";
59
+ export * from "./sdf/smooth-union.js";
60
+ export * from "./sdf/sphere.js";
61
+ export * from "./sdf/sub.js";
62
+ export * from "./sdf/torus.js";
63
+ export * from "./sdf/tri.js";
64
+ export * from "./sdf/union.js";
65
+ export * from "./tex/blur.js";
66
+ export * from "./tex/index-coord.js";
67
+ export * from "./tex/index-uv.js";
68
+ export * from "./tex/read-index.js";
69
69
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,68 +1,68 @@
1
- export * from "./api";
2
- export * from "./color/aces-film";
3
- export * from "./color/levels";
4
- export * from "./color/linear-srgb";
5
- export * from "./color/luminance";
6
- export * from "./color/porter-duff";
7
- export * from "./color/rgbe";
8
- export * from "./fog/exp";
9
- export * from "./fog/exp2";
10
- export * from "./fog/linear";
11
- export * from "./light/lambert";
12
- export * from "./light/trilight";
13
- export * from "./math/additive";
14
- export * from "./math/cartesian";
15
- export * from "./math/clamp";
16
- export * from "./math/cross2";
17
- export * from "./math/dist-chebyshev";
18
- export * from "./math/dist-manhattan";
19
- export * from "./math/fit";
20
- export * from "./math/magsq";
21
- export * from "./math/maxcomp";
22
- export * from "./math/mincomp";
23
- export * from "./math/mix-cubic";
24
- export * from "./math/mix-quadratic";
25
- export * from "./math/orthogonal";
26
- export * from "./math/osc";
27
- export * from "./math/polar";
28
- export * from "./math/sincos";
29
- export * from "./matrix/lookat";
30
- export * from "./matrix/mvp";
31
- export * from "./matrix/normal";
32
- export * from "./matrix/rotation";
33
- export * from "./noise/curl3";
34
- export * from "./noise/hash";
35
- export * from "./noise/permute";
36
- export * from "./noise/simplex2";
37
- export * from "./noise/simplex3";
38
- export * from "./noise/voronoi2";
39
- export * from "./noise/worley2";
40
- export * from "./raymarch/ao";
41
- export * from "./raymarch/direction";
42
- export * from "./raymarch/normal";
43
- export * from "./raymarch/point-at";
44
- export * from "./raymarch/scene";
45
- export * from "./screen/uv";
46
- export * from "./sdf/annular";
47
- export * from "./sdf/box";
48
- export * from "./sdf/cylinder";
49
- export * from "./sdf/isec";
50
- export * from "./sdf/line";
51
- export * from "./sdf/mirror";
52
- export * from "./sdf/plane";
53
- export * from "./sdf/polyhedra";
54
- export * from "./sdf/repeat";
55
- export * from "./sdf/repeat-polar";
56
- export * from "./sdf/round";
57
- export * from "./sdf/smooth-isec";
58
- export * from "./sdf/smooth-sub";
59
- export * from "./sdf/smooth-union";
60
- export * from "./sdf/sphere";
61
- export * from "./sdf/sub";
62
- export * from "./sdf/torus";
63
- export * from "./sdf/tri";
64
- export * from "./sdf/union";
65
- export * from "./tex/blur";
66
- export * from "./tex/index-coord";
67
- export * from "./tex/index-uv";
68
- export * from "./tex/read-index";
1
+ export * from "./api.js";
2
+ export * from "./color/aces-film.js";
3
+ export * from "./color/levels.js";
4
+ export * from "./color/linear-srgb.js";
5
+ export * from "./color/luminance.js";
6
+ export * from "./color/porter-duff.js";
7
+ export * from "./color/rgbe.js";
8
+ export * from "./fog/exp.js";
9
+ export * from "./fog/exp2.js";
10
+ export * from "./fog/linear.js";
11
+ export * from "./light/lambert.js";
12
+ export * from "./light/trilight.js";
13
+ export * from "./math/additive.js";
14
+ export * from "./math/cartesian.js";
15
+ export * from "./math/clamp.js";
16
+ export * from "./math/cross2.js";
17
+ export * from "./math/dist-chebyshev.js";
18
+ export * from "./math/dist-manhattan.js";
19
+ export * from "./math/fit.js";
20
+ export * from "./math/magsq.js";
21
+ export * from "./math/maxcomp.js";
22
+ export * from "./math/mincomp.js";
23
+ export * from "./math/mix-cubic.js";
24
+ export * from "./math/mix-quadratic.js";
25
+ export * from "./math/orthogonal.js";
26
+ export * from "./math/osc.js";
27
+ export * from "./math/polar.js";
28
+ export * from "./math/sincos.js";
29
+ export * from "./matrix/lookat.js";
30
+ export * from "./matrix/mvp.js";
31
+ export * from "./matrix/normal.js";
32
+ export * from "./matrix/rotation.js";
33
+ export * from "./noise/curl3.js";
34
+ export * from "./noise/hash.js";
35
+ export * from "./noise/permute.js";
36
+ export * from "./noise/simplex2.js";
37
+ export * from "./noise/simplex3.js";
38
+ export * from "./noise/voronoi2.js";
39
+ export * from "./noise/worley2.js";
40
+ export * from "./raymarch/ao.js";
41
+ export * from "./raymarch/direction.js";
42
+ export * from "./raymarch/normal.js";
43
+ export * from "./raymarch/point-at.js";
44
+ export * from "./raymarch/scene.js";
45
+ export * from "./screen/uv.js";
46
+ export * from "./sdf/annular.js";
47
+ export * from "./sdf/box.js";
48
+ export * from "./sdf/cylinder.js";
49
+ export * from "./sdf/isec.js";
50
+ export * from "./sdf/line.js";
51
+ export * from "./sdf/mirror.js";
52
+ export * from "./sdf/plane.js";
53
+ export * from "./sdf/polyhedra.js";
54
+ export * from "./sdf/repeat.js";
55
+ export * from "./sdf/repeat-polar.js";
56
+ export * from "./sdf/round.js";
57
+ export * from "./sdf/smooth-isec.js";
58
+ export * from "./sdf/smooth-sub.js";
59
+ export * from "./sdf/smooth-union.js";
60
+ export * from "./sdf/sphere.js";
61
+ export * from "./sdf/sub.js";
62
+ export * from "./sdf/torus.js";
63
+ export * from "./sdf/tri.js";
64
+ export * from "./sdf/union.js";
65
+ export * from "./tex/blur.js";
66
+ export * from "./tex/index-coord.js";
67
+ export * from "./tex/index-uv.js";
68
+ export * from "./tex/read-index.js";
package/light/lambert.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FLOAT0 } from "@thi.ng/shader-ast/ast/lit";
2
2
  import { madd, mul } from "@thi.ng/shader-ast/ast/ops";
3
3
  import { dot, max } from "@thi.ng/shader-ast/builtin/math";
4
- import { fit1101 } from "../math/fit";
4
+ import { fit1101 } from "../math/fit.js";
5
5
  /**
6
6
  * Inline function. Computes Lambert term, i.e. `max(dot(n, l), 0)`.
7
7
  * Both vectors must be pre-normalized.
package/math/cartesian.js CHANGED
@@ -3,7 +3,7 @@ import { vec3 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { mul } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $x, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
- import { cossin } from "./sincos";
6
+ import { cossin } from "./sincos.js";
7
7
  /**
8
8
  * Converts 2D polar vector `v`, i.e. `[r,θ]` (angle in radians) to
9
9
  * cartesian coordinates. See {@link polar2} for reverse operation.
package/math/fit.js CHANGED
@@ -3,7 +3,7 @@ import { defn, ret } from "@thi.ng/shader-ast/ast/function";
3
3
  import { FLOAT0, FLOAT05, FLOAT1, FLOAT2 } from "@thi.ng/shader-ast/ast/lit";
4
4
  import { add, div, mul, neq, sub } from "@thi.ng/shader-ast/ast/ops";
5
5
  import { mix } from "@thi.ng/shader-ast/builtin/math";
6
- import { clamp01 } from "./clamp";
6
+ import { clamp01 } from "./clamp.js";
7
7
  /**
8
8
  * Returns normalized value of `x` WRT to interval [a,b]. Returns 0, if
9
9
  * `a` equals `b`.
@@ -4,9 +4,9 @@ import { add, mul, neg, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $x, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
6
  import { cos, sin } from "@thi.ng/shader-ast/builtin/math";
7
- import { perpendicularCCW } from "../math/orthogonal";
8
- import { cossin } from "../math/sincos";
9
- import { m33ToM44 } from "./convert";
7
+ import { perpendicularCCW } from "../math/orthogonal.js";
8
+ import { cossin } from "../math/sincos.js";
9
+ import { m33ToM44 } from "./convert.js";
10
10
  export const rotation2 = defn("mat2", "rotation2", ["float"], (theta) => {
11
11
  let cs;
12
12
  return [(cs = sym(cossin(theta))), ret(mat2(cs, perpendicularCCW(cs)))];
package/noise/curl3.js CHANGED
@@ -3,7 +3,7 @@ import { vec2, vec3 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { add, div, mul, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $, $x, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
- import { snoiseVec3 } from "./simplex3";
6
+ import { snoiseVec3 } from "./simplex3.js";
7
7
  export const curlNoise3 = defn("vec3", "curlNoise3", ["vec3", "float"], (p, e) => {
8
8
  let D;
9
9
  let px0;
package/noise/simplex2.js CHANGED
@@ -6,8 +6,8 @@ import { add, gt, mul, sub } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $, $x, $xy, $y } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { sym } from "@thi.ng/shader-ast/ast/sym";
8
8
  import { abs, dot, floor, fract, max, mod, } from "@thi.ng/shader-ast/builtin/math";
9
- import { magSq2 } from "../math/magsq";
10
- import { permute3 } from "./permute";
9
+ import { magSq2 } from "../math/magsq.js";
10
+ import { permute3 } from "./permute.js";
11
11
  /**
12
12
  * Array and textureless GLSL 2D simplex noise function. Ported from
13
13
  * original GLSL implementation by Ian McEwan & Ashima Arts.
package/noise/simplex3.js CHANGED
@@ -5,7 +5,7 @@ import { add, mul, neg, sub } from "@thi.ng/shader-ast/ast/ops";
5
5
  import { $, $w, $x, $xy, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
6
6
  import { sym } from "@thi.ng/shader-ast/ast/sym";
7
7
  import { abs, dot, floor, max, min, mod, step, } from "@thi.ng/shader-ast/builtin/math";
8
- import { permute4 } from "./permute";
8
+ import { permute4 } from "./permute.js";
9
9
  export const snoise3 = defn("float", "snoise3", ["vec3"], (v) => {
10
10
  let g;
11
11
  let j;
package/noise/voronoi2.js CHANGED
@@ -6,7 +6,7 @@ import { add, div, inc, lte, madd, mul, sub } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $xy, $z } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { sym } from "@thi.ng/shader-ast/ast/sym";
8
8
  import { dot, floor, fract, pow, smoothstep, sqrt, } from "@thi.ng/shader-ast/builtin/math";
9
- import { hash32 } from "./hash";
9
+ import { hash32 } from "./hash.js";
10
10
  /**
11
11
  * IQ's parametric 2D voronoise. Depending on `u` and `v`, this function
12
12
  * produces 4 different noise types
package/noise/worley2.js CHANGED
@@ -6,7 +6,7 @@ import { add, lt, mul, sub } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $, $x, $xy, $y, $z } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { sym } from "@thi.ng/shader-ast/ast/sym";
8
8
  import { abs, floor, fract, max, min, mod, sqrt, } from "@thi.ng/shader-ast/builtin/math";
9
- import { permute3 } from "./permute";
9
+ import { permute3 } from "./permute.js";
10
10
  export const worleyDist = defn("vec3", "worleyDist", ["vec3", "vec3"], (a, b) => [ret(add(mul(a, a), mul(b, b)))]);
11
11
  export const worleyDistManhattan = defn("vec3", "worleyDistManhatten", ["vec3", "vec3"], (a, b) => [ret(add(abs(a), abs(b)))]);
12
12
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/shader-ast-stdlib",
3
- "version": "0.10.0",
3
+ "version": "0.10.7",
4
4
  "description": "Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,11 +34,11 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.0.0",
38
- "@thi.ng/shader-ast": "^0.11.0"
37
+ "@thi.ng/api": "^8.0.6",
38
+ "@thi.ng/shader-ast": "^0.11.7"
39
39
  },
40
40
  "devDependencies": {
41
- "@thi.ng/testament": "^0.1.0"
41
+ "@thi.ng/testament": "^0.1.6"
42
42
  },
43
43
  "keywords": [
44
44
  "ast",
@@ -69,6 +69,9 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
+ "engines": {
73
+ "node": ">=12.7"
74
+ },
72
75
  "files": [
73
76
  "*.js",
74
77
  "*.d.ts",
@@ -304,5 +307,5 @@
304
307
  ],
305
308
  "year": 2019
306
309
  },
307
- "gitHead": "9ac1344b38b565eb894306fbf72233b6c0b2d115"
310
+ "gitHead": "c17a556ad25f6882dfa8f806a1d9e8ed7ac7cd71"
308
311
  }
package/raymarch/ao.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RaymarchScene } from "../api";
1
+ import type { RaymarchScene } from "../api.js";
2
2
  /**
3
3
  * Higher order function returning an function to compute the Ambient
4
4
  * Occlusion term / shadow factor for given SDF scene function. The
package/raymarch/ao.js CHANGED
@@ -5,7 +5,7 @@ import { float, FLOAT0, FLOAT05, FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
5
5
  import { add, inc, lte, mul, sub } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $x } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { sym } from "@thi.ng/shader-ast/ast/sym";
8
- import { clamp01 } from "../math/clamp";
8
+ import { clamp01 } from "../math/clamp.js";
9
9
  /**
10
10
  * Higher order function returning an function to compute the Ambient
11
11
  * Occlusion term / shadow factor for given SDF scene function. The
@@ -1,4 +1,4 @@
1
- import type { RaymarchScene } from "../api";
1
+ import type { RaymarchScene } from "../api.js";
2
2
  /**
3
3
  * Higher order function producing a function to compute the raymarched
4
4
  * scene normal for a given scene function and intersection position.
@@ -1,4 +1,4 @@
1
- import type { RaymarchOpts, RaymarchScene } from "../api";
1
+ import type { RaymarchOpts, RaymarchScene } from "../api.js";
2
2
  /**
3
3
  * Higher order function producing a function to perform a raymarch
4
4
  * using the provided `scene` function and options to configure the
package/raymarch/scene.js CHANGED
@@ -5,7 +5,7 @@ import { float, int, INT0, vec2 } from "@thi.ng/shader-ast/ast/lit";
5
5
  import { gt, inc, lt, madd } from "@thi.ng/shader-ast/ast/ops";
6
6
  import { $x, $y } from "@thi.ng/shader-ast/ast/swizzle";
7
7
  import { sym } from "@thi.ng/shader-ast/ast/sym";
8
- import { rayPointAt } from "./point-at";
8
+ import { rayPointAt } from "./point-at.js";
9
9
  /**
10
10
  * Higher order function producing a function to perform a raymarch
11
11
  * using the provided `scene` function and options to configure the
package/screen/uv.js CHANGED
@@ -5,7 +5,7 @@ import { add, div, mul } from "@thi.ng/shader-ast/ast/ops";
5
5
  import { $x, $xy, $y } from "@thi.ng/shader-ast/ast/swizzle";
6
6
  import { sym } from "@thi.ng/shader-ast/ast/sym";
7
7
  import { greaterThan, lessThan, _any } from "@thi.ng/shader-ast/builtin/bvec";
8
- import { fit0111 } from "../math/fit";
8
+ import { fit0111 } from "../math/fit.js";
9
9
  /**
10
10
  * Computes UV coord in [0..1] interval from given `fragCoord` and screen `res`.
11
11
  *
package/sdf/box.js CHANGED
@@ -3,7 +3,7 @@ import { FLOAT0, VEC2_0, VEC3_0 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { add, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { sym } from "@thi.ng/shader-ast/ast/sym";
5
5
  import { abs, length, max, min } from "@thi.ng/shader-ast/builtin/math";
6
- import { maxComp2, maxComp3 } from "../math/maxcomp";
6
+ import { maxComp2, maxComp3 } from "../math/maxcomp.js";
7
7
  /**
8
8
  * Returns signed distance from `p` to centered AABB of `size`.
9
9
  *
package/sdf/cylinder.js CHANGED
@@ -4,7 +4,7 @@ import { add, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $, $y } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
6
  import { abs, length, max, min } from "@thi.ng/shader-ast/builtin/math";
7
- import { maxComp2 } from "../math/maxcomp";
7
+ import { maxComp2 } from "../math/maxcomp.js";
8
8
  /**
9
9
  * Returns signed distance from `p` to cylinder centered around Y-axis
10
10
  * with height `h` and radius `r`.
package/sdf/line.js CHANGED
@@ -2,7 +2,7 @@ import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
2
  import { div, mul, sub } from "@thi.ng/shader-ast/ast/ops";
3
3
  import { sym } from "@thi.ng/shader-ast/ast/sym";
4
4
  import { dot, length } from "@thi.ng/shader-ast/builtin/math";
5
- import { clamp01 } from "../math/clamp";
5
+ import { clamp01 } from "../math/clamp.js";
6
6
  /**
7
7
  * Shared impl for sdLine2/3
8
8
  *
@@ -4,7 +4,7 @@ import { add, div, mul, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $x, $y } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
6
  import { atan, length, mod } from "@thi.ng/shader-ast/builtin/math";
7
- import { cossin } from "../math/sincos";
7
+ import { cossin } from "../math/sincos.js";
8
8
  /**
9
9
  * @remarks
10
10
  * Based on HG_SDF (Mercury Demogroup). Does not compute cell index.
@@ -3,8 +3,8 @@ import { FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { add, div, mul, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { sym } from "@thi.ng/shader-ast/ast/sym";
5
5
  import { mix } from "@thi.ng/shader-ast/builtin/math";
6
- import { clamp01 } from "../math/clamp";
7
- import { fit1101 } from "../math/fit";
6
+ import { clamp01 } from "../math/clamp.js";
7
+ import { fit1101 } from "../math/fit.js";
8
8
  /**
9
9
  * @param d1 - float
10
10
  * @param d2 - float
package/sdf/smooth-sub.js CHANGED
@@ -3,8 +3,8 @@ import { FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { add, div, mul, neg, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { sym } from "@thi.ng/shader-ast/ast/sym";
5
5
  import { mix } from "@thi.ng/shader-ast/builtin/math";
6
- import { clamp01 } from "../math/clamp";
7
- import { fit1101 } from "../math/fit";
6
+ import { clamp01 } from "../math/clamp.js";
7
+ import { fit1101 } from "../math/fit.js";
8
8
  /**
9
9
  * @param d1 - float
10
10
  * @param d2 - float
@@ -3,8 +3,8 @@ import { FLOAT1 } from "@thi.ng/shader-ast/ast/lit";
3
3
  import { div, mul, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { sym } from "@thi.ng/shader-ast/ast/sym";
5
5
  import { mix } from "@thi.ng/shader-ast/builtin/math";
6
- import { clamp01 } from "../math/clamp";
7
- import { fit1101 } from "../math/fit";
6
+ import { clamp01 } from "../math/clamp.js";
7
+ import { fit1101 } from "../math/fit.js";
8
8
  /**
9
9
  * @param d1 - float
10
10
  * @param d2 - float
package/sdf/tri.js CHANGED
@@ -4,8 +4,8 @@ import { div, mul, neg, sub } from "@thi.ng/shader-ast/ast/ops";
4
4
  import { $x, $y } from "@thi.ng/shader-ast/ast/swizzle";
5
5
  import { sym } from "@thi.ng/shader-ast/ast/sym";
6
6
  import { dot, min, sign, sqrt } from "@thi.ng/shader-ast/builtin/math";
7
- import { clamp01 } from "../math/clamp";
8
- import { cross2 } from "../math/cross2";
7
+ import { clamp01 } from "../math/clamp.js";
8
+ import { cross2 } from "../math/cross2.js";
9
9
  /**
10
10
  * @param p - vec2
11
11
  * @param a - vec2
package/tex/read-index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $x, $xy, $xyz } from "@thi.ng/shader-ast/ast/swizzle";
2
2
  import { texture } from "@thi.ng/shader-ast/builtin/texture";
3
- import { indexToUV } from "./index-uv";
3
+ import { indexToUV } from "./index-uv.js";
4
4
  /**
5
5
  * Inline function. Returns x component at index `i` in `tex`.
6
6
  *