@thi.ng/webgl-msdf 2.1.114 → 2.1.116

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**: 2024-01-30T21:37:19Z
3
+ - **Last updated**: 2024-02-10T08:59:57Z
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.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [2.1.115](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl-msdf@2.1.115) (2024-02-06)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - use shader type consts ([b230780](https://github.com/thi-ng/umbrella/commit/b230780))
17
+
12
18
  ### [2.1.95](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl-msdf@2.1.95) (2023-11-09)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
  <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
3
+ > [!IMPORTANT]
4
+ > ‼️ Announcing the thi.ng user survey 2024 📋
5
+ >
6
+ > [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
7
+ > (open until end of February)
8
+ >
9
+ > **To achieve a better sample size, I'd highly appreciate if you could
10
+ > circulate the link to this survey in your own networks.**
11
+ >
12
+ > [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
3
13
 
4
14
  # ![@thi.ng/webgl-msdf](https://media.thi.ng/umbrella/banners-20230807/thing-webgl-msdf.svg?41eeb5f3)
5
15
 
@@ -67,7 +77,7 @@ For Node.js REPL:
67
77
  const webglMsdf = await import("@thi.ng/webgl-msdf");
68
78
  ```
69
79
 
70
- Package sizes (brotli'd, pre-treeshake): ESM: 1.56 KB
80
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.57 KB
71
81
 
72
82
  ## Dependencies
73
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/webgl-msdf",
3
- "version": "2.1.114",
3
+ "version": "2.1.116",
4
4
  "description": "Multi-channel SDF font rendering & basic text layout for WebGL",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,18 +35,18 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.22",
39
- "@thi.ng/shader-ast": "^0.13.6",
40
- "@thi.ng/transducers": "^8.8.26",
41
- "@thi.ng/vector-pools": "^3.1.102",
42
- "@thi.ng/vectors": "^7.10.4",
43
- "@thi.ng/webgl": "^6.6.25"
38
+ "@thi.ng/api": "^8.9.23",
39
+ "@thi.ng/shader-ast": "^0.13.8",
40
+ "@thi.ng/transducers": "^8.9.1",
41
+ "@thi.ng/vector-pools": "^3.1.104",
42
+ "@thi.ng/vectors": "^7.10.6",
43
+ "@thi.ng/webgl": "^6.6.27"
44
44
  },
45
45
  "devDependencies": {
46
- "@microsoft/api-extractor": "^7.39.0",
47
- "esbuild": "^0.19.10",
46
+ "@microsoft/api-extractor": "^7.40.1",
47
+ "esbuild": "^0.20.0",
48
48
  "rimraf": "^5.0.5",
49
- "typedoc": "^0.25.4",
49
+ "typedoc": "^0.25.7",
50
50
  "typescript": "^5.3.3"
51
51
  },
52
52
  "keywords": [
@@ -93,5 +93,5 @@
93
93
  "parent": "@thi.ng/webgl",
94
94
  "year": 2019
95
95
  },
96
- "gitHead": "a86521dfac00768f7e51a607209325eb72004730\n"
96
+ "gitHead": "e5e7d5c6ed2eadee7a91d59cbd0c86ce880ab1c5\n"
97
97
  }
package/shader.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { F, M4, S2D, V2, V3, V4 } from "@thi.ng/shader-ast/api/types";
1
2
  import { assign } from "@thi.ng/shader-ast/ast/assign";
2
3
  import { discard, ifThen } from "@thi.ng/shader-ast/ast/controlflow";
3
4
  import { defMain, defn, ret } from "@thi.ng/shader-ast/ast/function";
@@ -15,23 +16,18 @@ import { clamp, max, min, mix } from "@thi.ng/shader-ast/builtin/math";
15
16
  import { fwidth, texture } from "@thi.ng/shader-ast/builtin/texture";
16
17
  import { ONE4, ZERO4 } from "@thi.ng/vectors/api";
17
18
  import { BLEND_NORMAL } from "@thi.ng/webgl/api/blend";
18
- const median3 = defn("float", "median3", ["vec3"], (v) => [
19
+ const median3 = defn(F, "median3", [V3], (v) => [
19
20
  ret(max(min($x(v), $y(v)), min(max($x(v), $y(v)), $z(v))))
20
21
  ]);
21
- const msdfSample = defn(
22
- "vec2",
23
- "msdfSample",
24
- ["sampler2D", "vec2"],
25
- (tex, uv) => {
26
- let sd;
27
- let w;
28
- return [
29
- sd = sym(sub(median3($xyz(texture(tex, uv))), FLOAT05)),
30
- w = sym(clamp(add(div(sd, fwidth(sd)), FLOAT05), FLOAT0, FLOAT1)),
31
- ret(vec2(sd, w))
32
- ];
33
- }
34
- );
22
+ const msdfSample = defn(V2, "msdfSample", [S2D, V2], (tex, uv) => {
23
+ let sd;
24
+ let w;
25
+ return [
26
+ sd = sym(sub(median3($xyz(texture(tex, uv))), FLOAT05)),
27
+ w = sym(clamp(add(div(sd, fwidth(sd)), FLOAT05), FLOAT0, FLOAT1)),
28
+ ret(vec2(sd, w))
29
+ ];
30
+ });
35
31
  const msdfShader = (opts = {}) => ({
36
32
  vs: (gl, unis, ins, outs) => [
37
33
  defMain(() => [
@@ -60,21 +56,21 @@ const msdfShader = (opts = {}) => ({
60
56
  OES_standard_derivatives: true
61
57
  },
62
58
  attribs: {
63
- position: "vec3",
64
- uv: "vec2",
65
- ...opts.color ? { color: "vec4" } : null
59
+ position: V3,
60
+ uv: V2,
61
+ ...opts.color ? { color: V4 } : null
66
62
  },
67
63
  varying: {
68
- vuv: "vec2",
69
- ...opts.color ? { vcolor: "vec4" } : null
64
+ vuv: V2,
65
+ ...opts.color ? { vcolor: V4 } : null
70
66
  },
71
67
  uniforms: {
72
- modelview: "mat4",
73
- proj: "mat4",
74
- tex: "sampler2D",
75
- thresh: ["float", 1e-3],
76
- bg: ["vec4", ZERO4],
77
- ...!opts.color ? { fg: ["vec4", ONE4] } : null
68
+ modelview: M4,
69
+ proj: M4,
70
+ tex: S2D,
71
+ thresh: [F, 1e-3],
72
+ bg: [V4, ZERO4],
73
+ ...!opts.color ? { fg: [V4, ONE4] } : null
78
74
  },
79
75
  state: {
80
76
  blend: true,