@thi.ng/shader-ast-stdlib 1.0.75 → 1.1.0

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
@@ -8,7 +8,7 @@
8
8
 
9
9
  > [!NOTE]
10
10
 
11
- > This is one of 216 standalone projects. LLM-free, human-made and
11
+ > This is one of 217 standalone projects. LLM-free, human-made and
12
12
  > cared for software, maintained as part of the
13
13
  > [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem and
14
14
  > anti-framework.
@@ -118,7 +118,7 @@ For Node.js REPL:
118
118
  const std = await import("@thi.ng/shader-ast-stdlib");
119
119
  ```
120
120
 
121
- Package sizes (brotli'd, pre-treeshake): ESM: 13.98 KB
121
+ Package sizes (brotli'd, pre-treeshake): ESM: 14.02 KB
122
122
 
123
123
  ## Dependencies
124
124
 
@@ -1,3 +1,10 @@
1
+ import type { Vec4Sym } from "@thi.ng/shader-ast/api/syms";
1
2
  export declare const m22ToM33: import("@thi.ng/shader-ast").TaggedFn1<"mat2", "mat3">;
2
3
  export declare const m33ToM44: import("@thi.ng/shader-ast").TaggedFn1<"mat3", "mat4">;
4
+ /**
5
+ * Applies perpspective divide on given vector, i.e. `v.xyz / v.w`.
6
+ *
7
+ * @param v
8
+ */
9
+ export declare const perspectiveDivide: (v: Vec4Sym) => import("@thi.ng/shader-ast").Op2<"vec3">;
3
10
  //# sourceMappingURL=convert.d.ts.map
package/matrix/convert.js CHANGED
@@ -2,6 +2,8 @@ import { M2, M3, M4 } from "@thi.ng/shader-ast/api/types";
2
2
  import { defn, ret } from "@thi.ng/shader-ast/ast/function";
3
3
  import { indexMat } from "@thi.ng/shader-ast/ast/indexed";
4
4
  import { VEC3_0, mat3, mat4, vec3, vec4 } from "@thi.ng/shader-ast/ast/lit";
5
+ import { div } from "@thi.ng/shader-ast/ast/ops";
6
+ import { $w, $xyz } from "@thi.ng/shader-ast/ast/swizzle";
5
7
  const m22ToM33 = defn(M3, "m22ToM33", [M2], (m) => {
6
8
  return [
7
9
  ret(mat3(vec3(indexMat(m, 0), 0), vec3(indexMat(m, 1), 0), VEC3_0))
@@ -19,7 +21,9 @@ const m33ToM44 = defn(M4, "m33ToM44", [M3], (m) => {
19
21
  )
20
22
  ];
21
23
  });
24
+ const perspectiveDivide = (v) => div($xyz(v), $w(v));
22
25
  export {
23
26
  m22ToM33,
24
- m33ToM44
27
+ m33ToM44,
28
+ perspectiveDivide
25
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/shader-ast-stdlib",
3
- "version": "1.0.75",
3
+ "version": "1.1.0",
4
4
  "description": "Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -43,12 +43,12 @@
43
43
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
44
44
  },
45
45
  "dependencies": {
46
- "@thi.ng/api": "^8.12.27",
47
- "@thi.ng/shader-ast": "^1.1.56"
46
+ "@thi.ng/api": "^8.12.28",
47
+ "@thi.ng/shader-ast": "^1.1.57"
48
48
  },
49
49
  "devDependencies": {
50
- "esbuild": "^0.28.1",
51
- "typedoc": "^0.28.19",
50
+ "esbuild": "^0.28.2",
51
+ "typedoc": "^0.28.20",
52
52
  "typescript": "^6.0.3"
53
53
  },
54
54
  "keywords": [
@@ -376,5 +376,5 @@
376
376
  ],
377
377
  "year": 2019
378
378
  },
379
- "gitHead": "6a4e7c564ebc476770d213d98a2aa6257a41ac15"
379
+ "gitHead": "57ce96457ee0b8de5b17f9d371e6707780c64bd7"
380
380
  }