@thi.ng/shader-ast-js 0.7.38 → 0.7.40

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
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2022-12-16T12:52:25Z
3
+ - **Last updated**: 2022-12-22T21:47:07Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -22,7 +22,7 @@ This project is part of the
22
22
 
23
23
  ## About
24
24
 
25
- Customizable JS codegen, compiler & runtime for @thi.ng/shader-ast
25
+ Customizable JS codegen, compiler & runtime for [@thi.ng/shader-ast](https://github.com/thi-ng/umbrella/tree/develop/packages/shader-ast).
26
26
 
27
27
  Due to the lack of native vector operations in JS, this compile target
28
28
  is much more involved than the
package/api.d.ts CHANGED
@@ -4,13 +4,14 @@ import type { Term } from "@thi.ng/shader-ast";
4
4
  import type { BVec, Vec } from "@thi.ng/vectors";
5
5
  export interface JSTarget extends Fn<Term<any>, string> {
6
6
  /**
7
- * Compiles given AST to JavaScript, using optional `env` as backend
8
- * for various operators / builtins. If `env` is not given the
9
- * bundled {@link JS_DEFAULT_ENV} is used (based on
10
- * {@link @thi.ng/vectors# | @thi.ng/vectors} and {@link @thi.ng/matrices# | @thi.ng/matrices} packages).
7
+ * Compiles given AST to JavaScript, using optional `env` as backend for
8
+ * various operators / builtins. If `env` is not given the bundled
9
+ * {@link JS_DEFAULT_ENV} is used (based on
10
+ * [`thi.ng/vectors`](https://thi.ng/vectors) and
11
+ * [`thi.ng/matrices`](https://thi.ng/matrices) packages).
11
12
  *
12
- * Any functions defined in the given AST will be exported using
13
- * their defined name via the returned object.
13
+ * Any functions defined in the given AST will be exported using their
14
+ * defined name via the returned object.
14
15
  *
15
16
  * ```
16
17
  * const js = targetJS();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/shader-ast-js",
3
- "version": "0.7.38",
3
+ "version": "0.7.40",
4
4
  "description": "Customizable JS codegen, compiler & runtime for @thi.ng/shader-ast",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,18 +34,18 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.6.0",
38
- "@thi.ng/checks": "^3.3.5",
39
- "@thi.ng/errors": "^2.2.6",
40
- "@thi.ng/math": "^5.3.16",
41
- "@thi.ng/matrices": "^2.1.36",
42
- "@thi.ng/pixel": "^4.0.11",
43
- "@thi.ng/shader-ast": "^0.12.33",
44
- "@thi.ng/vectors": "^7.5.27"
37
+ "@thi.ng/api": "^8.6.2",
38
+ "@thi.ng/checks": "^3.3.6",
39
+ "@thi.ng/errors": "^2.2.7",
40
+ "@thi.ng/math": "^5.3.18",
41
+ "@thi.ng/matrices": "^2.1.38",
42
+ "@thi.ng/pixel": "^4.0.13",
43
+ "@thi.ng/shader-ast": "^0.12.35",
44
+ "@thi.ng/vectors": "^7.5.29"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@microsoft/api-extractor": "^7.33.7",
48
- "@thi.ng/testament": "^0.3.7",
48
+ "@thi.ng/testament": "^0.3.8",
49
49
  "rimraf": "^3.0.2",
50
50
  "tools": "^0.0.1",
51
51
  "typedoc": "^0.23.22",
@@ -147,5 +147,5 @@
147
147
  ],
148
148
  "year": 2019
149
149
  },
150
- "gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
150
+ "gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\n"
151
151
  }
package/runtime.d.ts CHANGED
@@ -2,16 +2,14 @@ import type { Fn } from "@thi.ng/api";
2
2
  import { IntBuffer } from "@thi.ng/pixel/int";
3
3
  import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
4
4
  /**
5
- * Low-level function used by {@link canvasRenderer} and
6
- * {@link renderBuffer}. Applies shader function `fn` to each pixel in
7
- * the given region of the `u32` raw ABGR buffer (a `Uint32Array`). The
8
- * region is defined by the top-left `x`, `y` coords and `w`, `h`
9
- * dimensions. The remaining parameters `bufW`, `bufH`, `bufOffsetX`,
10
- * `bufOffsetY` and `imgH` are used to define the actual location of the
11
- * given buffer in the full image to be computed and to support use
12
- * cases where the target array only defines a sub-region of the full
13
- * image (e.g. when splitting rendering over multiple workers, each with
14
- * their own buffer).
5
+ * Low-level function used by {@link canvasRenderer} and {@link renderBuffer}.
6
+ * Applies shader function `fn` to each pixel in the given region of the `u32`
7
+ * raw ABGR buffer (a `Uint32Array`). The region is defined by the top-left `x`,
8
+ * `y` coords and `w`, `h` dimensions. The remaining parameters `bufW`, `bufH`,
9
+ * `bufOffsetX`, `bufOffsetY` and `imgH` are used to define the actual location
10
+ * of the given buffer in the full image to be computed and to support use cases
11
+ * where the target array only defines a sub-region of the full image (e.g. when
12
+ * splitting rendering over multiple workers, each with their own buffer).
15
13
  *
16
14
  * @param fn -
17
15
  * @param u32 -
@@ -27,15 +25,17 @@ import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
27
25
  */
28
26
  export declare const renderPixels: (fn: Fn<ReadonlyVec, Vec>, u32: Uint32Array, bufW: number, bufH: number, x: number, y: number, w?: number, h?: number, bufOffsetX?: number, bufOffsetY?: number, imgH?: number) => Uint32Array;
29
27
  /**
30
- * Takes a {@link @thi.ng/pixel#IntBuffer} pixel buffer from
31
- * thi.ng/pixel w/ {@link @thi.ng/pixel#ABGR8888} format, an optional
32
- * buffer local region defined by `x`, `y`, `w`, `h` and applies shader
33
- * function `fn` to each pixel in that region (or full buffer by
28
+ * Takes a
29
+ * [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html)
30
+ * pixel buffer from thi.ng/pixel w/
31
+ * [`ABGR8888`](https://docs.thi.ng/umbrella/pixel/variables/ABGR8888.html)
32
+ * format, an optional buffer local region defined by `x`, `y`, `w`, `h` and
33
+ * applies shader function `fn` to each pixel in that region (or full buffer by
34
34
  * default).
35
35
  *
36
- * In case the buffer only defines a sub-region of a larger image,
37
- * `bufOffsetX`, `bufOffsetY` and `imgH` can be given to configure the
38
- * location and full image height.
36
+ * In case the buffer only defines a sub-region of a larger image, `bufOffsetX`,
37
+ * `bufOffsetY` and `imgH` can be given to configure the location and full image
38
+ * height.
39
39
  *
40
40
  * @param fn -
41
41
  * @param buf -
@@ -49,12 +49,12 @@ export declare const renderPixels: (fn: Fn<ReadonlyVec, Vec>, u32: Uint32Array,
49
49
  */
50
50
  export declare const renderBuffer: (fn: Fn<ReadonlyVec, Vec>, buf: IntBuffer, x?: number, y?: number, w?: number, h?: number, bufOffsetX?: number, bufOffsetY?: number, imgH?: number) => IntBuffer;
51
51
  /**
52
- * Higher order function accepting an `HTMLCanvasElement` and returning
53
- * a render function which accepts the following parameters:
52
+ * Higher order function accepting an `HTMLCanvasElement` and returning a render
53
+ * function which accepts the following parameters:
54
54
  *
55
55
  * - `fn` - shader function (compiled via `targetJS().compile(ast)`)
56
- * - `x`, `y`, `w`, `h` - optional args to define a sub-region to be
57
- * updated (default to full image update)
56
+ * - `x`, `y`, `w`, `h` - optional args to define a sub-region to be updated
57
+ * (default to full image update)
58
58
  *
59
59
  * @param canvas -
60
60
  */
package/runtime.js CHANGED
@@ -8,16 +8,14 @@ const rgba2bgra = (rgba) => ((clamp01(rgba[0]) * 255.5) << 0) |
8
8
  ((clamp01(rgba[3]) * 255.5) << 24);
9
9
  const clampCoord = (x, maxW, w) => w !== undefined ? Math.min(x + w, maxW) : maxW;
10
10
  /**
11
- * Low-level function used by {@link canvasRenderer} and
12
- * {@link renderBuffer}. Applies shader function `fn` to each pixel in
13
- * the given region of the `u32` raw ABGR buffer (a `Uint32Array`). The
14
- * region is defined by the top-left `x`, `y` coords and `w`, `h`
15
- * dimensions. The remaining parameters `bufW`, `bufH`, `bufOffsetX`,
16
- * `bufOffsetY` and `imgH` are used to define the actual location of the
17
- * given buffer in the full image to be computed and to support use
18
- * cases where the target array only defines a sub-region of the full
19
- * image (e.g. when splitting rendering over multiple workers, each with
20
- * their own buffer).
11
+ * Low-level function used by {@link canvasRenderer} and {@link renderBuffer}.
12
+ * Applies shader function `fn` to each pixel in the given region of the `u32`
13
+ * raw ABGR buffer (a `Uint32Array`). The region is defined by the top-left `x`,
14
+ * `y` coords and `w`, `h` dimensions. The remaining parameters `bufW`, `bufH`,
15
+ * `bufOffsetX`, `bufOffsetY` and `imgH` are used to define the actual location
16
+ * of the given buffer in the full image to be computed and to support use cases
17
+ * where the target array only defines a sub-region of the full image (e.g. when
18
+ * splitting rendering over multiple workers, each with their own buffer).
21
19
  *
22
20
  * @param fn -
23
21
  * @param u32 -
@@ -48,15 +46,17 @@ export const renderPixels = (fn, u32, bufW, bufH, x, y, w, h, bufOffsetX = 0, bu
48
46
  return u32;
49
47
  };
50
48
  /**
51
- * Takes a {@link @thi.ng/pixel#IntBuffer} pixel buffer from
52
- * thi.ng/pixel w/ {@link @thi.ng/pixel#ABGR8888} format, an optional
53
- * buffer local region defined by `x`, `y`, `w`, `h` and applies shader
54
- * function `fn` to each pixel in that region (or full buffer by
49
+ * Takes a
50
+ * [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html)
51
+ * pixel buffer from thi.ng/pixel w/
52
+ * [`ABGR8888`](https://docs.thi.ng/umbrella/pixel/variables/ABGR8888.html)
53
+ * format, an optional buffer local region defined by `x`, `y`, `w`, `h` and
54
+ * applies shader function `fn` to each pixel in that region (or full buffer by
55
55
  * default).
56
56
  *
57
- * In case the buffer only defines a sub-region of a larger image,
58
- * `bufOffsetX`, `bufOffsetY` and `imgH` can be given to configure the
59
- * location and full image height.
57
+ * In case the buffer only defines a sub-region of a larger image, `bufOffsetX`,
58
+ * `bufOffsetY` and `imgH` can be given to configure the location and full image
59
+ * height.
60
60
  *
61
61
  * @param fn -
62
62
  * @param buf -
@@ -74,12 +74,12 @@ export const renderBuffer = (fn, buf, x = 0, y = 0, w, h, bufOffsetX = 0, bufOff
74
74
  return buf;
75
75
  };
76
76
  /**
77
- * Higher order function accepting an `HTMLCanvasElement` and returning
78
- * a render function which accepts the following parameters:
77
+ * Higher order function accepting an `HTMLCanvasElement` and returning a render
78
+ * function which accepts the following parameters:
79
79
  *
80
80
  * - `fn` - shader function (compiled via `targetJS().compile(ast)`)
81
- * - `x`, `y`, `w`, `h` - optional args to define a sub-region to be
82
- * updated (default to full image update)
81
+ * - `x`, `y`, `w`, `h` - optional args to define a sub-region to be updated
82
+ * (default to full image update)
83
83
  *
84
84
  * @param canvas -
85
85
  */