@plastic-software/three 0.167.2 → 0.167.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/three.cjs CHANGED
@@ -13837,9 +13837,9 @@ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D(
13837
13837
 
13838
13838
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13839
13839
 
13840
- var batching_pars_vertex = "#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
13840
+ var batching_pars_vertex = "#ifdef USE_BATCHING_MATRIX\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in int i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
13841
13841
 
13842
- var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";
13842
+ var batching_vertex = "#ifdef USE_BATCHING_MATRIX\n\tmat4 batchingMatrix = getBatchingMatrix( gl_DrawID );\n#elif defined ( USE_BATCHING )\n\tmat4 batchingMatrix = mat4( 1.0 );\n#endif";
13843
13843
 
13844
13844
  var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
13845
13845
 
@@ -19799,6 +19799,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19799
19799
 
19800
19800
  parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
19801
19801
  parameters.batching ? '#define USE_BATCHING' : '',
19802
+ parameters.batchingMatrix ? '#define USE_BATCHING_MATRIX' : '',
19802
19803
  parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
19803
19804
  parameters.instancing ? '#define USE_INSTANCING' : '',
19804
19805
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
@@ -20499,7 +20500,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20499
20500
  }
20500
20501
 
20501
20502
  function getParameters( material, lights, shadows, scene, object ) {
20502
-
20503
20503
  const fog = scene.fog;
20504
20504
  const geometry = object.geometry;
20505
20505
  const environment = material.isMeshStandardMaterial ? scene.environment : null;
@@ -20644,6 +20644,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20644
20644
  precision: precision,
20645
20645
 
20646
20646
  batching: IS_BATCHEDMESH,
20647
+ batchingMatrix: IS_BATCHEDMESH && object._matricesTexture !== null,
20647
20648
  batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
20648
20649
  instancing: IS_INSTANCEDMESH,
20649
20650
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
@@ -20964,6 +20965,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20964
20965
  _programLayers.enable( 20 );
20965
20966
  if ( parameters.batchingColor )
20966
20967
  _programLayers.enable( 21 );
20968
+ if ( parameters.batchingMatrix )
20969
+ _programLayers.enable( 22 );
20967
20970
 
20968
20971
  array.push( _programLayers.mask );
20969
20972
  _programLayers.disableAll();
@@ -30439,6 +30442,14 @@ class WebGLRenderer {
30439
30442
 
30440
30443
  needsProgramChange = true;
30441
30444
 
30445
+ } else if (object.isBatchedMesh && materialProperties.batchingMatrix === false && object._matricesTexture !== null) {
30446
+
30447
+ needsProgramChange = true;
30448
+
30449
+ } else if (object.isBatchedMesh && materialProperties.batchingMatrix === true && object._matricesTexture === null) {
30450
+
30451
+ needsProgramChange = true;
30452
+
30442
30453
  } else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
30443
30454
 
30444
30455
  needsProgramChange = true;
@@ -30629,10 +30640,18 @@ class WebGLRenderer {
30629
30640
  if ( object.isBatchedMesh ) {
30630
30641
 
30631
30642
  p_uniforms.setOptional( _gl, object, 'batchingTexture' );
30632
- p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
30643
+ if ( objects._matricesTexture !== null ) {
30644
+
30645
+ p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
30646
+
30647
+ }
30633
30648
 
30634
30649
  p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
30635
- p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
30650
+ if ( object._indirectTexture !== null ) {
30651
+
30652
+ p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
30653
+
30654
+ }
30636
30655
 
30637
30656
  p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
30638
30657
  if ( object._colorsTexture !== null ) {
@@ -47183,7 +47202,7 @@ class ObjectLoader extends Loader {
47183
47202
  case 'DirectionalLight':
47184
47203
 
47185
47204
  object = new DirectionalLight( data.color, data.intensity );
47186
- object.target = data.target || '';
47205
+ object.target = data.target || '';
47187
47206
 
47188
47207
  break;
47189
47208
 
@@ -47202,7 +47221,7 @@ class ObjectLoader extends Loader {
47202
47221
  case 'SpotLight':
47203
47222
 
47204
47223
  object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
47205
- object.target = data.target || '';
47224
+ object.target = data.target || '';
47206
47225
 
47207
47226
  break;
47208
47227
 
@@ -47479,7 +47498,7 @@ class ObjectLoader extends Loader {
47479
47498
 
47480
47499
  object.traverse( function ( child ) {
47481
47500
 
47482
- if ( child.isDirectionalLight || child.isSpotLight ) {
47501
+ if ( child.isDirectionalLight || child.isSpotLight ) {
47483
47502
 
47484
47503
  const uuid = child.target;
47485
47504
 
@@ -13835,9 +13835,9 @@ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D(
13835
13835
 
13836
13836
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13837
13837
 
13838
- var batching_pars_vertex = "#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
13838
+ var batching_pars_vertex = "#ifdef USE_BATCHING_MATRIX\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in int i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
13839
13839
 
13840
- var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";
13840
+ var batching_vertex = "#ifdef USE_BATCHING_MATRIX\n\tmat4 batchingMatrix = getBatchingMatrix( gl_DrawID );\n#elif defined ( USE_BATCHING )\n\tmat4 batchingMatrix = mat4( 1.0 );\n#endif";
13841
13841
 
13842
13842
  var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
13843
13843
 
@@ -19797,6 +19797,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19797
19797
 
19798
19798
  parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
19799
19799
  parameters.batching ? '#define USE_BATCHING' : '',
19800
+ parameters.batchingMatrix ? '#define USE_BATCHING_MATRIX' : '',
19800
19801
  parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
19801
19802
  parameters.instancing ? '#define USE_INSTANCING' : '',
19802
19803
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
@@ -20497,7 +20498,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20497
20498
  }
20498
20499
 
20499
20500
  function getParameters( material, lights, shadows, scene, object ) {
20500
-
20501
20501
  const fog = scene.fog;
20502
20502
  const geometry = object.geometry;
20503
20503
  const environment = material.isMeshStandardMaterial ? scene.environment : null;
@@ -20642,6 +20642,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20642
20642
  precision: precision,
20643
20643
 
20644
20644
  batching: IS_BATCHEDMESH,
20645
+ batchingMatrix: IS_BATCHEDMESH && object._matricesTexture !== null,
20645
20646
  batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
20646
20647
  instancing: IS_INSTANCEDMESH,
20647
20648
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
@@ -20962,6 +20963,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20962
20963
  _programLayers.enable( 20 );
20963
20964
  if ( parameters.batchingColor )
20964
20965
  _programLayers.enable( 21 );
20966
+ if ( parameters.batchingMatrix )
20967
+ _programLayers.enable( 22 );
20965
20968
 
20966
20969
  array.push( _programLayers.mask );
20967
20970
  _programLayers.disableAll();
@@ -30437,6 +30440,14 @@ class WebGLRenderer {
30437
30440
 
30438
30441
  needsProgramChange = true;
30439
30442
 
30443
+ } else if (object.isBatchedMesh && materialProperties.batchingMatrix === false && object._matricesTexture !== null) {
30444
+
30445
+ needsProgramChange = true;
30446
+
30447
+ } else if (object.isBatchedMesh && materialProperties.batchingMatrix === true && object._matricesTexture === null) {
30448
+
30449
+ needsProgramChange = true;
30450
+
30440
30451
  } else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
30441
30452
 
30442
30453
  needsProgramChange = true;
@@ -30627,10 +30638,18 @@ class WebGLRenderer {
30627
30638
  if ( object.isBatchedMesh ) {
30628
30639
 
30629
30640
  p_uniforms.setOptional( _gl, object, 'batchingTexture' );
30630
- p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
30641
+ if ( objects._matricesTexture !== null ) {
30642
+
30643
+ p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
30644
+
30645
+ }
30631
30646
 
30632
30647
  p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
30633
- p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
30648
+ if ( object._indirectTexture !== null ) {
30649
+
30650
+ p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
30651
+
30652
+ }
30634
30653
 
30635
30654
  p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
30636
30655
  if ( object._colorsTexture !== null ) {
@@ -47181,7 +47200,7 @@ class ObjectLoader extends Loader {
47181
47200
  case 'DirectionalLight':
47182
47201
 
47183
47202
  object = new DirectionalLight( data.color, data.intensity );
47184
- object.target = data.target || '';
47203
+ object.target = data.target || '';
47185
47204
 
47186
47205
  break;
47187
47206
 
@@ -47200,7 +47219,7 @@ class ObjectLoader extends Loader {
47200
47219
  case 'SpotLight':
47201
47220
 
47202
47221
  object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
47203
- object.target = data.target || '';
47222
+ object.target = data.target || '';
47204
47223
 
47205
47224
  break;
47206
47225
 
@@ -47477,7 +47496,7 @@ class ObjectLoader extends Loader {
47477
47496
 
47478
47497
  object.traverse( function ( child ) {
47479
47498
 
47480
- if ( child.isDirectionalLight || child.isSpotLight ) {
47499
+ if ( child.isDirectionalLight || child.isSpotLight ) {
47481
47500
 
47482
47501
  const uuid = child.target;
47483
47502