@plastic-software/three 0.183.3 → 0.183.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/three.cjs CHANGED
@@ -59777,13 +59777,13 @@ var aomap_fragment = "#ifdef USE_AOMAP\n #ifdef USE_AOMAP_TRIPLANAR\n\t\tfloat
59777
59777
 
59778
59778
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
59779
59779
 
59780
- 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\tvec4 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 );\n\t}\n#endif";
59780
+ var batching_pars_vertex = "#ifdef USE_OCTAHEDRAL_NORMALS\n\tattribute vec2 normalOctahedral;\n\tvec3 decodeOctahedralNormal( vec2 value ) {\n\t\tvec3 normal = vec3( value, 1.0 - abs( value.x ) - abs( value.y ) );\n\t\tif ( normal.z < 0.0 ) {\n\t\t\tnormal.xy = ( 1.0 - abs( normal.yx ) ) * vec2( normal.x >= 0.0 ? 1.0 : - 1.0, normal.y >= 0.0 ? 1.0 : - 1.0 );\n\t\t}\n\t\treturn normalize( normal );\n\t}\n#endif\n#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\tvec4 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 );\n\t}\n#endif";
59781
59781
 
59782
59782
  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";
59783
59783
 
59784
59784
  var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
59785
59785
 
59786
- var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
59786
+ var beginnormal_vertex = "#ifdef USE_OCTAHEDRAL_NORMALS\n\tvec3 objectNormal = decodeOctahedralNormal( normalOctahedral );\n#else\n\tvec3 objectNormal = vec3( normal );\n#endif\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
59787
59787
 
59788
59788
  var bsdfs = "float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";
59789
59789
 
@@ -62353,7 +62353,7 @@ class PMREMGenerator {
62353
62353
 
62354
62354
  } else { // Equirectangular
62355
62355
 
62356
- this._setSize( texture.image.width / 2 );
62356
+ this._setSize( texture.image.width / 4 );
62357
62357
 
62358
62358
  }
62359
62359
 
@@ -66237,6 +66237,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
66237
66237
  parameters.batching ? '#define USE_BATCHING' : '',
66238
66238
  parameters.batchingMatrix ? '#define USE_BATCHING_MATRIX' : '',
66239
66239
  parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
66240
+ parameters.normalOctahedral ? '#define USE_OCTAHEDRAL_NORMALS' : '',
66240
66241
  parameters.instancing ? '#define USE_INSTANCING' : '',
66241
66242
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
66242
66243
  parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
@@ -67077,6 +67078,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
67077
67078
 
67078
67079
  const HAS_ALPHAHASH = !! material.alphaHash;
67079
67080
 
67081
+ const HAS_OCTAHEDRAL_NORMALS = object.geometry.attributes.normalOctahedral !== undefined;
67082
+
67080
67083
  const HAS_EXTENSIONS = !! material.extensions;
67081
67084
 
67082
67085
  let toneMapping = NoToneMapping;
@@ -67112,6 +67115,7 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
67112
67115
  batching: IS_BATCHEDMESH,
67113
67116
  batchingMatrix: IS_BATCHEDMESH && object._matricesTexture !== null,
67114
67117
  batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
67118
+ normalOctahedral: HAS_OCTAHEDRAL_NORMALS,
67115
67119
  instancing: IS_INSTANCEDMESH,
67116
67120
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
67117
67121
  instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
@@ -67453,6 +67457,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
67453
67457
  _programLayers.enable( 21 );
67454
67458
  if ( parameters.batchingMatrix )
67455
67459
  _programLayers.enable( 22 );
67460
+ if ( parameters.normalOctahedral )
67461
+ _programLayers.enable( 23 );
67456
67462
 
67457
67463
  array.push( _programLayers.mask );
67458
67464
  _programLayers.disableAll();
