@thi.ng/shader-ast-stdlib 1.0.50 → 1.0.51

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 210 standalone projects, maintained as part
10
+ > This is one of 211 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -115,7 +115,7 @@ For Node.js REPL:
115
115
  const std = await import("@thi.ng/shader-ast-stdlib");
116
116
  ```
117
117
 
118
- Package sizes (brotli'd, pre-treeshake): ESM: 14.03 KB
118
+ Package sizes (brotli'd, pre-treeshake): ESM: 13.98 KB
119
119
 
120
120
  ## Dependencies
121
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/shader-ast-stdlib",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "description": "Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -42,8 +42,8 @@
42
42
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@thi.ng/api": "^8.12.9",
46
- "@thi.ng/shader-ast": "^1.1.31"
45
+ "@thi.ng/api": "^8.12.10",
46
+ "@thi.ng/shader-ast": "^1.1.32"
47
47
  },
48
48
  "devDependencies": {
49
49
  "esbuild": "^0.27.0",
@@ -375,5 +375,5 @@
375
375
  ],
376
376
  "year": 2019
377
377
  },
378
- "gitHead": "fdca77cabf47dd23a9ab17a5ca13e3060075c12c\n"
378
+ "gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
379
379
  }
package/sdf/bezier.js CHANGED
@@ -47,7 +47,7 @@ const sdfQuadratic2 = defn(
47
47
  return [
48
48
  a = sym(sub(B, A)),
49
49
  b = sym(add(madd(B, -2, A), C)),
50
- c = sym(mul(a, 2)),
50
+ c = sym(mul(a, FLOAT2)),
51
51
  d = sym(sub(A, pos)),
52
52
  kk = sym(div(FLOAT1, dot(b, b))),
53
53
  kx = sym(mul(kk, dot(a, b))),
@@ -77,7 +77,7 @@ const sdfQuadratic2 = defn(
77
77
  div(acos(div(q, mul(mul(p, z), FLOAT2))), float(3))
78
78
  ),
79
79
  m = sym(cos(v)),
80
- n = sym(mul(sin(v), 1.732050808)),
80
+ n = sym(mul(sin(v), Math.sqrt(3))),
81
81
  uv = sym(
82
82
  clamp01(
83
83
  sub(mul(vec2(add(m, m), sub(neg(n), m)), z), kx)
@@ -91,11 +91,17 @@ const sdfQuadratic2 = defn(
91
91
  lt(m, n),
92
92
  [
93
93
  assign(res, m),
94
- assign(sgn, cross2(madd(b, mul($x(uv), 2), c), x))
94
+ assign(
95
+ sgn,
96
+ cross2(madd(b, mul($x(uv), FLOAT2), c), x)
97
+ )
95
98
  ],
96
99
  [
97
100
  assign(res, n),
98
- assign(sgn, cross2(madd(b, mul($y(uv), 2), c), y))
101
+ assign(
102
+ sgn,
103
+ cross2(madd(b, mul($y(uv), FLOAT2), c), y)
104
+ )
99
105
  ]
100
106
  )
101
107
  ]