Skip to content

Commit b7fa531

Browse files
committed
Updated builds.
1 parent fd1bddf commit b7fa531

File tree

9 files changed

+1447
-611
lines changed

9 files changed

+1447
-611
lines changed

build/three.cjs

Lines changed: 87 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23404,12 +23404,12 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
2340423404

2340523405
}
2340623406

23407-
const _basePosition = /*@__PURE__*/ new Vector3();
23407+
const _baseVector = /*@__PURE__*/ new Vector4();
2340823408

2340923409
const _skinIndex = /*@__PURE__*/ new Vector4();
2341023410
const _skinWeight = /*@__PURE__*/ new Vector4();
2341123411

23412-
const _vector3 = /*@__PURE__*/ new Vector3();
23412+
const _vector4 = /*@__PURE__*/ new Vector4();
2341323413
const _matrix4 = /*@__PURE__*/ new Matrix4();
2341423414
const _vertex = /*@__PURE__*/ new Vector3();
2341523415

@@ -23705,12 +23705,12 @@ class SkinnedMesh extends Mesh {
2370523705

2370623706
/**
2370723707
* Applies the bone transform associated with the given index to the given
23708-
* vertex position. Returns the updated vector.
23708+
* vector. Can be used to transform positions or direction vectors by providing
23709+
* a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector.
2370923710
*
2371023711
* @param {number} index - The vertex index.
23711-
* @param {Vector3} target - The target object that is used to store the method's result.
23712-
* the skinned mesh's world matrix will be used instead.
23713-
* @return {Vector3} The updated vertex position.
23712+
* @param {Vector3|Vector4} target - The target object that is used to store the method's result.
23713+
* @return {Vector3|Vector4} The updated vertex attribute data.
2371423714
*/
2371523715
applyBoneTransform( index, target ) {
2371623716

@@ -23720,9 +23720,19 @@ class SkinnedMesh extends Mesh {
2372023720
_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );
2372123721
_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );
2372223722

23723-
_basePosition.copy( target ).applyMatrix4( this.bindMatrix );
23723+
if ( target.isVector4 ) {
23724+
23725+
_baseVector.copy( target );
23726+
target.set( 0, 0, 0, 0 );
23727+
23728+
} else {
23729+
23730+
_baseVector.set( ...target, 1 );
23731+
target.set( 0, 0, 0 );
2372423732

23725-
target.set( 0, 0, 0 );
23733+
}
23734+
23735+
_baseVector.applyMatrix4( this.bindMatrix );
2372623736

2372723737
for ( let i = 0; i < 4; i ++ ) {
2372823738

@@ -23734,12 +23744,19 @@ class SkinnedMesh extends Mesh {
2373423744

2373523745
_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );
2373623746

23737-
target.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );
23747+
target.addScaledVector( _vector4.copy( _baseVector ).applyMatrix4( _matrix4 ), weight );
2373823748

2373923749
}
2374023750

2374123751
}
2374223752

23753+
if ( target.isVector4 ) {
23754+
23755+
// ensure the homogenous coordinate remains unchanged after vector operations
23756+
target.w = _baseVector.w;
23757+
23758+
}
23759+
2374323760
return target.applyMatrix4( this.bindMatrixInverse );
2374423761

