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