typegpu 0.10.0 → 0.10.2

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 (263) hide show
  1. package/{chunk-BYypO7fO.js → _virtual/_rolldown/runtime.js} +1 -1
  2. package/builtin.d.ts +50 -0
  3. package/builtin.js +37 -0
  4. package/common/fullScreenTriangle.d.ts +26 -0
  5. package/common/fullScreenTriangle.js +36 -0
  6. package/common/index.d.ts +2 -3
  7. package/common/index.js +3 -4
  8. package/core/buffer/buffer.d.ts +74 -0
  9. package/core/buffer/buffer.js +197 -0
  10. package/core/buffer/bufferShorthand.d.ts +48 -0
  11. package/core/buffer/bufferShorthand.js +49 -0
  12. package/core/buffer/bufferUsage.d.ts +45 -0
  13. package/core/buffer/bufferUsage.js +163 -0
  14. package/core/constant/tgpuConstant.d.ts +28 -0
  15. package/core/constant/tgpuConstant.js +67 -0
  16. package/core/declare/tgpuDeclare.d.ts +18 -0
  17. package/core/declare/tgpuDeclare.js +40 -0
  18. package/core/function/autoIO.d.ts +37 -0
  19. package/core/function/autoIO.js +87 -0
  20. package/core/function/comptime.d.ts +39 -0
  21. package/core/function/comptime.js +51 -0
  22. package/core/function/createCallableSchema.js +42 -0
  23. package/core/function/dualImpl.js +54 -0
  24. package/core/function/extractArgs.js +204 -0
  25. package/core/function/fnCore.js +79 -0
  26. package/core/function/fnTypes.d.ts +34 -0
  27. package/core/function/ioSchema.d.ts +10 -0
  28. package/core/function/ioSchema.js +30 -0
  29. package/core/function/shelllessImpl.d.ts +28 -0
  30. package/core/function/shelllessImpl.js +23 -0
  31. package/core/function/templateUtils.js +13 -0
  32. package/core/function/tgpuComputeFn.d.ts +49 -0
  33. package/core/function/tgpuComputeFn.js +62 -0
  34. package/core/function/tgpuFn.d.ts +52 -0
  35. package/core/function/tgpuFn.js +170 -0
  36. package/core/function/tgpuFragmentFn.d.ts +68 -0
  37. package/core/function/tgpuFragmentFn.js +68 -0
  38. package/core/function/tgpuVertexFn.d.ts +55 -0
  39. package/core/function/tgpuVertexFn.js +65 -0
  40. package/core/pipeline/applyPipelineState.js +37 -0
  41. package/core/pipeline/computePipeline.d.ts +58 -0
  42. package/core/pipeline/computePipeline.js +226 -0
  43. package/core/pipeline/connectAttachmentToShader.js +26 -0
  44. package/core/pipeline/connectTargetsToShader.js +29 -0
  45. package/core/pipeline/limitsOverflow.js +13 -0
  46. package/core/pipeline/renderPipeline.d.ts +266 -0
  47. package/core/pipeline/renderPipeline.js +471 -0
  48. package/core/pipeline/timeable.d.ts +23 -0
  49. package/core/pipeline/timeable.js +61 -0
  50. package/core/pipeline/typeGuards.js +29 -0
  51. package/core/querySet/querySet.d.ts +22 -0
  52. package/core/querySet/querySet.js +103 -0
  53. package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
  54. package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +96 -0
  55. package/core/resolve/externals.d.ts +10 -0
  56. package/core/resolve/externals.js +58 -0
  57. package/core/resolve/namespace.d.ts +38 -0
  58. package/core/resolve/namespace.js +41 -0
  59. package/core/resolve/resolveData.js +146 -0
  60. package/core/resolve/stitch.js +25 -0
  61. package/core/resolve/tgpuResolve.d.ts +151 -0
  62. package/core/resolve/tgpuResolve.js +68 -0
  63. package/core/root/configurableImpl.js +18 -0
  64. package/core/root/init.d.ts +69 -0
  65. package/core/root/init.js +457 -0
  66. package/core/root/rootTypes.d.ts +622 -0
  67. package/core/sampler/sampler.d.ts +35 -0
  68. package/core/sampler/sampler.js +116 -0
  69. package/core/simulate/tgpuSimulate.d.ts +36 -0
  70. package/core/simulate/tgpuSimulate.js +76 -0
  71. package/core/slot/accessor.d.ts +13 -0
  72. package/core/slot/accessor.js +97 -0
  73. package/core/slot/internalSlots.js +7 -0
  74. package/core/slot/lazy.d.ts +6 -0
  75. package/core/slot/lazy.js +42 -0
  76. package/core/slot/slot.d.ts +6 -0
  77. package/core/slot/slot.js +40 -0
  78. package/core/slot/slotTypes.d.ts +92 -0
  79. package/core/slot/slotTypes.js +21 -0
  80. package/core/texture/externalTexture.d.ts +12 -0
  81. package/core/texture/externalTexture.js +48 -0
  82. package/core/texture/texture.d.ts +118 -0
  83. package/core/texture/texture.js +312 -0
  84. package/core/texture/textureFormats.d.ts +29 -0
  85. package/core/texture/textureFormats.js +99 -0
  86. package/core/texture/textureProps.d.ts +11 -0
  87. package/core/texture/textureUtils.js +224 -0
  88. package/core/texture/usageExtension.d.ts +21 -0
  89. package/core/texture/usageExtension.js +21 -0
  90. package/core/unroll/tgpuUnroll.d.ts +13 -0
  91. package/core/unroll/tgpuUnroll.js +36 -0
  92. package/core/valueProxyUtils.js +44 -0
  93. package/core/variable/tgpuVariable.d.ts +38 -0
  94. package/core/variable/tgpuVariable.js +101 -0
  95. package/core/vertexLayout/connectAttributesToShader.js +59 -0
  96. package/core/vertexLayout/vertexAttribute.d.ts +29 -0
  97. package/core/vertexLayout/vertexLayout.d.ts +19 -0
  98. package/core/vertexLayout/vertexLayout.js +103 -0
  99. package/data/alignIO.js +15 -0
  100. package/data/alignmentOf.d.ts +10 -0
  101. package/data/alignmentOf.js +88 -0
  102. package/data/array.d.ts +28 -0
  103. package/data/array.js +48 -0
  104. package/data/atomic.d.ts +15 -0
  105. package/data/atomic.js +25 -0
  106. package/data/attributes.d.ts +121 -0
  107. package/data/attributes.js +145 -0
  108. package/data/autoStruct.d.ts +3 -0
  109. package/data/autoStruct.js +83 -0
  110. package/data/compiledIO.js +231 -0
  111. package/data/dataIO.js +549 -0
  112. package/data/dataTypes.d.ts +115 -0
  113. package/data/dataTypes.js +97 -0
  114. package/data/deepEqual.d.ts +25 -0
  115. package/data/deepEqual.js +58 -0
  116. package/data/disarray.d.ts +34 -0
  117. package/data/disarray.js +52 -0
  118. package/data/getLongestContiguousPrefix.d.ts +10 -0
  119. package/data/getLongestContiguousPrefix.js +15 -0
  120. package/data/index.d.ts +26 -4
  121. package/data/index.js +27 -7
  122. package/data/instanceToSchema.d.ts +33 -0
  123. package/data/isContiguous.d.ts +10 -0
  124. package/data/isContiguous.js +15 -0
  125. package/data/matrix.d.ts +126 -0
  126. package/data/matrix.js +517 -0
  127. package/data/numberOps.js +24 -0
  128. package/data/numeric.d.ts +81 -0
  129. package/data/numeric.js +234 -0
  130. package/data/offsetUtils.d.ts +33 -0
  131. package/data/offsetUtils.js +167 -0
  132. package/data/offsets.js +36 -0
  133. package/data/partialIO.js +68 -0
  134. package/data/ptr.d.ts +12 -0
  135. package/data/ptr.js +46 -0
  136. package/data/ref.d.ts +37 -0
  137. package/data/ref.js +96 -0
  138. package/data/sampler.d.ts +107 -0
  139. package/data/sampler.js +26 -0
  140. package/data/schemaCallWrapper.js +32 -0
  141. package/data/schemaMemoryLayout.js +200 -0
  142. package/data/sizeOf.d.ts +10 -0
  143. package/data/sizeOf.js +15 -0
  144. package/data/snippet.d.ts +26 -0
  145. package/data/snippet.js +61 -0
  146. package/data/struct.d.ts +17 -0
  147. package/data/struct.js +46 -0
  148. package/data/texture.d.ts +292 -0
  149. package/{texture-Dg5ybJro.js → data/texture.js} +6 -3
  150. package/data/unstruct.d.ts +24 -0
  151. package/data/unstruct.js +43 -0
  152. package/data/vector.d.ts +191 -0
  153. package/data/vector.js +247 -0
  154. package/data/vectorImpl.js +516 -0
  155. package/data/vectorOps.js +664 -0
  156. package/data/vertexFormatData.d.ts +190 -0
  157. package/data/vertexFormatData.js +110 -0
  158. package/data/wgslTypes.d.ts +896 -0
  159. package/data/wgslTypes.js +215 -0
  160. package/errors.d.ts +44 -0
  161. package/errors.js +128 -0
  162. package/execMode.js +51 -0
  163. package/extension.d.ts +11 -0
  164. package/extension.js +18 -0
  165. package/getGPUValue.js +9 -0
  166. package/index.d.ts +40 -243
  167. package/index.js +19 -6318
  168. package/indexNamedExports.d.ts +38 -0
  169. package/mathUtils.js +13 -0
  170. package/memo.js +22 -0
  171. package/nameRegistry.d.ts +30 -0
  172. package/nameRegistry.js +449 -0
  173. package/package.js +5 -0
  174. package/package.json +23 -23
  175. package/resolutionCtx.d.ts +29 -0
  176. package/resolutionCtx.js +546 -0
  177. package/shared/env.js +13 -0
  178. package/shared/generators.js +14 -0
  179. package/shared/meta.d.ts +39 -0
  180. package/shared/meta.js +63 -0
  181. package/shared/repr.d.ts +108 -0
  182. package/shared/stringify.js +22 -0
  183. package/shared/symbols.d.ts +61 -0
  184. package/shared/symbols.js +71 -0
  185. package/shared/utilityTypes.d.ts +29 -0
  186. package/shared/utilityTypes.js +7 -0
  187. package/shared/vertexFormat.d.ts +70 -0
  188. package/shared/vertexFormat.js +64 -0
  189. package/std/array.d.ts +7 -0
  190. package/std/array.js +27 -0
  191. package/std/atomic.d.ts +19 -0
  192. package/std/atomic.js +113 -0
  193. package/std/bitcast.d.ts +10 -0
  194. package/std/bitcast.js +43 -0
  195. package/std/boolean.d.ts +127 -0
  196. package/std/boolean.js +274 -0
  197. package/std/derivative.d.ts +16 -0
  198. package/std/derivative.js +89 -0
  199. package/std/discard.d.ts +6 -0
  200. package/std/discard.js +16 -0
  201. package/std/extensions.d.ts +8 -0
  202. package/std/extensions.js +14 -0
  203. package/std/index.d.ts +15 -3
  204. package/std/index.js +16 -5
  205. package/std/matrix.d.ts +41 -0
  206. package/std/matrix.js +87 -0
  207. package/std/numeric.d.ts +254 -0
  208. package/std/numeric.js +847 -0
  209. package/std/operators.d.ts +48 -0
  210. package/std/operators.js +153 -0
  211. package/std/packing.d.ts +26 -0
  212. package/std/packing.js +86 -0
  213. package/std/subgroup.d.ts +47 -0
  214. package/std/subgroup.js +220 -0
  215. package/std/texture.d.ts +108 -0
  216. package/std/texture.js +197 -0
  217. package/tgpu.js +44 -0
  218. package/tgpuBindGroupLayout.d.ts +161 -0
  219. package/tgpuBindGroupLayout.js +271 -0
  220. package/tgpuUnstable.d.ts +48 -0
  221. package/tgpuUnstable.js +66 -0
  222. package/tgsl/accessIndex.js +45 -0
  223. package/tgsl/accessProp.js +113 -0
  224. package/tgsl/consoleLog/deserializers.js +117 -0
  225. package/tgsl/consoleLog/logGenerator.js +86 -0
  226. package/tgsl/consoleLog/serializers.js +225 -0
  227. package/tgsl/consoleLog/types.d.ts +54 -0
  228. package/tgsl/consoleLog/types.js +12 -0
  229. package/tgsl/conversion.js +200 -0
  230. package/tgsl/forOfUtils.js +45 -0
  231. package/tgsl/generationHelpers.d.ts +37 -0
  232. package/tgsl/generationHelpers.js +67 -0
  233. package/tgsl/math.js +45 -0
  234. package/tgsl/shaderGenerator.d.ts +18 -0
  235. package/tgsl/shellless.d.ts +11 -0
  236. package/tgsl/shellless.js +53 -0
  237. package/tgsl/wgslGenerator.js +585 -0
  238. package/types.d.ts +255 -0
  239. package/types.js +43 -0
  240. package/unwrapper.d.ts +27 -0
  241. package/wgslExtensions.d.ts +5 -0
  242. package/wgslExtensions.js +18 -0
  243. package/builtin-ClEnM-Ye.js +0 -818
  244. package/builtin-ClEnM-Ye.js.map +0 -1
  245. package/common/index.d.ts.map +0 -1
  246. package/common/index.js.map +0 -1
  247. package/data/index.d.ts.map +0 -1
  248. package/data/index.js.map +0 -1
  249. package/deepEqual-yZXvaV2C.js +0 -413
  250. package/deepEqual-yZXvaV2C.js.map +0 -1
  251. package/extensions-0SFbU9FH.js +0 -2032
  252. package/extensions-0SFbU9FH.js.map +0 -1
  253. package/fullScreenTriangle-MdLGaAMR.js +0 -543
  254. package/fullScreenTriangle-MdLGaAMR.js.map +0 -1
  255. package/index.d.ts.map +0 -1
  256. package/index.js.map +0 -1
  257. package/indexNamedExports-Cdy7USiY.d.ts +0 -5696
  258. package/indexNamedExports-Cdy7USiY.d.ts.map +0 -1
  259. package/operators-HTxa_0k9.js +0 -4156
  260. package/operators-HTxa_0k9.js.map +0 -1
  261. package/std/index.d.ts.map +0 -1
  262. package/std/index.js.map +0 -1
  263. package/texture-Dg5ybJro.js.map +0 -1
