super-three 0.154.1 → 0.155.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 (106) hide show
  1. package/build/three.cjs +256 -38
  2. package/build/three.js +256 -38
  3. package/build/three.min.js +1 -1
  4. package/build/three.module.js +255 -39
  5. package/build/three.module.min.js +1 -1
  6. package/examples/jsm/controls/OrbitControls.js +143 -21
  7. package/examples/jsm/environments/RoomEnvironment.js +1 -1
  8. package/examples/jsm/exporters/USDZExporter.js +1 -0
  9. package/examples/jsm/interactive/SelectionHelper.js +7 -0
  10. package/examples/jsm/loaders/FBXLoader.js +1 -1
  11. package/examples/jsm/loaders/GLTFLoader.js +8 -3
  12. package/examples/jsm/loaders/KTX2Loader.js +4 -4
  13. package/examples/jsm/loaders/LDrawLoader.js +1 -1
  14. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  15. package/examples/jsm/loaders/PLYLoader.js +1 -1
  16. package/examples/jsm/loaders/TGALoader.js +10 -10
  17. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  18. package/examples/jsm/misc/GPUComputationRenderer.js +0 -9
  19. package/examples/jsm/misc/Volume.js +4 -6
  20. package/examples/jsm/nodes/Nodes.js +5 -6
  21. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +1 -1
  22. package/examples/jsm/nodes/accessors/CubeTextureNode.js +2 -0
  23. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +14 -1
  24. package/examples/jsm/nodes/accessors/InstanceNode.js +8 -8
  25. package/examples/jsm/nodes/accessors/MaterialNode.js +34 -44
  26. package/examples/jsm/nodes/accessors/SceneNode.js +6 -0
  27. package/examples/jsm/nodes/accessors/TextureNode.js +48 -7
  28. package/examples/jsm/nodes/core/LightingModel.js +7 -9
  29. package/examples/jsm/nodes/core/Node.js +11 -2
  30. package/examples/jsm/nodes/core/PropertyNode.js +4 -0
  31. package/examples/jsm/nodes/display/BumpMapNode.js +77 -0
  32. package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
  33. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -2
  34. package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +13 -0
  35. package/examples/jsm/nodes/functions/PhongLightingModel.js +53 -14
  36. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +236 -97
  37. package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
  38. package/examples/jsm/nodes/gpgpu/ComputeNode.js +13 -0
  39. package/examples/jsm/nodes/lighting/AONode.js +1 -1
  40. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +58 -20
  41. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +7 -10
  42. package/examples/jsm/nodes/lighting/EnvironmentNode.js +22 -12
  43. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +1 -1
  44. package/examples/jsm/nodes/lighting/LightingContextNode.js +12 -9
  45. package/examples/jsm/nodes/lighting/PointLightNode.js +7 -10
  46. package/examples/jsm/nodes/lighting/SpotLightNode.js +7 -10
  47. package/examples/jsm/nodes/materials/Materials.js +1 -0
  48. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -0
  49. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -0
  50. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
  51. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +19 -2
  52. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +2 -2
  53. package/examples/jsm/nodes/materials/NodeMaterial.js +50 -24
  54. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
  55. package/examples/jsm/nodes/shadernode/ShaderNode.js +2 -2
  56. package/examples/jsm/objects/Reflector.js +1 -9
  57. package/examples/jsm/objects/Refractor.js +0 -8
  58. package/examples/jsm/offscreen/scene.js +0 -1
  59. package/examples/jsm/postprocessing/MaskPass.js +4 -1
  60. package/examples/jsm/postprocessing/OutputPass.js +33 -14
  61. package/examples/jsm/postprocessing/UnrealBloomPass.js +21 -17
  62. package/examples/jsm/renderers/common/Background.js +22 -20
  63. package/examples/jsm/renderers/common/Binding.js +8 -0
  64. package/examples/jsm/renderers/common/Bindings.js +2 -6
  65. package/examples/jsm/renderers/common/Geometries.js +1 -1
  66. package/examples/jsm/renderers/common/Pipelines.js +94 -45
  67. package/examples/jsm/renderers/common/RenderContext.js +1 -0
  68. package/examples/jsm/renderers/common/RenderContexts.js +16 -5
  69. package/examples/jsm/renderers/common/RenderObject.js +20 -4
  70. package/examples/jsm/renderers/common/RenderObjects.js +10 -7
  71. package/examples/jsm/renderers/common/Renderer.js +70 -39
  72. package/examples/jsm/renderers/common/Textures.js +20 -8
  73. package/examples/jsm/renderers/common/nodes/Nodes.js +15 -4
  74. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +51 -54
  75. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +33 -9
  76. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +55 -36
  77. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +83 -5
  78. package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +24 -22
  79. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +83 -130
  80. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +35 -8
  81. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +1 -1
  82. package/examples/jsm/shaders/OutputShader.js +19 -2
  83. package/examples/jsm/utils/BufferGeometryUtils.js +13 -4
  84. package/examples/jsm/webxr/OculusHandPointerModel.js +2 -2
  85. package/package.json +2 -2
  86. package/src/Three.js +2 -0
  87. package/src/animation/PropertyBinding.js +1 -1
  88. package/src/cameras/CubeCamera.js +1 -4
  89. package/src/constants.js +1 -1
  90. package/src/core/BufferAttribute.js +20 -0
  91. package/src/core/Object3D.js +1 -1
  92. package/src/core/RenderTarget.js +122 -0
  93. package/src/geometries/CapsuleGeometry.js +1 -1
  94. package/src/loaders/DataTextureLoader.js +21 -2
  95. package/src/renderers/WebGLMultipleRenderTargets.js +0 -2
  96. package/src/renderers/WebGLRenderTarget.js +3 -110
  97. package/src/renderers/WebGLRenderer.js +62 -8
  98. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +1 -2
  99. package/src/renderers/webgl/WebGLGeometries.js +5 -1
  100. package/src/renderers/webgl/WebGLMaterials.js +1 -1
  101. package/src/renderers/webgl/WebGLPrograms.js +14 -2
  102. package/src/renderers/webgl/WebGLTextures.js +97 -12
  103. package/src/textures/CompressedCubeTexture.js +19 -0
  104. package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +0 -30
  105. package/examples/jsm/renderers/common/RenderTarget.js +0 -15
  106. package/examples/jsm/renderers/common/nodes/NodeRender.js +0 -302
