@lightningjs/renderer 0.6.0 → 0.6.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 +1 -1
- package/dist/src/core/CoreNode.d.ts +63 -15
- package/dist/src/core/CoreNode.js +238 -118
- package/dist/src/core/CoreNode.js.map +1 -1
- package/dist/src/core/CoreTextNode.d.ts +1 -0
- package/dist/src/core/CoreTextNode.js +13 -0
- package/dist/src/core/CoreTextNode.js.map +1 -1
- package/dist/src/core/Stage.d.ts +6 -2
- package/dist/src/core/Stage.js +24 -21
- package/dist/src/core/Stage.js.map +1 -1
- package/dist/src/core/animations/CoreAnimation.js +11 -2
- package/dist/src/core/animations/CoreAnimation.js.map +1 -1
- package/dist/src/core/lib/ContextSpy.d.ts +12 -0
- package/dist/src/core/lib/ContextSpy.js +38 -0
- package/dist/src/core/lib/ContextSpy.js.map +1 -0
- package/dist/src/core/lib/WebGlContext.d.ts +414 -0
- package/dist/src/core/lib/WebGlContext.js +640 -0
- package/dist/src/core/lib/WebGlContext.js.map +1 -0
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +496 -0
- package/dist/src/core/lib/WebGlContextWrapper.js +779 -0
- package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -0
- package/dist/src/core/platform.js +4 -0
- package/dist/src/core/platform.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js +9 -8
- package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.js +4 -5
- package/dist/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js +15 -13
- package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/CoreNode.ts +293 -149
- package/src/core/CoreTextNode.ts +16 -0
- package/src/core/Stage.ts +28 -31
- package/src/core/animations/CoreAnimation.ts +11 -2
- package/src/core/platform.ts +5 -0
- package/src/core/renderers/webgl/WebGlCoreRenderer.ts +9 -40
- package/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.ts +4 -5
- package/src/core/text-rendering/renderers/CanvasTextRenderer.ts +19 -15
- package/src/core/scene/Scene.ts +0 -120
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimized WebGL Context Wrapper
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This class contains the subset of the WebGLRenderingContext & WebGL2RenderingContext
|
|
6
|
+
* API that is used by the renderer. Select high volume WebGL methods include
|
|
7
|
+
* caching optimizations to avoid making WebGL calls if the state is already set
|
|
8
|
+
* to the desired value.
|
|
9
|
+
*
|
|
10
|
+
* While most methods contained are direct passthroughs to the WebGL context,
|
|
11
|
+
* some methods combine multiple WebGL calls into one for convenience, modify
|
|
12
|
+
* arguments to be more convenient, or are replaced by more specific methods.
|
|
13
|
+
*
|
|
14
|
+
* Not all methods are optimized. Only methods that are called frequently
|
|
15
|
+
* and/or have a high cost are optimized.
|
|
16
|
+
*
|
|
17
|
+
* A subset of GLenum constants are also exposed as properties on this class
|
|
18
|
+
* for convenience.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WebGlContextWrapper {
|
|
21
|
+
private gl;
|
|
22
|
+
private activeTextureUnit;
|
|
23
|
+
private texture2dUnits;
|
|
24
|
+
private texture2dParams;
|
|
25
|
+
private scissorEnabled;
|
|
26
|
+
private scissorX;
|
|
27
|
+
private scissorY;
|
|
28
|
+
private scissorWidth;
|
|
29
|
+
private scissorHeight;
|
|
30
|
+
private blendEnabled;
|
|
31
|
+
private blendSrcRgb;
|
|
32
|
+
private blendDstRgb;
|
|
33
|
+
private blendSrcAlpha;
|
|
34
|
+
private blendDstAlpha;
|
|
35
|
+
private boundArrayBuffer;
|
|
36
|
+
private boundElementArrayBuffer;
|
|
37
|
+
private curProgram;
|
|
38
|
+
private programUniforms;
|
|
39
|
+
readonly canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
40
|
+
readonly MAX_RENDERBUFFER_SIZE: 34024;
|
|
41
|
+
readonly MAX_TEXTURE_SIZE: 3379;
|
|
42
|
+
readonly MAX_VIEWPORT_DIMS: 3386;
|
|
43
|
+
readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660;
|
|
44
|
+
readonly MAX_TEXTURE_IMAGE_UNITS: 34930;
|
|
45
|
+
readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661;
|
|
46
|
+
readonly MAX_VERTEX_ATTRIBS: 34921;
|
|
47
|
+
readonly MAX_VARYING_VECTORS: 36348;
|
|
48
|
+
readonly MAX_VERTEX_UNIFORM_VECTORS: 36347;
|
|
49
|
+
readonly MAX_FRAGMENT_UNIFORM_VECTORS: 36349;
|
|
50
|
+
readonly TEXTURE_MAG_FILTER: 10240;
|
|
51
|
+
readonly TEXTURE_MIN_FILTER: 10241;
|
|
52
|
+
readonly TEXTURE_WRAP_S: 10242;
|
|
53
|
+
readonly TEXTURE_WRAP_T: 10243;
|
|
54
|
+
readonly LINEAR: 9729;
|
|
55
|
+
readonly CLAMP_TO_EDGE: 33071;
|
|
56
|
+
readonly RGBA: 6408;
|
|
57
|
+
readonly UNSIGNED_BYTE: 5121;
|
|
58
|
+
readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441;
|
|
59
|
+
readonly FLOAT: 5126;
|
|
60
|
+
readonly TRIANGLES: 4;
|
|
61
|
+
readonly UNSIGNED_SHORT: 5123;
|
|
62
|
+
readonly ONE: 1;
|
|
63
|
+
readonly ONE_MINUS_SRC_ALPHA: 771;
|
|
64
|
+
readonly VERTEX_SHADER: 35633;
|
|
65
|
+
readonly FRAGMENT_SHADER: 35632;
|
|
66
|
+
readonly STATIC_DRAW: 35044;
|
|
67
|
+
readonly COMPILE_STATUS: 35713;
|
|
68
|
+
readonly LINK_STATUS: 35714;
|
|
69
|
+
readonly DYNAMIC_DRAW: 35048;
|
|
70
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
71
|
+
/**
|
|
72
|
+
* Returns true if the WebGL context is WebGL2
|
|
73
|
+
*
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
isWebGl2(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* ```
|
|
79
|
+
* gl.activeTexture(textureUnit + gl.TEXTURE0);
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* **WebGL Difference**: `textureUnit` is based from 0, not `gl.TEXTURE0`.
|
|
84
|
+
*
|
|
85
|
+
* @param textureUnit
|
|
86
|
+
*/
|
|
87
|
+
activeTexture(textureUnit: number): void;
|
|
88
|
+
/**
|
|
89
|
+
* ```
|
|
90
|
+
* gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
91
|
+
* ```
|
|
92
|
+
* @remarks
|
|
93
|
+
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
94
|
+
*
|
|
95
|
+
* @param texture
|
|
96
|
+
*/
|
|
97
|
+
bindTexture(texture: WebGLTexture | null): void;
|
|
98
|
+
private _getActiveTexture;
|
|
99
|
+
/**
|
|
100
|
+
* ```
|
|
101
|
+
* gl.texParameteri(gl.TEXTURE_2D, pname, param);
|
|
102
|
+
* ```
|
|
103
|
+
* @remarks
|
|
104
|
+
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
105
|
+
*
|
|
106
|
+
* @param pname
|
|
107
|
+
* @param param
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
texParameteri(pname: number, param: number): void;
|
|
111
|
+
/**
|
|
112
|
+
* ```
|
|
113
|
+
* gl.texImage2D(
|
|
114
|
+
* gl.TEXTURE_2D,
|
|
115
|
+
* level,
|
|
116
|
+
* internalFormat,
|
|
117
|
+
* width,
|
|
118
|
+
* height,
|
|
119
|
+
* border,
|
|
120
|
+
* format,
|
|
121
|
+
* type,
|
|
122
|
+
* pixels,
|
|
123
|
+
* );
|
|
124
|
+
* ```
|
|
125
|
+
* @remarks
|
|
126
|
+
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
127
|
+
*
|
|
128
|
+
* @param level
|
|
129
|
+
* @param internalFormat
|
|
130
|
+
* @param width
|
|
131
|
+
* @param height
|
|
132
|
+
* @param border
|
|
133
|
+
* @param format
|
|
134
|
+
* @param type
|
|
135
|
+
* @param pixels
|
|
136
|
+
*/
|
|
137
|
+
texImage2D(level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView | null): void;
|
|
138
|
+
texImage2D(level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource): void;
|
|
139
|
+
/**
|
|
140
|
+
* ```
|
|
141
|
+
* gl.pixelStorei(pname, param);
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param pname
|
|
145
|
+
* @param param
|
|
146
|
+
*/
|
|
147
|
+
pixelStorei(pname: GLenum, param: GLint | GLboolean): void;
|
|
148
|
+
/**
|
|
149
|
+
* ```
|
|
150
|
+
* gl.generateMipmap(gl.TEXTURE_2D);
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
155
|
+
*/
|
|
156
|
+
generateMipmap(): void;
|
|
157
|
+
/**
|
|
158
|
+
* ```
|
|
159
|
+
* gl.createTexture();
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
createTexture(): WebGLTexture | null;
|
|
165
|
+
/**
|
|
166
|
+
* ```
|
|
167
|
+
* gl.deleteTexture(texture);
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @param texture
|
|
171
|
+
*/
|
|
172
|
+
deleteTexture(texture: WebGLTexture | null): void;
|
|
173
|
+
/**
|
|
174
|
+
* ```
|
|
175
|
+
* gl.viewport(x, y, width, height);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
|
|
179
|
+
/**
|
|
180
|
+
* ```
|
|
181
|
+
* gl.clearColor(red, green, blue, alpha);
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @param red
|
|
185
|
+
* @param green
|
|
186
|
+
* @param blue
|
|
187
|
+
* @param alpha
|
|
188
|
+
*/
|
|
189
|
+
clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf): void;
|
|
190
|
+
/**
|
|
191
|
+
* ```
|
|
192
|
+
* gl["enable"|"disable"](gl.SCISSOR_TEST);
|
|
193
|
+
* ```
|
|
194
|
+
* @param enable
|
|
195
|
+
*/
|
|
196
|
+
setScissorTest(enable: boolean): void;
|
|
197
|
+
/**
|
|
198
|
+
* ```
|
|
199
|
+
* gl.scissor(x, y, width, height);
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @param x
|
|
203
|
+
* @param y
|
|
204
|
+
* @param width
|
|
205
|
+
* @param height
|
|
206
|
+
*/
|
|
207
|
+
scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
|
|
208
|
+
/**
|
|
209
|
+
* ```
|
|
210
|
+
* gl["enable"|"disable"](gl.BLEND);
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @param blend
|
|
214
|
+
* @returns
|
|
215
|
+
*/
|
|
216
|
+
setBlend(blend: boolean): void;
|
|
217
|
+
/**
|
|
218
|
+
* ```
|
|
219
|
+
* gl.blendFunc(src, dst);
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @param src
|
|
223
|
+
* @param dst
|
|
224
|
+
*/
|
|
225
|
+
blendFunc(src: GLenum, dst: GLenum): void;
|
|
226
|
+
/**
|
|
227
|
+
* ```
|
|
228
|
+
* createBuffer();
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @returns
|
|
232
|
+
*/
|
|
233
|
+
createBuffer(): WebGLBuffer | null;
|
|
234
|
+
/**
|
|
235
|
+
* ```
|
|
236
|
+
* gl.clear(gl.COLOR_BUFFER_BIT);
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* **WebGL Difference**: Clear mask is always `gl.COLOR_BUFFER_BIT`
|
|
241
|
+
*/
|
|
242
|
+
clear(): void;
|
|
243
|
+
/**
|
|
244
|
+
* ```
|
|
245
|
+
* gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
246
|
+
* gl.bufferData(gl.ARRAY_BUFFER, data, usage);
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @remarks
|
|
250
|
+
* **WebGL Combo**: `gl.bindBuffer` and `gl.bufferData` are combined into one function.
|
|
251
|
+
*
|
|
252
|
+
* @param buffer
|
|
253
|
+
* @param data
|
|
254
|
+
* @param usage
|
|
255
|
+
*/
|
|
256
|
+
arrayBufferData(buffer: WebGLBuffer | null, data: ArrayBufferView, usage: GLenum): void;
|
|
257
|
+
/**
|
|
258
|
+
* ```
|
|
259
|
+
* gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);
|
|
260
|
+
* gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data, usage);
|
|
261
|
+
* ```
|
|
262
|
+
* @remarks
|
|
263
|
+
* **WebGL Combo**: `gl.bindBuffer` and `gl.bufferData` are combined into one function.
|
|
264
|
+
*
|
|
265
|
+
* @param buffer
|
|
266
|
+
* @param data
|
|
267
|
+
* @param usage
|
|
268
|
+
*/
|
|
269
|
+
elementArrayBufferData(buffer: WebGLBuffer | null, data: ArrayBufferView, usage: GLenum): void;
|
|
270
|
+
/**
|
|
271
|
+
* ```
|
|
272
|
+
* gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
273
|
+
* gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* **WebGL Combo**: `gl.bindBuffer` and `gl.vertexAttribPointer` are combined into one function.
|
|
278
|
+
*
|
|
279
|
+
* @param buffer
|
|
280
|
+
* @param index
|
|
281
|
+
* @param size
|
|
282
|
+
* @param type
|
|
283
|
+
* @param normalized
|
|
284
|
+
* @param stride
|
|
285
|
+
* @param offset
|
|
286
|
+
*/
|
|
287
|
+
vertexAttribPointer(buffer: WebGLBuffer, index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr): void;
|
|
288
|
+
/**
|
|
289
|
+
* ```
|
|
290
|
+
* gl.useProgram(program);
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param program
|
|
294
|
+
* @returns
|
|
295
|
+
*/
|
|
296
|
+
useProgram(program: WebGLProgram | null): void;
|
|
297
|
+
setUniform<T extends keyof UniformMethodMap>(type: T, location: WebGLUniformLocation, ...args: UniformMethodMap[T]): void;
|
|
298
|
+
/**
|
|
299
|
+
* ```
|
|
300
|
+
* gl.getParameter(pname);
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* @param pname
|
|
304
|
+
* @returns
|
|
305
|
+
*/
|
|
306
|
+
getParameter(pname: GLenum): any;
|
|
307
|
+
/**
|
|
308
|
+
* ```
|
|
309
|
+
* gl.drawElements(mode, count, type, offset);
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @param mode
|
|
313
|
+
* @param count
|
|
314
|
+
* @param type
|
|
315
|
+
* @param offset
|
|
316
|
+
*/
|
|
317
|
+
drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr): void;
|
|
318
|
+
/**
|
|
319
|
+
* ```
|
|
320
|
+
* gl.drawArrays(mode, first, count);
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @param name
|
|
324
|
+
* @returns
|
|
325
|
+
*/
|
|
326
|
+
getExtension(name: string): any;
|
|
327
|
+
/**
|
|
328
|
+
* ```
|
|
329
|
+
* gl.createVertexArray();
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* @returns
|
|
333
|
+
*/
|
|
334
|
+
createVertexArray(): WebGLVertexArrayObject | null;
|
|
335
|
+
/**
|
|
336
|
+
* ```
|
|
337
|
+
* gl.bindVertexArray(vertexArray);
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @param vertexArray
|
|
341
|
+
*/
|
|
342
|
+
bindVertexArray(vertexArray: WebGLVertexArrayObject | null): void;
|
|
343
|
+
/**
|
|
344
|
+
* ```
|
|
345
|
+
* gl.getAttribLocation(program, name);
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @param program
|
|
349
|
+
* @param name
|
|
350
|
+
* @returns
|
|
351
|
+
*/
|
|
352
|
+
getAttribLocation(program: WebGLProgram, name: string): number;
|
|
353
|
+
/**
|
|
354
|
+
* ```
|
|
355
|
+
* gl.getUniformLocation(program, name);
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @param program
|
|
359
|
+
* @param name
|
|
360
|
+
* @returns
|
|
361
|
+
*/
|
|
362
|
+
getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation | null;
|
|
363
|
+
/**
|
|
364
|
+
* ```
|
|
365
|
+
* gl.enableVertexAttribArray(index);
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @param index
|
|
369
|
+
*/
|
|
370
|
+
enableVertexAttribArray(index: number): void;
|
|
371
|
+
/**
|
|
372
|
+
* ```
|
|
373
|
+
* gl.disableVertexAttribArray(index);
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @param index
|
|
377
|
+
*/
|
|
378
|
+
disableVertexAttribArray(index: number): void;
|
|
379
|
+
/**
|
|
380
|
+
* ```
|
|
381
|
+
* gl.createShader(type);
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* @param type
|
|
385
|
+
* @returns
|
|
386
|
+
*/
|
|
387
|
+
createShader(type: number): WebGLShader | null;
|
|
388
|
+
/**
|
|
389
|
+
* ```
|
|
390
|
+
* gl.compileShader(shader);
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @param shader
|
|
394
|
+
* @returns
|
|
395
|
+
*/
|
|
396
|
+
compileShader(shader: WebGLShader): void;
|
|
397
|
+
/**
|
|
398
|
+
* ```
|
|
399
|
+
* gl.attachShader(program, shader);
|
|
400
|
+
* ```
|
|
401
|
+
*
|
|
402
|
+
* @param program
|
|
403
|
+
* @param shader
|
|
404
|
+
*/
|
|
405
|
+
attachShader(program: WebGLProgram, shader: WebGLShader): void;
|
|
406
|
+
/**
|
|
407
|
+
* ```
|
|
408
|
+
* gl.linkProgram(program);
|
|
409
|
+
* ```
|
|
410
|
+
*
|
|
411
|
+
* @param program
|
|
412
|
+
*/
|
|
413
|
+
linkProgram(program: WebGLProgram): void;
|
|
414
|
+
/**
|
|
415
|
+
* ```
|
|
416
|
+
* gl.deleteProgram(shader);
|
|
417
|
+
* ```
|
|
418
|
+
*
|
|
419
|
+
* @param shader
|
|
420
|
+
*/
|
|
421
|
+
deleteProgram(shader: WebGLProgram): void;
|
|
422
|
+
/**
|
|
423
|
+
* ```
|
|
424
|
+
* gl.getShaderParameter(shader, pname);
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @param shader
|
|
428
|
+
* @param pname
|
|
429
|
+
*/
|
|
430
|
+
getShaderParameter(shader: WebGLShader, pname: GLenum): any;
|
|
431
|
+
/**
|
|
432
|
+
* ```
|
|
433
|
+
* gl.getShaderInfoLog(shader);
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* @param shader
|
|
437
|
+
*/
|
|
438
|
+
getShaderInfoLog(shader: WebGLShader): string | null;
|
|
439
|
+
/**
|
|
440
|
+
* ```
|
|
441
|
+
* gl.createProgram();
|
|
442
|
+
* ```
|
|
443
|
+
*
|
|
444
|
+
* @returns
|
|
445
|
+
*/
|
|
446
|
+
createProgram(): WebGLProgram | null;
|
|
447
|
+
/**
|
|
448
|
+
* ```
|
|
449
|
+
* gl.getProgramParameter(program, pname);
|
|
450
|
+
* ```
|
|
451
|
+
*
|
|
452
|
+
* @param program
|
|
453
|
+
* @param pname
|
|
454
|
+
* @returns
|
|
455
|
+
*/
|
|
456
|
+
getProgramParameter(program: WebGLProgram, pname: GLenum): any;
|
|
457
|
+
/**
|
|
458
|
+
* ```
|
|
459
|
+
* gl.getProgramInfoLog(program);
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @param program
|
|
463
|
+
* @returns
|
|
464
|
+
*/
|
|
465
|
+
getProgramInfoLog(program: WebGLProgram): string | null;
|
|
466
|
+
/**
|
|
467
|
+
* ```
|
|
468
|
+
* gl.shaderSource(shader, source);
|
|
469
|
+
* ```
|
|
470
|
+
*
|
|
471
|
+
* @param shader
|
|
472
|
+
* @param source
|
|
473
|
+
*/
|
|
474
|
+
shaderSource(shader: WebGLShader, source: string): void;
|
|
475
|
+
/**
|
|
476
|
+
* ```
|
|
477
|
+
* gl.deleteShader(shader);
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* @param shader
|
|
481
|
+
*/
|
|
482
|
+
deleteShader(shader: WebGLShader): void;
|
|
483
|
+
}
|
|
484
|
+
type IsUniformMethod<MethodName, MethodType> = MethodName extends `uniform${string}` ? MethodType extends (location: WebGLUniformLocation | null, ...args: any[]) => void ? true : false : false;
|
|
485
|
+
export type UniformMethodMap = {
|
|
486
|
+
[Key in keyof WebGLRenderingContext as IsUniformMethod<Key, WebGLRenderingContext[Key]> extends true ? Key : never]: WebGLRenderingContext[Key] extends (location: WebGLUniformLocation | null, ...args: infer T) => void ? T : never;
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
*
|
|
490
|
+
*
|
|
491
|
+
* @param a
|
|
492
|
+
* @param b
|
|
493
|
+
* @returns
|
|
494
|
+
*/
|
|
495
|
+
export declare function compareArrays<T>(a: T[], b: T[]): boolean;
|
|
496
|
+
export {};
|