super-three 0.136.1 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/build/three.cjs +37132 -0
  3. package/build/three.js +71 -53
  4. package/build/three.min.js +2 -2
  5. package/build/three.module.js +80 -47
  6. package/examples/js/animation/MMDAnimationHelper.js +3 -1
  7. package/examples/js/controls/experimental/CameraControls.js +6 -2
  8. package/examples/js/exporters/GLTFExporter.js +82 -39
  9. package/examples/js/geometries/TextGeometry.js +12 -10
  10. package/examples/js/interactive/HTMLMesh.js +14 -2
  11. package/examples/js/loaders/EXRLoader.js +20 -9
  12. package/examples/js/loaders/GLTFLoader.js +1 -1
  13. package/examples/js/loaders/LDrawLoader.js +541 -425
  14. package/examples/js/loaders/MD2Loader.js +5 -5
  15. package/examples/js/loaders/MTLLoader.js +10 -3
  16. package/examples/js/loaders/PCDLoader.js +2 -2
  17. package/examples/js/loaders/STLLoader.js +1 -1
  18. package/examples/js/loaders/SVGLoader.js +3 -2
  19. package/examples/js/modifiers/EdgeSplitModifier.js +0 -6
  20. package/examples/js/modifiers/SimplifyModifier.js +0 -10
  21. package/examples/js/objects/Lensflare.js +2 -2
  22. package/examples/js/postprocessing/OutlinePass.js +1 -5
  23. package/examples/js/renderers/CSS2DRenderer.js +25 -19
  24. package/examples/js/renderers/CSS3DRenderer.js +37 -32
  25. package/examples/js/utils/LDrawUtils.js +182 -0
  26. package/examples/jsm/exporters/GLTFExporter.js +80 -12
  27. package/examples/jsm/geometries/TextGeometry.js +13 -13
  28. package/examples/jsm/interactive/HTMLMesh.js +16 -2
  29. package/examples/jsm/libs/flow.module.js +930 -169
  30. package/examples/jsm/loaders/EXRLoader.js +19 -9
  31. package/examples/jsm/loaders/GLTFLoader.js +1 -1
  32. package/examples/jsm/loaders/LDrawLoader.js +534 -442
  33. package/examples/jsm/loaders/MD2Loader.js +5 -5
  34. package/examples/jsm/loaders/MTLLoader.js +11 -4
  35. package/examples/jsm/loaders/PCDLoader.js +2 -2
  36. package/examples/jsm/loaders/STLLoader.js +1 -1
  37. package/examples/jsm/loaders/SVGLoader.js +3 -1
  38. package/examples/jsm/loaders/VRMLLoader.js +0 -1
  39. package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -6
  40. package/examples/jsm/modifiers/SimplifyModifier.js +0 -10
  41. package/examples/jsm/node-editor/NodeEditor.js +435 -181
  42. package/examples/jsm/node-editor/accessors/NormalEditor.js +8 -8
  43. package/examples/jsm/node-editor/accessors/PositionEditor.js +8 -8
  44. package/examples/jsm/node-editor/accessors/UVEditor.js +6 -7
  45. package/examples/jsm/node-editor/core/BaseNode.js +83 -0
  46. package/examples/jsm/node-editor/display/BlendEditor.js +7 -6
  47. package/examples/jsm/node-editor/examples/animate-uv.json +1 -1
  48. package/examples/jsm/node-editor/examples/fake-top-light.json +1 -1
  49. package/examples/jsm/node-editor/examples/oscillator-color.json +1 -1
  50. package/examples/jsm/node-editor/examples/rim.json +1 -1
  51. package/examples/jsm/node-editor/inputs/ColorEditor.js +14 -10
  52. package/examples/jsm/node-editor/inputs/FloatEditor.js +6 -7
  53. package/examples/jsm/node-editor/inputs/SliderEditor.js +4 -5
  54. package/examples/jsm/node-editor/inputs/Vector2Editor.js +6 -7
  55. package/examples/jsm/node-editor/inputs/Vector3Editor.js +8 -9
  56. package/examples/jsm/node-editor/inputs/Vector4Editor.js +9 -10
  57. package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +87 -0
  58. package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +97 -0
  59. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +20 -17
  60. package/examples/jsm/node-editor/math/AngleEditor.js +39 -0
  61. package/examples/jsm/node-editor/math/DotEditor.js +6 -7
  62. package/examples/jsm/node-editor/math/InvertEditor.js +4 -3
  63. package/examples/jsm/node-editor/math/LimiterEditor.js +11 -10
  64. package/examples/jsm/node-editor/math/NormalizeEditor.js +6 -5
  65. package/examples/jsm/node-editor/math/OperatorEditor.js +12 -11
  66. package/examples/jsm/node-editor/math/PowerEditor.js +6 -5
  67. package/examples/jsm/node-editor/math/TrigonometryEditor.js +12 -7
  68. package/examples/jsm/node-editor/procedural/CheckerEditor.js +4 -3
  69. package/examples/jsm/node-editor/scene/MeshEditor.js +99 -0
  70. package/examples/jsm/node-editor/scene/Object3DEditor.js +160 -0
  71. package/examples/jsm/node-editor/scene/PointsEditor.js +99 -0
  72. package/examples/jsm/node-editor/utils/JoinEditor.js +58 -0
  73. package/examples/jsm/node-editor/utils/OscillatorEditor.js +7 -6
  74. package/examples/jsm/node-editor/utils/SplitEditor.js +39 -0
  75. package/examples/jsm/node-editor/utils/TimerEditor.js +6 -5
  76. package/examples/jsm/postprocessing/OutlinePass.js +1 -4
  77. package/examples/jsm/renderers/CSS2DRenderer.js +24 -19
  78. package/examples/jsm/renderers/CSS3DRenderer.js +36 -30
  79. package/examples/jsm/renderers/nodes/accessors/UVNode.js +4 -4
  80. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +2 -1
  81. package/examples/jsm/renderers/nodes/utils/SplitNode.js +19 -4
  82. package/examples/jsm/utils/LDrawUtils.js +18 -11
  83. package/package.json +16 -9
  84. package/src/constants.js +1 -3
  85. package/src/core/BufferGeometry.js +2 -2
  86. package/src/geometries/LatheGeometry.js +1 -1
  87. package/src/loaders/FileLoader.js +20 -3
  88. package/src/math/Box3.js +24 -10
  89. package/src/renderers/WebGLRenderTarget.js +4 -1
  90. package/src/renderers/WebGLRenderer.js +3 -3
  91. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +1 -1
  92. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +2 -2
  93. package/src/renderers/webgl/WebGLBackground.js +2 -2
  94. package/src/renderers/webgl/WebGLGeometries.js +2 -2
  95. package/src/renderers/webgl/WebGLPrograms.js +2 -2
  96. package/src/renderers/webgl/WebGLState.js +2 -2
  97. package/src/renderers/webgl/WebGLTextures.js +9 -6
  98. package/src/renderers/webgl/WebGLUtils.js +1 -3
  99. package/src/renderers/webxr/WebXRManager.js +2 -0
  100. package/src/utils.js +15 -1
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2010-2021 Three.js Authors
3
+ * Copyright 2010-2022 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '137dev';
6
+ const REVISION = '137';
7
7
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
8
8
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
9
9
  const CullFaceNone = 0;
