glre 0.47.0 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1017 -29
- package/dist/addons.d.ts +60 -55
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +84 -79
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +65 -58
- package/dist/node.cjs +42 -42
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +63 -58
- package/dist/node.js +15 -15
- package/dist/node.js.map +1 -1
- package/dist/react.d.ts +84 -79
- package/dist/solid.d.ts +84 -79
- package/package.json +1 -1
- package/src/helpers.ts +2 -2
- package/src/index.ts +9 -4
- package/src/node/create.ts +10 -9
- package/src/node/scope.ts +3 -15
- package/src/node/types.ts +20 -45
- package/src/node/utils/const.ts +27 -10
- package/src/node/utils/index.ts +15 -8
- package/src/node/utils/infer.ts +26 -20
- package/src/node/utils/parse.ts +5 -5
- package/src/types.ts +6 -4
- package/src/webgl/compute.ts +4 -4
- package/src/webgl/graphic.ts +6 -6
- package/src/webgpu/compute.ts +5 -5
- package/src/webgpu/graphic.ts +15 -27
- package/src/webgpu/index.ts +36 -17
- package/src/webgpu/utils.ts +23 -27
package/dist/node.d.ts
CHANGED
|
@@ -29,8 +29,54 @@ declare const TYPE_MAPPING: {
|
|
|
29
29
|
readonly struct: "struct";
|
|
30
30
|
};
|
|
31
31
|
declare const CONSTANTS: (keyof typeof TYPE_MAPPING)[];
|
|
32
|
+
declare const SWIZZLE_BASE_MAP: {
|
|
33
|
+
readonly float: "float";
|
|
34
|
+
readonly vec2: "float";
|
|
35
|
+
readonly vec3: "float";
|
|
36
|
+
readonly vec4: "float";
|
|
37
|
+
readonly int: "int";
|
|
38
|
+
readonly ivec2: "int";
|
|
39
|
+
readonly ivec3: "int";
|
|
40
|
+
readonly ivec4: "int";
|
|
41
|
+
readonly uint: "uint";
|
|
42
|
+
readonly uvec2: "uint";
|
|
43
|
+
readonly uvec3: "uint";
|
|
44
|
+
readonly uvec4: "uint";
|
|
45
|
+
readonly bool: "bool";
|
|
46
|
+
readonly bvec2: "bool";
|
|
47
|
+
readonly bvec3: "bool";
|
|
48
|
+
readonly bvec4: "bool";
|
|
49
|
+
};
|
|
50
|
+
declare const SWIZZLE_RESULT_MAP: {
|
|
51
|
+
float: {
|
|
52
|
+
readonly 1: "float";
|
|
53
|
+
readonly 2: "vec2";
|
|
54
|
+
readonly 3: "vec3";
|
|
55
|
+
readonly 4: "vec4";
|
|
56
|
+
readonly 9: "mat3";
|
|
57
|
+
readonly 16: "mat4";
|
|
58
|
+
};
|
|
59
|
+
int: {
|
|
60
|
+
readonly 1: "int";
|
|
61
|
+
readonly 2: "ivec2";
|
|
62
|
+
readonly 3: "ivec3";
|
|
63
|
+
readonly 4: "ivec4";
|
|
64
|
+
};
|
|
65
|
+
uint: {
|
|
66
|
+
readonly 1: "uint";
|
|
67
|
+
readonly 2: "uvec2";
|
|
68
|
+
readonly 3: "uvec3";
|
|
69
|
+
readonly 4: "uvec4";
|
|
70
|
+
};
|
|
71
|
+
bool: {
|
|
72
|
+
readonly 1: "bool";
|
|
73
|
+
readonly 2: "bvec2";
|
|
74
|
+
readonly 3: "bvec3";
|
|
75
|
+
readonly 4: "bvec4";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
32
78
|
declare const OPERATORS: {
|
|
33
|
-
readonly not: "";
|
|
79
|
+
readonly not: "!";
|
|
34
80
|
readonly add: "+";
|
|
35
81
|
readonly sub: "-";
|
|
36
82
|
readonly mul: "*";
|
|
@@ -128,7 +174,9 @@ type GL = EventState<{
|
|
|
128
174
|
gpu: GPUCanvasContext;
|
|
129
175
|
device: GPUDevice;
|
|
130
176
|
format: GPUTextureFormat;
|
|
131
|
-
|
|
177
|
+
passEncoder: GPURenderPassEncoder;
|
|
178
|
+
commandEncoder: GPUCommandEncoder;
|
|
179
|
+
depthTexture?: GPUTexture;
|
|
132
180
|
binding: Binding;
|
|
133
181
|
/**
|
|
134
182
|
* core state
|
|
@@ -188,7 +236,7 @@ type Operators = (typeof OPERATOR_KEYS)[number];
|
|
|
188
236
|
*/
|
|
189
237
|
interface FnLayout {
|
|
190
238
|
name: string;
|
|
191
|
-
type
|
|
239
|
+
type?: C | 'auto';
|
|
192
240
|
inputs?: Array<{
|
|
193
241
|
name: string;
|
|
194
242
|
type: C | 'auto';
|
|
@@ -219,7 +267,6 @@ interface NodeProps {
|
|
|
219
267
|
}
|
|
220
268
|
interface NodeContext {
|
|
221
269
|
gl?: Partial<GL>;
|
|
222
|
-
binding?: Binding;
|
|
223
270
|
label?: 'vert' | 'frag' | 'compute';
|
|
224
271
|
isWebGL?: boolean;
|
|
225
272
|
units?: any;
|
|
@@ -236,6 +283,15 @@ interface NodeContext {
|
|
|
236
283
|
structStructFields: Map<string, StructFields>;
|
|
237
284
|
};
|
|
238
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* swizzle
|
|
288
|
+
*/
|
|
289
|
+
type _SwizzleLength<A extends string> = A extends `${infer _}${infer A}` ? A extends '' ? 1 : A extends `${infer _}${infer B}` ? B extends '' ? 2 : B extends `${infer _}${infer C}` ? C extends '' ? 3 : 4 : never : never : never;
|
|
290
|
+
type _SwizzleBaseMap = typeof SWIZZLE_BASE_MAP;
|
|
291
|
+
type _SwizzleResultMap = typeof SWIZZLE_RESULT_MAP;
|
|
292
|
+
type _SwizzleBase<T extends C> = T extends keyof _SwizzleBaseMap ? _SwizzleBaseMap[T] : never;
|
|
293
|
+
type _SwizzleResult<T extends C, L extends 1 | 2 | 3 | 4> = _SwizzleResultMap[_SwizzleBase<T>][L];
|
|
294
|
+
type InferSwizzleType<T extends C, S extends string> = _SwizzleLength<S> extends infer L extends 1 | 2 | 3 | 4 ? _SwizzleResult<_SwizzleBase<T>, L> : never;
|
|
239
295
|
/**
|
|
240
296
|
* infer
|
|
241
297
|
*/
|
|
@@ -246,57 +302,6 @@ type ExtractPairs<T> = T extends readonly [infer L, infer R, string] ? [L, R] |
|
|
|
246
302
|
type OperatorTypeRules = ExtractPairs<_OperatorTypeRulesMap[number]>;
|
|
247
303
|
type IsInRules<L extends C, R extends C> = [L, R] extends OperatorTypeRules ? 1 : 0;
|
|
248
304
|
type ValidateOperator<L extends C, R extends C> = L extends R ? 1 : IsInRules<L, R>;
|
|
249
|
-
/**
|
|
250
|
-
* swizzle
|
|
251
|
-
*/
|
|
252
|
-
type _SwizzleLength<A extends string> = A extends `${infer _}${infer A}` ? A extends '' ? 1 : A extends `${infer _}${infer B}` ? B extends '' ? 2 : B extends `${infer _}${infer C}` ? C extends '' ? 3 : 4 : never : never : never;
|
|
253
|
-
type _SwizzleBaseMap = {
|
|
254
|
-
float: 'float';
|
|
255
|
-
vec2: 'float';
|
|
256
|
-
vec3: 'float';
|
|
257
|
-
vec4: 'float';
|
|
258
|
-
int: 'int';
|
|
259
|
-
ivec2: 'int';
|
|
260
|
-
ivec3: 'int';
|
|
261
|
-
ivec4: 'int';
|
|
262
|
-
uint: 'uint';
|
|
263
|
-
uvec2: 'uint';
|
|
264
|
-
uvec3: 'uint';
|
|
265
|
-
uvec4: 'uint';
|
|
266
|
-
bool: 'bool';
|
|
267
|
-
bvec2: 'bool';
|
|
268
|
-
bvec3: 'bool';
|
|
269
|
-
bvec4: 'bool';
|
|
270
|
-
};
|
|
271
|
-
type _SwizzleResultMap = {
|
|
272
|
-
float: {
|
|
273
|
-
1: 'float';
|
|
274
|
-
2: 'vec2';
|
|
275
|
-
3: 'vec3';
|
|
276
|
-
4: 'vec4';
|
|
277
|
-
};
|
|
278
|
-
int: {
|
|
279
|
-
1: 'int';
|
|
280
|
-
2: 'ivec2';
|
|
281
|
-
3: 'ivec3';
|
|
282
|
-
4: 'ivec4';
|
|
283
|
-
};
|
|
284
|
-
uint: {
|
|
285
|
-
1: 'uint';
|
|
286
|
-
2: 'uvec2';
|
|
287
|
-
3: 'uvec3';
|
|
288
|
-
4: 'uvec4';
|
|
289
|
-
};
|
|
290
|
-
bool: {
|
|
291
|
-
1: 'bool';
|
|
292
|
-
2: 'bvec2';
|
|
293
|
-
3: 'bvec3';
|
|
294
|
-
4: 'bvec4';
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
type _SwizzleBase<T extends C> = T extends keyof _SwizzleBaseMap ? _SwizzleBaseMap[T] : never;
|
|
298
|
-
type _SwizzleResult<T extends C, L extends 1 | 2 | 3 | 4> = _SwizzleResultMap[_SwizzleBase<T>][L];
|
|
299
|
-
type InferSwizzleType<T extends C, S extends string> = _SwizzleLength<S> extends infer L extends 1 | 2 | 3 | 4 ? _SwizzleResult<_SwizzleBase<T>, L> : never;
|
|
300
305
|
/**
|
|
301
306
|
* Swizzles
|
|
302
307
|
*/
|
|
@@ -513,7 +518,7 @@ declare const fragment: (x: X, c?: NodeContext) => string;
|
|
|
513
518
|
declare const vertex: (x: X, c?: NodeContext) => string;
|
|
514
519
|
declare const compute: (x: X, c?: NodeContext) => string;
|
|
515
520
|
|
|
516
|
-
declare const create: <T extends Constants>(type: NodeTypes, props?: NodeProps | null, ...
|
|
521
|
+
declare const create: <T extends Constants>(type: NodeTypes, props?: NodeProps | null, ...children: Y[]) => X<T>;
|
|
517
522
|
declare const attribute: <T extends Constants>(x: Y<T>, id?: string) => X<T>;
|
|
518
523
|
declare const instance: <T extends Constants>(x: Y<T>, id?: string) => X<T>;
|
|
519
524
|
declare const constant: <T extends Constants>(x: Y<T>, id?: string) => X<T>;
|
|
@@ -531,7 +536,7 @@ declare const operator: <T extends Constants>(key: Operators, ...x: Y[]) => X<T>
|
|
|
531
536
|
declare const function_: <T extends Constants>(key: Functions, ...x: Y[]) => X<T>;
|
|
532
537
|
declare const conversion: <T extends Constants>(key: T, ...x: Y[]) => X<T>;
|
|
533
538
|
|
|
534
|
-
declare const addToScope: <T extends Constants>(x: X<T>) => X<T
|
|
539
|
+
declare const addToScope: <T extends Constants>(x: X<T>) => X<T>;
|
|
535
540
|
declare function toVar<T extends StructFields>(x: Struct<T>, id?: string): Struct<T>;
|
|
536
541
|
declare const assign: <T extends Constants>(x: X<T>, isScatter: boolean | undefined, y: Y<T>) => X<T>;
|
|
537
542
|
declare const Return: <T extends Constants>(x?: Y<T>) => Y<T>;
|
|
@@ -546,7 +551,7 @@ declare const If: (x: Y, fun: () => void) => {
|
|
|
546
551
|
};
|
|
547
552
|
declare const Loop: (x: Y, fun: (params: {
|
|
548
553
|
i: Int;
|
|
549
|
-
}) => void) => Bool | Color | StructBase | UInt | Int | Float | BVec2 | IVec2 | UVec2 | Vec2 | BVec3 | IVec3 | UVec3 | Vec3 | BVec4 | IVec4 | UVec4 | Vec4 | Mat2 | Mat3 | Mat4 | Texture | Sampler2D | Void
|
|
554
|
+
}) => void) => Bool | Color | StructBase | UInt | Int | Float | BVec2 | IVec2 | UVec2 | Vec2 | BVec3 | IVec3 | UVec3 | Vec3 | BVec4 | IVec4 | UVec4 | Vec4 | Mat2 | Mat3 | Mat4 | Texture | Sampler2D | Void;
|
|
550
555
|
declare const Switch: (x: Y) => {
|
|
551
556
|
Case: (...values: X[]) => (fun: () => void) => /*elided*/ any;
|
|
552
557
|
Default: (fun: () => void) => void;
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var O=["toBool","toUInt","toInt","toFloat","toBVec2","toIVec2","toUVec2","toVec2","toBVec3","toIVec3","toUVec3","toVec3","toBVec4","toIVec4","toUVec4","toVec4","toColor","toMat2","toMat3","toMat4"],P={bool:"bool",uint:"u32",int:"i32",float:"f32",bvec2:"vec2<bool>",ivec2:"vec2i",uvec2:"vec2u",vec2:"vec2f",bvec3:"vec3<bool>",ivec3:"vec3i",uvec3:"vec3u",vec3:"vec3f",bvec4:"vec4<bool>",ivec4:"vec4i",uvec4:"vec4u",vec4:"vec4f",color:"color",mat2:"mat2x2f",mat3:"mat3x3f",mat4:"mat4x4f",texture:"texture_2d<f32>",sampler2D:"sampler",struct:"struct"},W=Object.keys(P),k={float:"float",vec2:"float",vec3:"float",vec4:"float",int:"int",ivec2:"int",ivec3:"int",ivec4:"int",uint:"uint",uvec2:"uint",uvec3:"uint",uvec4:"uint",bool:"bool",bvec2:"bool",bvec3:"bool",bvec4:"bool"},F={float:{1:"float",2:"vec2",3:"vec3",4:"vec4",9:"mat3",16:"mat4"},int:{1:"int",2:"ivec2",3:"ivec3",4:"ivec4"},uint:{1:"uint",2:"uvec2",3:"uvec3",4:"uvec4"},bool:{1:"bool",2:"bvec2",3:"bvec3",4:"bvec4"}},M={not:"!",add:"+",sub:"-",mul:"*",div:"/",mod:"%",equal:"==",notEqual:"!=",lessThan:"<",lessThanEqual:"<=",greaterThan:">",greaterThanEqual:">=",and:"&&",or:"||",bitAnd:"&",bitOr:"|",bitXor:"^",shiftLeft:"<<",shiftRight:">>",addAssign:"+=",subAssign:"-=",mulAssign:"*=",divAssign:"/=",modAssign:"%=",bitAndAssign:"&=",bitOrAssign:"|=",bitXorAssign:"^=",shiftLeftAssign:"<<=",shiftRightAssign:">>="},q=Object.keys(M),j={position:"vec4",vertex_index:"uint",instance_index:"uint",front_facing:"bool",frag_depth:"float",sample_index:"uint",sample_mask:"uint",point_coord:"vec2",global_invocation_id:"uvec3",positionLocal:"vec3",positionWorld:"vec3",positionView:"vec3",normalLocal:"vec3",normalWorld:"vec3",normalView:"vec3",screenCoordinate:"vec2",screenUV:"vec2",gl_FragCoord:"vec4",gl_VertexID:"uint",gl_InstanceID:"uint",gl_FrontFacing:"bool",gl_FragDepth:"float",gl_SampleID:"uint",gl_SampleMask:"uint",gl_PointCoord:"vec2",normal:"vec3",uv:"vec2",color:"vec4"},K=["equal","notEqual","lessThan","lessThanEqual","greaterThan","greaterThanEqual"],Z=["and","or"],Q=[["float","vec2","vec2"],["float","vec3","vec3"],["float","vec4","vec4"],["int","ivec2","ivec2"],["int","ivec3","ivec3"],["int","ivec4","ivec4"],["uint","uvec2","uvec2"],["uint","uvec3","uvec3"],["uint","uvec4","uvec4"],["mat2","vec2","vec2"],["mat3","vec3","vec3"],["mat4","vec4","vec4"],["vec2","mat2","vec2"],["vec3","mat3","vec3"],["vec4","mat4","vec4"]],J={position:"gl_FragCoord",vertex_index:"gl_VertexID",instance_index:"gl_InstanceID",front_facing:"gl_FrontFacing",frag_depth:"gl_FragDepth",sample_index:"gl_SampleID",sample_mask:"gl_SampleMask",point_coord:"gl_PointCoord",uv:"gl_FragCoord.xy"},V={all:"bool",any:"bool",determinant:"float",distance:"float",dot:"float",length:"float",lengthSq:"float",luminance:"float",cross:"vec3",cubeTexture:"vec4",texture:"vec4",texelFetch:"vec4",textureLod:"vec4"},ee=[...Object.keys(V),"abs","acos","acosh","asin","asinh","atan","atanh","ceil","cos","cosh","dFdx","dFdy","degrees","exp","exp2","floor","fract","fwidth","inverse","inverseSqrt","log","log2","negate","normalize","oneMinus","radians","reciprocal","round","sign","sin","sinh","sqrt","tan","tanh","trunc","saturate","atan2","clamp","max","min","mix","pow","reflect","refract","smoothstep","step"],w=(e,t)=>e===t,ze=(e,t)=>Q.some(([n,r,s])=>n===e&&r===t||n===t&&r===e),te=(e,t,n)=>K.includes(n)||Z.includes(n)?w(e,t):w(e,t)?!0:ze(e,t),ne=(e,t,n)=>{if(K.includes(n)||Z.includes(n))return"bool";if(w(e,t))return e;let r=Q.find(([s,o,a])=>s===e&&o===t||s===t&&o===e);return r?r[2]:e};var c={arr:Array.isArray,bol:e=>typeof e=="boolean",str:e=>typeof e=="string",num:e=>typeof e=="number",int:e=>Number.isInteger(e),fun:e=>typeof e=="function",und:e=>typeof e>"u",nul:e=>e===null,set:e=>e instanceof Set,map:e=>e instanceof Map,obj:e=>!!e&&e.constructor.name==="Object",nan:e=>typeof e=="number"&&Number.isNaN(e)};var Y=e=>e instanceof Float32Array;var He=e=>[1,2,3,4,9,16].includes(e),ke=(e,t=3)=>e%t===0?Math.floor(e/t):-1,re=(e,t=1,n=console.warn,r="")=>{let s=ke(e,t);return He(s)||n(`glre attribute error: Invalid attribute length ${e}, ${r?`${r} `:" "}must divide by vertex count (${t}) with valid stride (1,2,3,4,9,16)`),s};var bt=`
|
|
2
2
|
struct In { @builtin(vertex_index) vertex_index: u32 }
|
|
3
3
|
struct Out { @builtin(position) position: vec4f }
|
|
4
4
|
@vertex
|
|
@@ -9,26 +9,26 @@ fn main(in: In) -> Out {
|
|
|
9
9
|
out.position = vec4f(x, y, 0.0, 1.0);
|
|
10
10
|
return out;
|
|
11
11
|
}
|
|
12
|
-
`.trim();var
|
|
12
|
+
`.trim();var I=(e=1024)=>{if(c.num(e)){let s=Math.sqrt(e),o=Math.ceil(s);return Number.isInteger(s)||console.warn(`GLRE Storage Warning: particleCount (${e}) is not a square. Using ${o}x${o} texture may waste GPU memory. Consider using [width, height] format for optimal storage.`),{x:o,y:o}}let[t,n,r]=e;if(r!==void 0){let s=n*r;return console.warn(`GLRE Storage Warning: 3D particleCount [${t}, ${n}, ${r}] specified but WebGL storage textures only support 2D. Flattening to 2D by multiplying height=${n} * depth=${r} = ${s}.`),{x:t,y:s}}return{x:t,y:n}};var oe=e=>c.str(e)&&/^[xyzwrgbastpq]{1,4}$/.test(e),se=e=>q.includes(e),ie=e=>ee.includes(e),ae=e=>c.obj(e)?!1:e instanceof Element,ue=e=>O.includes(e),L=e=>!e||typeof e!="object"?!1:e.isProxy,U=e=>c.str(e)?W.includes(e):!1,pe=e=>{let t=(e>>16&255)/255,n=(e>>8&255)/255,r=(e&255)/255;return[t,n,r]},qe=0,v=()=>`x${qe++}`,le=(e,t)=>{if(t==="global_invocation_id")return`uvec3(uint(gl_FragCoord.y) * uint(${I(e.gl?.particleCount).x}) + uint(gl_FragCoord.x), 0u, 0u)`;let n=J[t];if(!n)throw new Error(`Error: unknown builtin variable ${t}`);return n},C=(e,t)=>c.str(e)?t?.isWebGL?e:P[e]||e:"",B=e=>M[e]||e,fe=e=>{let t=O.indexOf(e);return t!==-1?W[t]:"float"},ce=e=>(e.code||(e.code={headers:new Map,fragInputs:new Map,vertInputs:new Map,vertOutputs:new Map,vertVaryings:new Map,computeInputs:new Map,dependencies:new Map,structStructFields:new Map},e.isWebGL)||(e.code.fragInputs.set("position","@builtin(position) position: vec4f"),e.code.vertOutputs.set("position","@builtin(position) position: vec4f")),e),de=e=>c.num(e)||c.str(e)&&/^\d+$/.test(e),N=(e,t="",n)=>{e.code?.dependencies?.has(t)||e.code.dependencies.set(t,new Set),U(n)||e.code.dependencies.get(t).add(n)},je=(e,t,n)=>e.isWebGL?n==="attribute"?e.gl?.attribute?.bind(null,t):n==="instance"?e.gl?.instance?.bind(null,t):n==="texture"?e.gl?.texture?.bind(null,t):n==="storage"?e.gl?.storage?.bind(null,t):r=>e.gl?.uniform?.(t,r):n==="attribute"?e.gl?._attribute?.bind(null,t):n==="instance"?e.gl?._instance?.bind(null,t):n==="texture"?e.gl?._texture?.bind(null,t):n==="storage"?e.gl?._storage?.bind(null,t):r=>e.gl?._uniform?.(t,r),Ke=(e,t)=>{if(c.und(e))return;if(!L(e))return t(e);if(e.type!=="conversion")return;let n=e.props.children?.slice(1);if(!c.und(n?.[0])){if(c.arr(n[0])||Y(n[0]))return t(n[0]);t(n.map(r=>r??n[0]))}},G=(e,t,n,r,s)=>{let o=je(e,t,n);if(o)return Ke(s,o),r.listeners.add(o),o};var Ze=e=>j[e],Qe=(e,t)=>F[k[e]][t],Je=(e,t,n)=>n==="not"?"bool":(te(e,t,n)||console.warn(`GLRE Type Warning: Invalid operator '${n}' between types '${e}' and '${t}'`),ne(e,t,n)),et=e=>c.bol(e)?"bool":c.str(e)?"texture":c.num(e)?"float":c.arr(e)||Y(e)?F.float[e.length]:ae(e)?"texture":"void",Te=(e,t=console.warn,n="")=>{let r=F.float[e];return r||t(`glre node system error: Cannot infer ${n?`${n} `:""} type from array length ${e}. Check your data size. Supported: 1(float), 2(vec2), 3(vec3), 4(vec4), 9(mat3), 16(mat4)`),r},xe=(e,t)=>{if(e.length===0)return"void";let[n]=e;return c.str(n)?n:g(n,t)},tt=e=>V[e],nt=(e,t)=>{let{type:n,props:r}=e,{id:s,children:o=[],inferFrom:a,layout:f}=r,[i,u,T]=o;if(n==="conversion")return i;if(n==="operator")return Je(g(u,t),g(T,t),i);if(n==="builtin")return Ze(s);if(n==="function")return tt(i)||g(u,t);if(n==="define")return U(f?.type)?f?.type:!a||a.length===0?"void":xe(a,t);if((n==="attribute"||n==="instance")&&c.arr(i)){let h=n==="instance"?t.gl?.instanceCount:t.gl?.count,$=re(i.length,h,t.gl?.error,s);return Te($,t.gl?.error,s)}if(n==="member"){let h=g(i,t);if(!U(h)){let $=t.code?.structStructFields?.get(h);if($&&$[u])return g($[u],t)}return oe(u)?Qe(h,u.length):"float"}return a?xe(a,t):i?g(i,t):"void"},g=(e,t)=>{if(t||(t={}),!L(e))return et(e);if(c.arr(e))return Te(e.length,t.gl?.error,e.props.id);if(t.infers||(t.infers=new WeakMap),t.infers.has(e))return t.infers.get(e);let n=nt(e,t);return t.infers.set(e,n),n};var y=(e,t)=>e.filter(n=>!c.und(n)&&!c.nul(n)).map(n=>p(n,t)).join(", "),me=(e,t,n,r)=>{let s=()=>{let u=g(r,e);if(u==="float")return".x";if(u==="vec2")return".xy";if(u==="vec3")return".xyz";if(u==="vec4")return"";throw new Error(`Unsupported storage scatter type: ${u}`)},o=p(n,e),a=I(e.gl?.particleCount),f=`int(${o}) % ${a.x}`,i=`int(${o}) / ${a.x}`;return`texelFetch(${p(t,e)}, ivec2(${f}, ${i}), 0)${s()}`},ge=(e,t,n)=>{let r=p(t,e),s=p(n,e),o=g(n,e);if(o==="float")return`_${r} = vec4(${s}, 0.0, 0.0, 1.0);`;if(o==="vec2")return`_${r} = vec4(${s}, 0.0, 1.0);`;if(o==="vec3")return`_${r} = vec4(${s}, 1.0);`;if(o==="vec4")return`_${r} = ${s};`;throw new Error(`Unsupported storage scatter type: ${o}`)},ve=(e,t,n,r)=>{if(e.isWebGL)return`texture(${y(r?[t,n,r]:[t,n],e)})`;let s=p(t,e),o=[s,s+"Sampler",p(n,e)];return r?(o.push(p(r,e)),`textureSampleLevel(${o})`):`textureSample(${o})`},be=(e,t,n,r)=>{let s=`if (${p(t,e)}) {
|
|
13
13
|
${p(n,e)}
|
|
14
14
|
}`;for(let o=2;o<r.length;o+=2){let a=o>=r.length-1;s+=a?` else {
|
|
15
15
|
${p(r[o],e)}
|
|
16
16
|
}`:` else if (${p(r[o],e)}) {
|
|
17
17
|
${p(r[o+1],e)}
|
|
18
|
-
}`}return s}
|
|
18
|
+
}`}return s},$e=(e,t,n)=>{let r=`switch (${p(t,e)}) {
|
|
19
19
|
`;for(let s=1;s<n.length;s+=2)s>=n.length-1&&n.length%2===0?r+=`default:
|
|
20
20
|
${p(n[s],e)}
|
|
21
21
|
break;
|
|
22
22
|
`:s+1<n.length&&(r+=`case ${p(n[s],e)}:
|
|
23
23
|
${p(n[s+1],e)}
|
|
24
24
|
break;
|
|
25
|
-
`);return r+="}",r}
|
|
25
|
+
`);return r+="}",r},he=(e,t,n)=>{let r=g(t,e),s=n?.props?.id;if(e.isWebGL)return`${r} ${s} = ${p(t,e)};`;let o=C(r);return`var ${s}: ${o} = ${p(t,e)};`},Ce=(e,t,n={})=>{e.code?.structStructFields?.set(t,n);let r=[];for(let o in n){let a=n[o],f=g(a,e);e.isWebGL&&N(e,t,f),r.push(e.isWebGL?`${f} ${o};`:`${o}: ${C(f,e)},`)}let s=r.join(`
|
|
26
26
|
`);return`struct ${t} {
|
|
27
27
|
${s}
|
|
28
|
-
};`},
|
|
29
|
-
`)},
|
|
30
|
-
@group(${
|
|
31
|
-
layout(location = ${
|
|
28
|
+
};`},Ee=(e,t,n="",r)=>{let s=e.code?.structStructFields?.get(t)||{};if(e.isWebGL)if(r){let o=[];for(let a in s)o.push(r[a]);return`${t} ${n} = ${t}(${y(o,e)});`}else return`${t} ${n};`;else if(r){let o=[];for(let a in s)o.push(r[a]);return`var ${n}: ${t} = ${t}(${y(o,e)});`}else return`var ${n}: ${t};`},_e=(e,t,n)=>{let{id:r,children:s=[],layout:o}=t,[a,...f]=s,i=[],u=[];for(let m=0;m<f.length;m++){let E=o?.inputs?.[m];E?i.push([E.name,E.type==="auto"?g(f[m],e):E.type]):i.push([`p${m}`,g(f[m],e)])}let T=p(a,e),h=g(n,e),$=[];if(e?.isWebGL){for(let[m,E]of i)N(e,r,E),u.push(`${E} ${m}`);N(e,r,h),$.push(`${h} ${r}(${u}) {`)}else{for(let[E,Be]of i)u.push(`${E}: ${C(Be,e)}`);h==="void"?$.push(`fn ${r}(${u}) {`):$.push(`fn ${r}(${u}) -> ${C(h,e)} {`)}return T&&$.push(T),$.push("}"),$.join(`
|
|
29
|
+
`)},ye=(e,t,n)=>e.isWebGL?`${n} ${t};`:`@location(${e.code?.vertVaryings?.size||0}) ${t}: ${C(n,e)}`,Xe=(e,t,n)=>{if(e.isWebGL)return`${n} ${t};`;let{location:r=0}=e.gl?.binding?.attrib(t)||{},s=C(n,e);return`@location(${r}) ${t}: ${s}`},Se=(e,t,n)=>{let r=n==="sampler2D"||n==="texture";if(e.isWebGL)return r?`uniform sampler2D ${t};`:`uniform ${n} ${t};`;if(r){let{group:f=1,binding:i=0}=e.gl?.binding?.texture(t)||{};return`@group(${f}) @binding(${i}) var ${t}Sampler: sampler;
|
|
30
|
+
@group(${f}) @binding(${i+1}) var ${t}: texture_2d<f32>;`}let{group:s=0,binding:o=0}=e.gl?.binding?.uniform(t)||{},a=C(n,e);return`@group(${s}) @binding(${o}) var<uniform> ${t}: ${a};`},Re=(e,t,n)=>{if(e.isWebGL){let a=`uniform sampler2D ${t};`;if(e.label!=="compute")return a;let f=e.units?.(t);return`${a}
|
|
31
|
+
layout(location = ${f}) out vec4 _${t};`}let{group:r=0,binding:s=0}=e.gl?.binding?.storage(t)||{},o=C(n,e);return`@group(${r}) @binding(${s}) var<storage, read_write> ${t}: array<${o}>;`},Le=(e,t,n,r)=>{let s=g(t,e),o=p(n,e),a=p(t,e);return e.isWebGL?s==="int"?`for (int ${r} = 0; ${r} < ${a}; ${r} += 1) {
|
|
32
32
|
${o}
|
|
33
33
|
}`:s==="float"?`for (float ${r} = 0.0; ${r} < ${a}; ${r} += 1.0) {
|
|
34
34
|
${o}
|
|
@@ -48,18 +48,18 @@ ${o}
|
|
|
48
48
|
${o}
|
|
49
49
|
}`:`for (var ${r}: i32 = 0; ${r} < ${a}; ${r}++) {
|
|
50
50
|
${o}
|
|
51
|
-
}`},
|
|
52
|
-
`);if(n==="assign")return`${p(i,t)} = ${p(u,t)};`;if(n==="return")return`return ${p(i,t)};`;if(n==="break")return"break;";if(n==="continue")return"continue;";if(n==="loop")return
|
|
51
|
+
}`},Ae=(e,t,n,r)=>e.isWebGL?`const ${n} ${t} = ${r};`:`const ${t}: ${C(n,e)} = ${r};`;var Fe=(e=0)=>{let t=`${e}`;return t.includes(".")?t:t+".0"},p=(e,t)=>{if(t||(t={}),ce(t),c.arr(e))return y(e,t);if(c.str(e))return e;if(c.num(e))return Fe(e);if(c.bol(e))return e?"true":"false";if(!e||!L(e))return"";let{type:n,props:r={}}=e,{id:s="i",children:o=[],fields:a,initialValues:f}=r,[i,u,T,h]=o;if(n==="variable")return s;if(n==="member")return`${p(i,t)}.${p(u,t)}`;if(n==="element")return`${p(i,t)}[${p(u,t)}]`;if(n==="gather")return t.isWebGL?me(t,i,u,e):`${p(i,t)}[${p(u,t)}]`;if(n==="scatter"){let[m,E]=i.props.children??[];return t.isWebGL?ge(t,m,u):`${p(m,t)}[${p(E,t)}] = ${p(u,t)};`}if(n==="ternary")return t.isWebGL?`(${p(T,t)} ? ${p(i,t)} : ${p(u,t)})`:`select(${p(i,t)}, ${p(u,t)}, ${p(T,t)})`;if(n==="conversion")return i==="float"&&c.num(u)?Fe(u):i==="bool"&&c.bol(u)?u?"true":"false":i==="int"&&c.num(u)?`${u<<0}`:`${C(i,t)}(${y(o.slice(1),t)})`;if(n==="operator")return i==="not"||i==="bitNot"?`!${p(u,t)}`:i==="mod"?p(Ye(u,T),t):i.endsWith("Assign")?`${p(u,t)} ${B(i)} ${p(T,t)};`:`(${p(u,t)} ${B(i)} ${p(T,t)})`;if(n==="function"){if(i==="negate")return`(-${p(u,t)})`;if(i==="reciprocal")return`(1.0 / ${p(u,t)})`;if(i==="oneMinus")return`(1.0-${p(u,t)})`;if(i==="saturate")return`clamp(${p(u,t)}, 0.0, 1.0)`;if(i==="texture")return ve(t,u,T,h);if(i==="atan2"&&t.isWebGL)return`atan(${p(u,t)}, ${p(T,t)})`;if(!t.isWebGL){if(i==="dFdx")return`dpdx(${p(u,t)})`;if(i==="dFdy")return`dpdy(${p(u,t)})`}return`${i}(${y(o.slice(1),t)})`}if(n==="scope")return o.map(m=>p(m,t)).join(`
|
|
52
|
+
`);if(n==="assign")return`${p(i,t)} = ${p(u,t)};`;if(n==="return")return`return ${p(i,t)};`;if(n==="break")return"break;";if(n==="continue")return"continue;";if(n==="loop")return Le(t,i,u,s);if(n==="if")return be(t,i,u,o);if(n==="switch")return $e(t,i,o);if(n==="declare")return he(t,i,u);if(n==="define")return t.code?.headers.has(s)||t.code?.headers.set(s,_e(t,r,e)),`${s}(${y(o.slice(1),t)})`;if(n==="struct")return t.code?.headers.has(s)||t.code?.headers.set(s,Ce(t,s,a)),Ee(t,s,i.props.id,f);if(n==="varying"){if(t.code?.vertOutputs.has(s))return t.isWebGL?`${s}`:`out.${s}`;let m=ye(t,s,g(e,t));return t.code?.fragInputs.set(s,m),t.code?.vertOutputs.set(s,m),t.code?.vertVaryings.set(s,{node:i}),t.isWebGL?`${s}`:`out.${s}`}if(n==="builtin"){if(t.isWebGL)return le(t,s);if(s==="position")return"out.position";let m=`@builtin(${s}) ${s}: ${C(g(e,t),t)}`;return t.label==="compute"?t.code?.computeInputs.set(s,m):t.label==="frag"?t.code?.fragInputs.set(s,m):t.label==="vert"&&t.code?.vertInputs.set(s,m),`in.${s}`}if(n==="attribute"||n==="instance")return G(t,s,n,e,i),t.code?.vertInputs.set(s,Xe(t,s,g(e,t))),t.isWebGL?`${s}`:`in.${s}`;if(t.code?.headers.has(s))return s;let $="";if(n==="uniform"){let m=g(e,t);G(t,s,m,e,i),$=Se(t,s,m)}return n==="storage"&&(G(t,s,n,e,i),$=Re(t,s,g(e,t))),n==="constant"&&($=Ae(t,s,g(e,t),p(i,t))),$?(t.code?.headers.set(s,$),s):p(i,t)};var rt=(e,t)=>{let n=[],r=new Set,s=new Set,o=a=>{if(s.has(a)||r.has(a))return;s.add(a);let f=t.get(a)||new Set;for(let i of f)e.has(i)&&o(i);s.delete(a),r.add(a),e.has(a)&&n.push([a,e.get(a)])};for(let[a]of e)o(a);return n},z=(e,t)=>{let n=p(e,t),r="";t.isWebGL&&t.code?.dependencies?r=rt(t.code.headers,t.code.dependencies).map(([,f])=>f).join(`
|
|
53
53
|
`):r=Array.from(t.code?.headers?.values()||[]).join(`
|
|
54
|
-
`);let[s,o]=n.split("return ");return o?o=o.replace(";",""):[s,o]=["",n],[r,s.trim(),o]},
|
|
54
|
+
`);let[s,o]=n.split("return ");return o?o=o.replace(";",""):[s,o]=["",n],[r,s.trim(),o]},D=(e,t)=>`struct ${e} {
|
|
55
55
|
${Array.from(t.values()).join(`,
|
|
56
56
|
`)}
|
|
57
|
-
}`,
|
|
57
|
+
}`,ot=["float","int","sampler2D","samplerCube","sampler3D","sampler2DArray","sampler2DShadow","samplerCubeShadow","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray"],Ie=(e,t="highp")=>{for(let n of ot)e.push(`precision ${t} ${n};`)},st=(e,t="highp")=>{if(!e)return"highp";if(t==="highp"){let n=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT),r=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);if(n&&n.precision>0&&r&&r.precision>0)return"highp";t="mediump"}if(t==="mediump"){let n=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT),r=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT);if(n&&n.precision>0&&r&&r.precision>0)return"mediump"}return"lowp"},Ue=(e,t={})=>{t.code?.headers?.clear(),t.label="frag";let[n,r,s]=z(e,t),o=[];if(t.isWebGL){o.push("#version 300 es"),Ie(o,st(t.gl?.gl,t.gl?.precision)),o.push("out vec4 fragColor;");for(let f of t.code?.fragInputs?.values()||[])o.push(`in ${f}`);o.push(n),o.push("void main() {"),o.push(` ${r}`),o.push(` fragColor = ${s};`)}else t.code?.fragInputs?.size&&o.push(D("Out",t.code.fragInputs)),o.push(n),o.push(`@fragment
|
|
58
58
|
fn main(out: Out) -> @location(0) vec4f {`),o.push(` ${r}`),o.push(` return ${s};`);o.push("}");let a=o.filter(Boolean).join(`
|
|
59
59
|
`).trim();return t.gl?.isDebug&&console.log(`\u2193\u2193\u2193generated\u2193\u2193\u2193
|
|
60
|
-
${a}`),a},
|
|
60
|
+
${a}`),a},Ne=(e,t={})=>{if(t.code?.headers?.clear(),t.label="vert",t.code)for(let[f,{node:i}]of t.code.vertVaryings.entries())t.code.vertVaryings.set(f,{node:i,code:p(i,t)});let[n,r,s]=z(e,t),o=[];if(t.isWebGL){o.push("#version 300 es");for(let f of t.code?.vertInputs?.values()||[])o.push(`in ${f}`);for(let f of t.code?.vertOutputs?.values()||[])o.push(`out ${f}`);if(o.push(n),o.push("void main() {"),o.push(` ${r}`),o.push(` gl_Position = ${s};`),t.code)for(let[f,i]of t.code.vertVaryings.entries())o.push(` ${f} = ${i.code};`)}else{if(t.code?.vertInputs?.size&&o.push(D("In",t.code.vertInputs)),t.code?.vertOutputs?.size&&o.push(D("Out",t.code.vertOutputs)),o.push(n),o.push("@vertex"),o.push(`fn main(${t.code?.vertInputs?.size?"in: In":""}) -> Out {`),o.push(" var out: Out;"),o.push(` ${r}`),o.push(` out.position = ${s};`),t.code)for(let[f,i]of t.code.vertVaryings.entries())o.push(` out.${f} = ${i.code};`);o.push(" return out;")}o.push("}");let a=o.filter(Boolean).join(`
|
|
61
61
|
`).trim();return t.gl?.isDebug&&console.log(`\u2193\u2193\u2193generated\u2193\u2193\u2193
|
|
62
|
-
${a}`),a},
|
|
62
|
+
${a}`),a},Ge=(e,t={})=>{t.code?.headers?.clear(),t.label="compute";let[n,r,s]=z(e,t),o=[];t.isWebGL?(o.push("#version 300 es"),Ie(o,"highp"),o.push(n),o.push("void main() {"),o.push(` ${r}`),o.push(` ${s};`),o.push("}")):(t.code?.computeInputs?.size&&o.push(D("In",t.code.computeInputs)),o.push(n),o.push("@compute @workgroup_size(32)"),o.push(`fn main(${t.code?.computeInputs?.size?"in: In":""}) {`),o.push(` ${r}`),o.push(` ${s};`),o.push("}"));let a=o.filter(Boolean).join(`
|
|
63
63
|
`).trim();return t.gl?.isDebug&&console.log(`\u2193\u2193\u2193generated\u2193\u2193\u2193
|
|
64
|
-
${a}`),a};var X=null,
|
|
64
|
+
${a}`),a};var X=null,S=null,_=e=>{if(!X||(X.props.children||(X.props.children=[]),X.props.children.push(e),e.type!=="return"||!S))return e;let{props:t}=S;return t.inferFrom||(t.inferFrom=[]),t.inferFrom.push(e),e};function De(e,t){t||(t=v());let n=d("variable",{id:t,inferFrom:[e]}),r=d("declare",null,e,n);return _(r),n}var we=(e,t=!1,n)=>{let r=d(t?"scatter":"assign",null,e,n);return _(r),e},it=e=>_(d("return",{inferFrom:[e]},e)),qt=()=>_(d("break")),jt=()=>_(d("continue")),Kt=(e,t=v())=>(n={},r=v())=>{let s=d("variable",{id:r,inferFrom:[t]}),o=d("struct",{id:t,fields:e,initialValues:n},s);return _(o),s},Oe=(e,t,n=S)=>{let[r,s]=[X,S];[X,S]=[e,n];let o=t();o&&it(o),[X,S]=[r,s]},R=e=>{let t=d("scope");return Oe(t,e),t},Zt=(e,t)=>{let n=R(t),r=d("if",null,e,n);_(r);let s=()=>({ElseIf:(o,a)=>{let f=R(a);return r.props.children.push(o,f),s()},Else:o=>{let a=R(o);r.props.children.push(a)}});return s()},Qt=(e,t)=>{let n=v(),r=R(()=>t({i:d("variable",{id:n,inferFrom:[x("int",0)]})})),s=d("loop",{id:n},e,r);return _(s)},Jt=e=>{let t=d("switch",null,e);_(t);let n=()=>({Case:(...r)=>s=>{let o=R(s);for(let a of r)t.props.children.push(a,o);return n()},Default:r=>{let s=R(r);t.props.children.push(s)}});return n()};function en(e,t){let n=v(),r=(...s)=>{let o=t?.name||n,a=[],f=[];for(let T=0;T<s.length;T++){let h=t?.inputs?.[T];h?f.push({id:h.name,inferFrom:h.type==="auto"?[s[T]]:[x(h.type,s[T])]}):f.push({id:`p${T}`,inferFrom:[s[T]]})}for(let T of f)a.push(d("variable",T));let i=d("scope"),u=d("define",{id:o,layout:t},i,...s);return Oe(i,()=>e(a),u),u};return r.getLayout=()=>t,r.setLayout=s=>(t=s,r),r}var at=(e,t)=>{if(t==="string")return p(e,null)},d=(e,t,...n)=>{t||(t={}),n.length&&(t.children=n);let r=new Set,s=(f,i)=>{if(i==="type")return e;if(i==="props")return t;if(i==="toVar")return De.bind(null,a);if(i==="isProxy")return!0;if(i==="toString")return p.bind(null,a);if(i==="fragment")return Ue.bind(null,a);if(i==="compute")return Ge.bind(null,a);if(i==="vertex")return Ne.bind(null,a);if(i===Symbol.toPrimitive)return at.bind(null,a);if(i==="listeners")return r;if(i==="attribute")return(u=v())=>ut(a,u);if(i==="instance")return(u=v())=>pt(a,u);if(i==="constant")return(u=v())=>lt(a,u);if(i==="uniform")return(u=v())=>A(a,u);if(i==="variable")return(u=v())=>ft(u);if(i==="builtin")return(u=v())=>b(u);if(i==="vertexStage")return(u=v())=>ct(a,u);if(i==="element")return u=>e==="storage"?dt(a,u):Pe(a,u);if(i==="member")return u=>H(a,u);if(i==="assign")return we.bind(null,a,a.type==="gather");if(i==="select")return xt.bind(null,a);if(se(i))return i.endsWith("Assign")?(...u)=>_(We(i,a,...u)):(...u)=>We(i,a,...u);if(ie(i))return(...u)=>l(i,a,...u);if(ue(i))return()=>x(fe(i),a);if(c.str(i))return de(i)?Pe(a,i):H(a,i)},o=(f,i,u)=>(i==="value"&&r.forEach(T=>T(u)),c.str(i)&&H(a,i).assign(u),!0),a=new Proxy({},{get:s,set:o});return a},ut=(e,t=v())=>d("attribute",{id:t},e),pt=(e,t=v())=>d("instance",{id:t},e),lt=(e,t=v())=>d("constant",{id:t},e),A=(e,t=v())=>d("uniform",{id:t},e),an=(e,t=v())=>d("storage",{id:t},e),ft=(e=v())=>d("variable",{id:e}),b=(e=v())=>d("builtin",{id:e}),ct=(e,t=v())=>d("varying",{id:t,inferFrom:[e]},e),H=(e,t)=>d("member",null,e,t),Pe=(e,t)=>d("element",null,e,t),dt=(e,t)=>d("gather",null,e,t),un=(e,t)=>d("scatter",null,e,t),xt=(e,t,n)=>d("ternary",null,e,t,n),We=(e,...t)=>d("operator",null,e,...t),l=(e,...t)=>d("function",null,e,...t),x=(e,...t)=>d("conversion",null,e,...t);var Tt=b("position"),dn=b("vertex_index"),xn=b("instance_index"),Tn=b("front_facing"),mn=b("frag_depth"),gn=b("sample_index"),vn=b("sample_mask"),bn=b("point_coord"),$n=b("global_invocation_id"),hn=b("position"),Cn=b("positionWorld"),En=b("positionView"),_n=b("normalLocal"),yn=b("normalWorld"),Xn=b("normalView"),Sn=b("screenCoordinate"),Rn=b("screenUV"),mt=e=>x("float",e),Ln=e=>x("int",e),An=e=>x("uint",e),Fn=e=>x("bool",e),Ve=(e,t)=>x("vec2",e,t),Me=(e,t,n)=>x("vec3",e,t,n),Yn=(e,t,n,r)=>x("vec4",e,t,n,r),In=(...e)=>x("mat2",...e),Un=(...e)=>x("mat3",...e),Nn=(...e)=>x("mat4",...e),Gn=(e,t)=>x("ivec2",e,t),Dn=(e,t,n)=>x("ivec3",e,t,n),wn=(e,t,n,r)=>x("ivec4",e,t,n,r),On=(e,t)=>x("uvec2",e,t),Pn=(e,t,n)=>x("uvec3",e,t,n),Wn=(e,t,n,r)=>x("uvec4",e,t,n,r),Mn=(e,t)=>x("bvec2",e,t),Vn=(e,t,n)=>x("bvec3",e,t,n),Bn=(e,t,n,r)=>x("bvec4",e,t,n,r),zn=e=>x("texture",e),Hn=()=>x("sampler2D"),kn=(e,t,n)=>c.num(e)&&c.und(t)&&c.und(n)?Me(...pe(e)):Me(e,t,n),gt=A(Ve(),"iResolution"),qn=A(Ve(),"iMouse"),jn=A(mt(),"iTime"),Kn=Tt.xy.div(gt),Zn=e=>l("all",e),Qn=e=>l("any",e),Jn=e=>l("determinant",e),er=(e,t)=>l("distance",e,t),tr=(e,t)=>l("dot",e,t),nr=e=>l("length",e),rr=e=>l("lengthSq",e),or=e=>l("luminance",e),sr=(e,t)=>l("cross",e,t),ir=(e,t,n)=>l("cubeTexture",e,t,n),ar=(e,t,n)=>l("texture",e,t,n),ur=(e,t,n)=>l("texelFetch",e,t,n),pr=(e,t,n)=>l("textureLod",e,t,n),lr=e=>l("abs",e),fr=e=>l("acos",e),cr=e=>l("acosh",e),dr=e=>l("asin",e),xr=e=>l("asinh",e),Tr=e=>l("atan",e),mr=e=>l("atanh",e),gr=e=>l("ceil",e),vr=e=>l("cos",e),br=e=>l("cosh",e),$r=e=>l("dFdx",e),hr=e=>l("dFdy",e),Cr=e=>l("degrees",e),Er=e=>l("exp",e),_r=e=>l("exp2",e),yr=e=>l("floor",e),Xr=e=>l("fract",e),Sr=e=>l("fwidth",e),Rr=e=>l("inverseSqrt",e),Lr=e=>l("log",e),Ar=e=>l("log2",e),Fr=e=>l("negate",e),Yr=e=>l("normalize",e),Ir=e=>l("oneMinus",e),Ur=e=>l("radians",e),Nr=e=>l("reciprocal",e),Gr=e=>l("round",e),Dr=e=>l("sign",e),wr=e=>l("sin",e),Or=e=>l("sinh",e),Pr=e=>l("sqrt",e),Wr=e=>l("tan",e),Mr=e=>l("tanh",e),Vr=e=>l("trunc",e),Br=(e,t)=>l("atan2",e,t),zr=(e,t,n)=>l("clamp",e,t,n),Hr=(e,t)=>l("max",e,t),kr=(e,t)=>l("min",e,t),qr=(e,t,n)=>l("mix",e,t,n),jr=(e,t)=>l("pow",e,t),Kr=(e,t)=>l("reflect",e,t),Zr=(e,t,n)=>l("refract",e,t,n),Qr=(e,t,n)=>l("smoothstep",e,t,n),Jr=(e,t)=>l("step",e,t),Ye=(e,t)=>e.sub(e.div(t).floor().mul(t));export{qt as Break,jt as Continue,en as Fn,Zt as If,Qt as Loop,it as Return,R as Scope,Jt as Switch,lr as abs,fr as acos,cr as acosh,_ as addToScope,Zn as all,Qn as any,dr as asin,xr as asinh,we as assign,Tr as atan,Br as atan2,mr as atanh,ut as attribute,Fn as bool,b as builtin,Mn as bvec2,Vn as bvec3,Bn as bvec4,gr as ceil,zr as clamp,kn as color,Ge as compute,lt as constant,x as conversion,vr as cos,br as cosh,d as create,sr as cross,ir as cubeTexture,$r as dFdx,hr as dFdy,Cr as degrees,Jn as determinant,er as distance,tr as dot,Pe as element,Er as exp,_r as exp2,mt as float,yr as floor,Xr as fract,mn as fragDepth,Ue as fragment,Tn as frontFacing,l as function_,Sr as fwidth,dt as gather,qn as iMouse,gt as iResolution,jn as iTime,$n as id,pt as instance,xn as instanceIndex,Ln as int,Rr as inverseSqrt,Gn as ivec2,Dn as ivec3,wn as ivec4,nr as length,rr as lengthSq,Lr as log,Ar as log2,or as luminance,In as mat2,Un as mat3,Nn as mat4,Hr as max,H as member,kr as min,qr as mix,Ye as mod,Fr as negate,_n as normalLocal,Xn as normalView,yn as normalWorld,Yr as normalize,Ir as oneMinus,We as operator,bn as pointCoord,Tt as position,hn as positionLocal,En as positionView,Cn as positionWorld,jr as pow,Ur as radians,Nr as reciprocal,Kr as reflect,Zr as refract,Gr as round,gn as sampleIndex,vn as sampleMask,Hn as sampler2D,un as scatter,Oe as scoped,Sn as screenCoordinate,Rn as screenUV,xt as select,Dr as sign,wr as sin,Or as sinh,Qr as smoothstep,Pr as sqrt,Jr as step,an as storage,Kt as struct,Wr as tan,Mr as tanh,ur as texelFetch,ar as texture,zn as texture2D,pr as textureLod,De as toVar,Vr as trunc,An as uint,A as uniform,Kn as uv,On as uvec2,Pn as uvec3,Wn as uvec4,ft as variable,Ve as vec2,Me as vec3,Yn as vec4,Ne as vertex,dn as vertexIndex,ct as vertexStage};
|
|
65
65
|
//# sourceMappingURL=node.js.map
|