2374523762
}
@@ -24524,7 +24541,15 @@ class InstancedMesh extends Mesh {
2452424541
*/
2452524542
getColorAt( index, color ) {
2452624543

24527-
return color.fromArray( this.instanceColor.array, index * 3 );
24544+
if ( this.instanceColor === null ) {
24545+
24546+
return color.setRGB( 1, 1, 1 );
24547+
24548+
} else {
24549+
24550+
return color.fromArray( this.instanceColor.array, index * 3 );
24551+
24552+
}
2452824553

2452924554
}
2453024555

@@ -26732,7 +26757,23 @@ class BatchedMesh extends Mesh {
2673226757
getColorAt( instanceId, color ) {
2673326758

2673426759
this.validateInstanceId( instanceId );
26735-
return color.fromArray( this._colorsTexture.image.data, instanceId * 4 );
26760+
if ( this._colorsTexture === null ) {
26761+
26762+
if ( color.isVector4 ) {
26763+
26764+
return color.set( 1, 1, 1, 1 );
26765+
26766+
} else {
26767+
26768+
return color.setRGB( 1, 1, 1 );
26769+
26770+
}
26771+
26772+
} else {
26773+
26774+
return color.fromArray( this._colorsTexture.image.data, instanceId * 4 );
26775+
26776+
}
2673626777

2673726778
}
2673826779

@@ -39088,7 +39129,7 @@ class MeshToonMaterial extends Material {
3908839129

3908939130
/**
3909039131
* Gradient map for toon shading. It's required to set
39091-
* {@link Texture#minFilter} and {@link Texture#magFilter} to {@linkNearestFilter}
39132+
* {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
3909239133
* when using this type of texture.
3909339134
*
3909439135
* @type {?Texture}
@@ -59838,9 +59879,9 @@ var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
5983859879

5983959880
var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
5984059881

59841-
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, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif";
59882+
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, envMapRotation * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif";
5984259883

59843-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif";
59884+
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif";
5984459885

5984559886
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\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";
5984659887

@@ -59994,7 +60035,7 @@ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\n
5999460035

5999560036
const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
5999660037

59997-
const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
60038+
const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
5999860039

5999960040
const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
6000060041

@@ -60230,7 +60271,6 @@ const UniformsLib = {
6023060271

6023160272
envMap: { value: null },
6023260273
envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
60233-
flipEnvMap: { value: -1 },
6023460274
reflectivity: { value: 1.0 }, // basic, lambert, phong
6023560275
ior: { value: 1.5 }, // physical
6023660276
refractionRatio: { value: 0.98 }, // basic, lambert, phong
@@ -60651,7 +60691,6 @@ const ShaderLib = {
6065160691

6065260692
uniforms: {
6065360693
envMap: { value: null },
60654-
flipEnvMap: { value: -1 },
6065560694
backgroundBlurriness: { value: 0 },
6065660695
backgroundIntensity: { value: 1 },
6065760696
backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
@@ -60779,8 +60818,10 @@ ShaderLib.physical = {
6077960818
};
6078060819

6078160820
const _rgb = { r: 0, b: 0, g: 0 };
60782-
const _e1$1 = /*@__PURE__*/ new Euler();
6078360821
const _m1$1 = /*@__PURE__*/ new Matrix4();
60822+
const _m$1 = /*@__PURE__*/ new Matrix3();
60823+
60824+
_m$1.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );
6078460825

6078560826
function WebGLBackground( renderer, environments, state, objects, alpha, premultipliedAlpha ) {
6078660827

@@ -60898,24 +60939,22 @@ function WebGLBackground( renderer, environments, state, objects, alpha, premult
6089860939

6089960940
}
6090060941

60901-
_e1$1.copy( scene.backgroundRotation );
6090260942

60903-
// accommodate left-handed frame
60904-
_e1$1.x *= -1; _e1$1.y *= -1; _e1$1.z *= -1;
60943+
boxMesh.material.uniforms.envMap.value = background;
60944+
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
60945+
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
60946+
60947+
60948+
// note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()
60949+
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( scene.backgroundRotation ) ).transpose();
6090560950

6090660951
if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
6090760952

60908-
// environment maps which are not cube render targets or PMREMs follow a different convention
60909-
_e1$1.y *= -1;
60910-
_e1$1.z *= -1;
60953+
boxMesh.material.uniforms.backgroundRotation.value.premultiply( _m$1 );
6091160954

6091260955
}
6091360956

60914-
boxMesh.material.uniforms.envMap.value = background;
60915-
boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? -1 : 1;
60916-
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
60917-
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
60918-
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
60957+
6091960958
boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
6092060959

6092160960
if ( currentBackground !== background ||
@@ -71332,14 +71371,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
7133271371

7133371372
state.activeTexture( _gl.TEXTURE0 + slot );
7133471373

71335-
const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
71336-
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
71337-
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
71374+
const isImageBitmap = ( typeof ImageBitmap !== 'undefined' && texture.image instanceof ImageBitmap );
71375+
71376+
if ( isImageBitmap === false ) {
71377+
71378+
const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
71379+
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
71380+
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
71381+
71382+
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
71383+
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
71384+
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
71385+
71386+
}
7133871387

71339-
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
71340-
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
7134171388
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
71342-
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
7134371389

7134471390
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
7134571391
image = verifyColorSpace( texture, image );
@@ -74305,8 +74351,10 @@ class WebXRManager extends EventDispatcher {
7430574351

7430674352
}
7430774353

74308-
const _e1 = /*@__PURE__*/ new Euler();
7430974354
const _m1 = /*@__PURE__*/ new Matrix4();
74355+
const _m = /*@__PURE__*/ new Matrix3();
74356+
74357+
_m.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );
7431074358

7431174359
function WebGLMaterials( renderer, properties ) {
7431274360

@@ -74537,23 +74585,16 @@ function WebGLMaterials( renderer, properties ) {
7453774585

7453874586
uniforms.envMap.value = envMap;
7453974587

74540-
_e1.copy( envMapRotation );
74588+
// note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()
74589+
uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( envMapRotation ) ).transpose();
7454174590

74542-
// accommodate left-handed frame
74543-
_e1.x *= -1; _e1.y *= -1; _e1.z *= -1;
7454474591

7454574592
if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
7454674593

74547-
// environment maps which are not cube render targets or PMREMs follow a different convention
74548-
_e1.y *= -1;
74549-
_e1.z *= -1;
74594+
uniforms.envMapRotation.value.premultiply( _m );
7455074595

7455174596
}
7455274597

74553-
uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
74554-
74555-
uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
74556-
7455774598
uniforms.reflectivity.value = material.reflectivity;
7455874599
uniforms.ior.value = material.ior;
7455974600
uniforms.refractionRatio.value = material.refractionRatio;

0 commit comments

Comments
 (0)