typegpu 0.10.1 → 0.11.0-rc.1

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