@@ -0,0 +1,664 @@
1
+ import { vec2b as vec2b$1, vec2f as vec2f$1, vec2h as vec2h$1, vec2i as vec2i$1, vec2u as vec2u$1, vec3b as vec3b$1, vec3f as vec3f$1, vec3h as vec3h$1, vec3i as vec3i$1, vec3u as vec3u$1, vec4b as vec4b$1, vec4f as vec4f$1, vec4h as vec4h$1, vec4i as vec4i$1, vec4u as vec4u$1 } from "./vector.js";
2
+ import { mat2x2f, mat3x3f, mat4x4f } from "./matrix.js";
3
+ import { bitcastU32toF32Impl, bitcastU32toI32Impl, clamp, divInteger, smoothstepScalar } from "./numberOps.js";
4
+
5
+ //#region src/data/vectorOps.ts
6
+ const vec2b = vec2b$1;
7
+ const vec2f = vec2f$1;
8
+ const vec2h = vec2h$1;
9
+ const vec2i = vec2i$1;
10
+ const vec2u = vec2u$1;
11
+ const vec3b = vec3b$1;
12
+ const vec3f = vec3f$1;
13
+ const vec3h = vec3h$1;
14
+ const vec3i = vec3i$1;
15
+ const vec3u = vec3u$1;
16
+ const vec4b = vec4b$1;
17
+ const vec4f = vec4f$1;
18
+ const vec4h = vec4h$1;
19
+ const vec4i = vec4i$1;
20
+ const vec4u = vec4u$1;
21
+ const lengthVec2 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2);
22
+ const lengthVec3 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);
23
+ const lengthVec4 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2 + v.w ** 2);
24
+ const dotVec2 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y;
25
+ const dotVec3 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;
26
+ const dotVec4 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z + lhs.w * rhs.w;
27
+ const unary2f = (op) => (a) => vec2f(op(a.x), op(a.y));
28
+ const unary2h = (op) => (a) => vec2h(op(a.x), op(a.y));
29
+ const unary2i = (op) => (a) => vec2i(op(a.x), op(a.y));
30
+ const unary2u = (op) => (a) => vec2u(op(a.x), op(a.y));
31
+ const unary3f = (op) => (a) => vec3f(op(a.x), op(a.y), op(a.z));
32
+ const unary3h = (op) => (a) => vec3h(op(a.x), op(a.y), op(a.z));
33
+ const unary3i = (op) => (a) => vec3i(op(a.x), op(a.y), op(a.z));
34
+ const unary3u = (op) => (a) => vec3u(op(a.x), op(a.y), op(a.z));
35
+ const unary4f = (op) => (a) => vec4f(op(a.x), op(a.y), op(a.z), op(a.w));
36
+ const unary4h = (op) => (a) => vec4h(op(a.x), op(a.y), op(a.z), op(a.w));
37
+ const unary4i = (op) => (a) => vec4i(op(a.x), op(a.y), op(a.z), op(a.w));
38
+ const unary4u = (op) => (a) => vec4u(op(a.x), op(a.y), op(a.z), op(a.w));
39
+ const unary2x2f = (op) => (a) => {
40
+ const a_ = a.columns;
41
+ return mat2x2f(unary2f(op)(a_[0]), unary2f(op)(a_[1]));
42
+ };
43
+ const unary3x3f = (op) => (a) => {
44
+ const a_ = a.columns;
45
+ return mat3x3f(unary3f(op)(a_[0]), unary3f(op)(a_[1]), unary3f(op)(a_[2]));
46
+ };
47
+ const unary4x4f = (op) => (a) => {
48
+ const a_ = a.columns;
49
+ return mat4x4f(unary4f(op)(a_[0]), unary4f(op)(a_[1]), unary4f(op)(a_[2]), unary4f(op)(a_[3]));
50
+ };
51
+ const binaryComponentWise2f = (op) => (a, b) => vec2f(op(a.x, b.x), op(a.y, b.y));
52
+ const binaryComponentWise2h = (op) => (a, b) => vec2h(op(a.x, b.x), op(a.y, b.y));
53
+ const binaryComponentWise2i = (op) => (a, b) => vec2i(op(a.x, b.x), op(a.y, b.y));
54
+ const binaryComponentWise2u = (op) => (a, b) => vec2u(op(a.x, b.x), op(a.y, b.y));
55
+ const binaryComponentWise3f = (op) => (a, b) => vec3f(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));
56
+ const binaryComponentWise3h = (op) => (a, b) => vec3h(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));
57
+ const binaryComponentWise3i = (op) => (a, b) => vec3i(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));
58
+ const binaryComponentWise3u = (op) => (a, b) => vec3u(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));
59
+ const binaryComponentWise4f = (op) => (a, b) => vec4f(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));
60
+ const binaryComponentWise4h = (op) => (a, b) => vec4h(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));
61
+ const binaryComponentWise4i = (op) => (a, b) => vec4i(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));
62
+ const binaryComponentWise4u = (op) => (a, b) => vec4u(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));
63
+ const binaryComponentWise2x2f = (op) => (a, b) => {
64
+ const a_ = a.columns;
65
+ const b_ = b.columns;
66
+ return mat2x2f(binaryComponentWise2f(op)(a_[0], b_[0]), binaryComponentWise2f(op)(a_[1], b_[1]));
67
+ };
68
+ const binaryComponentWise3x3f = (op) => (a, b) => {
69
+ const a_ = a.columns;
70
+ const b_ = b.columns;
71
+ return mat3x3f(binaryComponentWise3f(op)(a_[0], b_[0]), binaryComponentWise3f(op)(a_[1], b_[1]), binaryComponentWise3f(op)(a_[2], b_[2]));
72
+ };
73
+ const binaryComponentWise4x4f = (op) => (a, b) => {
74
+ const a_ = a.columns;
75
+ const b_ = b.columns;
76
+ return mat4x4f(binaryComponentWise4f(op)(a_[0], b_[0]), binaryComponentWise4f(op)(a_[1], b_[1]), binaryComponentWise4f(op)(a_[2], b_[2]), binaryComponentWise4f(op)(a_[3], b_[3]));
77
+ };
78
+ const ternaryComponentWise2f = (op) => (a, b, c) => vec2f(op(a.x, b.x, c.x), op(a.y, b.y, c.y));
79
+ const ternaryComponentWise2h = (op) => (a, b, c) => vec2h(op(a.x, b.x, c.x), op(a.y, b.y, c.y));
80
+ const ternaryComponentWise3f = (op) => (a, b, c) => vec3f(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z));
81
+ const ternaryComponentWise3h = (op) => (a, b, c) => vec3h(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z));
82
+ const ternaryComponentWise4f = (op) => (a, b, c) => vec4f(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z), op(a.w, b.w, c.w));
83
+ const ternaryComponentWise4h = (op) => (a, b, c) => vec4h(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z), op(a.w, b.w, c.w));
84
+ const VectorOps = {
85
+ eq: {
86
+ vec2f: (e1, e2) => vec2b(e1.x === e2.x, e1.y === e2.y),
87
+ vec2h: (e1, e2) => vec2b(e1.x === e2.x, e1.y === e2.y),
88
+ vec2i: (e1, e2) => vec2b(e1.x === e2.x, e1.y === e2.y),
89
+ vec2u: (e1, e2) => vec2b(e1.x === e2.x, e1.y === e2.y),
90
+ "vec2<bool>": (e1, e2) => vec2b(e1.x === e2.x, e1.y === e2.y),
91
+ vec3f: (e1, e2) => vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),
92
+ vec3h: (e1, e2) => vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),
93
+ vec3i: (e1, e2) => vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),
94
+ vec3u: (e1, e2) => vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),
95
+ "vec3<bool>": (e1, e2) => vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),
96
+ vec4f: (e1, e2) => vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),
97
+ vec4h: (e1, e2) => vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),
98
+ vec4i: (e1, e2) => vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),
99
+ vec4u: (e1, e2) => vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),
100
+ "vec4<bool>": (e1, e2) => vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w)
101
+ },
102
+ lt: {
103
+ vec2f: (e1, e2) => vec2b(e1.x < e2.x, e1.y < e2.y),
104
+ vec2h: (e1, e2) => vec2b(e1.x < e2.x, e1.y < e2.y),
105
+ vec2i: (e1, e2) => vec2b(e1.x < e2.x, e1.y < e2.y),
106
+ vec2u: (e1, e2) => vec2b(e1.x < e2.x, e1.y < e2.y),
107
+ vec3f: (e1, e2) => vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),
108
+ vec3h: (e1, e2) => vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),
109
+ vec3i: (e1, e2) => vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),
110
+ vec3u: (e1, e2) => vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),
111
+ vec4f: (e1, e2) => vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),
112
+ vec4h: (e1, e2) => vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),
113
+ vec4i: (e1, e2) => vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),
114
+ vec4u: (e1, e2) => vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w)
115
+ },
116
+ or: {
117
+ "vec2<bool>": (e1, e2) => vec2b(e1.x || e2.x, e1.y || e2.y),
118
+ "vec3<bool>": (e1, e2) => vec3b(e1.x || e2.x, e1.y || e2.y, e1.z || e2.z),
119
+ "vec4<bool>": (e1, e2) => vec4b(e1.x || e2.x, e1.y || e2.y, e1.z || e2.z, e1.w || e2.w)
120
+ },
121
+ all: {
122
+ "vec2<bool>": (e) => e.x && e.y,
123
+ "vec3<bool>": (e) => e.x && e.y && e.z,
124
+ "vec4<bool>": (e) => e.x && e.y && e.z && e.w
125
+ },
126
+ abs: {
127
+ vec2f: unary2f(Math.abs),
128
+ vec2h: unary2h(Math.abs),
129
+ vec2i: unary2i(Math.abs),
130
+ vec2u: unary2u(Math.abs),
131
+ vec3f: unary3f(Math.abs),
132
+ vec3h: unary3h(Math.abs),
133
+ vec3i: unary3i(Math.abs),
134
+ vec3u: unary3u(Math.abs),
135
+ vec4f: unary4f(Math.abs),
136
+ vec4h: unary4h(Math.abs),
137
+ vec4i: unary4i(Math.abs),
138
+ vec4u: unary4u(Math.abs)
139
+ },
140
+ atan2: {
141
+ vec2f: binaryComponentWise2f(Math.atan2),
142
+ vec2h: binaryComponentWise2h(Math.atan2),
143
+ vec3f: binaryComponentWise3f(Math.atan2),
144
+ vec3h: binaryComponentWise3h(Math.atan2),
145
+ vec4f: binaryComponentWise4f(Math.atan2),
146
+ vec4h: binaryComponentWise4h(Math.atan2)
147
+ },
148
+ acos: {
149
+ vec2f: unary2f(Math.acos),
150
+ vec2h: unary2h(Math.acos),
151
+ vec2i: unary2i(Math.acos),
152
+ vec2u: unary2u(Math.acos),
153
+ vec3f: unary3f(Math.acos),
154
+ vec3h: unary3h(Math.acos),
155
+ vec3i: unary3i(Math.acos),
156
+ vec3u: unary3u(Math.acos),
157
+ vec4f: unary4f(Math.acos),
158
+ vec4h: unary4h(Math.acos),
159
+ vec4i: unary4i(Math.acos),
160
+ vec4u: unary4u(Math.acos)
161
+ },
162
+ acosh: {
163
+ vec2f: unary2f(Math.acosh),
164
+ vec2h: unary2h(Math.acosh),
165
+ vec3f: unary3f(Math.acosh),
166
+ vec3h: unary3h(Math.acosh),
167
+ vec4f: unary4f(Math.acosh),
168
+ vec4h: unary4h(Math.acosh)
169
+ },
170
+ asin: {
171
+ vec2f: unary2f(Math.asin),
172
+ vec2h: unary2h(Math.asin),
173
+ vec3f: unary3f(Math.asin),
174
+ vec3h: unary3h(Math.asin),
175
+ vec4f: unary4f(Math.asin),
176
+ vec4h: unary4h(Math.asin)
177
+ },
178
+ asinh: {
179
+ vec2f: unary2f(Math.asinh),
180
+ vec2h: unary2h(Math.asinh),
181
+ vec3f: unary3f(Math.asinh),
182
+ vec3h: unary3h(Math.asinh),
183
+ vec4f: unary4f(Math.asinh),
184
+ vec4h: unary4h(Math.asinh)
185
+ },
186
+ atan: {
187
+ vec2f: unary2f(Math.atan),
188
+ vec2h: unary2h(Math.atan),
189
+ vec3f: unary3f(Math.atan),
190
+ vec3h: unary3h(Math.atan),
191
+ vec4f: unary4f(Math.atan),
192
+ vec4h: unary4h(Math.atan)
193
+ },
194
+ atanh: {
195
+ vec2f: unary2f(Math.atanh),
196
+ vec2h: unary2h(Math.atanh),
197
+ vec3f: unary3f(Math.atanh),
198
+ vec3h: unary3h(Math.atanh),
199
+ vec4f: unary4f(Math.atanh),
200
+ vec4h: unary4h(Math.atanh)
201
+ },
202
+ ceil: {
203
+ vec2f: unary2f(Math.ceil),
204
+ vec2h: unary2h(Math.ceil),
205
+ vec3f: unary3f(Math.ceil),
206
+ vec3h: unary3h(Math.ceil),
207
+ vec4f: unary4f(Math.ceil),
208
+ vec4h: unary4h(Math.ceil)
209
+ },
210
+ clamp: {
211
+ vec2f: (v, low, high) => vec2f(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
212
+ vec2h: (v, low, high) => vec2h(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
213
+ vec2i: (v, low, high) => vec2i(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
214
+ vec2u: (v, low, high) => vec2u(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
215
+ vec3f: (v, low, high) => vec3f(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z)),
216
+ vec3h: (v, low, high) => vec3h(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z)),
217
+ vec3i: (v, low, high) => vec3i(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z)),
218
+ vec3u: (v, low, high) => vec3u(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z)),
219
+ vec4f: (v, low, high) => vec4f(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z), clamp(v.w, low.w, high.w)),
220
+ vec4h: (v, low, high) => vec4h(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z), clamp(v.w, low.w, high.w)),
221
+ vec4i: (v, low, high) => vec4i(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z), clamp(v.w, low.w, high.w)),
222
+ vec4u: (v, low, high) => vec4u(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y), clamp(v.z, low.z, high.z), clamp(v.w, low.w, high.w))
223
+ },
224
+ length: {
225
+ vec2f: lengthVec2,
226
+ vec2h: lengthVec2,
227
+ vec3f: lengthVec3,
228
+ vec3h: lengthVec3,
229
+ vec4f: lengthVec4,
230
+ vec4h: lengthVec4
231
+ },
232
+ add: {
233
+ vec2f: binaryComponentWise2f((a, b) => a + b),
234
+ vec2h: binaryComponentWise2h((a, b) => a + b),
235
+ vec2i: binaryComponentWise2i((a, b) => a + b),
236
+ vec2u: binaryComponentWise2u((a, b) => a + b),
237
+ vec3f: binaryComponentWise3f((a, b) => a + b),
238
+ vec3h: binaryComponentWise3h((a, b) => a + b),
239
+ vec3i: binaryComponentWise3i((a, b) => a + b),
240
+ vec3u: binaryComponentWise3u((a, b) => a + b),
241
+ vec4f: binaryComponentWise4f((a, b) => a + b),
242
+ vec4h: binaryComponentWise4h((a, b) => a + b),
243
+ vec4i: binaryComponentWise4i((a, b) => a + b),
244
+ vec4u: binaryComponentWise4u((a, b) => a + b),
245
+ mat2x2f: binaryComponentWise2x2f((a, b) => a + b),
246
+ mat3x3f: binaryComponentWise3x3f((a, b) => a + b),
247
+ mat4x4f: binaryComponentWise4x4f((a, b) => a + b)
248
+ },
249
+ smoothstep: {
250
+ vec2f: ternaryComponentWise2f(smoothstepScalar),
251
+ vec2h: ternaryComponentWise2h(smoothstepScalar),
252
+ vec3f: ternaryComponentWise3f(smoothstepScalar),
253
+ vec3h: ternaryComponentWise3h(smoothstepScalar),
254
+ vec4f: ternaryComponentWise4f(smoothstepScalar),
255
+ vec4h: ternaryComponentWise4h(smoothstepScalar)
256
+ },
257
+ addMixed: {
258
+ vec2f: (a, b) => unary2f((e) => e + b)(a),
259
+ vec2h: (a, b) => unary2h((e) => e + b)(a),
260
+ vec2i: (a, b) => unary2i((e) => e + b)(a),
261
+ vec2u: (a, b) => unary2u((e) => e + b)(a),
262
+ vec3f: (a, b) => unary3f((e) => e + b)(a),
263
+ vec3h: (a, b) => unary3h((e) => e + b)(a),
264
+ vec3i: (a, b) => unary3i((e) => e + b)(a),
265
+ vec3u: (a, b) => unary3u((e) => e + b)(a),
266
+ vec4f: (a, b) => unary4f((e) => e + b)(a),
267
+ vec4h: (a, b) => unary4h((e) => e + b)(a),
268
+ vec4i: (a, b) => unary4i((e) => e + b)(a),
269
+ vec4u: (a, b) => unary4u((e) => e + b)(a),
270
+ mat2x2f: (a, b) => unary2x2f((e) => e + b)(a),
271
+ mat3x3f: (a, b) => unary3x3f((e) => e + b)(a),
272
+ mat4x4f: (a, b) => unary4x4f((e) => e + b)(a)
273
+ },
274
+ mulSxV: {
275
+ vec2f: (s, v) => unary2f((e) => s * e)(v),
276
+ vec2h: (s, v) => unary2h((e) => s * e)(v),
277
+ vec2i: (s, v) => unary2i((e) => s * e)(v),
278
+ vec2u: (s, v) => unary2u((e) => s * e)(v),
279
+ vec3f: (s, v) => unary3f((e) => s * e)(v),
280
+ vec3h: (s, v) => unary3h((e) => s * e)(v),
281
+ vec3i: (s, v) => unary3i((e) => s * e)(v),
282
+ vec3u: (s, v) => unary3u((e) => s * e)(v),
283
+ vec4f: (s, v) => unary4f((e) => s * e)(v),
284
+ vec4h: (s, v) => unary4h((e) => s * e)(v),
285
+ vec4i: (s, v) => unary4i((e) => s * e)(v),
286
+ vec4u: (s, v) => unary4u((e) => s * e)(v),
287
+ mat2x2f: (s, m) => unary2x2f((e) => s * e)(m),
288
+ mat3x3f: (s, m) => unary3x3f((e) => s * e)(m),
289
+ mat4x4f: (s, m) => unary4x4f((e) => s * e)(m)
290
+ },
291
+ mulVxV: {
292
+ vec2f: binaryComponentWise2f((a, b) => a * b),
293
+ vec2h: binaryComponentWise2h((a, b) => a * b),
294
+ vec2i: binaryComponentWise2i((a, b) => a * b),
295
+ vec2u: binaryComponentWise2u((a, b) => a * b),
296
+ vec3f: binaryComponentWise3f((a, b) => a * b),
297
+ vec3h: binaryComponentWise3h((a, b) => a * b),
298
+ vec3i: binaryComponentWise3i((a, b) => a * b),
299
+ vec3u: binaryComponentWise3u((a, b) => a * b),
300
+ vec4f: binaryComponentWise4f((a, b) => a * b),
301
+ vec4h: binaryComponentWise4h((a, b) => a * b),
302
+ vec4i: binaryComponentWise4i((a, b) => a * b),
303
+ vec4u: binaryComponentWise4u((a, b) => a * b),
304
+ mat2x2f: (a, b) => {
305
+ const a_ = a.columns;
306
+ const b_ = b.columns;
307
+ return mat2x2f(a_[0].x * b_[0].x + a_[1].x * b_[0].y, a_[0].y * b_[0].x + a_[1].y * b_[0].y, a_[0].x * b_[1].x + a_[1].x * b_[1].y, a_[0].y * b_[1].x + a_[1].y * b_[1].y);
308
+ },
309
+ mat3x3f: (a, b) => {
310
+ const a_ = a.columns;
311
+ const b_ = b.columns;
312
+ return mat3x3f(a_[0].x * b_[0].x + a_[1].x * b_[0].y + a_[2].x * b_[0].z, a_[0].y * b_[0].x + a_[1].y * b_[0].y + a_[2].y * b_[0].z, a_[0].z * b_[0].x + a_[1].z * b_[0].y + a_[2].z * b_[0].z, a_[0].x * b_[1].x + a_[1].x * b_[1].y + a_[2].x * b_[1].z, a_[0].y * b_[1].x + a_[1].y * b_[1].y + a_[2].y * b_[1].z, a_[0].z * b_[1].x + a_[1].z * b_[1].y + a_[2].z * b_[1].z, a_[0].x * b_[2].x + a_[1].x * b_[2].y + a_[2].x * b_[2].z, a_[0].y * b_[2].x + a_[1].y * b_[2].y + a_[2].y * b_[2].z, a_[0].z * b_[2].x + a_[1].z * b_[2].y + a_[2].z * b_[2].z);
313
+ },
314
+ mat4x4f: (a, b) => {
315
+ const a_ = a.columns;
316
+ const b_ = b.columns;
317
+ return mat4x4f(a_[0].x * b_[0].x + a_[1].x * b_[0].y + a_[2].x * b_[0].z + a_[3].x * b_[0].w, a_[0].y * b_[0].x + a_[1].y * b_[0].y + a_[2].y * b_[0].z + a_[3].y * b_[0].w, a_[0].z * b_[0].x + a_[1].z * b_[0].y + a_[2].z * b_[0].z + a_[3].z * b_[0].w, a_[0].w * b_[0].x + a_[1].w * b_[0].y + a_[2].w * b_[0].z + a_[3].w * b_[0].w, a_[0].x * b_[1].x + a_[1].x * b_[1].y + a_[2].x * b_[1].z + a_[3].x * b_[1].w, a_[0].y * b_[1].x + a_[1].y * b_[1].y + a_[2].y * b_[1].z + a_[3].y * b_[1].w, a_[0].z * b_[1].x + a_[1].z * b_[1].y + a_[2].z * b_[1].z + a_[3].z * b_[1].w, a_[0].w * b_[1].x + a_[1].w * b_[1].y + a_[2].w * b_[1].z + a_[3].w * b_[1].w, a_[0].x * b_[2].x + a_[1].x * b_[2].y + a_[2].x * b_[2].z + a_[3].x * b_[2].w, a_[0].y * b_[2].x + a_[1].y * b_[2].y + a_[2].y * b_[2].z + a_[3].y * b_[2].w, a_[0].z * b_[2].x + a_[1].z * b_[2].y + a_[2].z * b_[2].z + a_[3].z * b_[2].w, a_[0].w * b_[2].x + a_[1].w * b_[2].y + a_[2].w * b_[2].z + a_[3].w * b_[2].w, a_[0].x * b_[3].x + a_[1].x * b_[3].y + a_[2].x * b_[3].z + a_[3].x * b_[3].w, a_[0].y * b_[3].x + a_[1].y * b_[3].y + a_[2].y * b_[3].z + a_[3].y * b_[3].w, a_[0].z * b_[3].x + a_[1].z * b_[3].y + a_[2].z * b_[3].z + a_[3].z * b_[3].w, a_[0].w * b_[3].x + a_[1].w * b_[3].y + a_[2].w * b_[3].z + a_[3].w * b_[3].w);
318
+ }
319
+ },
320
+ mulMxV: {
321
+ mat2x2f: (m, v) => {
322
+ const m_ = m.columns;
323
+ return vec2f(m_[0].x * v.x + m_[1].x * v.y, m_[0].y * v.x + m_[1].y * v.y);
324
+ },
325
+ mat3x3f: (m, v) => {
326
+ const m_ = m.columns;
327
+ return vec3f(m_[0].x * v.x + m_[1].x * v.y + m_[2].x * v.z, m_[0].y * v.x + m_[1].y * v.y + m_[2].y * v.z, m_[0].z * v.x + m_[1].z * v.y + m_[2].z * v.z);
328
+ },
329
+ mat4x4f: (m, v) => {
330
+ const m_ = m.columns;
331
+ return vec4f(m_[0].x * v.x + m_[1].x * v.y + m_[2].x * v.z + m_[3].x * v.w, m_[0].y * v.x + m_[1].y * v.y + m_[2].y * v.z + m_[3].y * v.w, m_[0].z * v.x + m_[1].z * v.y + m_[2].z * v.z + m_[3].z * v.w, m_[0].w * v.x + m_[1].w * v.y + m_[2].w * v.z + m_[3].w * v.w);
332
+ }
333
+ },
334
+ mulVxM: {
335
+ mat2x2f: (v, m) => {
336
+ const m_ = m.columns;
337
+ return vec2f(v.x * m_[0].x + v.y * m_[0].y, v.x * m_[1].x + v.y * m_[1].y);
338
+ },
339
+ mat3x3f: (v, m) => {
340
+ const m_ = m.columns;
341
+ return vec3f(v.x * m_[0].x + v.y * m_[0].y + v.z * m_[0].z, v.x * m_[1].x + v.y * m_[1].y + v.z * m_[1].z, v.x * m_[2].x + v.y * m_[2].y + v.z * m_[2].z);
342
+ },
343
+ mat4x4f: (v, m) => {
344
+ const m_ = m.columns;
345
+ return vec4f(v.x * m_[0].x + v.y * m_[0].y + v.z * m_[0].z + v.w * m_[0].w, v.x * m_[1].x + v.y * m_[1].y + v.z * m_[1].z + v.w * m_[1].w, v.x * m_[2].x + v.y * m_[2].y + v.z * m_[2].z + v.w * m_[2].w, v.x * m_[3].x + v.y * m_[3].y + v.z * m_[3].z + v.w * m_[3].w);
346
+ }
347
+ },
348
+ div: {
349
+ vec2f: binaryComponentWise2f((a, b) => a / b),
350
+ vec2h: binaryComponentWise2h((a, b) => a / b),
351
+ vec2i: binaryComponentWise2i(divInteger),
352
+ vec2u: binaryComponentWise2u(divInteger),
353
+ vec3f: binaryComponentWise3f((a, b) => a / b),
354
+ vec3h: binaryComponentWise3h((a, b) => a / b),
355
+ vec3i: binaryComponentWise3i(divInteger),
356
+ vec3u: binaryComponentWise3u(divInteger),
357
+ vec4f: binaryComponentWise4f((a, b) => a / b),
358
+ vec4h: binaryComponentWise4h((a, b) => a / b),
359
+ vec4i: binaryComponentWise4i(divInteger),
360
+ vec4u: binaryComponentWise4u(divInteger)
361
+ },
362
+ dot: {
363
+ vec2f: dotVec2,
364
+ vec2h: dotVec2,
365
+ vec2i: dotVec2,
366
+ vec2u: dotVec2,
367
+ vec3f: dotVec3,
368
+ vec3h: dotVec3,
369
+ vec3i: dotVec3,
370
+ vec3u: dotVec3,
371
+ vec4f: dotVec4,
372
+ vec4h: dotVec4,
373
+ vec4i: dotVec4,
374
+ vec4u: dotVec4
375
+ },
376
+ normalize: {
377
+ vec2f: (v) => {
378
+ const len = lengthVec2(v);
379
+ return vec2f(v.x / len, v.y / len);
380
+ },
381
+ vec2h: (v) => {
382
+ const len = lengthVec2(v);
383
+ return vec2h(v.x / len, v.y / len);
384
+ },
385
+ vec2i: (v) => {
386
+ const len = lengthVec2(v);
387
+ return vec2i(v.x / len, v.y / len);
388
+ },
389
+ vec2u: (v) => {
390
+ const len = lengthVec2(v);
391
+ return vec2u(v.x / len, v.y / len);
392
+ },
393
+ vec3f: (v) => {
394
+ const len = lengthVec3(v);
395
+ return vec3f(v.x / len, v.y / len, v.z / len);
396
+ },
397
+ vec3h: (v) => {
398
+ const len = lengthVec3(v);
399
+ return vec3h(v.x / len, v.y / len, v.z / len);
400
+ },
401
+ vec3i: (v) => {
402
+ const len = lengthVec3(v);
403
+ return vec3i(v.x / len, v.y / len, v.z / len);
404
+ },
405
+ vec3u: (v) => {
406
+ const len = lengthVec3(v);
407
+ return vec3u(v.x / len, v.y / len, v.z / len);
408
+ },
409
+ vec4f: (v) => {
410
+ const len = lengthVec4(v);
411
+ return vec4f(v.x / len, v.y / len, v.z / len, v.w / len);
412
+ },
413
+ vec4h: (v) => {
414
+ const len = lengthVec4(v);
415
+ return vec4h(v.x / len, v.y / len, v.z / len, v.w / len);
416
+ },
417
+ vec4i: (v) => {
418
+ const len = lengthVec4(v);
419
+ return vec4i(v.x / len, v.y / len, v.z / len, v.w / len);
420
+ },
421
+ vec4u: (v) => {
422
+ const len = lengthVec4(v);
423
+ return vec4u(v.x / len, v.y / len, v.z / len, v.w / len);
424
+ }
425
+ },
426
+ cross: {
427
+ vec3f: (a, b) => {
428
+ return vec3f(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
429
+ },
430
+ vec3h: (a, b) => {
431
+ return vec3h(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
432
+ }
433
+ },
434
+ mod: {
435
+ vec2f: binaryComponentWise2f((a, b) => a % b),
436
+ vec2h: binaryComponentWise2h((a, b) => a % b),
437
+ vec2i: binaryComponentWise2i((a, b) => a % b),
438
+ vec2u: binaryComponentWise2u((a, b) => a % b),
439
+ vec3f: binaryComponentWise3f((a, b) => a % b),
440
+ vec3h: binaryComponentWise3h((a, b) => a % b),
441
+ vec3i: binaryComponentWise3i((a, b) => a % b),
442
+ vec3u: binaryComponentWise3u((a, b) => a % b),
443
+ vec4f: binaryComponentWise4f((a, b) => a % b),
444
+ vec4h: binaryComponentWise4h((a, b) => a % b),
445
+ vec4i: binaryComponentWise4i((a, b) => a % b),
446
+ vec4u: binaryComponentWise4u((a, b) => a % b)
447
+ },
448
+ floor: {
449
+ vec2f: unary2f(Math.floor),
450
+ vec2h: unary2h(Math.floor),
451
+ vec3f: unary3f(Math.floor),
452
+ vec3h: unary3h(Math.floor),
453
+ vec4f: unary4f(Math.floor),
454
+ vec4h: unary4h(Math.floor)
455
+ },
456
+ max: {
457
+ vec2f: binaryComponentWise2f(Math.max),
458
+ vec2h: binaryComponentWise2h(Math.max),
459
+ vec2i: binaryComponentWise2i(Math.max),
460
+ vec2u: binaryComponentWise2u(Math.max),
461
+ vec3f: binaryComponentWise3f(Math.max),
462
+ vec3h: binaryComponentWise3h(Math.max),
463
+ vec3i: binaryComponentWise3i(Math.max),
464
+ vec3u: binaryComponentWise3u(Math.max),
465
+ vec4f: binaryComponentWise4f(Math.max),
466
+ vec4h: binaryComponentWise4h(Math.max),
467
+ vec4i: binaryComponentWise4i(Math.max),
468
+ vec4u: binaryComponentWise4u(Math.max)
469
+ },
470
+ min: {
471
+ vec2f: binaryComponentWise2f(Math.min),
472
+ vec2h: binaryComponentWise2h(Math.min),
473
+ vec2i: binaryComponentWise2i(Math.min),
474
+ vec2u: binaryComponentWise2u(Math.min),
475
+ vec3f: binaryComponentWise3f(Math.min),
476
+ vec3h: binaryComponentWise3h(Math.min),
477
+ vec3i: binaryComponentWise3i(Math.min),
478
+ vec3u: binaryComponentWise3u(Math.min),
479
+ vec4f: binaryComponentWise4f(Math.min),
480
+ vec4h: binaryComponentWise4h(Math.min),
481
+ vec4i: binaryComponentWise4i(Math.min),
482
+ vec4u: binaryComponentWise4u(Math.min)
483
+ },
484
+ pow: {
485
+ vec2f: (base, exponent) => vec2f(base.x ** exponent.x, base.y ** exponent.y),
486
+ vec2h: (base, exponent) => vec2h(base.x ** exponent.x, base.y ** exponent.y),
487
+ vec3f: (base, exponent) => vec3f(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z),
488
+ vec3h: (base, exponent) => vec3h(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z),
489
+ vec4f: (base, exponent) => vec4f(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z, base.w ** exponent.w),
490
+ vec4h: (base, exponent) => vec4h(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z, base.w ** exponent.w)
491
+ },
492
+ sign: {
493
+ vec2f: unary2f(Math.sign),
494
+ vec2h: unary2h(Math.sign),
495
+ vec2i: unary2i(Math.sign),
496
+ vec3f: unary3f(Math.sign),
497
+ vec3h: unary3h(Math.sign),
498
+ vec3i: unary3i(Math.sign),
499
+ vec4f: unary4f(Math.sign),
500
+ vec4h: unary4h(Math.sign),
501
+ vec4i: unary4i(Math.sign)
502
+ },
503
+ sqrt: {
504
+ vec2f: unary2f(Math.sqrt),
505
+ vec2h: unary2h(Math.sqrt),
506
+ vec3f: unary3f(Math.sqrt),
507
+ vec3h: unary3h(Math.sqrt),
508
+ vec4f: unary4f(Math.sqrt),
509
+ vec4h: unary4h(Math.sqrt)
510
+ },
511
+ mix: {
512
+ vec2f: (e1, e2, e3) => {
513
+ if (typeof e3 === "number") return vec2f(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3);
514
+ return vec2f(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y);
515
+ },
516
+ vec2h: (e1, e2, e3) => {
517
+ if (typeof e3 === "number") return vec2h(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3);
518
+ return vec2h(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y);
519
+ },
520
+ vec3f: (e1, e2, e3) => {
521
+ if (typeof e3 === "number") return vec3f(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3, e1.z * (1 - e3) + e2.z * e3);
522
+ return vec3f(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y, e1.z * (1 - e3.z) + e2.z * e3.z);
523
+ },
524
+ vec3h: (e1, e2, e3) => {
525
+ if (typeof e3 === "number") return vec3h(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3, e1.z * (1 - e3) + e2.z * e3);
526
+ return vec3h(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y, e1.z * (1 - e3.z) + e2.z * e3.z);
527
+ },
528
+ vec4f: (e1, e2, e3) => {
529
+ if (typeof e3 === "number") return vec4f(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3, e1.z * (1 - e3) + e2.z * e3, e1.w * (1 - e3) + e2.w * e3);
530
+ return vec4f(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y, e1.z * (1 - e3.z) + e2.z * e3.z, e1.w * (1 - e3.w) + e2.w * e3.w);
531
+ },
532
+ vec4h: (e1, e2, e3) => {
533
+ if (typeof e3 === "number") return vec4h(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3, e1.z * (1 - e3) + e2.z * e3, e1.w * (1 - e3) + e2.w * e3);
534
+ return vec4h(e1.x * (1 - e3.x) + e2.x * e3.x, e1.y * (1 - e3.y) + e2.y * e3.y, e1.z * (1 - e3.z) + e2.z * e3.z, e1.w * (1 - e3.w) + e2.w * e3.w);
535
+ }
536
+ },
537
+ sin: {
538
+ vec2f: unary2f(Math.sin),
539
+ vec2h: unary2h(Math.sin),
540
+ vec3f: unary3f(Math.sin),
541
+ vec3h: unary3h(Math.sin),
542
+ vec4f: unary4f(Math.sin),
543
+ vec4h: unary4h(Math.sin)
544
+ },
545
+ cos: {
546
+ vec2f: unary2f(Math.cos),
547
+ vec2h: unary2h(Math.cos),
548
+ vec3f: unary3f(Math.cos),
549
+ vec3h: unary3h(Math.cos),
550
+ vec4f: unary4f(Math.cos),
551
+ vec4h: unary4h(Math.cos)
552
+ },
553
+ cosh: {
554
+ vec2f: unary2f(Math.cosh),
555
+ vec2h: unary2h(Math.cosh),
556
+ vec3f: unary3f(Math.cosh),
557
+ vec3h: unary3h(Math.cosh),
558
+ vec4f: unary4f(Math.cosh),
559
+ vec4h: unary4h(Math.cosh)
560
+ },
561
+ exp: {
562
+ vec2f: unary2f(Math.exp),
563
+ vec2h: unary2h(Math.exp),
564
+ vec3f: unary3f(Math.exp),
565
+ vec3h: unary3h(Math.exp),
566
+ vec4f: unary4f(Math.exp),
567
+ vec4h: unary4h(Math.exp)
568
+ },
569
+ exp2: {
570
+ vec2f: unary2f((val) => 2 ** val),
571
+ vec2h: unary2h((val) => 2 ** val),
572
+ vec3f: unary3f((val) => 2 ** val),
573
+ vec3h: unary3h((val) => 2 ** val),
574
+ vec4f: unary4f((val) => 2 ** val),
575
+ vec4h: unary4h((val) => 2 ** val)
576
+ },
577
+ log: {
578
+ vec2f: unary2f(Math.log),
579
+ vec2h: unary2h(Math.log),
580
+ vec3f: unary3f(Math.log),
581
+ vec3h: unary3h(Math.log),
582
+ vec4f: unary4f(Math.log),
583
+ vec4h: unary4h(Math.log)
584
+ },
585
+ log2: {
586
+ vec2f: unary2f(Math.log2),
587
+ vec2h: unary2h(Math.log2),
588
+ vec3f: unary3f(Math.log2),
589
+ vec3h: unary3h(Math.log2),
590
+ vec4f: unary4f(Math.log2),
591
+ vec4h: unary4h(Math.log2)
592
+ },
593
+ fract: {
594
+ vec2f: unary2f((value) => value - Math.floor(value)),
595
+ vec2h: unary2h((value) => value - Math.floor(value)),
596
+ vec3f: unary3f((value) => value - Math.floor(value)),
597
+ vec3h: unary3h((value) => value - Math.floor(value)),
598
+ vec4f: unary4f((value) => value - Math.floor(value)),
599
+ vec4h: unary4h((value) => value - Math.floor(value))
600
+ },
601
+ isCloseToZero: {
602
+ vec2f: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n,
603
+ vec2h: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n,
604
+ vec3f: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n,
605
+ vec3h: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n,
606
+ vec4f: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n && Math.abs(v.w) <= n,
607
+ vec4h: (v, n) => Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n && Math.abs(v.w) <= n
608
+ },
609
+ neg: {
610
+ vec2f: unary2f((value) => -value),
611
+ vec2h: unary2h((value) => -value),
612
+ vec2i: unary2i((value) => -value),
613
+ vec2u: unary2u((value) => -value),
614
+ "vec2<bool>": (e) => vec2b(!e.x, !e.y),
615
+ vec3f: unary3f((value) => -value),
616
+ vec3h: unary3h((value) => -value),
617
+ vec3i: unary3i((value) => -value),
618
+ vec3u: unary3u((value) => -value),
619
+ "vec3<bool>": (e) => vec3b(!e.x, !e.y, !e.z),
620
+ vec4f: unary4f((value) => -value),
621
+ vec4h: unary4h((value) => -value),
622
+ vec4i: unary4i((value) => -value),
623
+ vec4u: unary4u((value) => -value),
624
+ "vec4<bool>": (e) => vec4b(!e.x, !e.y, !e.z, !e.w)
625
+ },
626
+ select: {
627
+ vec2f: (f, t, c) => vec2f(c.x ? t.x : f.x, c.y ? t.y : f.y),
628
+ vec2h: (f, t, c) => vec2h(c.x ? t.x : f.x, c.y ? t.y : f.y),
629
+ vec2i: (f, t, c) => vec2i(c.x ? t.x : f.x, c.y ? t.y : f.y),
630
+ vec2u: (f, t, c) => vec2u(c.x ? t.x : f.x, c.y ? t.y : f.y),
631
+ "vec2<bool>": (f, t, c) => vec2b(c.x ? t.x : f.x, c.y ? t.y : f.y),
632
+ vec3f: (f, t, c) => vec3f(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),
633
+ vec3h: (f, t, c) => vec3h(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),
634
+ vec3i: (f, t, c) => vec3i(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),
635
+ vec3u: (f, t, c) => vec3u(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),
636
+ "vec3<bool>": (f, t, c) => vec3b(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),
637
+ vec4f: (f, t, c) => vec4f(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),
638
+ vec4h: (f, t, c) => vec4h(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),
639
+ vec4i: (f, t, c) => vec4i(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),
640
+ vec4u: (f, t, c) => vec4u(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),
641
+ "vec4<bool>": (f, t, c) => vec4b(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w)
642
+ },
643
+ tanh: {
644
+ vec2f: unary2f(Math.tanh),
645
+ vec2h: unary2h(Math.tanh),
646
+ vec3f: unary3f(Math.tanh),
647
+ vec3h: unary3h(Math.tanh),
648
+ vec4f: unary4f(Math.tanh),
649
+ vec4h: unary4h(Math.tanh)
650
+ },
651
+ bitcastU32toF32: {
652
+ vec2u: (n) => vec2f(bitcastU32toF32Impl(n.x), bitcastU32toF32Impl(n.y)),
653
+ vec3u: (n) => vec3f(bitcastU32toF32Impl(n.x), bitcastU32toF32Impl(n.y), bitcastU32toF32Impl(n.z)),
654
+ vec4u: (n) => vec4f(bitcastU32toF32Impl(n.x), bitcastU32toF32Impl(n.y), bitcastU32toF32Impl(n.z), bitcastU32toF32Impl(n.w))
655
+ },
656
+ bitcastU32toI32: {
657
+ vec2u: (n) => vec2i(bitcastU32toI32Impl(n.x), bitcastU32toI32Impl(n.y)),
658
+ vec3u: (n) => vec3i(bitcastU32toI32Impl(n.x), bitcastU32toI32Impl(n.y), bitcastU32toI32Impl(n.z)),
659
+ vec4u: (n) => vec4i(bitcastU32toI32Impl(n.x), bitcastU32toI32Impl(n.y), bitcastU32toI32Impl(n.z), bitcastU32toI32Impl(n.w))
660
+ }
661
+ };
662
+
663
+ //#endregion
664
+ export { VectorOps };