super-three 0.136.0 → 0.136.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.js +1634 -1608
  3. package/build/three.min.js +1 -1
  4. package/build/three.module.js +4630 -4534
  5. package/examples/js/animation/MMDPhysics.js +1 -1
  6. package/examples/js/cameras/CinematicCamera.js +2 -7
  7. package/examples/js/exporters/MMDExporter.js +1 -1
  8. package/examples/js/geometries/ConvexGeometry.js +1 -1
  9. package/examples/js/loaders/BasisTextureLoader.js +1 -0
  10. package/examples/js/loaders/EXRLoader.js +25 -19
  11. package/examples/js/loaders/GLTFLoader.js +2 -2
  12. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -2
  13. package/examples/js/loaders/LDrawLoader.js +1131 -859
  14. package/examples/js/loaders/LUT3dlLoader.js +17 -10
  15. package/examples/js/loaders/LUTCubeLoader.js +3 -4
  16. package/examples/js/loaders/RGBELoader.js +6 -6
  17. package/examples/js/loaders/RGBMLoader.js +1 -1
  18. package/examples/js/loaders/SVGLoader.js +3 -1
  19. package/examples/js/loaders/VRMLLoader.js +9 -21
  20. package/examples/js/math/ConvexHull.js +7 -13
  21. package/examples/js/misc/Volume.js +2 -2
  22. package/examples/js/modifiers/CurveModifier.js +8 -7
  23. package/examples/js/modifiers/EdgeSplitModifier.js +1 -1
  24. package/examples/js/modifiers/SimplifyModifier.js +1 -1
  25. package/examples/js/objects/Reflector.js +1 -13
  26. package/examples/js/objects/ReflectorForSSRPass.js +0 -10
  27. package/examples/js/objects/Refractor.js +1 -13
  28. package/examples/js/objects/Water.js +1 -13
  29. package/examples/js/postprocessing/GlitchPass.js +4 -5
  30. package/examples/js/postprocessing/SMAAPass.js +2 -9
  31. package/examples/js/postprocessing/SSAOPass.js +9 -21
  32. package/examples/js/postprocessing/SavePass.js +1 -5
  33. package/examples/js/shaders/DigitalGlitch.js +3 -3
  34. package/examples/js/shaders/MMDToonShader.js +0 -1
  35. package/examples/js/shaders/SSAOShader.js +1 -1
  36. package/examples/jsm/animation/MMDPhysics.js +1 -1
  37. package/examples/jsm/cameras/CinematicCamera.js +2 -5
  38. package/examples/jsm/{WebGL.js → capabilities/WebGL.js} +2 -2
  39. package/examples/jsm/{renderers/webgpu → capabilities}/WebGPU.js +1 -1
  40. package/examples/jsm/exporters/GLTFExporter.js +8 -24
  41. package/examples/jsm/exporters/MMDExporter.js +1 -1
  42. package/examples/jsm/geometries/ConvexGeometry.js +1 -1
  43. package/examples/jsm/libs/lil-gui.module.min.js +2 -2
  44. package/examples/jsm/loaders/BasisTextureLoader.js +7 -0
  45. package/examples/jsm/loaders/EXRLoader.js +22 -19
  46. package/examples/jsm/loaders/GLTFLoader.js +1 -3
  47. package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -4
  48. package/examples/jsm/loaders/LDrawLoader.js +1147 -885
  49. package/examples/jsm/loaders/LUT3dlLoader.js +17 -12
  50. package/examples/jsm/loaders/LUTCubeLoader.js +3 -5
  51. package/examples/jsm/loaders/RGBELoader.js +7 -8
  52. package/examples/jsm/loaders/RGBMLoader.js +1 -1
  53. package/examples/jsm/loaders/SVGLoader.js +6 -1
  54. package/examples/jsm/loaders/VRMLLoader.js +9 -22
  55. package/examples/jsm/math/ConvexHull.js +7 -13
  56. package/examples/jsm/misc/Volume.js +2 -2
  57. package/examples/jsm/modifiers/CurveModifier.js +9 -8
  58. package/examples/jsm/modifiers/EdgeSplitModifier.js +1 -1
  59. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  60. package/examples/jsm/node-editor/NodeEditor.js +21 -22
  61. package/examples/jsm/nodes/utils/ColorSpaceNode.js +4 -13
  62. package/examples/jsm/objects/Lensflare.js +4 -4
  63. package/examples/jsm/objects/Reflector.js +1 -16
  64. package/examples/jsm/objects/ReflectorForSSRPass.js +0 -12
  65. package/examples/jsm/objects/Refractor.js +1 -16
  66. package/examples/jsm/objects/Water.js +1 -16
  67. package/examples/jsm/postprocessing/GlitchPass.js +7 -6
  68. package/examples/jsm/postprocessing/SMAAPass.js +2 -11
  69. package/examples/jsm/postprocessing/SSAOPass.js +13 -25
  70. package/examples/jsm/postprocessing/SavePass.js +1 -3
  71. package/examples/jsm/renderers/nodes/Nodes.js +2 -0
  72. package/examples/jsm/renderers/nodes/ShaderNode.js +58 -31
  73. package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +9 -46
  74. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +5 -10
  75. package/examples/jsm/renderers/nodes/math/MathNode.js +2 -1
  76. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
  77. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +3 -5
  78. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +1 -2
  79. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +10 -4
  80. package/examples/jsm/shaders/DigitalGlitch.js +3 -3
  81. package/examples/jsm/shaders/MMDToonShader.js +0 -1
  82. package/examples/jsm/shaders/SSAOShader.js +1 -1
  83. package/examples/jsm/utils/LDrawUtils.js +195 -0
  84. package/examples/jsm/webxr/VRButton.js +24 -0
  85. package/examples/jsm/webxr/XREstimatedLight.js +2 -0
  86. package/package.json +4 -1
  87. package/src/animation/AnimationMixer.js +1 -0
  88. package/src/cameras/CubeCamera.js +2 -0
  89. package/src/constants.js +3 -16
  90. package/src/extras/ImageUtils.js +63 -0
  91. package/src/extras/PMREMGenerator.js +32 -82
  92. package/src/loaders/MaterialLoader.js +1 -1
  93. package/src/materials/Material.js +4 -4
  94. package/src/math/Color.js +1 -1
  95. package/src/math/Quaternion.js +1 -1
  96. package/src/renderers/WebGLCubeRenderTarget.js +0 -2
  97. package/src/renderers/WebGLRenderer.js +1 -67
  98. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +0 -2
  99. package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -4
  100. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -2
  101. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -1
  102. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -1
  103. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +2 -2
  104. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +10 -3
  105. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +1 -2
  106. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +8 -7
  107. package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -3
  108. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -3
  109. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -1
  110. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -2
  111. package/src/renderers/shaders/ShaderLib.js +2 -2
  112. package/src/renderers/webgl/WebGLCubeMaps.js +0 -4
  113. package/src/renderers/webgl/WebGLCubeUVMaps.js +29 -16
  114. package/src/renderers/webgl/WebGLMorphtargets.js +12 -0
  115. package/src/renderers/webgl/WebGLProgram.js +4 -16
  116. package/src/renderers/webgl/WebGLPrograms.js +8 -47
  117. package/src/renderers/webgl/WebGLState.js +81 -0
  118. package/src/renderers/webgl/WebGLTextures.js +75 -22
  119. package/src/renderers/webgl/WebGLUtils.js +86 -28
  120. package/src/renderers/webxr/WebXRManager.js +3 -3
  121. package/src/textures/Texture.js +2 -1
  122. package/src/textures/VideoTexture.js +1 -3
  123. package/examples/js/WebGL.js +0 -90
  124. package/examples/js/utils/RoughnessMipmapper.js +0 -268
  125. package/examples/jsm/utils/RoughnessMipmapper.js +0 -288
