typegpu 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/attributes-BQuRnaZ4.d.ts +151 -0
  2. package/attributes-Bt2NG-9a.d.cts +151 -0
  3. package/chunk-LF344PKG.cjs +4 -0
  4. package/chunk-LF344PKG.cjs.map +1 -0
  5. package/chunk-SDSDWWKW.js +2 -0
  6. package/chunk-SDSDWWKW.js.map +1 -0
  7. package/chunk-Y2M5GYRO.cjs +2 -0
  8. package/chunk-Y2M5GYRO.cjs.map +1 -0
  9. package/chunk-YLI4IK35.js +4 -0
  10. package/chunk-YLI4IK35.js.map +1 -0
  11. package/data/index.cjs +1 -192
  12. package/data/index.d.cts +209 -2
  13. package/data/index.d.ts +209 -2
  14. package/data/index.js +1 -192
  15. package/index.cjs +18 -4269
  16. package/index.cjs.map +1 -1
  17. package/index.d.cts +146 -133
  18. package/index.d.ts +146 -133
  19. package/index.js +18 -4269
  20. package/index.js.map +1 -1
  21. package/package.json +2 -2
  22. package/std/index.cjs +1 -490
  23. package/std/index.cjs.map +1 -1
  24. package/std/index.d.cts +10 -3
  25. package/std/index.d.ts +10 -3
  26. package/std/index.js +1 -490
  27. package/std/index.js.map +1 -1
  28. package/vector-CeDeofzh.d.ts +176 -0
  29. package/vector-UFYwud47.d.cts +176 -0
  30. package/{vector-CDD2FV2v.d.cts → wgslTypes-BNsjCP--.d.cts} +477 -260
  31. package/{vector-CDD2FV2v.d.ts → wgslTypes-BNsjCP--.d.ts} +477 -260
  32. package/chunk-2CMWQRQC.cjs +0 -2
  33. package/chunk-2CMWQRQC.cjs.map +0 -1
  34. package/chunk-2ZAQFPSX.js +0 -1266
  35. package/chunk-2ZAQFPSX.js.map +0 -1
  36. package/chunk-35UVS2JJ.cjs +0 -591
  37. package/chunk-35UVS2JJ.cjs.map +0 -1
  38. package/chunk-A2QB4MSZ.js +0 -4
  39. package/chunk-A2QB4MSZ.js.map +0 -1
  40. package/chunk-CMYXKKUP.cjs +0 -1266
  41. package/chunk-CMYXKKUP.cjs.map +0 -1
  42. package/chunk-DDEF2Y4S.js +0 -591
  43. package/chunk-DDEF2Y4S.js.map +0 -1
  44. package/chunk-KYBPSQX5.js +0 -2
  45. package/chunk-KYBPSQX5.js.map +0 -1
  46. package/chunk-VRYGOFCW.cjs +0 -4
  47. package/chunk-VRYGOFCW.cjs.map +0 -1
  48. package/index-CuzbyKXg.d.cts +0 -751
  49. package/index-FHKuURMs.d.ts +0 -751
