super-three 0.135.0 → 0.136.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.js +527 -332
- package/build/three.min.js +1 -1
- package/build/three.module.js +752 -370
- package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
- package/examples/js/animation/CCDIKSolver.js +0 -1
- package/examples/js/animation/MMDPhysics.js +1 -3
- package/examples/js/controls/ArcballControls.js +38 -52
- package/examples/js/controls/TransformControls.js +24 -1
- package/examples/js/curves/CurveExtras.js +0 -2
- package/examples/js/effects/AsciiEffect.js +2 -9
- package/examples/js/exporters/GLTFExporter.js +1 -1
- package/examples/js/geometries/TeapotGeometry.js +0 -1
- package/examples/js/interactive/SelectionBox.js +2 -0
- package/examples/js/interactive/SelectionHelper.js +22 -7
- package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
- package/examples/js/loaders/AMFLoader.js +0 -2
- package/examples/js/loaders/ColladaLoader.js +1 -2
- package/examples/js/loaders/EXRLoader.js +185 -262
- package/examples/js/loaders/FBXLoader.js +3 -4
- package/examples/js/loaders/GLTFLoader.js +2 -2
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -8
- package/examples/js/loaders/KTX2Loader.js +11 -2
- package/examples/js/loaders/KTXLoader.js +1 -1
- package/examples/js/loaders/LDrawLoader.js +26 -30
- package/examples/js/loaders/LUT3dlLoader.js +2 -0
- package/examples/js/loaders/LUTCubeLoader.js +2 -0
- package/examples/js/loaders/MMDLoader.js +0 -1
- package/examples/js/loaders/NRRDLoader.js +9 -2
- package/examples/js/loaders/OBJLoader.js +0 -2
- package/examples/js/loaders/PLYLoader.js +1 -1
- package/examples/js/loaders/RGBELoader.js +0 -15
- package/examples/js/loaders/RGBMLoader.js +55 -5
- package/examples/js/loaders/SVGLoader.js +2 -2
- package/examples/js/loaders/VOXLoader.js +1 -0
- package/examples/js/loaders/VRMLLoader.js +2 -1
- package/examples/js/math/ImprovedNoise.js +1 -1
- package/examples/js/misc/GPUComputationRenderer.js +3 -1
- package/examples/js/objects/Lensflare.js +2 -10
- package/examples/js/objects/Reflector.js +7 -0
- package/examples/js/objects/Refractor.js +7 -0
- package/examples/js/objects/Sky.js +1 -1
- package/examples/js/objects/Water.js +2 -2
- package/examples/js/objects/Water2.js +4 -7
- package/examples/js/postprocessing/GlitchPass.js +3 -1
- package/examples/js/postprocessing/SSAOPass.js +1 -0
- package/examples/js/shaders/ConvolutionShader.js +0 -1
- package/examples/js/shaders/FXAAShader.js +1 -1
- package/examples/js/shaders/FilmShader.js +1 -1
- package/examples/js/shaders/GammaCorrectionShader.js +1 -1
- package/examples/js/shaders/HorizontalBlurShader.js +1 -2
- package/examples/js/shaders/SSRShader.js +1 -1
- package/examples/js/shaders/SSRrShader.js +1 -1
- package/examples/js/shaders/VerticalBlurShader.js +1 -2
- package/examples/js/utils/GeometryUtils.js +1 -1
- package/examples/js/utils/RoughnessMipmapper.js +18 -29
- package/examples/jsm/animation/CCDIKSolver.js +0 -1
- package/examples/jsm/animation/MMDPhysics.js +0 -2
- package/examples/jsm/controls/ArcballControls.js +27 -56
- package/examples/jsm/controls/TransformControls.js +24 -1
- package/examples/jsm/curves/CurveExtras.js +0 -2
- package/examples/jsm/effects/AsciiEffect.js +2 -9
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +0 -1
- package/examples/jsm/interactive/SelectionBox.js +1 -0
- package/examples/jsm/interactive/SelectionHelper.js +19 -7
- package/examples/jsm/libs/flow.module.js +256 -136
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
- package/examples/jsm/loaders/AMFLoader.js +0 -2
- package/examples/jsm/loaders/ColladaLoader.js +1 -2
- package/examples/jsm/loaders/EXRLoader.js +184 -293
- package/examples/jsm/loaders/FBXLoader.js +3 -4
- package/examples/jsm/loaders/GLTFLoader.js +2 -2
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -14
- package/examples/jsm/loaders/KTX2Loader.js +13 -4
- package/examples/jsm/loaders/KTXLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +23 -24
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -0
- package/examples/jsm/loaders/MMDLoader.js +0 -1
- package/examples/jsm/loaders/NRRDLoader.js +10 -2
- package/examples/jsm/loaders/OBJLoader.js +0 -2
- package/examples/jsm/loaders/PLYLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +0 -20
- package/examples/jsm/loaders/RGBMLoader.js +61 -7
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +30 -9
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +2 -1
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
- package/examples/jsm/node-editor/NodeEditor.js +23 -22
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +48 -9
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +1 -0
- package/examples/jsm/nodes/math/MathNode.js +12 -0
- package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -116
- package/examples/jsm/objects/Lensflare.js +3 -14
- package/examples/jsm/objects/Reflector.js +7 -0
- package/examples/jsm/objects/Refractor.js +7 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +2 -2
- package/examples/jsm/objects/Water2.js +4 -8
- package/examples/jsm/postprocessing/GlitchPass.js +3 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -0
- package/examples/jsm/renderers/nodes/Nodes.js +1 -0
- package/examples/jsm/renderers/nodes/ShaderNode.js +7 -6
- package/examples/jsm/renderers/nodes/core/InputNode.js +1 -1
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +1 -1
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +26 -31
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +2 -2
- package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +1 -1
- package/examples/jsm/renderers/nodes/math/MathNode.js +5 -3
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +2 -2
- package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +14 -14
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +7 -6
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +42 -61
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +0 -1
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +30 -4
- package/examples/jsm/shaders/ConvolutionShader.js +0 -1
- package/examples/jsm/shaders/FXAAShader.js +1 -1
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SSRrShader.js +1 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
- package/examples/jsm/utils/GeometryUtils.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +19 -32
- package/examples/jsm/utils/WorkerPool.js +11 -11
- package/package.json +15 -9
- package/src/Three.Legacy.js +12 -0
- package/src/Three.js +1 -2
- package/src/constants.js +1 -7
- package/src/core/Object3D.js +1 -1
- package/src/extras/PMREMGenerator.js +19 -110
- package/src/extras/core/Interpolations.js +1 -1
- package/src/geometries/LatheGeometry.js +70 -47
- package/src/helpers/CameraHelper.js +1 -1
- package/src/loaders/FileLoader.js +23 -6
- package/src/math/Color.js +0 -38
- package/src/math/Ray.js +2 -2
- package/src/math/Sphere.js +10 -1
- package/src/objects/Skeleton.js +1 -0
- package/src/renderers/WebGLRenderer.js +23 -16
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -47
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +27 -1
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
- package/src/renderers/webgl/WebGLCapabilities.js +0 -2
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -0
- package/src/renderers/webgl/WebGLProgram.js +2 -19
- package/src/renderers/webgl/WebGLPrograms.js +191 -35
- package/src/renderers/webgl/WebGLRenderLists.js +4 -14
- package/src/renderers/webgl/WebGLShaderCache.js +120 -0
- package/src/renderers/webgl/WebGLState.js +45 -0
- package/src/renderers/webgl/WebGLTextures.js +195 -26
- package/src/renderers/webxr/WebXRManager.js +10 -3
- package/src/scenes/Scene.js +1 -1
- package/src/textures/DataTexture.js +0 -2
- package/src/textures/DataTexture2DArray.js +0 -2
- package/src/textures/DataTexture3D.js +0 -2
- package/src/textures/FramebufferTexture.js +25 -0
- package/src/utils.js +1 -37
package/build/three.module.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2010-2021 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
const REVISION = '
|
|
6
|
+
const REVISION = '136';
|
|
7
7
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
8
8
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
9
9
|
const CullFaceNone = 0;
|
|
@@ -96,7 +96,6 @@ const RGBFormat = 1022;
|
|
|
96
96
|
const RGBAFormat = 1023;
|
|
97
97
|
const LuminanceFormat = 1024;
|
|
98
98
|
const LuminanceAlphaFormat = 1025;
|
|
99
|
-
const RGBEFormat = RGBAFormat;
|
|
100
99
|
const DepthFormat = 1026;
|
|
101
100
|
const DepthStencilFormat = 1027;
|
|
102
101
|
const RedFormat = 1028;
|
|
@@ -162,11 +161,6 @@ const TriangleStripDrawMode = 1;
|
|
|
162
161
|
const TriangleFanDrawMode = 2;
|
|
163
162
|
const LinearEncoding = 3000;
|
|
164
163
|
const sRGBEncoding = 3001;
|
|
165
|
-
const GammaEncoding = 3007;
|
|
166
|
-
const RGBEEncoding = 3002;
|
|
167
|
-
const RGBM7Encoding = 3004;
|
|
168
|
-
const RGBM16Encoding = 3005;
|
|
169
|
-
const RGBDEncoding = 3006;
|
|
170
164
|
const BasicDepthPacking = 3200;
|
|
171
165
|
const RGBADepthPacking = 3201;
|
|
172
166
|
const TangentSpaceNormalMap = 0;
|
|
@@ -1406,42 +1400,6 @@ function createElementNS( name ) {
|
|
|
1406
1400
|
|
|
1407
1401
|
}
|
|
1408
1402
|
|
|
1409
|
-
/**
|
|
1410
|
-
* cyrb53 hash for string from: https://stackoverflow.com/a/52171480
|
|
1411
|
-
*
|
|
1412
|
-
* Public Domain, @bryc - https://stackoverflow.com/users/815680/bryc
|
|
1413
|
-
*
|
|
1414
|
-
* It is roughly similar to the well-known MurmurHash/xxHash algorithms. It uses a combination
|
|
1415
|
-
* of multiplication and Xorshift to generate the hash, but not as thorough. As a result it's
|
|
1416
|
-
* faster than either would be in JavaScript and significantly simpler to implement. Keep in
|
|
1417
|
-
* mind this is not a secure algorithm, if privacy/security is a concern, this is not for you.
|
|
1418
|
-
*
|
|
1419
|
-
* @param {string} str
|
|
1420
|
-
* @param {number} seed, default 0
|
|
1421
|
-
* @returns number
|
|
1422
|
-
*/
|
|
1423
|
-
function hashString( str, seed = 0 ) {
|
|
1424
|
-
|
|
1425
|
-
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
1426
|
-
|
|
1427
|
-
for ( let i = 0, ch; i < str.length; i ++ ) {
|
|
1428
|
-
|
|
1429
|
-
ch = str.charCodeAt( i );
|
|
1430
|
-
|
|
1431
|
-
h1 = Math.imul( h1 ^ ch, 2654435761 );
|
|
1432
|
-
|
|
1433
|
-
h2 = Math.imul( h2 ^ ch, 1597334677 );
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
h1 = Math.imul( h1 ^ ( h1 >>> 16 ), 2246822507 ) ^ Math.imul( h2 ^ ( h2 >>> 13 ), 3266489909 );
|
|
1438
|
-
|
|
1439
|
-
h2 = Math.imul( h2 ^ ( h2 >>> 16 ), 2246822507 ) ^ Math.imul( h1 ^ ( h1 >>> 13 ), 3266489909 );
|
|
1440
|
-
|
|
1441
|
-
return 4294967296 * ( 2097151 & h2 ) + ( h1 >>> 0 );
|
|
1442
|
-
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
1403
|
let _canvas;
|
|
1446
1404
|
|
|
1447
1405
|
class ImageUtils {
|
|
@@ -4870,7 +4828,16 @@ class Sphere {
|
|
|
4870
4828
|
// 1) Enclose the farthest point on the other sphere into this sphere.
|
|
4871
4829
|
// 2) Enclose the opposite point of the farthest point into this sphere.
|
|
4872
4830
|
|
|
4873
|
-
|
|
4831
|
+
if ( this.center.equals( sphere.center ) === true ) {
|
|
4832
|
+
|
|
4833
|
+
_toFarthestPoint.set( 0, 0, 1 ).multiplyScalar( sphere.radius );
|
|
4834
|
+
|
|
4835
|
+
|
|
4836
|
+
} else {
|
|
4837
|
+
|
|
4838
|
+
_toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );
|
|
4839
|
+
|
|
4840
|
+
}
|
|
4874
4841
|
|
|
4875
4842
|
this.expandByPoint( _v1$6.copy( sphere.center ).add( _toFarthestPoint ) );
|
|
4876
4843
|
this.expandByPoint( _v1$6.copy( sphere.center ).sub( _toFarthestPoint ) );
|
|
@@ -4993,7 +4960,7 @@ class Ray {
|
|
|
4993
4960
|
|
|
4994
4961
|
distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {
|
|
4995
4962
|
|
|
4996
|
-
// from
|
|
4963
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h
|
|
4997
4964
|
// It returns the min distance between the ray and the segment
|
|
4998
4965
|
// defined by v0 and v1
|
|
4999
4966
|
// It can also set two optional targets :
|
|
@@ -5292,7 +5259,7 @@ class Ray {
|
|
|
5292
5259
|
|
|
5293
5260
|
// Compute the offset origin, edges, and normal.
|
|
5294
5261
|
|
|
5295
|
-
// from
|
|
5262
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
|
|
5296
5263
|
|
|
5297
5264
|
_edge1.subVectors( b, a );
|
|
5298
5265
|
_edge2.subVectors( c, a );
|
|
@@ -7135,7 +7102,7 @@ class Object3D extends EventDispatcher {
|
|
|
7135
7102
|
|
|
7136
7103
|
}
|
|
7137
7104
|
|
|
7138
|
-
raycast() {}
|
|
7105
|
+
raycast( /* raycaster, intersects */ ) {}
|
|
7139
7106
|
|
|
7140
7107
|
traverse( callback ) {
|
|
7141
7108
|
|
|
@@ -8636,44 +8603,6 @@ class Color {
|
|
|
8636
8603
|
|
|
8637
8604
|
}
|
|
8638
8605
|
|
|
8639
|
-
copyGammaToLinear( color, gammaFactor = 2.0 ) {
|
|
8640
|
-
|
|
8641
|
-
this.r = Math.pow( color.r, gammaFactor );
|
|
8642
|
-
this.g = Math.pow( color.g, gammaFactor );
|
|
8643
|
-
this.b = Math.pow( color.b, gammaFactor );
|
|
8644
|
-
|
|
8645
|
-
return this;
|
|
8646
|
-
|
|
8647
|
-
}
|
|
8648
|
-
|
|
8649
|
-
copyLinearToGamma( color, gammaFactor = 2.0 ) {
|
|
8650
|
-
|
|
8651
|
-
const safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;
|
|
8652
|
-
|
|
8653
|
-
this.r = Math.pow( color.r, safeInverse );
|
|
8654
|
-
this.g = Math.pow( color.g, safeInverse );
|
|
8655
|
-
this.b = Math.pow( color.b, safeInverse );
|
|
8656
|
-
|
|
8657
|
-
return this;
|
|
8658
|
-
|
|
8659
|
-
}
|
|
8660
|
-
|
|
8661
|
-
convertGammaToLinear( gammaFactor ) {
|
|
8662
|
-
|
|
8663
|
-
this.copyGammaToLinear( this, gammaFactor );
|
|
8664
|
-
|
|
8665
|
-
return this;
|
|
8666
|
-
|
|
8667
|
-
}
|
|
8668
|
-
|
|
8669
|
-
convertLinearToGamma( gammaFactor ) {
|
|
8670
|
-
|
|
8671
|
-
this.copyLinearToGamma( this, gammaFactor );
|
|
8672
|
-
|
|
8673
|
-
return this;
|
|
8674
|
-
|
|
8675
|
-
}
|
|
8676
|
-
|
|
8677
8606
|
copySRGBToLinear( color ) {
|
|
8678
8607
|
|
|
8679
8608
|
this.r = SRGBToLinear( color.r );
|
|
@@ -9547,7 +9476,7 @@ class Float64BufferAttribute extends BufferAttribute {
|
|
|
9547
9476
|
|
|
9548
9477
|
}
|
|
9549
9478
|
|
|
9550
|
-
let _id = 0;
|
|
9479
|
+
let _id$1 = 0;
|
|
9551
9480
|
|
|
9552
9481
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
9553
9482
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
@@ -9562,7 +9491,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
9562
9491
|
|
|
9563
9492
|
super();
|
|
9564
9493
|
|
|
9565
|
-
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
9494
|
+
Object.defineProperty( this, 'id', { value: _id$1 ++ } );
|
|
9566
9495
|
|
|
9567
9496
|
this.uuid = generateUUID();
|
|
9568
9497
|
|
|
@@ -12788,7 +12717,7 @@ var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#el
|
|
|
12788
12717
|
|
|
12789
12718
|
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
|
|
12790
12719
|
|
|
12791
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 )
|
|
12720
|
+
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\treturn texture2D( envMap, uv ).rgb;\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
12792
12721
|
|
|
12793
12722
|
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
|
|
12794
12723
|
|
|
@@ -12802,7 +12731,7 @@ var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emi
|
|
|
12802
12731
|
|
|
12803
12732
|
var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
12804
12733
|
|
|
12805
|
-
var encodings_pars_fragment = "
|
|
12734
|
+
var encodings_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBToLinear( 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 LinearTosRGB( 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}";
|
|
12806
12735
|
|
|
12807
12736
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
12808
12737
|
|
|
@@ -12822,7 +12751,7 @@ var fog_fragment = "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0
|
|
|
12822
12751
|
|
|
12823
12752
|
var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
|
|
12824
12753
|
|
|
12825
|
-
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).
|
|
12754
|
+
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
|
|
12826
12755
|
|
|
12827
12756
|
var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
12828
12757
|
|
|
@@ -12844,7 +12773,7 @@ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhong
|
|
|
12844
12773
|
|
|
12845
12774
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
|
|
12846
12775
|
|
|
12847
|
-
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\
|
|
12776
|
+
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
12848
12777
|
|
|
12849
12778
|
var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
12850
12779
|
|
|
@@ -13000,7 +12929,7 @@ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;
|
|
|
13000
12929
|
|
|
13001
12930
|
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
|
|
13002
12931
|
|
|
13003
|
-
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
12932
|
+
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13004
12933
|
|
|
13005
12934
|
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13006
12935
|
|
|
@@ -14603,10 +14532,8 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
14603
14532
|
|
|
14604
14533
|
}
|
|
14605
14534
|
|
|
14606
|
-
/* eslint-disable no-undef */
|
|
14607
14535
|
const isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ) ||
|
|
14608
14536
|
( typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext );
|
|
14609
|
-
/* eslint-enable no-undef */
|
|
14610
14537
|
|
|
14611
14538
|
let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
|
|
14612
14539
|
const maxPrecision = getMaxPrecision( precision );
|
|
@@ -15096,12 +15023,7 @@ const MAX_SAMPLES = 20;
|
|
|
15096
15023
|
|
|
15097
15024
|
const ENCODINGS = {
|
|
15098
15025
|
[ LinearEncoding ]: 0,
|
|
15099
|
-
[ sRGBEncoding ]: 1
|
|
15100
|
-
[ RGBEEncoding ]: 2,
|
|
15101
|
-
[ RGBM7Encoding ]: 3,
|
|
15102
|
-
[ RGBM16Encoding ]: 4,
|
|
15103
|
-
[ RGBDEncoding ]: 5,
|
|
15104
|
-
[ GammaEncoding ]: 6
|
|
15026
|
+
[ sRGBEncoding ]: 1
|
|
15105
15027
|
};
|
|
15106
15028
|
|
|
15107
15029
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
@@ -15185,7 +15107,7 @@ class PMREMGenerator {
|
|
|
15185
15107
|
|
|
15186
15108
|
/**
|
|
15187
15109
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
15188
|
-
*
|
|
15110
|
+
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
15189
15111
|
* as this matches best with the 256 x 256 cubemap output.
|
|
15190
15112
|
*/
|
|
15191
15113
|
fromEquirectangular( equirectangular ) {
|
|
@@ -15196,7 +15118,7 @@ class PMREMGenerator {
|
|
|
15196
15118
|
|
|
15197
15119
|
/**
|
|
15198
15120
|
* Generates a PMREM from an cubemap texture, which can be either LDR
|
|
15199
|
-
*
|
|
15121
|
+
* or HDR. The ideal input cube size is 256 x 256,
|
|
15200
15122
|
* as this matches best with the 256 x 256 cubemap output.
|
|
15201
15123
|
*/
|
|
15202
15124
|
fromCubemap( cubemap ) {
|
|
@@ -15281,12 +15203,12 @@ class PMREMGenerator {
|
|
|
15281
15203
|
_allocateTargets( texture ) { // warning: null texture is valid
|
|
15282
15204
|
|
|
15283
15205
|
const params = {
|
|
15284
|
-
magFilter:
|
|
15285
|
-
minFilter:
|
|
15206
|
+
magFilter: LinearFilter,
|
|
15207
|
+
minFilter: LinearFilter,
|
|
15286
15208
|
generateMipmaps: false,
|
|
15287
|
-
type:
|
|
15288
|
-
format:
|
|
15289
|
-
encoding:
|
|
15209
|
+
type: HalfFloatType,
|
|
15210
|
+
format: RGBAFormat,
|
|
15211
|
+
encoding: LinearEncoding,
|
|
15290
15212
|
depthBuffer: false
|
|
15291
15213
|
};
|
|
15292
15214
|
|
|
@@ -15314,12 +15236,10 @@ class PMREMGenerator {
|
|
|
15314
15236
|
const renderer = this._renderer;
|
|
15315
15237
|
|
|
15316
15238
|
const originalAutoClear = renderer.autoClear;
|
|
15317
|
-
const outputEncoding = renderer.outputEncoding;
|
|
15318
15239
|
const toneMapping = renderer.toneMapping;
|
|
15319
15240
|
renderer.getClearColor( _clearColor );
|
|
15320
15241
|
|
|
15321
15242
|
renderer.toneMapping = NoToneMapping;
|
|
15322
|
-
renderer.outputEncoding = LinearEncoding;
|
|
15323
15243
|
renderer.autoClear = false;
|
|
15324
15244
|
|
|
15325
15245
|
const backgroundMaterial = new MeshBasicMaterial( {
|
|
@@ -15389,7 +15309,6 @@ class PMREMGenerator {
|
|
|
15389
15309
|
backgroundBox.material.dispose();
|
|
15390
15310
|
|
|
15391
15311
|
renderer.toneMapping = toneMapping;
|
|
15392
|
-
renderer.outputEncoding = outputEncoding;
|
|
15393
15312
|
renderer.autoClear = originalAutoClear;
|
|
15394
15313
|
scene.background = background;
|
|
15395
15314
|
|
|
@@ -15397,7 +15316,7 @@ class PMREMGenerator {
|
|
|
15397
15316
|
|
|
15398
15317
|
_setEncoding( uniform, texture ) {
|
|
15399
15318
|
|
|
15400
|
-
|
|
15319
|
+
if ( this._renderer.capabilities.isWebGL2 === true && texture.format === RGBAFormat && texture.type === UnsignedByteType && texture.encoding === sRGBEncoding ) {
|
|
15401
15320
|
|
|
15402
15321
|
uniform.value = ENCODINGS[ LinearEncoding ];
|
|
15403
15322
|
|
|
@@ -15405,9 +15324,7 @@ class PMREMGenerator {
|
|
|
15405
15324
|
|
|
15406
15325
|
uniform.value = ENCODINGS[ texture.encoding ];
|
|
15407
15326
|
|
|
15408
|
-
}
|
|
15409
|
-
|
|
15410
|
-
uniform.value = ENCODINGS[ texture.encoding ];
|
|
15327
|
+
}
|
|
15411
15328
|
|
|
15412
15329
|
}
|
|
15413
15330
|
|
|
@@ -15449,7 +15366,6 @@ class PMREMGenerator {
|
|
|
15449
15366
|
}
|
|
15450
15367
|
|
|
15451
15368
|
this._setEncoding( uniforms[ 'inputEncoding' ], texture );
|
|
15452
|
-
this._setEncoding( uniforms[ 'outputEncoding' ], cubeUVRenderTarget.texture );
|
|
15453
15369
|
|
|
15454
15370
|
_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );
|
|
15455
15371
|
|
|
@@ -15581,9 +15497,6 @@ class PMREMGenerator {
|
|
|
15581
15497
|
blurUniforms[ 'dTheta' ].value = radiansPerPixel;
|
|
15582
15498
|
blurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn;
|
|
15583
15499
|
|
|
15584
|
-
this._setEncoding( blurUniforms[ 'inputEncoding' ], targetIn.texture );
|
|
15585
|
-
this._setEncoding( blurUniforms[ 'outputEncoding' ], targetIn.texture );
|
|
15586
|
-
|
|
15587
15500
|
const outputSize = _sizeLods[ lodOut ];
|
|
15588
15501
|
const x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize );
|
|
15589
15502
|
const y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) + 2 * outputSize * ( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 );
|
|
@@ -15596,14 +15509,6 @@ class PMREMGenerator {
|
|
|
15596
15509
|
|
|
15597
15510
|
}
|
|
15598
15511
|
|
|
15599
|
-
function _isLDR( texture ) {
|
|
15600
|
-
|
|
15601
|
-
if ( texture === undefined || texture.type !== UnsignedByteType ) return false;
|
|
15602
|
-
|
|
15603
|
-
return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;
|
|
15604
|
-
|
|
15605
|
-
}
|
|
15606
|
-
|
|
15607
15512
|
function _createPlanes() {
|
|
15608
15513
|
|
|
15609
15514
|
const _lodPlanes = [];
|
|
@@ -15716,9 +15621,7 @@ function _getBlurShader( maxSamples ) {
|
|
|
15716
15621
|
'latitudinal': { value: false },
|
|
15717
15622
|
'dTheta': { value: 0 },
|
|
15718
15623
|
'mipInt': { value: 0 },
|
|
15719
|
-
'poleAxis': { value: poleAxis }
|
|
15720
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
|
|
15721
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15624
|
+
'poleAxis': { value: poleAxis }
|
|
15722
15625
|
},
|
|
15723
15626
|
|
|
15724
15627
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15784,8 +15687,6 @@ function _getBlurShader( maxSamples ) {
|
|
|
15784
15687
|
|
|
15785
15688
|
}
|
|
15786
15689
|
|
|
15787
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15788
|
-
|
|
15789
15690
|
}
|
|
15790
15691
|
`,
|
|
15791
15692
|
|
|
@@ -15809,8 +15710,7 @@ function _getEquirectShader() {
|
|
|
15809
15710
|
uniforms: {
|
|
15810
15711
|
'envMap': { value: null },
|
|
15811
15712
|
'texelSize': { value: texelSize },
|
|
15812
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15813
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15713
|
+
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15814
15714
|
},
|
|
15815
15715
|
|
|
15816
15716
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15850,8 +15750,6 @@ function _getEquirectShader() {
|
|
|
15850
15750
|
vec3 bm = mix( bl, br, f.x );
|
|
15851
15751
|
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
15852
15752
|
|
|
15853
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15854
|
-
|
|
15855
15753
|
}
|
|
15856
15754
|
`,
|
|
15857
15755
|
|
|
@@ -15873,8 +15771,7 @@ function _getCubemapShader() {
|
|
|
15873
15771
|
|
|
15874
15772
|
uniforms: {
|
|
15875
15773
|
'envMap': { value: null },
|
|
15876
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15877
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15774
|
+
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15878
15775
|
},
|
|
15879
15776
|
|
|
15880
15777
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15892,9 +15789,7 @@ function _getCubemapShader() {
|
|
|
15892
15789
|
|
|
15893
15790
|
void main() {
|
|
15894
15791
|
|
|
15895
|
-
gl_FragColor =
|
|
15896
|
-
gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
|
|
15897
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15792
|
+
gl_FragColor = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) );
|
|
15898
15793
|
|
|
15899
15794
|
}
|
|
15900
15795
|
`,
|
|
@@ -15977,7 +15872,6 @@ function _getEncodings() {
|
|
|
15977
15872
|
return /* glsl */`
|
|
15978
15873
|
|
|
15979
15874
|
uniform int inputEncoding;
|
|
15980
|
-
uniform int outputEncoding;
|
|
15981
15875
|
|
|
15982
15876
|
#include <encodings_pars_fragment>
|
|
15983
15877
|
|
|
@@ -15987,63 +15881,9 @@ function _getEncodings() {
|
|
|
15987
15881
|
|
|
15988
15882
|
return value;
|
|
15989
15883
|
|
|
15990
|
-
} else if ( inputEncoding == 1 ) {
|
|
15991
|
-
|
|
15992
|
-
return sRGBToLinear( value );
|
|
15993
|
-
|
|
15994
|
-
} else if ( inputEncoding == 2 ) {
|
|
15995
|
-
|
|
15996
|
-
return RGBEToLinear( value );
|
|
15997
|
-
|
|
15998
|
-
} else if ( inputEncoding == 3 ) {
|
|
15999
|
-
|
|
16000
|
-
return RGBMToLinear( value, 7.0 );
|
|
16001
|
-
|
|
16002
|
-
} else if ( inputEncoding == 4 ) {
|
|
16003
|
-
|
|
16004
|
-
return RGBMToLinear( value, 16.0 );
|
|
16005
|
-
|
|
16006
|
-
} else if ( inputEncoding == 5 ) {
|
|
16007
|
-
|
|
16008
|
-
return RGBDToLinear( value, 256.0 );
|
|
16009
|
-
|
|
16010
15884
|
} else {
|
|
16011
15885
|
|
|
16012
|
-
return
|
|
16013
|
-
|
|
16014
|
-
}
|
|
16015
|
-
|
|
16016
|
-
}
|
|
16017
|
-
|
|
16018
|
-
vec4 linearToOutputTexel( vec4 value ) {
|
|
16019
|
-
|
|
16020
|
-
if ( outputEncoding == 0 ) {
|
|
16021
|
-
|
|
16022
|
-
return value;
|
|
16023
|
-
|
|
16024
|
-
} else if ( outputEncoding == 1 ) {
|
|
16025
|
-
|
|
16026
|
-
return LinearTosRGB( value );
|
|
16027
|
-
|
|
16028
|
-
} else if ( outputEncoding == 2 ) {
|
|
16029
|
-
|
|
16030
|
-
return LinearToRGBE( value );
|
|
16031
|
-
|
|
16032
|
-
} else if ( outputEncoding == 3 ) {
|
|
16033
|
-
|
|
16034
|
-
return LinearToRGBM( value, 7.0 );
|
|
16035
|
-
|
|
16036
|
-
} else if ( outputEncoding == 4 ) {
|
|
16037
|
-
|
|
16038
|
-
return LinearToRGBM( value, 16.0 );
|
|
16039
|
-
|
|
16040
|
-
} else if ( outputEncoding == 5 ) {
|
|
16041
|
-
|
|
16042
|
-
return LinearToRGBD( value, 256.0 );
|
|
16043
|
-
|
|
16044
|
-
} else {
|
|
16045
|
-
|
|
16046
|
-
return LinearToGamma( value, 2.2 );
|
|
15886
|
+
return sRGBToLinear( value );
|
|
16047
15887
|
|
|
16048
15888
|
}
|
|
16049
15889
|
|
|
@@ -16611,8 +16451,6 @@ class DataTexture2DArray extends Texture {
|
|
|
16611
16451
|
this.flipY = false;
|
|
16612
16452
|
this.unpackAlignment = 1;
|
|
16613
16453
|
|
|
16614
|
-
this.needsUpdate = true;
|
|
16615
|
-
|
|
16616
16454
|
}
|
|
16617
16455
|
|
|
16618
16456
|
}
|
|
@@ -16700,6 +16538,7 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
|
|
|
16700
16538
|
const texture = new DataTexture2DArray( buffer, width, height, numberOfMorphTargets );
|
|
16701
16539
|
texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)
|
|
16702
16540
|
texture.type = FloatType;
|
|
16541
|
+
texture.needsUpdate = true;
|
|
16703
16542
|
|
|
16704
16543
|
// fill buffer
|
|
16705
16544
|
|
|
@@ -16990,8 +16829,6 @@ class DataTexture3D extends Texture {
|
|
|
16990
16829
|
this.flipY = false;
|
|
16991
16830
|
this.unpackAlignment = 1;
|
|
16992
16831
|
|
|
16993
|
-
this.needsUpdate = true;
|
|
16994
|
-
|
|
16995
16832
|
}
|
|
16996
16833
|
|
|
16997
16834
|
}
|
|
@@ -18046,16 +17883,6 @@ function getEncodingComponents( encoding ) {
|
|
|
18046
17883
|
return [ 'Linear', '( value )' ];
|
|
18047
17884
|
case sRGBEncoding:
|
|
18048
17885
|
return [ 'sRGB', '( value )' ];
|
|
18049
|
-
case RGBEEncoding:
|
|
18050
|
-
return [ 'RGBE', '( value )' ];
|
|
18051
|
-
case RGBM7Encoding:
|
|
18052
|
-
return [ 'RGBM', '( value, 7.0 )' ];
|
|
18053
|
-
case RGBM16Encoding:
|
|
18054
|
-
return [ 'RGBM', '( value, 16.0 )' ];
|
|
18055
|
-
case RGBDEncoding:
|
|
18056
|
-
return [ 'RGBD', '( value, 256.0 )' ];
|
|
18057
|
-
case GammaEncoding:
|
|
18058
|
-
return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];
|
|
18059
17886
|
default:
|
|
18060
17887
|
console.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding );
|
|
18061
17888
|
return [ 'Linear', '( value )' ];
|
|
@@ -18416,9 +18243,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
18416
18243
|
const envMapModeDefine = generateEnvMapModeDefine( parameters );
|
|
18417
18244
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
18418
18245
|
|
|
18419
|
-
|
|
18420
|
-
const gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
|
|
18421
|
-
|
|
18422
18246
|
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
18423
18247
|
|
|
18424
18248
|
const customDefines = generateDefines( defines );
|
|
@@ -18470,8 +18294,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
18470
18294
|
|
|
18471
18295
|
parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',
|
|
18472
18296
|
|
|
18473
|
-
'#define GAMMA_FACTOR ' + gammaFactorDefine,
|
|
18474
|
-
|
|
18475
18297
|
'#define MAX_BONES ' + parameters.maxBones,
|
|
18476
18298
|
( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',
|
|
18477
18299
|
( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',
|
|
@@ -18620,8 +18442,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
18620
18442
|
|
|
18621
18443
|
customDefines,
|
|
18622
18444
|
|
|
18623
|
-
'#define GAMMA_FACTOR ' + gammaFactorDefine,
|
|
18624
|
-
|
|
18625
18445
|
( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',
|
|
18626
18446
|
( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',
|
|
18627
18447
|
|
|
@@ -18741,7 +18561,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
18741
18561
|
|
|
18742
18562
|
prefixFragment = [
|
|
18743
18563
|
'#define varying in',
|
|
18744
|
-
( parameters.glslVersion === GLSL3 ) ? '' : 'out highp vec4 pc_fragColor;',
|
|
18564
|
+
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
18745
18565
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
18746
18566
|
'#define gl_FragDepthEXT gl_FragDepth',
|
|
18747
18567
|
'#define texture2D texture',
|
|
@@ -18913,8 +18733,129 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
18913
18733
|
|
|
18914
18734
|
}
|
|
18915
18735
|
|
|
18736
|
+
let _id = 0;
|
|
18737
|
+
|
|
18738
|
+
class WebGLShaderCache {
|
|
18739
|
+
|
|
18740
|
+
constructor() {
|
|
18741
|
+
|
|
18742
|
+
this.shaderCache = new Map();
|
|
18743
|
+
this.materialCache = new Map();
|
|
18744
|
+
|
|
18745
|
+
}
|
|
18746
|
+
|
|
18747
|
+
update( material ) {
|
|
18748
|
+
|
|
18749
|
+
const vertexShader = material.vertexShader;
|
|
18750
|
+
const fragmentShader = material.fragmentShader;
|
|
18751
|
+
|
|
18752
|
+
const vertexShaderStage = this._getShaderStage( vertexShader );
|
|
18753
|
+
const fragmentShaderStage = this._getShaderStage( fragmentShader );
|
|
18754
|
+
|
|
18755
|
+
const materialShaders = this._getShaderCacheForMaterial( material );
|
|
18756
|
+
|
|
18757
|
+
if ( materialShaders.has( vertexShaderStage ) === false ) {
|
|
18758
|
+
|
|
18759
|
+
materialShaders.add( vertexShaderStage );
|
|
18760
|
+
vertexShaderStage.usedTimes ++;
|
|
18761
|
+
|
|
18762
|
+
}
|
|
18763
|
+
|
|
18764
|
+
if ( materialShaders.has( fragmentShaderStage ) === false ) {
|
|
18765
|
+
|
|
18766
|
+
materialShaders.add( fragmentShaderStage );
|
|
18767
|
+
fragmentShaderStage.usedTimes ++;
|
|
18768
|
+
|
|
18769
|
+
}
|
|
18770
|
+
|
|
18771
|
+
return this;
|
|
18772
|
+
|
|
18773
|
+
}
|
|
18774
|
+
|
|
18775
|
+
remove( material ) {
|
|
18776
|
+
|
|
18777
|
+
const materialShaders = this.materialCache.get( material );
|
|
18778
|
+
|
|
18779
|
+
for ( const shaderStage of materialShaders ) {
|
|
18780
|
+
|
|
18781
|
+
shaderStage.usedTimes --;
|
|
18782
|
+
|
|
18783
|
+
if ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage );
|
|
18784
|
+
|
|
18785
|
+
}
|
|
18786
|
+
|
|
18787
|
+
this.materialCache.delete( material );
|
|
18788
|
+
|
|
18789
|
+
return this;
|
|
18790
|
+
|
|
18791
|
+
}
|
|
18792
|
+
|
|
18793
|
+
getVertexShaderID( material ) {
|
|
18794
|
+
|
|
18795
|
+
return this._getShaderStage( material.vertexShader ).id;
|
|
18796
|
+
|
|
18797
|
+
}
|
|
18798
|
+
|
|
18799
|
+
getFragmentShaderID( material ) {
|
|
18800
|
+
|
|
18801
|
+
return this._getShaderStage( material.fragmentShader ).id;
|
|
18802
|
+
|
|
18803
|
+
}
|
|
18804
|
+
|
|
18805
|
+
dispose() {
|
|
18806
|
+
|
|
18807
|
+
this.shaderCache.clear();
|
|
18808
|
+
this.materialCache.clear();
|
|
18809
|
+
|
|
18810
|
+
}
|
|
18811
|
+
|
|
18812
|
+
_getShaderCacheForMaterial( material ) {
|
|
18813
|
+
|
|
18814
|
+
const cache = this.materialCache;
|
|
18815
|
+
|
|
18816
|
+
if ( cache.has( material ) === false ) {
|
|
18817
|
+
|
|
18818
|
+
cache.set( material, new Set() );
|
|
18819
|
+
|
|
18820
|
+
}
|
|
18821
|
+
|
|
18822
|
+
return cache.get( material );
|
|
18823
|
+
|
|
18824
|
+
}
|
|
18825
|
+
|
|
18826
|
+
_getShaderStage( code ) {
|
|
18827
|
+
|
|
18828
|
+
const cache = this.shaderCache;
|
|
18829
|
+
|
|
18830
|
+
if ( cache.has( code ) === false ) {
|
|
18831
|
+
|
|
18832
|
+
const stage = new WebGLShaderStage();
|
|
18833
|
+
cache.set( code, stage );
|
|
18834
|
+
|
|
18835
|
+
}
|
|
18836
|
+
|
|
18837
|
+
return cache.get( code );
|
|
18838
|
+
|
|
18839
|
+
}
|
|
18840
|
+
|
|
18841
|
+
}
|
|
18842
|
+
|
|
18843
|
+
class WebGLShaderStage {
|
|
18844
|
+
|
|
18845
|
+
constructor() {
|
|
18846
|
+
|
|
18847
|
+
this.id = _id ++;
|
|
18848
|
+
|
|
18849
|
+
this.usedTimes = 0;
|
|
18850
|
+
|
|
18851
|
+
}
|
|
18852
|
+
|
|
18853
|
+
}
|
|
18854
|
+
|
|
18916
18855
|
function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {
|
|
18917
18856
|
|
|
18857
|
+
const _programLayers = new Layers();
|
|
18858
|
+
const _customShaders = new WebGLShaderCache();
|
|
18918
18859
|
const programs = [];
|
|
18919
18860
|
|
|
18920
18861
|
const isWebGL2 = capabilities.isWebGL2;
|
|
@@ -18922,7 +18863,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
18922
18863
|
const floatVertexTextures = capabilities.floatVertexTextures;
|
|
18923
18864
|
const maxVertexUniforms = capabilities.maxVertexUniforms;
|
|
18924
18865
|
const vertexTextures = capabilities.vertexTextures;
|
|
18925
|
-
|
|
18926
18866
|
let precision = capabilities.precision;
|
|
18927
18867
|
|
|
18928
18868
|
const shaderIDs = {
|
|
@@ -18943,25 +18883,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
18943
18883
|
SpriteMaterial: 'sprite'
|
|
18944
18884
|
};
|
|
18945
18885
|
|
|
18946
|
-
const parameterNames = [
|
|
18947
|
-
'precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor',
|
|
18948
|
-
'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV',
|
|
18949
|
-
'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap',
|
|
18950
|
-
'objectSpaceNormalMap', 'tangentSpaceNormalMap',
|
|
18951
|
-
'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap',
|
|
18952
|
-
'displacementMap', 'specularMap', , 'roughnessMap', 'metalnessMap', 'gradientMap',
|
|
18953
|
-
'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2',
|
|
18954
|
-
'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning',
|
|
18955
|
-
'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'morphTargetsCount', 'premultipliedAlpha',
|
|
18956
|
-
'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights',
|
|
18957
|
-
'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',
|
|
18958
|
-
'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',
|
|
18959
|
-
'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format',
|
|
18960
|
-
'specularIntensityMap', 'specularColorMap', 'specularColorMapEncoding',
|
|
18961
|
-
'transmission', 'transmissionMap', 'thicknessMap',
|
|
18962
|
-
'sheen', 'sheenColorMap', 'sheenColorMapEncoding', 'sheenRoughnessMap'
|
|
18963
|
-
];
|
|
18964
|
-
|
|
18965
18886
|
function getMaxBones( object ) {
|
|
18966
18887
|
|
|
18967
18888
|
const skeleton = object.skeleton;
|
|
@@ -19017,11 +18938,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19017
18938
|
|
|
19018
18939
|
}
|
|
19019
18940
|
|
|
19020
|
-
|
|
18941
|
+
if ( isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding ) {
|
|
19021
18942
|
|
|
19022
18943
|
encoding = LinearEncoding; // disable inline decode for sRGB textures in WebGL 2
|
|
19023
18944
|
|
|
19024
|
-
}
|
|
18945
|
+
}
|
|
19025
18946
|
|
|
19026
18947
|
return encoding;
|
|
19027
18948
|
|
|
@@ -19054,6 +18975,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19054
18975
|
}
|
|
19055
18976
|
|
|
19056
18977
|
let vertexShader, fragmentShader;
|
|
18978
|
+
let customVertexShaderID, customFragmentShaderID;
|
|
19057
18979
|
|
|
19058
18980
|
if ( shaderID ) {
|
|
19059
18981
|
|
|
@@ -19067,6 +18989,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19067
18989
|
vertexShader = material.vertexShader;
|
|
19068
18990
|
fragmentShader = material.fragmentShader;
|
|
19069
18991
|
|
|
18992
|
+
_customShaders.update( material );
|
|
18993
|
+
|
|
18994
|
+
customVertexShaderID = _customShaders.getVertexShaderID( material );
|
|
18995
|
+
customFragmentShaderID = _customShaders.getFragmentShaderID( material );
|
|
18996
|
+
|
|
19070
18997
|
}
|
|
19071
18998
|
|
|
19072
18999
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
@@ -19085,6 +19012,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19085
19012
|
fragmentShader: fragmentShader,
|
|
19086
19013
|
defines: material.defines,
|
|
19087
19014
|
|
|
19015
|
+
customVertexShaderID: customVertexShaderID,
|
|
19016
|
+
customFragmentShaderID: customFragmentShaderID,
|
|
19017
|
+
|
|
19088
19018
|
isRawShaderMaterial: material.isRawShaderMaterial === true,
|
|
19089
19019
|
glslVersion: material.glslVersion,
|
|
19090
19020
|
|
|
@@ -19145,7 +19075,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19145
19075
|
vertexTangents: ( !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent ),
|
|
19146
19076
|
vertexColors: material.vertexColors,
|
|
19147
19077
|
vertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
|
|
19148
|
-
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,
|
|
19078
|
+
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || !! material.sheenRoughnessMap,
|
|
19149
19079
|
uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
|
|
19150
19080
|
|
|
19151
19081
|
fog: !! fog,
|
|
@@ -19223,8 +19153,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19223
19153
|
|
|
19224
19154
|
} else {
|
|
19225
19155
|
|
|
19226
|
-
array.push(
|
|
19227
|
-
array.push(
|
|
19156
|
+
array.push( parameters.customVertexShaderID );
|
|
19157
|
+
array.push( parameters.customFragmentShaderID );
|
|
19228
19158
|
|
|
19229
19159
|
}
|
|
19230
19160
|
|
|
@@ -19241,14 +19171,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19241
19171
|
|
|
19242
19172
|
if ( parameters.isRawShaderMaterial === false ) {
|
|
19243
19173
|
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
array.push( parameters[ parameterNames[ i ] ] );
|
|
19247
|
-
|
|
19248
|
-
}
|
|
19249
|
-
|
|
19174
|
+
getProgramCacheKeyParameters( array, parameters );
|
|
19175
|
+
getProgramCacheKeyBooleans( array, parameters );
|
|
19250
19176
|
array.push( renderer.outputEncoding );
|
|
19251
|
-
array.push( renderer.gammaFactor );
|
|
19252
19177
|
|
|
19253
19178
|
}
|
|
19254
19179
|
|
|
@@ -19258,6 +19183,161 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19258
19183
|
|
|
19259
19184
|
}
|
|
19260
19185
|
|
|
19186
|
+
function getProgramCacheKeyParameters( array, parameters ) {
|
|
19187
|
+
|
|
19188
|
+
array.push( parameters.precision );
|
|
19189
|
+
array.push( parameters.outputEncoding );
|
|
19190
|
+
array.push( parameters.mapEncoding );
|
|
19191
|
+
array.push( parameters.matcapEncoding );
|
|
19192
|
+
array.push( parameters.envMapMode );
|
|
19193
|
+
array.push( parameters.envMapEncoding );
|
|
19194
|
+
array.push( parameters.lightMapEncoding );
|
|
19195
|
+
array.push( parameters.emissiveMapEncoding );
|
|
19196
|
+
array.push( parameters.combine );
|
|
19197
|
+
array.push( parameters.vertexUvs );
|
|
19198
|
+
array.push( parameters.fogExp2 );
|
|
19199
|
+
array.push( parameters.sizeAttenuation );
|
|
19200
|
+
array.push( parameters.maxBones );
|
|
19201
|
+
array.push( parameters.morphTargetsCount );
|
|
19202
|
+
array.push( parameters.numDirLights );
|
|
19203
|
+
array.push( parameters.numPointLights );
|
|
19204
|
+
array.push( parameters.numSpotLights );
|
|
19205
|
+
array.push( parameters.numHemiLights );
|
|
19206
|
+
array.push( parameters.numRectAreaLights );
|
|
19207
|
+
array.push( parameters.numDirLightShadows );
|
|
19208
|
+
array.push( parameters.numPointLightShadows );
|
|
19209
|
+
array.push( parameters.numSpotLightShadows );
|
|
19210
|
+
array.push( parameters.shadowMapType );
|
|
19211
|
+
array.push( parameters.toneMapping );
|
|
19212
|
+
array.push( parameters.numClippingPlanes );
|
|
19213
|
+
array.push( parameters.numClipIntersection );
|
|
19214
|
+
array.push( parameters.format );
|
|
19215
|
+
array.push( parameters.specularColorMapEncoding );
|
|
19216
|
+
array.push( parameters.sheenColorMapEncoding );
|
|
19217
|
+
|
|
19218
|
+
}
|
|
19219
|
+
|
|
19220
|
+
function getProgramCacheKeyBooleans( array, parameters ) {
|
|
19221
|
+
|
|
19222
|
+
_programLayers.disableAll();
|
|
19223
|
+
|
|
19224
|
+
if ( parameters.isWebGL2 )
|
|
19225
|
+
_programLayers.enable( 0 );
|
|
19226
|
+
if ( parameters.supportsVertexTextures )
|
|
19227
|
+
_programLayers.enable( 1 );
|
|
19228
|
+
if ( parameters.instancing )
|
|
19229
|
+
_programLayers.enable( 2 );
|
|
19230
|
+
if ( parameters.instancingColor )
|
|
19231
|
+
_programLayers.enable( 3 );
|
|
19232
|
+
if ( parameters.map )
|
|
19233
|
+
_programLayers.enable( 4 );
|
|
19234
|
+
if ( parameters.matcap )
|
|
19235
|
+
_programLayers.enable( 5 );
|
|
19236
|
+
if ( parameters.envMap )
|
|
19237
|
+
_programLayers.enable( 6 );
|
|
19238
|
+
if ( parameters.envMapCubeUV )
|
|
19239
|
+
_programLayers.enable( 7 );
|
|
19240
|
+
if ( parameters.lightMap )
|
|
19241
|
+
_programLayers.enable( 8 );
|
|
19242
|
+
if ( parameters.aoMap )
|
|
19243
|
+
_programLayers.enable( 9 );
|
|
19244
|
+
if ( parameters.emissiveMap )
|
|
19245
|
+
_programLayers.enable( 10 );
|
|
19246
|
+
if ( parameters.bumpMap )
|
|
19247
|
+
_programLayers.enable( 11 );
|
|
19248
|
+
if ( parameters.normalMap )
|
|
19249
|
+
_programLayers.enable( 12 );
|
|
19250
|
+
if ( parameters.objectSpaceNormalMap )
|
|
19251
|
+
_programLayers.enable( 13 );
|
|
19252
|
+
if ( parameters.tangentSpaceNormalMap )
|
|
19253
|
+
_programLayers.enable( 14 );
|
|
19254
|
+
if ( parameters.clearcoat )
|
|
19255
|
+
_programLayers.enable( 15 );
|
|
19256
|
+
if ( parameters.clearcoatMap )
|
|
19257
|
+
_programLayers.enable( 16 );
|
|
19258
|
+
if ( parameters.clearcoatRoughnessMap )
|
|
19259
|
+
_programLayers.enable( 17 );
|
|
19260
|
+
if ( parameters.clearcoatNormalMap )
|
|
19261
|
+
_programLayers.enable( 18 );
|
|
19262
|
+
if ( parameters.displacementMap )
|
|
19263
|
+
_programLayers.enable( 19 );
|
|
19264
|
+
if ( parameters.specularMap )
|
|
19265
|
+
_programLayers.enable( 20 );
|
|
19266
|
+
if ( parameters.roughnessMap )
|
|
19267
|
+
_programLayers.enable( 21 );
|
|
19268
|
+
if ( parameters.metalnessMap )
|
|
19269
|
+
_programLayers.enable( 22 );
|
|
19270
|
+
if ( parameters.gradientMap )
|
|
19271
|
+
_programLayers.enable( 23 );
|
|
19272
|
+
if ( parameters.alphaMap )
|
|
19273
|
+
_programLayers.enable( 24 );
|
|
19274
|
+
if ( parameters.alphaTest )
|
|
19275
|
+
_programLayers.enable( 25 );
|
|
19276
|
+
if ( parameters.vertexColors )
|
|
19277
|
+
_programLayers.enable( 26 );
|
|
19278
|
+
if ( parameters.vertexAlphas )
|
|
19279
|
+
_programLayers.enable( 27 );
|
|
19280
|
+
if ( parameters.vertexUvs )
|
|
19281
|
+
_programLayers.enable( 28 );
|
|
19282
|
+
if ( parameters.vertexTangents )
|
|
19283
|
+
_programLayers.enable( 29 );
|
|
19284
|
+
if ( parameters.uvsVertexOnly )
|
|
19285
|
+
_programLayers.enable( 30 );
|
|
19286
|
+
if ( parameters.fog )
|
|
19287
|
+
_programLayers.enable( 31 );
|
|
19288
|
+
|
|
19289
|
+
array.push( _programLayers.mask );
|
|
19290
|
+
_programLayers.disableAll();
|
|
19291
|
+
|
|
19292
|
+
if ( parameters.useFog )
|
|
19293
|
+
_programLayers.enable( 0 );
|
|
19294
|
+
if ( parameters.flatShading )
|
|
19295
|
+
_programLayers.enable( 1 );
|
|
19296
|
+
if ( parameters.logarithmicDepthBuffer )
|
|
19297
|
+
_programLayers.enable( 2 );
|
|
19298
|
+
if ( parameters.skinning )
|
|
19299
|
+
_programLayers.enable( 3 );
|
|
19300
|
+
if ( parameters.useVertexTexture )
|
|
19301
|
+
_programLayers.enable( 4 );
|
|
19302
|
+
if ( parameters.morphTargets )
|
|
19303
|
+
_programLayers.enable( 5 );
|
|
19304
|
+
if ( parameters.morphNormals )
|
|
19305
|
+
_programLayers.enable( 6 );
|
|
19306
|
+
if ( parameters.premultipliedAlpha )
|
|
19307
|
+
_programLayers.enable( 7 );
|
|
19308
|
+
if ( parameters.shadowMapEnabled )
|
|
19309
|
+
_programLayers.enable( 8 );
|
|
19310
|
+
if ( parameters.physicallyCorrectLights )
|
|
19311
|
+
_programLayers.enable( 9 );
|
|
19312
|
+
if ( parameters.doubleSided )
|
|
19313
|
+
_programLayers.enable( 10 );
|
|
19314
|
+
if ( parameters.flipSided )
|
|
19315
|
+
_programLayers.enable( 11 );
|
|
19316
|
+
if ( parameters.depthPacking )
|
|
19317
|
+
_programLayers.enable( 12 );
|
|
19318
|
+
if ( parameters.dithering )
|
|
19319
|
+
_programLayers.enable( 13 );
|
|
19320
|
+
if ( parameters.specularIntensityMap )
|
|
19321
|
+
_programLayers.enable( 14 );
|
|
19322
|
+
if ( parameters.specularColorMap )
|
|
19323
|
+
_programLayers.enable( 15 );
|
|
19324
|
+
if ( parameters.transmission )
|
|
19325
|
+
_programLayers.enable( 16 );
|
|
19326
|
+
if ( parameters.transmissionMap )
|
|
19327
|
+
_programLayers.enable( 17 );
|
|
19328
|
+
if ( parameters.thicknessMap )
|
|
19329
|
+
_programLayers.enable( 18 );
|
|
19330
|
+
if ( parameters.sheen )
|
|
19331
|
+
_programLayers.enable( 19 );
|
|
19332
|
+
if ( parameters.sheenColorMap )
|
|
19333
|
+
_programLayers.enable( 20 );
|
|
19334
|
+
if ( parameters.sheenRoughnessMap )
|
|
19335
|
+
_programLayers.enable( 21 );
|
|
19336
|
+
|
|
19337
|
+
array.push( _programLayers.mask );
|
|
19338
|
+
|
|
19339
|
+
}
|
|
19340
|
+
|
|
19261
19341
|
function getUniforms( material ) {
|
|
19262
19342
|
|
|
19263
19343
|
const shaderID = shaderIDs[ material.type ];
|
|
@@ -19325,14 +19405,28 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19325
19405
|
|
|
19326
19406
|
}
|
|
19327
19407
|
|
|
19408
|
+
function releaseShaderCache( material ) {
|
|
19409
|
+
|
|
19410
|
+
_customShaders.remove( material );
|
|
19411
|
+
|
|
19412
|
+
}
|
|
19413
|
+
|
|
19414
|
+
function dispose() {
|
|
19415
|
+
|
|
19416
|
+
_customShaders.dispose();
|
|
19417
|
+
|
|
19418
|
+
}
|
|
19419
|
+
|
|
19328
19420
|
return {
|
|
19329
19421
|
getParameters: getParameters,
|
|
19330
19422
|
getProgramCacheKey: getProgramCacheKey,
|
|
19331
19423
|
getUniforms: getUniforms,
|
|
19332
19424
|
acquireProgram: acquireProgram,
|
|
19333
19425
|
releaseProgram: releaseProgram,
|
|
19426
|
+
releaseShaderCache: releaseShaderCache,
|
|
19334
19427
|
// Exposed for resource monitoring & error feedback via renderer.info:
|
|
19335
|
-
programs: programs
|
|
19428
|
+
programs: programs,
|
|
19429
|
+
dispose: dispose
|
|
19336
19430
|
};
|
|
19337
19431
|
|
|
19338
19432
|
}
|
|
@@ -19393,10 +19487,6 @@ function painterSortStable( a, b ) {
|
|
|
19393
19487
|
|
|
19394
19488
|
return a.renderOrder - b.renderOrder;
|
|
19395
19489
|
|
|
19396
|
-
} else if ( a.program !== b.program ) {
|
|
19397
|
-
|
|
19398
|
-
return a.program.id - b.program.id;
|
|
19399
|
-
|
|
19400
19490
|
} else if ( a.material.id !== b.material.id ) {
|
|
19401
19491
|
|
|
19402
19492
|
return a.material.id - b.material.id;
|
|
@@ -19436,7 +19526,7 @@ function reversePainterSortStable( a, b ) {
|
|
|
19436
19526
|
}
|
|
19437
19527
|
|
|
19438
19528
|
|
|
19439
|
-
function WebGLRenderList(
|
|
19529
|
+
function WebGLRenderList() {
|
|
19440
19530
|
|
|
19441
19531
|
const renderItems = [];
|
|
19442
19532
|
let renderItemsIndex = 0;
|
|
@@ -19445,8 +19535,6 @@ function WebGLRenderList( properties ) {
|
|
|
19445
19535
|
const transmissive = [];
|
|
19446
19536
|
const transparent = [];
|
|
19447
19537
|
|
|
19448
|
-
const defaultProgram = { id: - 1 };
|
|
19449
|
-
|
|
19450
19538
|
function init() {
|
|
19451
19539
|
|
|
19452
19540
|
renderItemsIndex = 0;
|
|
@@ -19460,7 +19548,6 @@ function WebGLRenderList( properties ) {
|
|
|
19460
19548
|
function getNextRenderItem( object, geometry, material, groupOrder, z, group ) {
|
|
19461
19549
|
|
|
19462
19550
|
let renderItem = renderItems[ renderItemsIndex ];
|
|
19463
|
-
const materialProperties = properties.get( material );
|
|
19464
19551
|
|
|
19465
19552
|
if ( renderItem === undefined ) {
|
|
19466
19553
|
|
|
@@ -19469,7 +19556,6 @@ function WebGLRenderList( properties ) {
|
|
|
19469
19556
|
object: object,
|
|
19470
19557
|
geometry: geometry,
|
|
19471
19558
|
material: material,
|
|
19472
|
-
program: materialProperties.program || defaultProgram,
|
|
19473
19559
|
groupOrder: groupOrder,
|
|
19474
19560
|
renderOrder: object.renderOrder,
|
|
19475
19561
|
z: z,
|
|
@@ -19484,7 +19570,6 @@ function WebGLRenderList( properties ) {
|
|
|
19484
19570
|
renderItem.object = object;
|
|
19485
19571
|
renderItem.geometry = geometry;
|
|
19486
19572
|
renderItem.material = material;
|
|
19487
|
-
renderItem.program = materialProperties.program || defaultProgram;
|
|
19488
19573
|
renderItem.groupOrder = groupOrder;
|
|
19489
19574
|
renderItem.renderOrder = object.renderOrder;
|
|
19490
19575
|
renderItem.z = z;
|
|
@@ -19560,7 +19645,6 @@ function WebGLRenderList( properties ) {
|
|
|
19560
19645
|
renderItem.object = null;
|
|
19561
19646
|
renderItem.geometry = null;
|
|
19562
19647
|
renderItem.material = null;
|
|
19563
|
-
renderItem.program = null;
|
|
19564
19648
|
renderItem.group = null;
|
|
19565
19649
|
|
|
19566
19650
|
}
|
|
@@ -19583,7 +19667,7 @@ function WebGLRenderList( properties ) {
|
|
|
19583
19667
|
|
|
19584
19668
|
}
|
|
19585
19669
|
|
|
19586
|
-
function WebGLRenderLists(
|
|
19670
|
+
function WebGLRenderLists() {
|
|
19587
19671
|
|
|
19588
19672
|
let lists = new WeakMap();
|
|
19589
19673
|
|
|
@@ -19593,14 +19677,14 @@ function WebGLRenderLists( properties ) {
|
|
|
19593
19677
|
|
|
19594
19678
|
if ( lists.has( scene ) === false ) {
|
|
19595
19679
|
|
|
19596
|
-
list = new WebGLRenderList(
|
|
19680
|
+
list = new WebGLRenderList();
|
|
19597
19681
|
lists.set( scene, [ list ] );
|
|
19598
19682
|
|
|
19599
19683
|
} else {
|
|
19600
19684
|
|
|
19601
19685
|
if ( renderCallDepth >= lists.get( scene ).length ) {
|
|
19602
19686
|
|
|
19603
|
-
list = new WebGLRenderList(
|
|
19687
|
+
list = new WebGLRenderList();
|
|
19604
19688
|
lists.get( scene ).push( list );
|
|
19605
19689
|
|
|
19606
19690
|
} else {
|
|
@@ -21657,6 +21741,34 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
21657
21741
|
|
|
21658
21742
|
}
|
|
21659
21743
|
|
|
21744
|
+
function texSubImage3D() {
|
|
21745
|
+
|
|
21746
|
+
try {
|
|
21747
|
+
|
|
21748
|
+
gl.texSubImage3D.apply( gl, arguments );
|
|
21749
|
+
|
|
21750
|
+
} catch ( error ) {
|
|
21751
|
+
|
|
21752
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21753
|
+
|
|
21754
|
+
}
|
|
21755
|
+
|
|
21756
|
+
}
|
|
21757
|
+
|
|
21758
|
+
function compressedTexSubImage2D() {
|
|
21759
|
+
|
|
21760
|
+
try {
|
|
21761
|
+
|
|
21762
|
+
gl.compressedTexSubImage2D.apply( gl, arguments );
|
|
21763
|
+
|
|
21764
|
+
} catch ( error ) {
|
|
21765
|
+
|
|
21766
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21767
|
+
|
|
21768
|
+
}
|
|
21769
|
+
|
|
21770
|
+
}
|
|
21771
|
+
|
|
21660
21772
|
function texStorage2D() {
|
|
21661
21773
|
|
|
21662
21774
|
try {
|
|
@@ -21671,6 +21783,20 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
21671
21783
|
|
|
21672
21784
|
}
|
|
21673
21785
|
|
|
21786
|
+
function texStorage3D() {
|
|
21787
|
+
|
|
21788
|
+
try {
|
|
21789
|
+
|
|
21790
|
+
gl.texStorage3D.apply( gl, arguments );
|
|
21791
|
+
|
|
21792
|
+
} catch ( error ) {
|
|
21793
|
+
|
|
21794
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21795
|
+
|
|
21796
|
+
}
|
|
21797
|
+
|
|
21798
|
+
}
|
|
21799
|
+
|
|
21674
21800
|
function texImage2D() {
|
|
21675
21801
|
|
|
21676
21802
|
try {
|
|
@@ -21848,7 +21974,10 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
21848
21974
|
texImage3D: texImage3D,
|
|
21849
21975
|
|
|
21850
21976
|
texStorage2D: texStorage2D,
|
|
21977
|
+
texStorage3D: texStorage3D,
|
|
21851
21978
|
texSubImage2D: texSubImage2D,
|
|
21979
|
+
texSubImage3D: texSubImage3D,
|
|
21980
|
+
compressedTexSubImage2D: compressedTexSubImage2D,
|
|
21852
21981
|
|
|
21853
21982
|
scissor: scissor,
|
|
21854
21983
|
viewport: viewport,
|
|
@@ -21987,7 +22116,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
21987
22116
|
|
|
21988
22117
|
}
|
|
21989
22118
|
|
|
21990
|
-
function getInternalFormat( internalFormatName, glFormat, glType
|
|
22119
|
+
function getInternalFormat( internalFormatName, glFormat, glType, encoding ) {
|
|
21991
22120
|
|
|
21992
22121
|
if ( isWebGL2 === false ) return glFormat;
|
|
21993
22122
|
|
|
@@ -22021,9 +22150,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22021
22150
|
|
|
22022
22151
|
if ( glType === 5126 ) internalFormat = 34836;
|
|
22023
22152
|
if ( glType === 5131 ) internalFormat = 34842;
|
|
22024
|
-
|
|
22025
|
-
if ( glType === 5121 ) internalFormat = 32856;
|
|
22026
|
-
|
|
22153
|
+
if ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding ) ? 35907 : 32856;
|
|
22027
22154
|
|
|
22028
22155
|
}
|
|
22029
22156
|
|
|
@@ -22040,18 +22167,20 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22040
22167
|
|
|
22041
22168
|
function getMipLevels( texture, image, supportsMips ) {
|
|
22042
22169
|
|
|
22043
|
-
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true ) {
|
|
22044
|
-
|
|
22045
|
-
// generated mipmaps via gl.generateMipmap()
|
|
22170
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
|
|
22046
22171
|
|
|
22047
22172
|
return Math.log2( Math.max( image.width, image.height ) ) + 1;
|
|
22048
22173
|
|
|
22049
|
-
} else if ( texture.mipmaps.length > 0 ) {
|
|
22174
|
+
} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {
|
|
22050
22175
|
|
|
22051
22176
|
// user-defined mipmaps
|
|
22052
22177
|
|
|
22053
22178
|
return texture.mipmaps.length;
|
|
22054
22179
|
|
|
22180
|
+
} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {
|
|
22181
|
+
|
|
22182
|
+
return image.mipmaps.length;
|
|
22183
|
+
|
|
22055
22184
|
} else {
|
|
22056
22185
|
|
|
22057
22186
|
// texture without mipmaps (only base level)
|
|
@@ -22420,6 +22549,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22420
22549
|
let mipmap;
|
|
22421
22550
|
const mipmaps = texture.mipmaps;
|
|
22422
22551
|
|
|
22552
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22553
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22554
|
+
const levels = getMipLevels( texture, image, supportsMips );
|
|
22555
|
+
|
|
22423
22556
|
if ( texture.isDepthTexture ) {
|
|
22424
22557
|
|
|
22425
22558
|
// populate depth texture with dummy data
|
|
@@ -22496,7 +22629,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22496
22629
|
|
|
22497
22630
|
//
|
|
22498
22631
|
|
|
22499
|
-
|
|
22632
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22633
|
+
|
|
22634
|
+
state.texStorage2D( 3553, 1, glInternalFormat, image.width, image.height );
|
|
22635
|
+
|
|
22636
|
+
} else {
|
|
22637
|
+
|
|
22638
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22639
|
+
|
|
22640
|
+
}
|
|
22500
22641
|
|
|
22501
22642
|
} else if ( texture.isDataTexture ) {
|
|
22502
22643
|
|
|
@@ -22506,10 +22647,25 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22506
22647
|
|
|
22507
22648
|
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22508
22649
|
|
|
22650
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22651
|
+
|
|
22652
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22653
|
+
|
|
22654
|
+
}
|
|
22655
|
+
|
|
22509
22656
|
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22510
22657
|
|
|
22511
22658
|
mipmap = mipmaps[ i ];
|
|
22512
|
-
|
|
22659
|
+
|
|
22660
|
+
if ( useTexStorage ) {
|
|
22661
|
+
|
|
22662
|
+
state.texSubImage2D( 3553, 0, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22663
|
+
|
|
22664
|
+
} else {
|
|
22665
|
+
|
|
22666
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22667
|
+
|
|
22668
|
+
}
|
|
22513
22669
|
|
|
22514
22670
|
}
|
|
22515
22671
|
|
|
@@ -22517,12 +22673,32 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22517
22673
|
|
|
22518
22674
|
} else {
|
|
22519
22675
|
|
|
22520
|
-
|
|
22676
|
+
if ( useTexStorage ) {
|
|
22677
|
+
|
|
22678
|
+
if ( allocateMemory ) {
|
|
22679
|
+
|
|
22680
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
22681
|
+
|
|
22682
|
+
}
|
|
22683
|
+
|
|
22684
|
+
state.texSubImage2D( 3553, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
22685
|
+
|
|
22686
|
+
} else {
|
|
22687
|
+
|
|
22688
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
22689
|
+
|
|
22690
|
+
}
|
|
22521
22691
|
|
|
22522
22692
|
}
|
|
22523
22693
|
|
|
22524
22694
|
} else if ( texture.isCompressedTexture ) {
|
|
22525
22695
|
|
|
22696
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22697
|
+
|
|
22698
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22699
|
+
|
|
22700
|
+
}
|
|
22701
|
+
|
|
22526
22702
|
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22527
22703
|
|
|
22528
22704
|
mipmap = mipmaps[ i ];
|
|
@@ -22531,7 +22707,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22531
22707
|
|
|
22532
22708
|
if ( glFormat !== null ) {
|
|
22533
22709
|
|
|
22534
|
-
|
|
22710
|
+
if ( useTexStorage ) {
|
|
22711
|
+
|
|
22712
|
+
state.compressedTexSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
22713
|
+
|
|
22714
|
+
} else {
|
|
22715
|
+
|
|
22716
|
+
state.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
22717
|
+
|
|
22718
|
+
}
|
|
22535
22719
|
|
|
22536
22720
|
} else {
|
|
22537
22721
|
|
|
@@ -22541,7 +22725,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22541
22725
|
|
|
22542
22726
|
} else {
|
|
22543
22727
|
|
|
22544
|
-
|
|
22728
|
+
if ( useTexStorage ) {
|
|
22729
|
+
|
|
22730
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22731
|
+
|
|
22732
|
+
} else {
|
|
22733
|
+
|
|
22734
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22735
|
+
|
|
22736
|
+
}
|
|
22545
22737
|
|
|
22546
22738
|
}
|
|
22547
22739
|
|
|
@@ -22549,11 +22741,51 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22549
22741
|
|
|
22550
22742
|
} else if ( texture.isDataTexture2DArray ) {
|
|
22551
22743
|
|
|
22552
|
-
|
|
22744
|
+
if ( useTexStorage ) {
|
|
22745
|
+
|
|
22746
|
+
if ( allocateMemory ) {
|
|
22747
|
+
|
|
22748
|
+
state.texStorage3D( 35866, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22749
|
+
|
|
22750
|
+
}
|
|
22751
|
+
|
|
22752
|
+
state.texSubImage3D( 35866, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
22753
|
+
|
|
22754
|
+
} else {
|
|
22755
|
+
|
|
22756
|
+
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
22757
|
+
|
|
22758
|
+
}
|
|
22553
22759
|
|
|
22554
22760
|
} else if ( texture.isDataTexture3D ) {
|
|
22555
22761
|
|
|
22556
|
-
|
|
22762
|
+
if ( useTexStorage ) {
|
|
22763
|
+
|
|
22764
|
+
if ( allocateMemory ) {
|
|
22765
|
+
|
|
22766
|
+
state.texStorage3D( 32879, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22767
|
+
|
|
22768
|
+
}
|
|
22769
|
+
|
|
22770
|
+
state.texSubImage3D( 32879, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
22771
|
+
|
|
22772
|
+
} else {
|
|
22773
|
+
|
|
22774
|
+
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
22775
|
+
|
|
22776
|
+
}
|
|
22777
|
+
|
|
22778
|
+
} else if ( texture.isFramebufferTexture ) {
|
|
22779
|
+
|
|
22780
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22781
|
+
|
|
22782
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
22783
|
+
|
|
22784
|
+
} else {
|
|
22785
|
+
|
|
22786
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22787
|
+
|
|
22788
|
+
}
|
|
22557
22789
|
|
|
22558
22790
|
} else {
|
|
22559
22791
|
|
|
@@ -22563,10 +22795,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22563
22795
|
// if there are no manual mipmaps
|
|
22564
22796
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
22565
22797
|
|
|
22566
|
-
const levels = getMipLevels( texture, image, supportsMips );
|
|
22567
|
-
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22568
|
-
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22569
|
-
|
|
22570
22798
|
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22571
22799
|
|
|
22572
22800
|
if ( useTexStorage && allocateMemory ) {
|
|
@@ -22666,12 +22894,22 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22666
22894
|
glType = utils.convert( texture.type ),
|
|
22667
22895
|
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
22668
22896
|
|
|
22897
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22898
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22899
|
+
let levels = getMipLevels( texture, image, supportsMips );
|
|
22900
|
+
|
|
22669
22901
|
setTextureParameters( 34067, texture, supportsMips );
|
|
22670
22902
|
|
|
22671
22903
|
let mipmaps;
|
|
22672
22904
|
|
|
22673
22905
|
if ( isCompressed ) {
|
|
22674
22906
|
|
|
22907
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22908
|
+
|
|
22909
|
+
state.texStorage2D( 34067, levels, glInternalFormat, image.width, image.height );
|
|
22910
|
+
|
|
22911
|
+
}
|
|
22912
|
+
|
|
22675
22913
|
for ( let i = 0; i < 6; i ++ ) {
|
|
22676
22914
|
|
|
22677
22915
|
mipmaps = cubeImage[ i ].mipmaps;
|
|
@@ -22684,7 +22922,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22684
22922
|
|
|
22685
22923
|
if ( glFormat !== null ) {
|
|
22686
22924
|
|
|
22687
|
-
|
|
22925
|
+
if ( useTexStorage ) {
|
|
22926
|
+
|
|
22927
|
+
state.compressedTexSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
22928
|
+
|
|
22929
|
+
} else {
|
|
22930
|
+
|
|
22931
|
+
state.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
22932
|
+
|
|
22933
|
+
}
|
|
22688
22934
|
|
|
22689
22935
|
} else {
|
|
22690
22936
|
|
|
@@ -22694,7 +22940,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22694
22940
|
|
|
22695
22941
|
} else {
|
|
22696
22942
|
|
|
22697
|
-
|
|
22943
|
+
if ( useTexStorage ) {
|
|
22944
|
+
|
|
22945
|
+
state.texSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22946
|
+
|
|
22947
|
+
} else {
|
|
22948
|
+
|
|
22949
|
+
state.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22950
|
+
|
|
22951
|
+
}
|
|
22698
22952
|
|
|
22699
22953
|
}
|
|
22700
22954
|
|
|
@@ -22706,30 +22960,74 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22706
22960
|
|
|
22707
22961
|
mipmaps = texture.mipmaps;
|
|
22708
22962
|
|
|
22963
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22964
|
+
|
|
22965
|
+
// TODO: Uniformly handle mipmap definitions
|
|
22966
|
+
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
22967
|
+
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
22968
|
+
|
|
22969
|
+
if ( mipmaps.length > 0 ) levels ++;
|
|
22970
|
+
|
|
22971
|
+
state.texStorage2D( 34067, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
|
|
22972
|
+
|
|
22973
|
+
}
|
|
22974
|
+
|
|
22709
22975
|
for ( let i = 0; i < 6; i ++ ) {
|
|
22710
22976
|
|
|
22711
22977
|
if ( isDataTexture ) {
|
|
22712
22978
|
|
|
22713
|
-
|
|
22979
|
+
if ( useTexStorage ) {
|
|
22980
|
+
|
|
22981
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
|
|
22982
|
+
|
|
22983
|
+
} else {
|
|
22984
|
+
|
|
22985
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
|
|
22986
|
+
|
|
22987
|
+
}
|
|
22714
22988
|
|
|
22715
22989
|
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
22716
22990
|
|
|
22717
22991
|
const mipmap = mipmaps[ j ];
|
|
22718
22992
|
const mipmapImage = mipmap.image[ i ].image;
|
|
22719
22993
|
|
|
22720
|
-
|
|
22994
|
+
if ( useTexStorage ) {
|
|
22995
|
+
|
|
22996
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
|
|
22997
|
+
|
|
22998
|
+
} else {
|
|
22999
|
+
|
|
23000
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );
|
|
23001
|
+
|
|
23002
|
+
}
|
|
22721
23003
|
|
|
22722
23004
|
}
|
|
22723
23005
|
|
|
22724
23006
|
} else {
|
|
22725
23007
|
|
|
22726
|
-
|
|
23008
|
+
if ( useTexStorage ) {
|
|
23009
|
+
|
|
23010
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
|
|
23011
|
+
|
|
23012
|
+
} else {
|
|
23013
|
+
|
|
23014
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
|
|
23015
|
+
|
|
23016
|
+
}
|
|
22727
23017
|
|
|
22728
23018
|
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
22729
23019
|
|
|
22730
23020
|
const mipmap = mipmaps[ j ];
|
|
22731
23021
|
|
|
22732
|
-
|
|
23022
|
+
if ( useTexStorage ) {
|
|
23023
|
+
|
|
23024
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
|
|
23025
|
+
|
|
23026
|
+
} else {
|
|
23027
|
+
|
|
23028
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );
|
|
23029
|
+
|
|
23030
|
+
}
|
|
22733
23031
|
|
|
22734
23032
|
}
|
|
22735
23033
|
|
|
@@ -24679,7 +24977,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
24679
24977
|
|
|
24680
24978
|
newRenderTarget = new WebGLRenderTarget(
|
|
24681
24979
|
glBaseLayer.framebufferWidth,
|
|
24682
|
-
glBaseLayer.framebufferHeight
|
|
24980
|
+
glBaseLayer.framebufferHeight,
|
|
24981
|
+
{
|
|
24982
|
+
format: RGBAFormat,
|
|
24983
|
+
type: UnsignedByteType,
|
|
24984
|
+
encoding: renderer.outputEncoding
|
|
24985
|
+
}
|
|
24683
24986
|
);
|
|
24684
24987
|
|
|
24685
24988
|
} else {
|
|
@@ -24691,7 +24994,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
24691
24994
|
|
|
24692
24995
|
if ( attributes.depth ) {
|
|
24693
24996
|
|
|
24694
|
-
glDepthFormat = attributes.stencil ? 35056 :
|
|
24997
|
+
glDepthFormat = attributes.stencil ? 35056 : 33190;
|
|
24695
24998
|
depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
|
|
24696
24999
|
depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType;
|
|
24697
25000
|
|
|
@@ -24721,6 +25024,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
24721
25024
|
stencilBuffer: attributes.stencil,
|
|
24722
25025
|
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
24723
25026
|
useRenderToTexture: hasMultisampledRenderToTexture,
|
|
25027
|
+
encoding: renderer.outputEncoding
|
|
24724
25028
|
} );
|
|
24725
25029
|
|
|
24726
25030
|
} else {
|
|
@@ -24734,6 +25038,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
24734
25038
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24735
25039
|
stencilBuffer: attributes.stencil,
|
|
24736
25040
|
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
25041
|
+
encoding: renderer.outputEncoding
|
|
24737
25042
|
} );
|
|
24738
25043
|
|
|
24739
25044
|
}
|
|
@@ -24741,7 +25046,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
24741
25046
|
}
|
|
24742
25047
|
|
|
24743
25048
|
// Set foveation to maximum.
|
|
24744
|
-
this.setFoveation( 0 );
|
|
25049
|
+
this.setFoveation( 1.0 );
|
|
24745
25050
|
|
|
24746
25051
|
referenceSpace = await session.requestReferenceSpace( referenceSpaceType );
|
|
24747
25052
|
|
|
@@ -25982,7 +26287,6 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
25982
26287
|
|
|
25983
26288
|
// physically based shading
|
|
25984
26289
|
|
|
25985
|
-
this.gammaFactor = 2.0; // for backwards compatibility
|
|
25986
26290
|
this.outputEncoding = LinearEncoding;
|
|
25987
26291
|
|
|
25988
26292
|
// physical lights
|
|
@@ -26177,7 +26481,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
26177
26481
|
clipping = new WebGLClipping( properties );
|
|
26178
26482
|
programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
|
|
26179
26483
|
materials = new WebGLMaterials( properties );
|
|
26180
|
-
renderLists = new WebGLRenderLists(
|
|
26484
|
+
renderLists = new WebGLRenderLists();
|
|
26181
26485
|
renderStates = new WebGLRenderStates( extensions, capabilities );
|
|
26182
26486
|
background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
|
|
26183
26487
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
@@ -26443,6 +26747,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
26443
26747
|
cubeuvmaps.dispose();
|
|
26444
26748
|
objects.dispose();
|
|
26445
26749
|
bindingStates.dispose();
|
|
26750
|
+
programCache.dispose();
|
|
26446
26751
|
|
|
26447
26752
|
xr.dispose();
|
|
26448
26753
|
|
|
@@ -26527,6 +26832,12 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
26527
26832
|
|
|
26528
26833
|
} );
|
|
26529
26834
|
|
|
26835
|
+
if ( material.isShaderMaterial ) {
|
|
26836
|
+
|
|
26837
|
+
programCache.releaseShaderCache( material );
|
|
26838
|
+
|
|
26839
|
+
}
|
|
26840
|
+
|
|
26530
26841
|
}
|
|
26531
26842
|
|
|
26532
26843
|
}
|
|
@@ -27279,6 +27590,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
27279
27590
|
materialProperties.numIntersection = parameters.numClipIntersection;
|
|
27280
27591
|
materialProperties.vertexAlphas = parameters.vertexAlphas;
|
|
27281
27592
|
materialProperties.vertexTangents = parameters.vertexTangents;
|
|
27593
|
+
materialProperties.toneMapping = parameters.toneMapping;
|
|
27282
27594
|
|
|
27283
27595
|
}
|
|
27284
27596
|
|
|
@@ -27297,6 +27609,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
27297
27609
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
27298
27610
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
27299
27611
|
const morphTargetsCount = !! geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;
|
|
27612
|
+
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;
|
|
27300
27613
|
|
|
27301
27614
|
const materialProperties = properties.get( material );
|
|
27302
27615
|
const lights = currentRenderState.state.lights;
|
|
@@ -27378,6 +27691,10 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
27378
27691
|
|
|
27379
27692
|
needsProgramChange = true;
|
|
27380
27693
|
|
|
27694
|
+
} else if ( materialProperties.toneMapping !== toneMapping ) {
|
|
27695
|
+
|
|
27696
|
+
needsProgramChange = true;
|
|
27697
|
+
|
|
27381
27698
|
} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {
|
|
27382
27699
|
|
|
27383
27700
|
needsProgramChange = true;
|
|
@@ -27940,25 +28257,20 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
27940
28257
|
|
|
27941
28258
|
this.copyFramebufferToTexture = function ( position, texture, level = 0 ) {
|
|
27942
28259
|
|
|
27943
|
-
|
|
27944
|
-
const width = Math.floor( texture.image.width * levelScale );
|
|
27945
|
-
const height = Math.floor( texture.image.height * levelScale );
|
|
27946
|
-
|
|
27947
|
-
let glFormat = utils.convert( texture.format );
|
|
27948
|
-
|
|
27949
|
-
if ( capabilities.isWebGL2 ) {
|
|
27950
|
-
|
|
27951
|
-
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
|
|
27952
|
-
// Not needed in Chrome 93+
|
|
28260
|
+
if ( texture.isFramebufferTexture !== true ) {
|
|
27953
28261
|
|
|
27954
|
-
|
|
27955
|
-
|
|
28262
|
+
console.error( 'THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.' );
|
|
28263
|
+
return;
|
|
27956
28264
|
|
|
27957
28265
|
}
|
|
27958
28266
|
|
|
28267
|
+
const levelScale = Math.pow( 2, - level );
|
|
28268
|
+
const width = Math.floor( texture.image.width * levelScale );
|
|
28269
|
+
const height = Math.floor( texture.image.height * levelScale );
|
|
28270
|
+
|
|
27959
28271
|
textures.setTexture2D( texture, 0 );
|
|
27960
28272
|
|
|
27961
|
-
_gl.
|
|
28273
|
+
_gl.copyTexSubImage2D( 3553, level, 0, 0, position.x, position.y, width, height );
|
|
27962
28274
|
|
|
27963
28275
|
state.unbindTexture();
|
|
27964
28276
|
|
|
@@ -28108,7 +28420,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
28108
28420
|
|
|
28109
28421
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
28110
28422
|
|
|
28111
|
-
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
28423
|
+
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
28112
28424
|
|
|
28113
28425
|
}
|
|
28114
28426
|
|
|
@@ -28203,7 +28515,7 @@ class Scene extends Object3D {
|
|
|
28203
28515
|
|
|
28204
28516
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
28205
28517
|
|
|
28206
|
-
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
28518
|
+
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
28207
28519
|
|
|
28208
28520
|
}
|
|
28209
28521
|
|
|
@@ -29257,8 +29569,6 @@ class DataTexture extends Texture {
|
|
|
29257
29569
|
this.flipY = false;
|
|
29258
29570
|
this.unpackAlignment = 1;
|
|
29259
29571
|
|
|
29260
|
-
this.needsUpdate = true;
|
|
29261
|
-
|
|
29262
29572
|
}
|
|
29263
29573
|
|
|
29264
29574
|
}
|
|
@@ -29436,6 +29746,7 @@ class Skeleton {
|
|
|
29436
29746
|
boneMatrices.set( this.boneMatrices ); // copy current values
|
|
29437
29747
|
|
|
29438
29748
|
const boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );
|
|
29749
|
+
boneTexture.needsUpdate = true;
|
|
29439
29750
|
|
|
29440
29751
|
this.boneMatrices = boneMatrices;
|
|
29441
29752
|
this.boneTexture = boneTexture;
|
|
@@ -30351,6 +30662,27 @@ class VideoTexture extends Texture {
|
|
|
30351
30662
|
|
|
30352
30663
|
VideoTexture.prototype.isVideoTexture = true;
|
|
30353
30664
|
|
|
30665
|
+
class FramebufferTexture extends Texture {
|
|
30666
|
+
|
|
30667
|
+
constructor( width, height, format ) {
|
|
30668
|
+
|
|
30669
|
+
super( { width, height } );
|
|
30670
|
+
|
|
30671
|
+
this.format = format;
|
|
30672
|
+
|
|
30673
|
+
this.magFilter = NearestFilter;
|
|
30674
|
+
this.minFilter = NearestFilter;
|
|
30675
|
+
|
|
30676
|
+
this.generateMipmaps = false;
|
|
30677
|
+
|
|
30678
|
+
this.needsUpdate = true;
|
|
30679
|
+
|
|
30680
|
+
}
|
|
30681
|
+
|
|
30682
|
+
}
|
|
30683
|
+
|
|
30684
|
+
FramebufferTexture.prototype.isFramebufferTexture = true;
|
|
30685
|
+
|
|
30354
30686
|
class CompressedTexture extends Texture {
|
|
30355
30687
|
|
|
30356
30688
|
constructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
|
|
@@ -32095,7 +32427,7 @@ CatmullRomCurve3.prototype.isCatmullRomCurve3 = true;
|
|
|
32095
32427
|
|
|
32096
32428
|
/**
|
|
32097
32429
|
* Bezier Curves formulas obtained from
|
|
32098
|
-
*
|
|
32430
|
+
* https://en.wikipedia.org/wiki/B%C3%A9zier_curve
|
|
32099
32431
|
*/
|
|
32100
32432
|
|
|
32101
32433
|
function CatmullRom( t, p0, p1, p2, p3 ) {
|
|
@@ -34990,14 +35322,75 @@ class LatheGeometry extends BufferGeometry {
|
|
|
34990
35322
|
const indices = [];
|
|
34991
35323
|
const vertices = [];
|
|
34992
35324
|
const uvs = [];
|
|
35325
|
+
const initNormals = [];
|
|
35326
|
+
const normals = [];
|
|
34993
35327
|
|
|
34994
35328
|
// helper variables
|
|
34995
35329
|
|
|
34996
35330
|
const inverseSegments = 1.0 / segments;
|
|
34997
35331
|
const vertex = new Vector3();
|
|
34998
35332
|
const uv = new Vector2();
|
|
35333
|
+
const normal = new Vector3();
|
|
35334
|
+
const curNormal = new Vector3();
|
|
35335
|
+
const prevNormal = new Vector3();
|
|
35336
|
+
let dx = 0;
|
|
35337
|
+
let dy = 0;
|
|
35338
|
+
|
|
35339
|
+
// pre-compute normals for initial "meridian"
|
|
35340
|
+
|
|
35341
|
+
for ( let j = 0; j <= ( points.length - 1 ); j ++ ) {
|
|
35342
|
+
|
|
35343
|
+
switch ( j ) {
|
|
35344
|
+
|
|
35345
|
+
case 0: // special handling for 1st vertex on path
|
|
35346
|
+
|
|
35347
|
+
dx = points[ j + 1 ].x - points[ j ].x;
|
|
35348
|
+
dy = points[ j + 1 ].y - points[ j ].y;
|
|
35349
|
+
|
|
35350
|
+
normal.x = dy * 1.0;
|
|
35351
|
+
normal.y = - dx;
|
|
35352
|
+
normal.z = dy * 0.0;
|
|
35353
|
+
|
|
35354
|
+
prevNormal.copy( normal );
|
|
35355
|
+
|
|
35356
|
+
normal.normalize();
|
|
35357
|
+
|
|
35358
|
+
initNormals.push( normal.x, normal.y, normal.z );
|
|
35359
|
+
|
|
35360
|
+
break;
|
|
35361
|
+
|
|
35362
|
+
case ( points.length - 1 ): // special handling for last Vertex on path
|
|
35363
|
+
|
|
35364
|
+
initNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );
|
|
35365
|
+
|
|
35366
|
+
break;
|
|
35367
|
+
|
|
35368
|
+
default: // default handling for all vertices in between
|
|
34999
35369
|
|
|
35000
|
-
|
|
35370
|
+
dx = points[ j + 1 ].x - points[ j ].x;
|
|
35371
|
+
dy = points[ j + 1 ].y - points[ j ].y;
|
|
35372
|
+
|
|
35373
|
+
normal.x = dy * 1.0;
|
|
35374
|
+
normal.y = - dx;
|
|
35375
|
+
normal.z = dy * 0.0;
|
|
35376
|
+
|
|
35377
|
+
curNormal.copy( normal );
|
|
35378
|
+
|
|
35379
|
+
normal.x += prevNormal.x;
|
|
35380
|
+
normal.y += prevNormal.y;
|
|
35381
|
+
normal.z += prevNormal.z;
|
|
35382
|
+
|
|
35383
|
+
normal.normalize();
|
|
35384
|
+
|
|
35385
|
+
initNormals.push( normal.x, normal.y, normal.z );
|
|
35386
|
+
|
|
35387
|
+
prevNormal.copy( curNormal );
|
|
35388
|
+
|
|
35389
|
+
}
|
|
35390
|
+
|
|
35391
|
+
}
|
|
35392
|
+
|
|
35393
|
+
// generate vertices, uvs and normals
|
|
35001
35394
|
|
|
35002
35395
|
for ( let i = 0; i <= segments; i ++ ) {
|
|
35003
35396
|
|
|
@@ -35023,6 +35416,13 @@ class LatheGeometry extends BufferGeometry {
|
|
|
35023
35416
|
|
|
35024
35417
|
uvs.push( uv.x, uv.y );
|
|
35025
35418
|
|
|
35419
|
+
// normal
|
|
35420
|
+
|
|
35421
|
+
const x = initNormals[ 3 * j + 0 ] * sin;
|
|
35422
|
+
const y = initNormals[ 3 * j + 1 ];
|
|
35423
|
+
const z = initNormals[ 3 * j + 0 ] * cos;
|
|
35424
|
+
|
|
35425
|
+
normals.push( x, y, z );
|
|
35026
35426
|
|
|
35027
35427
|
}
|
|
35028
35428
|
|
|
@@ -35055,52 +35455,7 @@ class LatheGeometry extends BufferGeometry {
|
|
|
35055
35455
|
this.setIndex( indices );
|
|
35056
35456
|
this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
|
|
35057
35457
|
this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
|
|
35058
|
-
|
|
35059
|
-
// generate normals
|
|
35060
|
-
|
|
35061
|
-
this.computeVertexNormals();
|
|
35062
|
-
|
|
35063
|
-
// if the geometry is closed, we need to average the normals along the seam.
|
|
35064
|
-
// because the corresponding vertices are identical (but still have different UVs).
|
|
35065
|
-
|
|
35066
|
-
if ( phiLength === Math.PI * 2 ) {
|
|
35067
|
-
|
|
35068
|
-
const normals = this.attributes.normal.array;
|
|
35069
|
-
const n1 = new Vector3();
|
|
35070
|
-
const n2 = new Vector3();
|
|
35071
|
-
const n = new Vector3();
|
|
35072
|
-
|
|
35073
|
-
// this is the buffer offset for the last line of vertices
|
|
35074
|
-
|
|
35075
|
-
const base = segments * points.length * 3;
|
|
35076
|
-
|
|
35077
|
-
for ( let i = 0, j = 0; i < points.length; i ++, j += 3 ) {
|
|
35078
|
-
|
|
35079
|
-
// select the normal of the vertex in the first line
|
|
35080
|
-
|
|
35081
|
-
n1.x = normals[ j + 0 ];
|
|
35082
|
-
n1.y = normals[ j + 1 ];
|
|
35083
|
-
n1.z = normals[ j + 2 ];
|
|
35084
|
-
|
|
35085
|
-
// select the normal of the vertex in the last line
|
|
35086
|
-
|
|
35087
|
-
n2.x = normals[ base + j + 0 ];
|
|
35088
|
-
n2.y = normals[ base + j + 1 ];
|
|
35089
|
-
n2.z = normals[ base + j + 2 ];
|
|
35090
|
-
|
|
35091
|
-
// average normals
|
|
35092
|
-
|
|
35093
|
-
n.addVectors( n1, n2 ).normalize();
|
|
35094
|
-
|
|
35095
|
-
// assign the new values to both normals
|
|
35096
|
-
|
|
35097
|
-
normals[ j + 0 ] = normals[ base + j + 0 ] = n.x;
|
|
35098
|
-
normals[ j + 1 ] = normals[ base + j + 1 ] = n.y;
|
|
35099
|
-
normals[ j + 2 ] = normals[ base + j + 2 ] = n.z;
|
|
35100
|
-
|
|
35101
|
-
}
|
|
35102
|
-
|
|
35103
|
-
}
|
|
35458
|
+
this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
|
|
35104
35459
|
|
|
35105
35460
|
}
|
|
35106
35461
|
|
|
@@ -39369,6 +39724,12 @@ class FileLoader extends Loader {
|
|
|
39369
39724
|
|
|
39370
39725
|
}
|
|
39371
39726
|
|
|
39727
|
+
if ( typeof ReadableStream === 'undefined' || response.body.getReader === undefined ) {
|
|
39728
|
+
|
|
39729
|
+
return response;
|
|
39730
|
+
|
|
39731
|
+
}
|
|
39732
|
+
|
|
39372
39733
|
const callbacks = loading[ url ];
|
|
39373
39734
|
const reader = response.body.getReader();
|
|
39374
39735
|
const contentLength = response.headers.get( 'Content-Length' );
|
|
@@ -39377,7 +39738,7 @@ class FileLoader extends Loader {
|
|
|
39377
39738
|
let loaded = 0;
|
|
39378
39739
|
|
|
39379
39740
|
// periodically read data into the new stream tracking while download progress
|
|
39380
|
-
|
|
39741
|
+
const stream = new ReadableStream( {
|
|
39381
39742
|
start( controller ) {
|
|
39382
39743
|
|
|
39383
39744
|
readData();
|
|
@@ -39415,6 +39776,8 @@ class FileLoader extends Loader {
|
|
|
39415
39776
|
|
|
39416
39777
|
} );
|
|
39417
39778
|
|
|
39779
|
+
return new Response( stream );
|
|
39780
|
+
|
|
39418
39781
|
} else {
|
|
39419
39782
|
|
|
39420
39783
|
throw Error( `fetch for "${response.url}" responded with ${response.status}: ${response.statusText}` );
|
|
@@ -39422,9 +39785,7 @@ class FileLoader extends Loader {
|
|
|
39422
39785
|
}
|
|
39423
39786
|
|
|
39424
39787
|
} )
|
|
39425
|
-
.then(
|
|
39426
|
-
|
|
39427
|
-
const response = new Response( stream );
|
|
39788
|
+
.then( response => {
|
|
39428
39789
|
|
|
39429
39790
|
switch ( this.responseType ) {
|
|
39430
39791
|
|
|
@@ -39473,14 +39834,21 @@ class FileLoader extends Loader {
|
|
|
39473
39834
|
|
|
39474
39835
|
}
|
|
39475
39836
|
|
|
39476
|
-
this.manager.itemEnd( url );
|
|
39477
|
-
|
|
39478
39837
|
} )
|
|
39479
39838
|
.catch( err => {
|
|
39480
39839
|
|
|
39481
39840
|
// Abort errors and other errors are handled the same
|
|
39482
39841
|
|
|
39483
39842
|
const callbacks = loading[ url ];
|
|
39843
|
+
|
|
39844
|
+
if ( callbacks === undefined ) {
|
|
39845
|
+
|
|
39846
|
+
// When onLoad was called and url was deleted in `loading`
|
|
39847
|
+
this.manager.itemError( url );
|
|
39848
|
+
throw err;
|
|
39849
|
+
|
|
39850
|
+
}
|
|
39851
|
+
|
|
39484
39852
|
delete loading[ url ];
|
|
39485
39853
|
|
|
39486
39854
|
for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
|
|
@@ -39491,6 +39859,10 @@ class FileLoader extends Loader {
|
|
|
39491
39859
|
}
|
|
39492
39860
|
|
|
39493
39861
|
this.manager.itemError( url );
|
|
39862
|
+
|
|
39863
|
+
} )
|
|
39864
|
+
.finally( () => {
|
|
39865
|
+
|
|
39494
39866
|
this.manager.itemEnd( url );
|
|
39495
39867
|
|
|
39496
39868
|
} );
|
|
@@ -47704,7 +48076,7 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
47704
48076
|
* - shows frustum, line of sight and up of the camera
|
|
47705
48077
|
* - suitable for fast updates
|
|
47706
48078
|
* - based on frustum visualization in lightgl.js shadowmap example
|
|
47707
|
-
*
|
|
48079
|
+
* https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html
|
|
47708
48080
|
*/
|
|
47709
48081
|
|
|
47710
48082
|
class CameraHelper extends LineSegments {
|
|
@@ -50100,7 +50472,19 @@ Object.defineProperties( WebGLRenderer.prototype, {
|
|
|
50100
50472
|
|
|
50101
50473
|
}
|
|
50102
50474
|
},
|
|
50475
|
+
gammaFactor: {
|
|
50476
|
+
get: function () {
|
|
50103
50477
|
|
|
50478
|
+
console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
|
|
50479
|
+
return 2;
|
|
50480
|
+
|
|
50481
|
+
},
|
|
50482
|
+
set: function () {
|
|
50483
|
+
|
|
50484
|
+
console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
|
|
50485
|
+
|
|
50486
|
+
}
|
|
50487
|
+
}
|
|
50104
50488
|
} );
|
|
50105
50489
|
|
|
50106
50490
|
Object.defineProperties( WebGLShadowMap.prototype, {
|
|
@@ -50469,11 +50853,9 @@ function ImmediateRenderObject() {
|
|
|
50469
50853
|
|
|
50470
50854
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
50471
50855
|
|
|
50472
|
-
/* eslint-disable no-undef */
|
|
50473
50856
|
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
|
|
50474
50857
|
revision: REVISION,
|
|
50475
50858
|
} } ) );
|
|
50476
|
-
/* eslint-enable no-undef */
|
|
50477
50859
|
|
|
50478
50860
|
}
|
|
50479
50861
|
|
|
@@ -50491,4 +50873,4 @@ if ( typeof window !== 'undefined' ) {
|
|
|
50491
50873
|
|
|
50492
50874
|
}
|
|
50493
50875
|
|
|
50494
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3,
|
|
50876
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding };
|