super-three 0.155.0 → 0.156.0
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 +107 -125
- package/build/three.js +107 -125
- package/build/three.min.js +1 -1
- package/build/three.module.js +104 -126
- package/build/three.module.min.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +13 -5
- package/examples/jsm/csm/CSMShader.js +35 -1
- package/examples/jsm/libs/tween.module.js +790 -735
- package/examples/jsm/libs/utif.module.js +1644 -1558
- package/examples/jsm/loaders/DDSLoader.js +46 -3
- package/examples/jsm/loaders/EXRLoader.js +4 -4
- package/examples/jsm/loaders/FBXLoader.js +2 -0
- package/examples/jsm/loaders/GLTFLoader.js +17 -7
- package/examples/jsm/loaders/KTX2Loader.js +126 -77
- package/examples/jsm/loaders/LogLuvLoader.js +2 -2
- package/examples/jsm/loaders/MMDLoader.js +10 -7
- package/examples/jsm/loaders/RGBELoader.js +48 -66
- package/examples/jsm/loaders/STLLoader.js +7 -0
- package/examples/jsm/nodes/Nodes.js +3 -0
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +28 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +18 -3
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +2 -4
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +31 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +55 -33
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +3 -0
- package/examples/jsm/nodes/accessors/Object3DNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureNode.js +6 -2
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +29 -0
- package/examples/jsm/nodes/core/AttributeNode.js +2 -2
- package/examples/jsm/nodes/core/Node.js +17 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +94 -12
- package/examples/jsm/nodes/core/NodeUniform.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +58 -0
- package/examples/jsm/nodes/core/PropertyNode.js +2 -0
- package/examples/jsm/nodes/core/StackNode.js +4 -4
- package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
- package/examples/jsm/nodes/display/ViewportNode.js +19 -5
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +12 -3
- package/examples/jsm/nodes/math/HashNode.js +35 -0
- package/examples/jsm/nodes/shadernode/ShaderNode.js +4 -0
- package/examples/jsm/nodes/utils/SplitNode.js +1 -1
- package/examples/jsm/postprocessing/FilmPass.js +3 -5
- package/examples/jsm/postprocessing/RenderPass.js +30 -12
- package/examples/jsm/postprocessing/SAOPass.js +23 -98
- package/examples/jsm/postprocessing/SSAOPass.js +10 -30
- package/examples/jsm/renderers/common/Backend.js +11 -8
- package/examples/jsm/renderers/common/Binding.js +6 -0
- package/examples/jsm/renderers/common/Bindings.js +5 -4
- package/examples/jsm/renderers/common/Pipelines.js +2 -2
- package/examples/jsm/renderers/common/RenderContexts.js +26 -1
- package/examples/jsm/renderers/common/RenderList.js +12 -4
- package/examples/jsm/renderers/common/RenderObject.js +6 -2
- package/examples/jsm/renderers/common/Renderer.js +12 -3
- package/examples/jsm/renderers/common/SampledTexture.js +2 -1
- package/examples/jsm/renderers/common/Sampler.js +1 -1
- package/examples/jsm/renderers/common/StorageBuffer.js +1 -1
- package/examples/jsm/renderers/common/Textures.js +155 -15
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +1 -1
- package/examples/jsm/renderers/common/nodes/Nodes.js +43 -9
- package/examples/jsm/renderers/webgl/WebGLBackend.js +607 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +118 -17
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +84 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +26 -0
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +529 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +199 -0
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +242 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +340 -0
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +279 -40
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +18 -2
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +89 -59
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +15 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -9
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +26 -135
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +6 -5
- package/examples/jsm/shaders/FilmShader.js +11 -54
- package/examples/jsm/shaders/SAOShader.js +0 -13
- package/examples/jsm/shaders/SSAOShader.js +33 -26
- package/package.json +1 -1
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +6 -0
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +1 -14
- package/src/core/UniformsGroup.js +2 -2
- package/src/loaders/DataTextureLoader.js +0 -2
- package/src/materials/Material.js +2 -2
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +3 -3
- package/src/math/Vector4.js +4 -4
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/renderers/WebGLRenderer.js +21 -49
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +11 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
- package/src/renderers/webgl/WebGLBackground.js +5 -14
- package/src/renderers/webgl/WebGLProgram.js +2 -0
- package/src/renderers/webgl/WebGLPrograms.js +5 -1
- package/src/renderers/webgl/WebGLTextures.js +4 -4
- package/src/renderers/webgl/WebGLUtils.js +27 -20
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +9 -1
- /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +0 -0
- /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +0 -0
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '156';
|
|
9
9
|
|
|
10
10
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
11
11
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -129,6 +129,8 @@ const RGBA_ASTC_10x10_Format = 37819;
|
|
|
129
129
|
const RGBA_ASTC_12x10_Format = 37820;
|
|
130
130
|
const RGBA_ASTC_12x12_Format = 37821;
|
|
131
131
|
const RGBA_BPTC_Format = 36492;
|
|
132
|
+
const RGB_BPTC_SIGNED_Format = 36494;
|
|
133
|
+
const RGB_BPTC_UNSIGNED_Format = 36495;
|
|
132
134
|
const RED_RGTC1_Format = 36283;
|
|
133
135
|
const SIGNED_RED_RGTC1_Format = 36284;
|
|
134
136
|
const RED_GREEN_RGTC2_Format = 36285;
|
|
@@ -161,6 +163,7 @@ const NoColorSpace = '';
|
|
|
161
163
|
const SRGBColorSpace = 'srgb';
|
|
162
164
|
const LinearSRGBColorSpace = 'srgb-linear';
|
|
163
165
|
const DisplayP3ColorSpace = 'display-p3';
|
|
166
|
+
const LinearDisplayP3ColorSpace = 'display-p3-linear';
|
|
164
167
|
|
|
165
168
|
const ZeroStencilOp = 0;
|
|
166
169
|
const KeepStencilOp = 7680;
|
|
@@ -921,8 +924,8 @@ class Vector2 {
|
|
|
921
924
|
|
|
922
925
|
roundToZero() {
|
|
923
926
|
|
|
924
|
-
this.x =
|
|
925
|
-
this.y =
|
|
927
|
+
this.x = Math.trunc( this.x );
|
|
928
|
+
this.y = Math.trunc( this.y );
|
|
926
929
|
|
|
927
930
|
return this;
|
|
928
931
|
|
|
@@ -1530,6 +1533,14 @@ function createElementNS( name ) {
|
|
|
1530
1533
|
|
|
1531
1534
|
}
|
|
1532
1535
|
|
|
1536
|
+
function createCanvasElement() {
|
|
1537
|
+
|
|
1538
|
+
const canvas = createElementNS( 'canvas' );
|
|
1539
|
+
canvas.style.display = 'block';
|
|
1540
|
+
return canvas;
|
|
1541
|
+
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1533
1544
|
const _cache = {};
|
|
1534
1545
|
|
|
1535
1546
|
function warnOnce( message ) {
|
|
@@ -1921,7 +1932,7 @@ function serializeImage( image ) {
|
|
|
1921
1932
|
|
|
1922
1933
|
}
|
|
1923
1934
|
|
|
1924
|
-
let
|
|
1935
|
+
let _textureId = 0;
|
|
1925
1936
|
|
|
1926
1937
|
class Texture extends EventDispatcher {
|
|
1927
1938
|
|
|
@@ -1931,7 +1942,7 @@ class Texture extends EventDispatcher {
|
|
|
1931
1942
|
|
|
1932
1943
|
this.isTexture = true;
|
|
1933
1944
|
|
|
1934
|
-
Object.defineProperty( this, 'id', { value:
|
|
1945
|
+
Object.defineProperty( this, 'id', { value: _textureId ++ } );
|
|
1935
1946
|
|
|
1936
1947
|
this.uuid = generateUUID();
|
|
1937
1948
|
|
|
@@ -2741,10 +2752,10 @@ class Vector4 {
|
|
|
2741
2752
|
|
|
2742
2753
|
roundToZero() {
|
|
2743
2754
|
|
|
2744
|
-
this.x =
|
|
2745
|
-
this.y =
|
|
2746
|
-
this.z =
|
|
2747
|
-
this.w =
|
|
2755
|
+
this.x = Math.trunc( this.x );
|
|
2756
|
+
this.y = Math.trunc( this.y );
|
|
2757
|
+
this.z = Math.trunc( this.z );
|
|
2758
|
+
this.w = Math.trunc( this.w );
|
|
2748
2759
|
|
|
2749
2760
|
return this;
|
|
2750
2761
|
|
|
@@ -4252,9 +4263,9 @@ class Vector3 {
|
|
|
4252
4263
|
|
|
4253
4264
|
roundToZero() {
|
|
4254
4265
|
|
|
4255
|
-
this.x =
|
|
4256
|
-
this.y =
|
|
4257
|
-
this.z =
|
|
4266
|
+
this.x = Math.trunc( this.x );
|
|
4267
|
+
this.y = Math.trunc( this.y );
|
|
4268
|
+
this.z = Math.trunc( this.z );
|
|
4258
4269
|
|
|
4259
4270
|
return this;
|
|
4260
4271
|
|
|
@@ -7484,20 +7495,7 @@ class Object3D extends EventDispatcher {
|
|
|
7484
7495
|
|
|
7485
7496
|
clear() {
|
|
7486
7497
|
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
const object = this.children[ i ];
|
|
7490
|
-
|
|
7491
|
-
object.parent = null;
|
|
7492
|
-
|
|
7493
|
-
object.dispatchEvent( _removedEvent );
|
|
7494
|
-
|
|
7495
|
-
}
|
|
7496
|
-
|
|
7497
|
-
this.children.length = 0;
|
|
7498
|
-
|
|
7499
|
-
return this;
|
|
7500
|
-
|
|
7498
|
+
return this.remove( ... this.children );
|
|
7501
7499
|
|
|
7502
7500
|
}
|
|
7503
7501
|
|
|
@@ -8388,7 +8386,7 @@ class Triangle {
|
|
|
8388
8386
|
|
|
8389
8387
|
}
|
|
8390
8388
|
|
|
8391
|
-
let
|
|
8389
|
+
let _materialId = 0;
|
|
8392
8390
|
|
|
8393
8391
|
class Material extends EventDispatcher {
|
|
8394
8392
|
|
|
@@ -8398,7 +8396,7 @@ class Material extends EventDispatcher {
|
|
|
8398
8396
|
|
|
8399
8397
|
this.isMaterial = true;
|
|
8400
8398
|
|
|
8401
|
-
Object.defineProperty( this, 'id', { value:
|
|
8399
|
+
Object.defineProperty( this, 'id', { value: _materialId ++ } );
|
|
8402
8400
|
|
|
8403
8401
|
this.uuid = generateUUID();
|
|
8404
8402
|
|
|
@@ -10367,7 +10365,7 @@ class Float64BufferAttribute extends BufferAttribute {
|
|
|
10367
10365
|
|
|
10368
10366
|
}
|
|
10369
10367
|
|
|
10370
|
-
let _id$
|
|
10368
|
+
let _id$2 = 0;
|
|
10371
10369
|
|
|
10372
10370
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
10373
10371
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
@@ -10384,7 +10382,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
10384
10382
|
|
|
10385
10383
|
this.isBufferGeometry = true;
|
|
10386
10384
|
|
|
10387
|
-
Object.defineProperty( this, 'id', { value: _id$
|
|
10385
|
+
Object.defineProperty( this, 'id', { value: _id$2 ++ } );
|
|
10388
10386
|
|
|
10389
10387
|
this.uuid = generateUUID();
|
|
10390
10388
|
|
|
@@ -11489,7 +11487,7 @@ class Mesh extends Object3D {
|
|
|
11489
11487
|
|
|
11490
11488
|
}
|
|
11491
11489
|
|
|
11492
|
-
this.material = source.material;
|
|
11490
|
+
this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
11493
11491
|
this.geometry = source.geometry;
|
|
11494
11492
|
|
|
11495
11493
|
return this;
|
|
@@ -13779,7 +13777,7 @@ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_
|
|
|
13779
13777
|
|
|
13780
13778
|
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";
|
|
13781
13779
|
|
|
13782
|
-
var map_fragment = "#ifdef USE_MAP\n\
|
|
13780
|
+
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";
|
|
13783
13781
|
|
|
13784
13782
|
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
13785
13783
|
|
|
@@ -13873,7 +13871,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
|
|
|
13873
13871
|
|
|
13874
13872
|
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}";
|
|
13875
13873
|
|
|
13876
|
-
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}";
|
|
13874
|
+
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}";
|
|
13877
13875
|
|
|
13878
13876
|
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}";
|
|
13879
13877
|
|
|
@@ -14693,24 +14691,15 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
14693
14691
|
|
|
14694
14692
|
}
|
|
14695
14693
|
|
|
14696
|
-
const
|
|
14697
|
-
const environmentBlendMode = xr.getEnvironmentBlendMode();
|
|
14694
|
+
const environmentBlendMode = renderer.xr.getEnvironmentBlendMode();
|
|
14698
14695
|
|
|
14699
|
-
|
|
14696
|
+
if ( environmentBlendMode === 'additive' ) {
|
|
14700
14697
|
|
|
14701
|
-
|
|
14702
|
-
forceClear = true;
|
|
14703
|
-
break;
|
|
14698
|
+
state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
|
|
14704
14699
|
|
|
14705
|
-
|
|
14706
|
-
state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
|
|
14707
|
-
forceClear = true;
|
|
14708
|
-
break;
|
|
14700
|
+
} else if ( environmentBlendMode === 'alpha-blend' ) {
|
|
14709
14701
|
|
|
14710
|
-
|
|
14711
|
-
state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
|
|
14712
|
-
forceClear = true;
|
|
14713
|
-
break;
|
|
14702
|
+
state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
|
|
14714
14703
|
|
|
14715
14704
|
}
|
|
14716
14705
|
|
|
@@ -19825,6 +19814,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
19825
19814
|
|
|
19826
19815
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19827
19816
|
|
|
19817
|
+
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
19818
|
+
|
|
19828
19819
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
19829
19820
|
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
19830
19821
|
|
|
@@ -20059,7 +20050,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20059
20050
|
|
|
20060
20051
|
}
|
|
20061
20052
|
|
|
20062
|
-
let _id = 0;
|
|
20053
|
+
let _id$1 = 0;
|
|
20063
20054
|
|
|
20064
20055
|
class WebGLShaderCache {
|
|
20065
20056
|
|
|
@@ -20173,7 +20164,7 @@ class WebGLShaderStage {
|
|
|
20173
20164
|
|
|
20174
20165
|
constructor( code ) {
|
|
20175
20166
|
|
|
20176
|
-
this.id = _id ++;
|
|
20167
|
+
this.id = _id$1 ++;
|
|
20177
20168
|
|
|
20178
20169
|
this.code = code;
|
|
20179
20170
|
this.usedTimes = 0;
|
|
@@ -20512,6 +20503,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20512
20503
|
toneMapping: toneMapping,
|
|
20513
20504
|
useLegacyLights: renderer._useLegacyLights,
|
|
20514
20505
|
|
|
20506
|
+
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( material.map.colorSpace === SRGBColorSpace ),
|
|
20507
|
+
|
|
20515
20508
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
20516
20509
|
|
|
20517
20510
|
doubleSided: material.side === DoubleSide,
|
|
@@ -20713,6 +20706,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20713
20706
|
_programLayers.enable( 17 );
|
|
20714
20707
|
if ( parameters.pointsUvs )
|
|
20715
20708
|
_programLayers.enable( 18 );
|
|
20709
|
+
if ( parameters.decodeVideoTexture )
|
|
20710
|
+
_programLayers.enable( 19 );
|
|
20716
20711
|
|
|
20717
20712
|
array.push( _programLayers.mask );
|
|
20718
20713
|
|
|
@@ -24273,7 +24268,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24273
24268
|
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24274
24269
|
|
|
24275
24270
|
let glType = utils.convert( texture.type ),
|
|
24276
|
-
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
24271
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
|
|
24277
24272
|
|
|
24278
24273
|
setTextureParameters( textureType, texture, supportsMips );
|
|
24279
24274
|
|
|
@@ -25552,13 +25547,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25552
25547
|
const format = texture.format;
|
|
25553
25548
|
const type = texture.type;
|
|
25554
25549
|
|
|
25555
|
-
if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
25550
|
+
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
25556
25551
|
|
|
25557
25552
|
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
25558
25553
|
|
|
25559
25554
|
// sRGB
|
|
25560
25555
|
|
|
25561
|
-
if ( colorSpace === SRGBColorSpace ) {
|
|
25556
|
+
if ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) {
|
|
25562
25557
|
|
|
25563
25558
|
if ( isWebGL2 === false ) {
|
|
25564
25559
|
|
|
@@ -25624,6 +25619,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25624
25619
|
|
|
25625
25620
|
}
|
|
25626
25621
|
|
|
25622
|
+
const LinearTransferFunction = 0;
|
|
25623
|
+
const SRGBTransferFunction = 1;
|
|
25624
|
+
|
|
25627
25625
|
function WebGLUtils( gl, extensions, capabilities ) {
|
|
25628
25626
|
|
|
25629
25627
|
const isWebGL2 = capabilities.isWebGL2;
|
|
@@ -25632,6 +25630,8 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
25632
25630
|
|
|
25633
25631
|
let extension;
|
|
25634
25632
|
|
|
25633
|
+
const transferFunction = ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) ? SRGBTransferFunction : LinearTransferFunction;
|
|
25634
|
+
|
|
25635
25635
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
25636
25636
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
25637
25637
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
@@ -25698,7 +25698,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
25698
25698
|
|
|
25699
25699
|
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
|
|
25700
25700
|
|
|
25701
|
-
if (
|
|
25701
|
+
if ( transferFunction === SRGBTransferFunction ) {
|
|
25702
25702
|
|
|
25703
25703
|
extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
|
|
25704
25704
|
|
|
@@ -25783,8 +25783,8 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
25783
25783
|
|
|
25784
25784
|
if ( extension !== null ) {
|
|
25785
25785
|
|
|
25786
|
-
if ( p === RGB_ETC2_Format ) return (
|
|
25787
|
-
if ( p === RGBA_ETC2_EAC_Format ) return (
|
|
25786
|
+
if ( p === RGB_ETC2_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
25787
|
+
if ( p === RGBA_ETC2_EAC_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
25788
25788
|
|
|
25789
25789
|
} else {
|
|
25790
25790
|
|
|
@@ -25806,20 +25806,20 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
25806
25806
|
|
|
25807
25807
|
if ( extension !== null ) {
|
|
25808
25808
|
|
|
25809
|
-
if ( p === RGBA_ASTC_4x4_Format ) return (
|
|
25810
|
-
if ( p === RGBA_ASTC_5x4_Format ) return (
|
|
25811
|
-
if ( p === RGBA_ASTC_5x5_Format ) return (
|
|
25812
|
-
if ( p === RGBA_ASTC_6x5_Format ) return (
|
|
25813
|
-
if ( p === RGBA_ASTC_6x6_Format ) return (
|
|
25814
|
-
if ( p === RGBA_ASTC_8x5_Format ) return (
|
|
25815
|
-
if ( p === RGBA_ASTC_8x6_Format ) return (
|
|
25816
|
-
if ( p === RGBA_ASTC_8x8_Format ) return (
|
|
25817
|
-
if ( p === RGBA_ASTC_10x5_Format ) return (
|
|
25818
|
-
if ( p === RGBA_ASTC_10x6_Format ) return (
|
|
25819
|
-
if ( p === RGBA_ASTC_10x8_Format ) return (
|
|
25820
|
-
if ( p === RGBA_ASTC_10x10_Format ) return (
|
|
25821
|
-
if ( p === RGBA_ASTC_12x10_Format ) return (
|
|
25822
|
-
if ( p === RGBA_ASTC_12x12_Format ) return (
|
|
25809
|
+
if ( p === RGBA_ASTC_4x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
25810
|
+
if ( p === RGBA_ASTC_5x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
25811
|
+
if ( p === RGBA_ASTC_5x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
25812
|
+
if ( p === RGBA_ASTC_6x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
25813
|
+
if ( p === RGBA_ASTC_6x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
25814
|
+
if ( p === RGBA_ASTC_8x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
25815
|
+
if ( p === RGBA_ASTC_8x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
25816
|
+
if ( p === RGBA_ASTC_8x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
25817
|
+
if ( p === RGBA_ASTC_10x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
25818
|
+
if ( p === RGBA_ASTC_10x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
25819
|
+
if ( p === RGBA_ASTC_10x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
25820
|
+
if ( p === RGBA_ASTC_10x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
25821
|
+
if ( p === RGBA_ASTC_12x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
25822
|
+
if ( p === RGBA_ASTC_12x12_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
|
|
25823
25823
|
|
|
25824
25824
|
} else {
|
|
25825
25825
|
|
|
@@ -25831,13 +25831,15 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
25831
25831
|
|
|
25832
25832
|
// BPTC
|
|
25833
25833
|
|
|
25834
|
-
if ( p === RGBA_BPTC_Format ) {
|
|
25834
|
+
if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {
|
|
25835
25835
|
|
|
25836
25836
|
extension = extensions.get( 'EXT_texture_compression_bptc' );
|
|
25837
25837
|
|
|
25838
25838
|
if ( extension !== null ) {
|
|
25839
25839
|
|
|
25840
|
-
if ( p === RGBA_BPTC_Format ) return (
|
|
25840
|
+
if ( p === RGBA_BPTC_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
25841
|
+
if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
|
|
25842
|
+
if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
|
|
25841
25843
|
|
|
25842
25844
|
} else {
|
|
25843
25845
|
|
|
@@ -28625,14 +28627,6 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
28625
28627
|
|
|
28626
28628
|
}
|
|
28627
28629
|
|
|
28628
|
-
function createCanvasElement() {
|
|
28629
|
-
|
|
28630
|
-
const canvas = createElementNS( 'canvas' );
|
|
28631
|
-
canvas.style.display = 'block';
|
|
28632
|
-
return canvas;
|
|
28633
|
-
|
|
28634
|
-
}
|
|
28635
|
-
|
|
28636
28630
|
class WebGLRenderer {
|
|
28637
28631
|
|
|
28638
28632
|
constructor( parameters = {} ) {
|
|
@@ -30363,48 +30357,28 @@ class WebGLRenderer {
|
|
|
30363
30357
|
|
|
30364
30358
|
if ( refreshProgram || _currentCamera !== camera ) {
|
|
30365
30359
|
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
if ( capabilities.logarithmicDepthBuffer ) {
|
|
30369
|
-
|
|
30370
|
-
p_uniforms.setValue( _gl, 'logDepthBufFC',
|
|
30371
|
-
2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
30360
|
+
// common camera uniforms
|
|
30372
30361
|
|
|
30373
|
-
|
|
30362
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
30363
|
+
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
30374
30364
|
|
|
30375
|
-
|
|
30365
|
+
const uCamPos = p_uniforms.map.cameraPosition;
|
|
30376
30366
|
|
|
30377
|
-
|
|
30367
|
+
if ( uCamPos !== undefined ) {
|
|
30378
30368
|
|
|
30379
|
-
|
|
30380
|
-
// now, in case this material supports lights - or later, when
|
|
30381
|
-
// the next material that does gets activated:
|
|
30382
|
-
|
|
30383
|
-
refreshMaterial = true; // set to true on material change
|
|
30384
|
-
refreshLights = true; // remains set until update done
|
|
30369
|
+
uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
30385
30370
|
|
|
30386
30371
|
}
|
|
30387
30372
|
|
|
30388
|
-
|
|
30389
|
-
// (shader material also gets them for the sake of genericity)
|
|
30390
|
-
|
|
30391
|
-
if ( material.isShaderMaterial ||
|
|
30392
|
-
material.isMeshPhongMaterial ||
|
|
30393
|
-
material.isMeshToonMaterial ||
|
|
30394
|
-
material.isMeshStandardMaterial ||
|
|
30395
|
-
material.envMap ) {
|
|
30396
|
-
|
|
30397
|
-
const uCamPos = p_uniforms.map.cameraPosition;
|
|
30398
|
-
|
|
30399
|
-
if ( uCamPos !== undefined ) {
|
|
30400
|
-
|
|
30401
|
-
uCamPos.setValue( _gl,
|
|
30402
|
-
_vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
30373
|
+
if ( capabilities.logarithmicDepthBuffer ) {
|
|
30403
30374
|
|
|
30404
|
-
|
|
30375
|
+
p_uniforms.setValue( _gl, 'logDepthBufFC',
|
|
30376
|
+
2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
30405
30377
|
|
|
30406
30378
|
}
|
|
30407
30379
|
|
|
30380
|
+
// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
|
|
30381
|
+
|
|
30408
30382
|
if ( material.isMeshPhongMaterial ||
|
|
30409
30383
|
material.isMeshToonMaterial ||
|
|
30410
30384
|
material.isMeshLambertMaterial ||
|
|
@@ -30416,16 +30390,16 @@ class WebGLRenderer {
|
|
|
30416
30390
|
|
|
30417
30391
|
}
|
|
30418
30392
|
|
|
30419
|
-
if (
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
material
|
|
30425
|
-
material
|
|
30426
|
-
object.isSkinnedMesh ) {
|
|
30393
|
+
if ( _currentCamera !== camera ) {
|
|
30394
|
+
|
|
30395
|
+
_currentCamera = camera;
|
|
30396
|
+
|
|
30397
|
+
// lighting uniforms depend on the camera so enforce an update
|
|
30398
|
+
// now, in case this material supports lights - or later, when
|
|
30399
|
+
// the next material that does gets activated:
|
|
30427
30400
|
|
|
30428
|
-
|
|
30401
|
+
refreshMaterial = true; // set to true on material change
|
|
30402
|
+
refreshLights = true; // remains set until update done
|
|
30429
30403
|
|
|
30430
30404
|
}
|
|
30431
30405
|
|
|
@@ -32982,7 +32956,7 @@ class Line extends Object3D {
|
|
|
32982
32956
|
|
|
32983
32957
|
super.copy( source, recursive );
|
|
32984
32958
|
|
|
32985
|
-
this.material = source.material;
|
|
32959
|
+
this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
32986
32960
|
this.geometry = source.geometry;
|
|
32987
32961
|
|
|
32988
32962
|
return this;
|
|
@@ -33303,7 +33277,7 @@ class Points extends Object3D {
|
|
|
33303
33277
|
|
|
33304
33278
|
super.copy( source, recursive );
|
|
33305
33279
|
|
|
33306
|
-
this.material = source.material;
|
|
33280
|
+
this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
33307
33281
|
this.geometry = source.geometry;
|
|
33308
33282
|
|
|
33309
33283
|
return this;
|
|
@@ -43139,8 +43113,6 @@ class DataTextureLoader extends Loader {
|
|
|
43139
43113
|
|
|
43140
43114
|
}
|
|
43141
43115
|
|
|
43142
|
-
if ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors
|
|
43143
|
-
|
|
43144
43116
|
if ( texData.image !== undefined ) {
|
|
43145
43117
|
|
|
43146
43118
|
texture.image = texData.image;
|
|
@@ -46561,6 +46533,12 @@ class Audio extends Object3D {
|
|
|
46561
46533
|
|
|
46562
46534
|
disconnect() {
|
|
46563
46535
|
|
|
46536
|
+
if ( this._connected === false ) {
|
|
46537
|
+
|
|
46538
|
+
return;
|
|
46539
|
+
|
|
46540
|
+
}
|
|
46541
|
+
|
|
46564
46542
|
if ( this.filters.length > 0 ) {
|
|
46565
46543
|
|
|
46566
46544
|
this.source.disconnect( this.filters[ 0 ] );
|
|
@@ -49809,7 +49787,7 @@ class Uniform {
|
|
|
49809
49787
|
|
|
49810
49788
|
}
|
|
49811
49789
|
|
|
49812
|
-
let
|
|
49790
|
+
let _id = 0;
|
|
49813
49791
|
|
|
49814
49792
|
class UniformsGroup extends EventDispatcher {
|
|
49815
49793
|
|
|
@@ -49819,7 +49797,7 @@ class UniformsGroup extends EventDispatcher {
|
|
|
49819
49797
|
|
|
49820
49798
|
this.isUniformsGroup = true;
|
|
49821
49799
|
|
|
49822
|
-
Object.defineProperty( this, 'id', { value:
|
|
49800
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
49823
49801
|
|
|
49824
49802
|
this.name = '';
|
|
49825
49803
|
|
|
@@ -52263,6 +52241,7 @@ exports.LineCurve3 = LineCurve3;
|
|
|
52263
52241
|
exports.LineDashedMaterial = LineDashedMaterial;
|
|
52264
52242
|
exports.LineLoop = LineLoop;
|
|
52265
52243
|
exports.LineSegments = LineSegments;
|
|
52244
|
+
exports.LinearDisplayP3ColorSpace = LinearDisplayP3ColorSpace;
|
|
52266
52245
|
exports.LinearEncoding = LinearEncoding;
|
|
52267
52246
|
exports.LinearFilter = LinearFilter;
|
|
52268
52247
|
exports.LinearInterpolant = LinearInterpolant;
|
|
@@ -52379,6 +52358,8 @@ exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
|
|
|
52379
52358
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
52380
52359
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
52381
52360
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
52361
|
+
exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
|
|
52362
|
+
exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
|
|
52382
52363
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
52383
52364
|
exports.RGB_ETC2_Format = RGB_ETC2_Format;
|
|
52384
52365
|
exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
|
|
@@ -52488,4 +52469,5 @@ exports.ZeroFactor = ZeroFactor;
|
|
|
52488
52469
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
52489
52470
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
52490
52471
|
exports._SRGBAFormat = _SRGBAFormat;
|
|
52472
|
+
exports.createCanvasElement = createCanvasElement;
|
|
52491
52473
|
exports.sRGBEncoding = sRGBEncoding;
|