glre 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,583 +1,3 @@
1
- import * as refr from 'refr';
2
- import { Queue, Frame } from 'refr';
3
1
  export { Frame, Fun, Queue } from 'refr';
4
- import { EventState } from 'reev';
5
- import { NodeProps as NodeProps$1 } from './../../../../node_modules/glre/src/node/types';
6
-
7
- declare const SWIZZLES: readonly ["x", "y", "z", "w", "r", "g", "b", "a", "s", "t", "p", "q"];
8
- declare const CONSTANTS: readonly ["bool", "uint", "int", "float", "bvec2", "bvec3", "bvec4", "ivec2", "ivec3", "ivec4", "uvec2", "uvec3", "uvec4", "vec2", "vec3", "vec4", "color", "mat2", "mat3", "mat4"];
9
- declare const CONVERSIONS: readonly ["toFloat", "toInt", "toUint", "toBool", "toVec2", "toVec3", "toVec4", "toIvec2", "toIvec3", "toIvec4", "toUvec2", "toUvec3", "toUvec4", "toBvec2", "toBvec3", "toBvec4", "toMat2", "toMat3", "toMat4", "toColor"];
10
- declare const OPERATORS: {
11
- readonly add: "+";
12
- readonly sub: "-";
13
- readonly mul: "*";
14
- readonly div: "/";
15
- readonly mod: "%";
16
- readonly equal: "==";
17
- readonly notEqual: "!=";
18
- readonly lessThan: "<";
19
- readonly lessThanEqual: "<=";
20
- readonly greaterThan: ">";
21
- readonly greaterThanEqual: ">=";
22
- readonly and: "&&";
23
- readonly or: "||";
24
- readonly bitAnd: "&";
25
- readonly bitOr: "|";
26
- readonly bitXor: "^";
27
- readonly shiftLeft: "<<";
28
- readonly shiftRight: ">>";
29
- };
30
- declare const OPERATOR_KEYS: (keyof typeof OPERATORS)[];
31
- declare const SCALAR_RETURN_FUNCTIONS: readonly ["dot", "distance", "length", "lengthSq", "determinant", "luminance"];
32
- declare const BOOL_RETURN_FUNCTIONS: readonly ["all", "any"];
33
- declare const PRESERVE_TYPE_FUNCTIONS: readonly ["abs", "sign", "floor", "ceil", "round", "fract", "trunc", "sin", "cos", "tan", "asin", "acos", "atan", "exp", "exp2", "log", "log2", "sqrt", "inverseSqrt", "normalize", "oneMinus", "saturate", "negate", "reciprocal", "dFdx", "dFdy", "fwidth"];
34
- declare const VEC3_RETURN_FUNCTIONS: readonly ["cross"];
35
- declare const FIRST_ARG_TYPE_FUNCTIONS: readonly ["reflect", "refract"];
36
- declare const HIGHEST_TYPE_FUNCTIONS: readonly ["min", "max", "mix", "clamp", "step", "smoothstep"];
37
- declare const VEC4_RETURN_FUNCTIONS: readonly ["texture", "textureLod", "textureSize", "cubeTexture"];
38
- declare const ADDITIONAL_FUNCTIONS: readonly ["atan2", "degrees", "faceforward", "bitcast", "cbrt", "difference", "equals", "pow", "pow2", "pow3", "pow4", "radians", "transformDirection"];
39
- declare const FUNCTIONS: readonly ["dot", "distance", "length", "lengthSq", "determinant", "luminance", "all", "any", "abs", "sign", "floor", "ceil", "round", "fract", "trunc", "sin", "cos", "tan", "asin", "acos", "atan", "exp", "exp2", "log", "log2", "sqrt", "inverseSqrt", "normalize", "oneMinus", "saturate", "negate", "reciprocal", "dFdx", "dFdy", "fwidth", "cross", "reflect", "refract", "min", "max", "mix", "clamp", "step", "smoothstep", "texture", "textureLod", "textureSize", "cubeTexture", "atan2", "degrees", "faceforward", "bitcast", "cbrt", "difference", "equals", "pow", "pow2", "pow3", "pow4", "radians", "transformDirection"];
40
- declare const TYPE_MAPPING: {
41
- readonly float: "f32";
42
- readonly int: "i32";
43
- readonly uint: "u32";
44
- readonly bool: "bool";
45
- readonly vec2: "vec2f";
46
- readonly vec3: "vec3f";
47
- readonly vec4: "vec4f";
48
- readonly mat2: "mat2x2f";
49
- readonly mat3: "mat3x3f";
50
- readonly mat4: "mat4x4f";
51
- readonly ivec2: "vec2i";
52
- readonly ivec3: "vec3i";
53
- readonly ivec4: "vec4i";
54
- readonly uvec2: "vec2u";
55
- readonly uvec3: "vec3u";
56
- readonly uvec4: "vec4u";
57
- readonly bvec2: "vec2<bool>";
58
- readonly bvec3: "vec3<bool>";
59
- readonly bvec4: "vec4<bool>";
60
- };
61
- declare const COMPONENT_COUNT_TO_TYPE: {
62
- readonly 1: "float";
63
- readonly 2: "vec2";
64
- readonly 3: "vec3";
65
- readonly 4: "vec4";
66
- readonly 9: "mat3";
67
- readonly 16: "mat4";
68
- };
69
- declare const BUILTIN_TYPES: {
70
- readonly position: "vec4";
71
- readonly vertex_index: "uint";
72
- readonly instance_index: "uint";
73
- readonly front_facing: "bool";
74
- readonly frag_depth: "float";
75
- readonly sample_index: "uint";
76
- readonly sample_mask: "uint";
77
- readonly point_coord: "vec2";
78
- readonly positionLocal: "vec3";
79
- readonly positionWorld: "vec3";
80
- readonly positionView: "vec3";
81
- readonly normalLocal: "vec3";
82
- readonly normalWorld: "vec3";
83
- readonly normalView: "vec3";
84
- readonly screenCoordinate: "vec2";
85
- readonly screenUV: "vec2";
86
- readonly gl_FragCoord: "vec4";
87
- readonly gl_VertexID: "uint";
88
- readonly gl_InstanceID: "uint";
89
- readonly gl_FrontFacing: "bool";
90
- readonly gl_FragDepth: "float";
91
- readonly gl_SampleID: "uint";
92
- readonly gl_SampleMask: "uint";
93
- readonly gl_PointCoord: "vec2";
94
- readonly normal: "vec3";
95
- readonly uv: "vec2";
96
- readonly color: "vec4";
97
- };
98
- declare const COMPARISON_OPERATORS: readonly ["equal", "notEqual", "lessThan", "lessThanEqual", "greaterThan", "greaterThanEqual"];
99
- declare const LOGICAL_OPERATORS: readonly ["and", "or"];
100
- declare const WGSL_TO_GLSL_BUILTIN: {
101
- readonly position: "gl_FragCoord";
102
- readonly vertex_index: "gl_VertexID";
103
- readonly instance_index: "gl_InstanceID";
104
- readonly front_facing: "gl_FrontFacing";
105
- readonly frag_depth: "gl_FragDepth";
106
- readonly sample_index: "gl_SampleID";
107
- readonly sample_mask: "gl_SampleMask";
108
- readonly point_coord: "gl_PointCoord";
109
- };
110
-
111
- type Constants = (typeof CONSTANTS)[number] | 'void';
112
- type Conversions = (typeof CONVERSIONS)[number];
113
- type Functions = (typeof FUNCTIONS)[number];
114
- type Operators = (typeof OPERATOR_KEYS)[number];
115
- interface NodeProps {
116
- id?: string;
117
- args?: X[];
118
- type?: string;
119
- children?: X[];
120
- value?: number | number[] | boolean;
121
- }
122
- interface NodeConfig {
123
- isWebGL?: boolean;
124
- binding?: number;
125
- infers?: WeakMap<NodeProxy, Constants>;
126
- headers?: Map<string, string>;
127
- onMount?: (name: string, value: any) => void;
128
- }
129
- type _Swizzles<T extends string> = T | `${T}${T}` | `${T}${T}${T}` | `${T}${T}${T}${T}`;
130
- type Swizzles = _Swizzles<'x' | 'y' | 'z' | 'w'> | _Swizzles<'r' | 'g' | 'b' | 'a'> | _Swizzles<'p' | 'q'> | _Swizzles<'s' | 't'>;
131
- type NodeTypes = 'uniform' | 'variable' | 'swizzle' | 'operator' | 'conversion' | 'function' | 'declare' | 'assign' | 'define' | 'if' | 'loop' | 'scope' | 'switch' | 'ternary' | 'attribute' | 'varying' | 'builtin' | 'constant';
132
- interface NodeProxy extends Record<Swizzles | Conversions, NodeProxy> {
133
- add(n: X): NodeProxy;
134
- sub(n: X): NodeProxy;
135
- mul(n: X): NodeProxy;
136
- div(n: X): NodeProxy;
137
- mod(n: X): NodeProxy;
138
- equal(n: X): NodeProxy;
139
- notEqual(n: X): NodeProxy;
140
- lessThan(n: X): NodeProxy;
141
- lessThanEqual(n: X): NodeProxy;
142
- greaterThan(n: X): NodeProxy;
143
- greaterThanEqual(n: X): NodeProxy;
144
- and(n: X): NodeProxy;
145
- or(n: X): NodeProxy;
146
- not(): NodeProxy;
147
- assign(n: X): NodeProxy;
148
- toVar(name?: string): NodeProxy;
149
- toConst(name?: string): NodeProxy;
150
- abs(): NodeProxy;
151
- sin(): NodeProxy;
152
- cos(): NodeProxy;
153
- tan(): NodeProxy;
154
- asin(): NodeProxy;
155
- acos(): NodeProxy;
156
- atan(): NodeProxy;
157
- atan2(x: X): NodeProxy;
158
- pow(y: X): NodeProxy;
159
- pow2(): NodeProxy;
160
- pow3(): NodeProxy;
161
- pow4(): NodeProxy;
162
- sqrt(): NodeProxy;
163
- inverseSqrt(): NodeProxy;
164
- exp(): NodeProxy;
165
- exp2(): NodeProxy;
166
- log(): NodeProxy;
167
- log2(): NodeProxy;
168
- floor(): NodeProxy;
169
- ceil(): NodeProxy;
170
- round(): NodeProxy;
171
- fract(): NodeProxy;
172
- trunc(): NodeProxy;
173
- min(y: X): NodeProxy;
174
- max(y: X): NodeProxy;
175
- clamp(min: X, max: X): NodeProxy;
176
- saturate(): NodeProxy;
177
- mix(y: X, a: X): NodeProxy;
178
- step(edge: X): NodeProxy;
179
- smoothstep(edge0: X, edge1: X): NodeProxy;
180
- length(): NodeProxy;
181
- distance(y: X): NodeProxy;
182
- dot(y: X): NodeProxy;
183
- cross(y: X): NodeProxy;
184
- normalize(): NodeProxy;
185
- reflect(N: X): NodeProxy;
186
- refract(N: X, eta: X): NodeProxy;
187
- sign(): NodeProxy;
188
- oneMinus(): NodeProxy;
189
- reciprocal(): NodeProxy;
190
- negate(): NodeProxy;
191
- dFdx(): NodeProxy;
192
- dFdy(): NodeProxy;
193
- fwidth(): NodeProxy;
194
- toString(c?: NodeConfig): string;
195
- type: NodeTypes;
196
- props: NodeProps;
197
- isProxy: true;
198
- }
199
- type X = NodeProxy | number | string | boolean | undefined;
200
-
201
- declare const code: (target: X, c?: NodeConfig | null) => string;
202
-
203
- declare const inferImpl: (target: NodeProxy, c: NodeConfig) => Constants;
204
- declare const infer: (target: X, c: NodeConfig | null) => Constants;
205
-
206
- declare const node: (type: NodeTypes, props?: NodeProps | null, ...args: X[]) => NodeProxy;
207
- declare const swizzle: (key: Swizzles, arg: X) => NodeProxy;
208
- declare const operator: (key: Operators, ...args: X[]) => NodeProxy;
209
- declare const function_: (key: Functions, ...args: X[]) => NodeProxy;
210
- declare const conversion: (key: string, ...args: X[]) => NodeProxy;
211
-
212
- declare const toVar: (x: X, id?: string) => NodeProxy;
213
- declare const assign: (x: X, y: X) => X;
214
- declare const If: (condition: X, fun: () => void) => {
215
- ElseIf: (x: X, _fun: () => void) => /*elided*/ any;
216
- Else: (_fun: () => void) => void;
217
- };
218
- declare const Loop: (x: X, fun: (params: {
219
- i?: NodeProxy;
220
- }) => void) => NodeProxy;
221
- declare const Switch: (value: X) => {
222
- Case: (...values: X[]) => (fun: () => void) => /*elided*/ any;
223
- Default: (fun: () => void) => void;
224
- };
225
- declare const Fn: (fun: (paramVars: NodeProxy[]) => NodeProxy) => (...args: X[]) => NodeProxy;
226
-
227
- declare const isSwizzle: (key: unknown) => key is Swizzles;
228
- declare const isOperator: (key: unknown) => key is Operators;
229
- declare const isFunction: (key: unknown) => key is Functions;
230
- declare const isConversion: (key: unknown) => key is Conversions;
231
- declare const isNodeProxy: (x: unknown) => x is NodeProxy;
232
- declare const hex2rgb: (hex: number) => number[];
233
- declare const getId: () => string;
234
- declare const joins: (children: X[], c: NodeConfig) => string;
235
- declare const formatConversions: (x: X, c?: NodeConfig) => string;
236
- declare const getOperator: (op: X) => "/" | "+" | "-" | "*" | "%" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "&&" | "||" | "&" | "|" | "^" | "<<" | ">>";
237
- declare const generateDefine: (props: NodeProps$1, c: NodeConfig) => string;
238
- declare const fragment: (x: X, c?: NodeConfig) => string;
239
- declare const vertex: (x: X, c: NodeConfig) => string;
240
-
241
- declare const select: (x: X, y: X, z: X) => NodeProxy;
242
- declare const uniform: (value: number | number[], id?: string) => NodeProxy;
243
- declare const varying: (value: number | number[], id?: string) => NodeProxy;
244
- declare const attribute: (value: number | number[], id?: string) => NodeProxy;
245
- declare const variable: (id: string) => NodeProxy;
246
- declare const builtin: (id: string) => NodeProxy;
247
- declare const iResolution: NodeProxy;
248
- declare const iMouse: NodeProxy;
249
- declare const iTime: NodeProxy;
250
- declare const position: NodeProxy;
251
- declare const vertexIndex: NodeProxy;
252
- declare const instanceIndex: NodeProxy;
253
- declare const frontFacing: NodeProxy;
254
- declare const fragDepth: NodeProxy;
255
- declare const sampleIndex: NodeProxy;
256
- declare const sampleMask: NodeProxy;
257
- declare const pointCoord: NodeProxy;
258
- declare const positionLocal: NodeProxy;
259
- declare const positionWorld: NodeProxy;
260
- declare const positionView: NodeProxy;
261
- declare const normalLocal: NodeProxy;
262
- declare const normalWorld: NodeProxy;
263
- declare const normalView: NodeProxy;
264
- declare const screenCoordinate: NodeProxy;
265
- declare const screenUV: NodeProxy;
266
- declare const fragCoord: NodeProxy;
267
- declare const vertexId: NodeProxy;
268
- declare const float: (x: X) => NodeProxy;
269
- declare const int: (x: X) => NodeProxy;
270
- declare const uint: (x: X) => NodeProxy;
271
- declare const bool: (x: X) => NodeProxy;
272
- declare const vec2: (x?: X, y?: X) => NodeProxy;
273
- declare const vec3: (x?: X, y?: X, z?: X) => NodeProxy;
274
- declare const vec4: (x?: X, y?: X, z?: X, w?: X) => NodeProxy;
275
- declare const mat2: (...args: X[]) => NodeProxy;
276
- declare const mat3: (...args: X[]) => NodeProxy;
277
- declare const mat4: (...args: X[]) => NodeProxy;
278
- declare const ivec2: (x?: X, y?: X) => NodeProxy;
279
- declare const ivec3: (x?: X, y?: X, z?: X) => NodeProxy;
280
- declare const ivec4: (x?: X, y?: X, z?: X, w?: X) => NodeProxy;
281
- declare const uvec2: (x?: X, y?: X) => NodeProxy;
282
- declare const uvec3: (x?: X, y?: X, z?: X) => NodeProxy;
283
- declare const uvec4: (x?: X, y?: X, z?: X, w?: X) => NodeProxy;
284
- declare const bvec2: (x?: X, y?: X) => NodeProxy;
285
- declare const bvec3: (x?: X, y?: X, z?: X) => NodeProxy;
286
- declare const bvec4: (x?: X, y?: X, z?: X, w?: X) => NodeProxy;
287
- declare const color: (r?: X, g?: X, b?: X) => NodeProxy;
288
- declare const texture: (x: X, y: X, z?: X) => NodeProxy;
289
- declare const cubeTexture: (x: X, y: X, z?: X) => NodeProxy;
290
- declare const textureSize: (x: X, y?: X) => NodeProxy;
291
- declare const abs: (x: X) => NodeProxy;
292
- declare const acos: (x: X) => NodeProxy;
293
- declare const all: (x: X) => NodeProxy;
294
- declare const any: (x: X) => NodeProxy;
295
- declare const asin: (x: X) => NodeProxy;
296
- declare const atan: (y: X, x?: X) => NodeProxy;
297
- declare const atan2: (y: X, x: X) => NodeProxy;
298
- declare const bitcast: (x: X, y: X) => NodeProxy;
299
- declare const cbrt: (x: X) => NodeProxy;
300
- declare const ceil: (x: X) => NodeProxy;
301
- declare const clamp: (x: X, min: X, max: X) => NodeProxy;
302
- declare const cos: (x: X) => NodeProxy;
303
- declare const cross: (x: X, y: X) => NodeProxy;
304
- declare const dFdx: (p: X) => NodeProxy;
305
- declare const dFdy: (p: X) => NodeProxy;
306
- declare const degrees: (radians: X) => NodeProxy;
307
- declare const difference: (x: X, y: X) => NodeProxy;
308
- declare const distance: (x: X, y: X) => NodeProxy;
309
- declare const dot: (x: X, y: X) => NodeProxy;
310
- declare const equals: (x: X, y: X) => NodeProxy;
311
- declare const exp: (x: X) => NodeProxy;
312
- declare const exp2: (x: X) => NodeProxy;
313
- declare const faceforward: (N: X, I: X, Nref: X) => NodeProxy;
314
- declare const floor: (x: X) => NodeProxy;
315
- declare const fract: (x: X) => NodeProxy;
316
- declare const fwidth: (x: X) => NodeProxy;
317
- declare const inverseSqrt: (x: X) => NodeProxy;
318
- declare const length: (x: X) => NodeProxy;
319
- declare const lengthSq: (x: X) => NodeProxy;
320
- declare const log: (x: X) => NodeProxy;
321
- declare const log2: (x: X) => NodeProxy;
322
- declare const max: (x: X, y: X) => NodeProxy;
323
- declare const min: (x: X, y: X) => NodeProxy;
324
- declare const mix: (x: X, y: X, a: X) => NodeProxy;
325
- declare const negate: (x: X) => NodeProxy;
326
- declare const normalize: (x: X) => NodeProxy;
327
- declare const oneMinus: (x: X) => NodeProxy;
328
- declare const pow: (x: X, y: X) => NodeProxy;
329
- declare const pow2: (x: X) => NodeProxy;
330
- declare const pow3: (x: X) => NodeProxy;
331
- declare const pow4: (x: X) => NodeProxy;
332
- declare const radians: (degrees: X) => NodeProxy;
333
- declare const reciprocal: (x: X) => NodeProxy;
334
- declare const reflect: (I: X, N: X) => NodeProxy;
335
- declare const refract: (I: X, N: X, eta: X) => NodeProxy;
336
- declare const round: (x: X) => NodeProxy;
337
- declare const saturate: (x: X) => NodeProxy;
338
- declare const sign: (x: X) => NodeProxy;
339
- declare const sin: (x: X) => NodeProxy;
340
- declare const smoothstep: (e0: X, e1: X, x: X) => NodeProxy;
341
- declare const sqrt: (x: X) => NodeProxy;
342
- declare const step: (edge: X, x: X) => NodeProxy;
343
- declare const tan: (x: X) => NodeProxy;
344
- declare const transformDirection: (dir: X, matrix: X) => NodeProxy;
345
- declare const trunc: (x: X) => NodeProxy;
346
-
347
- type GPUContext = any;
348
- type GPUDevice = any;
349
- type GPUBuffer = any;
350
- type GPUPipeline = any;
351
- type GPUBindGroup = any;
352
- type Uniform = number | number[];
353
- type Attribute = number[];
354
- type Attributes = Record<string, Attribute>;
355
- type Uniforms = Record<string, Uniform>;
356
- type PrecisionMode = 'highp' | 'mediump' | 'lowp';
357
- type GLClearMode = 'COLOR_BUFFER_BIT' | 'DEPTH_BUFFER_BIT' | 'STENCIL_BUFFER_BIT';
358
- type GLDrawType = 'UNSIGNED_BYTE' | 'UNSIGNED_SHORT' | 'UNSIGNED_INT';
359
- type GLDrawMode = 'POINTS' | 'LINE_STRIP' | 'LINE_LOOP' | 'LINES' | 'TRIANGLE_STRIP' | 'TRIANGLE_FAN' | 'TRIANGLES';
360
- interface WebGLState {
361
- context: WebGLRenderingContext;
362
- program: WebGLProgram;
363
- }
364
- interface WebGPUState {
365
- device: GPUDevice;
366
- context: GPUContext;
367
- pipeline: GPUPipeline;
368
- groups: any[];
369
- resources: any[];
370
- loadingImg: number;
371
- needsUpdate: boolean;
372
- }
373
- type GL = EventState<{
374
- /**
375
- * initial value
376
- */
377
- isNative: boolean;
378
- isWebGL: boolean;
379
- isLoop: boolean;
380
- isGL: true;
381
- width: number;
382
- height: number;
383
- size: [number, number];
384
- mouse: [number, number];
385
- count: number;
386
- el: HTMLCanvasElement;
387
- vs: string | NodeProxy;
388
- fs: string | NodeProxy;
389
- vert: string | NodeProxy;
390
- frag: string | NodeProxy;
391
- vertex: string | NodeProxy;
392
- fragment: string | NodeProxy;
393
- /**
394
- * core state
395
- */
396
- webgpu: WebGPUState;
397
- webgl: WebGLState;
398
- queue: Queue;
399
- frame: Frame;
400
- /**
401
- * events
402
- */
403
- ref?: any;
404
- init(): void;
405
- loop(): void;
406
- mount(): void;
407
- clean(): void;
408
- render(): void;
409
- resize(e?: Event): void;
410
- mousemove(e: Event): void;
411
- /**
412
- * setter
413
- */
414
- _uniform?(key: string, value: Uniform, isMatrix?: boolean): GL;
415
- uniform(key: string, value: Uniform, isMatrix?: boolean): GL;
416
- uniform(target: {
417
- [key: string]: Uniform;
418
- }): GL;
419
- _texture?(key: string, value: string): GL;
420
- texture(key: string, value: string): GL;
421
- texture(target: {
422
- [key: string]: string;
423
- }): GL;
424
- _attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
425
- attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
426
- attribute(target: {
427
- [key: string]: Attribute;
428
- }): GL;
429
- }>;
430
-
431
- declare const is: {
432
- arr: (arg: any) => arg is any[];
433
- bol: (a: unknown) => a is boolean;
434
- str: (a: unknown) => a is string;
435
- num: (a: unknown) => a is number;
436
- int: (a: unknown) => a is number;
437
- fun: (a: unknown) => a is Function;
438
- und: (a: unknown) => a is undefined;
439
- nul: (a: unknown) => a is null;
440
- set: (a: unknown) => a is Set<unknown>;
441
- map: (a: unknown) => a is Map<unknown, unknown>;
442
- obj: (a: unknown) => a is object;
443
- nan: (a: unknown) => a is number;
444
- };
445
- /**
446
- * each
447
- */
448
- type EachFn<Value, Key, This> = (this: This, value: Value, key: Key) => void;
449
- type Eachable<Value = any, Key = any, This = any> = {
450
- forEach(cb: EachFn<Value, Key, This>, ctx?: This): void;
451
- };
452
- declare const each: <Value, Key, This>(obj: Eachable<Value, Key, This>, fn: EachFn<Value, Key, This>) => void;
453
- declare const flush: <Value extends Function, Key, This>(obj: Eachable<Value, Key, This>, ...args: any[]) => void;
454
- /**
455
- * other
456
- */
457
- declare const replace: (x?: string, from?: string, to?: string) => string;
458
- declare const ext: (src?: string) => string;
459
- declare const fig: (x?: number) => number;
460
- declare const dig: (x?: number) => number;
461
- declare const sig: (value?: number, digit?: number) => number;
462
-
463
- declare const createDevice: (c: GPUContext) => Promise<{
464
- device: any;
465
- format: any;
466
- }>;
467
- declare const createPipeline: (device: GPUDevice, format: string, bufferLayouts: any[], bindGroupLayouts: any[], vs?: string | NodeProxy, fs?: string | NodeProxy) => GPUPipeline;
468
- declare const createBindGroup: (device: GPUDevice, resources: any[]) => {
469
- layout: any;
470
- bindGroup: any;
471
- };
472
- declare const createDescriptor: (c: GPUContext) => {
473
- colorAttachments: {
474
- view: any;
475
- clearValue: {
476
- r: number;
477
- g: number;
478
- b: number;
479
- a: number;
480
- };
481
- loadOp: string;
482
- storeOp: string;
483
- }[];
484
- };
485
- declare const alignTo256: (size: number) => number;
486
- declare const createVertexBuffer: (device: GPUDevice, value: number[]) => {
487
- array: Float32Array<ArrayBuffer>;
488
- buffer: any;
489
- };
490
- declare const createUniformBuffer: (device: GPUDevice, value: number[]) => {
491
- array: Float32Array<ArrayBuffer>;
492
- buffer: Buffer;
493
- };
494
- declare const createTextureSampler: (device: GPUDevice, width?: number, height?: number) => {
495
- texture: any;
496
- sampler: any;
497
- };
498
- declare const createBufferLayout: (shaderLocation: number, dataLength: number, count?: number) => {
499
- arrayStride: number;
500
- attributes: {
501
- shaderLocation: number;
502
- offset: number;
503
- format: string;
504
- }[];
505
- };
506
-
507
- declare const defaultVertexGLSL = "\n#version 300 es\nvoid main() {\n float x = float(gl_VertexID % 2) * 4.0 - 1.0;\n float y = float(gl_VertexID / 2) * 4.0 - 1.0;\n gl_Position = vec4(x, y, 0.0, 1.0);\n}\n";
508
- declare const defaultFragmentGLSL = "\n#version 300 es\nprecision mediump float;\nuniform vec2 iResolution;\nout vec4 fragColor;\nvoid main() {\n fragColor = vec4(fract(gl_FragCoord.xy / iResolution), 0, 1);\n}\n";
509
- declare const createProgram: (c: WebGLRenderingContext, vs?: string | NodeProxy, fs?: string | NodeProxy, onError?: () => void) => void | WebGLProgram;
510
- declare const createVbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
511
- declare const createIbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
512
- declare const getStride: (count: number, value: number[], iboValue?: number[]) => number;
513
- declare const createAttrib: (c: WebGLRenderingContext, stride: number, loc: any, vbo: WebGLBuffer, ibo?: WebGLBuffer) => void;
514
- declare const createTexture: (c: WebGLRenderingContext, img: HTMLImageElement, loc: any, unit: number) => void;
515
-
516
- declare const webgl: (gl: Partial<GL>) => Promise<{
517
- webgl: WebGLState;
518
- render: () => void;
519
- clean: () => void;
520
- _attribute: (key: string | undefined, value: number[], iboValue: number[]) => void;
521
- _uniform: (key: string, value: number | number[]) => void;
522
- _texture: (key: string, src: string) => void;
523
- }>;
524
-
525
- declare const webgpu: (gl: Partial<GL>) => Promise<{
526
- webgpu: WebGPUState;
527
- render: () => void;
528
- clean: () => void;
529
- _attribute: (key: string | undefined, value: number[]) => void;
530
- _uniform: (key: string, value: number | number[]) => void;
531
- _texture: (key: string, src: string) => void;
532
- }>;
533
-
534
- declare const isGL: (a: unknown) => a is EventState<GL>;
535
- declare const isServer: () => boolean;
536
- declare const isWebGPUSupported: () => boolean;
537
- declare const createGL: (props?: Partial<GL>) => EventState<{
538
- isNative: boolean;
539
- isWebGL: boolean;
540
- isLoop: boolean;
541
- isGL: true;
542
- width: number;
543
- height: number;
544
- size: [number, number];
545
- mouse: [number, number];
546
- count: number;
547
- el: HTMLCanvasElement;
548
- vs: string | NodeProxy;
549
- fs: string | NodeProxy;
550
- vert: string | NodeProxy;
551
- frag: string | NodeProxy;
552
- vertex: string | NodeProxy;
553
- fragment: string | NodeProxy;
554
- webgpu: WebGPUState;
555
- webgl: WebGLState;
556
- queue: refr.Queue;
557
- frame: refr.Frame;
558
- ref?: any;
559
- init(): void;
560
- loop(): void;
561
- mount(): void;
562
- clean(): void;
563
- render(): void;
564
- resize(e?: Event): void;
565
- mousemove(e: Event): void;
566
- _uniform?(key: string, value: Uniform, isMatrix?: boolean): GL;
567
- uniform(key: string, value: Uniform, isMatrix?: boolean): GL;
568
- uniform(target: {
569
- [key: string]: Uniform;
570
- }): GL;
571
- _texture?(key: string, value: string): GL;
572
- texture(key: string, value: string): GL;
573
- texture(target: {
574
- [key: string]: string;
575
- }): GL;
576
- _attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
577
- attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
578
- attribute(target: {
579
- [key: string]: Attribute;
580
- }): GL;
581
- }, any[] | unknown[]>;
582
-
583
- export { ADDITIONAL_FUNCTIONS, type Attribute, type Attributes, BOOL_RETURN_FUNCTIONS, BUILTIN_TYPES, COMPARISON_OPERATORS, COMPONENT_COUNT_TO_TYPE, CONSTANTS, CONVERSIONS, type Constants, type Conversions, FIRST_ARG_TYPE_FUNCTIONS, FUNCTIONS, Fn, type Functions, type GL, type GLClearMode, type GLDrawMode, type GLDrawType, type GPUBindGroup, type GPUBuffer, type GPUContext, type GPUDevice, type GPUPipeline, HIGHEST_TYPE_FUNCTIONS, If, LOGICAL_OPERATORS, Loop, type NodeConfig, type NodeProps, type NodeProxy, type NodeTypes, OPERATORS, OPERATOR_KEYS, type Operators, PRESERVE_TYPE_FUNCTIONS, type PrecisionMode, SCALAR_RETURN_FUNCTIONS, SWIZZLES, Switch, type Swizzles, TYPE_MAPPING, type Uniform, type Uniforms, VEC3_RETURN_FUNCTIONS, VEC4_RETURN_FUNCTIONS, WGSL_TO_GLSL_BUILTIN, type WebGLState, type WebGPUState, type X, abs, acos, alignTo256, all, any, asin, assign, atan, atan2, attribute, bitcast, bool, builtin, bvec2, bvec3, bvec4, cbrt, ceil, clamp, code, color, conversion, cos, createAttrib, createBindGroup, createBufferLayout, createDescriptor, createDevice, createGL, createIbo, createPipeline, createProgram, createTexture, createTextureSampler, createUniformBuffer, createVbo, createVertexBuffer, cross, cubeTexture, dFdx, dFdy, createGL as default, defaultFragmentGLSL, defaultVertexGLSL, degrees, difference, dig, distance, dot, each, equals, exp, exp2, ext, faceforward, fig, float, floor, flush, formatConversions, fract, fragCoord, fragDepth, fragment, frontFacing, function_, fwidth, generateDefine, getId, getOperator, getStride, hex2rgb, iMouse, iResolution, iTime, infer, inferImpl, instanceIndex, int, inverseSqrt, is, isConversion, isFunction, isGL, isNodeProxy, isOperator, isServer, isSwizzle, isWebGPUSupported, ivec2, ivec3, ivec4, joins, length, lengthSq, log, log2, mat2, mat3, mat4, max, min, mix, negate, node, normalLocal, normalView, normalWorld, normalize, oneMinus, operator, pointCoord, position, positionLocal, positionView, positionWorld, pow, pow2, pow3, pow4, radians, reciprocal, reflect, refract, replace, round, sampleIndex, sampleMask, saturate, screenCoordinate, screenUV, select, sig, sign, sin, smoothstep, sqrt, step, swizzle, tan, texture, textureSize, toVar, transformDirection, trunc, uint, uniform, uvec2, uvec3, uvec4, variable, varying, vec2, vec3, vec4, vertex, vertexId, vertexIndex, webgl, webgpu };
2
+ export { A as Attribute, k as Attributes, G as GL, m as GLClearMode, o as GLDrawMode, n as GLDrawType, j as GPUBindGroup, g as GPUBuffer, e as GPUContext, f as GPUDevice, h as GPUPipeline, P as PrecisionMode, U as Uniform, l as Uniforms, a as WebGLState, W as WebGPUState, C as alignTo256, Q as createAttrib, z as createBindGroup, H as createBufferLayout, B as createDescriptor, x as createDevice, d as createGL, M as createIbo, y as createPipeline, K as createProgram, R as createTexture, F as createTextureSampler, E as createUniformBuffer, L as createVbo, D as createVertexBuffer, d as default, J as defaultFragmentGLSL, I as defaultVertexGLSL, v as dig, q as each, t as ext, u as fig, r as flush, O as getStride, p as is, i as isGL, b as isServer, c as isWebGPUSupported, s as replace, w as sig, S as webgl, T as webgpu } from './index-q8W5cl04.cjs';
3
+ import 'reev';