@thi.ng/shader-ast-stdlib 0.13.14 → 0.13.16

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +1 -1
  3. package/color/aces-film.js +2 -1
  4. package/color/levels.js +5 -4
  5. package/color/porter-duff.js +2 -1
  6. package/color/rgbe.js +3 -2
  7. package/fog/exp.js +4 -1
  8. package/fog/exp2.js +2 -1
  9. package/fog/linear.js +4 -1
  10. package/light/trilight.js +2 -1
  11. package/math/additive.js +2 -1
  12. package/math/cartesian.js +2 -1
  13. package/math/clamp.js +4 -3
  14. package/math/cross2.js +2 -1
  15. package/math/fit.js +4 -1
  16. package/math/magsq.js +2 -1
  17. package/math/mix-cubic.js +6 -5
  18. package/math/mix-quadratic.js +6 -5
  19. package/math/orthogonal.js +2 -1
  20. package/math/polar.js +3 -2
  21. package/matrix/convert.js +4 -3
  22. package/matrix/lookat.js +2 -1
  23. package/matrix/rotation.js +10 -9
  24. package/noise/curl3.js +2 -1
  25. package/noise/hash.js +16 -15
  26. package/noise/permute.js +6 -5
  27. package/noise/simplex2.js +3 -2
  28. package/noise/simplex3.d.ts +1 -0
  29. package/noise/simplex3.js +9 -3
  30. package/noise/voronoi2.js +3 -2
  31. package/noise/worley2.js +6 -3
  32. package/package.json +8 -8
  33. package/raymarch/ao.js +2 -1
  34. package/raymarch/direction.js +2 -1
  35. package/raymarch/normal.js +2 -1
  36. package/raymarch/scene.js +3 -2
  37. package/screen/uv.js +5 -4
  38. package/sdf/arc.js +2 -1
  39. package/sdf/bezier.js +3 -2
  40. package/sdf/box-rounded.js +2 -1
  41. package/sdf/box.js +3 -2
  42. package/sdf/cross.js +4 -3
  43. package/sdf/cylinder.js +3 -2
  44. package/sdf/hex.js +2 -1
  45. package/sdf/line.js +4 -3
  46. package/sdf/mirror.js +2 -1
  47. package/sdf/plane.js +7 -2
  48. package/sdf/polygon.js +2 -1
  49. package/sdf/polyhedra.js +3 -2
  50. package/sdf/repeat-polar.js +2 -1
  51. package/sdf/repeat.js +3 -2
  52. package/sdf/smooth-isec.js +2 -1
  53. package/sdf/smooth-sub.js +2 -1
  54. package/sdf/smooth-union.js +2 -1
  55. package/sdf/sphere.js +7 -2
  56. package/sdf/torus.js +2 -1
  57. package/sdf/tri.js +2 -1
  58. package/sdf/union.js +2 -1
  59. package/tex/blur.js +4 -3
  60. package/tex/index-uv.js +3 -2
package/tex/index-uv.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { I, V2 } from "@thi.ng/shader-ast/api/types";
1
2
  import { defn, ret } from "@thi.ng/shader-ast/ast/function";
2
3
  import { float, int, vec2 } from "@thi.ng/shader-ast/ast/lit";
3
4
  import { add, div, modi, mul } from "@thi.ng/shader-ast/ast/ops";
@@ -9,7 +10,7 @@ import { $x, $y } from "@thi.ng/shader-ast/ast/swizzle";
9
10
  * @param i -
10
11
  * @param size -
11
12
  */
12
- export const indexToUV = defn("vec2", "indexToUV", [["int", "i", { prec: "highp" }], ["ivec2"]], (i, size) => [
13
+ export const indexToUV = defn(V2, "indexToUV", [[I, "i", { prec: "highp" }], ["ivec2"]], (i, size) => [
13
14
  ret(vec2(div(float(modi(i, $x(size))), float($x(size))), div(float(div(i, $x(size))), float($y(size))))),
14
15
  ]);
15
16
  /**
@@ -19,6 +20,6 @@ export const indexToUV = defn("vec2", "indexToUV", [["int", "i", { prec: "highp"
19
20
  * @param i -
20
21
  * @param width -
21
22
  */
22
- export const uvToIndex = defn("int", "uvToIndex", ["vec2", ["int", "width", { prec: "highp" }]], (uv, width) => [
23
+ export const uvToIndex = defn(I, "uvToIndex", [V2, [I, "width", { prec: "highp" }]], (uv, width) => [
23
24
  ret(add(int(mul($x(uv), float(width))), int(mul($y(uv), float(mul(width, width)))))),
24
25
  ]);