|
@@ -23404,12 +23404,12 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const _basePosition = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
|
+const _baseVector = /*@__PURE__*/ new Vector4();
|
|
|
|
|
|
|
|
const _skinIndex = /*@__PURE__*/ new Vector4();
|
|
const _skinIndex = /*@__PURE__*/ new Vector4();
|
|
|
const _skinWeight = /*@__PURE__*/ new Vector4();
|
|
const _skinWeight = /*@__PURE__*/ new Vector4();
|
|
|
|
|
|
|
|
-const _vector3 = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
|
+const _vector4 = /*@__PURE__*/ new Vector4();
|
|
|
const _matrix4 = /*@__PURE__*/ new Matrix4();
|
|
const _matrix4 = /*@__PURE__*/ new Matrix4();
|
|
|
const _vertex = /*@__PURE__*/ new Vector3();
|
|
const _vertex = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
|
@@ -23705,12 +23705,12 @@ class SkinnedMesh extends Mesh {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Applies the bone transform associated with the given index to the given
|
|
* Applies the bone transform associated with the given index to the given
|
|
|
- * vertex position. Returns the updated vector.
|
|
|
|
|
|
|
+ * vector. Can be used to transform positions or direction vectors by providing
|
|
|
|
|
+ * a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector.
|
|
|
*
|
|
*
|
|
|
* @param {number} index - The vertex index.
|
|
* @param {number} index - The vertex index.
|
|
|
- * @param {Vector3} target - The target object that is used to store the method's result.
|
|
|
|
|
- * the skinned mesh's world matrix will be used instead.
|
|
|
|
|
- * @return {Vector3} The updated vertex position.
|
|
|
|
|
|
|
+ * @param {Vector3|Vector4} target - The target object that is used to store the method's result.
|
|
|
|
|
+ * @return {Vector3|Vector4} The updated vertex attribute data.
|
|
|
*/
|
|
*/
|
|
|
applyBoneTransform( index, target ) {
|
|
applyBoneTransform( index, target ) {
|
|
|
|
|
|
|
@@ -23720,9 +23720,19 @@ class SkinnedMesh extends Mesh {
|
|
|
_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );
|
|
_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );
|
|
|
_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );
|
|
_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );
|
|
|
|
|
|
|
|
- _basePosition.copy( target ).applyMatrix4( this.bindMatrix );
|
|
|
|
|
|
|
+ if ( target.isVector4 ) {
|
|
|
|
|
+
|
|
|
|
|
+ _baseVector.copy( target );
|
|
|
|
|
+ target.set( 0, 0, 0, 0 );
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ _baseVector.set( ...target, 1 );
|
|
|
|
|
+ target.set( 0, 0, 0 );
|
|
|
|
|
|
|
|
- target.set( 0, 0, 0 );
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _baseVector.applyMatrix4( this.bindMatrix );
|
|
|
|
|
|
|
|
for ( let i = 0; i < 4; i ++ ) {
|
|
for ( let i = 0; i < 4; i ++ ) {
|
|
|
|
|
|
|
@@ -23734,12 +23744,19 @@ class SkinnedMesh extends Mesh {
|
|
|
|
|
|
|
|
_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );
|
|
_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );
|
|
|
|
|
|
|
|
- target.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );
|
|
|
|
|
|
|
+ target.addScaledVector( _vector4.copy( _baseVector ).applyMatrix4( _matrix4 ), weight );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ( target.isVector4 ) {
|
|
|
|
|
+
|
|
|
|
|
+ // ensure the homogenous coordinate remains unchanged after vector operations
|
|
|
|
|
+ target.w = _baseVector.w;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return target.applyMatrix4( this.bindMatrixInverse );
|
|
return target.applyMatrix4( this.bindMatrixInverse );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -24524,7 +24541,15 @@ class InstancedMesh extends Mesh {
|
|
|
*/
|
|
*/
|
|
|
getColorAt( index, color ) {
|
|
getColorAt( index, color ) {
|
|
|
|
|
|
|
|
- return color.fromArray( this.instanceColor.array, index * 3 );
|
|
|
|
|
|
|
+ if ( this.instanceColor === null ) {
|
|
|
|
|
+
|
|
|
|
|
+ return color.setRGB( 1, 1, 1 );
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ return color.fromArray( this.instanceColor.array, index * 3 );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -26732,7 +26757,23 @@ class BatchedMesh extends Mesh {
|
|
|
getColorAt( instanceId, color ) {
|
|
getColorAt( instanceId, color ) {
|
|
|
|
|
|
|
|
this.validateInstanceId( instanceId );
|
|
this.validateInstanceId( instanceId );
|
|
|
- return color.fromArray( this._colorsTexture.image.data, instanceId * 4 );
|
|
|
|
|
|
|
+ if ( this._colorsTexture === null ) {
|
|
|
|
|
+
|
|
|
|
|
+ if ( color.isVector4 ) {
|
|
|
|
|
+
|
|
|
|
|
+ return color.set( 1, 1, 1, 1 );
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ return color.setRGB( 1, 1, 1 );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ return color.fromArray( this._colorsTexture.image.data, instanceId * 4 );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -39088,7 +39129,7 @@ class MeshToonMaterial extends Material {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Gradient map for toon shading. It's required to set
|
|
* Gradient map for toon shading. It's required to set
|
|
|
- * {@link Texture#minFilter} and {@link Texture#magFilter} to {@linkNearestFilter}
|
|
|
|
|
|
|
+ * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
|
|
|
* when using this type of texture.
|
|
* when using this type of texture.
|
|
|
*
|
|
*
|
|
|
* @type {?Texture}
|
|
* @type {?Texture}
|
|
@@ -59838,9 +59879,9 @@ var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
|
|
|
|
|
|
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}";
|
|
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}";
|
|
|
|
|
|
|
|
-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";
|
|
|
|
|
|
|
+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";
|
|
|
|
|
|
|
|
-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";
|
|
|
|
|
|
|
+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";
|
|
|
|
|
|
|
|
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";
|
|
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";
|
|
|
|
|
|
|
@@ -59994,7 +60035,7 @@ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\n
|
|
|
|
|
|
|
|
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}";
|
|
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}";
|
|
|
|
|
|
|
|
-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}";
|
|
|
|
|
|
|
+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}";
|
|
|
|
|
|
|
|
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}";
|
|
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}";
|
|
|
|
|
|
|
@@ -60230,7 +60271,6 @@ const UniformsLib = {
|
|
|
|
|
|
|
|
envMap: { value: null },
|
|
envMap: { value: null },
|
|
|
envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
|
|
envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
|
|
|
- flipEnvMap: { value: -1 },
|
|
|
|
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
|
ior: { value: 1.5 }, // physical
|
|
ior: { value: 1.5 }, // physical
|
|
|
refractionRatio: { value: 0.98 }, // basic, lambert, phong
|
|
refractionRatio: { value: 0.98 }, // basic, lambert, phong
|
|
@@ -60651,7 +60691,6 @@ const ShaderLib = {
|
|
|
|
|
|
|
|
uniforms: {
|
|
uniforms: {
|
|
|
envMap: { value: null },
|
|
envMap: { value: null },
|
|
|
- flipEnvMap: { value: -1 },
|
|
|
|
|
backgroundBlurriness: { value: 0 },
|
|
backgroundBlurriness: { value: 0 },
|
|
|
backgroundIntensity: { value: 1 },
|
|
backgroundIntensity: { value: 1 },
|
|
|
backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
|
|
backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
|
|
@@ -60779,8 +60818,10 @@ ShaderLib.physical = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const _rgb = { r: 0, b: 0, g: 0 };
|
|
const _rgb = { r: 0, b: 0, g: 0 };
|
|
|
-const _e1$1 = /*@__PURE__*/ new Euler();
|
|
|
|
|
const _m1$1 = /*@__PURE__*/ new Matrix4();
|
|
const _m1$1 = /*@__PURE__*/ new Matrix4();
|
|
|
|
|
+const _m$1 = /*@__PURE__*/ new Matrix3();
|
|
|
|
|
+
|
|
|
|
|
+_m$1.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );
|
|
|
|
|
|
|
|
function WebGLBackground( renderer, environments, state, objects, alpha, premultipliedAlpha ) {
|
|
function WebGLBackground( renderer, environments, state, objects, alpha, premultipliedAlpha ) {
|
|
|
|
|
|
|
@@ -60898,24 +60939,22 @@ function WebGLBackground( renderer, environments, state, objects, alpha, premult
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- _e1$1.copy( scene.backgroundRotation );
|
|
|
|
|
|
|
|
|
|
- // accommodate left-handed frame
|
|
|
|
|
- _e1$1.x *= -1; _e1$1.y *= -1; _e1$1.z *= -1;
|
|
|
|
|
|
|
+ boxMesh.material.uniforms.envMap.value = background;
|
|
|
|
|
+ boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
|
|
|
+ boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()
|
|
|
|
|
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( scene.backgroundRotation ) ).transpose();
|
|
|
|
|
|
|
|
if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
|
|
if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
|
|
|
|
|
|
|
|
- // environment maps which are not cube render targets or PMREMs follow a different convention
|
|
|
|
|
- _e1$1.y *= -1;
|
|
|
|
|
- _e1$1.z *= -1;
|
|
|
|
|
|
|
+ boxMesh.material.uniforms.backgroundRotation.value.premultiply( _m$1 );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- boxMesh.material.uniforms.envMap.value = background;
|
|
|
|
|
- boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? -1 : 1;
|
|
|
|
|
- boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
|
|
|
- boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
|
|
|
- boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
|
|
|
|
|
|
|
+
|
|
|
boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
|
|
boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
|
|
|
|
|
|
|
|
if ( currentBackground !== background ||
|
|
if ( currentBackground !== background ||
|
|
@@ -71332,14 +71371,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
|
|
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
|
|
|
|
|
|
- const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
|
|
|
|
|
- const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
|
|
|
- const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
|
|
|
|
|
+ const isImageBitmap = ( typeof ImageBitmap !== 'undefined' && texture.image instanceof ImageBitmap );
|
|
|
|
|
+
|
|
|
|
|
+ if ( isImageBitmap === false ) {
|
|
|
|
|
+
|
|
|
|
|
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
|
|
|
|
|
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
|
|
|
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
|
|
|
+
|
|
|
|
|
+ _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
+ _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
|
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
|
|
|
|
|
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
|
image = verifyColorSpace( texture, image );
|
|
image = verifyColorSpace( texture, image );
|
|
@@ -74305,8 +74351,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const _e1 = /*@__PURE__*/ new Euler();
|
|
|
|
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
|
|
|
+const _m = /*@__PURE__*/ new Matrix3();
|
|
|
|
|
+
|
|
|
|
|
+_m.set( -1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 );
|
|
|
|
|
|
|
|
function WebGLMaterials( renderer, properties ) {
|
|
function WebGLMaterials( renderer, properties ) {
|
|
|
|
|
|
|
@@ -74537,23 +74585,16 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
|
|
|
|
|
uniforms.envMap.value = envMap;
|
|
uniforms.envMap.value = envMap;
|
|
|
|
|
|
|
|
- _e1.copy( envMapRotation );
|
|
|
|
|
|
|
+ // note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()
|
|
|
|
|
+ uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( envMapRotation ) ).transpose();
|
|
|
|
|
|
|
|
- // accommodate left-handed frame
|
|
|
|
|
- _e1.x *= -1; _e1.y *= -1; _e1.z *= -1;
|
|
|
|
|
|
|
|
|
|
if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
|
|
if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
|
|
|
|
|
|
|
|
- // environment maps which are not cube render targets or PMREMs follow a different convention
|
|
|
|
|
- _e1.y *= -1;
|
|
|
|
|
- _e1.z *= -1;
|
|
|
|
|
|
|
+ uniforms.envMapRotation.value.premultiply( _m );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
|
|
|
|
|
-
|
|
|
|
|
- uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
|
|
|
|
|
-
|
|
|
|
|
uniforms.reflectivity.value = material.reflectivity;
|
|
uniforms.reflectivity.value = material.reflectivity;
|
|
|
uniforms.ior.value = material.ior;
|
|
uniforms.ior.value = material.ior;
|
|
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
uniforms.refractionRatio.value = material.refractionRatio;
|