@@ -821,7 +821,7 @@
821
821
  return new Ammo.btCapsuleShape( p.width, p.height );
822
822
 
823
823
  default:
824
- throw 'unknown shape type ' + p.shapeType;
824
+ throw new Error( 'unknown shape type ' + p.shapeType );
825
825
 
826
826
  }
827
827
 
@@ -91,13 +91,8 @@
91
91
  this.postprocessing.scene = new THREE.Scene();
92
92
  this.postprocessing.camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 10000, 10000 );
93
93
  this.postprocessing.scene.add( this.postprocessing.camera );
94
- const pars = {
95
- minFilter: THREE.LinearFilter,
96
- magFilter: THREE.LinearFilter,
97
- format: THREE.RGBFormat
98
- };
99
- this.postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
100
- this.postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
94
+ this.postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight );
95
+ this.postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight );
101
96
  const bokeh_shader = THREE.BokehShader;
102
97
  this.postprocessing.bokeh_uniforms = THREE.UniformsUtils.clone( bokeh_shader.uniforms );
103
98
  this.postprocessing.bokeh_uniforms[ 'tColor' ].value = this.postprocessing.rtTextureColor.texture;
@@ -161,7 +161,7 @@
161
161
 
162
162
  if ( value === undefined ) {
163
163
 
164
- throw 'cannot convert charcode 0x' + code.toString( 16 );
164
+ throw new Error( 'cannot convert charcode 0x' + code.toString( 16 ) );
165
165
 
166
166
  } else if ( value > 0xff ) {
167
167
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  class ConvexGeometry extends THREE.BufferGeometry {
4
4
 
5
- constructor( points ) {
5
+ constructor( points = [] ) {
6
6
 
7
7
  super(); // buffers
8
8
 
@@ -28,6 +28,7 @@
28
28
  this.workerNextTaskID = 1;
29
29
  this.workerSourceURL = '';
30
30
  this.workerConfig = null;
31
+ console.warn( 'THREE.BasisTextureLoader: This loader is deprecated, and will be removed in a future release. ' + 'Instead, use Basis Universal compression in KTX2 (.ktx2) files with THREE.KTX2Loader.' );
31
32
 
32
33
  }
33
34
 
@@ -210,7 +210,7 @@
210
210
 
211
211
  if ( p.value - inOffset.value > ni ) {
212
212
 
213
- throw 'Something wrong with hufUnpackEncTable';
213
+ throw new Error( 'Something wrong with hufUnpackEncTable' );
214
214
 
215
215
  }
216
216
 
@@ -221,7 +221,7 @@
221
221
 
222
222
  if ( im + zerun > iM + 1 ) {
223
223
 
224
- throw 'Something wrong with hufUnpackEncTable';
224
+ throw new Error( 'Something wrong with hufUnpackEncTable' );
225
225
 
226
226
  }
227
227
 
@@ -235,7 +235,7 @@
235
235
 
236
236
  if ( im + zerun > iM + 1 ) {
237
237
 
238
- throw 'Something wrong with hufUnpackEncTable';
238
+ throw new Error( 'Something wrong with hufUnpackEncTable' );
239
239
 
240
240
  }
241
241
 
@@ -272,7 +272,7 @@
272
272
 
273
273
  if ( c >> l ) {
274
274
 
275
- throw 'Invalid table entry';
275
+ throw new Error( 'Invalid table entry' );
276
276
 
277
277
  }
278
278
 
@@ -282,7 +282,7 @@
282
282
 
283
283
  if ( pl.len ) {
284
284
 
285
- throw 'Invalid table entry';
285
+ throw new Error( 'Invalid table entry' );
286
286
 
287
287
  }
288
288
 
@@ -317,7 +317,7 @@
317
317
 
318
318
  if ( pl.len || pl.p ) {
319
319
 
320
- throw 'Invalid table entry';
320
+ throw new Error( 'Invalid table entry' );
321
321
 
322
322
  }
323
323
 
@@ -576,7 +576,7 @@
576
576
 
577
577
  if ( ! pl.p ) {
578
578
 
579
- throw 'hufDecode issues';
579
+ throw new Error( 'hufDecode issues' );
580
580
 
581
581
  }
582
582
 
@@ -612,7 +612,7 @@
612
612
 
613
613
  if ( j == pl.lit ) {
614
614
 
615
- throw 'hufDecode issues';
615
+ throw new Error( 'hufDecode issues' );
616
616
 
617
617
  }
618
618
 
@@ -639,7 +639,7 @@
639
639
 
640
640
  } else {
641
641
 
642
- throw 'hufDecode issues';
642
+ throw new Error( 'hufDecode issues' );
643
643
 
644
644
  }
645
645
 
@@ -663,7 +663,7 @@
663
663
 
664
664
  if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) {
665
665
 
666
- throw 'Something wrong with HUF_ENCSIZE';
666
+ throw new Error( 'Something wrong with HUF_ENCSIZE' );
667
667
 
668
668
  }
669
669
 
@@ -675,7 +675,7 @@
675
675
 
676
676
  if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) {
677
677
 
678
- throw 'Something wrong with hufUncompress';
678
+ throw new Error( 'Something wrong with hufUncompress' );
679
679
 
680
680
  }
