|
@@ -3,7 +3,7 @@
|
|
* Copyright 2010-2021 Three.js Authors
|
|
* Copyright 2010-2021 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
*/
|
|
-const REVISION = '134';
|
|
|
|
|
|
+const REVISION = '135dev';
|
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
const CullFaceNone = 0;
|
|
const CullFaceNone = 0;
|
|
@@ -12804,7 +12804,7 @@ var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\tretur
|
|
|
|
|
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
|
|
|
|
-var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
|
|
|
|
|
|
+var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
|
|
|
|
|
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
|
|
|
|
@@ -13186,8 +13186,7 @@ const UniformsLib = {
|
|
flipEnvMap: { value: - 1 },
|
|
flipEnvMap: { value: - 1 },
|
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
ior: { value: 1.5 }, // standard, physical
|
|
ior: { value: 1.5 }, // standard, physical
|
|
- refractionRatio: { value: 0.98 },
|
|
|
|
- maxMipLevel: { value: 0 }
|
|
|
|
|
|
+ refractionRatio: { value: 0.98 }
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
@@ -19100,7 +19099,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
vertexColors: material.vertexColors,
|
|
vertexColors: material.vertexColors,
|
|
vertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
|
|
vertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
|
|
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,
|
|
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,
|
|
- uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
|
|
|
|
|
|
+ uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
|
|
|
|
|
|
fog: !! fog,
|
|
fog: !! fog,
|
|
useFog: material.fog,
|
|
useFog: material.fog,
|
|
@@ -21919,14 +21918,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- function generateMipmap( target, texture, width, height, depth = 1 ) {
|
|
|
|
|
|
+ function generateMipmap( target ) {
|
|
|
|
|
|
_gl.generateMipmap( target );
|
|
_gl.generateMipmap( target );
|
|
|
|
|
|
- const textureProperties = properties.get( texture );
|
|
|
|
-
|
|
|
|
- textureProperties.__maxMipLevel = Math.log2( Math.max( width, height, depth ) );
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function getInternalFormat( internalFormatName, glFormat, glType, encoding ) {
|
|
function getInternalFormat( internalFormatName, glFormat, glType, encoding ) {
|
|
@@ -22430,12 +22425,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
}
|
|
}
|
|
|
|
|
|
texture.generateMipmaps = false;
|
|
texture.generateMipmaps = false;
|
|
- textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
- textureProperties.__maxMipLevel = 0;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22465,17 +22458,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
|
|
-
|
|
|
|
} else if ( texture.isDataTexture2DArray ) {
|
|
} else if ( texture.isDataTexture2DArray ) {
|
|
|
|
|
|
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
- textureProperties.__maxMipLevel = 0;
|
|
|
|
|
|
|
|
} else if ( texture.isDataTexture3D ) {
|
|
} else if ( texture.isDataTexture3D ) {
|
|
|
|
|
|
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
- textureProperties.__maxMipLevel = 0;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -22495,12 +22484,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
}
|
|
}
|
|
|
|
|
|
texture.generateMipmaps = false;
|
|
texture.generateMipmaps = false;
|
|
- textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
|
|
state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
|
|
- textureProperties.__maxMipLevel = 0;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22508,7 +22495,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
|
|
|
|
- generateMipmap( textureType, texture, image.width, image.height );
|
|
|
|
|
|
+ generateMipmap( textureType );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22593,8 +22580,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
mipmaps = texture.mipmaps;
|
|
mipmaps = texture.mipmaps;
|
|
@@ -22630,14 +22615,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- textureProperties.__maxMipLevel = mipmaps.length;
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
|
|
|
|
// We assume images for cube map have the same size.
|
|
// We assume images for cube map have the same size.
|
|
- generateMipmap( 34067, texture, image.width, image.height );
|
|
|
|
|
|
+ generateMipmap( 34067 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22971,7 +22954,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
|
|
|
|
- generateMipmap( 34067, texture, renderTarget.width, renderTarget.height );
|
|
|
|
|
|
+ generateMipmap( 34067 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22992,7 +22975,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
|
|
|
|
- generateMipmap( 3553, attachment, renderTarget.width, renderTarget.height );
|
|
|
|
|
|
+ generateMipmap( 3553 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -23027,7 +23010,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
|
|
|
|
- generateMipmap( glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth );
|
|
|
|
|
|
+ generateMipmap( glTextureType );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -23061,7 +23044,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
|
|
|
|
state.bindTexture( target, webglTexture );
|
|
state.bindTexture( target, webglTexture );
|
|
- generateMipmap( target, texture, renderTarget.width, renderTarget.height );
|
|
|
|
|
|
+ generateMipmap( target );
|
|
state.unbindTexture();
|
|
state.unbindTexture();
|
|
|
|
|
|
}
|
|
}
|
|
@@ -24573,14 +24556,6 @@ function WebGLMaterials( properties ) {
|
|
uniforms.ior.value = material.ior;
|
|
uniforms.ior.value = material.ior;
|
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
|
|
|
|
- const maxMipLevel = properties.get( envMap ).__maxMipLevel;
|
|
|
|
-
|
|
|
|
- if ( maxMipLevel !== undefined ) {
|
|
|
|
-
|
|
|
|
- uniforms.maxMipLevel.value = maxMipLevel;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if ( material.lightMap ) {
|
|
if ( material.lightMap ) {
|
|
@@ -25382,6 +25357,8 @@ function WebGLRenderer( parameters = {} ) {
|
|
failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
|
|
failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );
|
|
|
|
+
|
|
// event listeners must be registered before WebGL context is created, see #12753
|
|
// event listeners must be registered before WebGL context is created, see #12753
|
|
|
|
|
|
_canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
_canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
@@ -35710,7 +35687,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
|
|
|
this.transmissionMap = null;
|
|
this.transmissionMap = null;
|
|
|
|
|
|
- this.thickness = 0.01;
|
|
|
|
|
|
+ this.thickness = 0;
|
|
this.thicknessMap = null;
|
|
this.thicknessMap = null;
|
|
this.attenuationDistance = 0.0;
|
|
this.attenuationDistance = 0.0;
|
|
this.attenuationColor = new Color( 1, 1, 1 );
|
|
this.attenuationColor = new Color( 1, 1, 1 );
|