@@ -89,7 +89,6 @@ const FloatType = 1015;
89
89
  const HalfFloatType = 1016;
90
90
  const UnsignedShort4444Type = 1017;
91
91
  const UnsignedShort5551Type = 1018;
92
- const UnsignedShort565Type = 1019;
93
92
  const UnsignedInt248Type = 1020;
94
93
  const AlphaFormat = 1021;
95
94
  const RGBAFormat = 1023;
@@ -101,7 +100,6 @@ const RedFormat = 1028;
101
100
  const RedIntegerFormat = 1029;
102
101
  const RGFormat = 1030;
103
102
  const RGIntegerFormat = 1031;
104
- const RGBIntegerFormat = 1032;
105
103
  const RGBAIntegerFormat = 1033;
106
104
 
107
105
  const RGB_S3TC_DXT1_Format = 33776;
@@ -1347,19 +1345,17 @@ class Matrix3 {
1347
1345
 
1348
1346
  Matrix3.prototype.isMatrix3 = true;
1349
1347
 
1350
- function arrayMax( array ) {
1348
+ function arrayNeedsUint32( array ) {
1351
1349
 
1352
- if ( array.length === 0 ) return - Infinity;
1350
+ // assumes larger values usually on last
1353
1351
 
1354
- let max = array[ 0 ];
1352
+ for ( let i = array.length - 1; i >= 0; -- i ) {
1355
1353
 
1356
- for ( let i = 1, l = array.length; i < l; ++ i ) {
1357
-
1358
- if ( array[ i ] > max ) max = array[ i ];
1354
+ if ( array[ i ] > 65535 ) return true;
1359
1355
 
1360
1356
  }
1361
1357
 
1362
- return max;
1358
+ return false;
1363
1359
 
1364
1360
  }
1365
1361
 
@@ -3181,7 +3177,10 @@ class WebGLRenderTarget extends EventDispatcher {
3181
3177
  this.viewport.copy( source.viewport );
3182
3178
 
3183
3179
  this.texture = source.texture.clone();
3184
- this.texture.image = { ...this.texture.image }; // See #20328.
3180
+
3181
+ // ensure image object is not shared, see #20328
3182
+
3183
+ this.texture.image = Object.assign( {}, source.texture.image );
3185
3184
 
3186
3185
  this.depthBuffer = source.depthBuffer;
3187
3186
  this.stencilBuffer = source.stencilBuffer;
@@ -4843,11 +4842,11 @@ class Box3 {
4843
4842
 
4844
4843
  }
4845
4844
 
4846
- setFromObject( object ) {
4845
+ setFromObject( object, precise = false ) {
4847
4846
 
4848
4847
  this.makeEmpty();
4849
4848
 
4850
- return this.expandByObject( object );
4849
+ return this.expandByObject( object, precise );
4851
4850
 
4852
4851
  }
4853
4852
 
@@ -4922,7 +4921,7 @@ class Box3 {
4922
4921
 
4923
4922
  }
4924
4923
 
4925
- expandByObject( object ) {
4924
+ expandByObject( object, precise = false ) {
4926
4925
 
4927
4926
  // Computes the world-axis-aligned bounding box of an object (including its children),
4928
4927
  // accounting for both the object's, and children's, world transforms
@@ -4933,16 +4932,30 @@ class Box3 {
4933
4932
 
4934
4933
  if ( geometry !== undefined ) {
4935
4934
 
4936
- if ( geometry.boundingBox === null ) {
4935
+ if ( precise && geometry.attributes != undefined && geometry.attributes.position !== undefined ) {
4937
4936
 
4938
- geometry.computeBoundingBox();
4937
+ const position = geometry.attributes.position;
4938
+ for ( let i = 0, l = position.count; i < l; i ++ ) {
4939
4939
 
4940
- }
4940
+ _vector$b.fromBufferAttribute( position, i ).applyMatrix4( object.matrixWorld );
4941
+ this.expandByPoint( _vector$b );
4941
4942
 
4942
- _box$3.copy( geometry.boundingBox );
4943
- _box$3.applyMatrix4( object.matrixWorld );
4943
+ }
4944
+
4945
+ } else {
4946
+
4947
+ if ( geometry.boundingBox === null ) {
4948
+
4949
+ geometry.computeBoundingBox();
4950
+
4951
+ }
4944
4952
 
4945
- this.union( _box$3 );
4953
+ _box$3.copy( geometry.boundingBox );
4954
+ _box$3.applyMatrix4( object.matrixWorld );
4955
+
4956
+ this.union( _box$3 );
4957
+
4958
+ }
4946
4959
 
4947
4960
  }
4948
4961
 
@@ -4950,7 +4963,7 @@ class Box3 {
4950
4963
 
4951
4964
  for ( let i = 0, l = children.length; i < l; i ++ ) {
4952
4965
 
4953
- this.expandByObject( children[ i ] );
4966
+ this.expandByObject( children[ i ], precise );
4954
4967
 
4955
4968
  }
4956
4969
 
@@ -9575,7 +9588,7 @@ class BufferGeometry extends EventDispatcher {
9575
9588
 
9576
9589
  if ( Array.isArray( index ) ) {
9577
9590
 
9578
- this.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
9591
+ this.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
9579
9592
 
9580
9593
  } else {
9581
9594
 
@@ -12851,11 +12864,11 @@ var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_META
12851
12864
 
12852
12865
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
12853
12866
 
12854
- var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
12867
+ var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
12855
12868
 
12856
12869
  var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
12857
12870
 
12858
- var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
12871
+ var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
12859
12872
 
12860
12873
  var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
12861
12874
 
@@ -13662,10 +13675,10 @@ ShaderLib.physical = {
13662
13675
 
13663
13676
  };
13664
13677
 
13665
- function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha ) {
13678
+ function WebGLBackground( renderer, cubemaps, state, objects, alpha, premultipliedAlpha ) {
13666
13679
 
13667
13680
  const clearColor = new Color( 0x000000 );
13668
- let clearAlpha = 0;
13681
+ let clearAlpha = alpha === true ? 0 : 1;
13669
13682
 
13670
13683
  let planeMesh;
13671
13684
  let boxMesh;
@@ -16248,7 +16261,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
16248
16261
 
16249
16262
  }
16250
16263
 
16251
- const attribute = new ( arrayMax( indices ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
16264
+ const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
16252
16265
  attribute.version = version;
16253
16266
 
16254
16267
  // Updating index buffer in VAO now. See WebGLBindingStates
@@ -19006,7 +19019,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
19006
19019
  instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
19007
19020
 
19008
19021
  supportsVertexTextures: vertexTextures,
19009
- outputEncoding: ( currentRenderTarget !== null ) ? currentRenderTarget.texture.encoding : renderer.outputEncoding,
19022
+ outputEncoding: ( currentRenderTarget === null ) ? renderer.outputEncoding : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.encoding : LinearEncoding ),
19010
19023
  map: !! material.map,
19011
19024
  matcap: !! material.matcap,
19012
19025
  envMap: !! envMap,
@@ -21476,7 +21489,7 @@ function WebGLState( gl, extensions, capabilities ) {
21476
21489
  break;
21477
21490
 
21478
21491
  case SubtractiveBlending:
21479
- gl.blendFuncSeparate( 0, 0, 769, 771 );
21492
+ gl.blendFuncSeparate( 0, 769, 0, 1 );
21480
21493
  break;
21481
21494
 
21482
21495
  case MultiplyBlending:
@@ -21502,7 +21515,7 @@ function WebGLState( gl, extensions, capabilities ) {
21502
21515
  break;
21503
21516
 
21504
21517
  case SubtractiveBlending:
21505
- gl.blendFunc( 0, 769 );
21518
+ gl.blendFuncSeparate( 0, 769, 0, 1 );
21506
21519
  break;
21507
21520
 
21508
21521
  case MultiplyBlending:
@@ -22191,11 +22204,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22191
22204
 
22192
22205
  }
22193
22206
 
22194
- if ( glFormat === 6407 ) {
22207
+ if ( glFormat === 33319 ) {
22195
22208
 
22196
- if ( glType === 5126 ) internalFormat = 34837;
22197
- if ( glType === 5131 ) internalFormat = 34843;
22198
- if ( glType === 5121 ) internalFormat = 32849;
22209
+ if ( glType === 5126 ) internalFormat = 33328;
22210
+ if ( glType === 5131 ) internalFormat = 33327;
22211
+ if ( glType === 5121 ) internalFormat = 33323;
22199
22212
 
22200
22213
  }
22201
22214
 
@@ -22204,10 +22217,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22204
22217
  if ( glType === 5126 ) internalFormat = 34836;
22205
22218
  if ( glType === 5131 ) internalFormat = 34842;
22206
22219
  if ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding && isVideoTexture === false ) ? 35907 : 32856;
22220
+ if ( glType === 32819 ) internalFormat = 32854;
22221
+ if ( glType === 32820 ) internalFormat = 32855;
22207
22222
 
22208
22223
  }
22209
22224
 
22210
22225
  if ( internalFormat === 33325 || internalFormat === 33326 ||
22226
+ internalFormat === 33327 || internalFormat === 33328 ||
22211
22227
  internalFormat === 34842 || internalFormat === 34836 ) {
22212
22228
 
22213
22229
  extensions.get( 'EXT_color_buffer_float' );
@@ -23669,13 +23685,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
23669
23685
  const format = texture.format;
23670
23686
  const type = texture.type;
23671
23687
 
23672
- if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
23688
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
23673
23689
 
23674
23690
  if ( encoding !== LinearEncoding ) {
23675
23691
 
23676
23692
  // sRGB
23677
23693
 
23678
- if ( encoding === sRGBEncoding && texture.isVideoTexture !== true ) {
23694
+ if ( encoding === sRGBEncoding ) {
23679
23695
 
23680
23696
  if ( isWebGL2 === false ) {
23681
23697
 
@@ -23798,7 +23814,6 @@ function WebGLUtils( gl, extensions, capabilities ) {
23798
23814
  if ( p === UnsignedByteType ) return 5121;
23799
23815
  if ( p === UnsignedShort4444Type ) return 32819;
23800
23816
  if ( p === UnsignedShort5551Type ) return 32820;
23801
- if ( p === UnsignedShort565Type ) return 33635;
23802
23817
 
23803
23818
  if ( p === ByteType ) return 5120;
23804
23819
  if ( p === ShortType ) return 5122;
@@ -23856,7 +23871,6 @@ function WebGLUtils( gl, extensions, capabilities ) {
23856
23871
  if ( p === RedIntegerFormat ) return 36244;
23857
23872
  if ( p === RGFormat ) return 33319;
23858
23873
  if ( p === RGIntegerFormat ) return 33320;
23859
- if ( p === RGBIntegerFormat ) return 36248;
23860
23874
  if ( p === RGBAIntegerFormat ) return 36249;
23861
23875
 
23862
23876
  // S3TC
@@ -25208,6 +25222,8 @@ class WebXRManager extends EventDispatcher {
25208
25222
 
25209
25223
  }
25210
25224
 
25225
+ newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
25226
+
25211
25227
  // Set foveation to maximum.
25212
25228
  this.setFoveation( 1.0 );
25213
25229
 
@@ -26541,7 +26557,7 @@ function WebGLRenderer( parameters = {} ) {
26541
26557
  try {
26542
26558
 
26543
26559
  const contextAttributes = {
26544
- alpha: _alpha,
26560
+ alpha: true,
26545
26561
  depth: _depth,
26546
26562
  stencil: _stencil,
26547
26563
  antialias: _antialias,
@@ -26640,7 +26656,7 @@ function WebGLRenderer( parameters = {} ) {
26640
26656
  materials = new WebGLMaterials( properties );
26641
26657
  renderLists = new WebGLRenderLists();
26642
26658
  renderStates = new WebGLRenderStates( extensions, capabilities );
26643
- background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
26659
+ background = new WebGLBackground( _this, cubemaps, state, objects, _alpha, _premultipliedAlpha );
26644
26660
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
26645
26661
 
26646
26662
  bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
@@ -27759,7 +27775,7 @@ function WebGLRenderer( parameters = {} ) {
27759
27775
 
27760
27776
  const fog = scene.fog;
27761
27777
  const environment = material.isMeshStandardMaterial ? scene.environment : null;
27762
- const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
27778
+ const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.encoding : LinearEncoding );
27763
27779
  const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
27764
27780
  const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
27765
27781
  const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
@@ -35539,7 +35555,7 @@ class LatheGeometry extends BufferGeometry {
35539
35555
  // faces
35540
35556
 
35541
35557
  indices.push( a, b, d );
35542
- indices.push( b, c, d );
35558
+ indices.push( c, d, b );
35543
35559
 
35544
35560
  }
35545
35561
 
@@ -39804,6 +39820,10 @@ class FileLoader extends Loader {
39804
39820
  // An abort controller could be added within a future PR
39805
39821
  } );
39806
39822
 
39823
+ // record states ( avoid data race )
39824
+ const mimeType = this.mimeType;
39825
+ const responseType = this.responseType;
39826
+
39807
39827
  // start the fetch
39808
39828
  fetch( req )
39809
39829
  .then( response => {
@@ -39882,7 +39902,7 @@ class FileLoader extends Loader {
39882
39902
  } )
39883
39903
  .then( response => {
39884
39904
 
39885
- switch ( this.responseType ) {
39905
+ switch ( responseType ) {
39886
39906
 
39887
39907
  case 'arraybuffer':
39888
39908
 
@@ -39898,7 +39918,7 @@ class FileLoader extends Loader {
39898
39918
  .then( text => {
39899
39919
 
39900
39920
  const parser = new DOMParser();
39901
- return parser.parseFromString( text, this.mimeType );
39921
+ return parser.parseFromString( text, mimeType );
39902
39922
 
39903
39923
  } );
39904
39924
 
@@ -39908,7 +39928,20 @@ class FileLoader extends Loader {
39908
39928
 
39909
39929
  default:
39910
39930
 
39911
- return response.text();
39931
+ if ( mimeType === undefined ) {
39932
+
39933
+ return response.text();
39934
+
39935
+ } else {
39936
+
39937
+ // sniff encoding
39938
+ const re = /charset="?([^;"\s]*)"?/i;
39939
+ const exec = re.exec( mimeType );
39940
+ const label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;
39941
+ const decoder = new TextDecoder( label );
39942
+ return response.arrayBuffer().then( ab => decoder.decode( ab ) );
39943
+
39944
+ }
39912
39945
 
39913
39946
  }
39914
39947
 
@@ -50969,4 +51002,4 @@ if ( typeof window !== 'undefined' ) {
50969
51002
 
50970
51003
  }
50971
51004
 
50972
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBIntegerFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, sRGBEncoding };
51005
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, sRGBEncoding };
@@ -44,7 +44,9 @@
44
44
  cameraAnimation: true
45
45
  };
46
46
 
47
- this.onBeforePhysics = function () {}; // experimental
47
+ this.onBeforePhysics = function
48
+ /* mesh */
49
+ () {}; // experimental
48
50
 
49
51
 
50
52
  this.sharedPhysics = false;
@@ -510,7 +510,9 @@
510
510
 
511
511
  }
512
512
 
513
- function handleMouseUp() { // no-op
513
+ function
514
+ /*event*/
515
+ handleMouseUp() { // no-op
514
516
  }
515
517
 
516
518
  function handleMouseWheel( event ) {
@@ -691,7 +693,9 @@
691
693
 
692
694
  }
693
695
 
694
- function handleTouchEnd() { // no-op
696
+ function
697
+ /*event*/
698
+ handleTouchEnd() { // no-op
695
699
  } //
696
700
  // event handlers - FSM: listen for events and reset state
697
701
  //
@@ -624,6 +624,71 @@
624
624
 
625
625
  }
626
626
 
627
+ }
628
+
629
+ buildORMTexture( material ) {
630
+
631
+ const occlusion = material.aoMap?.image;
632
+ const roughness = material.roughnessMap?.image;
633
+ const metalness = material.metalnessMap?.image;
634
+ if ( occlusion === roughness && roughness === metalness ) return occlusion;
635
+
636
+ if ( occlusion || roughness || metalness ) {
637
+
638
+ const width = Math.max( occlusion?.width || 0, roughness?.width || 0, metalness?.width || 0 );
639
+ const height = Math.max( occlusion?.height || 0, roughness?.height || 0, metalness?.height || 0 );
640
+ const canvas = document.createElement( 'canvas' );
641
+ canvas.width = width;
642
+ canvas.height = height;
643
+ const context = canvas.getContext( '2d' );
644
+ context.fillStyle = '#ffffff';
645
+ context.fillRect( 0, 0, width, height );
646
+ const composite = context.getImageData( 0, 0, width, height );
647
+
648
+ if ( occlusion ) {
649
+
650
+ context.drawImage( occlusion, 0, 0, width, height );
651
+ const data = context.getImageData( 0, 0, width, height ).data;
652
+
653
+ for ( let i = 0; i < data.length; i += 4 ) {
654
+
655
+ composite.data[ i ] = data[ i ];
656
+
657
+ }
658
+
659
+ }
660
+
661
+ if ( roughness ) {
662
+
663
+ context.drawImage( roughness, 0, 0, width, height );
664
+ const data = context.getImageData( 0, 0, width, height ).data;
665
+
666
+ for ( let i = 1; i < data.length; i += 4 ) {
667
+
668
+ composite.data[ i ] = data[ i ];
669
+
670
+ }
671
+
672
+ }
673
+
674
+ if ( metalness ) {
675
+
676
+ context.drawImage( metalness, 0, 0, width, height );
677
+ const data = context.getImageData( 0, 0, width, height ).data;
678
+
679
+ for ( let i = 2; i < data.length; i += 4 ) {
680
+
681
+ composite.data[ i ] = data[ i ];
682
+
683
+ }
684
+
685
+ }
686
+
687
+ context.putImageData( composite, 0, 0 );
688
+ return new THREE.Texture( canvas );
689
+
690
+ }
691
+
627
692
  }
628
693
  /**
629
694
  * Process a buffer to append to the default one.
@@ -866,7 +931,7 @@
866
931
  /**
867
932
  * Process image
868
933
  * @param {Image} image to process
869
- * @param {Integer} format of the image (e.g. THREE.RGBFormat, THREE.RGBAFormat etc)
934
+ * @param {Integer} format of the image (THREE.RGBAFormat)
870
935
  * @param {Boolean} flipY before writing out the image
871
936
  * @return {Integer} Index of the processed texture in the "images" array
872
937
  */
@@ -909,9 +974,9 @@
909
974
 
910
975
  } else {
911
976
 
912
- if ( format !== THREE.RGBAFormat && format !== THREE.RGBFormat ) {
977
+ if ( format !== THREE.RGBAFormat ) {
913
978
 
914
- console.error( 'GLTFExporter: Only RGB and RGBA formats are supported.' );
979
+ console.error( 'GLTFExporter: Only THREE.RGBAFormat is supported.' );
915
980
 
916
981
  }
917
982
 
@@ -923,27 +988,12 @@
923
988
 
924
989
  const data = new Uint8ClampedArray( image.height * image.width * 4 );
925
990
 
926
- if ( format === THREE.RGBAFormat ) {
927
-
928
- for ( let i = 0; i < data.length; i += 4 ) {
929
-
930
- data[ i + 0 ] = image.data[ i + 0 ];
931
- data[ i + 1 ] = image.data[ i + 1 ];
932
- data[ i + 2 ] = image.data[ i + 2 ];
933
- data[ i + 3 ] = image.data[ i + 3 ];
934
-
935
- }
936
-
937
- } else {
991
+ for ( let i = 0; i < data.length; i += 4 ) {
938
992
 
939
- for ( let i = 0, j = 0; i < data.length; i += 4, j += 3 ) {
940
-
941
- data[ i + 0 ] = image.data[ j + 0 ];
942
- data[ i + 1 ] = image.data[ j + 1 ];
943
- data[ i + 2 ] = image.data[ j + 2 ];
944
- data[ i + 3 ] = 255;
945
-
946
- }
993
+ data[ i + 0 ] = image.data[ i + 0 ];
994
+ data[ i + 1 ] = image.data[ i + 1 ];
995
+ data[ i + 2 ] = image.data[ i + 2 ];
996
+ data[ i + 3 ] = image.data[ i + 3 ];
947
997
 
948
998
  }
949
999
 
@@ -987,7 +1037,7 @@
987
1037
  }
988
1038
  /**
989
1039
  * Process sampler
990
- * @param {Texture} map Texture to process
1040
+ * @param {Texture} map THREE.Texture to process
991
1041
  * @return {Integer} Index of the processed texture in the "samplers" array
992
1042
  */
993
1043
 
@@ -1086,24 +1136,17 @@
1086
1136
  materialDef.pbrMetallicRoughness.metallicFactor = 0.5;
1087
1137
  materialDef.pbrMetallicRoughness.roughnessFactor = 0.5;
1088
1138
 
1089
- } // pbrMetallicRoughness.metallicRoughnessTexture
1139
+ }
1090
1140
 
1141
+ const ormTexture = this.buildORMTexture( material ); // pbrMetallicRoughness.metallicRoughnessTexture
1091
1142
 
1092
1143
  if ( material.metalnessMap || material.roughnessMap ) {
1093
1144
 
1094
- if ( material.metalnessMap === material.roughnessMap ) {
1095
-
1096
- const metalRoughMapDef = {
1097
- index: this.processTexture( material.metalnessMap )
1098
- };
1099
- this.applyTextureTransform( metalRoughMapDef, material.metalnessMap );
1100
- materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef;
1101
-
1102
- } else {
1103
-
1104
- console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
1105
-
1106
- }
1145
+ const metalRoughMapDef = {
1146
+ index: this.processTexture( ormTexture )
1147
+ };
1148
+ this.applyTextureTransform( metalRoughMapDef, material.metalnessMap || material.roughnessMap );
1149
+ materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef;
1107
1150
 
1108
1151
  } // pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
1109
1152
 
@@ -1174,7 +1217,7 @@
1174
1217
  if ( material.aoMap ) {
1175
1218
 
1176
1219
  const occlusionMapDef = {
1177
- index: this.processTexture( material.aoMap ),
1220
+ index: this.processTexture( ormTexture ),
1178
1221
  texCoord: 1
1179
1222
  };
1180
1223
 
@@ -23,21 +23,23 @@
23
23
 
24
24
  const font = parameters.font;
25
25
 
26
- if ( ! ( font && font.isFont ) ) {
26
+ if ( font === undefined ) {
27
27
 
28
- console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' );
29
- return new THREE.BufferGeometry();
28
+ super(); // generate default extrude geometry
30
29
 
31
- }
30
+ } else {
31
+
32
+ const shapes = font.generateShapes( text, parameters.size ); // translate parameters to THREE.ExtrudeGeometry API
32
33
 
33
- const shapes = font.generateShapes( text, parameters.size ); // translate parameters to THREE.ExtrudeGeometry API
34
+ parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults
34
35
 
35
- parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults
36
+ if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
37
+ if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
38
+ if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
39
+ super( shapes, parameters );
40
+
41
+ }
36
42
 
37
- if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
38
- if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
39
- if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
40
- super( shapes, parameters );
41
43
  this.type = 'TextGeometry';
42
44
 
43
45
  }
@@ -14,7 +14,7 @@
14
14
 
15
15
  function onEvent( event ) {
16
16
 
17
- material.map.dispatchEvent( event );
17
+ material.map.dispatchDOMEvent( event );
18
18
 
19
19
  }
20
20
 
@@ -23,6 +23,18 @@
23
23
  this.addEventListener( 'mouseup', onEvent );
24
24
  this.addEventListener( 'click', onEvent );
25
25
 
26
+ this.dispose = function () {
27
+
28
+ geometry.dispose();
29
+ material.dispose();
30
+ material.map.dispose();
31
+ this.removeEventListener( 'mousedown', onEvent );
32
+ this.removeEventListener( 'mousemove', onEvent );
33
+ this.removeEventListener( 'mouseup', onEvent );
34
+ this.removeEventListener( 'click', onEvent );
35
+
36
+ };
37
+
26
38
  }
27
39
 
28
40
  }
@@ -40,7 +52,7 @@
40
52
 
41
53
  }
42
54
 
43
- dispatchEvent( event ) {
55
+ dispatchDOMEvent( event ) {
44
56
 
45
57
  htmlevent( this.dom, event.type, event.data.x, event.data.y );
46
58
  this.update();