681
681
 
@@ -1198,7 +1198,7 @@
1198
1198
 
1199
1199
  if ( maxNonZero >= BITMAP_SIZE ) {
1200
1200
 
1201
- throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE';
1201
+ throw new Error( 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE' );
1202
1202
 
1203
1203
  }
1204
1204
 
@@ -1346,7 +1346,7 @@
1346
1346
  totalDcUncompressedCount: parseInt64( inDataView, inOffset ),
1347
1347
  acCompression: parseInt64( inDataView, inOffset )
1348
1348
  };
1349
- if ( dwaHeader.version < 2 ) throw 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported'; // Read channel ruleset information
1349
+ if ( dwaHeader.version < 2 ) throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported' ); // Read channel ruleset information
1350
1350
 
1351
1351
  var channelRules = new Array();
1352
1352
  var ruleSize = parseUint16( inDataView, inOffset ) - INT16_SIZE;
@@ -1523,7 +1523,7 @@
1523
1523
  case LOSSY_DCT: // skip
1524
1524
 
1525
1525
  default:
1526
- throw 'EXRLoader.parse: unsupported channel compression';
1526
+ throw new Error( 'EXRLoader.parse: unsupported channel compression' );
1527
1527
 
1528
1528
  }
1529
1529
 
@@ -1818,8 +1818,14 @@
1818
1818
  function parseHeader( dataView, buffer, offset ) {
1819
1819
 
1820
1820
  const EXRHeader = {};
1821
- if ( dataView.getUint32( 0, true ) != 20000630 ) // magic
1822
- throw 'THREE.EXRLoader: provided file doesn\'t appear to be in OpenEXR format.';
1821
+
1822
+ if ( dataView.getUint32( 0, true ) != 20000630 ) {
1823
+
1824
+ // magic
1825
+ throw new Error( 'THREE.EXRLoader: provided file doesn\'t appear to be in OpenEXR format.' );
1826
+
1827
+ }
1828
+
1823
1829
  EXRHeader.version = dataView.getUint8( 4, true );
1824
1830
  const spec = dataView.getUint8( 5, true ); // fullMask
1825
1831
 
@@ -1865,7 +1871,7 @@
1865
1871
  if ( spec != 0 ) {
1866
1872
 
1867
1873
  console.error( 'EXRHeader:', EXRHeader );
1868
- throw 'THREE.EXRLoader: provided file is currently unsupported.';
1874
+ throw new Error( 'THREE.EXRLoader: provided file is currently unsupported.' );
1869
1875
 
1870
1876
  }
1871
1877
 
@@ -1936,7 +1942,7 @@
1936
1942
  break;
1937
1943
 
1938
1944
  default:
1939
- throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported';
1945
+ throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported' );
1940
1946
 
1941
1947
  }
