|
@@ -5,7 +5,7 @@
|
|
*/
|
|
*/
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
-const REVISION = '155';
|
|
|
|
|
|
+const REVISION = '156';
|
|
|
|
|
|
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 };
|
|
@@ -129,6 +129,8 @@ const RGBA_ASTC_10x10_Format = 37819;
|
|
const RGBA_ASTC_12x10_Format = 37820;
|
|
const RGBA_ASTC_12x10_Format = 37820;
|
|
const RGBA_ASTC_12x12_Format = 37821;
|
|
const RGBA_ASTC_12x12_Format = 37821;
|
|
const RGBA_BPTC_Format = 36492;
|
|
const RGBA_BPTC_Format = 36492;
|
|
|
|
+const RGB_BPTC_SIGNED_Format = 36494;
|
|
|
|
+const RGB_BPTC_UNSIGNED_Format = 36495;
|
|
const RED_RGTC1_Format = 36283;
|
|
const RED_RGTC1_Format = 36283;
|
|
const SIGNED_RED_RGTC1_Format = 36284;
|
|
const SIGNED_RED_RGTC1_Format = 36284;
|
|
const RED_GREEN_RGTC2_Format = 36285;
|
|
const RED_GREEN_RGTC2_Format = 36285;
|
|
@@ -161,6 +163,7 @@ const NoColorSpace = '';
|
|
const SRGBColorSpace = 'srgb';
|
|
const SRGBColorSpace = 'srgb';
|
|
const LinearSRGBColorSpace = 'srgb-linear';
|
|
const LinearSRGBColorSpace = 'srgb-linear';
|
|
const DisplayP3ColorSpace = 'display-p3';
|
|
const DisplayP3ColorSpace = 'display-p3';
|
|
|
|
+const LinearDisplayP3ColorSpace = 'display-p3-linear';
|
|
|
|
|
|
const ZeroStencilOp = 0;
|
|
const ZeroStencilOp = 0;
|
|
const KeepStencilOp = 7680;
|
|
const KeepStencilOp = 7680;
|
|
@@ -921,8 +924,8 @@ class Vector2 {
|
|
|
|
|
|
roundToZero() {
|
|
roundToZero() {
|
|
|
|
|
|
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
|
|
|
|
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
|
|
|
|
|
|
+ this.x = Math.trunc( this.x );
|
|
|
|
+ this.y = Math.trunc( this.y );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
@@ -1530,6 +1533,14 @@ function createElementNS( name ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function createCanvasElement() {
|
|
|
|
+
|
|
|
|
+ const canvas = createElementNS( 'canvas' );
|
|
|
|
+ canvas.style.display = 'block';
|
|
|
|
+ return canvas;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
const _cache = {};
|
|
const _cache = {};
|
|
|
|
|
|
function warnOnce( message ) {
|
|
function warnOnce( message ) {
|
|
@@ -1921,7 +1932,7 @@ function serializeImage( image ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-let textureId = 0;
|
|
|
|
|
|
+let _textureId = 0;
|
|
|
|
|
|
class Texture extends EventDispatcher {
|
|
class Texture extends EventDispatcher {
|
|
|
|
|
|
@@ -1931,7 +1942,7 @@ class Texture extends EventDispatcher {
|
|
|
|
|
|
this.isTexture = true;
|
|
this.isTexture = true;
|
|
|
|
|
|
- Object.defineProperty( this, 'id', { value: textureId ++ } );
|
|
|
|
|
|
+ Object.defineProperty( this, 'id', { value: _textureId ++ } );
|
|
|
|
|
|
this.uuid = generateUUID();
|
|
this.uuid = generateUUID();
|
|
|
|
|
|
@@ -2741,10 +2752,10 @@ class Vector4 {
|
|
|
|
|
|
roundToZero() {
|
|
roundToZero() {
|
|
|
|
|
|
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
|
|
|
|
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
|
|
|
|
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
|
|
|
|
- this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
|
|
|
|
|
|
+ this.x = Math.trunc( this.x );
|
|
|
|
+ this.y = Math.trunc( this.y );
|
|
|
|
+ this.z = Math.trunc( this.z );
|
|
|
|
+ this.w = Math.trunc( this.w );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
@@ -4252,9 +4263,9 @@ class Vector3 {
|
|
|
|
|
|
roundToZero() {
|
|
roundToZero() {
|
|
|
|
|
|
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
|
|
|
|
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
|
|
|
|
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
|
|
|
|
|
|
+ this.x = Math.trunc( this.x );
|
|
|
|
+ this.y = Math.trunc( this.y );
|
|
|
|
+ this.z = Math.trunc( this.z );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
@@ -7484,20 +7495,7 @@ class Object3D extends EventDispatcher {
|
|
|
|
|
|
clear() {
|
|
clear() {
|
|
|
|
|
|
- for ( let i = 0; i < this.children.length; i ++ ) {
|
|
|
|
-
|
|
|
|
- const object = this.children[ i ];
|
|
|
|
-
|
|
|
|
- object.parent = null;
|
|
|
|
-
|
|
|
|
- object.dispatchEvent( _removedEvent );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- this.children.length = 0;
|
|
|
|
-
|
|
|
|
- return this;
|
|
|
|
-
|
|
|
|
|
|
+ return this.remove( ... this.children );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -8388,7 +8386,7 @@ class Triangle {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-let materialId = 0;
|
|
|
|
|
|
+let _materialId = 0;
|
|
|
|
|
|
class Material extends EventDispatcher {
|
|
class Material extends EventDispatcher {
|
|
|
|
|
|
@@ -8398,7 +8396,7 @@ class Material extends EventDispatcher {
|
|
|
|
|
|
this.isMaterial = true;
|
|
this.isMaterial = true;
|
|
|
|
|
|
- Object.defineProperty( this, 'id', { value: materialId ++ } );
|
|
|
|
|
|
+ Object.defineProperty( this, 'id', { value: _materialId ++ } );
|
|
|
|
|
|
this.uuid = generateUUID();
|
|
this.uuid = generateUUID();
|
|
|
|
|
|
@@ -10367,7 +10365,7 @@ class Float64BufferAttribute extends BufferAttribute {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-let _id$1 = 0;
|
|
|
|
|
|
+let _id$2 = 0;
|
|
|
|
|
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
@@ -10384,7 +10382,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
this.isBufferGeometry = true;
|
|
this.isBufferGeometry = true;
|
|
|
|
|
|
- Object.defineProperty( this, 'id', { value: _id$1 ++ } );
|
|
|
|
|
|
+ Object.defineProperty( this, 'id', { value: _id$2 ++ } );
|
|
|
|
|
|
this.uuid = generateUUID();
|
|
this.uuid = generateUUID();
|
|
|
|
|
|
@@ -11489,7 +11487,7 @@ class Mesh extends Object3D {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- this.material = source.material;
|
|
|
|
|
|
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
this.geometry = source.geometry;
|
|
this.geometry = source.geometry;
|
|
|
|
|
|
return this;
|
|
return this;
|
|
@@ -13779,7 +13777,7 @@ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_
|
|
|
|
|
|
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
|
|
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
|
|
|
|
|
|
-var map_fragment = "#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif";
|
|
|
|
|
|
+var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
|
|
|
|
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
|
|
|
|
@@ -13873,7 +13871,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
|
|
|
|
|
|
const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
|
|
|
|
-const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
|
|
|
|
|
|
+const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\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}";
|
|
|
|
|
|
@@ -14693,24 +14691,15 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const xr = renderer.xr;
|
|
|
|
- const environmentBlendMode = xr.getEnvironmentBlendMode();
|
|
|
|
|
|
+ const environmentBlendMode = renderer.xr.getEnvironmentBlendMode();
|
|
|
|
|
|
- switch ( environmentBlendMode ) {
|
|
|
|
|
|
+ if ( environmentBlendMode === 'additive' ) {
|
|
|
|
|
|
- case 'opaque':
|
|
|
|
- forceClear = true;
|
|
|
|
- break;
|
|
|
|
|
|
+ state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
|
|
|
|
|
|
- case 'additive':
|
|
|
|
- state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
|
|
|
|
- forceClear = true;
|
|
|
|
- break;
|
|
|
|
|
|
+ } else if ( environmentBlendMode === 'alpha-blend' ) {
|
|
|
|
|
|
- case 'alpha-blend':
|
|
|
|
- state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
|
|
|
|
- forceClear = true;
|
|
|
|
- break;
|
|
|
|
|
|
+ state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -19825,6 +19814,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
|
|
|
|
|
|
+ parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
|
|
+
|
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
|
|
|
|
@@ -20059,7 +20050,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-let _id = 0;
|
|
|
|
|
|
+let _id$1 = 0;
|
|
|
|
|
|
class WebGLShaderCache {
|
|
class WebGLShaderCache {
|
|
|
|
|
|
@@ -20173,7 +20164,7 @@ class WebGLShaderStage {
|
|
|
|
|
|
constructor( code ) {
|
|
constructor( code ) {
|
|
|
|
|
|
- this.id = _id ++;
|
|
|
|
|
|
+ this.id = _id$1 ++;
|
|
|
|
|
|
this.code = code;
|
|
this.code = code;
|
|
this.usedTimes = 0;
|
|
this.usedTimes = 0;
|
|
@@ -20512,6 +20503,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
toneMapping: toneMapping,
|
|
toneMapping: toneMapping,
|
|
useLegacyLights: renderer._useLegacyLights,
|
|
useLegacyLights: renderer._useLegacyLights,
|
|
|
|
|
|
|
|
+ decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( material.map.colorSpace === SRGBColorSpace ),
|
|
|
|
+
|
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
|
|
|
|
doubleSided: material.side === DoubleSide,
|
|
doubleSided: material.side === DoubleSide,
|
|
@@ -20713,6 +20706,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
_programLayers.enable( 17 );
|
|
_programLayers.enable( 17 );
|
|
if ( parameters.pointsUvs )
|
|
if ( parameters.pointsUvs )
|
|
_programLayers.enable( 18 );
|
|
_programLayers.enable( 18 );
|
|
|
|
+ if ( parameters.decodeVideoTexture )
|
|
|
|
+ _programLayers.enable( 19 );
|
|
|
|
|
|
array.push( _programLayers.mask );
|
|
array.push( _programLayers.mask );
|
|
|
|
|
|
@@ -24273,7 +24268,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
|
|
|
|
let glType = utils.convert( texture.type ),
|
|
let glType = utils.convert( texture.type ),
|
|
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
|
|
|
|
+ glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
|
|
|
|
|
|
setTextureParameters( textureType, texture, supportsMips );
|
|
setTextureParameters( textureType, texture, supportsMips );
|
|
|
|
|
|
@@ -25552,13 +25547,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
const format = texture.format;
|
|
const format = texture.format;
|
|
const type = texture.type;
|
|
const type = texture.type;
|
|
|
|
|
|
- if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
|
|
|
|
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
|
|
|
|
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
|
|
|
|
// sRGB
|
|
// sRGB
|
|
|
|
|
|
- if ( colorSpace === SRGBColorSpace ) {
|
|
|
|
|
|
+ if ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) {
|
|
|
|
|
|
if ( isWebGL2 === false ) {
|
|
if ( isWebGL2 === false ) {
|
|
|
|
|
|
@@ -25624,6 +25619,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const LinearTransferFunction = 0;
|
|
|
|
+const SRGBTransferFunction = 1;
|
|
|
|
+
|
|
function WebGLUtils( gl, extensions, capabilities ) {
|
|
function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
const isWebGL2 = capabilities.isWebGL2;
|
|
const isWebGL2 = capabilities.isWebGL2;
|
|
@@ -25632,6 +25630,8 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
let extension;
|
|
let extension;
|
|
|
|
|
|
|
|
+ const transferFunction = ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) ? SRGBTransferFunction : LinearTransferFunction;
|
|
|
|
+
|
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
@@ -25698,7 +25698,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
|
|
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
|
|
|
|
|
|
- if ( colorSpace === SRGBColorSpace ) {
|
|
|
|
|
|
+ if ( transferFunction === SRGBTransferFunction ) {
|
|
|
|
|
|
extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
|
|
extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
|
|
|
|
|
|
@@ -25783,8 +25783,8 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
if ( extension !== null ) {
|
|
if ( extension !== null ) {
|
|
|
|
|
|
- if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
|
|
- if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
|
|
|
|
+ if ( p === RGB_ETC2_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
|
|
+ if ( p === RGBA_ETC2_EAC_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -25806,20 +25806,20 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
if ( extension !== null ) {
|
|
if ( extension !== null ) {
|
|
|
|
|
|
- if ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
|
|
- if ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
|
|
|
|
|
|
+ if ( p === RGBA_ASTC_4x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_5x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_5x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_6x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_6x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_8x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_8x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_8x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_10x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_10x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_10x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_10x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_12x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
|
|
+ if ( p === RGBA_ASTC_12x12_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -25831,13 +25831,15 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
|
|
|
// BPTC
|
|
// BPTC
|
|
|
|
|
|
- if ( p === RGBA_BPTC_Format ) {
|
|
|
|
|
|
+ if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {
|
|
|
|
|
|
extension = extensions.get( 'EXT_texture_compression_bptc' );
|
|
extension = extensions.get( 'EXT_texture_compression_bptc' );
|
|
|
|
|
|
if ( extension !== null ) {
|
|
if ( extension !== null ) {
|
|
|
|
|
|
- if ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
|
|
|
|
+ if ( p === RGBA_BPTC_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
|
|
+ if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
|
|
|
|
+ if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -26879,14 +26881,6 @@ class WebXRManager extends EventDispatcher {
|
|
camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
|
|
camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
|
|
camera.updateMatrixWorld( true );
|
|
camera.updateMatrixWorld( true );
|
|
|
|
|
|
- const children = camera.children;
|
|
|
|
-
|
|
|
|
- for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
|
|
-
|
|
|
|
- children[ i ].updateMatrixWorld( true );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
camera.projectionMatrix.copy( cameraXR.projectionMatrix );
|
|
camera.projectionMatrix.copy( cameraXR.projectionMatrix );
|
|
camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
|
|
camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
|
|
|
|
|
|
@@ -28049,14 +28043,6 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-function createCanvasElement() {
|
|
|
|
-
|
|
|
|
- const canvas = createElementNS( 'canvas' );
|
|
|
|
- canvas.style.display = 'block';
|
|
|
|
- return canvas;
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
class WebGLRenderer {
|
|
class WebGLRenderer {
|
|
|
|
|
|
constructor( parameters = {} ) {
|
|
constructor( parameters = {} ) {
|
|
@@ -29782,48 +29768,28 @@ class WebGLRenderer {
|
|
|
|
|
|
if ( refreshProgram || _currentCamera !== camera ) {
|
|
if ( refreshProgram || _currentCamera !== camera ) {
|
|
|
|
|
|
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
|
|
-
|
|
|
|
- if ( capabilities.logarithmicDepthBuffer ) {
|
|
|
|
|
|
+ // common camera uniforms
|
|
|
|
|
|
- p_uniforms.setValue( _gl, 'logDepthBufFC',
|
|
|
|
- 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ( _currentCamera !== camera ) {
|
|
|
|
|
|
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
|
|
+ p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
|
|
|
|
- _currentCamera = camera;
|
|
|
|
|
|
+ const uCamPos = p_uniforms.map.cameraPosition;
|
|
|
|
|
|
- // lighting uniforms depend on the camera so enforce an update
|
|
|
|
- // now, in case this material supports lights - or later, when
|
|
|
|
- // the next material that does gets activated:
|
|
|
|
|
|
+ if ( uCamPos !== undefined ) {
|
|
|
|
|
|
- refreshMaterial = true; // set to true on material change
|
|
|
|
- refreshLights = true; // remains set until update done
|
|
|
|
|
|
+ uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // load material specific uniforms
|
|
|
|
- // (shader material also gets them for the sake of genericity)
|
|
|
|
-
|
|
|
|
- if ( material.isShaderMaterial ||
|
|
|
|
- material.isMeshPhongMaterial ||
|
|
|
|
- material.isMeshToonMaterial ||
|
|
|
|
- material.isMeshStandardMaterial ||
|
|
|
|
- material.envMap ) {
|
|
|
|
-
|
|
|
|
- const uCamPos = p_uniforms.map.cameraPosition;
|
|
|
|
-
|
|
|
|
- if ( uCamPos !== undefined ) {
|
|
|
|
-
|
|
|
|
- uCamPos.setValue( _gl,
|
|
|
|
- _vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
|
|
|
|
+ if ( capabilities.logarithmicDepthBuffer ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ p_uniforms.setValue( _gl, 'logDepthBufFC',
|
|
|
|
+ 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
|
|
|
|
+
|
|
if ( material.isMeshPhongMaterial ||
|
|
if ( material.isMeshPhongMaterial ||
|
|
material.isMeshToonMaterial ||
|
|
material.isMeshToonMaterial ||
|
|
material.isMeshLambertMaterial ||
|
|
material.isMeshLambertMaterial ||
|
|
@@ -29835,16 +29801,16 @@ class WebGLRenderer {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( material.isMeshPhongMaterial ||
|
|
|
|
- material.isMeshToonMaterial ||
|
|
|
|
- material.isMeshLambertMaterial ||
|
|
|
|
- material.isMeshBasicMaterial ||
|
|
|
|
- material.isMeshStandardMaterial ||
|
|
|
|
- material.isShaderMaterial ||
|
|
|
|
- material.isShadowMaterial ||
|
|
|
|
- object.isSkinnedMesh ) {
|
|
|
|
|
|
+ if ( _currentCamera !== camera ) {
|
|
|
|
|
|
- p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
|
|
|
|
+ _currentCamera = camera;
|
|
|
|
+
|
|
|
|
+ // lighting uniforms depend on the camera so enforce an update
|
|
|
|
+ // now, in case this material supports lights - or later, when
|
|
|
|
+ // the next material that does gets activated:
|
|
|
|
+
|
|
|
|
+ refreshMaterial = true; // set to true on material change
|
|
|
|
+ refreshLights = true; // remains set until update done
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -32375,7 +32341,7 @@ class Line extends Object3D {
|
|
|
|
|
|
super.copy( source, recursive );
|
|
super.copy( source, recursive );
|
|
|
|
|
|
- this.material = source.material;
|
|
|
|
|
|
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
this.geometry = source.geometry;
|
|
this.geometry = source.geometry;
|
|
|
|
|
|
return this;
|
|
return this;
|
|
@@ -32696,7 +32662,7 @@ class Points extends Object3D {
|
|
|
|
|
|
super.copy( source, recursive );
|
|
super.copy( source, recursive );
|
|
|
|
|
|
- this.material = source.material;
|
|
|
|
|
|
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
this.geometry = source.geometry;
|
|
this.geometry = source.geometry;
|
|
|
|
|
|
return this;
|
|
return this;
|
|
@@ -42532,8 +42498,6 @@ class DataTextureLoader extends Loader {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors
|
|
|
|
-
|
|
|
|
if ( texData.image !== undefined ) {
|
|
if ( texData.image !== undefined ) {
|
|
|
|
|
|
texture.image = texData.image;
|
|
texture.image = texData.image;
|
|
@@ -45939,6 +45903,12 @@ class Audio extends Object3D {
|
|
|
|
|
|
disconnect() {
|
|
disconnect() {
|
|
|
|
|
|
|
|
+ if ( this._connected === false ) {
|
|
|
|
+
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if ( this.filters.length > 0 ) {
|
|
if ( this.filters.length > 0 ) {
|
|
|
|
|
|
this.source.disconnect( this.filters[ 0 ] );
|
|
this.source.disconnect( this.filters[ 0 ] );
|
|
@@ -49187,7 +49157,7 @@ class Uniform {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-let id = 0;
|
|
|
|
|
|
+let _id = 0;
|
|
|
|
|
|
class UniformsGroup extends EventDispatcher {
|
|
class UniformsGroup extends EventDispatcher {
|
|
|
|
|
|
@@ -49197,7 +49167,7 @@ class UniformsGroup extends EventDispatcher {
|
|
|
|
|
|
this.isUniformsGroup = true;
|
|
this.isUniformsGroup = true;
|
|
|
|
|
|
- Object.defineProperty( this, 'id', { value: id ++ } );
|
|
|
|
|
|
+ Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
|
|
|
|
this.name = '';
|
|
this.name = '';
|
|
|
|
|
|
@@ -51641,6 +51611,7 @@ exports.LineCurve3 = LineCurve3;
|
|
exports.LineDashedMaterial = LineDashedMaterial;
|
|
exports.LineDashedMaterial = LineDashedMaterial;
|
|
exports.LineLoop = LineLoop;
|
|
exports.LineLoop = LineLoop;
|
|
exports.LineSegments = LineSegments;
|
|
exports.LineSegments = LineSegments;
|
|
|
|
+exports.LinearDisplayP3ColorSpace = LinearDisplayP3ColorSpace;
|
|
exports.LinearEncoding = LinearEncoding;
|
|
exports.LinearEncoding = LinearEncoding;
|
|
exports.LinearFilter = LinearFilter;
|
|
exports.LinearFilter = LinearFilter;
|
|
exports.LinearInterpolant = LinearInterpolant;
|
|
exports.LinearInterpolant = LinearInterpolant;
|
|
@@ -51757,6 +51728,8 @@ exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
|
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
|
|
+exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
|
|
|
|
+exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
|
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
exports.RGB_ETC2_Format = RGB_ETC2_Format;
|
|
exports.RGB_ETC2_Format = RGB_ETC2_Format;
|
|
exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
|
|
exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
|
|
@@ -51866,4 +51839,5 @@ exports.ZeroFactor = ZeroFactor;
|
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
exports._SRGBAFormat = _SRGBAFormat;
|
|
exports._SRGBAFormat = _SRGBAFormat;
|
|
|
|
+exports.createCanvasElement = createCanvasElement;
|
|
exports.sRGBEncoding = sRGBEncoding;
|
|
exports.sRGBEncoding = sRGBEncoding;
|