@@ -0,0 +1,122 @@
1
+ import { EventDispatcher } from './EventDispatcher.js';
2
+ import { Texture } from '../textures/Texture.js';
3
+ import { LinearFilter, NoColorSpace, SRGBColorSpace, sRGBEncoding } from '../constants.js';
4
+ import { Vector4 } from '../math/Vector4.js';
5
+ import { Source } from '../textures/Source.js';
6
+ import { warnOnce } from '../utils.js';
7
+
8
+ /*
9
+ In options, we can specify:
10
+ * Texture parameters for an auto-generated target texture
11
+ * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
12
+ */
13
+ class RenderTarget extends EventDispatcher {
14
+
15
+ constructor( width = 1, height = 1, options = {} ) {
16
+
17
+ super();
18
+
19
+ this.isRenderTarget = true;
20
+
21
+ this.width = width;
22
+ this.height = height;
23
+ this.depth = 1;
24
+
25
+ this.scissor = new Vector4( 0, 0, width, height );
26
+ this.scissorTest = false;
27
+
28
+ this.viewport = new Vector4( 0, 0, width, height );
29
+
30
+ const image = { width: width, height: height, depth: 1 };
31
+
32
+ if ( options.encoding !== undefined ) {
33
+
34
+ // @deprecated, r152
35
+ warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
36
+ options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
37
+
38
+ }
39
+
40
+ this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
41
+ this.texture.isRenderTargetTexture = true;
42
+
43
+ this.texture.flipY = false;
44
+ this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
45
+ this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
46
+ this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
47
+
48
+ this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
49
+ this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
50
+
51
+ this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
52
+
53
+ this.samples = options.samples !== undefined ? options.samples : 0;
54
+
55
+ }
56
+
57
+ setSize( width, height, depth = 1 ) {
58
+
59
+ if ( this.width !== width || this.height !== height || this.depth !== depth ) {
60
+
61
+ this.width = width;
62
+ this.height = height;
63
+ this.depth = depth;
64
+
65
+ this.texture.image.width = width;
66
+ this.texture.image.height = height;
67
+ this.texture.image.depth = depth;
68
+
69
+ this.dispose();
70
+
71
+ }
72
+
73
+ this.viewport.set( 0, 0, width, height );
74
+ this.scissor.set( 0, 0, width, height );
75
+
76
+ }
77
+
78
+ clone() {
79
+
80
+ return new this.constructor().copy( this );
81
+
82
+ }
83
+
84
+ copy( source ) {
85
+
86
+ this.width = source.width;
87
+ this.height = source.height;
88
+ this.depth = source.depth;
89
+
90
+ this.scissor.copy( source.scissor );
91
+ this.scissorTest = source.scissorTest;
92
+
93
+ this.viewport.copy( source.viewport );
94
+
95
+ this.texture = source.texture.clone();
96
+ this.texture.isRenderTargetTexture = true;
97
+
98
+ // ensure image object is not shared, see #20328
99
+
100
+ const image = Object.assign( {}, source.texture.image );
101
+ this.texture.source = new Source( image );
102
+
103
+ this.depthBuffer = source.depthBuffer;
104
+ this.stencilBuffer = source.stencilBuffer;
105
+
106
+ if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
107
+
108
+ this.samples = source.samples;
109
+
110
+ return this;
111
+
112
+ }
113
+
114
+ dispose() {
115
+
116
+ this.dispatchEvent( { type: 'dispose' } );
117
+
118
+ }
119
+
120
+ }
121
+
122
+ export { RenderTarget };
@@ -15,7 +15,7 @@ class CapsuleGeometry extends LatheGeometry {
15
15
 
16
16
  this.parameters = {
17
17
  radius: radius,
18
- height: length,
18
+ length: length,
19
19
  capSegments: capSegments,
20
20
  radialSegments: radialSegments,
21
21
  };
@@ -30,9 +30,28 @@ class DataTextureLoader extends Loader {
30
30
  loader.setWithCredentials( scope.withCredentials );
31
31
  loader.load( url, function ( buffer ) {
32
32
 
33
- const texData = scope.parse( buffer );
33
+ let texData;
34
34
 
35
- if ( ! texData ) return;
35
+ try {
36
+
37
+ texData = scope.parse( buffer );
38
+
39
+ } catch ( error ) {
40
+
41
+ if ( onError !== undefined ) {
42
+
43
+ onError( error );
44
+
45
+ } else {
46
+
47
+ console.error( error );
48
+ return;
49
+
50
+ }
51
+
52
+ }
53
+
54
+ if ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors
36
55
 
37
56
  if ( texData.image !== undefined ) {
38
57
 
@@ -44,8 +44,6 @@ class WebGLMultipleRenderTargets extends WebGLRenderTarget {
44
44
  this.viewport.set( 0, 0, width, height );
45
45
  this.scissor.set( 0, 0, width, height );
46
46
 
47
- return this;
48
-
49
47
  }
50
48
 
51
49
  copy( source ) {
@@ -1,120 +1,13 @@
1
- import { EventDispatcher } from '../core/EventDispatcher.js';
2
- import { Texture } from '../textures/Texture.js';
3
- import { LinearFilter, NoColorSpace, SRGBColorSpace, sRGBEncoding } from '../constants.js';
4
- import { Vector4 } from '../math/Vector4.js';
5
- import { Source } from '../textures/Source.js';
6
- import { warnOnce } from '../utils.js';
1
+ import { RenderTarget } from '../core/RenderTarget.js';
7
2
 
8
- /*
9
- In options, we can specify:
10
- * Texture parameters for an auto-generated target texture
11
- * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
12
- */
13
- class WebGLRenderTarget extends EventDispatcher {
3
+ class WebGLRenderTarget extends RenderTarget {
14
4
 
15
5
  constructor( width = 1, height = 1, options = {} ) {
16
6
 
17
- super();
7
+ super( width, height, options );
18
8
 
19
9
  this.isWebGLRenderTarget = true;
20
10
 
21
- this.width = width;
22
- this.height = height;
23
- this.depth = 1;
24
-
25
- this.scissor = new Vector4( 0, 0, width, height );
26
- this.scissorTest = false;
27
-
28
- this.viewport = new Vector4( 0, 0, width, height );
29
-
30
- const image = { width: width, height: height, depth: 1 };
31
-
32
- if ( options.encoding !== undefined ) {
33
-
34
- // @deprecated, r152
35
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
36
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
37
-
38
- }
39
-
40
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
41
- this.texture.isRenderTargetTexture = true;
42
-
43
- this.texture.flipY = false;
44
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
45
- this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
46
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
47
-
48
- this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
49
- this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
50
-
51
- this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
52
-
53
- this.samples = options.samples !== undefined ? options.samples : 0;
54
-
55
- }
56
-
57
- setSize( width, height, depth = 1 ) {
58
-
59
- if ( this.width !== width || this.height !== height || this.depth !== depth ) {
60
-
61
- this.width = width;
62
- this.height = height;
63
- this.depth = depth;
64
-
65
- this.texture.image.width = width;
66
- this.texture.image.height = height;
67
- this.texture.image.depth = depth;
68
-
69
- this.dispose();
70
-
71
- }
72
-
73
- this.viewport.set( 0, 0, width, height );
74
- this.scissor.set( 0, 0, width, height );
75
-
76
- }
77
-
78
- clone() {
79
-
80
- return new this.constructor().copy( this );
81
-
82
- }
83
-
84
- copy( source ) {
85
-
86
- this.width = source.width;
87
- this.height = source.height;
88
- this.depth = source.depth;
89
-
90
- this.scissor.copy( source.scissor );
91
- this.scissorTest = source.scissorTest;
92
-
93
- this.viewport.copy( source.viewport );
94
-
95
- this.texture = source.texture.clone();
96
- this.texture.isRenderTargetTexture = true;
97
-
98
- // ensure image object is not shared, see #20328
99
-
100
- const image = Object.assign( {}, source.texture.image );
101
- this.texture.source = new Source( image );
102
-
103
- this.depthBuffer = source.depthBuffer;
104
- this.stencilBuffer = source.stencilBuffer;
105
-
106
- if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
107
-
108
- this.samples = source.samples;
109
-
110
- return this;
111
-
112
- }
113
-
114
- dispose() {
115
-
116
- this.dispatchEvent( { type: 'dispose' } );
117
-
118
11
  }
119
12
 
120
13
  }
@@ -153,7 +153,7 @@ class WebGLRenderer {
153
153
 
154
154
  // physical lights
155
155
 
156
- this.useLegacyLights = true;
156
+ this._useLegacyLights = false;
157
157
 
158
158
  // tone mapping
159
159
 
@@ -796,6 +796,9 @@ class WebGLRenderer {
796
796
  if ( material.wireframe === true ) {
797
797
 
798
798
  index = geometries.getWireframeAttribute( geometry );
799
+
800
+ if ( index === undefined ) return;
801
+
799
802
  rangeFactor = 2;
800
803
 
801
804
  }
@@ -960,7 +963,7 @@ class WebGLRenderer {
960
963
 
961
964
  } );
962
965
 
963
- currentRenderState.setupLights( _this.useLegacyLights );
966
+ currentRenderState.setupLights( _this._useLegacyLights );
964
967
 
965
968
  scene.traverse( function ( object ) {
966
969
 
@@ -1113,7 +1116,7 @@ class WebGLRenderer {
1113
1116
 
1114
1117
  // render scene
1115
1118
 
1116
- currentRenderState.setupLights( _this.useLegacyLights );
1119
+ currentRenderState.setupLights( _this._useLegacyLights );
1117
1120
 
1118
1121
  if ( camera.isArrayCamera ) {
1119
1122
 
@@ -1607,6 +1610,7 @@ class WebGLRenderer {
1607
1610
 
1608
1611
  materialProperties.outputColorSpace = parameters.outputColorSpace;
1609
1612
  materialProperties.instancing = parameters.instancing;
1613
+ materialProperties.instancingColor = parameters.instancingColor;
1610
1614
  materialProperties.skinning = parameters.skinning;
1611
1615
  materialProperties.morphTargets = parameters.morphTargets;
1612
1616
  materialProperties.morphNormals = parameters.morphNormals;
@@ -1635,7 +1639,18 @@ class WebGLRenderer {
1635
1639
  const morphTargets = !! geometry.morphAttributes.position;
1636
1640
  const morphNormals = !! geometry.morphAttributes.normal;
1637
1641
  const morphColors = !! geometry.morphAttributes.color;
1638
- const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;
1642
+
1643
+ let toneMapping = NoToneMapping;
1644
+
1645
+ if ( material.toneMapped ) {
1646
+
1647
+ if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {
1648
+
1649
+ toneMapping = _this.toneMapping;
1650
+
1651
+ }
1652
+
1653
+ }
1639
1654
 
1640
1655
  const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
1641
1656
  const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
@@ -1690,6 +1705,14 @@ class WebGLRenderer {
1690
1705
 
1691
1706
  needsProgramChange = true;
1692
1707
 
1708
+ } else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {
1709
+
1710
+ needsProgramChange = true;
1711
+
1712
+ } else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {
1713
+
1714
+ needsProgramChange = true;
1715
+
1693
1716
  } else if ( materialProperties.envMap !== envMap ) {
1694
1717
 
1695
1718
  needsProgramChange = true;
@@ -2131,7 +2154,16 @@ class WebGLRenderer {
2131
2154
 
2132
2155
  if ( renderTarget.isWebGLCubeRenderTarget ) {
2133
2156
 
2134
- framebuffer = __webglFramebuffer[ activeCubeFace ];
2157
+ if ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {
2158
+
2159
+ framebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];
2160
+
2161
+ } else {
2162
+
2163
+ framebuffer = __webglFramebuffer[ activeCubeFace ];
2164
+
2165
+ }
2166
+
2135
2167
  isCube = true;
2136
2168
 
2137
2169
  } else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
@@ -2140,7 +2172,15 @@ class WebGLRenderer {
2140
2172
 
2141
2173
  } else {
2142
2174
 
2143
- framebuffer = __webglFramebuffer;
2175
+ if ( Array.isArray( __webglFramebuffer ) ) {
2176
+
2177
+ framebuffer = __webglFramebuffer[ activeMipmapLevel ];
2178
+
2179
+ } else {
2180
+
2181
+ framebuffer = __webglFramebuffer;
2182
+
2183
+ }
2144
2184
 
2145
2185
  }
2146
2186
 
@@ -2439,14 +2479,14 @@ class WebGLRenderer {
2439
2479
 
2440
2480
  get physicallyCorrectLights() { // @deprecated, r150
2441
2481
 
2442
- console.warn( 'THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
2482
+ console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
2443
2483
  return ! this.useLegacyLights;
2444
2484
 
2445
2485
  }
2446
2486
 
2447
2487
  set physicallyCorrectLights( value ) { // @deprecated, r150
2448
2488
 
2449
- console.warn( 'THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
2489
+ console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
2450
2490
  this.useLegacyLights = ! value;
2451
2491
 
2452
2492
  }
@@ -2465,6 +2505,20 @@ class WebGLRenderer {
2465
2505
 
2466
2506
  }
2467
2507
 
2508
+ get useLegacyLights() { // @deprecated, r155
2509
+
2510
+ console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
2511
+ return this._useLegacyLights;
2512
+
2513
+ }
2514
+
2515
+ set useLegacyLights( value ) { // @deprecated, r155
2516
+
2517
+ console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
2518
+ this._useLegacyLights = value;
2519
+
2520
+ }
2521
+
2468
2522
  }
2469
2523
 
2470
2524
 
@@ -64,7 +64,7 @@ export default /* glsl */`
64
64
  float cosTheta2Sq = 1.0 - sinTheta2Sq;
65
65
  if ( cosTheta2Sq < 0.0 ) {
66
66
 
67
- return vec3( 1.0 );
67
+ return vec3( 1.0 );
68
68
 
69
69
  }
70
70
 
@@ -73,7 +73,6 @@ export default /* glsl */`
73
73
  // First interface
74
74
  float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
75
75
  float R12 = F_Schlick( R0, 1.0, cosTheta1 );
76
- float R21 = R12;
77
76
  float T121 = 1.0 - R12;
78
77
  float phi12 = 0.0;
79
78
  if ( iridescenceIOR < outsideIOR ) phi12 = PI;
@@ -128,7 +128,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
128
128
 
129
129
  }
130
130
 
131
- } else {
131
+ } else if ( geometryPosition !== undefined ) {
132
132
 
133
133
  const array = geometryPosition.array;
134
134
  version = geometryPosition.version;
@@ -143,6 +143,10 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
143
143
 
144
144
  }
145
145
 
146
+ } else {
147
+
148
+ return;
149
+
146
150
  }
147
151
 
148
152
  const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
@@ -228,7 +228,7 @@ function WebGLMaterials( renderer, properties ) {
228
228
  uniforms.lightMap.value = material.lightMap;
229
229
 
230
230
  // artist-friendly light intensity scaling factor
231
- const scaleFactor = ( renderer.useLegacyLights === true ) ? Math.PI : 1;
231
+ const scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;
232
232
 
233
233
  uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;
234
234
 
@@ -160,6 +160,18 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
160
160
  const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
161
161
  const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
162
162
 
163
+ let toneMapping = NoToneMapping;
164
+
165
+ if ( material.toneMapped ) {
166
+
167
+ if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {
168
+
169
+ toneMapping = renderer.toneMapping;
170
+
171
+ }
172
+
173
+ }
174
+
163
175
  const parameters = {
164
176
 
165
177
  isWebGL2: IS_WEBGL2,
@@ -320,8 +332,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
320
332
  shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
321
333
  shadowMapType: renderer.shadowMap.type,
322
334
 
323
- toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
324
- useLegacyLights: renderer.useLegacyLights,
335
+ toneMapping: toneMapping,
336
+ useLegacyLights: renderer._useLegacyLights,
325
337
 
326
338
  premultipliedAlpha: material.premultipliedAlpha,
327
339