package/std/index.js CHANGED
@@ -1,491 +1,2 @@
1
- import {
2
- inGPUMode,
3
- vec2f,
4
- vec2h,
5
- vec2i,
6
- vec2u,
7
- vec3f,
8
- vec3h,
9
- vec3i,
10
- vec3u,
11
- vec4f,
12
- vec4h,
13
- vec4i,
14
- vec4u
15
- } from "../chunk-DDEF2Y4S.js";
16
-
17
- // src/data/vectorOps.ts
18
- var lengthVec2 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2);
19
- var lengthVec3 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);
20
- var lengthVec4 = (v) => Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2 + v.w ** 2);
21
- var dotVec2 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y;
22
- var dotVec3 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;
23
- var dotVec4 = (lhs, rhs) => lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z + lhs.w * rhs.w;
24
- var clamp = (value, low, high) => Math.min(Math.max(low, value), high);
25
- var VectorOps = {
26
- abs: {
27
- vec2f: (v) => vec2f(Math.abs(v.x), Math.abs(v.y)),
28
- vec2h: (v) => vec2h(Math.abs(v.x), Math.abs(v.y)),
29
- vec2i: (v) => vec2i(Math.abs(v.x), Math.abs(v.y)),
30
- vec2u: (v) => vec2u(Math.abs(v.x), Math.abs(v.y)),
31
- vec3f: (v) => vec3f(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z)),
32
- vec3h: (v) => vec3h(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z)),
33
- vec3i: (v) => vec3i(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z)),
34
- vec3u: (v) => vec3u(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z)),
35
- vec4f: (v) => vec4f(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z), Math.abs(v.w)),
36
- vec4h: (v) => vec4h(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z), Math.abs(v.w)),
37
- vec4i: (v) => vec4i(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z), Math.abs(v.w)),
38
- vec4u: (v) => vec4u(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z), Math.abs(v.w))
39
- },
40
- ceil: {
41
- vec2f: (v) => vec2f(Math.ceil(v.x), Math.ceil(v.y)),
42
- vec2h: (v) => vec2h(Math.ceil(v.x), Math.ceil(v.y)),
43
- vec2i: (v) => vec2i(Math.ceil(v.x), Math.ceil(v.y)),
44
- vec2u: (v) => vec2u(Math.ceil(v.x), Math.ceil(v.y)),
45
- vec3f: (v) => vec3f(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z)),
46
- vec3h: (v) => vec3h(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z)),
47
- vec3i: (v) => vec3i(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z)),
48
- vec3u: (v) => vec3u(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z)),
49
- vec4f: (v) => vec4f(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z), Math.ceil(v.w)),
50
- vec4h: (v) => vec4h(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z), Math.ceil(v.w)),
51
- vec4i: (v) => vec4i(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z), Math.ceil(v.w)),
52
- vec4u: (v) => vec4u(Math.ceil(v.x), Math.ceil(v.y), Math.ceil(v.z), Math.ceil(v.w))
53
- },
54
- clamp: {
55
- vec2f: (v, low, high) => vec2f(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
56
- vec2h: (v, low, high) => vec2h(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
57
- vec2i: (v, low, high) => vec2i(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
58
- vec2u: (v, low, high) => vec2u(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),
59
- vec3f: (v, low, high) => vec3f(
60
- clamp(v.x, low.x, high.x),
61
- clamp(v.y, low.y, high.y),
62
- clamp(v.z, low.z, high.z)
63
- ),
64
- vec3h: (v, low, high) => vec3h(
65
- clamp(v.x, low.x, high.x),
66
- clamp(v.y, low.y, high.y),
67
- clamp(v.z, low.z, high.z)
68
- ),
69
- vec3i: (v, low, high) => vec3i(
70
- clamp(v.x, low.x, high.x),
71
- clamp(v.y, low.y, high.y),
72
- clamp(v.z, low.z, high.z)
73
- ),
74
- vec3u: (v, low, high) => vec3u(
75
- clamp(v.x, low.x, high.x),
76
- clamp(v.y, low.y, high.y),
77
- clamp(v.z, low.z, high.z)
78
- ),
79
- vec4f: (v, low, high) => vec4f(
80
- clamp(v.x, low.x, high.x),
81
- clamp(v.y, low.y, high.y),
82
- clamp(v.z, low.z, high.z),
83
- clamp(v.w, low.w, high.w)
84
- ),
85
- vec4h: (v, low, high) => vec4h(
86
- clamp(v.x, low.x, high.x),
87
- clamp(v.y, low.y, high.y),
88
- clamp(v.z, low.z, high.z),
89
- clamp(v.w, low.w, high.w)
90
- ),
91
- vec4i: (v, low, high) => vec4i(
92
- clamp(v.x, low.x, high.x),
93
- clamp(v.y, low.y, high.y),
94
- clamp(v.z, low.z, high.z),
95
- clamp(v.w, low.w, high.w)
96
- ),
97
- vec4u: (v, low, high) => vec4u(
98
- clamp(v.x, low.x, high.x),
99
- clamp(v.y, low.y, high.y),
100
- clamp(v.z, low.z, high.z),
101
- clamp(v.w, low.w, high.w)
102
- )
103
- },
104
- length: {
105
- vec2f: lengthVec2,
106
- vec2h: lengthVec2,
107
- vec2i: lengthVec2,
108
- vec2u: lengthVec2,
109
- vec3f: lengthVec3,
110
- vec3h: lengthVec3,
111
- vec3i: lengthVec3,
112
- vec3u: lengthVec3,
113
- vec4f: lengthVec4,
114
- vec4h: lengthVec4,
115
- vec4i: lengthVec4,
116
- vec4u: lengthVec4
117
- },
118
- add: {
119
- vec2f: (a, b) => vec2f(a.x + b.x, a.y + b.y),
120
- vec2h: (a, b) => vec2h(a.x + b.x, a.y + b.y),
121
- vec2i: (a, b) => vec2i(a.x + b.x, a.y + b.y),
122
- vec2u: (a, b) => vec2u(a.x + b.x, a.y + b.y),
123
- vec3f: (a, b) => vec3f(a.x + b.x, a.y + b.y, a.z + b.z),
124
- vec3h: (a, b) => vec3h(a.x + b.x, a.y + b.y, a.z + b.z),
125
- vec3i: (a, b) => vec3i(a.x + b.x, a.y + b.y, a.z + b.z),
126
- vec3u: (a, b) => vec3u(a.x + b.x, a.y + b.y, a.z + b.z),
127
- vec4f: (a, b) => vec4f(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w),
128
- vec4h: (a, b) => vec4h(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w),
129
- vec4i: (a, b) => vec4i(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w),
130
- vec4u: (a, b) => vec4u(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w)
131
- },
132
- sub: {
133
- vec2f: (a, b) => vec2f(a.x - b.x, a.y - b.y),
134
- vec2h: (a, b) => vec2h(a.x - b.x, a.y - b.y),
135
- vec2i: (a, b) => vec2i(a.x - b.x, a.y - b.y),
136
- vec2u: (a, b) => vec2u(a.x - b.x, a.y - b.y),
137
- vec3f: (a, b) => vec3f(a.x - b.x, a.y - b.y, a.z - b.z),
138
- vec3h: (a, b) => vec3h(a.x - b.x, a.y - b.y, a.z - b.z),
139
- vec3i: (a, b) => vec3i(a.x - b.x, a.y - b.y, a.z - b.z),
140
- vec3u: (a, b) => vec3u(a.x - b.x, a.y - b.y, a.z - b.z),
141
- vec4f: (a, b) => vec4f(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w),
142
- vec4h: (a, b) => vec4h(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w),
143
- vec4i: (a, b) => vec4i(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w),
144
- vec4u: (a, b) => vec4u(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w)
145
- },
146
- mulSxV: {
147
- vec2f: (s, v) => vec2f(s * v.x, s * v.y),
148
- vec2h: (s, v) => vec2h(s * v.x, s * v.y),
149
- vec2i: (s, v) => vec2i(s * v.x, s * v.y),
150
- vec2u: (s, v) => vec2u(s * v.x, s * v.y),
151
- vec3f: (s, v) => vec3f(s * v.x, s * v.y, s * v.z),
152
- vec3h: (s, v) => vec3h(s * v.x, s * v.y, s * v.z),
153
- vec3i: (s, v) => vec3i(s * v.x, s * v.y, s * v.z),
154
- vec3u: (s, v) => vec3u(s * v.x, s * v.y, s * v.z),
155
- vec4f: (s, v) => vec4f(s * v.x, s * v.y, s * v.z, s * v.w),
156
- vec4h: (s, v) => vec4h(s * v.x, s * v.y, s * v.z, s * v.w),
157
- vec4i: (s, v) => vec4i(s * v.x, s * v.y, s * v.z, s * v.w),
158
- vec4u: (s, v) => vec4u(s * v.x, s * v.y, s * v.z, s * v.w)
159
- },
160
- mulVxV: {
161
- vec2f: (a, b) => vec2f(a.x * b.x, a.y * b.y),
162
- vec2h: (a, b) => vec2h(a.x * b.x, a.y * b.y),
163
- vec2i: (a, b) => vec2i(a.x * b.x, a.y * b.y),
164
- vec2u: (a, b) => vec2u(a.x * b.x, a.y * b.y),
165
- vec3f: (a, b) => vec3f(a.x * b.x, a.y * b.y, a.z * b.z),
166
- vec3h: (a, b) => vec3h(a.x * b.x, a.y * b.y, a.z * b.z),
167
- vec3i: (a, b) => vec3i(a.x * b.x, a.y * b.y, a.z * b.z),
168
- vec3u: (a, b) => vec3u(a.x * b.x, a.y * b.y, a.z * b.z),
169
- vec4f: (a, b) => vec4f(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w),
170
- vec4h: (a, b) => vec4h(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w),
171
- vec4i: (a, b) => vec4i(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w),
172
- vec4u: (a, b) => vec4u(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w)
173
- },
174
- dot: {
175
- vec2f: dotVec2,
176
- vec2h: dotVec2,
177
- vec2i: dotVec2,
178
- vec2u: dotVec2,
179
- vec3f: dotVec3,
180
- vec3h: dotVec3,
181
- vec3i: dotVec3,
182
- vec3u: dotVec3,
183
- vec4f: dotVec4,
184
- vec4h: dotVec4,
185
- vec4i: dotVec4,
186
- vec4u: dotVec4
187
- },
188
- normalize: {
189
- vec2f: (v) => {
190
- const len = lengthVec2(v);
191
- return vec2f(v.x / len, v.y / len);
192
- },
193
- vec2h: (v) => {
194
- const len = lengthVec2(v);
195
- return vec2h(v.x / len, v.y / len);
196
- },
197
- vec2i: (v) => {
198
- const len = lengthVec2(v);
199
- return vec2i(v.x / len, v.y / len);
200
- },
201
- vec2u: (v) => {
202
- const len = lengthVec2(v);
203
- return vec2u(v.x / len, v.y / len);
204
- },
205
- vec3f: (v) => {
206
- const len = lengthVec3(v);
207
- return vec3f(v.x / len, v.y / len, v.z / len);
208
- },
209
- vec3h: (v) => {
210
- const len = lengthVec3(v);
211
- return vec3h(v.x / len, v.y / len, v.z / len);
212
- },
213
- vec3i: (v) => {
214
- const len = lengthVec3(v);
215
- return vec3i(v.x / len, v.y / len, v.z / len);
216
- },
217
- vec3u: (v) => {
218
- const len = lengthVec3(v);
219
- return vec3u(v.x / len, v.y / len, v.z / len);
220
- },
221
- vec4f: (v) => {
222
- const len = lengthVec4(v);
223
- return vec4f(v.x / len, v.y / len, v.z / len, v.w / len);
224
- },
225
- vec4h: (v) => {
226
- const len = lengthVec4(v);
227
- return vec4h(v.x / len, v.y / len, v.z / len, v.w / len);
228
- },
229
- vec4i: (v) => {
230
- const len = lengthVec4(v);
231
- return vec4i(v.x / len, v.y / len, v.z / len, v.w / len);
232
- },
233
- vec4u: (v) => {
234
- const len = lengthVec4(v);
235
- return vec4u(v.x / len, v.y / len, v.z / len, v.w / len);
236
- }
237
- },
238
- cross: {
239
- vec3f: (a, b) => {
240
- return vec3f(
241
- a.y * b.z - a.z * b.y,
242
- a.z * b.x - a.x * b.z,
243
- a.x * b.y - a.y * b.x
244
- );
245
- },
246
- vec3h: (a, b) => {
247
- return vec3h(
248
- a.y * b.z - a.z * b.y,
249
- a.z * b.x - a.x * b.z,
250
- a.x * b.y - a.y * b.x
251
- );
252
- },
253
- vec3i: (a, b) => {
254
- return vec3i(
255
- a.y * b.z - a.z * b.y,
256
- a.z * b.x - a.x * b.z,
257
- a.x * b.y - a.y * b.x
258
- );
259
- },
260
- vec3u: (a, b) => {
261
- return vec3u(
262
- a.y * b.z - a.z * b.y,
263
- a.z * b.x - a.x * b.z,
264
- a.x * b.y - a.y * b.x
265
- );
266
- }
267
- },
268
- floor: {
269
- vec2f: (v) => vec2f(Math.floor(v.x), Math.floor(v.y)),
270
- vec2h: (v) => vec2h(Math.floor(v.x), Math.floor(v.y)),
271
- vec2i: (v) => vec2i(Math.floor(v.x), Math.floor(v.y)),
272
- vec2u: (v) => vec2u(Math.floor(v.x), Math.floor(v.y)),
273
- vec3f: (v) => vec3f(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z)),
274
- vec3h: (v) => vec3h(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z)),
275
- vec3i: (v) => vec3i(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z)),
276
- vec3u: (v) => vec3u(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z)),
277
- vec4f: (v) => vec4f(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z), Math.floor(v.w)),
278
- vec4h: (v) => vec4h(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z), Math.floor(v.w)),
279
- vec4i: (v) => vec4i(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z), Math.floor(v.w)),
280
- vec4u: (v) => vec4u(Math.floor(v.x), Math.floor(v.y), Math.floor(v.z), Math.floor(v.w))
281
- },
282
- max: {
283
- vec2f: (a, b) => vec2f(Math.max(a.x, b.x), Math.max(a.y, b.y)),
284
- vec2h: (a, b) => vec2h(Math.max(a.x, b.x), Math.max(a.y, b.y)),
285
- vec2i: (a, b) => vec2i(Math.max(a.x, b.x), Math.max(a.y, b.y)),
286
- vec2u: (a, b) => vec2u(Math.max(a.x, b.x), Math.max(a.y, b.y)),
287
- vec3f: (a, b) => vec3f(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z)),
288
- vec3h: (a, b) => vec3h(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z)),
289
- vec3i: (a, b) => vec3i(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z)),
290
- vec3u: (a, b) => vec3u(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z)),
291
- vec4f: (a, b) => vec4f(
292
- Math.max(a.x, b.x),
293
- Math.max(a.y, b.y),
294
- Math.max(a.z, b.z),
295
- Math.max(a.w, b.w)
296
- ),
297
- vec4h: (a, b) => vec4h(
298
- Math.max(a.x, b.x),
299
- Math.max(a.y, b.y),
300
- Math.max(a.z, b.z),
301
- Math.max(a.w, b.w)
302
- ),
303
- vec4i: (a, b) => vec4i(
304
- Math.max(a.x, b.x),
305
- Math.max(a.y, b.y),
306
- Math.max(a.z, b.z),
307
- Math.max(a.w, b.w)
308
- ),
309
- vec4u: (a, b) => vec4u(
310
- Math.max(a.x, b.x),
311
- Math.max(a.y, b.y),
312
- Math.max(a.z, b.z),
313
- Math.max(a.w, b.w)
314
- )
315
- },
316
- min: {
317
- vec2f: (a, b) => vec2f(Math.min(a.x, b.x), Math.min(a.y, b.y)),
318
- vec2h: (a, b) => vec2h(Math.min(a.x, b.x), Math.min(a.y, b.y)),
319
- vec2i: (a, b) => vec2i(Math.min(a.x, b.x), Math.min(a.y, b.y)),
320
- vec2u: (a, b) => vec2u(Math.min(a.x, b.x), Math.min(a.y, b.y)),
321
- vec3f: (a, b) => vec3f(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z)),
322
- vec3h: (a, b) => vec3h(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z)),
323
- vec3i: (a, b) => vec3i(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z)),
324
- vec3u: (a, b) => vec3u(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z)),
325
- vec4f: (a, b) => vec4f(
326
- Math.min(a.x, b.x),
327
- Math.min(a.y, b.y),
328
- Math.min(a.z, b.z),
329
- Math.min(a.w, b.w)
330
- ),
331
- vec4h: (a, b) => vec4h(
332
- Math.min(a.x, b.x),
333
- Math.min(a.y, b.y),
334
- Math.min(a.z, b.z),
335
- Math.min(a.w, b.w)
336
- ),
337
- vec4i: (a, b) => vec4i(
338
- Math.min(a.x, b.x),
339
- Math.min(a.y, b.y),
340
- Math.min(a.z, b.z),
341
- Math.min(a.w, b.w)
342
- ),
343
- vec4u: (a, b) => vec4u(
344
- Math.min(a.x, b.x),
345
- Math.min(a.y, b.y),
346
- Math.min(a.z, b.z),
347
- Math.min(a.w, b.w)
348
- )
349
- }
350
- };
351
-
352
- // src/std/numeric.ts
353
- function add(lhs, rhs) {
354
- if (inGPUMode()) {
355
- return `(${lhs} + ${rhs})`;
356
- }
357
- return VectorOps.add[lhs.kind](lhs, rhs);
358
- }
359
- function sub(lhs, rhs) {
360
- if (inGPUMode()) {
361
- return `(${lhs} - ${rhs})`;
362
- }
363
- return VectorOps.sub[lhs.kind](lhs, rhs);
364
- }
365
- function mul(s, v) {
366
- if (inGPUMode()) {
367
- return `(${s} * ${v})`;
368
- }
369
- if (typeof s === "number") {
370
- return VectorOps.mulSxV[v.kind](s, v);
371
- }
372
- return VectorOps.mulVxV[v.kind](s, v);
373
- }
374
- function abs(value) {
375
- if (inGPUMode()) {
376
- return `abs(${value})`;
377
- }
378
- if (typeof value === "number") {
379
- return Math.abs(value);
380
- }
381
- return VectorOps.abs[value.kind](value);
382
- }
383
- function ceil(value) {
384
- if (inGPUMode()) {
385
- return `ceil(${value})`;
386
- }
387
- if (typeof value === "number") {
388
- return Math.ceil(value);
389
- }
390
- return VectorOps.ceil[value.kind](value);
391
- }
392
- function clamp2(value, low, high) {
393
- if (inGPUMode()) {
394
- return `clamp(${value}, ${low}, ${high})`;
395
- }
396
- if (typeof value === "number") {
397
- return Math.min(Math.max(low, value), high);
398
- }
399
- return VectorOps.clamp[value.kind](value, low, high);
400
- }
401
- function cos(radians) {
402
- if (inGPUMode()) {
403
- return `cos(${radians})`;
404
- }
405
- return Math.cos(radians);
406
- }
407
- function cross(a, b) {
408
- if (inGPUMode()) {
409
- return `cross(${a}, ${b})`;
410
- }
411
- return VectorOps.cross[a.kind](a, b);
412
- }
413
- function dot(lhs, rhs) {
414
- if (inGPUMode()) {
415
- return `dot(${lhs}, ${rhs})`;
416
- }
417
- return VectorOps.dot[lhs.kind](lhs, rhs);
418
- }
419
- function normalize(v) {
420
- if (inGPUMode()) {
421
- return `normalize(${v})`;
422
- }
423
- return VectorOps.normalize[v.kind](v);
424
- }
425
- function floor(value) {
426
- if (inGPUMode()) {
427
- return `floor(${value})`;
428
- }
429
- if (typeof value === "number") {
430
- return Math.floor(value);
431
- }
432
- return VectorOps.floor[value.kind](value);
433
- }
434
- function fract(a) {
435
- if (inGPUMode()) {
436
- return `fract(${a})`;
437
- }
438
- return a - Math.floor(a);
439
- }
440
- function length(value) {
441
- if (inGPUMode()) {
442
- return `length(${value})`;
443
- }
444
- if (typeof value === "number") {
445
- return Math.abs(value);
446
- }
447
- return VectorOps.length[value.kind](value);
448
- }
449
- function max(a, b) {
450
- if (inGPUMode()) {
451
- return `max(${a}, ${b})`;
452
- }
453
- if (typeof a === "number") {
454
- return Math.max(a, b);
455
- }
456
- return VectorOps.max[a.kind](a, b);
457
- }
458
- function min(a, b) {
459
- if (inGPUMode()) {
460
- return `min(${a}, ${b})`;
461
- }
462
- if (typeof a === "number") {
463
- return Math.min(a, b);
464
- }
465
- return VectorOps.min[a.kind](a, b);
466
- }
467
- function sin(radians) {
468
- if (inGPUMode()) {
469
- return `sin(${radians})`;
470
- }
471
- return Math.sin(radians);
472
- }
473
- export {
474
- abs,
475
- add,
476
- ceil,
477
- clamp2 as clamp,
478
- cos,
479
- cross,
480
- dot,
481
- floor,
482
- fract,
483
- length,
484
- max,
485
- min,
486
- mul,
487
- normalize,
488
- sin,
489
- sub
490
- };
1
+ import{A as d,B as $,m as w,n as r,o as c,p as i,q as a,r as l,s as y,t as g,u as h,v as f,w as u,x as z,y as m,z as V}from"../chunk-YLI4IK35.js";var o=s=>Math.sqrt(s.x**2+s.y**2),M=s=>Math.sqrt(s.x**2+s.y**2+s.z**2),T=s=>Math.sqrt(s.x**2+s.y**2+s.z**2+s.w**2),p=(s,x)=>s.x*x.x+s.y*x.y,k=(s,x)=>s.x*x.x+s.y*x.y+s.z*x.z,B=(s,x)=>s.x*x.x+s.y*x.y+s.z*x.z+s.w*x.w,n=(s,x,t)=>Math.min(Math.max(x,s),t),v={abs:{vec2f:s=>r(Math.abs(s.x),Math.abs(s.y)),vec2h:s=>c(Math.abs(s.x),Math.abs(s.y)),vec2i:s=>i(Math.abs(s.x),Math.abs(s.y)),vec2u:s=>a(Math.abs(s.x),Math.abs(s.y)),vec3f:s=>l(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z)),vec3h:s=>y(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z)),vec3i:s=>g(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z)),vec3u:s=>h(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z)),vec4f:s=>f(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z),Math.abs(s.w)),vec4h:s=>u(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z),Math.abs(s.w)),vec4i:s=>z(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z),Math.abs(s.w)),vec4u:s=>m(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z),Math.abs(s.w))},ceil:{vec2f:s=>r(Math.ceil(s.x),Math.ceil(s.y)),vec2h:s=>c(Math.ceil(s.x),Math.ceil(s.y)),vec2i:s=>i(Math.ceil(s.x),Math.ceil(s.y)),vec2u:s=>a(Math.ceil(s.x),Math.ceil(s.y)),vec3f:s=>l(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z)),vec3h:s=>y(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z)),vec3i:s=>g(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z)),vec3u:s=>h(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z)),vec4f:s=>f(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z),Math.ceil(s.w)),vec4h:s=>u(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z),Math.ceil(s.w)),vec4i:s=>z(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z),Math.ceil(s.w)),vec4u:s=>m(Math.ceil(s.x),Math.ceil(s.y),Math.ceil(s.z),Math.ceil(s.w))},clamp:{vec2f:(s,x,t)=>r(n(s.x,x.x,t.x),n(s.y,x.y,t.y)),vec2h:(s,x,t)=>c(n(s.x,x.x,t.x),n(s.y,x.y,t.y)),vec2i:(s,x,t)=>i(n(s.x,x.x,t.x),n(s.y,x.y,t.y)),vec2u:(s,x,t)=>a(n(s.x,x.x,t.x),n(s.y,x.y,t.y)),vec3f:(s,x,t)=>l(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z)),vec3h:(s,x,t)=>y(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z)),vec3i:(s,x,t)=>g(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z)),vec3u:(s,x,t)=>h(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z)),vec4f:(s,x,t)=>f(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z),n(s.w,x.w,t.w)),vec4h:(s,x,t)=>u(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z),n(s.w,x.w,t.w)),vec4i:(s,x,t)=>z(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z),n(s.w,x.w,t.w)),vec4u:(s,x,t)=>m(n(s.x,x.x,t.x),n(s.y,x.y,t.y),n(s.z,x.z,t.z),n(s.w,x.w,t.w))},length:{vec2f:o,vec2h:o,vec2i:o,vec2u:o,vec3f:M,vec3h:M,vec3i:M,vec3u:M,vec4f:T,vec4h:T,vec4i:T,vec4u:T},add:{vec2f:(s,x)=>r(s.x+x.x,s.y+x.y),vec2h:(s,x)=>c(s.x+x.x,s.y+x.y),vec2i:(s,x)=>i(s.x+x.x,s.y+x.y),vec2u:(s,x)=>a(s.x+x.x,s.y+x.y),vec3f:(s,x)=>l(s.x+x.x,s.y+x.y,s.z+x.z),vec3h:(s,x)=>y(s.x+x.x,s.y+x.y,s.z+x.z),vec3i:(s,x)=>g(s.x+x.x,s.y+x.y,s.z+x.z),vec3u:(s,x)=>h(s.x+x.x,s.y+x.y,s.z+x.z),vec4f:(s,x)=>f(s.x+x.x,s.y+x.y,s.z+x.z,s.w+x.w),vec4h:(s,x)=>u(s.x+x.x,s.y+x.y,s.z+x.z,s.w+x.w),vec4i:(s,x)=>z(s.x+x.x,s.y+x.y,s.z+x.z,s.w+x.w),vec4u:(s,x)=>m(s.x+x.x,s.y+x.y,s.z+x.z,s.w+x.w)},sub:{vec2f:(s,x)=>r(s.x-x.x,s.y-x.y),vec2h:(s,x)=>c(s.x-x.x,s.y-x.y),vec2i:(s,x)=>i(s.x-x.x,s.y-x.y),vec2u:(s,x)=>a(s.x-x.x,s.y-x.y),vec3f:(s,x)=>l(s.x-x.x,s.y-x.y,s.z-x.z),vec3h:(s,x)=>y(s.x-x.x,s.y-x.y,s.z-x.z),vec3i:(s,x)=>g(s.x-x.x,s.y-x.y,s.z-x.z),vec3u:(s,x)=>h(s.x-x.x,s.y-x.y,s.z-x.z),vec4f:(s,x)=>f(s.x-x.x,s.y-x.y,s.z-x.z,s.w-x.w),vec4h:(s,x)=>u(s.x-x.x,s.y-x.y,s.z-x.z,s.w-x.w),vec4i:(s,x)=>z(s.x-x.x,s.y-x.y,s.z-x.z,s.w-x.w),vec4u:(s,x)=>m(s.x-x.x,s.y-x.y,s.z-x.z,s.w-x.w)},mulSxV:{vec2f:(s,x)=>r(s*x.x,s*x.y),vec2h:(s,x)=>c(s*x.x,s*x.y),vec2i:(s,x)=>i(s*x.x,s*x.y),vec2u:(s,x)=>a(s*x.x,s*x.y),vec3f:(s,x)=>l(s*x.x,s*x.y,s*x.z),vec3h:(s,x)=>y(s*x.x,s*x.y,s*x.z),vec3i:(s,x)=>g(s*x.x,s*x.y,s*x.z),vec3u:(s,x)=>h(s*x.x,s*x.y,s*x.z),vec4f:(s,x)=>f(s*x.x,s*x.y,s*x.z,s*x.w),vec4h:(s,x)=>u(s*x.x,s*x.y,s*x.z,s*x.w),vec4i:(s,x)=>z(s*x.x,s*x.y,s*x.z,s*x.w),vec4u:(s,x)=>m(s*x.x,s*x.y,s*x.z,s*x.w),mat2x2f:(s,x)=>{let t=x.columns;return V(s*t[0].x,s*t[0].y,s*t[1].x,s*t[1].y)},mat3x3f:(s,x)=>{let t=x.columns;return d(s*t[0].x,s*t[0].y,s*t[0].z,s*t[1].x,s*t[1].y,s*t[1].z,s*t[2].x,s*t[2].y,s*t[2].z)},mat4x4f:(s,x)=>{let t=x.columns;return d(s*t[0].x,s*t[0].y,s*t[0].z,s*t[0].w,s*t[1].x,s*t[1].y,s*t[1].z,s*t[1].w,s*t[2].x,s*t[2].y,s*t[2].z,s*t[2].w,s*t[3].x,s*t[3].y,s*t[3].z,s*t[3].w)}},mulVxV:{vec2f:(s,x)=>r(s.x*x.x,s.y*x.y),vec2h:(s,x)=>c(s.x*x.x,s.y*x.y),vec2i:(s,x)=>i(s.x*x.x,s.y*x.y),vec2u:(s,x)=>a(s.x*x.x,s.y*x.y),vec3f:(s,x)=>l(s.x*x.x,s.y*x.y,s.z*x.z),vec3h:(s,x)=>y(s.x*x.x,s.y*x.y,s.z*x.z),vec3i:(s,x)=>g(s.x*x.x,s.y*x.y,s.z*x.z),vec3u:(s,x)=>h(s.x*x.x,s.y*x.y,s.z*x.z),vec4f:(s,x)=>f(s.x*x.x,s.y*x.y,s.z*x.z,s.w*x.w),vec4h:(s,x)=>u(s.x*x.x,s.y*x.y,s.z*x.z,s.w*x.w),vec4i:(s,x)=>z(s.x*x.x,s.y*x.y,s.z*x.z,s.w*x.w),vec4u:(s,x)=>m(s.x*x.x,s.y*x.y,s.z*x.z,s.w*x.w),mat2x2f:(s,x)=>{let t=s.columns,e=x.columns;return V(t[0].x*e[0].x+t[1].x*e[0].y,t[0].y*e[0].x+t[1].y*e[0].y,t[0].x*e[1].x+t[1].x*e[1].y,t[0].y*e[1].x+t[1].y*e[1].y)},mat3x3f:(s,x)=>{let t=s.columns,e=x.columns;return d(t[0].x*e[0].x+t[1].x*e[0].y+t[2].x*e[0].z,t[0].y*e[0].x+t[1].y*e[0].y+t[2].y*e[0].z,t[0].z*e[0].x+t[1].z*e[0].y+t[2].z*e[0].z,t[0].x*e[1].x+t[1].x*e[1].y+t[2].x*e[1].z,t[0].y*e[1].x+t[1].y*e[1].y+t[2].y*e[1].z,t[0].z*e[1].x+t[1].z*e[1].y+t[2].z*e[1].z,t[0].x*e[2].x+t[1].x*e[2].y+t[2].x*e[2].z,t[0].y*e[2].x+t[1].y*e[2].y+t[2].y*e[2].z,t[0].z*e[2].x+t[1].z*e[2].y+t[2].z*e[2].z)},mat4x4f:(s,x)=>{let t=s.columns,e=x.columns;return $(t[0].x*e[0].x+t[1].x*e[0].y+t[2].x*e[0].z+t[3].x*e[0].w,t[0].y*e[0].x+t[1].y*e[0].y+t[2].y*e[0].z+t[3].y*e[0].w,t[0].z*e[0].x+t[1].z*e[0].y+t[2].z*e[0].z+t[3].z*e[0].w,t[0].w*e[0].x+t[1].w*e[0].y+t[2].w*e[0].z+t[3].w*e[0].w,t[0].x*e[1].x+t[1].x*e[1].y+t[2].x*e[1].z+t[3].x*e[1].w,t[0].y*e[1].x+t[1].y*e[1].y+t[2].y*e[1].z+t[3].y*e[1].w,t[0].z*e[1].x+t[1].z*e[1].y+t[2].z*e[1].z+t[3].z*e[1].w,t[0].w*e[1].x+t[1].w*e[1].y+t[2].w*e[1].z+t[3].w*e[1].w,t[0].x*e[2].x+t[1].x*e[2].y+t[2].x*e[2].z+t[3].x*e[2].w,t[0].y*e[2].x+t[1].y*e[2].y+t[2].y*e[2].z+t[3].y*e[2].w,t[0].z*e[2].x+t[1].z*e[2].y+t[2].z*e[2].z+t[3].z*e[2].w,t[0].w*e[2].x+t[1].w*e[2].y+t[2].w*e[2].z+t[3].w*e[2].w,t[0].x*e[3].x+t[1].x*e[3].y+t[2].x*e[3].z+t[3].x*e[3].w,t[0].y*e[3].x+t[1].y*e[3].y+t[2].y*e[3].z+t[3].y*e[3].w,t[0].z*e[3].x+t[1].z*e[3].y+t[2].z*e[3].z+t[3].z*e[3].w,t[0].w*e[3].x+t[1].w*e[3].y+t[2].w*e[3].z+t[3].w*e[3].w)}},dot:{vec2f:p,vec2h:p,vec2i:p,vec2u:p,vec3f:k,vec3h:k,vec3i:k,vec3u:k,vec4f:B,vec4h:B,vec4i:B,vec4u:B},normalize:{vec2f:s=>{let x=o(s);return r(s.x/x,s.y/x)},vec2h:s=>{let x=o(s);return c(s.x/x,s.y/x)},vec2i:s=>{let x=o(s);return i(s.x/x,s.y/x)},vec2u:s=>{let x=o(s);return a(s.x/x,s.y/x)},vec3f:s=>{let x=M(s);return l(s.x/x,s.y/x,s.z/x)},vec3h:s=>{let x=M(s);return y(s.x/x,s.y/x,s.z/x)},vec3i:s=>{let x=M(s);return g(s.x/x,s.y/x,s.z/x)},vec3u:s=>{let x=M(s);return h(s.x/x,s.y/x,s.z/x)},vec4f:s=>{let x=T(s);return f(s.x/x,s.y/x,s.z/x,s.w/x)},vec4h:s=>{let x=T(s);return u(s.x/x,s.y/x,s.z/x,s.w/x)},vec4i:s=>{let x=T(s);return z(s.x/x,s.y/x,s.z/x,s.w/x)},vec4u:s=>{let x=T(s);return m(s.x/x,s.y/x,s.z/x,s.w/x)}},cross:{vec3f:(s,x)=>l(s.y*x.z-s.z*x.y,s.z*x.x-s.x*x.z,s.x*x.y-s.y*x.x),vec3h:(s,x)=>y(s.y*x.z-s.z*x.y,s.z*x.x-s.x*x.z,s.x*x.y-s.y*x.x),vec3i:(s,x)=>g(s.y*x.z-s.z*x.y,s.z*x.x-s.x*x.z,s.x*x.y-s.y*x.x),vec3u:(s,x)=>h(s.y*x.z-s.z*x.y,s.z*x.x-s.x*x.z,s.x*x.y-s.y*x.x)},floor:{vec2f:s=>r(Math.floor(s.x),Math.floor(s.y)),vec2h:s=>c(Math.floor(s.x),Math.floor(s.y)),vec2i:s=>i(Math.floor(s.x),Math.floor(s.y)),vec2u:s=>a(Math.floor(s.x),Math.floor(s.y)),vec3f:s=>l(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z)),vec3h:s=>y(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z)),vec3i:s=>g(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z)),vec3u:s=>h(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z)),vec4f:s=>f(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z),Math.floor(s.w)),vec4h:s=>u(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z),Math.floor(s.w)),vec4i:s=>z(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z),Math.floor(s.w)),vec4u:s=>m(Math.floor(s.x),Math.floor(s.y),Math.floor(s.z),Math.floor(s.w))},max:{vec2f:(s,x)=>r(Math.max(s.x,x.x),Math.max(s.y,x.y)),vec2h:(s,x)=>c(Math.max(s.x,x.x),Math.max(s.y,x.y)),vec2i:(s,x)=>i(Math.max(s.x,x.x),Math.max(s.y,x.y)),vec2u:(s,x)=>a(Math.max(s.x,x.x),Math.max(s.y,x.y)),vec3f:(s,x)=>l(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z)),vec3h:(s,x)=>y(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z)),vec3i:(s,x)=>g(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z)),vec3u:(s,x)=>h(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z)),vec4f:(s,x)=>f(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z),Math.max(s.w,x.w)),vec4h:(s,x)=>u(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z),Math.max(s.w,x.w)),vec4i:(s,x)=>z(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z),Math.max(s.w,x.w)),vec4u:(s,x)=>m(Math.max(s.x,x.x),Math.max(s.y,x.y),Math.max(s.z,x.z),Math.max(s.w,x.w))},min:{vec2f:(s,x)=>r(Math.min(s.x,x.x),Math.min(s.y,x.y)),vec2h:(s,x)=>c(Math.min(s.x,x.x),Math.min(s.y,x.y)),vec2i:(s,x)=>i(Math.min(s.x,x.x),Math.min(s.y,x.y)),vec2u:(s,x)=>a(Math.min(s.x,x.x),Math.min(s.y,x.y)),vec3f:(s,x)=>l(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z)),vec3h:(s,x)=>y(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z)),vec3i:(s,x)=>g(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z)),vec3u:(s,x)=>h(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z)),vec4f:(s,x)=>f(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z),Math.min(s.w,x.w)),vec4h:(s,x)=>u(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z),Math.min(s.w,x.w)),vec4i:(s,x)=>z(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z),Math.min(s.w,x.w)),vec4u:(s,x)=>m(Math.min(s.x,x.x),Math.min(s.y,x.y),Math.min(s.z,x.z),Math.min(s.w,x.w))},pow:{vec2f:(s,x)=>r(s.x**x.x,s.y**x.y),vec2h:(s,x)=>c(s.x**x.x,s.y**x.y),vec3f:(s,x)=>l(s.x**x.x,s.y**x.y,s.z**x.z),vec3h:(s,x)=>y(s.x**x.x,s.y**x.y,s.z**x.z),vec4f:(s,x)=>f(s.x**x.x,s.y**x.y,s.z**x.z,s.w**x.w),vec4h:(s,x)=>u(s.x**x.x,s.y**x.y,s.z**x.z,s.w**x.w)},mix:{vec2f:(s,x,t)=>typeof t=="number"?r(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t):r(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y),vec2h:(s,x,t)=>typeof t=="number"?c(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t):c(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y),vec3f:(s,x,t)=>typeof t=="number"?l(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t,s.z*(1-t)+x.z*t):l(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y,s.z*(1-t.z)+x.z*t.z),vec3h:(s,x,t)=>typeof t=="number"?y(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t,s.z*(1-t)+x.z*t):y(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y,s.z*(1-t.z)+x.z*t.z),vec4f:(s,x,t)=>typeof t=="number"?f(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t,s.z*(1-t)+x.z*t,s.w*(1-t)+x.w*t):f(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y,s.z*(1-t.z)+x.z*t.z,s.w*(1-t.w)+x.w*t.w),vec4h:(s,x,t)=>typeof t=="number"?u(s.x*(1-t)+x.x*t,s.y*(1-t)+x.y*t,s.z*(1-t)+x.z*t,s.w*(1-t)+x.w*t):u(s.x*(1-t.x)+x.x*t.x,s.y*(1-t.y)+x.y*t.y,s.z*(1-t.z)+x.z*t.z,s.w*(1-t.w)+x.w*t.w)}};function K(s,x){return w()?`(${s} + ${x})`:v.add[s.kind](s,x)}function R(s,x){return w()?`(${s} - ${x})`:v.sub[s.kind](s,x)}function _(s,x){return w()?`(${s} * ${x})`:typeof s=="number"?v.mulSxV[x.kind](s,x):v.mulVxV[x.kind](s,x)}function I(s){return w()?`abs(${s})`:typeof s=="number"?Math.abs(s):v.abs[s.kind](s)}function A(s){return w()?`ceil(${s})`:typeof s=="number"?Math.ceil(s):v.ceil[s.kind](s)}function q(s,x,t){return w()?`clamp(${s}, ${x}, ${t})`:typeof s=="number"?Math.min(Math.max(x,s),t):v.clamp[s.kind](s,x,t)}function E(s){return w()?`cos(${s})`:Math.cos(s)}function j(s,x){return w()?`cross(${s}, ${x})`:v.cross[s.kind](s,x)}function O(s,x){return w()?`dot(${s}, ${x})`:v.dot[s.kind](s,x)}function S(s){return w()?`normalize(${s})`:v.normalize[s.kind](s)}function G(s){return w()?`floor(${s})`:typeof s=="number"?Math.floor(s):v.floor[s.kind](s)}function P(s){return w()?`fract(${s})`:s-Math.floor(s)}function U(s){return w()?`length(${s})`:typeof s=="number"?Math.abs(s):v.length[s.kind](s)}function W(s,x){return w()?`max(${s}, ${x})`:typeof s=="number"?Math.max(s,x):v.max[s.kind](s,x)}function C(s,x){return w()?`min(${s}, ${x})`:typeof s=="number"?Math.min(s,x):v.min[s.kind](s,x)}function D(s){return w()?`sin(${s})`:Math.sin(s)}function F(s){return w()?`exp(${s})`:Math.exp(s)}function H(s,x){if(w())return`pow(${s}, ${x})`;if(typeof s=="number"&&typeof x=="number")return s**x;if(typeof s=="object"&&typeof x=="object"&&"kind"in s&&"kind"in x)return v.pow[s.kind](s,x);throw new Error("Invalid arguments to pow()")}function J(s,x,t){if(w())return`mix(${s}, ${x}, ${t})`;if(typeof s=="number"){if(typeof t!="number"||typeof x!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return s*(1-t)+x*t}if(typeof s=="number"||typeof x=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return v.mix[s.kind](s,x,t)}export{I as abs,K as add,A as ceil,q as clamp,E as cos,j as cross,O as dot,F as exp,G as floor,P as fract,U as length,W as max,C as min,J as mix,_ as mul,S as normalize,H as pow,D as sin,R as sub};
491
2
  //# sourceMappingURL=index.js.map