1942
1948
 
@@ -1977,7 +1983,7 @@
1977
1983
 
1978
1984
  } else {
1979
1985
 
1980
- throw 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.';
1986
+ throw new Error( 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.' );
1981
1987
 
1982
1988
  }
1983
1989
 
@@ -1329,7 +1329,7 @@
1329
1329
 
1330
1330
  const specularMapParsFragmentChunk = [ '#ifdef USE_SPECULARMAP', ' uniform sampler2D specularMap;', '#endif' ].join( '\n' );
1331
1331
  const glossinessMapParsFragmentChunk = [ '#ifdef USE_GLOSSINESSMAP', ' uniform sampler2D glossinessMap;', '#endif' ].join( '\n' );
1332
- const specularMapFragmentChunk = [ 'vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', ' vec4 texelSpecular = texture2D( specularMap, vUv );', ' texelSpecular = sRGBToLinear( texelSpecular );', ' // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', ' specularFactor *= texelSpecular.rgb;', '#endif' ].join( '\n' );
1332
+ const specularMapFragmentChunk = [ 'vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', ' vec4 texelSpecular = texture2D( specularMap, vUv );', ' // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', ' specularFactor *= texelSpecular.rgb;', '#endif' ].join( '\n' );
1333
1333
  const glossinessMapFragmentChunk = [ 'float glossinessFactor = glossiness;', '#ifdef USE_GLOSSINESSMAP', ' vec4 texelGlossiness = texture2D( glossinessMap, vUv );', ' // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture', ' glossinessFactor *= texelGlossiness.a;', '#endif' ].join( '\n' );
1334
1334
  const lightPhysicalFragmentChunk = [ 'PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );', 'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );', 'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );', 'material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.', 'material.roughness += geometryRoughness;', 'material.roughness = min( material.roughness, 1.0 );', 'material.specularColor = specularFactor;' ].join( '\n' );
1335
1335
  const uniforms = {
@@ -2884,8 +2884,8 @@
2884
2884
 
2885
2885
  } else {
2886
2886
 
2887
- materialParams.format = THREE.RGBFormat;
2888
2887
  materialParams.transparent = false;
2888
+ materialParams.alphaWrite = false;
2889
2889
 
2890
2890
  if ( alphaMode === ALPHA_MODES.MASK ) {
2891
2891
 
@@ -30,7 +30,6 @@
30
30
 
31
31
  case THREE.FloatType:
32
32
  texture.encoding = THREE.LinearEncoding;
33
- texture.format = THREE.RGBFormat;
34
33
  texture.minFilter = THREE.LinearFilter;
35
34
  texture.magFilter = THREE.LinearFilter;
36
35
  texture.generateMipmaps = false;
@@ -38,7 +37,6 @@
38
37
 
39
38
  case THREE.HalfFloatType:
40
39
  texture.encoding = THREE.LinearEncoding;
41
- texture.format = THREE.RGBFormat;
42
40
  texture.minFilter = THREE.LinearFilter;
43
41
  texture.magFilter = THREE.LinearFilter;
44
42
  texture.generateMipmaps = false;