@react-three/test-renderer 10.0.0-alpha.2 → 10.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +228 -228
- package/dist/{react-three-test-renderer.cjs.prod.js → index.cjs} +567 -225
- package/dist/index.d.cts +117 -0
- package/dist/index.d.mts +115 -0
- package/dist/index.d.ts +117 -0
- package/dist/{react-three-test-renderer.esm.js → index.mjs} +555 -204
- package/dist/legacy.cjs +1252 -0
- package/dist/legacy.d.cts +117 -0
- package/dist/legacy.d.mts +115 -0
- package/dist/legacy.d.ts +117 -0
- package/dist/{react-three-test-renderer.cjs.dev.js → legacy.mjs} +557 -237
- package/dist/webgpu/index.cjs +1603 -0
- package/dist/webgpu/index.d.cts +128 -0
- package/dist/webgpu/index.d.mts +126 -0
- package/dist/webgpu/index.d.ts +128 -0
- package/dist/webgpu/index.mjs +1570 -0
- package/package.json +60 -57
- package/CHANGELOG.md +0 -525
- package/dist/declarations/src/createTestInstance.d.ts +0 -22
- package/dist/declarations/src/helpers/waitFor.d.ts +0 -5
- package/dist/declarations/src/index.d.ts +0 -14
- package/dist/declarations/src/types/index.d.ts +0 -1
- package/dist/declarations/src/types/internal.d.ts +0 -20
- package/dist/declarations/src/types/public.d.ts +0 -38
- package/dist/react-three-test-renderer.cjs.d.ts +0 -3
- package/dist/react-three-test-renderer.cjs.js +0 -7
package/dist/legacy.cjs
ADDED
|
@@ -0,0 +1,1252 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const react = require('react');
|
|
6
|
+
const THREE = require('three');
|
|
7
|
+
const legacy$1 = require('@react-three/fiber/legacy');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceCompat(e) {
|
|
10
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
11
|
+
const n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
n[k] = e[k];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
n.default = e;
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const THREE__namespace = /*#__PURE__*/_interopNamespaceCompat(THREE);
|
|
22
|
+
|
|
23
|
+
const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
24
|
+
const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
25
|
+
|
|
26
|
+
const treeObjectFactory = (type, props, children) => ({
|
|
27
|
+
type,
|
|
28
|
+
props,
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
const toTreeBranch = (children) => children.map((child) => {
|
|
32
|
+
return treeObjectFactory(
|
|
33
|
+
lowerCaseFirstLetter(child.object.type || child.object.constructor.name),
|
|
34
|
+
child.props,
|
|
35
|
+
toTreeBranch(child.children)
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
const toTree = (root) => toTreeBranch(root.children);
|
|
39
|
+
|
|
40
|
+
const graphObjectFactory = (type, name, children) => ({
|
|
41
|
+
type,
|
|
42
|
+
name,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
function processThreeChildren(children) {
|
|
46
|
+
return children.map(
|
|
47
|
+
(object) => graphObjectFactory(
|
|
48
|
+
object.type,
|
|
49
|
+
object.name || "",
|
|
50
|
+
object.children && object.children.length > 0 ? processThreeChildren(object.children) : []
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
const toGraph = (object) => {
|
|
55
|
+
return object.children.map((child) => {
|
|
56
|
+
const children = toGraph(child);
|
|
57
|
+
if (child.type === "primitive" && child.object.children?.length) {
|
|
58
|
+
const threeChildren = processThreeChildren(child.object.children);
|
|
59
|
+
children.push(...threeChildren);
|
|
60
|
+
}
|
|
61
|
+
return graphObjectFactory(child.object.type, child.object.name ?? "", children);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var __defProp$2 = Object.defineProperty;
|
|
66
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
67
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
68
|
+
const functions = [
|
|
69
|
+
"activeTexture",
|
|
70
|
+
"attachShader",
|
|
71
|
+
"beginQuery",
|
|
72
|
+
"beginTransformFeedback",
|
|
73
|
+
"bindAttribLocation",
|
|
74
|
+
"bindBufferBase",
|
|
75
|
+
"bindBufferRange",
|
|
76
|
+
"bindRenderbuffer",
|
|
77
|
+
"bindSampler",
|
|
78
|
+
"bindTransformFeedback",
|
|
79
|
+
"bindVertexArray",
|
|
80
|
+
"blendColor",
|
|
81
|
+
"blendEquation",
|
|
82
|
+
"blendEquationSeparate",
|
|
83
|
+
"blendFunc",
|
|
84
|
+
"blendFuncSeparate",
|
|
85
|
+
"blitFramebuffer",
|
|
86
|
+
"bufferData",
|
|
87
|
+
"bufferSubData",
|
|
88
|
+
"checkFramebufferStatus",
|
|
89
|
+
"clientWaitSync",
|
|
90
|
+
"compileShader",
|
|
91
|
+
"compressedTexImage2D",
|
|
92
|
+
"compressedTexImage3D",
|
|
93
|
+
"compressedTexSubImage2D",
|
|
94
|
+
"compressedTexSubImage3D",
|
|
95
|
+
"copyBufferSubData",
|
|
96
|
+
"copyTexImage2D",
|
|
97
|
+
"copyTexSubImage2D",
|
|
98
|
+
"copyTexSubImage3D",
|
|
99
|
+
"createBuffer",
|
|
100
|
+
"createFramebuffer",
|
|
101
|
+
"createProgram",
|
|
102
|
+
"createQuery",
|
|
103
|
+
"createRenderbuffer",
|
|
104
|
+
"createSampler",
|
|
105
|
+
"createShader",
|
|
106
|
+
"createTexture",
|
|
107
|
+
"createTransformFeedback",
|
|
108
|
+
"createVertexArray",
|
|
109
|
+
"cullFace",
|
|
110
|
+
"deleteBuffer",
|
|
111
|
+
"deleteFramebuffer",
|
|
112
|
+
"deleteProgram",
|
|
113
|
+
"deleteQuery",
|
|
114
|
+
"deleteRenderbuffer",
|
|
115
|
+
"deleteSampler",
|
|
116
|
+
"deleteShader",
|
|
117
|
+
"deleteSync",
|
|
118
|
+
"deleteTexture",
|
|
119
|
+
"deleteTransformFeedback",
|
|
120
|
+
"deleteVertexArray",
|
|
121
|
+
"depthFunc",
|
|
122
|
+
"depthMask",
|
|
123
|
+
"depthRange",
|
|
124
|
+
"detachShader",
|
|
125
|
+
"disable",
|
|
126
|
+
"drawArraysInstanced",
|
|
127
|
+
"drawElementsInstanced",
|
|
128
|
+
"drawRangeElements",
|
|
129
|
+
"enable",
|
|
130
|
+
"endQuery",
|
|
131
|
+
"endTransformFeedback",
|
|
132
|
+
"fenceSync",
|
|
133
|
+
"finish",
|
|
134
|
+
"flush",
|
|
135
|
+
"framebufferRenderbuffer",
|
|
136
|
+
"framebufferTexture2D",
|
|
137
|
+
"framebufferTextureLayer",
|
|
138
|
+
"frontFace",
|
|
139
|
+
"generateMipmap",
|
|
140
|
+
"getActiveAttrib",
|
|
141
|
+
"getActiveUniform",
|
|
142
|
+
"getActiveUniformBlockName",
|
|
143
|
+
"getActiveUniformBlockParameter",
|
|
144
|
+
"getActiveUniforms",
|
|
145
|
+
"getAttachedShaders",
|
|
146
|
+
"getAttribLocation",
|
|
147
|
+
"getBufferParameter",
|
|
148
|
+
"getBufferSubData",
|
|
149
|
+
"getContextAttributes",
|
|
150
|
+
"getError",
|
|
151
|
+
"getExtension",
|
|
152
|
+
"getFragDataLocation",
|
|
153
|
+
"getFramebufferAttachmentParameter",
|
|
154
|
+
"getIndexedParameter",
|
|
155
|
+
"getInternalformatParameter",
|
|
156
|
+
"getParameter",
|
|
157
|
+
"getProgramInfoLog",
|
|
158
|
+
"getProgramParameter",
|
|
159
|
+
"getQuery",
|
|
160
|
+
"getQueryParameter",
|
|
161
|
+
"getRenderbufferParameter",
|
|
162
|
+
"getSamplerParameter",
|
|
163
|
+
"getShaderInfoLog",
|
|
164
|
+
"getShaderParameter",
|
|
165
|
+
"getShaderPrecisionFormat",
|
|
166
|
+
"getShaderSource",
|
|
167
|
+
"getSupportedExtensions",
|
|
168
|
+
"getSyncParameter",
|
|
169
|
+
"getTexParameter",
|
|
170
|
+
"getTransformFeedbackVarying",
|
|
171
|
+
"getUniform",
|
|
172
|
+
"getUniformBlockIndex",
|
|
173
|
+
"getUniformIndices",
|
|
174
|
+
"getUniformLocation",
|
|
175
|
+
"getVertexAttrib",
|
|
176
|
+
"getVertexAttribOffset",
|
|
177
|
+
"hint",
|
|
178
|
+
"invalidateFramebuffer",
|
|
179
|
+
"invalidateSubFramebuffer",
|
|
180
|
+
"isBuffer",
|
|
181
|
+
"isContextLost",
|
|
182
|
+
"isEnabled",
|
|
183
|
+
"isFramebuffer",
|
|
184
|
+
"isProgram",
|
|
185
|
+
"isQuery",
|
|
186
|
+
"isRenderbuffer",
|
|
187
|
+
"isSampler",
|
|
188
|
+
"isShader",
|
|
189
|
+
"isSync",
|
|
190
|
+
"isTexture",
|
|
191
|
+
"isTransformFeedback",
|
|
192
|
+
"isVertexArray",
|
|
193
|
+
"lineWidth",
|
|
194
|
+
"linkProgram",
|
|
195
|
+
"pauseTransformFeedback",
|
|
196
|
+
"pixelStorei",
|
|
197
|
+
"polygonOffset",
|
|
198
|
+
"readBuffer",
|
|
199
|
+
"readPixels",
|
|
200
|
+
"renderbufferStorage",
|
|
201
|
+
"renderbufferStorageMultisample",
|
|
202
|
+
"resumeTransformFeedback",
|
|
203
|
+
"sampleCoverage",
|
|
204
|
+
"samplerParameterf",
|
|
205
|
+
"samplerParameteri",
|
|
206
|
+
"shaderSource",
|
|
207
|
+
"stencilFunc",
|
|
208
|
+
"stencilFuncSeparate",
|
|
209
|
+
"stencilMask",
|
|
210
|
+
"stencilMaskSeparate",
|
|
211
|
+
"stencilOp",
|
|
212
|
+
"stencilOpSeparate",
|
|
213
|
+
"texImage2D",
|
|
214
|
+
"texImage3D",
|
|
215
|
+
"texParameterf",
|
|
216
|
+
"texParameteri",
|
|
217
|
+
"texStorage2D",
|
|
218
|
+
"texStorage3D",
|
|
219
|
+
"texSubImage2D",
|
|
220
|
+
"texSubImage3D",
|
|
221
|
+
"transformFeedbackVaryings",
|
|
222
|
+
"uniform1ui",
|
|
223
|
+
"uniform2ui",
|
|
224
|
+
"uniform3ui",
|
|
225
|
+
"uniform4ui",
|
|
226
|
+
"uniformBlockBinding",
|
|
227
|
+
"useProgram",
|
|
228
|
+
"validateProgram",
|
|
229
|
+
"vertexAttribDivisor",
|
|
230
|
+
"vertexAttribI4i",
|
|
231
|
+
"vertexAttribI4ui",
|
|
232
|
+
"vertexAttribIPointer",
|
|
233
|
+
"waitSync",
|
|
234
|
+
"bindBuffer",
|
|
235
|
+
"bindFramebuffer",
|
|
236
|
+
"bindTexture",
|
|
237
|
+
"clear",
|
|
238
|
+
"clearBufferfi",
|
|
239
|
+
"clearBufferfv",
|
|
240
|
+
"clearBufferiv",
|
|
241
|
+
"clearBufferuiv",
|
|
242
|
+
"clearColor",
|
|
243
|
+
"clearDepth",
|
|
244
|
+
"clearStencil",
|
|
245
|
+
"colorMask",
|
|
246
|
+
"disableVertexAttribArray",
|
|
247
|
+
"drawArrays",
|
|
248
|
+
"drawBuffers",
|
|
249
|
+
"drawElements",
|
|
250
|
+
"enableVertexAttribArray",
|
|
251
|
+
"scissor",
|
|
252
|
+
"uniform1f",
|
|
253
|
+
"uniform1fv",
|
|
254
|
+
"uniform1i",
|
|
255
|
+
"uniform1iv",
|
|
256
|
+
"uniform1uiv",
|
|
257
|
+
"uniform2f",
|
|
258
|
+
"uniform2fv",
|
|
259
|
+
"uniform2i",
|
|
260
|
+
"uniform2iv",
|
|
261
|
+
"uniform2uiv",
|
|
262
|
+
"uniform3f",
|
|
263
|
+
"uniform3fv",
|
|
264
|
+
"uniform3i",
|
|
265
|
+
"uniform3iv",
|
|
266
|
+
"uniform3uiv",
|
|
267
|
+
"uniform4f",
|
|
268
|
+
"uniform4fv",
|
|
269
|
+
"uniform4i",
|
|
270
|
+
"uniform4iv",
|
|
271
|
+
"uniform4uiv",
|
|
272
|
+
"uniformMatrix2fv",
|
|
273
|
+
"uniformMatrix2x3fv",
|
|
274
|
+
"uniformMatrix2x4fv",
|
|
275
|
+
"uniformMatrix3fv",
|
|
276
|
+
"uniformMatrix3x2fv",
|
|
277
|
+
"uniformMatrix3x4fv",
|
|
278
|
+
"uniformMatrix4fv",
|
|
279
|
+
"uniformMatrix4x2fv",
|
|
280
|
+
"uniformMatrix4x3fv",
|
|
281
|
+
"vertexAttrib1f",
|
|
282
|
+
"vertexAttrib1fv",
|
|
283
|
+
"vertexAttrib2f",
|
|
284
|
+
"vertexAttrib2fv",
|
|
285
|
+
"vertexAttrib3f",
|
|
286
|
+
"vertexAttrib3fv",
|
|
287
|
+
"vertexAttrib4f",
|
|
288
|
+
"vertexAttrib4fv",
|
|
289
|
+
"vertexAttribI4iv",
|
|
290
|
+
"vertexAttribI4uiv",
|
|
291
|
+
"vertexAttribPointer",
|
|
292
|
+
"viewport",
|
|
293
|
+
"makeXRCompatible"
|
|
294
|
+
];
|
|
295
|
+
const enums = {
|
|
296
|
+
DEPTH_BUFFER_BIT: 256,
|
|
297
|
+
STENCIL_BUFFER_BIT: 1024,
|
|
298
|
+
COLOR_BUFFER_BIT: 16384,
|
|
299
|
+
POINTS: 0,
|
|
300
|
+
LINES: 1,
|
|
301
|
+
LINE_LOOP: 2,
|
|
302
|
+
LINE_STRIP: 3,
|
|
303
|
+
TRIANGLES: 4,
|
|
304
|
+
TRIANGLE_STRIP: 5,
|
|
305
|
+
TRIANGLE_FAN: 6,
|
|
306
|
+
ZERO: 0,
|
|
307
|
+
ONE: 1,
|
|
308
|
+
SRC_COLOR: 768,
|
|
309
|
+
ONE_MINUS_SRC_COLOR: 769,
|
|
310
|
+
SRC_ALPHA: 770,
|
|
311
|
+
ONE_MINUS_SRC_ALPHA: 771,
|
|
312
|
+
DST_ALPHA: 772,
|
|
313
|
+
ONE_MINUS_DST_ALPHA: 773,
|
|
314
|
+
DST_COLOR: 774,
|
|
315
|
+
ONE_MINUS_DST_COLOR: 775,
|
|
316
|
+
SRC_ALPHA_SATURATE: 776,
|
|
317
|
+
FUNC_ADD: 32774,
|
|
318
|
+
BLEND_EQUATION: 32777,
|
|
319
|
+
BLEND_EQUATION_RGB: 32777,
|
|
320
|
+
BLEND_EQUATION_ALPHA: 34877,
|
|
321
|
+
FUNC_SUBTRACT: 32778,
|
|
322
|
+
FUNC_REVERSE_SUBTRACT: 32779,
|
|
323
|
+
BLEND_DST_RGB: 32968,
|
|
324
|
+
BLEND_SRC_RGB: 32969,
|
|
325
|
+
BLEND_DST_ALPHA: 32970,
|
|
326
|
+
BLEND_SRC_ALPHA: 32971,
|
|
327
|
+
CONSTANT_COLOR: 32769,
|
|
328
|
+
ONE_MINUS_CONSTANT_COLOR: 32770,
|
|
329
|
+
CONSTANT_ALPHA: 32771,
|
|
330
|
+
ONE_MINUS_CONSTANT_ALPHA: 32772,
|
|
331
|
+
BLEND_COLOR: 32773,
|
|
332
|
+
ARRAY_BUFFER: 34962,
|
|
333
|
+
ELEMENT_ARRAY_BUFFER: 34963,
|
|
334
|
+
ARRAY_BUFFER_BINDING: 34964,
|
|
335
|
+
ELEMENT_ARRAY_BUFFER_BINDING: 34965,
|
|
336
|
+
STREAM_DRAW: 35040,
|
|
337
|
+
STATIC_DRAW: 35044,
|
|
338
|
+
DYNAMIC_DRAW: 35048,
|
|
339
|
+
BUFFER_SIZE: 34660,
|
|
340
|
+
BUFFER_USAGE: 34661,
|
|
341
|
+
CURRENT_VERTEX_ATTRIB: 34342,
|
|
342
|
+
FRONT: 1028,
|
|
343
|
+
BACK: 1029,
|
|
344
|
+
FRONT_AND_BACK: 1032,
|
|
345
|
+
TEXTURE_2D: 3553,
|
|
346
|
+
CULL_FACE: 2884,
|
|
347
|
+
BLEND: 3042,
|
|
348
|
+
DITHER: 3024,
|
|
349
|
+
STENCIL_TEST: 2960,
|
|
350
|
+
DEPTH_TEST: 2929,
|
|
351
|
+
SCISSOR_TEST: 3089,
|
|
352
|
+
POLYGON_OFFSET_FILL: 32823,
|
|
353
|
+
SAMPLE_ALPHA_TO_COVERAGE: 32926,
|
|
354
|
+
SAMPLE_COVERAGE: 32928,
|
|
355
|
+
NO_ERROR: 0,
|
|
356
|
+
INVALID_ENUM: 1280,
|
|
357
|
+
INVALID_VALUE: 1281,
|
|
358
|
+
INVALID_OPERATION: 1282,
|
|
359
|
+
OUT_OF_MEMORY: 1285,
|
|
360
|
+
CW: 2304,
|
|
361
|
+
CCW: 2305,
|
|
362
|
+
LINE_WIDTH: 2849,
|
|
363
|
+
ALIASED_POINT_SIZE_RANGE: 33901,
|
|
364
|
+
ALIASED_LINE_WIDTH_RANGE: 33902,
|
|
365
|
+
CULL_FACE_MODE: 2885,
|
|
366
|
+
FRONT_FACE: 2886,
|
|
367
|
+
DEPTH_RANGE: 2928,
|
|
368
|
+
DEPTH_WRITEMASK: 2930,
|
|
369
|
+
DEPTH_CLEAR_VALUE: 2931,
|
|
370
|
+
DEPTH_FUNC: 2932,
|
|
371
|
+
STENCIL_CLEAR_VALUE: 2961,
|
|
372
|
+
STENCIL_FUNC: 2962,
|
|
373
|
+
STENCIL_FAIL: 2964,
|
|
374
|
+
STENCIL_PASS_DEPTH_FAIL: 2965,
|
|
375
|
+
STENCIL_PASS_DEPTH_PASS: 2966,
|
|
376
|
+
STENCIL_REF: 2967,
|
|
377
|
+
STENCIL_VALUE_MASK: 2963,
|
|
378
|
+
STENCIL_WRITEMASK: 2968,
|
|
379
|
+
STENCIL_BACK_FUNC: 34816,
|
|
380
|
+
STENCIL_BACK_FAIL: 34817,
|
|
381
|
+
STENCIL_BACK_PASS_DEPTH_FAIL: 34818,
|
|
382
|
+
STENCIL_BACK_PASS_DEPTH_PASS: 34819,
|
|
383
|
+
STENCIL_BACK_REF: 36003,
|
|
384
|
+
STENCIL_BACK_VALUE_MASK: 36004,
|
|
385
|
+
STENCIL_BACK_WRITEMASK: 36005,
|
|
386
|
+
VIEWPORT: 2978,
|
|
387
|
+
SCISSOR_BOX: 3088,
|
|
388
|
+
COLOR_CLEAR_VALUE: 3106,
|
|
389
|
+
COLOR_WRITEMASK: 3107,
|
|
390
|
+
UNPACK_ALIGNMENT: 3317,
|
|
391
|
+
PACK_ALIGNMENT: 3333,
|
|
392
|
+
MAX_TEXTURE_SIZE: 3379,
|
|
393
|
+
MAX_VIEWPORT_DIMS: 3386,
|
|
394
|
+
SUBPIXEL_BITS: 3408,
|
|
395
|
+
RED_BITS: 3410,
|
|
396
|
+
GREEN_BITS: 3411,
|
|
397
|
+
BLUE_BITS: 3412,
|
|
398
|
+
ALPHA_BITS: 3413,
|
|
399
|
+
DEPTH_BITS: 3414,
|
|
400
|
+
STENCIL_BITS: 3415,
|
|
401
|
+
POLYGON_OFFSET_UNITS: 10752,
|
|
402
|
+
POLYGON_OFFSET_FACTOR: 32824,
|
|
403
|
+
TEXTURE_BINDING_2D: 32873,
|
|
404
|
+
SAMPLE_BUFFERS: 32936,
|
|
405
|
+
SAMPLES: 32937,
|
|
406
|
+
SAMPLE_COVERAGE_VALUE: 32938,
|
|
407
|
+
SAMPLE_COVERAGE_INVERT: 32939,
|
|
408
|
+
COMPRESSED_TEXTURE_FORMATS: 34467,
|
|
409
|
+
DONT_CARE: 4352,
|
|
410
|
+
FASTEST: 4353,
|
|
411
|
+
NICEST: 4354,
|
|
412
|
+
GENERATE_MIPMAP_HINT: 33170,
|
|
413
|
+
BYTE: 5120,
|
|
414
|
+
UNSIGNED_BYTE: 5121,
|
|
415
|
+
SHORT: 5122,
|
|
416
|
+
UNSIGNED_SHORT: 5123,
|
|
417
|
+
INT: 5124,
|
|
418
|
+
UNSIGNED_INT: 5125,
|
|
419
|
+
FLOAT: 5126,
|
|
420
|
+
DEPTH_COMPONENT: 6402,
|
|
421
|
+
ALPHA: 6406,
|
|
422
|
+
RGB: 6407,
|
|
423
|
+
RGBA: 6408,
|
|
424
|
+
LUMINANCE: 6409,
|
|
425
|
+
LUMINANCE_ALPHA: 6410,
|
|
426
|
+
UNSIGNED_SHORT_4_4_4_4: 32819,
|
|
427
|
+
UNSIGNED_SHORT_5_5_5_1: 32820,
|
|
428
|
+
UNSIGNED_SHORT_5_6_5: 33635,
|
|
429
|
+
FRAGMENT_SHADER: 35632,
|
|
430
|
+
VERTEX_SHADER: 35633,
|
|
431
|
+
MAX_VERTEX_ATTRIBS: 34921,
|
|
432
|
+
MAX_VERTEX_UNIFORM_VECTORS: 36347,
|
|
433
|
+
MAX_VARYING_VECTORS: 36348,
|
|
434
|
+
MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661,
|
|
435
|
+
MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660,
|
|
436
|
+
MAX_TEXTURE_IMAGE_UNITS: 34930,
|
|
437
|
+
MAX_FRAGMENT_UNIFORM_VECTORS: 36349,
|
|
438
|
+
SHADER_TYPE: 35663,
|
|
439
|
+
DELETE_STATUS: 35712,
|
|
440
|
+
LINK_STATUS: 35714,
|
|
441
|
+
VALIDATE_STATUS: 35715,
|
|
442
|
+
ATTACHED_SHADERS: 35717,
|
|
443
|
+
ACTIVE_UNIFORMS: 35718,
|
|
444
|
+
ACTIVE_ATTRIBUTES: 35721,
|
|
445
|
+
SHADING_LANGUAGE_VERSION: 35724,
|
|
446
|
+
CURRENT_PROGRAM: 35725,
|
|
447
|
+
NEVER: 512,
|
|
448
|
+
LESS: 513,
|
|
449
|
+
EQUAL: 514,
|
|
450
|
+
LEQUAL: 515,
|
|
451
|
+
GREATER: 516,
|
|
452
|
+
NOTEQUAL: 517,
|
|
453
|
+
GEQUAL: 518,
|
|
454
|
+
ALWAYS: 519,
|
|
455
|
+
KEEP: 7680,
|
|
456
|
+
REPLACE: 7681,
|
|
457
|
+
INCR: 7682,
|
|
458
|
+
DECR: 7683,
|
|
459
|
+
INVERT: 5386,
|
|
460
|
+
INCR_WRAP: 34055,
|
|
461
|
+
DECR_WRAP: 34056,
|
|
462
|
+
VENDOR: 7936,
|
|
463
|
+
RENDERER: 7937,
|
|
464
|
+
VERSION: 7938,
|
|
465
|
+
NEAREST: 9728,
|
|
466
|
+
LINEAR: 9729,
|
|
467
|
+
NEAREST_MIPMAP_NEAREST: 9984,
|
|
468
|
+
LINEAR_MIPMAP_NEAREST: 9985,
|
|
469
|
+
NEAREST_MIPMAP_LINEAR: 9986,
|
|
470
|
+
LINEAR_MIPMAP_LINEAR: 9987,
|
|
471
|
+
TEXTURE_MAG_FILTER: 10240,
|
|
472
|
+
TEXTURE_MIN_FILTER: 10241,
|
|
473
|
+
TEXTURE_WRAP_S: 10242,
|
|
474
|
+
TEXTURE_WRAP_T: 10243,
|
|
475
|
+
TEXTURE: 5890,
|
|
476
|
+
TEXTURE_CUBE_MAP: 34067,
|
|
477
|
+
TEXTURE_BINDING_CUBE_MAP: 34068,
|
|
478
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: 34069,
|
|
479
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: 34070,
|
|
480
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: 34071,
|
|
481
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072,
|
|
482
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: 34073,
|
|
483
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074,
|
|
484
|
+
MAX_CUBE_MAP_TEXTURE_SIZE: 34076,
|
|
485
|
+
TEXTURE0: 33984,
|
|
486
|
+
TEXTURE1: 33985,
|
|
487
|
+
TEXTURE2: 33986,
|
|
488
|
+
TEXTURE3: 33987,
|
|
489
|
+
TEXTURE4: 33988,
|
|
490
|
+
TEXTURE5: 33989,
|
|
491
|
+
TEXTURE6: 33990,
|
|
492
|
+
TEXTURE7: 33991,
|
|
493
|
+
TEXTURE8: 33992,
|
|
494
|
+
TEXTURE9: 33993,
|
|
495
|
+
TEXTURE10: 33994,
|
|
496
|
+
TEXTURE11: 33995,
|
|
497
|
+
TEXTURE12: 33996,
|
|
498
|
+
TEXTURE13: 33997,
|
|
499
|
+
TEXTURE14: 33998,
|
|
500
|
+
TEXTURE15: 33999,
|
|
501
|
+
TEXTURE16: 34e3,
|
|
502
|
+
TEXTURE17: 34001,
|
|
503
|
+
TEXTURE18: 34002,
|
|
504
|
+
TEXTURE19: 34003,
|
|
505
|
+
TEXTURE20: 34004,
|
|
506
|
+
TEXTURE21: 34005,
|
|
507
|
+
TEXTURE22: 34006,
|
|
508
|
+
TEXTURE23: 34007,
|
|
509
|
+
TEXTURE24: 34008,
|
|
510
|
+
TEXTURE25: 34009,
|
|
511
|
+
TEXTURE26: 34010,
|
|
512
|
+
TEXTURE27: 34011,
|
|
513
|
+
TEXTURE28: 34012,
|
|
514
|
+
TEXTURE29: 34013,
|
|
515
|
+
TEXTURE30: 34014,
|
|
516
|
+
TEXTURE31: 34015,
|
|
517
|
+
ACTIVE_TEXTURE: 34016,
|
|
518
|
+
REPEAT: 10497,
|
|
519
|
+
CLAMP_TO_EDGE: 33071,
|
|
520
|
+
MIRRORED_REPEAT: 33648,
|
|
521
|
+
FLOAT_VEC2: 35664,
|
|
522
|
+
FLOAT_VEC3: 35665,
|
|
523
|
+
FLOAT_VEC4: 35666,
|
|
524
|
+
INT_VEC2: 35667,
|
|
525
|
+
INT_VEC3: 35668,
|
|
526
|
+
INT_VEC4: 35669,
|
|
527
|
+
BOOL: 35670,
|
|
528
|
+
BOOL_VEC2: 35671,
|
|
529
|
+
BOOL_VEC3: 35672,
|
|
530
|
+
BOOL_VEC4: 35673,
|
|
531
|
+
FLOAT_MAT2: 35674,
|
|
532
|
+
FLOAT_MAT3: 35675,
|
|
533
|
+
FLOAT_MAT4: 35676,
|
|
534
|
+
SAMPLER_2D: 35678,
|
|
535
|
+
SAMPLER_CUBE: 35680,
|
|
536
|
+
VERTEX_ATTRIB_ARRAY_ENABLED: 34338,
|
|
537
|
+
VERTEX_ATTRIB_ARRAY_SIZE: 34339,
|
|
538
|
+
VERTEX_ATTRIB_ARRAY_STRIDE: 34340,
|
|
539
|
+
VERTEX_ATTRIB_ARRAY_TYPE: 34341,
|
|
540
|
+
VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922,
|
|
541
|
+
VERTEX_ATTRIB_ARRAY_POINTER: 34373,
|
|
542
|
+
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975,
|
|
543
|
+
IMPLEMENTATION_COLOR_READ_TYPE: 35738,
|
|
544
|
+
IMPLEMENTATION_COLOR_READ_FORMAT: 35739,
|
|
545
|
+
COMPILE_STATUS: 35713,
|
|
546
|
+
LOW_FLOAT: 36336,
|
|
547
|
+
MEDIUM_FLOAT: 36337,
|
|
548
|
+
HIGH_FLOAT: 36338,
|
|
549
|
+
LOW_INT: 36339,
|
|
550
|
+
MEDIUM_INT: 36340,
|
|
551
|
+
HIGH_INT: 36341,
|
|
552
|
+
FRAMEBUFFER: 36160,
|
|
553
|
+
RENDERBUFFER: 36161,
|
|
554
|
+
RGBA4: 32854,
|
|
555
|
+
RGB5_A1: 32855,
|
|
556
|
+
RGB565: 36194,
|
|
557
|
+
DEPTH_COMPONENT16: 33189,
|
|
558
|
+
STENCIL_INDEX: 6401,
|
|
559
|
+
STENCIL_INDEX8: 36168,
|
|
560
|
+
DEPTH_STENCIL: 34041,
|
|
561
|
+
RENDERBUFFER_WIDTH: 36162,
|
|
562
|
+
RENDERBUFFER_HEIGHT: 36163,
|
|
563
|
+
RENDERBUFFER_INTERNAL_FORMAT: 36164,
|
|
564
|
+
RENDERBUFFER_RED_SIZE: 36176,
|
|
565
|
+
RENDERBUFFER_GREEN_SIZE: 36177,
|
|
566
|
+
RENDERBUFFER_BLUE_SIZE: 36178,
|
|
567
|
+
RENDERBUFFER_ALPHA_SIZE: 36179,
|
|
568
|
+
RENDERBUFFER_DEPTH_SIZE: 36180,
|
|
569
|
+
RENDERBUFFER_STENCIL_SIZE: 36181,
|
|
570
|
+
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048,
|
|
571
|
+
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049,
|
|
572
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050,
|
|
573
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051,
|
|
574
|
+
COLOR_ATTACHMENT0: 36064,
|
|
575
|
+
DEPTH_ATTACHMENT: 36096,
|
|
576
|
+
STENCIL_ATTACHMENT: 36128,
|
|
577
|
+
DEPTH_STENCIL_ATTACHMENT: 33306,
|
|
578
|
+
NONE: 0,
|
|
579
|
+
FRAMEBUFFER_COMPLETE: 36053,
|
|
580
|
+
FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054,
|
|
581
|
+
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055,
|
|
582
|
+
FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057,
|
|
583
|
+
FRAMEBUFFER_UNSUPPORTED: 36061,
|
|
584
|
+
FRAMEBUFFER_BINDING: 36006,
|
|
585
|
+
RENDERBUFFER_BINDING: 36007,
|
|
586
|
+
MAX_RENDERBUFFER_SIZE: 34024,
|
|
587
|
+
INVALID_FRAMEBUFFER_OPERATION: 1286,
|
|
588
|
+
UNPACK_FLIP_Y_WEBGL: 37440,
|
|
589
|
+
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
|
|
590
|
+
CONTEXT_LOST_WEBGL: 37442,
|
|
591
|
+
UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
|
|
592
|
+
BROWSER_DEFAULT_WEBGL: 37444,
|
|
593
|
+
READ_BUFFER: 3074,
|
|
594
|
+
UNPACK_ROW_LENGTH: 3314,
|
|
595
|
+
UNPACK_SKIP_ROWS: 3315,
|
|
596
|
+
UNPACK_SKIP_PIXELS: 3316,
|
|
597
|
+
PACK_ROW_LENGTH: 3330,
|
|
598
|
+
PACK_SKIP_ROWS: 3331,
|
|
599
|
+
PACK_SKIP_PIXELS: 3332,
|
|
600
|
+
COLOR: 6144,
|
|
601
|
+
DEPTH: 6145,
|
|
602
|
+
STENCIL: 6146,
|
|
603
|
+
RED: 6403,
|
|
604
|
+
UNPACK_SKIP_IMAGES: 32877,
|
|
605
|
+
UNPACK_IMAGE_HEIGHT: 32878,
|
|
606
|
+
TEXTURE_WRAP_R: 32882,
|
|
607
|
+
MAX_ELEMENTS_VERTICES: 33e3,
|
|
608
|
+
MAX_ELEMENTS_INDICES: 33001,
|
|
609
|
+
TEXTURE_MIN_LOD: 33082,
|
|
610
|
+
TEXTURE_MAX_LOD: 33083,
|
|
611
|
+
TEXTURE_BASE_LEVEL: 33084,
|
|
612
|
+
TEXTURE_MAX_LEVEL: 33085,
|
|
613
|
+
MIN: 32775,
|
|
614
|
+
MAX: 32776,
|
|
615
|
+
MAX_TEXTURE_LOD_BIAS: 34045,
|
|
616
|
+
TEXTURE_COMPARE_MODE: 34892,
|
|
617
|
+
TEXTURE_COMPARE_FUNC: 34893,
|
|
618
|
+
CURRENT_QUERY: 34917,
|
|
619
|
+
QUERY_RESULT: 34918,
|
|
620
|
+
QUERY_RESULT_AVAILABLE: 34919,
|
|
621
|
+
STREAM_READ: 35041,
|
|
622
|
+
STREAM_COPY: 35042,
|
|
623
|
+
STATIC_READ: 35045,
|
|
624
|
+
STATIC_COPY: 35046,
|
|
625
|
+
DYNAMIC_READ: 35049,
|
|
626
|
+
DYNAMIC_COPY: 35050,
|
|
627
|
+
MAX_DRAW_BUFFERS: 34852,
|
|
628
|
+
MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
|
|
629
|
+
MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
|
|
630
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
|
|
631
|
+
PIXEL_PACK_BUFFER: 35051,
|
|
632
|
+
PIXEL_UNPACK_BUFFER: 35052,
|
|
633
|
+
PIXEL_PACK_BUFFER_BINDING: 35053,
|
|
634
|
+
PIXEL_UNPACK_BUFFER_BINDING: 35055,
|
|
635
|
+
SRGB: 35904,
|
|
636
|
+
COMPARE_REF_TO_TEXTURE: 34894,
|
|
637
|
+
VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
|
|
638
|
+
MAX_ARRAY_TEXTURE_LAYERS: 35071,
|
|
639
|
+
MIN_PROGRAM_TEXEL_OFFSET: 35076,
|
|
640
|
+
MAX_PROGRAM_TEXEL_OFFSET: 35077,
|
|
641
|
+
MAX_VARYING_COMPONENTS: 35659,
|
|
642
|
+
TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
|
|
643
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
|
|
644
|
+
TRANSFORM_FEEDBACK_VARYINGS: 35971,
|
|
645
|
+
TRANSFORM_FEEDBACK_BUFFER_START: 35972,
|
|
646
|
+
TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
|
|
647
|
+
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
|
|
648
|
+
RASTERIZER_DISCARD: 35977,
|
|
649
|
+
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
|
|
650
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
|
|
651
|
+
INTERLEAVED_ATTRIBS: 35980,
|
|
652
|
+
SEPARATE_ATTRIBS: 35981,
|
|
653
|
+
TRANSFORM_FEEDBACK_BUFFER: 35982,
|
|
654
|
+
TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
|
|
655
|
+
RED_INTEGER: 36244,
|
|
656
|
+
RGB_INTEGER: 36248,
|
|
657
|
+
RGBA_INTEGER: 36249,
|
|
658
|
+
SAMPLER_CUBE_SHADOW: 36293,
|
|
659
|
+
INT_SAMPLER_CUBE: 36300,
|
|
660
|
+
UNSIGNED_INT_SAMPLER_CUBE: 36308,
|
|
661
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
|
|
662
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
|
|
663
|
+
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
|
|
664
|
+
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
|
|
665
|
+
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
|
|
666
|
+
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
|
|
667
|
+
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
|
|
668
|
+
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
|
|
669
|
+
FRAMEBUFFER_DEFAULT: 33304,
|
|
670
|
+
UNSIGNED_NORMALIZED: 35863,
|
|
671
|
+
DRAW_FRAMEBUFFER_BINDING: 36006,
|
|
672
|
+
READ_FRAMEBUFFER: 36008,
|
|
673
|
+
DRAW_FRAMEBUFFER: 36009,
|
|
674
|
+
READ_FRAMEBUFFER_BINDING: 36010,
|
|
675
|
+
RENDERBUFFER_SAMPLES: 36011,
|
|
676
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
|
|
677
|
+
MAX_COLOR_ATTACHMENTS: 36063,
|
|
678
|
+
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
|
|
679
|
+
MAX_SAMPLES: 36183,
|
|
680
|
+
HALF_FLOAT: 5131,
|
|
681
|
+
RG: 33319,
|
|
682
|
+
RG_INTEGER: 33320,
|
|
683
|
+
VERTEX_ARRAY_BINDING: 34229,
|
|
684
|
+
SIGNED_NORMALIZED: 36764,
|
|
685
|
+
COPY_READ_BUFFER: 36662,
|
|
686
|
+
COPY_WRITE_BUFFER: 36663,
|
|
687
|
+
COPY_READ_BUFFER_BINDING: 36662,
|
|
688
|
+
COPY_WRITE_BUFFER_BINDING: 36663,
|
|
689
|
+
UNIFORM_BUFFER: 35345,
|
|
690
|
+
UNIFORM_BUFFER_BINDING: 35368,
|
|
691
|
+
UNIFORM_BUFFER_START: 35369,
|
|
692
|
+
UNIFORM_BUFFER_SIZE: 35370,
|
|
693
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 35371,
|
|
694
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
|
|
695
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 35374,
|
|
696
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
|
|
697
|
+
MAX_UNIFORM_BLOCK_SIZE: 35376,
|
|
698
|
+
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
|
|
699
|
+
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
|
|
700
|
+
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
|
|
701
|
+
ACTIVE_UNIFORM_BLOCKS: 35382,
|
|
702
|
+
UNIFORM_TYPE: 35383,
|
|
703
|
+
UNIFORM_SIZE: 35384,
|
|
704
|
+
UNIFORM_BLOCK_INDEX: 35386,
|
|
705
|
+
UNIFORM_OFFSET: 35387,
|
|
706
|
+
UNIFORM_ARRAY_STRIDE: 35388,
|
|
707
|
+
UNIFORM_MATRIX_STRIDE: 35389,
|
|
708
|
+
UNIFORM_IS_ROW_MAJOR: 35390,
|
|
709
|
+
UNIFORM_BLOCK_BINDING: 35391,
|
|
710
|
+
UNIFORM_BLOCK_DATA_SIZE: 35392,
|
|
711
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
|
|
712
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
|
|
713
|
+
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
|
|
714
|
+
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
|
|
715
|
+
INVALID_INDEX: 4294967295,
|
|
716
|
+
MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
|
|
717
|
+
MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
|
|
718
|
+
MAX_SERVER_WAIT_TIMEOUT: 37137,
|
|
719
|
+
OBJECT_TYPE: 37138,
|
|
720
|
+
SYNC_CONDITION: 37139,
|
|
721
|
+
SYNC_STATUS: 37140,
|
|
722
|
+
SYNC_FLAGS: 37141,
|
|
723
|
+
SYNC_FENCE: 37142,
|
|
724
|
+
SYNC_GPU_COMMANDS_COMPLETE: 37143,
|
|
725
|
+
UNSIGNALED: 37144,
|
|
726
|
+
SIGNALED: 37145,
|
|
727
|
+
ALREADY_SIGNALED: 37146,
|
|
728
|
+
TIMEOUT_EXPIRED: 37147,
|
|
729
|
+
CONDITION_SATISFIED: 37148,
|
|
730
|
+
WAIT_FAILED: 37149,
|
|
731
|
+
SYNC_FLUSH_COMMANDS_BIT: 1,
|
|
732
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
|
|
733
|
+
ANY_SAMPLES_PASSED: 35887,
|
|
734
|
+
ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
|
|
735
|
+
SAMPLER_BINDING: 35097,
|
|
736
|
+
TRANSFORM_FEEDBACK: 36386,
|
|
737
|
+
TRANSFORM_FEEDBACK_PAUSED: 36387,
|
|
738
|
+
TRANSFORM_FEEDBACK_ACTIVE: 36388,
|
|
739
|
+
TRANSFORM_FEEDBACK_BINDING: 36389,
|
|
740
|
+
TEXTURE_IMMUTABLE_FORMAT: 37167,
|
|
741
|
+
MAX_ELEMENT_INDEX: 36203,
|
|
742
|
+
TEXTURE_IMMUTABLE_LEVELS: 33503,
|
|
743
|
+
TIMEOUT_IGNORED: -1,
|
|
744
|
+
MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 37447
|
|
745
|
+
};
|
|
746
|
+
const extensions = {
|
|
747
|
+
// ratified
|
|
748
|
+
OES_texture_float: {},
|
|
749
|
+
OES_texture_half_float: {},
|
|
750
|
+
WEBGL_lose_context: {
|
|
751
|
+
loseContext: () => {
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
OES_standard_derivatives: {},
|
|
755
|
+
OES_vertex_array_object: {
|
|
756
|
+
createVertexArrayOES: () => {
|
|
757
|
+
},
|
|
758
|
+
bindVertexArrayOES: () => {
|
|
759
|
+
},
|
|
760
|
+
deleteVertexArrayOES: () => {
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
WEBGL_debug_renderer_info: null,
|
|
764
|
+
WEBGL_debug_shaders: null,
|
|
765
|
+
WEBGL_compressed_texture_s3tc: null,
|
|
766
|
+
WEBGL_depth_texture: {},
|
|
767
|
+
OES_element_index_uint: {},
|
|
768
|
+
EXT_texture_filter_anisotropic: null,
|
|
769
|
+
EXT_frag_depth: {},
|
|
770
|
+
WEBGL_draw_buffers: {},
|
|
771
|
+
ANGLE_instanced_arrays: null,
|
|
772
|
+
OES_texture_float_linear: null,
|
|
773
|
+
OES_texture_half_float_linear: null,
|
|
774
|
+
EXT_blend_minmax: { MIN_EXT: 0, MAX_EXT: 0 },
|
|
775
|
+
EXT_shader_texture_lod: null,
|
|
776
|
+
// community
|
|
777
|
+
WEBGL_compressed_texture_atc: null,
|
|
778
|
+
WEBGL_compressed_texture_pvrtc: null,
|
|
779
|
+
EXT_color_buffer_half_float: null,
|
|
780
|
+
WEBGL_color_buffer_float: null,
|
|
781
|
+
EXT_sRGB: null,
|
|
782
|
+
WEBGL_compressed_texture_etc1: null
|
|
783
|
+
};
|
|
784
|
+
const returnsHandle = (method) => method.startsWith("create") || method === "fenceSync";
|
|
785
|
+
class WebGL2RenderingContext {
|
|
786
|
+
constructor(canvas) {
|
|
787
|
+
__publicField$2(this, "getShaderPrecisionFormat", () => {
|
|
788
|
+
return {
|
|
789
|
+
rangeMin: 127,
|
|
790
|
+
rangeMax: 127,
|
|
791
|
+
precision: 23
|
|
792
|
+
};
|
|
793
|
+
});
|
|
794
|
+
__publicField$2(this, "GL_VERSION", 7938);
|
|
795
|
+
__publicField$2(this, "SCISSOR_BOX", 3088);
|
|
796
|
+
__publicField$2(this, "VIEWPORT", 2978);
|
|
797
|
+
__publicField$2(this, "getProgramInfoLog", () => "");
|
|
798
|
+
__publicField$2(this, "getShaderInfoLog", () => "");
|
|
799
|
+
this.canvas = canvas;
|
|
800
|
+
this.drawingBufferWidth = canvas.width;
|
|
801
|
+
this.drawingBufferHeight = canvas.height;
|
|
802
|
+
for (const method of functions) {
|
|
803
|
+
this[method] ?? (this[method] = returnsHandle(method) ? () => ({}) : () => {
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
Object.assign(this, enums);
|
|
807
|
+
}
|
|
808
|
+
getParameter(paramId) {
|
|
809
|
+
switch (paramId) {
|
|
810
|
+
case this.GL_VERSION:
|
|
811
|
+
return ["WebGL2"];
|
|
812
|
+
case this.SCISSOR_BOX:
|
|
813
|
+
case this.VIEWPORT:
|
|
814
|
+
return [0, 0, 1, 1];
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
getExtension(ext) {
|
|
818
|
+
return extensions[ext];
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
var __defProp$1 = Object.defineProperty;
|
|
823
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
824
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
825
|
+
class MockGPUTexture {
|
|
826
|
+
constructor(descriptor) {
|
|
827
|
+
__publicField$1(this, "width");
|
|
828
|
+
__publicField$1(this, "height");
|
|
829
|
+
__publicField$1(this, "depthOrArrayLayers");
|
|
830
|
+
__publicField$1(this, "mipLevelCount");
|
|
831
|
+
__publicField$1(this, "sampleCount");
|
|
832
|
+
__publicField$1(this, "dimension");
|
|
833
|
+
__publicField$1(this, "format");
|
|
834
|
+
__publicField$1(this, "usage");
|
|
835
|
+
this.width = typeof descriptor.size === "number" ? descriptor.size : descriptor.size.width ?? 1;
|
|
836
|
+
this.height = typeof descriptor.size === "number" ? 1 : descriptor.size.height ?? 1;
|
|
837
|
+
this.depthOrArrayLayers = typeof descriptor.size === "number" ? 1 : descriptor.size.depthOrArrayLayers ?? 1;
|
|
838
|
+
this.mipLevelCount = descriptor.mipLevelCount ?? 1;
|
|
839
|
+
this.sampleCount = descriptor.sampleCount ?? 1;
|
|
840
|
+
this.dimension = descriptor.dimension ?? "2d";
|
|
841
|
+
this.format = descriptor.format;
|
|
842
|
+
this.usage = descriptor.usage;
|
|
843
|
+
}
|
|
844
|
+
createView(_descriptor) {
|
|
845
|
+
return new MockGPUTextureView();
|
|
846
|
+
}
|
|
847
|
+
destroy() {
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
class MockGPUTextureView {
|
|
851
|
+
constructor() {
|
|
852
|
+
__publicField$1(this, "label");
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
class MockGPUCanvasContext {
|
|
856
|
+
constructor(canvas) {
|
|
857
|
+
__publicField$1(this, "canvas");
|
|
858
|
+
__publicField$1(this, "_configuration", null);
|
|
859
|
+
this.canvas = canvas;
|
|
860
|
+
}
|
|
861
|
+
configure(configuration) {
|
|
862
|
+
this._configuration = configuration;
|
|
863
|
+
}
|
|
864
|
+
unconfigure() {
|
|
865
|
+
this._configuration = null;
|
|
866
|
+
}
|
|
867
|
+
getCurrentTexture() {
|
|
868
|
+
const width = this.canvas instanceof HTMLCanvasElement ? this.canvas.width : this.canvas.width;
|
|
869
|
+
const height = this.canvas instanceof HTMLCanvasElement ? this.canvas.height : this.canvas.height;
|
|
870
|
+
return new MockGPUTexture({
|
|
871
|
+
size: { width, height },
|
|
872
|
+
format: this._configuration?.format ?? "bgra8unorm",
|
|
873
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
function setupWebGLMocking() {
|
|
879
|
+
if (globalThis.HTMLCanvasElement) {
|
|
880
|
+
const originalGetContext = HTMLCanvasElement.prototype.getContext;
|
|
881
|
+
HTMLCanvasElement.prototype.getContext = function(id, options) {
|
|
882
|
+
if (id.startsWith("webgl")) {
|
|
883
|
+
return new WebGL2RenderingContext(this);
|
|
884
|
+
}
|
|
885
|
+
return originalGetContext.call(this, id, options);
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
class WebGLRenderingContext extends WebGL2RenderingContext {
|
|
889
|
+
}
|
|
890
|
+
globalThis.WebGLRenderingContext ?? (globalThis.WebGLRenderingContext = WebGLRenderingContext);
|
|
891
|
+
globalThis.WebGL2RenderingContext ?? (globalThis.WebGL2RenderingContext = WebGL2RenderingContext);
|
|
892
|
+
}
|
|
893
|
+
function setupWebGPUMocking() {
|
|
894
|
+
if (globalThis.HTMLCanvasElement) {
|
|
895
|
+
const originalGetContext = HTMLCanvasElement.prototype.getContext;
|
|
896
|
+
HTMLCanvasElement.prototype.getContext = function(id, options) {
|
|
897
|
+
if (id === "webgpu") {
|
|
898
|
+
return new MockGPUCanvasContext(this);
|
|
899
|
+
}
|
|
900
|
+
if (id.startsWith("webgl")) {
|
|
901
|
+
return new WebGL2RenderingContext(this);
|
|
902
|
+
}
|
|
903
|
+
return originalGetContext.call(this, id, options);
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
class WebGLRenderingContext extends WebGL2RenderingContext {
|
|
907
|
+
}
|
|
908
|
+
globalThis.WebGLRenderingContext ?? (globalThis.WebGLRenderingContext = WebGLRenderingContext);
|
|
909
|
+
globalThis.WebGL2RenderingContext ?? (globalThis.WebGL2RenderingContext = WebGL2RenderingContext);
|
|
910
|
+
}
|
|
911
|
+
const createCanvas = ({
|
|
912
|
+
beforeReturn,
|
|
913
|
+
width = 1280,
|
|
914
|
+
height = 800,
|
|
915
|
+
mode = "webgl"
|
|
916
|
+
} = {}) => {
|
|
917
|
+
let canvas;
|
|
918
|
+
if (typeof document !== "undefined" && typeof document.createElement === "function") {
|
|
919
|
+
canvas = document.createElement("canvas");
|
|
920
|
+
} else {
|
|
921
|
+
canvas = createMockCanvas(width, height, mode);
|
|
922
|
+
}
|
|
923
|
+
canvas.width = width;
|
|
924
|
+
canvas.height = height;
|
|
925
|
+
if (mode === "webgpu") {
|
|
926
|
+
setupWebGPUMocking();
|
|
927
|
+
} else {
|
|
928
|
+
setupWebGLMocking();
|
|
929
|
+
}
|
|
930
|
+
beforeReturn?.(canvas);
|
|
931
|
+
return canvas;
|
|
932
|
+
};
|
|
933
|
+
function createMockCanvas(width, height, mode) {
|
|
934
|
+
const canvas = {
|
|
935
|
+
style: {},
|
|
936
|
+
width,
|
|
937
|
+
height,
|
|
938
|
+
clientWidth: width,
|
|
939
|
+
clientHeight: height,
|
|
940
|
+
addEventListener: (() => {
|
|
941
|
+
}),
|
|
942
|
+
removeEventListener: (() => {
|
|
943
|
+
}),
|
|
944
|
+
getContext: ((id) => {
|
|
945
|
+
if (mode === "webgpu" && id === "webgpu") {
|
|
946
|
+
return new MockGPUCanvasContext(canvas);
|
|
947
|
+
}
|
|
948
|
+
if (id.startsWith("webgl")) {
|
|
949
|
+
return new WebGL2RenderingContext(canvas);
|
|
950
|
+
}
|
|
951
|
+
return null;
|
|
952
|
+
}),
|
|
953
|
+
// Additional properties that Three.js might check
|
|
954
|
+
getBoundingClientRect: () => ({
|
|
955
|
+
left: 0,
|
|
956
|
+
top: 0,
|
|
957
|
+
right: width,
|
|
958
|
+
bottom: height,
|
|
959
|
+
width,
|
|
960
|
+
height,
|
|
961
|
+
x: 0,
|
|
962
|
+
y: 0,
|
|
963
|
+
toJSON: () => {
|
|
964
|
+
}
|
|
965
|
+
}),
|
|
966
|
+
// For WebGPU texture creation
|
|
967
|
+
transferControlToOffscreen: () => ({
|
|
968
|
+
width,
|
|
969
|
+
height,
|
|
970
|
+
getContext: (id) => {
|
|
971
|
+
if (id === "webgpu") return new MockGPUCanvasContext(canvas);
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
})
|
|
975
|
+
};
|
|
976
|
+
return canvas;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
const createEventFirer = (act, store) => {
|
|
980
|
+
const findEventHandler = (element, eventName) => {
|
|
981
|
+
const eventHandlerName = toEventHandlerName(eventName);
|
|
982
|
+
const props = element.props;
|
|
983
|
+
if (typeof props[eventHandlerName] === "function") {
|
|
984
|
+
return props[eventHandlerName];
|
|
985
|
+
}
|
|
986
|
+
if (typeof props[eventName] === "function") {
|
|
987
|
+
return props[eventName];
|
|
988
|
+
}
|
|
989
|
+
console.warn(
|
|
990
|
+
`Handler for ${eventName} was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent`
|
|
991
|
+
);
|
|
992
|
+
return null;
|
|
993
|
+
};
|
|
994
|
+
const createSyntheticEvent = (element, data) => {
|
|
995
|
+
const raycastEvent = {
|
|
996
|
+
camera: store.getState().camera,
|
|
997
|
+
stopPropagation: () => {
|
|
998
|
+
},
|
|
999
|
+
target: element,
|
|
1000
|
+
currentTarget: element,
|
|
1001
|
+
sourceEvent: data,
|
|
1002
|
+
...data
|
|
1003
|
+
};
|
|
1004
|
+
return raycastEvent;
|
|
1005
|
+
};
|
|
1006
|
+
const invokeEvent = async (element, eventName, data) => {
|
|
1007
|
+
const handler = findEventHandler(element, eventName);
|
|
1008
|
+
if (!handler) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
let returnValue;
|
|
1012
|
+
await act(async () => {
|
|
1013
|
+
returnValue = handler(createSyntheticEvent(element, data));
|
|
1014
|
+
});
|
|
1015
|
+
return returnValue;
|
|
1016
|
+
};
|
|
1017
|
+
const fireEvent = async (element, eventName, data = {}) => await invokeEvent(element, eventName, data);
|
|
1018
|
+
return fireEvent;
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
const expectOne = (items, msg) => {
|
|
1022
|
+
if (items.length === 1) {
|
|
1023
|
+
return items[0];
|
|
1024
|
+
}
|
|
1025
|
+
const prefix = items.length === 0 ? "RTTR: No instances found" : `RTTR: Expected 1 but found ${items.length} instances`;
|
|
1026
|
+
throw new Error(`${prefix} ${msg}`);
|
|
1027
|
+
};
|
|
1028
|
+
const matchProps = (props, filter) => {
|
|
1029
|
+
for (const key in filter) {
|
|
1030
|
+
const isRegex = filter[key] instanceof RegExp;
|
|
1031
|
+
const shouldMatch = isRegex && typeof props[key] === "string";
|
|
1032
|
+
const match = shouldMatch && filter[key].test(props[key]);
|
|
1033
|
+
if (props[key] !== filter[key] && !match) {
|
|
1034
|
+
return false;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return true;
|
|
1038
|
+
};
|
|
1039
|
+
const findAll = (root, decider, options = { includeRoot: true }) => {
|
|
1040
|
+
const results = [];
|
|
1041
|
+
if (options.includeRoot !== false && decider(root)) {
|
|
1042
|
+
results.push(root);
|
|
1043
|
+
}
|
|
1044
|
+
root.allChildren.forEach((child) => {
|
|
1045
|
+
results.push(...findAll(child, decider, { includeRoot: true }));
|
|
1046
|
+
});
|
|
1047
|
+
return results;
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
var __defProp = Object.defineProperty;
|
|
1051
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1052
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1053
|
+
const createVirtualInstance = (object, parent) => {
|
|
1054
|
+
const instance = {
|
|
1055
|
+
root: parent.root,
|
|
1056
|
+
type: object.type.toLowerCase(),
|
|
1057
|
+
// Convert to lowercase to match R3F convention
|
|
1058
|
+
parent,
|
|
1059
|
+
children: [],
|
|
1060
|
+
props: { object },
|
|
1061
|
+
object,
|
|
1062
|
+
eventCount: 0,
|
|
1063
|
+
handlers: {},
|
|
1064
|
+
isHidden: false
|
|
1065
|
+
};
|
|
1066
|
+
if (object.children && object.children.length > 0) {
|
|
1067
|
+
const objectChildren = object.children;
|
|
1068
|
+
instance.children = Array.from(objectChildren).map((child) => createVirtualInstance(child, instance));
|
|
1069
|
+
}
|
|
1070
|
+
return instance;
|
|
1071
|
+
};
|
|
1072
|
+
class ReactThreeTestInstance {
|
|
1073
|
+
constructor(fiber) {
|
|
1074
|
+
__publicField(this, "_fiber");
|
|
1075
|
+
__publicField(this, "getChildren", (fiber, opts = { exhaustive: false }) => {
|
|
1076
|
+
const r3fChildren = fiber.children.filter((child) => !child.props.attach || opts.exhaustive).map((fib) => wrapFiber(fib));
|
|
1077
|
+
if (fiber.type === "primitive" && fiber.object.children?.length) {
|
|
1078
|
+
const threeChildren = fiber.object.children.map((child) => {
|
|
1079
|
+
const virtualInstance = createVirtualInstance(child, fiber);
|
|
1080
|
+
return wrapFiber(virtualInstance);
|
|
1081
|
+
});
|
|
1082
|
+
r3fChildren.push(...threeChildren);
|
|
1083
|
+
return r3fChildren;
|
|
1084
|
+
}
|
|
1085
|
+
return r3fChildren;
|
|
1086
|
+
});
|
|
1087
|
+
__publicField(this, "findAll", (decider) => findAll(this, decider, { includeRoot: false }));
|
|
1088
|
+
__publicField(this, "find", (decider) => expectOne(this.findAll(decider), `matching custom checker: ${decider.toString()}`));
|
|
1089
|
+
__publicField(this, "findByType", (type) => expectOne(
|
|
1090
|
+
this.findAll((node) => Boolean(node.type && node.type === type)),
|
|
1091
|
+
`with node type: "${type || "Unknown"}"`
|
|
1092
|
+
));
|
|
1093
|
+
__publicField(this, "findAllByType", (type) => this.findAll((node) => Boolean(node.type && node.type === type)));
|
|
1094
|
+
__publicField(this, "findByProps", (props) => expectOne(this.findAllByProps(props), `with props: ${JSON.stringify(props)}`));
|
|
1095
|
+
__publicField(this, "findAllByProps", (props) => this.findAll((node) => Boolean(node.props && matchProps(node.props, props))));
|
|
1096
|
+
this._fiber = fiber;
|
|
1097
|
+
}
|
|
1098
|
+
get fiber() {
|
|
1099
|
+
return this._fiber;
|
|
1100
|
+
}
|
|
1101
|
+
get instance() {
|
|
1102
|
+
return this._fiber.object;
|
|
1103
|
+
}
|
|
1104
|
+
get type() {
|
|
1105
|
+
return this._fiber.object.type;
|
|
1106
|
+
}
|
|
1107
|
+
get props() {
|
|
1108
|
+
return this._fiber.props;
|
|
1109
|
+
}
|
|
1110
|
+
get parent() {
|
|
1111
|
+
const parent = this._fiber.parent;
|
|
1112
|
+
if (parent !== null) {
|
|
1113
|
+
return wrapFiber(parent);
|
|
1114
|
+
}
|
|
1115
|
+
return parent;
|
|
1116
|
+
}
|
|
1117
|
+
get children() {
|
|
1118
|
+
return this.getChildren(this._fiber);
|
|
1119
|
+
}
|
|
1120
|
+
get allChildren() {
|
|
1121
|
+
return this.getChildren(this._fiber, { exhaustive: true });
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
const fiberToWrapper = /* @__PURE__ */ new WeakMap();
|
|
1125
|
+
const wrapFiber = (fiber) => {
|
|
1126
|
+
let wrapper = fiberToWrapper.get(fiber);
|
|
1127
|
+
if (wrapper === void 0) {
|
|
1128
|
+
wrapper = new ReactThreeTestInstance(fiber);
|
|
1129
|
+
fiberToWrapper.set(fiber, wrapper);
|
|
1130
|
+
}
|
|
1131
|
+
return wrapper;
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
async function waitFor(callback, { interval = 50, timeout = 5e3 } = {}) {
|
|
1135
|
+
await react.act(async () => {
|
|
1136
|
+
const start = performance.now();
|
|
1137
|
+
while (true) {
|
|
1138
|
+
const result = callback();
|
|
1139
|
+
if (result || result == null) break;
|
|
1140
|
+
if (interval) await new Promise((resolve) => setTimeout(resolve, interval));
|
|
1141
|
+
if (timeout && performance.now() - start >= timeout) throw new Error(`Timed out after ${timeout}ms.`);
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
function createTestRenderer(deps) {
|
|
1147
|
+
const { THREE: THREE2, createRoot, mockRoots, reconciler, act, extend, mode } = deps;
|
|
1148
|
+
extend(THREE2);
|
|
1149
|
+
const create = async (element, options) => {
|
|
1150
|
+
const canvas = createCanvas({ ...options, mode });
|
|
1151
|
+
const _root = createRoot(canvas);
|
|
1152
|
+
await _root.configure({
|
|
1153
|
+
frameloop: "never",
|
|
1154
|
+
// TODO: remove and use default behavior
|
|
1155
|
+
size: {
|
|
1156
|
+
width: options?.width ?? 1280,
|
|
1157
|
+
height: options?.height ?? 800,
|
|
1158
|
+
top: 0,
|
|
1159
|
+
left: 0
|
|
1160
|
+
},
|
|
1161
|
+
...options,
|
|
1162
|
+
events: void 0
|
|
1163
|
+
});
|
|
1164
|
+
const _store = mockRoots.get(canvas).store;
|
|
1165
|
+
await act(async () => _root.render(element));
|
|
1166
|
+
const _scene = _store.getState().scene.__r3f;
|
|
1167
|
+
return {
|
|
1168
|
+
scene: wrapFiber(_scene),
|
|
1169
|
+
async unmount() {
|
|
1170
|
+
await act(async () => {
|
|
1171
|
+
_root.unmount();
|
|
1172
|
+
});
|
|
1173
|
+
},
|
|
1174
|
+
getInstance() {
|
|
1175
|
+
if (!mockRoots.has(canvas)) return null;
|
|
1176
|
+
const root = { current: mockRoots.get(canvas).fiber.current };
|
|
1177
|
+
while (root.current.child && !root.current.child.stateNode) root.current = root.current.child;
|
|
1178
|
+
if (!root.current.child) return null;
|
|
1179
|
+
return reconciler.getPublicRootInstance(root);
|
|
1180
|
+
},
|
|
1181
|
+
async update(newElement) {
|
|
1182
|
+
if (!mockRoots.has(canvas)) return console.warn("RTTR: attempted to update an unmounted root!");
|
|
1183
|
+
await act(async () => {
|
|
1184
|
+
_root.render(newElement);
|
|
1185
|
+
});
|
|
1186
|
+
},
|
|
1187
|
+
toTree() {
|
|
1188
|
+
return toTree(_scene);
|
|
1189
|
+
},
|
|
1190
|
+
toGraph() {
|
|
1191
|
+
return toGraph(_scene);
|
|
1192
|
+
},
|
|
1193
|
+
fireEvent: createEventFirer(act, _store),
|
|
1194
|
+
async advanceFrames(frames, delta = 1) {
|
|
1195
|
+
const state = _store.getState();
|
|
1196
|
+
const scheduler = state.internal.scheduler;
|
|
1197
|
+
if (scheduler) {
|
|
1198
|
+
if (scheduler.resetTiming) {
|
|
1199
|
+
scheduler.resetTiming();
|
|
1200
|
+
}
|
|
1201
|
+
let baseTime = 0;
|
|
1202
|
+
scheduler.step(baseTime);
|
|
1203
|
+
for (let i = 0; i < frames; i++) {
|
|
1204
|
+
const frameDeltaSeconds = Array.isArray(delta) ? delta[i] ?? delta[delta.length - 1] : delta;
|
|
1205
|
+
const frameDeltaMs = frameDeltaSeconds * 1e3;
|
|
1206
|
+
baseTime += frameDeltaMs;
|
|
1207
|
+
scheduler.step(baseTime);
|
|
1208
|
+
}
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const storeSubscribers = state.internal.subscribers;
|
|
1212
|
+
const promises = [];
|
|
1213
|
+
storeSubscribers.forEach((subscriber) => {
|
|
1214
|
+
for (let i = 0; i < frames; i++) {
|
|
1215
|
+
if (Array.isArray(delta)) {
|
|
1216
|
+
promises.push(
|
|
1217
|
+
new Promise(() => subscriber.ref.current(state, delta[i] || delta[-1]))
|
|
1218
|
+
);
|
|
1219
|
+
} else {
|
|
1220
|
+
promises.push(new Promise(() => subscriber.ref.current(state, delta)));
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
Promise.all(promises);
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
};
|
|
1228
|
+
return { create, act, waitFor };
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
const index = {
|
|
1232
|
+
__proto__: null,
|
|
1233
|
+
ReactThreeTestInstance: ReactThreeTestInstance
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
const renderer = createTestRenderer({
|
|
1237
|
+
THREE: THREE__namespace,
|
|
1238
|
+
createRoot: legacy$1.createRoot,
|
|
1239
|
+
mockRoots: legacy$1._roots,
|
|
1240
|
+
reconciler: legacy$1.reconciler,
|
|
1241
|
+
act: react.act,
|
|
1242
|
+
extend: legacy$1.extend,
|
|
1243
|
+
mode: "webgl"
|
|
1244
|
+
});
|
|
1245
|
+
const { create } = renderer;
|
|
1246
|
+
const legacy = { create, act: react.act, waitFor };
|
|
1247
|
+
|
|
1248
|
+
exports.act = react.act;
|
|
1249
|
+
exports.ReactThreeTest = index;
|
|
1250
|
+
exports.create = create;
|
|
1251
|
+
exports.default = legacy;
|
|
1252
|
+
exports.waitFor = waitFor;
|