@react-three/test-renderer 8.1.2 → 8.1.4
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/CHANGELOG.md +12 -0
- package/dist/declarations/src/WebGL2RenderingContext.d.ts +16 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/react-three-test-renderer.cjs.dev.js +199 -50
- package/dist/react-three-test-renderer.cjs.prod.js +199 -50
- package/dist/react-three-test-renderer.esm.js +198 -51
- package/package.json +1 -1
- package/dist/declarations/src/createWebGLContext.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class WebGL2RenderingContext {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
constructor(canvas: HTMLCanvasElement);
|
|
4
|
+
getShaderPrecisionFormat: () => {
|
|
5
|
+
rangeMin: number;
|
|
6
|
+
rangeMax: number;
|
|
7
|
+
precision: number;
|
|
8
|
+
};
|
|
9
|
+
private GL_VERSION;
|
|
10
|
+
private SCISSOR_BOX;
|
|
11
|
+
private VIEWPORT;
|
|
12
|
+
getParameter(paramId: number): string[] | number[] | undefined;
|
|
13
|
+
getExtension(ext: string): any;
|
|
14
|
+
getProgramInfoLog: () => string;
|
|
15
|
+
getShaderInfoLog: () => string;
|
|
16
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CreateOptions, Renderer, Act } from './types/public';
|
|
3
|
+
export declare const act: Act;
|
|
4
|
+
export declare const create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
3
5
|
export * as ReactThreeTest from './types';
|
|
4
6
|
declare const _default: {
|
|
5
7
|
create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
@@ -71,23 +71,7 @@ const is = {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const
|
|
75
|
-
beforeReturn,
|
|
76
|
-
width = 1280,
|
|
77
|
-
height = 800
|
|
78
|
-
} = {}) => {
|
|
79
|
-
const canvas = document.createElement('canvas');
|
|
80
|
-
canvas.height = height;
|
|
81
|
-
canvas.width = width;
|
|
82
|
-
canvas.addEventListener = () => {};
|
|
83
|
-
canvas.removeEventListener = () => {};
|
|
84
|
-
if (beforeReturn) {
|
|
85
|
-
beforeReturn(canvas);
|
|
86
|
-
}
|
|
87
|
-
return canvas;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const functions = ['attachShader', 'bindAttribLocation', 'bindBuffer', 'bindFramebuffer', 'bindRenderbuffer', 'bindTexture', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clear', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'compileShader', 'compressedTexImage2D', 'compressedTexSubImage2D', 'copyTexImage2D', 'copyTexSubImage2D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createRenderbuffer', 'createShader', 'createTexture', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteRenderbuffer', 'deleteShader', 'deleteTexture', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'disableVertexAttribArray', 'drawArrays', 'drawElements', 'enable', 'enableVertexAttribArray', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getContextAttributes', 'getError', 'getFramebufferAttachmentParameter', 'getProgramParameter', 'getRenderbufferParameter', 'getShaderParameter', 'getShaderSource', 'getSupportedExtensions', 'getTexParameter', 'getUniform', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isRenderbuffer', 'isShader', 'isTexture', 'lineWidth', 'linkProgram', 'pixelStorei', 'polygonOffset', 'readPixels', 'renderbufferStorage', 'sampleCoverage', 'scissor', 'setPixelRatio', 'setSize', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texParameterf', 'texParameteri', 'texImage2D', 'texSubImage2D', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniformMatrix2fv', 'uniformMatrix3fv', 'uniformMatrix4fv', 'useProgram', 'validateProgram', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribPointer', 'viewport'];
|
|
74
|
+
const functions = ['activeTexture', 'attachShader', 'beginQuery', 'beginTransformFeedback', 'bindAttribLocation', 'bindBufferBase', 'bindBufferRange', 'bindRenderbuffer', 'bindSampler', 'bindTransformFeedback', 'bindVertexArray', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'blitFramebuffer', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clientWaitSync', 'compileShader', 'compressedTexImage2D', 'compressedTexImage3D', 'compressedTexSubImage2D', 'compressedTexSubImage3D', 'copyBufferSubData', 'copyTexImage2D', 'copyTexSubImage2D', 'copyTexSubImage3D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createQuery', 'createRenderbuffer', 'createSampler', 'createShader', 'createTexture', 'createTransformFeedback', 'createVertexArray', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteQuery', 'deleteRenderbuffer', 'deleteSampler', 'deleteShader', 'deleteSync', 'deleteTexture', 'deleteTransformFeedback', 'deleteVertexArray', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'drawArraysInstanced', 'drawElementsInstanced', 'drawRangeElements', 'enable', 'endQuery', 'endTransformFeedback', 'fenceSync', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'framebufferTextureLayer', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getActiveUniformBlockName', 'getActiveUniformBlockParameter', 'getActiveUniforms', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getBufferSubData', 'getContextAttributes', 'getError', 'getExtension', 'getFragDataLocation', 'getFramebufferAttachmentParameter', 'getIndexedParameter', 'getInternalformatParameter', 'getParameter', 'getProgramInfoLog', 'getProgramParameter', 'getQuery', 'getQueryParameter', 'getRenderbufferParameter', 'getSamplerParameter', 'getShaderInfoLog', 'getShaderParameter', 'getShaderPrecisionFormat', 'getShaderSource', 'getSupportedExtensions', 'getSyncParameter', 'getTexParameter', 'getTransformFeedbackVarying', 'getUniform', 'getUniformBlockIndex', 'getUniformIndices', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'invalidateFramebuffer', 'invalidateSubFramebuffer', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isQuery', 'isRenderbuffer', 'isSampler', 'isShader', 'isSync', 'isTexture', 'isTransformFeedback', 'isVertexArray', 'lineWidth', 'linkProgram', 'pauseTransformFeedback', 'pixelStorei', 'polygonOffset', 'readBuffer', 'readPixels', 'renderbufferStorage', 'renderbufferStorageMultisample', 'resumeTransformFeedback', 'sampleCoverage', 'samplerParameterf', 'samplerParameteri', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texImage2D', 'texImage3D', 'texParameterf', 'texParameteri', 'texStorage2D', 'texStorage3D', 'texSubImage2D', 'texSubImage3D', 'transformFeedbackVaryings', 'uniform1ui', 'uniform2ui', 'uniform3ui', 'uniform4ui', 'uniformBlockBinding', 'useProgram', 'validateProgram', 'vertexAttribDivisor', 'vertexAttribI4i', 'vertexAttribI4ui', 'vertexAttribIPointer', 'waitSync', 'bindBuffer', 'bindFramebuffer', 'bindTexture', 'clear', 'clearBufferfi', 'clearBufferfv', 'clearBufferiv', 'clearBufferuiv', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'disableVertexAttribArray', 'drawArrays', 'drawBuffers', 'drawElements', 'enableVertexAttribArray', 'scissor', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform1uiv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform2uiv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform3uiv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniform4uiv', 'uniformMatrix2fv', 'uniformMatrix2x3fv', 'uniformMatrix2x4fv', 'uniformMatrix3fv', 'uniformMatrix3x2fv', 'uniformMatrix3x4fv', 'uniformMatrix4fv', 'uniformMatrix4x2fv', 'uniformMatrix4x3fv', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribI4iv', 'vertexAttribI4uiv', 'vertexAttribPointer', 'viewport', 'makeXRCompatible'];
|
|
91
75
|
const enums = {
|
|
92
76
|
DEPTH_BUFFER_BIT: 256,
|
|
93
77
|
STENCIL_BUFFER_BIT: 1024,
|
|
@@ -385,7 +369,159 @@ const enums = {
|
|
|
385
369
|
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
|
|
386
370
|
CONTEXT_LOST_WEBGL: 37442,
|
|
387
371
|
UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
|
|
388
|
-
BROWSER_DEFAULT_WEBGL: 37444
|
|
372
|
+
BROWSER_DEFAULT_WEBGL: 37444,
|
|
373
|
+
READ_BUFFER: 3074,
|
|
374
|
+
UNPACK_ROW_LENGTH: 3314,
|
|
375
|
+
UNPACK_SKIP_ROWS: 3315,
|
|
376
|
+
UNPACK_SKIP_PIXELS: 3316,
|
|
377
|
+
PACK_ROW_LENGTH: 3330,
|
|
378
|
+
PACK_SKIP_ROWS: 3331,
|
|
379
|
+
PACK_SKIP_PIXELS: 3332,
|
|
380
|
+
COLOR: 6144,
|
|
381
|
+
DEPTH: 6145,
|
|
382
|
+
STENCIL: 6146,
|
|
383
|
+
RED: 6403,
|
|
384
|
+
UNPACK_SKIP_IMAGES: 32877,
|
|
385
|
+
UNPACK_IMAGE_HEIGHT: 32878,
|
|
386
|
+
TEXTURE_WRAP_R: 32882,
|
|
387
|
+
MAX_ELEMENTS_VERTICES: 33000,
|
|
388
|
+
MAX_ELEMENTS_INDICES: 33001,
|
|
389
|
+
TEXTURE_MIN_LOD: 33082,
|
|
390
|
+
TEXTURE_MAX_LOD: 33083,
|
|
391
|
+
TEXTURE_BASE_LEVEL: 33084,
|
|
392
|
+
TEXTURE_MAX_LEVEL: 33085,
|
|
393
|
+
MIN: 32775,
|
|
394
|
+
MAX: 32776,
|
|
395
|
+
MAX_TEXTURE_LOD_BIAS: 34045,
|
|
396
|
+
TEXTURE_COMPARE_MODE: 34892,
|
|
397
|
+
TEXTURE_COMPARE_FUNC: 34893,
|
|
398
|
+
CURRENT_QUERY: 34917,
|
|
399
|
+
QUERY_RESULT: 34918,
|
|
400
|
+
QUERY_RESULT_AVAILABLE: 34919,
|
|
401
|
+
STREAM_READ: 35041,
|
|
402
|
+
STREAM_COPY: 35042,
|
|
403
|
+
STATIC_READ: 35045,
|
|
404
|
+
STATIC_COPY: 35046,
|
|
405
|
+
DYNAMIC_READ: 35049,
|
|
406
|
+
DYNAMIC_COPY: 35050,
|
|
407
|
+
MAX_DRAW_BUFFERS: 34852,
|
|
408
|
+
MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
|
|
409
|
+
MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
|
|
410
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
|
|
411
|
+
PIXEL_PACK_BUFFER: 35051,
|
|
412
|
+
PIXEL_UNPACK_BUFFER: 35052,
|
|
413
|
+
PIXEL_PACK_BUFFER_BINDING: 35053,
|
|
414
|
+
PIXEL_UNPACK_BUFFER_BINDING: 35055,
|
|
415
|
+
SRGB: 35904,
|
|
416
|
+
COMPARE_REF_TO_TEXTURE: 34894,
|
|
417
|
+
VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
|
|
418
|
+
MAX_ARRAY_TEXTURE_LAYERS: 35071,
|
|
419
|
+
MIN_PROGRAM_TEXEL_OFFSET: 35076,
|
|
420
|
+
MAX_PROGRAM_TEXEL_OFFSET: 35077,
|
|
421
|
+
MAX_VARYING_COMPONENTS: 35659,
|
|
422
|
+
TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
|
|
423
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
|
|
424
|
+
TRANSFORM_FEEDBACK_VARYINGS: 35971,
|
|
425
|
+
TRANSFORM_FEEDBACK_BUFFER_START: 35972,
|
|
426
|
+
TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
|
|
427
|
+
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
|
|
428
|
+
RASTERIZER_DISCARD: 35977,
|
|
429
|
+
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
|
|
430
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
|
|
431
|
+
INTERLEAVED_ATTRIBS: 35980,
|
|
432
|
+
SEPARATE_ATTRIBS: 35981,
|
|
433
|
+
TRANSFORM_FEEDBACK_BUFFER: 35982,
|
|
434
|
+
TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
|
|
435
|
+
RED_INTEGER: 36244,
|
|
436
|
+
RGB_INTEGER: 36248,
|
|
437
|
+
RGBA_INTEGER: 36249,
|
|
438
|
+
SAMPLER_CUBE_SHADOW: 36293,
|
|
439
|
+
INT_SAMPLER_CUBE: 36300,
|
|
440
|
+
UNSIGNED_INT_SAMPLER_CUBE: 36308,
|
|
441
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
|
|
442
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
|
|
443
|
+
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
|
|
444
|
+
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
|
|
445
|
+
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
|
|
446
|
+
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
|
|
447
|
+
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
|
|
448
|
+
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
|
|
449
|
+
FRAMEBUFFER_DEFAULT: 33304,
|
|
450
|
+
UNSIGNED_NORMALIZED: 35863,
|
|
451
|
+
DRAW_FRAMEBUFFER_BINDING: 36006,
|
|
452
|
+
READ_FRAMEBUFFER: 36008,
|
|
453
|
+
DRAW_FRAMEBUFFER: 36009,
|
|
454
|
+
READ_FRAMEBUFFER_BINDING: 36010,
|
|
455
|
+
RENDERBUFFER_SAMPLES: 36011,
|
|
456
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
|
|
457
|
+
MAX_COLOR_ATTACHMENTS: 36063,
|
|
458
|
+
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
|
|
459
|
+
MAX_SAMPLES: 36183,
|
|
460
|
+
HALF_FLOAT: 5131,
|
|
461
|
+
RG: 33319,
|
|
462
|
+
RG_INTEGER: 33320,
|
|
463
|
+
VERTEX_ARRAY_BINDING: 34229,
|
|
464
|
+
SIGNED_NORMALIZED: 36764,
|
|
465
|
+
COPY_READ_BUFFER: 36662,
|
|
466
|
+
COPY_WRITE_BUFFER: 36663,
|
|
467
|
+
COPY_READ_BUFFER_BINDING: 36662,
|
|
468
|
+
COPY_WRITE_BUFFER_BINDING: 36663,
|
|
469
|
+
UNIFORM_BUFFER: 35345,
|
|
470
|
+
UNIFORM_BUFFER_BINDING: 35368,
|
|
471
|
+
UNIFORM_BUFFER_START: 35369,
|
|
472
|
+
UNIFORM_BUFFER_SIZE: 35370,
|
|
473
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 35371,
|
|
474
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
|
|
475
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 35374,
|
|
476
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
|
|
477
|
+
MAX_UNIFORM_BLOCK_SIZE: 35376,
|
|
478
|
+
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
|
|
479
|
+
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
|
|
480
|
+
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
|
|
481
|
+
ACTIVE_UNIFORM_BLOCKS: 35382,
|
|
482
|
+
UNIFORM_TYPE: 35383,
|
|
483
|
+
UNIFORM_SIZE: 35384,
|
|
484
|
+
UNIFORM_BLOCK_INDEX: 35386,
|
|
485
|
+
UNIFORM_OFFSET: 35387,
|
|
486
|
+
UNIFORM_ARRAY_STRIDE: 35388,
|
|
487
|
+
UNIFORM_MATRIX_STRIDE: 35389,
|
|
488
|
+
UNIFORM_IS_ROW_MAJOR: 35390,
|
|
489
|
+
UNIFORM_BLOCK_BINDING: 35391,
|
|
490
|
+
UNIFORM_BLOCK_DATA_SIZE: 35392,
|
|
491
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
|
|
492
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
|
|
493
|
+
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
|
|
494
|
+
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
|
|
495
|
+
INVALID_INDEX: 4294967295,
|
|
496
|
+
MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
|
|
497
|
+
MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
|
|
498
|
+
MAX_SERVER_WAIT_TIMEOUT: 37137,
|
|
499
|
+
OBJECT_TYPE: 37138,
|
|
500
|
+
SYNC_CONDITION: 37139,
|
|
501
|
+
SYNC_STATUS: 37140,
|
|
502
|
+
SYNC_FLAGS: 37141,
|
|
503
|
+
SYNC_FENCE: 37142,
|
|
504
|
+
SYNC_GPU_COMMANDS_COMPLETE: 37143,
|
|
505
|
+
UNSIGNALED: 37144,
|
|
506
|
+
SIGNALED: 37145,
|
|
507
|
+
ALREADY_SIGNALED: 37146,
|
|
508
|
+
TIMEOUT_EXPIRED: 37147,
|
|
509
|
+
CONDITION_SATISFIED: 37148,
|
|
510
|
+
WAIT_FAILED: 37149,
|
|
511
|
+
SYNC_FLUSH_COMMANDS_BIT: 1,
|
|
512
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
|
|
513
|
+
ANY_SAMPLES_PASSED: 35887,
|
|
514
|
+
ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
|
|
515
|
+
SAMPLER_BINDING: 35097,
|
|
516
|
+
TRANSFORM_FEEDBACK: 36386,
|
|
517
|
+
TRANSFORM_FEEDBACK_PAUSED: 36387,
|
|
518
|
+
TRANSFORM_FEEDBACK_ACTIVE: 36388,
|
|
519
|
+
TRANSFORM_FEEDBACK_BINDING: 36389,
|
|
520
|
+
TEXTURE_IMMUTABLE_FORMAT: 37167,
|
|
521
|
+
MAX_ELEMENT_INDEX: 36203,
|
|
522
|
+
TEXTURE_IMMUTABLE_LEVELS: 33503,
|
|
523
|
+
TIMEOUT_IGNORED: -1,
|
|
524
|
+
MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 37447
|
|
389
525
|
};
|
|
390
526
|
const extensions = {
|
|
391
527
|
// ratified
|
|
@@ -424,7 +560,7 @@ const extensions = {
|
|
|
424
560
|
EXT_sRGB: null,
|
|
425
561
|
WEBGL_compressed_texture_etc1: null
|
|
426
562
|
};
|
|
427
|
-
class
|
|
563
|
+
class WebGL2RenderingContext {
|
|
428
564
|
constructor(canvas) {
|
|
429
565
|
this.getShaderPrecisionFormat = () => {
|
|
430
566
|
return {
|
|
@@ -436,32 +572,55 @@ class WebGLRenderingContext {
|
|
|
436
572
|
this.GL_VERSION = 7938;
|
|
437
573
|
this.SCISSOR_BOX = 3088;
|
|
438
574
|
this.VIEWPORT = 2978;
|
|
439
|
-
this.getParameter = paramId => {
|
|
440
|
-
switch (paramId) {
|
|
441
|
-
case this.GL_VERSION:
|
|
442
|
-
return ['WebGL1'];
|
|
443
|
-
case this.SCISSOR_BOX:
|
|
444
|
-
case this.VIEWPORT:
|
|
445
|
-
return [0, 0, 1, 1];
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
this.getExtension = ext => {
|
|
449
|
-
return extensions[ext];
|
|
450
|
-
};
|
|
451
575
|
this.getProgramInfoLog = () => '';
|
|
452
576
|
this.getShaderInfoLog = () => '';
|
|
453
577
|
this.canvas = canvas;
|
|
454
578
|
this.drawingBufferWidth = canvas.width;
|
|
455
579
|
this.drawingBufferHeight = canvas.height;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
});
|
|
580
|
+
for (const method of functions) {
|
|
581
|
+
var _this$method;
|
|
582
|
+
(_this$method = this[method]) != null ? _this$method : this[method] = () => {};
|
|
583
|
+
}
|
|
461
584
|
Object.assign(this, enums);
|
|
462
585
|
}
|
|
586
|
+
getParameter(paramId) {
|
|
587
|
+
switch (paramId) {
|
|
588
|
+
case this.GL_VERSION:
|
|
589
|
+
return ['WebGL2'];
|
|
590
|
+
case this.SCISSOR_BOX:
|
|
591
|
+
case this.VIEWPORT:
|
|
592
|
+
return [0, 0, 1, 1];
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
getExtension(ext) {
|
|
596
|
+
return extensions[ext];
|
|
597
|
+
}
|
|
463
598
|
}
|
|
464
|
-
|
|
599
|
+
|
|
600
|
+
const createCanvas = ({
|
|
601
|
+
beforeReturn,
|
|
602
|
+
width = 1280,
|
|
603
|
+
height = 800
|
|
604
|
+
} = {}) => {
|
|
605
|
+
var _globalThis$WebGLRend, _globalThis$WebGL2Ren;
|
|
606
|
+
const canvas = typeof document !== 'undefined' && typeof document.createElement === 'function' ? document.createElement('canvas') : {
|
|
607
|
+
style: {},
|
|
608
|
+
addEventListener: () => {},
|
|
609
|
+
removeEventListener: () => {},
|
|
610
|
+
clientWidth: width,
|
|
611
|
+
clientHeight: height,
|
|
612
|
+
getContext: () => new WebGL2RenderingContext(canvas)
|
|
613
|
+
};
|
|
614
|
+
canvas.width = width;
|
|
615
|
+
canvas.height = height;
|
|
616
|
+
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
617
|
+
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
618
|
+
// @ts-ignore
|
|
619
|
+
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
620
|
+
// @ts-ignore
|
|
621
|
+
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
622
|
+
return canvas;
|
|
623
|
+
};
|
|
465
624
|
|
|
466
625
|
const createEventFirer = (act, store) => {
|
|
467
626
|
const findEventHandler = (element, eventName) => {
|
|
@@ -601,19 +760,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
601
760
|
fiber.extend(THREE__namespace);
|
|
602
761
|
const act = fiber.act;
|
|
603
762
|
const create = async (element, options) => {
|
|
604
|
-
const canvas = createCanvas(
|
|
605
|
-
width: options == null ? void 0 : options.width,
|
|
606
|
-
height: options == null ? void 0 : options.height,
|
|
607
|
-
beforeReturn: canvas => {
|
|
608
|
-
function getContext(contextId) {
|
|
609
|
-
if (contextId === 'webgl' || contextId === 'webgl2') {
|
|
610
|
-
return createWebGLContext(canvas);
|
|
611
|
-
}
|
|
612
|
-
return null;
|
|
613
|
-
}
|
|
614
|
-
canvas.getContext = getContext;
|
|
615
|
-
}
|
|
616
|
-
});
|
|
763
|
+
const canvas = createCanvas(options);
|
|
617
764
|
const _root = fiber.createRoot(canvas).configure({
|
|
618
765
|
frameloop: 'never',
|
|
619
766
|
...options,
|
|
@@ -677,4 +824,6 @@ var index = {
|
|
|
677
824
|
};
|
|
678
825
|
|
|
679
826
|
exports.ReactThreeTest = index$1;
|
|
827
|
+
exports.act = act;
|
|
828
|
+
exports.create = create;
|
|
680
829
|
exports["default"] = index;
|
|
@@ -71,23 +71,7 @@ const is = {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const
|
|
75
|
-
beforeReturn,
|
|
76
|
-
width = 1280,
|
|
77
|
-
height = 800
|
|
78
|
-
} = {}) => {
|
|
79
|
-
const canvas = document.createElement('canvas');
|
|
80
|
-
canvas.height = height;
|
|
81
|
-
canvas.width = width;
|
|
82
|
-
canvas.addEventListener = () => {};
|
|
83
|
-
canvas.removeEventListener = () => {};
|
|
84
|
-
if (beforeReturn) {
|
|
85
|
-
beforeReturn(canvas);
|
|
86
|
-
}
|
|
87
|
-
return canvas;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const functions = ['attachShader', 'bindAttribLocation', 'bindBuffer', 'bindFramebuffer', 'bindRenderbuffer', 'bindTexture', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clear', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'compileShader', 'compressedTexImage2D', 'compressedTexSubImage2D', 'copyTexImage2D', 'copyTexSubImage2D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createRenderbuffer', 'createShader', 'createTexture', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteRenderbuffer', 'deleteShader', 'deleteTexture', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'disableVertexAttribArray', 'drawArrays', 'drawElements', 'enable', 'enableVertexAttribArray', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getContextAttributes', 'getError', 'getFramebufferAttachmentParameter', 'getProgramParameter', 'getRenderbufferParameter', 'getShaderParameter', 'getShaderSource', 'getSupportedExtensions', 'getTexParameter', 'getUniform', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isRenderbuffer', 'isShader', 'isTexture', 'lineWidth', 'linkProgram', 'pixelStorei', 'polygonOffset', 'readPixels', 'renderbufferStorage', 'sampleCoverage', 'scissor', 'setPixelRatio', 'setSize', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texParameterf', 'texParameteri', 'texImage2D', 'texSubImage2D', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniformMatrix2fv', 'uniformMatrix3fv', 'uniformMatrix4fv', 'useProgram', 'validateProgram', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribPointer', 'viewport'];
|
|
74
|
+
const functions = ['activeTexture', 'attachShader', 'beginQuery', 'beginTransformFeedback', 'bindAttribLocation', 'bindBufferBase', 'bindBufferRange', 'bindRenderbuffer', 'bindSampler', 'bindTransformFeedback', 'bindVertexArray', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'blitFramebuffer', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clientWaitSync', 'compileShader', 'compressedTexImage2D', 'compressedTexImage3D', 'compressedTexSubImage2D', 'compressedTexSubImage3D', 'copyBufferSubData', 'copyTexImage2D', 'copyTexSubImage2D', 'copyTexSubImage3D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createQuery', 'createRenderbuffer', 'createSampler', 'createShader', 'createTexture', 'createTransformFeedback', 'createVertexArray', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteQuery', 'deleteRenderbuffer', 'deleteSampler', 'deleteShader', 'deleteSync', 'deleteTexture', 'deleteTransformFeedback', 'deleteVertexArray', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'drawArraysInstanced', 'drawElementsInstanced', 'drawRangeElements', 'enable', 'endQuery', 'endTransformFeedback', 'fenceSync', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'framebufferTextureLayer', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getActiveUniformBlockName', 'getActiveUniformBlockParameter', 'getActiveUniforms', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getBufferSubData', 'getContextAttributes', 'getError', 'getExtension', 'getFragDataLocation', 'getFramebufferAttachmentParameter', 'getIndexedParameter', 'getInternalformatParameter', 'getParameter', 'getProgramInfoLog', 'getProgramParameter', 'getQuery', 'getQueryParameter', 'getRenderbufferParameter', 'getSamplerParameter', 'getShaderInfoLog', 'getShaderParameter', 'getShaderPrecisionFormat', 'getShaderSource', 'getSupportedExtensions', 'getSyncParameter', 'getTexParameter', 'getTransformFeedbackVarying', 'getUniform', 'getUniformBlockIndex', 'getUniformIndices', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'invalidateFramebuffer', 'invalidateSubFramebuffer', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isQuery', 'isRenderbuffer', 'isSampler', 'isShader', 'isSync', 'isTexture', 'isTransformFeedback', 'isVertexArray', 'lineWidth', 'linkProgram', 'pauseTransformFeedback', 'pixelStorei', 'polygonOffset', 'readBuffer', 'readPixels', 'renderbufferStorage', 'renderbufferStorageMultisample', 'resumeTransformFeedback', 'sampleCoverage', 'samplerParameterf', 'samplerParameteri', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texImage2D', 'texImage3D', 'texParameterf', 'texParameteri', 'texStorage2D', 'texStorage3D', 'texSubImage2D', 'texSubImage3D', 'transformFeedbackVaryings', 'uniform1ui', 'uniform2ui', 'uniform3ui', 'uniform4ui', 'uniformBlockBinding', 'useProgram', 'validateProgram', 'vertexAttribDivisor', 'vertexAttribI4i', 'vertexAttribI4ui', 'vertexAttribIPointer', 'waitSync', 'bindBuffer', 'bindFramebuffer', 'bindTexture', 'clear', 'clearBufferfi', 'clearBufferfv', 'clearBufferiv', 'clearBufferuiv', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'disableVertexAttribArray', 'drawArrays', 'drawBuffers', 'drawElements', 'enableVertexAttribArray', 'scissor', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform1uiv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform2uiv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform3uiv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniform4uiv', 'uniformMatrix2fv', 'uniformMatrix2x3fv', 'uniformMatrix2x4fv', 'uniformMatrix3fv', 'uniformMatrix3x2fv', 'uniformMatrix3x4fv', 'uniformMatrix4fv', 'uniformMatrix4x2fv', 'uniformMatrix4x3fv', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribI4iv', 'vertexAttribI4uiv', 'vertexAttribPointer', 'viewport', 'makeXRCompatible'];
|
|
91
75
|
const enums = {
|
|
92
76
|
DEPTH_BUFFER_BIT: 256,
|
|
93
77
|
STENCIL_BUFFER_BIT: 1024,
|
|
@@ -385,7 +369,159 @@ const enums = {
|
|
|
385
369
|
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
|
|
386
370
|
CONTEXT_LOST_WEBGL: 37442,
|
|
387
371
|
UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
|
|
388
|
-
BROWSER_DEFAULT_WEBGL: 37444
|
|
372
|
+
BROWSER_DEFAULT_WEBGL: 37444,
|
|
373
|
+
READ_BUFFER: 3074,
|
|
374
|
+
UNPACK_ROW_LENGTH: 3314,
|
|
375
|
+
UNPACK_SKIP_ROWS: 3315,
|
|
376
|
+
UNPACK_SKIP_PIXELS: 3316,
|
|
377
|
+
PACK_ROW_LENGTH: 3330,
|
|
378
|
+
PACK_SKIP_ROWS: 3331,
|
|
379
|
+
PACK_SKIP_PIXELS: 3332,
|
|
380
|
+
COLOR: 6144,
|
|
381
|
+
DEPTH: 6145,
|
|
382
|
+
STENCIL: 6146,
|
|
383
|
+
RED: 6403,
|
|
384
|
+
UNPACK_SKIP_IMAGES: 32877,
|
|
385
|
+
UNPACK_IMAGE_HEIGHT: 32878,
|
|
386
|
+
TEXTURE_WRAP_R: 32882,
|
|
387
|
+
MAX_ELEMENTS_VERTICES: 33000,
|
|
388
|
+
MAX_ELEMENTS_INDICES: 33001,
|
|
389
|
+
TEXTURE_MIN_LOD: 33082,
|
|
390
|
+
TEXTURE_MAX_LOD: 33083,
|
|
391
|
+
TEXTURE_BASE_LEVEL: 33084,
|
|
392
|
+
TEXTURE_MAX_LEVEL: 33085,
|
|
393
|
+
MIN: 32775,
|
|
394
|
+
MAX: 32776,
|
|
395
|
+
MAX_TEXTURE_LOD_BIAS: 34045,
|
|
396
|
+
TEXTURE_COMPARE_MODE: 34892,
|
|
397
|
+
TEXTURE_COMPARE_FUNC: 34893,
|
|
398
|
+
CURRENT_QUERY: 34917,
|
|
399
|
+
QUERY_RESULT: 34918,
|
|
400
|
+
QUERY_RESULT_AVAILABLE: 34919,
|
|
401
|
+
STREAM_READ: 35041,
|
|
402
|
+
STREAM_COPY: 35042,
|
|
403
|
+
STATIC_READ: 35045,
|
|
404
|
+
STATIC_COPY: 35046,
|
|
405
|
+
DYNAMIC_READ: 35049,
|
|
406
|
+
DYNAMIC_COPY: 35050,
|
|
407
|
+
MAX_DRAW_BUFFERS: 34852,
|
|
408
|
+
MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
|
|
409
|
+
MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
|
|
410
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
|
|
411
|
+
PIXEL_PACK_BUFFER: 35051,
|
|
412
|
+
PIXEL_UNPACK_BUFFER: 35052,
|
|
413
|
+
PIXEL_PACK_BUFFER_BINDING: 35053,
|
|
414
|
+
PIXEL_UNPACK_BUFFER_BINDING: 35055,
|
|
415
|
+
SRGB: 35904,
|
|
416
|
+
COMPARE_REF_TO_TEXTURE: 34894,
|
|
417
|
+
VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
|
|
418
|
+
MAX_ARRAY_TEXTURE_LAYERS: 35071,
|
|
419
|
+
MIN_PROGRAM_TEXEL_OFFSET: 35076,
|
|
420
|
+
MAX_PROGRAM_TEXEL_OFFSET: 35077,
|
|
421
|
+
MAX_VARYING_COMPONENTS: 35659,
|
|
422
|
+
TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
|
|
423
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
|
|
424
|
+
TRANSFORM_FEEDBACK_VARYINGS: 35971,
|
|
425
|
+
TRANSFORM_FEEDBACK_BUFFER_START: 35972,
|
|
426
|
+
TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
|
|
427
|
+
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
|
|
428
|
+
RASTERIZER_DISCARD: 35977,
|
|
429
|
+
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
|
|
430
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
|
|
431
|
+
INTERLEAVED_ATTRIBS: 35980,
|
|
432
|
+
SEPARATE_ATTRIBS: 35981,
|
|
433
|
+
TRANSFORM_FEEDBACK_BUFFER: 35982,
|
|
434
|
+
TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
|
|
435
|
+
RED_INTEGER: 36244,
|
|
436
|
+
RGB_INTEGER: 36248,
|
|
437
|
+
RGBA_INTEGER: 36249,
|
|
438
|
+
SAMPLER_CUBE_SHADOW: 36293,
|
|
439
|
+
INT_SAMPLER_CUBE: 36300,
|
|
440
|
+
UNSIGNED_INT_SAMPLER_CUBE: 36308,
|
|
441
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
|
|
442
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
|
|
443
|
+
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
|
|
444
|
+
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
|
|
445
|
+
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
|
|
446
|
+
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
|
|
447
|
+
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
|
|
448
|
+
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
|
|
449
|
+
FRAMEBUFFER_DEFAULT: 33304,
|
|
450
|
+
UNSIGNED_NORMALIZED: 35863,
|
|
451
|
+
DRAW_FRAMEBUFFER_BINDING: 36006,
|
|
452
|
+
READ_FRAMEBUFFER: 36008,
|
|
453
|
+
DRAW_FRAMEBUFFER: 36009,
|
|
454
|
+
READ_FRAMEBUFFER_BINDING: 36010,
|
|
455
|
+
RENDERBUFFER_SAMPLES: 36011,
|
|
456
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
|
|
457
|
+
MAX_COLOR_ATTACHMENTS: 36063,
|
|
458
|
+
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
|
|
459
|
+
MAX_SAMPLES: 36183,
|
|
460
|
+
HALF_FLOAT: 5131,
|
|
461
|
+
RG: 33319,
|
|
462
|
+
RG_INTEGER: 33320,
|
|
463
|
+
VERTEX_ARRAY_BINDING: 34229,
|
|
464
|
+
SIGNED_NORMALIZED: 36764,
|
|
465
|
+
COPY_READ_BUFFER: 36662,
|
|
466
|
+
COPY_WRITE_BUFFER: 36663,
|
|
467
|
+
COPY_READ_BUFFER_BINDING: 36662,
|
|
468
|
+
COPY_WRITE_BUFFER_BINDING: 36663,
|
|
469
|
+
UNIFORM_BUFFER: 35345,
|
|
470
|
+
UNIFORM_BUFFER_BINDING: 35368,
|
|
471
|
+
UNIFORM_BUFFER_START: 35369,
|
|
472
|
+
UNIFORM_BUFFER_SIZE: 35370,
|
|
473
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 35371,
|
|
474
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
|
|
475
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 35374,
|
|
476
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
|
|
477
|
+
MAX_UNIFORM_BLOCK_SIZE: 35376,
|
|
478
|
+
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
|
|
479
|
+
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
|
|
480
|
+
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
|
|
481
|
+
ACTIVE_UNIFORM_BLOCKS: 35382,
|
|
482
|
+
UNIFORM_TYPE: 35383,
|
|
483
|
+
UNIFORM_SIZE: 35384,
|
|
484
|
+
UNIFORM_BLOCK_INDEX: 35386,
|
|
485
|
+
UNIFORM_OFFSET: 35387,
|
|
486
|
+
UNIFORM_ARRAY_STRIDE: 35388,
|
|
487
|
+
UNIFORM_MATRIX_STRIDE: 35389,
|
|
488
|
+
UNIFORM_IS_ROW_MAJOR: 35390,
|
|
489
|
+
UNIFORM_BLOCK_BINDING: 35391,
|
|
490
|
+
UNIFORM_BLOCK_DATA_SIZE: 35392,
|
|
491
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
|
|
492
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
|
|
493
|
+
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
|
|
494
|
+
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
|
|
495
|
+
INVALID_INDEX: 4294967295,
|
|
496
|
+
MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
|
|
497
|
+
MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
|
|
498
|
+
MAX_SERVER_WAIT_TIMEOUT: 37137,
|
|
499
|
+
OBJECT_TYPE: 37138,
|
|
500
|
+
SYNC_CONDITION: 37139,
|
|
501
|
+
SYNC_STATUS: 37140,
|
|
502
|
+
SYNC_FLAGS: 37141,
|
|
503
|
+
SYNC_FENCE: 37142,
|
|
504
|
+
SYNC_GPU_COMMANDS_COMPLETE: 37143,
|
|
505
|
+
UNSIGNALED: 37144,
|
|
506
|
+
SIGNALED: 37145,
|
|
507
|
+
ALREADY_SIGNALED: 37146,
|
|
508
|
+
TIMEOUT_EXPIRED: 37147,
|
|
509
|
+
CONDITION_SATISFIED: 37148,
|
|
510
|
+
WAIT_FAILED: 37149,
|
|
511
|
+
SYNC_FLUSH_COMMANDS_BIT: 1,
|
|
512
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
|
|
513
|
+
ANY_SAMPLES_PASSED: 35887,
|
|
514
|
+
ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
|
|
515
|
+
SAMPLER_BINDING: 35097,
|
|
516
|
+
TRANSFORM_FEEDBACK: 36386,
|
|
517
|
+
TRANSFORM_FEEDBACK_PAUSED: 36387,
|
|
518
|
+
TRANSFORM_FEEDBACK_ACTIVE: 36388,
|
|
519
|
+
TRANSFORM_FEEDBACK_BINDING: 36389,
|
|
520
|
+
TEXTURE_IMMUTABLE_FORMAT: 37167,
|
|
521
|
+
MAX_ELEMENT_INDEX: 36203,
|
|
522
|
+
TEXTURE_IMMUTABLE_LEVELS: 33503,
|
|
523
|
+
TIMEOUT_IGNORED: -1,
|
|
524
|
+
MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 37447
|
|
389
525
|
};
|
|
390
526
|
const extensions = {
|
|
391
527
|
// ratified
|
|
@@ -424,7 +560,7 @@ const extensions = {
|
|
|
424
560
|
EXT_sRGB: null,
|
|
425
561
|
WEBGL_compressed_texture_etc1: null
|
|
426
562
|
};
|
|
427
|
-
class
|
|
563
|
+
class WebGL2RenderingContext {
|
|
428
564
|
constructor(canvas) {
|
|
429
565
|
this.getShaderPrecisionFormat = () => {
|
|
430
566
|
return {
|
|
@@ -436,32 +572,55 @@ class WebGLRenderingContext {
|
|
|
436
572
|
this.GL_VERSION = 7938;
|
|
437
573
|
this.SCISSOR_BOX = 3088;
|
|
438
574
|
this.VIEWPORT = 2978;
|
|
439
|
-
this.getParameter = paramId => {
|
|
440
|
-
switch (paramId) {
|
|
441
|
-
case this.GL_VERSION:
|
|
442
|
-
return ['WebGL1'];
|
|
443
|
-
case this.SCISSOR_BOX:
|
|
444
|
-
case this.VIEWPORT:
|
|
445
|
-
return [0, 0, 1, 1];
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
this.getExtension = ext => {
|
|
449
|
-
return extensions[ext];
|
|
450
|
-
};
|
|
451
575
|
this.getProgramInfoLog = () => '';
|
|
452
576
|
this.getShaderInfoLog = () => '';
|
|
453
577
|
this.canvas = canvas;
|
|
454
578
|
this.drawingBufferWidth = canvas.width;
|
|
455
579
|
this.drawingBufferHeight = canvas.height;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
});
|
|
580
|
+
for (const method of functions) {
|
|
581
|
+
var _this$method;
|
|
582
|
+
(_this$method = this[method]) != null ? _this$method : this[method] = () => {};
|
|
583
|
+
}
|
|
461
584
|
Object.assign(this, enums);
|
|
462
585
|
}
|
|
586
|
+
getParameter(paramId) {
|
|
587
|
+
switch (paramId) {
|
|
588
|
+
case this.GL_VERSION:
|
|
589
|
+
return ['WebGL2'];
|
|
590
|
+
case this.SCISSOR_BOX:
|
|
591
|
+
case this.VIEWPORT:
|
|
592
|
+
return [0, 0, 1, 1];
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
getExtension(ext) {
|
|
596
|
+
return extensions[ext];
|
|
597
|
+
}
|
|
463
598
|
}
|
|
464
|
-
|
|
599
|
+
|
|
600
|
+
const createCanvas = ({
|
|
601
|
+
beforeReturn,
|
|
602
|
+
width = 1280,
|
|
603
|
+
height = 800
|
|
604
|
+
} = {}) => {
|
|
605
|
+
var _globalThis$WebGLRend, _globalThis$WebGL2Ren;
|
|
606
|
+
const canvas = typeof document !== 'undefined' && typeof document.createElement === 'function' ? document.createElement('canvas') : {
|
|
607
|
+
style: {},
|
|
608
|
+
addEventListener: () => {},
|
|
609
|
+
removeEventListener: () => {},
|
|
610
|
+
clientWidth: width,
|
|
611
|
+
clientHeight: height,
|
|
612
|
+
getContext: () => new WebGL2RenderingContext(canvas)
|
|
613
|
+
};
|
|
614
|
+
canvas.width = width;
|
|
615
|
+
canvas.height = height;
|
|
616
|
+
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
617
|
+
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
618
|
+
// @ts-ignore
|
|
619
|
+
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
620
|
+
// @ts-ignore
|
|
621
|
+
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
622
|
+
return canvas;
|
|
623
|
+
};
|
|
465
624
|
|
|
466
625
|
const createEventFirer = (act, store) => {
|
|
467
626
|
const findEventHandler = (element, eventName) => {
|
|
@@ -601,19 +760,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
601
760
|
fiber.extend(THREE__namespace);
|
|
602
761
|
const act = fiber.act;
|
|
603
762
|
const create = async (element, options) => {
|
|
604
|
-
const canvas = createCanvas(
|
|
605
|
-
width: options == null ? void 0 : options.width,
|
|
606
|
-
height: options == null ? void 0 : options.height,
|
|
607
|
-
beforeReturn: canvas => {
|
|
608
|
-
function getContext(contextId) {
|
|
609
|
-
if (contextId === 'webgl' || contextId === 'webgl2') {
|
|
610
|
-
return createWebGLContext(canvas);
|
|
611
|
-
}
|
|
612
|
-
return null;
|
|
613
|
-
}
|
|
614
|
-
canvas.getContext = getContext;
|
|
615
|
-
}
|
|
616
|
-
});
|
|
763
|
+
const canvas = createCanvas(options);
|
|
617
764
|
const _root = fiber.createRoot(canvas).configure({
|
|
618
765
|
frameloop: 'never',
|
|
619
766
|
...options,
|
|
@@ -677,4 +824,6 @@ var index = {
|
|
|
677
824
|
};
|
|
678
825
|
|
|
679
826
|
exports.ReactThreeTest = index$1;
|
|
827
|
+
exports.act = act;
|
|
828
|
+
exports.create = create;
|
|
680
829
|
exports["default"] = index;
|
|
@@ -47,23 +47,7 @@ const is = {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const
|
|
51
|
-
beforeReturn,
|
|
52
|
-
width = 1280,
|
|
53
|
-
height = 800
|
|
54
|
-
} = {}) => {
|
|
55
|
-
const canvas = document.createElement('canvas');
|
|
56
|
-
canvas.height = height;
|
|
57
|
-
canvas.width = width;
|
|
58
|
-
canvas.addEventListener = () => {};
|
|
59
|
-
canvas.removeEventListener = () => {};
|
|
60
|
-
if (beforeReturn) {
|
|
61
|
-
beforeReturn(canvas);
|
|
62
|
-
}
|
|
63
|
-
return canvas;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const functions = ['attachShader', 'bindAttribLocation', 'bindBuffer', 'bindFramebuffer', 'bindRenderbuffer', 'bindTexture', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clear', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'compileShader', 'compressedTexImage2D', 'compressedTexSubImage2D', 'copyTexImage2D', 'copyTexSubImage2D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createRenderbuffer', 'createShader', 'createTexture', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteRenderbuffer', 'deleteShader', 'deleteTexture', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'disableVertexAttribArray', 'drawArrays', 'drawElements', 'enable', 'enableVertexAttribArray', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getContextAttributes', 'getError', 'getFramebufferAttachmentParameter', 'getProgramParameter', 'getRenderbufferParameter', 'getShaderParameter', 'getShaderSource', 'getSupportedExtensions', 'getTexParameter', 'getUniform', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isRenderbuffer', 'isShader', 'isTexture', 'lineWidth', 'linkProgram', 'pixelStorei', 'polygonOffset', 'readPixels', 'renderbufferStorage', 'sampleCoverage', 'scissor', 'setPixelRatio', 'setSize', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texParameterf', 'texParameteri', 'texImage2D', 'texSubImage2D', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniformMatrix2fv', 'uniformMatrix3fv', 'uniformMatrix4fv', 'useProgram', 'validateProgram', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribPointer', 'viewport'];
|
|
50
|
+
const functions = ['activeTexture', 'attachShader', 'beginQuery', 'beginTransformFeedback', 'bindAttribLocation', 'bindBufferBase', 'bindBufferRange', 'bindRenderbuffer', 'bindSampler', 'bindTransformFeedback', 'bindVertexArray', 'blendColor', 'blendEquation', 'blendEquationSeparate', 'blendFunc', 'blendFuncSeparate', 'blitFramebuffer', 'bufferData', 'bufferSubData', 'checkFramebufferStatus', 'clientWaitSync', 'compileShader', 'compressedTexImage2D', 'compressedTexImage3D', 'compressedTexSubImage2D', 'compressedTexSubImage3D', 'copyBufferSubData', 'copyTexImage2D', 'copyTexSubImage2D', 'copyTexSubImage3D', 'createBuffer', 'createFramebuffer', 'createProgram', 'createQuery', 'createRenderbuffer', 'createSampler', 'createShader', 'createTexture', 'createTransformFeedback', 'createVertexArray', 'cullFace', 'deleteBuffer', 'deleteFramebuffer', 'deleteProgram', 'deleteQuery', 'deleteRenderbuffer', 'deleteSampler', 'deleteShader', 'deleteSync', 'deleteTexture', 'deleteTransformFeedback', 'deleteVertexArray', 'depthFunc', 'depthMask', 'depthRange', 'detachShader', 'disable', 'drawArraysInstanced', 'drawElementsInstanced', 'drawRangeElements', 'enable', 'endQuery', 'endTransformFeedback', 'fenceSync', 'finish', 'flush', 'framebufferRenderbuffer', 'framebufferTexture2D', 'framebufferTextureLayer', 'frontFace', 'generateMipmap', 'getActiveAttrib', 'getActiveUniform', 'getActiveUniformBlockName', 'getActiveUniformBlockParameter', 'getActiveUniforms', 'getAttachedShaders', 'getAttribLocation', 'getBufferParameter', 'getBufferSubData', 'getContextAttributes', 'getError', 'getExtension', 'getFragDataLocation', 'getFramebufferAttachmentParameter', 'getIndexedParameter', 'getInternalformatParameter', 'getParameter', 'getProgramInfoLog', 'getProgramParameter', 'getQuery', 'getQueryParameter', 'getRenderbufferParameter', 'getSamplerParameter', 'getShaderInfoLog', 'getShaderParameter', 'getShaderPrecisionFormat', 'getShaderSource', 'getSupportedExtensions', 'getSyncParameter', 'getTexParameter', 'getTransformFeedbackVarying', 'getUniform', 'getUniformBlockIndex', 'getUniformIndices', 'getUniformLocation', 'getVertexAttrib', 'getVertexAttribOffset', 'hint', 'invalidateFramebuffer', 'invalidateSubFramebuffer', 'isBuffer', 'isContextLost', 'isEnabled', 'isFramebuffer', 'isProgram', 'isQuery', 'isRenderbuffer', 'isSampler', 'isShader', 'isSync', 'isTexture', 'isTransformFeedback', 'isVertexArray', 'lineWidth', 'linkProgram', 'pauseTransformFeedback', 'pixelStorei', 'polygonOffset', 'readBuffer', 'readPixels', 'renderbufferStorage', 'renderbufferStorageMultisample', 'resumeTransformFeedback', 'sampleCoverage', 'samplerParameterf', 'samplerParameteri', 'shaderSource', 'stencilFunc', 'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate', 'stencilOp', 'stencilOpSeparate', 'texImage2D', 'texImage3D', 'texParameterf', 'texParameteri', 'texStorage2D', 'texStorage3D', 'texSubImage2D', 'texSubImage3D', 'transformFeedbackVaryings', 'uniform1ui', 'uniform2ui', 'uniform3ui', 'uniform4ui', 'uniformBlockBinding', 'useProgram', 'validateProgram', 'vertexAttribDivisor', 'vertexAttribI4i', 'vertexAttribI4ui', 'vertexAttribIPointer', 'waitSync', 'bindBuffer', 'bindFramebuffer', 'bindTexture', 'clear', 'clearBufferfi', 'clearBufferfv', 'clearBufferiv', 'clearBufferuiv', 'clearColor', 'clearDepth', 'clearStencil', 'colorMask', 'disableVertexAttribArray', 'drawArrays', 'drawBuffers', 'drawElements', 'enableVertexAttribArray', 'scissor', 'uniform1f', 'uniform1fv', 'uniform1i', 'uniform1iv', 'uniform1uiv', 'uniform2f', 'uniform2fv', 'uniform2i', 'uniform2iv', 'uniform2uiv', 'uniform3f', 'uniform3fv', 'uniform3i', 'uniform3iv', 'uniform3uiv', 'uniform4f', 'uniform4fv', 'uniform4i', 'uniform4iv', 'uniform4uiv', 'uniformMatrix2fv', 'uniformMatrix2x3fv', 'uniformMatrix2x4fv', 'uniformMatrix3fv', 'uniformMatrix3x2fv', 'uniformMatrix3x4fv', 'uniformMatrix4fv', 'uniformMatrix4x2fv', 'uniformMatrix4x3fv', 'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f', 'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv', 'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribI4iv', 'vertexAttribI4uiv', 'vertexAttribPointer', 'viewport', 'makeXRCompatible'];
|
|
67
51
|
const enums = {
|
|
68
52
|
DEPTH_BUFFER_BIT: 256,
|
|
69
53
|
STENCIL_BUFFER_BIT: 1024,
|
|
@@ -361,7 +345,159 @@ const enums = {
|
|
|
361
345
|
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
|
|
362
346
|
CONTEXT_LOST_WEBGL: 37442,
|
|
363
347
|
UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
|
|
364
|
-
BROWSER_DEFAULT_WEBGL: 37444
|
|
348
|
+
BROWSER_DEFAULT_WEBGL: 37444,
|
|
349
|
+
READ_BUFFER: 3074,
|
|
350
|
+
UNPACK_ROW_LENGTH: 3314,
|
|
351
|
+
UNPACK_SKIP_ROWS: 3315,
|
|
352
|
+
UNPACK_SKIP_PIXELS: 3316,
|
|
353
|
+
PACK_ROW_LENGTH: 3330,
|
|
354
|
+
PACK_SKIP_ROWS: 3331,
|
|
355
|
+
PACK_SKIP_PIXELS: 3332,
|
|
356
|
+
COLOR: 6144,
|
|
357
|
+
DEPTH: 6145,
|
|
358
|
+
STENCIL: 6146,
|
|
359
|
+
RED: 6403,
|
|
360
|
+
UNPACK_SKIP_IMAGES: 32877,
|
|
361
|
+
UNPACK_IMAGE_HEIGHT: 32878,
|
|
362
|
+
TEXTURE_WRAP_R: 32882,
|
|
363
|
+
MAX_ELEMENTS_VERTICES: 33000,
|
|
364
|
+
MAX_ELEMENTS_INDICES: 33001,
|
|
365
|
+
TEXTURE_MIN_LOD: 33082,
|
|
366
|
+
TEXTURE_MAX_LOD: 33083,
|
|
367
|
+
TEXTURE_BASE_LEVEL: 33084,
|
|
368
|
+
TEXTURE_MAX_LEVEL: 33085,
|
|
369
|
+
MIN: 32775,
|
|
370
|
+
MAX: 32776,
|
|
371
|
+
MAX_TEXTURE_LOD_BIAS: 34045,
|
|
372
|
+
TEXTURE_COMPARE_MODE: 34892,
|
|
373
|
+
TEXTURE_COMPARE_FUNC: 34893,
|
|
374
|
+
CURRENT_QUERY: 34917,
|
|
375
|
+
QUERY_RESULT: 34918,
|
|
376
|
+
QUERY_RESULT_AVAILABLE: 34919,
|
|
377
|
+
STREAM_READ: 35041,
|
|
378
|
+
STREAM_COPY: 35042,
|
|
379
|
+
STATIC_READ: 35045,
|
|
380
|
+
STATIC_COPY: 35046,
|
|
381
|
+
DYNAMIC_READ: 35049,
|
|
382
|
+
DYNAMIC_COPY: 35050,
|
|
383
|
+
MAX_DRAW_BUFFERS: 34852,
|
|
384
|
+
MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
|
|
385
|
+
MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
|
|
386
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
|
|
387
|
+
PIXEL_PACK_BUFFER: 35051,
|
|
388
|
+
PIXEL_UNPACK_BUFFER: 35052,
|
|
389
|
+
PIXEL_PACK_BUFFER_BINDING: 35053,
|
|
390
|
+
PIXEL_UNPACK_BUFFER_BINDING: 35055,
|
|
391
|
+
SRGB: 35904,
|
|
392
|
+
COMPARE_REF_TO_TEXTURE: 34894,
|
|
393
|
+
VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
|
|
394
|
+
MAX_ARRAY_TEXTURE_LAYERS: 35071,
|
|
395
|
+
MIN_PROGRAM_TEXEL_OFFSET: 35076,
|
|
396
|
+
MAX_PROGRAM_TEXEL_OFFSET: 35077,
|
|
397
|
+
MAX_VARYING_COMPONENTS: 35659,
|
|
398
|
+
TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
|
|
399
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
|
|
400
|
+
TRANSFORM_FEEDBACK_VARYINGS: 35971,
|
|
401
|
+
TRANSFORM_FEEDBACK_BUFFER_START: 35972,
|
|
402
|
+
TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
|
|
403
|
+
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
|
|
404
|
+
RASTERIZER_DISCARD: 35977,
|
|
405
|
+
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
|
|
406
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
|
|
407
|
+
INTERLEAVED_ATTRIBS: 35980,
|
|
408
|
+
SEPARATE_ATTRIBS: 35981,
|
|
409
|
+
TRANSFORM_FEEDBACK_BUFFER: 35982,
|
|
410
|
+
TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
|
|
411
|
+
RED_INTEGER: 36244,
|
|
412
|
+
RGB_INTEGER: 36248,
|
|
413
|
+
RGBA_INTEGER: 36249,
|
|
414
|
+
SAMPLER_CUBE_SHADOW: 36293,
|
|
415
|
+
INT_SAMPLER_CUBE: 36300,
|
|
416
|
+
UNSIGNED_INT_SAMPLER_CUBE: 36308,
|
|
417
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
|
|
418
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
|
|
419
|
+
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
|
|
420
|
+
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
|
|
421
|
+
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
|
|
422
|
+
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
|
|
423
|
+
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
|
|
424
|
+
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
|
|
425
|
+
FRAMEBUFFER_DEFAULT: 33304,
|
|
426
|
+
UNSIGNED_NORMALIZED: 35863,
|
|
427
|
+
DRAW_FRAMEBUFFER_BINDING: 36006,
|
|
428
|
+
READ_FRAMEBUFFER: 36008,
|
|
429
|
+
DRAW_FRAMEBUFFER: 36009,
|
|
430
|
+
READ_FRAMEBUFFER_BINDING: 36010,
|
|
431
|
+
RENDERBUFFER_SAMPLES: 36011,
|
|
432
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
|
|
433
|
+
MAX_COLOR_ATTACHMENTS: 36063,
|
|
434
|
+
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
|
|
435
|
+
MAX_SAMPLES: 36183,
|
|
436
|
+
HALF_FLOAT: 5131,
|
|
437
|
+
RG: 33319,
|
|
438
|
+
RG_INTEGER: 33320,
|
|
439
|
+
VERTEX_ARRAY_BINDING: 34229,
|
|
440
|
+
SIGNED_NORMALIZED: 36764,
|
|
441
|
+
COPY_READ_BUFFER: 36662,
|
|
442
|
+
COPY_WRITE_BUFFER: 36663,
|
|
443
|
+
COPY_READ_BUFFER_BINDING: 36662,
|
|
444
|
+
COPY_WRITE_BUFFER_BINDING: 36663,
|
|
445
|
+
UNIFORM_BUFFER: 35345,
|
|
446
|
+
UNIFORM_BUFFER_BINDING: 35368,
|
|
447
|
+
UNIFORM_BUFFER_START: 35369,
|
|
448
|
+
UNIFORM_BUFFER_SIZE: 35370,
|
|
449
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 35371,
|
|
450
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
|
|
451
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 35374,
|
|
452
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
|
|
453
|
+
MAX_UNIFORM_BLOCK_SIZE: 35376,
|
|
454
|
+
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
|
|
455
|
+
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
|
|
456
|
+
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
|
|
457
|
+
ACTIVE_UNIFORM_BLOCKS: 35382,
|
|
458
|
+
UNIFORM_TYPE: 35383,
|
|
459
|
+
UNIFORM_SIZE: 35384,
|
|
460
|
+
UNIFORM_BLOCK_INDEX: 35386,
|
|
461
|
+
UNIFORM_OFFSET: 35387,
|
|
462
|
+
UNIFORM_ARRAY_STRIDE: 35388,
|
|
463
|
+
UNIFORM_MATRIX_STRIDE: 35389,
|
|
464
|
+
UNIFORM_IS_ROW_MAJOR: 35390,
|
|
465
|
+
UNIFORM_BLOCK_BINDING: 35391,
|
|
466
|
+
UNIFORM_BLOCK_DATA_SIZE: 35392,
|
|
467
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
|
|
468
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
|
|
469
|
+
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
|
|
470
|
+
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
|
|
471
|
+
INVALID_INDEX: 4294967295,
|
|
472
|
+
MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
|
|
473
|
+
MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
|
|
474
|
+
MAX_SERVER_WAIT_TIMEOUT: 37137,
|
|
475
|
+
OBJECT_TYPE: 37138,
|
|
476
|
+
SYNC_CONDITION: 37139,
|
|
477
|
+
SYNC_STATUS: 37140,
|
|
478
|
+
SYNC_FLAGS: 37141,
|
|
479
|
+
SYNC_FENCE: 37142,
|
|
480
|
+
SYNC_GPU_COMMANDS_COMPLETE: 37143,
|
|
481
|
+
UNSIGNALED: 37144,
|
|
482
|
+
SIGNALED: 37145,
|
|
483
|
+
ALREADY_SIGNALED: 37146,
|
|
484
|
+
TIMEOUT_EXPIRED: 37147,
|
|
485
|
+
CONDITION_SATISFIED: 37148,
|
|
486
|
+
WAIT_FAILED: 37149,
|
|
487
|
+
SYNC_FLUSH_COMMANDS_BIT: 1,
|
|
488
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
|
|
489
|
+
ANY_SAMPLES_PASSED: 35887,
|
|
490
|
+
ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
|
|
491
|
+
SAMPLER_BINDING: 35097,
|
|
492
|
+
TRANSFORM_FEEDBACK: 36386,
|
|
493
|
+
TRANSFORM_FEEDBACK_PAUSED: 36387,
|
|
494
|
+
TRANSFORM_FEEDBACK_ACTIVE: 36388,
|
|
495
|
+
TRANSFORM_FEEDBACK_BINDING: 36389,
|
|
496
|
+
TEXTURE_IMMUTABLE_FORMAT: 37167,
|
|
497
|
+
MAX_ELEMENT_INDEX: 36203,
|
|
498
|
+
TEXTURE_IMMUTABLE_LEVELS: 33503,
|
|
499
|
+
TIMEOUT_IGNORED: -1,
|
|
500
|
+
MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 37447
|
|
365
501
|
};
|
|
366
502
|
const extensions = {
|
|
367
503
|
// ratified
|
|
@@ -400,7 +536,7 @@ const extensions = {
|
|
|
400
536
|
EXT_sRGB: null,
|
|
401
537
|
WEBGL_compressed_texture_etc1: null
|
|
402
538
|
};
|
|
403
|
-
class
|
|
539
|
+
class WebGL2RenderingContext {
|
|
404
540
|
constructor(canvas) {
|
|
405
541
|
this.getShaderPrecisionFormat = () => {
|
|
406
542
|
return {
|
|
@@ -412,32 +548,55 @@ class WebGLRenderingContext {
|
|
|
412
548
|
this.GL_VERSION = 7938;
|
|
413
549
|
this.SCISSOR_BOX = 3088;
|
|
414
550
|
this.VIEWPORT = 2978;
|
|
415
|
-
this.getParameter = paramId => {
|
|
416
|
-
switch (paramId) {
|
|
417
|
-
case this.GL_VERSION:
|
|
418
|
-
return ['WebGL1'];
|
|
419
|
-
case this.SCISSOR_BOX:
|
|
420
|
-
case this.VIEWPORT:
|
|
421
|
-
return [0, 0, 1, 1];
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
this.getExtension = ext => {
|
|
425
|
-
return extensions[ext];
|
|
426
|
-
};
|
|
427
551
|
this.getProgramInfoLog = () => '';
|
|
428
552
|
this.getShaderInfoLog = () => '';
|
|
429
553
|
this.canvas = canvas;
|
|
430
554
|
this.drawingBufferWidth = canvas.width;
|
|
431
555
|
this.drawingBufferHeight = canvas.height;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
});
|
|
556
|
+
for (const method of functions) {
|
|
557
|
+
var _this$method;
|
|
558
|
+
(_this$method = this[method]) != null ? _this$method : this[method] = () => {};
|
|
559
|
+
}
|
|
437
560
|
Object.assign(this, enums);
|
|
438
561
|
}
|
|
562
|
+
getParameter(paramId) {
|
|
563
|
+
switch (paramId) {
|
|
564
|
+
case this.GL_VERSION:
|
|
565
|
+
return ['WebGL2'];
|
|
566
|
+
case this.SCISSOR_BOX:
|
|
567
|
+
case this.VIEWPORT:
|
|
568
|
+
return [0, 0, 1, 1];
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
getExtension(ext) {
|
|
572
|
+
return extensions[ext];
|
|
573
|
+
}
|
|
439
574
|
}
|
|
440
|
-
|
|
575
|
+
|
|
576
|
+
const createCanvas = ({
|
|
577
|
+
beforeReturn,
|
|
578
|
+
width = 1280,
|
|
579
|
+
height = 800
|
|
580
|
+
} = {}) => {
|
|
581
|
+
var _globalThis$WebGLRend, _globalThis$WebGL2Ren;
|
|
582
|
+
const canvas = typeof document !== 'undefined' && typeof document.createElement === 'function' ? document.createElement('canvas') : {
|
|
583
|
+
style: {},
|
|
584
|
+
addEventListener: () => {},
|
|
585
|
+
removeEventListener: () => {},
|
|
586
|
+
clientWidth: width,
|
|
587
|
+
clientHeight: height,
|
|
588
|
+
getContext: () => new WebGL2RenderingContext(canvas)
|
|
589
|
+
};
|
|
590
|
+
canvas.width = width;
|
|
591
|
+
canvas.height = height;
|
|
592
|
+
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
593
|
+
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
594
|
+
// @ts-ignore
|
|
595
|
+
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
596
|
+
// @ts-ignore
|
|
597
|
+
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
598
|
+
return canvas;
|
|
599
|
+
};
|
|
441
600
|
|
|
442
601
|
const createEventFirer = (act, store) => {
|
|
443
602
|
const findEventHandler = (element, eventName) => {
|
|
@@ -577,19 +736,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
577
736
|
extend(THREE);
|
|
578
737
|
const act = act$1;
|
|
579
738
|
const create = async (element, options) => {
|
|
580
|
-
const canvas = createCanvas(
|
|
581
|
-
width: options == null ? void 0 : options.width,
|
|
582
|
-
height: options == null ? void 0 : options.height,
|
|
583
|
-
beforeReturn: canvas => {
|
|
584
|
-
function getContext(contextId) {
|
|
585
|
-
if (contextId === 'webgl' || contextId === 'webgl2') {
|
|
586
|
-
return createWebGLContext(canvas);
|
|
587
|
-
}
|
|
588
|
-
return null;
|
|
589
|
-
}
|
|
590
|
-
canvas.getContext = getContext;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
739
|
+
const canvas = createCanvas(options);
|
|
593
740
|
const _root = createRoot(canvas).configure({
|
|
594
741
|
frameloop: 'never',
|
|
595
742
|
...options,
|
|
@@ -652,4 +799,4 @@ var index = {
|
|
|
652
799
|
act
|
|
653
800
|
};
|
|
654
801
|
|
|
655
|
-
export { index$1 as ReactThreeTest, index as default };
|
|
802
|
+
export { index$1 as ReactThreeTest, act, create, index as default };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createWebGLContext: (canvas: HTMLCanvasElement) => RenderingContext;
|