@@ -77895,7 +77901,7 @@ class WebGLRenderer {
77895
77901
  if ( object.isBatchedMesh ) {
77896
77902
 
77897
77903
  p_uniforms.setOptional( _gl, object, 'batchingTexture' );
77898
- if ( objects._matricesTexture !== null ) {
77904
+ if ( object._matricesTexture !== null ) {
77899
77905
 
77900
77906
  p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
77901
77907
 
@@ -309,13 +309,13 @@ var aomap_fragment = "#ifdef USE_AOMAP\n #ifdef USE_AOMAP_TRIPLANAR\n\t\tfloat
309
309
 
310
310
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
311
311
 
312
- 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\tvec4 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 );\n\t}\n#endif";
312
+ var batching_pars_vertex = "#ifdef USE_OCTAHEDRAL_NORMALS\n\tattribute vec2 normalOctahedral;\n\tvec3 decodeOctahedralNormal( vec2 value ) {\n\t\tvec3 normal = vec3( value, 1.0 - abs( value.x ) - abs( value.y ) );\n\t\tif ( normal.z < 0.0 ) {\n\t\t\tnormal.xy = ( 1.0 - abs( normal.yx ) ) * vec2( normal.x >= 0.0 ? 1.0 : - 1.0, normal.y >= 0.0 ? 1.0 : - 1.0 );\n\t\t}\n\t\treturn normalize( normal );\n\t}\n#endif\n#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\tvec4 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 );\n\t}\n#endif";
313
313
 
314
314
  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";
315
315
 
316
316
  var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
317
317
 
318
- var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
318
+ var beginnormal_vertex = "#ifdef USE_OCTAHEDRAL_NORMALS\n\tvec3 objectNormal = decodeOctahedralNormal( normalOctahedral );\n#else\n\tvec3 objectNormal = vec3( normal );\n#endif\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
319
319
 
320
320
  var bsdfs = "float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";
321
321
 
@@ -2885,7 +2885,7 @@ class PMREMGenerator {
2885
2885
 
2886
2886
  } else { // Equirectangular
2887
2887
 
2888
- this._setSize( texture.image.width / 2 );
2888
+ this._setSize( texture.image.width / 4 );
2889
2889
 
2890
2890
  }
2891
2891
 
@@ -6769,6 +6769,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6769
6769
  parameters.batching ? '#define USE_BATCHING' : '',
6770
6770
  parameters.batchingMatrix ? '#define USE_BATCHING_MATRIX' : '',
6771
6771
  parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
6772
+ parameters.normalOctahedral ? '#define USE_OCTAHEDRAL_NORMALS' : '',
6772
6773
  parameters.instancing ? '#define USE_INSTANCING' : '',
6773
6774
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
6774
6775
  parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
@@ -7609,6 +7610,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
7609
7610
 
7610
7611
  const HAS_ALPHAHASH = !! material.alphaHash;
7611
7612
 
7613
+ const HAS_OCTAHEDRAL_NORMALS = object.geometry.attributes.normalOctahedral !== undefined;
7614
+
7612
7615
  const HAS_EXTENSIONS = !! material.extensions;
7613
7616
 
7614
7617
  let toneMapping = NoToneMapping;
@@ -7644,6 +7647,7 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
7644
7647
  batching: IS_BATCHEDMESH,
7645
7648
  batchingMatrix: IS_BATCHEDMESH && object._matricesTexture !== null,
7646
7649
  batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
7650
+ normalOctahedral: HAS_OCTAHEDRAL_NORMALS,
7647
7651
  instancing: IS_INSTANCEDMESH,
7648
7652
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
7649
7653
  instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
@@ -7985,6 +7989,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
7985
7989
  _programLayers.enable( 21 );
7986
7990
  if ( parameters.batchingMatrix )
7987
7991
  _programLayers.enable( 22 );
7992
+ if ( parameters.normalOctahedral )
7993
+ _programLayers.enable( 23 );
7988
7994
 
7989
7995
  array.push( _programLayers.mask );
7990
7996
  _programLayers.disableAll();
@@ -18427,7 +18433,7 @@ class WebGLRenderer {
18427
18433
  if ( object.isBatchedMesh ) {
18428
18434
 
18429
18435
  p_uniforms.setOptional( _gl, object, 'batchingTexture' );
18430
- if ( objects._matricesTexture !== null ) {
18436
+ if ( object._matricesTexture !== null ) {
18431
18437
 
18432
18438
  p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
18433
18439