typegpu 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -12
- package/README.md +13 -5
- package/chunk-5RYM4COI.js +4 -0
- package/chunk-5RYM4COI.js.map +1 -0
- package/chunk-FHOQ6WZE.cjs +2 -0
- package/chunk-FHOQ6WZE.cjs.map +1 -0
- package/chunk-ODKBWWHU.cjs +4 -0
- package/chunk-ODKBWWHU.cjs.map +1 -0
- package/chunk-SMTSXYNG.js +2 -0
- package/chunk-SMTSXYNG.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +5 -23
- package/data/index.d.ts +5 -23
- package/data/index.js +1 -1
- package/index.cjs +23 -19
- package/index.cjs.map +1 -1
- package/index.d.cts +4 -1045
- package/index.d.ts +4 -1045
- package/index.js +23 -19
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +53 -4
- package/std/index.d.ts +53 -4
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/tgpuComputeFn-DH8_PcIR.d.cts +3042 -0
- package/tgpuComputeFn-DH8_PcIR.d.ts +3042 -0
- package/attributes-BcDZsQCE.d.cts +0 -159
- package/attributes-DsIdcdq4.d.ts +0 -159
- package/chunk-A6AAWPBU.cjs +0 -2
- package/chunk-A6AAWPBU.cjs.map +0 -1
- package/chunk-HZAXWB4J.js +0 -2
- package/chunk-HZAXWB4J.js.map +0 -1
- package/chunk-T5Y2EQPZ.js +0 -4
- package/chunk-T5Y2EQPZ.js.map +0 -1
- package/chunk-VUYQ2ZIK.cjs +0 -4
- package/chunk-VUYQ2ZIK.cjs.map +0 -1
- package/dataTypes-ts2Ccted.d.cts +0 -1382
- package/dataTypes-ts2Ccted.d.ts +0 -1382
- package/sampler-CPNwYXSH.d.ts +0 -369
- package/sampler-DeX4AnIZ.d.cts +0 -369
package/std/index.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import { cS as TgpuDualFn, cT as AnyNumericVecInstance, cU as AnyMatInstance, cV as vBaseForMat, cW as AnyFloatVecInstance, bx as v3f, cX as v3h, bt as v2f, cY as v2h, bu as v2i, by as v3i, bB as v4f, cZ as v4h, bC as v4i, bl as AnyVecInstance, c_ as AnyVec2Instance, bs as v2b, c$ as AnyVec3Instance, bw as v3b, bA as v4b, d0 as AnyBooleanVecInstance, d1 as atomicI32, d2 as atomicU32, ac as TgpuSampledTexture, d3 as TgpuStorageTexture, bv as v2u, bz as v3u, d4 as TexelData, bD as v4u, d5 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-DH8_PcIR.cjs';
|
2
|
+
import 'tinyest';
|
3
3
|
|
4
4
|
declare const discard: TgpuDualFn<() => never>;
|
5
5
|
|
@@ -62,6 +62,7 @@ declare const max: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T,
|
|
62
62
|
* https://www.w3.org/TR/WGSL/#min-float-builtin
|
63
63
|
*/
|
64
64
|
declare const min: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
|
65
|
+
declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
|
65
66
|
/**
|
66
67
|
* @privateRemarks
|
67
68
|
* https://www.w3.org/TR/WGSL/#sin-builtin
|
@@ -86,6 +87,8 @@ declare const mix: MixOverload;
|
|
86
87
|
declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
|
87
88
|
declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
|
88
89
|
declare const neg: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
|
90
|
+
declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
91
|
+
declare const div: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(lhs: T, rhs: T | number) => T)>;
|
89
92
|
|
90
93
|
/**
|
91
94
|
* Checks whether `lhs == rhs` on all components.
|
@@ -196,13 +199,15 @@ declare const any: TgpuDualFn<(value: AnyBooleanVecInstance) => boolean>;
|
|
196
199
|
*/
|
197
200
|
declare const isCloseTo: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(lhs: T, rhs: T, precision?: number) => boolean)>;
|
198
201
|
type SelectOverload = {
|
199
|
-
<T extends
|
202
|
+
<T extends number | boolean | AnyVecInstance>(f: T, t: T, cond: boolean): T;
|
200
203
|
<T extends AnyVecInstance>(f: T, t: T, cond: T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b): T;
|
201
204
|
};
|
202
205
|
/**
|
203
206
|
* Returns `t` if `cond` is `true`, and `f` otherwise.
|
204
207
|
* Component-wise if `cond` is a vector.
|
205
208
|
* @example
|
209
|
+
* select(1, 2, false) // returns 1
|
210
|
+
* select(1, 2, true) // returns 2
|
206
211
|
* select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
|
207
212
|
* select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
|
208
213
|
*/
|
@@ -256,5 +261,49 @@ type TextureSampleOverload = {
|
|
256
261
|
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number): v4f;
|
257
262
|
};
|
258
263
|
declare const textureSample: TextureSampleOverload;
|
264
|
+
type TextureSampleLevelOverload = {
|
265
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, sampler: TgpuSampler, coords: v2f, level: number, offset?: v2i): v4f;
|
266
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, sampler: TgpuSampler, coords: v2f, arrayIndex: number, level: number, offset?: v2i): v4f;
|
267
|
+
<T extends TgpuSampledTexture<'3d' | 'cube'>>(texture: T, sampler: TgpuSampler, coords: v3f, level: number, offset?: v3i): v4f;
|
268
|
+
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number, level: number): v4f;
|
269
|
+
};
|
270
|
+
declare const textureSampleLevel: TextureSampleLevelOverload;
|
271
|
+
type TexelDataToInstance<TF extends TexelData> = {
|
272
|
+
vec4f: v4f;
|
273
|
+
vec4i: v4i;
|
274
|
+
vec4u: v4u;
|
275
|
+
}[TF['type']];
|
276
|
+
type SampleTypeToInstance<TF extends ChannelData> = {
|
277
|
+
u32: v4u;
|
278
|
+
i32: v4i;
|
279
|
+
f32: v4f;
|
280
|
+
}[TF['type']];
|
281
|
+
type TextureLoadOverload = {
|
282
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number): TexelDataToInstance<T['texelDataType']>;
|
283
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u): TexelDataToInstance<T['texelDataType']>;
|
284
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number): TexelDataToInstance<T['texelDataType']>;
|
285
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u): TexelDataToInstance<T['texelDataType']>;
|
286
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, coords: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
287
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, coords: v2i | v2u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
288
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
289
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, coords: v3i | v3u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
290
|
+
};
|
291
|
+
declare const textureLoad: TextureLoadOverload;
|
292
|
+
type TextureStoreOverload = {
|
293
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
294
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u, value: TexelDataToInstance<T['texelDataType']>): void;
|
295
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
296
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u, value: TexelDataToInstance<T['texelDataType']>): void;
|
297
|
+
};
|
298
|
+
declare const textureStore: TextureStoreOverload;
|
299
|
+
type TextureDimensionsOverload = {
|
300
|
+
<T extends TgpuSampledTexture<'1d'> | TgpuStorageTexture<'1d'>>(texture: T): number;
|
301
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, level: number): number;
|
302
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'> | TgpuStorageTexture<'2d'> | TgpuStorageTexture<'2d-array'>>(texture: T): v2u;
|
303
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'>>(texture: T, level: number): v2u;
|
304
|
+
<T extends TgpuSampledTexture<'3d'> | TgpuStorageTexture<'3d'>>(texture: T): v3u;
|
305
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, level: number): v3u;
|
306
|
+
};
|
307
|
+
declare const textureDimensions: TextureDimensionsOverload;
|
259
308
|
|
260
|
-
export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sin, storageBarrier, sub, textureBarrier, textureSample, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
309
|
+
export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, div, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sign, sin, sqrt, storageBarrier, sub, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
package/std/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import { cS as TgpuDualFn, cT as AnyNumericVecInstance, cU as AnyMatInstance, cV as vBaseForMat, cW as AnyFloatVecInstance, bx as v3f, cX as v3h, bt as v2f, cY as v2h, bu as v2i, by as v3i, bB as v4f, cZ as v4h, bC as v4i, bl as AnyVecInstance, c_ as AnyVec2Instance, bs as v2b, c$ as AnyVec3Instance, bw as v3b, bA as v4b, d0 as AnyBooleanVecInstance, d1 as atomicI32, d2 as atomicU32, ac as TgpuSampledTexture, d3 as TgpuStorageTexture, bv as v2u, bz as v3u, d4 as TexelData, bD as v4u, d5 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-DH8_PcIR.js';
|
2
|
+
import 'tinyest';
|
3
3
|
|
4
4
|
declare const discard: TgpuDualFn<() => never>;
|
5
5
|
|
@@ -62,6 +62,7 @@ declare const max: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T,
|
|
62
62
|
* https://www.w3.org/TR/WGSL/#min-float-builtin
|
63
63
|
*/
|
64
64
|
declare const min: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
|
65
|
+
declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
|
65
66
|
/**
|
66
67
|
* @privateRemarks
|
67
68
|
* https://www.w3.org/TR/WGSL/#sin-builtin
|
@@ -86,6 +87,8 @@ declare const mix: MixOverload;
|
|
86
87
|
declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
|
87
88
|
declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
|
88
89
|
declare const neg: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
|
90
|
+
declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
91
|
+
declare const div: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(lhs: T, rhs: T | number) => T)>;
|
89
92
|
|
90
93
|
/**
|
91
94
|
* Checks whether `lhs == rhs` on all components.
|
@@ -196,13 +199,15 @@ declare const any: TgpuDualFn<(value: AnyBooleanVecInstance) => boolean>;
|
|
196
199
|
*/
|
197
200
|
declare const isCloseTo: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(lhs: T, rhs: T, precision?: number) => boolean)>;
|
198
201
|
type SelectOverload = {
|
199
|
-
<T extends
|
202
|
+
<T extends number | boolean | AnyVecInstance>(f: T, t: T, cond: boolean): T;
|
200
203
|
<T extends AnyVecInstance>(f: T, t: T, cond: T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b): T;
|
201
204
|
};
|
202
205
|
/**
|
203
206
|
* Returns `t` if `cond` is `true`, and `f` otherwise.
|
204
207
|
* Component-wise if `cond` is a vector.
|
205
208
|
* @example
|
209
|
+
* select(1, 2, false) // returns 1
|
210
|
+
* select(1, 2, true) // returns 2
|
206
211
|
* select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
|
207
212
|
* select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
|
208
213
|
*/
|
@@ -256,5 +261,49 @@ type TextureSampleOverload = {
|
|
256
261
|
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number): v4f;
|
257
262
|
};
|
258
263
|
declare const textureSample: TextureSampleOverload;
|
264
|
+
type TextureSampleLevelOverload = {
|
265
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, sampler: TgpuSampler, coords: v2f, level: number, offset?: v2i): v4f;
|
266
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, sampler: TgpuSampler, coords: v2f, arrayIndex: number, level: number, offset?: v2i): v4f;
|
267
|
+
<T extends TgpuSampledTexture<'3d' | 'cube'>>(texture: T, sampler: TgpuSampler, coords: v3f, level: number, offset?: v3i): v4f;
|
268
|
+
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number, level: number): v4f;
|
269
|
+
};
|
270
|
+
declare const textureSampleLevel: TextureSampleLevelOverload;
|
271
|
+
type TexelDataToInstance<TF extends TexelData> = {
|
272
|
+
vec4f: v4f;
|
273
|
+
vec4i: v4i;
|
274
|
+
vec4u: v4u;
|
275
|
+
}[TF['type']];
|
276
|
+
type SampleTypeToInstance<TF extends ChannelData> = {
|
277
|
+
u32: v4u;
|
278
|
+
i32: v4i;
|
279
|
+
f32: v4f;
|
280
|
+
}[TF['type']];
|
281
|
+
type TextureLoadOverload = {
|
282
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number): TexelDataToInstance<T['texelDataType']>;
|
283
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u): TexelDataToInstance<T['texelDataType']>;
|
284
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number): TexelDataToInstance<T['texelDataType']>;
|
285
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u): TexelDataToInstance<T['texelDataType']>;
|
286
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, coords: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
287
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, coords: v2i | v2u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
288
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
289
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, coords: v3i | v3u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
290
|
+
};
|
291
|
+
declare const textureLoad: TextureLoadOverload;
|
292
|
+
type TextureStoreOverload = {
|
293
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
294
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u, value: TexelDataToInstance<T['texelDataType']>): void;
|
295
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
296
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u, value: TexelDataToInstance<T['texelDataType']>): void;
|
297
|
+
};
|
298
|
+
declare const textureStore: TextureStoreOverload;
|
299
|
+
type TextureDimensionsOverload = {
|
300
|
+
<T extends TgpuSampledTexture<'1d'> | TgpuStorageTexture<'1d'>>(texture: T): number;
|
301
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, level: number): number;
|
302
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'> | TgpuStorageTexture<'2d'> | TgpuStorageTexture<'2d-array'>>(texture: T): v2u;
|
303
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'>>(texture: T, level: number): v2u;
|
304
|
+
<T extends TgpuSampledTexture<'3d'> | TgpuStorageTexture<'3d'>>(texture: T): v3u;
|
305
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, level: number): v3u;
|
306
|
+
};
|
307
|
+
declare const textureDimensions: TextureDimensionsOverload;
|
259
308
|
|
260
|
-
export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sin, storageBarrier, sub, textureBarrier, textureSample, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
309
|
+
export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, div, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sign, sin, sqrt, storageBarrier, sub, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
package/std/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{A as x,B as y,C as T,D as p,E as z,F as u,G as ee,H as te,I as ne,M as S,N as O,P as U,R as F,Z as h,p as s,r as o,s as i,t as m,u as f,v,w as l,x as w,y as d,z as g}from"../chunk-T5Y2EQPZ.js";var he=s(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:F}));var R=e=>Math.sqrt(e.x**2+e.y**2),K=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),N=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),D=(e,t)=>e.x*t.x+e.y*t.y,P=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,G=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,r=(e,t,n)=>Math.min(Math.max(t,e),n),b=e=>t=>o(e(t.x),e(t.y)),M=e=>t=>i(e(t.x),e(t.y)),q=e=>t=>m(e(t.x),e(t.y)),J=e=>t=>f(e(t.x),e(t.y)),A=e=>t=>l(e(t.x),e(t.y),e(t.z)),V=e=>t=>w(e(t.x),e(t.y),e(t.z)),L=e=>t=>d(e(t.x),e(t.y),e(t.z)),j=e=>t=>g(e(t.x),e(t.y),e(t.z)),I=e=>t=>y(e(t.x),e(t.y),e(t.z),e(t.w)),$=e=>t=>T(e(t.x),e(t.y),e(t.z),e(t.w)),X=e=>t=>p(e(t.x),e(t.y),e(t.z),e(t.w)),Z=e=>t=>z(e(t.x),e(t.y),e(t.z),e(t.w)),ae=e=>(t,n)=>o(e(t.x,n.x),e(t.y,n.y)),se=e=>(t,n)=>i(e(t.x,n.x),e(t.y,n.y)),xe=e=>(t,n)=>m(e(t.x,n.x),e(t.y,n.y)),ue=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y)),re=e=>(t,n)=>l(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ce=e=>(t,n)=>w(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),we=e=>(t,n)=>d(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ie=e=>(t,n)=>g(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ye=e=>(t,n)=>y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),oe=e=>(t,n)=>T(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),Te=e=>(t,n)=>p(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),me=e=>(t,n)=>z(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),c={eq:{vec2f:(e,t)=>v(e.x===t.x,e.y===t.y),vec2h:(e,t)=>v(e.x===t.x,e.y===t.y),vec2i:(e,t)=>v(e.x===t.x,e.y===t.y),vec2u:(e,t)=>v(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>v(e.x===t.x,e.y===t.y),vec3f:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>v(e.x<t.x,e.y<t.y),vec2h:(e,t)=>v(e.x<t.x,e.y<t.y),vec2i:(e,t)=>v(e.x<t.x,e.y<t.y),vec2u:(e,t)=>v(e.x<t.x,e.y<t.y),vec3f:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>v(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>x(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>u(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:b(Math.abs),vec2h:M(Math.abs),vec2i:q(Math.abs),vec2u:J(Math.abs),vec3f:A(Math.abs),vec3h:V(Math.abs),vec3i:L(Math.abs),vec3u:j(Math.abs),vec4f:I(Math.abs),vec4h:$(Math.abs),vec4i:X(Math.abs),vec4u:Z(Math.abs)},atan2:{vec2f:ae(Math.atan2),vec2h:se(Math.atan2),vec3f:re(Math.atan2),vec3h:ce(Math.atan2),vec4f:ye(Math.atan2),vec4h:oe(Math.atan2)},acos:{vec2f:b(Math.acos),vec2h:M(Math.acos),vec2i:q(Math.acos),vec2u:J(Math.acos),vec3f:A(Math.acos),vec3h:V(Math.acos),vec3i:L(Math.acos),vec3u:j(Math.acos),vec4f:I(Math.acos),vec4h:$(Math.acos),vec4i:X(Math.acos),vec4u:Z(Math.acos)},asin:{vec2f:b(Math.asin),vec2h:M(Math.asin),vec2i:q(Math.asin),vec2u:J(Math.asin),vec3f:A(Math.asin),vec3h:V(Math.asin),vec3i:L(Math.asin),vec3u:j(Math.asin),vec4f:I(Math.asin),vec4h:$(Math.asin),vec4i:X(Math.asin),vec4u:Z(Math.asin)},ceil:{vec2f:b(Math.ceil),vec2h:M(Math.ceil),vec3f:A(Math.ceil),vec3h:V(Math.ceil),vec4f:I(Math.ceil),vec4h:$(Math.ceil)},clamp:{vec2f:(e,t,n)=>o(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2h:(e,t,n)=>i(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2i:(e,t,n)=>m(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2u:(e,t,n)=>f(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec3f:(e,t,n)=>l(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3h:(e,t,n)=>w(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3i:(e,t,n)=>d(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3u:(e,t,n)=>g(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec4f:(e,t,n)=>y(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4h:(e,t,n)=>T(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4i:(e,t,n)=>p(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4u:(e,t,n)=>z(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w))},length:{vec2f:R,vec2h:R,vec3f:K,vec3h:K,vec4f:N,vec4h:N},add:{vec2f:(e,t)=>o(e.x+t.x,e.y+t.y),vec2h:(e,t)=>i(e.x+t.x,e.y+t.y),vec2i:(e,t)=>m(e.x+t.x,e.y+t.y),vec2u:(e,t)=>f(e.x+t.x,e.y+t.y),vec3f:(e,t)=>l(e.x+t.x,e.y+t.y,e.z+t.z),vec3h:(e,t)=>w(e.x+t.x,e.y+t.y,e.z+t.z),vec3i:(e,t)=>d(e.x+t.x,e.y+t.y,e.z+t.z),vec3u:(e,t)=>g(e.x+t.x,e.y+t.y,e.z+t.z),vec4f:(e,t)=>y(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4h:(e,t)=>T(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4i:(e,t)=>p(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4u:(e,t)=>z(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w)},sub:{vec2f:(e,t)=>o(e.x-t.x,e.y-t.y),vec2h:(e,t)=>i(e.x-t.x,e.y-t.y),vec2i:(e,t)=>m(e.x-t.x,e.y-t.y),vec2u:(e,t)=>f(e.x-t.x,e.y-t.y),vec3f:(e,t)=>l(e.x-t.x,e.y-t.y,e.z-t.z),vec3h:(e,t)=>w(e.x-t.x,e.y-t.y,e.z-t.z),vec3i:(e,t)=>d(e.x-t.x,e.y-t.y,e.z-t.z),vec3u:(e,t)=>g(e.x-t.x,e.y-t.y,e.z-t.z),vec4f:(e,t)=>y(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4h:(e,t)=>T(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4i:(e,t)=>p(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4u:(e,t)=>z(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w)},mulSxV:{vec2f:(e,t)=>o(e*t.x,e*t.y),vec2h:(e,t)=>i(e*t.x,e*t.y),vec2i:(e,t)=>m(e*t.x,e*t.y),vec2u:(e,t)=>f(e*t.x,e*t.y),vec3f:(e,t)=>l(e*t.x,e*t.y,e*t.z),vec3h:(e,t)=>w(e*t.x,e*t.y,e*t.z),vec3i:(e,t)=>d(e*t.x,e*t.y,e*t.z),vec3u:(e,t)=>g(e*t.x,e*t.y,e*t.z),vec4f:(e,t)=>y(e*t.x,e*t.y,e*t.z,e*t.w),vec4h:(e,t)=>T(e*t.x,e*t.y,e*t.z,e*t.w),vec4i:(e,t)=>p(e*t.x,e*t.y,e*t.z,e*t.w),vec4u:(e,t)=>z(e*t.x,e*t.y,e*t.z,e*t.w),mat2x2f:(e,t)=>{let n=t.columns;return ee(e*n[0].x,e*n[0].y,e*n[1].x,e*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return te(e*n[0].x,e*n[0].y,e*n[0].z,e*n[1].x,e*n[1].y,e*n[1].z,e*n[2].x,e*n[2].y,e*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return ne(e*n[0].x,e*n[0].y,e*n[0].z,e*n[0].w,e*n[1].x,e*n[1].y,e*n[1].z,e*n[1].w,e*n[2].x,e*n[2].y,e*n[2].z,e*n[2].w,e*n[3].x,e*n[3].y,e*n[3].z,e*n[3].w)}},mulVxV:{vec2f:(e,t)=>o(e.x*t.x,e.y*t.y),vec2h:(e,t)=>i(e.x*t.x,e.y*t.y),vec2i:(e,t)=>m(e.x*t.x,e.y*t.y),vec2u:(e,t)=>f(e.x*t.x,e.y*t.y),vec3f:(e,t)=>l(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>w(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>y(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4h:(e,t)=>T(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4i:(e,t)=>p(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>z(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),mat2x2f:(e,t)=>{let n=e.columns,a=t.columns;return ee(n[0].x*a[0].x+n[1].x*a[0].y,n[0].y*a[0].x+n[1].y*a[0].y,n[0].x*a[1].x+n[1].x*a[1].y,n[0].y*a[1].x+n[1].y*a[1].y)},mat3x3f:(e,t)=>{let n=e.columns,a=t.columns;return te(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z)},mat4x4f:(e,t)=>{let n=e.columns,a=t.columns;return ne(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z+n[3].x*a[0].w,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z+n[3].y*a[0].w,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z+n[3].z*a[0].w,n[0].w*a[0].x+n[1].w*a[0].y+n[2].w*a[0].z+n[3].w*a[0].w,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z+n[3].x*a[1].w,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z+n[3].y*a[1].w,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z+n[3].z*a[1].w,n[0].w*a[1].x+n[1].w*a[1].y+n[2].w*a[1].z+n[3].w*a[1].w,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z+n[3].x*a[2].w,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z+n[3].y*a[2].w,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z+n[3].z*a[2].w,n[0].w*a[2].x+n[1].w*a[2].y+n[2].w*a[2].z+n[3].w*a[2].w,n[0].x*a[3].x+n[1].x*a[3].y+n[2].x*a[3].z+n[3].x*a[3].w,n[0].y*a[3].x+n[1].y*a[3].y+n[2].y*a[3].z+n[3].y*a[3].w,n[0].z*a[3].x+n[1].z*a[3].y+n[2].z*a[3].z+n[3].z*a[3].w,n[0].w*a[3].x+n[1].w*a[3].y+n[2].w*a[3].z+n[3].w*a[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return o(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return l(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return y(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return o(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return l(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return y(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},dot:{vec2f:D,vec2h:D,vec2i:D,vec2u:D,vec3f:P,vec3h:P,vec3i:P,vec3u:P,vec4f:G,vec4h:G,vec4i:G,vec4u:G},normalize:{vec2f:e=>{let t=R(e);return o(e.x/t,e.y/t)},vec2h:e=>{let t=R(e);return i(e.x/t,e.y/t)},vec2i:e=>{let t=R(e);return m(e.x/t,e.y/t)},vec2u:e=>{let t=R(e);return f(e.x/t,e.y/t)},vec3f:e=>{let t=K(e);return l(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=K(e);return w(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=K(e);return d(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=K(e);return g(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=N(e);return y(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=N(e);return T(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=N(e);return p(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=N(e);return z(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>l(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>w(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},floor:{vec2f:b(Math.floor),vec2h:M(Math.floor),vec3f:A(Math.floor),vec3h:V(Math.floor),vec4f:I(Math.floor),vec4h:$(Math.floor)},max:{vec2f:ae(Math.max),vec2h:se(Math.max),vec2i:xe(Math.max),vec2u:ue(Math.max),vec3f:re(Math.max),vec3h:ce(Math.max),vec3i:we(Math.max),vec3u:ie(Math.max),vec4f:ye(Math.max),vec4h:oe(Math.max),vec4i:Te(Math.max),vec4u:me(Math.max)},min:{vec2f:ae(Math.min),vec2h:se(Math.min),vec2i:xe(Math.min),vec2u:ue(Math.min),vec3f:re(Math.min),vec3h:ce(Math.min),vec3i:we(Math.min),vec3u:ie(Math.min),vec4f:ye(Math.min),vec4h:oe(Math.min),vec4i:Te(Math.min),vec4u:me(Math.min)},pow:{vec2f:(e,t)=>o(e.x**t.x,e.y**t.y),vec2h:(e,t)=>i(e.x**t.x,e.y**t.y),vec3f:(e,t)=>l(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>w(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>y(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>T(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},mix:{vec2f:(e,t,n)=>typeof n=="number"?o(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):o(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):i(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?l(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):l(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?w(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):w(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?y(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):y(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?T(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):T(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:b(Math.sin),vec2h:M(Math.sin),vec3f:A(Math.sin),vec3h:V(Math.sin),vec4f:I(Math.sin),vec4h:$(Math.sin)},cos:{vec2f:b(Math.cos),vec2h:M(Math.cos),vec3f:A(Math.cos),vec3h:V(Math.cos),vec4f:I(Math.cos),vec4h:$(Math.cos)},exp:{vec2f:b(Math.exp),vec2h:M(Math.exp),vec3f:A(Math.exp),vec3h:V(Math.exp),vec4f:I(Math.exp),vec4h:$(Math.exp)},fract:{vec2f:b(e=>e-Math.floor(e)),vec2h:M(e=>e-Math.floor(e)),vec3f:A(e=>e-Math.floor(e)),vec3h:V(e=>e-Math.floor(e)),vec4f:I(e=>e-Math.floor(e)),vec4h:$(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:b(e=>-e),vec2h:M(e=>-e),vec2i:q(e=>-e),vec2u:J(e=>-e),"vec2<bool>":e=>v(!e.x,!e.y),vec3f:A(e=>-e),vec3h:V(e=>-e),vec3i:L(e=>-e),vec3u:j(e=>-e),"vec3<bool>":e=>x(!e.x,!e.y,!e.z),vec4f:I(e=>-e),vec4h:$(e=>-e),vec4i:X(e=>-e),vec4u:Z(e=>-e),"vec4<bool>":e=>u(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>v(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>g(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>x(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>p(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>z(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>u(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)}};function W(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var be=s((e,t)=>c.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType})),_=s((e,t)=>c.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType})),fe=s((e,t)=>{if(typeof e=="number")return c.mulSxV[t.kind](e,t);if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t){let n=!e.kind.startsWith("mat"),a=!t.kind.startsWith("mat");if(!n&&a)return c.mulMxV[e.kind](e,t);if(n&&!a)return c.mulVxM[t.kind](e,t)}return c.mulVxV[t.kind](e,t)},(e,t)=>{let n=W(e)?t.dataType:e.dataType.type.startsWith("mat")?t.dataType.type.startsWith("mat")?e.dataType:t.dataType:e.dataType;return{value:`(${e.value} * ${t.value})`,dataType:n}}),Me=s(e=>typeof e=="number"?Math.abs(e):c.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),Ae=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):c.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),Ve=s(e=>typeof e=="number"?Math.acos(e):c.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Ie=s(e=>typeof e=="number"?Math.asin(e):c.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),$e=s(e=>typeof e=="number"?Math.ceil(e):c.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Be=s((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):c.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),ke=s(e=>typeof e=="number"?Math.cos(e):c.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Se=s((e,t)=>c.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),de=s((e,t)=>c.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:U})),Oe=s(e=>c.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Fe=s(e=>typeof e=="number"?Math.floor(e):c.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Ue=s(e=>typeof e=="number"?e-Math.floor(e):c.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),ge=s(e=>typeof e=="number"?Math.abs(e):c.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:U})),Re=s((e,t)=>typeof e=="number"?Math.max(e,t):c.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType})),Ke=s((e,t)=>typeof e=="number"?Math.min(e,t):c.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType})),Ne=s(e=>typeof e=="number"?Math.sin(e):c.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),We=s(e=>typeof e=="number"?Math.exp(e):c.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Ee=s((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return c.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),_e=s((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return c.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ce=s((e,t)=>_(e,fe(2*de(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),De=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):ge(_(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:U})),Pe=s(e=>typeof e=="number"?-e:c.neg[e.kind](e),e=>({value:`-(${e.value})`,dataType:e.dataType}));function E(e){return e.dataType.type.includes("2")?v:e.dataType.type.includes("3")?x:u}var Ge=s((e,t)=>ve(C(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:S})),C=s((e,t)=>c.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:E(e)})),qe=s((e,t)=>k(C(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:E(e)})),H=s((e,t)=>c.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:E(e)})),Je=s((e,t)=>le(H(e,t),C(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:E(e)})),Le=s((e,t)=>pe(k(H(e,t)),k(C(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:E(e)})),je=s((e,t)=>k(H(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:E(e)})),k=s(e=>c.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),le=s((e,t)=>c.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),pe=s((e,t)=>k(le(k(e),k(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),ve=s(e=>c.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:S})),Xe=s(e=>!ve(k(e)),e=>({value:`any(${e.value})`,dataType:S})),Ze=s((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?c.isCloseToZero[e.kind](_(e,t),n):!1,(e,t,n={value:.01,dataType:U})=>W(e)&&W(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:S}:!W(e)&&!W(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:S}:{value:"false",dataType:S}),He=s((e,t,n)=>typeof n=="boolean"?n?t:e:c.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var Qe=s(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:F})),Ye=s(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:F})),et=s(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:F})),tt=s(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicLoad(&${e.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),nt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!h(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return{value:`atomicStore(&${e.value}, ${t.value})`,dataType:F}}),at=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAdd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),st=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicSub(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),rt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMax(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ct=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMin(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),yt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAnd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ot=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicOr(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),lt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicXor(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)});var vt=s(e=>e.length,e=>({value:`arrayLength(&${e.value})`,dataType:O}));import*as B from"typed-binary";var xt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return o(a.readFloat16(),a.readFloat16())},e=>({value:`unpack2x16float(${e.value})`,dataType:o})),ut=s(e=>{let t=new ArrayBuffer(4),n=new B.BufferWriter(t);n.writeFloat16(e.x),n.writeFloat16(e.y);let a=new B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack2x16float(${e.value})`,dataType:O})),wt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return y(a.readUint8()/255,a.readUint8()/255,a.readUint8()/255,a.readUint8()/255)},e=>({value:`unpack4x8unorm(${e.value})`,dataType:y})),it=s(e=>{let t=new ArrayBuffer(4),n=new B.BufferWriter(t);n.writeUint8(e.x*255),n.writeUint8(e.y*255),n.writeUint8(e.z*255),n.writeUint8(e.w*255);let a=new B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack4x8unorm(${e.value})`,dataType:O}));var Tt=s((e,t,n,a,Q)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,Q)=>{let Y=[e,t,n];return a!==void 0&&Y.push(a),Q!==void 0&&Y.push(Q),{value:`textureSample(${Y.map(ze=>ze.value).join(", ")})`,dataType:y}});export{Me as abs,Ve as acos,be as add,ve as all,Ge as allEq,pe as and,Xe as any,vt as arrayLength,Ie as asin,Ae as atan2,at as atomicAdd,yt as atomicAnd,tt as atomicLoad,rt as atomicMax,ct as atomicMin,ot as atomicOr,nt as atomicStore,st as atomicSub,lt as atomicXor,$e as ceil,Be as clamp,ke as cos,Se as cross,he as discard,De as distance,de as dot,C as eq,We as exp,Fe as floor,Ue as fract,je as ge,Le as gt,Ze as isCloseTo,Je as le,ge as length,H as lt,Re as max,Ke as min,_e as mix,fe as mul,qe as ne,Pe as neg,Oe as normalize,k as not,le as or,ut as pack2x16float,it as pack4x8unorm,Ee as pow,Ce as reflect,He as select,Ne as sin,Ye as storageBarrier,_ as sub,et as textureBarrier,Tt as textureSample,xt as unpack2x16float,wt as unpack4x8unorm,Qe as workgroupBarrier};
|
1
|
+
import{$ as i,A as S,N as r,Q as U,R as I,S as ge,T as R,V as u,W as w,X as $,Y as p,Z as l,_ as y,aa as B,ba as m,ca as x,da as o,ea as d,fa as g,ga as f,ha as T,ja as ue,ka as ye,la as ve,na as fe,t as O}from"../chunk-5RYM4COI.js";var Ae=r(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:O}));var K=e=>Math.sqrt(e.x**2+e.y**2),_=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),W=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),j=(e,t)=>e.x*t.x+e.y*t.y,X=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,Z=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,c=(e,t,n)=>Math.min(Math.max(t,e),n),z=e=>t=>u(e(t.x),e(t.y)),h=e=>t=>w(e(t.x),e(t.y)),P=e=>t=>$(e(t.x),e(t.y)),H=e=>t=>p(e(t.x),e(t.y)),b=e=>t=>y(e(t.x),e(t.y),e(t.z)),M=e=>t=>i(e(t.x),e(t.y),e(t.z)),C=e=>t=>B(e(t.x),e(t.y),e(t.z)),Q=e=>t=>m(e(t.x),e(t.y),e(t.z)),A=e=>t=>o(e(t.x),e(t.y),e(t.z),e(t.w)),V=e=>t=>d(e(t.x),e(t.y),e(t.z),e(t.w)),G=e=>t=>g(e(t.x),e(t.y),e(t.z),e(t.w)),Y=e=>t=>f(e(t.x),e(t.y),e(t.z),e(t.w)),ee=e=>(t,n)=>u(e(t.x,n.x),e(t.y,n.y)),te=e=>(t,n)=>w(e(t.x,n.x),e(t.y,n.y)),le=e=>(t,n)=>$(e(t.x,n.x),e(t.y,n.y)),xe=e=>(t,n)=>p(e(t.x,n.x),e(t.y,n.y)),ne=e=>(t,n)=>y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ae=e=>(t,n)=>i(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),Te=e=>(t,n)=>B(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ie=e=>(t,n)=>m(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),re=e=>(t,n)=>o(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),se=e=>(t,n)=>d(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),we=e=>(t,n)=>g(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),de=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),s={eq:{vec2f:(e,t)=>l(e.x===t.x,e.y===t.y),vec2h:(e,t)=>l(e.x===t.x,e.y===t.y),vec2i:(e,t)=>l(e.x===t.x,e.y===t.y),vec2u:(e,t)=>l(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>l(e.x===t.x,e.y===t.y),vec3f:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>l(e.x<t.x,e.y<t.y),vec2h:(e,t)=>l(e.x<t.x,e.y<t.y),vec2i:(e,t)=>l(e.x<t.x,e.y<t.y),vec2u:(e,t)=>l(e.x<t.x,e.y<t.y),vec3f:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>l(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>x(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>T(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:z(Math.abs),vec2h:h(Math.abs),vec2i:P(Math.abs),vec2u:H(Math.abs),vec3f:b(Math.abs),vec3h:M(Math.abs),vec3i:C(Math.abs),vec3u:Q(Math.abs),vec4f:A(Math.abs),vec4h:V(Math.abs),vec4i:G(Math.abs),vec4u:Y(Math.abs)},atan2:{vec2f:ee(Math.atan2),vec2h:te(Math.atan2),vec3f:ne(Math.atan2),vec3h:ae(Math.atan2),vec4f:re(Math.atan2),vec4h:se(Math.atan2)},acos:{vec2f:z(Math.acos),vec2h:h(Math.acos),vec2i:P(Math.acos),vec2u:H(Math.acos),vec3f:b(Math.acos),vec3h:M(Math.acos),vec3i:C(Math.acos),vec3u:Q(Math.acos),vec4f:A(Math.acos),vec4h:V(Math.acos),vec4i:G(Math.acos),vec4u:Y(Math.acos)},asin:{vec2f:z(Math.asin),vec2h:h(Math.asin),vec2i:P(Math.asin),vec2u:H(Math.asin),vec3f:b(Math.asin),vec3h:M(Math.asin),vec3i:C(Math.asin),vec3u:Q(Math.asin),vec4f:A(Math.asin),vec4h:V(Math.asin),vec4i:G(Math.asin),vec4u:Y(Math.asin)},ceil:{vec2f:z(Math.ceil),vec2h:h(Math.ceil),vec3f:b(Math.ceil),vec3h:M(Math.ceil),vec4f:A(Math.ceil),vec4h:V(Math.ceil)},clamp:{vec2f:(e,t,n)=>u(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2h:(e,t,n)=>w(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2i:(e,t,n)=>$(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2u:(e,t,n)=>p(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec3f:(e,t,n)=>y(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3h:(e,t,n)=>i(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3i:(e,t,n)=>B(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3u:(e,t,n)=>m(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec4f:(e,t,n)=>o(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4h:(e,t,n)=>d(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4i:(e,t,n)=>g(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4u:(e,t,n)=>f(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w))},length:{vec2f:K,vec2h:K,vec3f:_,vec3h:_,vec4f:W,vec4h:W},add:{vec2f:(e,t)=>u(e.x+t.x,e.y+t.y),vec2h:(e,t)=>w(e.x+t.x,e.y+t.y),vec2i:(e,t)=>$(e.x+t.x,e.y+t.y),vec2u:(e,t)=>p(e.x+t.x,e.y+t.y),vec3f:(e,t)=>y(e.x+t.x,e.y+t.y,e.z+t.z),vec3h:(e,t)=>i(e.x+t.x,e.y+t.y,e.z+t.z),vec3i:(e,t)=>B(e.x+t.x,e.y+t.y,e.z+t.z),vec3u:(e,t)=>m(e.x+t.x,e.y+t.y,e.z+t.z),vec4f:(e,t)=>o(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4h:(e,t)=>d(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4i:(e,t)=>g(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4u:(e,t)=>f(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w)},sub:{vec2f:(e,t)=>u(e.x-t.x,e.y-t.y),vec2h:(e,t)=>w(e.x-t.x,e.y-t.y),vec2i:(e,t)=>$(e.x-t.x,e.y-t.y),vec2u:(e,t)=>p(e.x-t.x,e.y-t.y),vec3f:(e,t)=>y(e.x-t.x,e.y-t.y,e.z-t.z),vec3h:(e,t)=>i(e.x-t.x,e.y-t.y,e.z-t.z),vec3i:(e,t)=>B(e.x-t.x,e.y-t.y,e.z-t.z),vec3u:(e,t)=>m(e.x-t.x,e.y-t.y,e.z-t.z),vec4f:(e,t)=>o(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4h:(e,t)=>d(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4i:(e,t)=>g(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4u:(e,t)=>f(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w)},mulSxV:{vec2f:(e,t)=>u(e*t.x,e*t.y),vec2h:(e,t)=>w(e*t.x,e*t.y),vec2i:(e,t)=>$(e*t.x,e*t.y),vec2u:(e,t)=>p(e*t.x,e*t.y),vec3f:(e,t)=>y(e*t.x,e*t.y,e*t.z),vec3h:(e,t)=>i(e*t.x,e*t.y,e*t.z),vec3i:(e,t)=>B(e*t.x,e*t.y,e*t.z),vec3u:(e,t)=>m(e*t.x,e*t.y,e*t.z),vec4f:(e,t)=>o(e*t.x,e*t.y,e*t.z,e*t.w),vec4h:(e,t)=>d(e*t.x,e*t.y,e*t.z,e*t.w),vec4i:(e,t)=>g(e*t.x,e*t.y,e*t.z,e*t.w),vec4u:(e,t)=>f(e*t.x,e*t.y,e*t.z,e*t.w),mat2x2f:(e,t)=>{let n=t.columns;return ue(e*n[0].x,e*n[0].y,e*n[1].x,e*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return ye(e*n[0].x,e*n[0].y,e*n[0].z,e*n[1].x,e*n[1].y,e*n[1].z,e*n[2].x,e*n[2].y,e*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return ve(e*n[0].x,e*n[0].y,e*n[0].z,e*n[0].w,e*n[1].x,e*n[1].y,e*n[1].z,e*n[1].w,e*n[2].x,e*n[2].y,e*n[2].z,e*n[2].w,e*n[3].x,e*n[3].y,e*n[3].z,e*n[3].w)}},mulVxV:{vec2f:(e,t)=>u(e.x*t.x,e.y*t.y),vec2h:(e,t)=>w(e.x*t.x,e.y*t.y),vec2i:(e,t)=>$(e.x*t.x,e.y*t.y),vec2u:(e,t)=>p(e.x*t.x,e.y*t.y),vec3f:(e,t)=>y(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>i(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>B(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>m(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>o(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4h:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4i:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>f(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),mat2x2f:(e,t)=>{let n=e.columns,a=t.columns;return ue(n[0].x*a[0].x+n[1].x*a[0].y,n[0].y*a[0].x+n[1].y*a[0].y,n[0].x*a[1].x+n[1].x*a[1].y,n[0].y*a[1].x+n[1].y*a[1].y)},mat3x3f:(e,t)=>{let n=e.columns,a=t.columns;return ye(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z)},mat4x4f:(e,t)=>{let n=e.columns,a=t.columns;return ve(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z+n[3].x*a[0].w,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z+n[3].y*a[0].w,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z+n[3].z*a[0].w,n[0].w*a[0].x+n[1].w*a[0].y+n[2].w*a[0].z+n[3].w*a[0].w,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z+n[3].x*a[1].w,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z+n[3].y*a[1].w,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z+n[3].z*a[1].w,n[0].w*a[1].x+n[1].w*a[1].y+n[2].w*a[1].z+n[3].w*a[1].w,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z+n[3].x*a[2].w,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z+n[3].y*a[2].w,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z+n[3].z*a[2].w,n[0].w*a[2].x+n[1].w*a[2].y+n[2].w*a[2].z+n[3].w*a[2].w,n[0].x*a[3].x+n[1].x*a[3].y+n[2].x*a[3].z+n[3].x*a[3].w,n[0].y*a[3].x+n[1].y*a[3].y+n[2].y*a[3].z+n[3].y*a[3].w,n[0].z*a[3].x+n[1].z*a[3].y+n[2].z*a[3].z+n[3].z*a[3].w,n[0].w*a[3].x+n[1].w*a[3].y+n[2].w*a[3].z+n[3].w*a[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return u(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return y(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return o(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return u(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return y(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return o(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},dot:{vec2f:j,vec2h:j,vec2i:j,vec2u:j,vec3f:X,vec3h:X,vec3i:X,vec3u:X,vec4f:Z,vec4h:Z,vec4i:Z,vec4u:Z},normalize:{vec2f:e=>{let t=K(e);return u(e.x/t,e.y/t)},vec2h:e=>{let t=K(e);return w(e.x/t,e.y/t)},vec2i:e=>{let t=K(e);return $(e.x/t,e.y/t)},vec2u:e=>{let t=K(e);return p(e.x/t,e.y/t)},vec3f:e=>{let t=_(e);return y(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=_(e);return i(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=_(e);return B(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=_(e);return m(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=W(e);return o(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=W(e);return d(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=W(e);return g(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=W(e);return f(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>y(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>i(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},floor:{vec2f:z(Math.floor),vec2h:h(Math.floor),vec3f:b(Math.floor),vec3h:M(Math.floor),vec4f:A(Math.floor),vec4h:V(Math.floor)},max:{vec2f:ee(Math.max),vec2h:te(Math.max),vec2i:le(Math.max),vec2u:xe(Math.max),vec3f:ne(Math.max),vec3h:ae(Math.max),vec3i:Te(Math.max),vec3u:ie(Math.max),vec4f:re(Math.max),vec4h:se(Math.max),vec4i:we(Math.max),vec4u:de(Math.max)},min:{vec2f:ee(Math.min),vec2h:te(Math.min),vec2i:le(Math.min),vec2u:xe(Math.min),vec3f:ne(Math.min),vec3h:ae(Math.min),vec3i:Te(Math.min),vec3u:ie(Math.min),vec4f:re(Math.min),vec4h:se(Math.min),vec4i:we(Math.min),vec4u:de(Math.min)},pow:{vec2f:(e,t)=>u(e.x**t.x,e.y**t.y),vec2h:(e,t)=>w(e.x**t.x,e.y**t.y),vec3f:(e,t)=>y(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>i(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>o(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>d(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},sign:{vec2f:z(Math.sign),vec2h:h(Math.sign),vec2i:P(Math.sign),vec3f:b(Math.sign),vec3h:M(Math.sign),vec3i:C(Math.sign),vec4f:A(Math.sign),vec4h:V(Math.sign),vec4i:G(Math.sign)},sqrt:{vec2f:z(Math.sqrt),vec2h:h(Math.sqrt),vec3f:b(Math.sqrt),vec3h:M(Math.sqrt),vec4f:A(Math.sqrt),vec4h:V(Math.sqrt)},div:{vec2f:ee((e,t)=>e/t),vec2h:te((e,t)=>e/t),vec2i:le((e,t)=>e/t),vec2u:xe((e,t)=>e/t),vec3f:ne((e,t)=>e/t),vec3h:ae((e,t)=>e/t),vec3i:Te((e,t)=>e/t),vec3u:ie((e,t)=>e/t),vec4f:re((e,t)=>e/t),vec4h:se((e,t)=>e/t),vec4i:we((e,t)=>e/t),vec4u:de((e,t)=>e/t)},mix:{vec2f:(e,t,n)=>typeof n=="number"?u(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):u(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?w(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):w(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?y(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):y(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):i(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?o(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):o(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?d(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):d(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:z(Math.sin),vec2h:h(Math.sin),vec3f:b(Math.sin),vec3h:M(Math.sin),vec4f:A(Math.sin),vec4h:V(Math.sin)},cos:{vec2f:z(Math.cos),vec2h:h(Math.cos),vec3f:b(Math.cos),vec3h:M(Math.cos),vec4f:A(Math.cos),vec4h:V(Math.cos)},exp:{vec2f:z(Math.exp),vec2h:h(Math.exp),vec3f:b(Math.exp),vec3h:M(Math.exp),vec4f:A(Math.exp),vec4h:V(Math.exp)},fract:{vec2f:z(e=>e-Math.floor(e)),vec2h:h(e=>e-Math.floor(e)),vec3f:b(e=>e-Math.floor(e)),vec3h:M(e=>e-Math.floor(e)),vec4f:A(e=>e-Math.floor(e)),vec4h:V(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:z(e=>-e),vec2h:h(e=>-e),vec2i:P(e=>-e),vec2u:H(e=>-e),"vec2<bool>":e=>l(!e.x,!e.y),vec3f:b(e=>-e),vec3h:M(e=>-e),vec3i:C(e=>-e),vec3u:Q(e=>-e),"vec3<bool>":e=>x(!e.x,!e.y,!e.z),vec4f:A(e=>-e),vec4h:V(e=>-e),vec4i:G(e=>-e),vec4u:Y(e=>-e),"vec4<bool>":e=>T(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>u(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>$(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>p(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>B(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>x(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>g(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)}};function E(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var Ve=r((e,t)=>s.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType}),"coerce"),L=r((e,t)=>s.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType}),"coerce"),ze=r((e,t)=>{if(typeof e=="number")return s.mulSxV[t.kind](e,t);if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t){let n=!e.kind.startsWith("mat"),a=!t.kind.startsWith("mat");if(!n&&a)return s.mulMxV[e.kind](e,t);if(n&&!a)return s.mulVxM[t.kind](e,t)}return s.mulVxV[t.kind](e,t)},(e,t)=>{let n=E(e)?t.dataType:e.dataType.type.startsWith("mat")?t.dataType.type.startsWith("mat")?e.dataType:t.dataType:e.dataType;return{value:`(${e.value} * ${t.value})`,dataType:n}}),Ie=r(e=>typeof e=="number"?Math.abs(e):s.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),Se=r((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):s.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),$e=r(e=>typeof e=="number"?Math.acos(e):s.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Be=r(e=>typeof e=="number"?Math.asin(e):s.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),ke=r(e=>typeof e=="number"?Math.ceil(e):s.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Oe=r((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):s.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),De=r(e=>typeof e=="number"?Math.cos(e):s.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Fe=r((e,t)=>s.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),he=r((e,t)=>s.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:R})),Ue=r(e=>s.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Ne=r(e=>typeof e=="number"?Math.floor(e):s.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Re=r(e=>typeof e=="number"?e-Math.floor(e):s.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),be=r(e=>typeof e=="number"?Math.abs(e):s.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:R})),Ke=r((e,t)=>typeof e=="number"?Math.max(e,t):s.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType}),"coerce"),_e=r((e,t)=>typeof e=="number"?Math.min(e,t):s.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType}),"coerce"),We=r(e=>typeof e=="number"?Math.sign(e):s.sign[e.kind](e),e=>({value:`sign(${e.value})`,dataType:e.dataType})),Ee=r(e=>typeof e=="number"?Math.sin(e):s.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),qe=r(e=>typeof e=="number"?Math.exp(e):s.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Pe=r((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return s.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),Ce=r((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return s.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ge=r((e,t)=>L(e,ze(2*he(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),Le=r((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):be(L(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:R})),Je=r(e=>typeof e=="number"?-e:s.neg[e.kind](e),e=>({value:`-(${e.value})`,dataType:e.dataType})),je=r(e=>typeof e=="number"?Math.sqrt(e):s.sqrt[e.kind](e),e=>({value:`sqrt(${e.value})`,dataType:e.dataType})),Xe=r((e,t)=>typeof e=="number"&&typeof t=="number"?e/t:typeof t=="number"?s.mulSxV[e.kind](1/t,e):s.div[e.kind](e,t),(e,t)=>({value:`(${e.value} / ${t.value})`,dataType:e.dataType}));function q(e){return e.dataType.type.includes("2")?l:e.dataType.type.includes("3")?x:T}var Ze=r((e,t)=>me(J(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:U})),J=r((e,t)=>s.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:q(e)})),He=r((e,t)=>D(J(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:q(e)})),ce=r((e,t)=>s.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:q(e)})),Qe=r((e,t)=>pe(ce(e,t),J(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:q(e)})),Ye=r((e,t)=>Me(D(ce(e,t)),D(J(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:q(e)})),et=r((e,t)=>D(ce(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:q(e)})),D=r(e=>s.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),pe=r((e,t)=>s.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),Me=r((e,t)=>D(pe(D(e),D(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),me=r(e=>s.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:U})),tt=r(e=>!me(D(e)),e=>({value:`any(${e.value})`,dataType:U})),nt=r((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?s.isCloseToZero[e.kind](L(e,t),n):!1,(e,t,n={value:.01,dataType:R})=>E(e)&&E(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:U}:!E(e)&&!E(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:U}:{value:"false",dataType:U}),at=r((e,t,n)=>typeof n=="boolean"?n?t:e:s.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var rt=r(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:O})),st=r(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:O})),ct=r(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:O})),ot=r(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicLoad(&${e.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ut=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!S(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return{value:`atomicStore(&${e.value}, ${t.value})`,dataType:O}}),N=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,ge]:[e.dataType,I],yt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAdd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),vt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicSub(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),lt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMax(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),xt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMin(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),Tt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAnd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),it=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicOr(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),wt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicXor(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N);var dt=r(e=>e.length,e=>({value:`arrayLength(${e.value})`,dataType:I}),e=>[fe(e.dataType)]);import*as k from"typed-binary";var pt=r(e=>{let t=new ArrayBuffer(4);new k.BufferWriter(t).writeUint32(e);let a=new k.BufferReader(t);return u(a.readFloat16(),a.readFloat16())},e=>({value:`unpack2x16float(${e.value})`,dataType:u})),mt=r(e=>{let t=new ArrayBuffer(4),n=new k.BufferWriter(t);n.writeFloat16(e.x),n.writeFloat16(e.y);let a=new k.BufferReader(t);return I(a.readUint32())},e=>({value:`pack2x16float(${e.value})`,dataType:I})),gt=r(e=>{let t=new ArrayBuffer(4);new k.BufferWriter(t).writeUint32(e);let a=new k.BufferReader(t);return o(a.readUint8()/255,a.readUint8()/255,a.readUint8()/255,a.readUint8()/255)},e=>({value:`unpack4x8unorm(${e.value})`,dataType:o})),ft=r(e=>{let t=new ArrayBuffer(4),n=new k.BufferWriter(t);n.writeUint8(e.x*255),n.writeUint8(e.y*255),n.writeUint8(e.z*255),n.writeUint8(e.w*255);let a=new k.BufferReader(t);return I(a.readUint32())},e=>({value:`pack4x8unorm(${e.value})`,dataType:I}));var zt=r((e,t,n,a,v)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,v)=>{let F=[e,t,n];return a!==void 0&&F.push(a),v!==void 0&&F.push(v),{value:`textureSample(${F.map(oe=>oe.value).join(", ")})`,dataType:o}}),ht=r((e,t,n,a,v)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,v)=>{let F=[e,t,n,a];return v!==void 0&&F.push(v),{value:`textureSampleLevel(${F.map(oe=>oe.value).join(", ")})`,dataType:o}}),bt={u32:f,i32:g,f32:o},Mt=r((e,t,n)=>{throw new Error("Texture loading is not supported outside of GPU mode.")},(e,t,n)=>{let a=[e,t];n!==void 0&&a.push(n);let v=e.dataType;return{value:`textureLoad(${a.map(F=>F.value).join(", ")})`,dataType:"texelDataType"in v?v.texelDataType:bt[v.channelDataType.type]}}),At=r((e,t,n,a)=>{throw new Error("Texture storing is not supported outside of GPU mode.")},(e,t,n,a)=>({value:`textureStore(${[e,t,n,a].filter(v=>v!==void 0).map(v=>v.value).join(", ")})`,dataType:O})),Vt=r((e,t)=>{throw new Error("Texture dimensions are not supported outside of GPU mode.")},(e,t)=>{let n=e.dataType.dimension;return{value:`textureDimensions(${e.value}${t!==void 0?`, ${t.value}`:""})`,dataType:n==="1d"?I:n==="3d"?m:p}});export{Ie as abs,$e as acos,Ve as add,me as all,Ze as allEq,Me as and,tt as any,dt as arrayLength,Be as asin,Se as atan2,yt as atomicAdd,Tt as atomicAnd,ot as atomicLoad,lt as atomicMax,xt as atomicMin,it as atomicOr,ut as atomicStore,vt as atomicSub,wt as atomicXor,ke as ceil,Oe as clamp,De as cos,Fe as cross,Ae as discard,Le as distance,Xe as div,he as dot,J as eq,qe as exp,Ne as floor,Re as fract,et as ge,Ye as gt,nt as isCloseTo,Qe as le,be as length,ce as lt,Ke as max,_e as min,Ce as mix,ze as mul,He as ne,Je as neg,Ue as normalize,D as not,pe as or,mt as pack2x16float,ft as pack4x8unorm,Pe as pow,Ge as reflect,at as select,We as sign,Ee as sin,je as sqrt,st as storageBarrier,L as sub,ct as textureBarrier,Vt as textureDimensions,Mt as textureLoad,zt as textureSample,ht as textureSampleLevel,At as textureStore,pt as unpack2x16float,gt as unpack4x8unorm,rt as workgroupBarrier};
|
2
2
|
//# sourceMappingURL=index.js.map
|