super-three 0.162.0 → 0.164.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +847 -1226
- package/build/three.module.js +846 -1225
- package/build/three.module.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/controls/TransformControls.js +3 -3
- package/examples/jsm/exporters/GLTFExporter.js +66 -5
- package/examples/jsm/exporters/USDZExporter.js +22 -1
- package/examples/jsm/geometries/TextGeometry.js +10 -2
- package/examples/jsm/interactive/HTMLMesh.js +7 -9
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/fflate.module.js +694 -496
- package/examples/jsm/lines/LineMaterial.js +0 -2
- package/examples/jsm/loaders/3MFLoader.js +2 -0
- package/examples/jsm/loaders/EXRLoader.js +351 -97
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +59 -0
- package/examples/jsm/loaders/KTX2Loader.js +3 -10
- package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
- package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
- package/examples/jsm/loaders/LUTImageLoader.js +0 -14
- package/examples/jsm/loaders/RGBMLoader.js +16 -0
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/misc/GPUComputationRenderer.js +0 -6
- package/examples/jsm/nodes/Nodes.js +10 -4
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
- package/examples/jsm/nodes/accessors/BatchNode.js +78 -0
- package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
- package/examples/jsm/nodes/accessors/InstanceNode.js +25 -2
- package/examples/jsm/nodes/accessors/MaterialNode.js +107 -3
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +1 -1
- package/examples/jsm/nodes/accessors/MorphNode.js +13 -3
- package/examples/jsm/nodes/accessors/NormalNode.js +12 -2
- package/examples/jsm/nodes/accessors/ReferenceNode.js +1 -1
- package/examples/jsm/nodes/accessors/RendererReferenceNode.js +29 -0
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +51 -10
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +0 -8
- package/examples/jsm/nodes/core/Node.js +63 -4
- package/examples/jsm/nodes/core/NodeBuilder.js +26 -25
- package/examples/jsm/nodes/core/NodeFrame.js +10 -10
- package/examples/jsm/nodes/core/NodeUtils.js +2 -2
- package/examples/jsm/nodes/core/OutputStructNode.js +2 -1
- package/examples/jsm/nodes/core/PropertyNode.js +10 -0
- package/examples/jsm/nodes/core/UniformNode.js +20 -0
- package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
- package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
- package/examples/jsm/nodes/display/PassNode.js +17 -1
- package/examples/jsm/nodes/display/ToneMappingNode.js +8 -4
- package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +4 -2
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -0
- package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
- package/examples/jsm/nodes/fog/FogExp2Node.js +4 -5
- package/examples/jsm/nodes/fog/FogNode.js +13 -3
- package/examples/jsm/nodes/fog/FogRangeNode.js +4 -3
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +164 -10
- package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +19 -5
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +22 -70
- package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +11 -1
- package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +10 -6
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +76 -5
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/NodeMaterial.js +55 -43
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/examples/jsm/nodes/pmrem/PMREMNode.js +193 -0
- package/examples/jsm/nodes/pmrem/PMREMUtils.js +288 -0
- package/examples/jsm/nodes/shadernode/ShaderNode.js +3 -9
- package/examples/jsm/nodes/utils/EquirectUVNode.js +1 -1
- package/examples/jsm/objects/QuadMesh.js +7 -23
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/physics/RapierPhysics.js +4 -4
- package/examples/jsm/postprocessing/GlitchPass.js +0 -3
- package/examples/jsm/postprocessing/LUTPass.js +5 -71
- package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SSAOPass.js +0 -3
- package/examples/jsm/renderers/common/Animation.js +3 -0
- package/examples/jsm/renderers/common/Background.js +8 -8
- package/examples/jsm/renderers/common/ClippingContext.js +1 -1
- package/examples/jsm/renderers/common/Info.js +11 -19
- package/examples/jsm/renderers/common/PostProcessing.js +12 -4
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderList.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +47 -5
- package/examples/jsm/renderers/common/RenderObjects.js +1 -1
- package/examples/jsm/renderers/common/Renderer.js +153 -21
- package/examples/jsm/renderers/common/Textures.js +1 -1
- package/examples/jsm/renderers/common/extras/PMREMGenerator.js +773 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +34 -63
- package/examples/jsm/renderers/webgl/WebGLBackend.js +146 -36
- package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +145 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +9 -3
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +1 -1
- package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +1 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +64 -7
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +6 -23
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +77 -60
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -4
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +29 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -4
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +92 -18
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/utils/GPUStatsPanel.js +10 -45
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +1 -1
- package/src/Three.js +0 -1
- package/src/animation/AnimationClip.js +1 -1
- package/src/constants.js +3 -3
- package/src/core/Object3D.js +10 -7
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/PMREMGenerator.js +21 -11
- package/src/loaders/FileLoader.js +1 -1
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/loaders/ObjectLoader.js +2 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/materials/ShaderMaterial.js +0 -4
- package/src/math/Spherical.js +4 -5
- package/src/objects/BatchedMesh.js +27 -3
- package/src/objects/InstancedMesh.js +10 -0
- package/src/objects/Line.js +66 -43
- package/src/renderers/WebGLRenderer.js +130 -158
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +32 -22
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +2 -1
- package/src/renderers/shaders/UniformsUtils.js +10 -1
- package/src/renderers/webgl/WebGLAttributes.js +6 -33
- package/src/renderers/webgl/WebGLBackground.js +18 -3
- package/src/renderers/webgl/WebGLBindingStates.js +14 -51
- package/src/renderers/webgl/WebGLBufferRenderer.js +35 -21
- package/src/renderers/webgl/WebGLCapabilities.js +35 -13
- package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
- package/src/renderers/webgl/WebGLExtensions.js +4 -19
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +35 -21
- package/src/renderers/webgl/WebGLLights.js +6 -32
- package/src/renderers/webgl/WebGLMaterials.js +8 -3
- package/src/renderers/webgl/WebGLMorphtargets.js +79 -217
- package/src/renderers/webgl/WebGLProgram.js +21 -52
- package/src/renderers/webgl/WebGLPrograms.js +24 -31
- package/src/renderers/webgl/WebGLRenderStates.js +13 -7
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLState.js +15 -59
- package/src/renderers/webgl/WebGLTextures.js +138 -292
- package/src/renderers/webgl/WebGLUniformsGroups.js +1 -1
- package/src/renderers/webgl/WebGLUtils.js +9 -78
- package/src/renderers/webxr/WebXRDepthSensing.js +2 -3
- package/src/renderers/webxr/WebXRManager.js +4 -6
- package/src/scenes/Scene.js +7 -1
- package/src/textures/Texture.js +11 -1
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -320
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -794
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
- package/src/renderers/WebGL1Renderer.js +0 -7
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
package/build/three.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright 2010-
|
|
3
|
+
* Copyright 2010-2024 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '164';
|
|
9
9
|
|
|
10
10
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
11
11
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -98,7 +98,9 @@ const HalfFloatType = 1016;
|
|
|
98
98
|
const UnsignedShort4444Type = 1017;
|
|
99
99
|
const UnsignedShort5551Type = 1018;
|
|
100
100
|
const UnsignedInt248Type = 1020;
|
|
101
|
+
const UnsignedInt5999Type = 35902;
|
|
101
102
|
const AlphaFormat = 1021;
|
|
103
|
+
const RGBFormat = 1022;
|
|
102
104
|
const RGBAFormat = 1023;
|
|
103
105
|
const LuminanceFormat = 1024;
|
|
104
106
|
const LuminanceAlphaFormat = 1025;
|
|
@@ -214,8 +216,6 @@ const StreamCopyUsage = 35042;
|
|
|
214
216
|
const GLSL1 = '100';
|
|
215
217
|
const GLSL3 = '300 es';
|
|
216
218
|
|
|
217
|
-
const _SRGBAFormat = 1035; // fallback for WebGL 1
|
|
218
|
-
|
|
219
219
|
const WebGLCoordinateSystem = 2000;
|
|
220
220
|
const WebGPUCoordinateSystem = 2001;
|
|
221
221
|
|
|
@@ -2003,7 +2003,7 @@ class Texture extends EventDispatcher {
|
|
|
2003
2003
|
this.onUpdate = null;
|
|
2004
2004
|
|
|
2005
2005
|
this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
|
|
2006
|
-
this.
|
|
2006
|
+
this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
|
|
2007
2007
|
|
|
2008
2008
|
}
|
|
2009
2009
|
|
|
@@ -2234,6 +2234,16 @@ class Texture extends EventDispatcher {
|
|
|
2234
2234
|
|
|
2235
2235
|
}
|
|
2236
2236
|
|
|
2237
|
+
set needsPMREMUpdate( value ) {
|
|
2238
|
+
|
|
2239
|
+
if ( value === true ) {
|
|
2240
|
+
|
|
2241
|
+
this.pmremVersion ++;
|
|
2242
|
+
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2237
2247
|
}
|
|
2238
2248
|
|
|
2239
2249
|
Texture.DEFAULT_IMAGE = null;
|
|
@@ -2913,6 +2923,8 @@ class RenderTarget extends EventDispatcher {
|
|
|
2913
2923
|
minFilter: LinearFilter,
|
|
2914
2924
|
depthBuffer: true,
|
|
2915
2925
|
stencilBuffer: false,
|
|
2926
|
+
resolveDepthBuffer: true,
|
|
2927
|
+
resolveStencilBuffer: true,
|
|
2916
2928
|
depthTexture: null,
|
|
2917
2929
|
samples: 0,
|
|
2918
2930
|
count: 1
|
|
@@ -2937,6 +2949,9 @@ class RenderTarget extends EventDispatcher {
|
|
|
2937
2949
|
this.depthBuffer = options.depthBuffer;
|
|
2938
2950
|
this.stencilBuffer = options.stencilBuffer;
|
|
2939
2951
|
|
|
2952
|
+
this.resolveDepthBuffer = options.resolveDepthBuffer;
|
|
2953
|
+
this.resolveStencilBuffer = options.resolveStencilBuffer;
|
|
2954
|
+
|
|
2940
2955
|
this.depthTexture = options.depthTexture;
|
|
2941
2956
|
|
|
2942
2957
|
this.samples = options.samples;
|
|
@@ -3014,6 +3029,9 @@ class RenderTarget extends EventDispatcher {
|
|
|
3014
3029
|
this.depthBuffer = source.depthBuffer;
|
|
3015
3030
|
this.stencilBuffer = source.stencilBuffer;
|
|
3016
3031
|
|
|
3032
|
+
this.resolveDepthBuffer = source.resolveDepthBuffer;
|
|
3033
|
+
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
3034
|
+
|
|
3017
3035
|
if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
|
|
3018
3036
|
|
|
3019
3037
|
this.samples = source.samples;
|
|
@@ -7402,12 +7420,7 @@ class Object3D extends EventDispatcher {
|
|
|
7402
7420
|
|
|
7403
7421
|
if ( object && object.isObject3D ) {
|
|
7404
7422
|
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
object.parent.remove( object );
|
|
7408
|
-
|
|
7409
|
-
}
|
|
7410
|
-
|
|
7423
|
+
object.removeFromParent();
|
|
7411
7424
|
object.parent = this;
|
|
7412
7425
|
this.children.push( object );
|
|
7413
7426
|
|
|
@@ -7500,10 +7513,18 @@ class Object3D extends EventDispatcher {
|
|
|
7500
7513
|
|
|
7501
7514
|
object.applyMatrix4( _m1$3 );
|
|
7502
7515
|
|
|
7503
|
-
|
|
7516
|
+
object.removeFromParent();
|
|
7517
|
+
object.parent = this;
|
|
7518
|
+
this.children.push( object );
|
|
7504
7519
|
|
|
7505
7520
|
object.updateWorldMatrix( false, true );
|
|
7506
7521
|
|
|
7522
|
+
object.dispatchEvent( _addedEvent );
|
|
7523
|
+
|
|
7524
|
+
_childaddedEvent.child = object;
|
|
7525
|
+
this.dispatchEvent( _childaddedEvent );
|
|
7526
|
+
_childaddedEvent.child = null;
|
|
7527
|
+
|
|
7507
7528
|
return this;
|
|
7508
7529
|
|
|
7509
7530
|
}
|
|
@@ -9226,6 +9247,8 @@ class Material extends EventDispatcher {
|
|
|
9226
9247
|
|
|
9227
9248
|
}
|
|
9228
9249
|
|
|
9250
|
+
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
9251
|
+
|
|
9229
9252
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
9230
9253
|
if ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;
|
|
9231
9254
|
if ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
|
|
@@ -11774,7 +11797,7 @@ class Mesh extends Object3D {
|
|
|
11774
11797
|
|
|
11775
11798
|
}
|
|
11776
11799
|
|
|
11777
|
-
function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
11800
|
+
function checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
11778
11801
|
|
|
11779
11802
|
let intersect;
|
|
11780
11803
|
|
|
@@ -11811,7 +11834,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11811
11834
|
object.getVertexPosition( b, _vB$1 );
|
|
11812
11835
|
object.getVertexPosition( c, _vC$1 );
|
|
11813
11836
|
|
|
11814
|
-
const intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
11837
|
+
const intersection = checkIntersection$1( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
11815
11838
|
|
|
11816
11839
|
if ( intersection ) {
|
|
11817
11840
|
|
|
@@ -12130,13 +12153,22 @@ function cloneUniformsGroups( src ) {
|
|
|
12130
12153
|
|
|
12131
12154
|
function getUnlitUniformColorSpace( renderer ) {
|
|
12132
12155
|
|
|
12133
|
-
|
|
12156
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
12157
|
+
|
|
12158
|
+
if ( currentRenderTarget === null ) {
|
|
12134
12159
|
|
|
12135
12160
|
// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
|
|
12136
12161
|
return renderer.outputColorSpace;
|
|
12137
12162
|
|
|
12138
12163
|
}
|
|
12139
12164
|
|
|
12165
|
+
// https://github.com/mrdoob/three.js/issues/27868
|
|
12166
|
+
if ( currentRenderTarget.isXRRenderTarget === true ) {
|
|
12167
|
+
|
|
12168
|
+
return currentRenderTarget.texture.colorSpace;
|
|
12169
|
+
|
|
12170
|
+
}
|
|
12171
|
+
|
|
12140
12172
|
return ColorManagement.workingColorSpace;
|
|
12141
12173
|
|
|
12142
12174
|
}
|
|
@@ -12178,10 +12210,6 @@ class ShaderMaterial extends Material {
|
|
|
12178
12210
|
this.forceSinglePass = true;
|
|
12179
12211
|
|
|
12180
12212
|
this.extensions = {
|
|
12181
|
-
derivatives: false, // set to use derivatives
|
|
12182
|
-
fragDepth: false, // set to use fragment depth values
|
|
12183
|
-
drawBuffers: false, // set to use draw buffers
|
|
12184
|
-
shaderTextureLOD: false, // set to use shader texture LOD
|
|
12185
12213
|
clipCullDistance: false, // set to use vertex shader clipping
|
|
12186
12214
|
multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
|
|
12187
12215
|
};
|
|
@@ -13422,9 +13450,7 @@ function WebGLAnimation() {
|
|
|
13422
13450
|
|
|
13423
13451
|
}
|
|
13424
13452
|
|
|
13425
|
-
function WebGLAttributes( gl
|
|
13426
|
-
|
|
13427
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
13453
|
+
function WebGLAttributes( gl ) {
|
|
13428
13454
|
|
|
13429
13455
|
const buffers = new WeakMap();
|
|
13430
13456
|
|
|
@@ -13451,15 +13477,7 @@ function WebGLAttributes( gl, capabilities ) {
|
|
|
13451
13477
|
|
|
13452
13478
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
13453
13479
|
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
type = gl.HALF_FLOAT;
|
|
13457
|
-
|
|
13458
|
-
} else {
|
|
13459
|
-
|
|
13460
|
-
throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
|
|
13461
|
-
|
|
13462
|
-
}
|
|
13480
|
+
type = gl.HALF_FLOAT;
|
|
13463
13481
|
|
|
13464
13482
|
} else {
|
|
13465
13483
|
|
|
@@ -13527,17 +13545,9 @@ function WebGLAttributes( gl, capabilities ) {
|
|
|
13527
13545
|
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13528
13546
|
|
|
13529
13547
|
const range = updateRanges[ i ];
|
|
13530
|
-
if ( isWebGL2 ) {
|
|
13531
|
-
|
|
13532
|
-
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13533
|
-
array, range.start, range.count );
|
|
13534
|
-
|
|
13535
|
-
} else {
|
|
13536
|
-
|
|
13537
|
-
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13538
|
-
array.subarray( range.start, range.start + range.count ) );
|
|
13539
13548
|
|
|
13540
|
-
|
|
13549
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13550
|
+
array, range.start, range.count );
|
|
13541
13551
|
|
|
13542
13552
|
}
|
|
13543
13553
|
|
|
@@ -13548,17 +13558,8 @@ function WebGLAttributes( gl, capabilities ) {
|
|
|
13548
13558
|
// @deprecated, r159
|
|
13549
13559
|
if ( updateRange.count !== - 1 ) {
|
|
13550
13560
|
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13554
|
-
array, updateRange.offset, updateRange.count );
|
|
13555
|
-
|
|
13556
|
-
} else {
|
|
13557
|
-
|
|
13558
|
-
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13559
|
-
array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
|
|
13560
|
-
|
|
13561
|
-
}
|
|
13561
|
+
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13562
|
+
array, updateRange.offset, updateRange.count );
|
|
13562
13563
|
|
|
13563
13564
|
updateRange.count = - 1; // reset range
|
|
13564
13565
|
|
|
@@ -13827,8 +13828,6 @@ var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying flo
|
|
|
13827
13828
|
|
|
13828
13829
|
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\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
|
|
13829
13830
|
|
|
13830
|
-
var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
13831
|
-
|
|
13832
13831
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
|
|
13833
13832
|
|
|
13834
13833
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
@@ -13847,9 +13846,9 @@ var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor
|
|
|
13847
13846
|
|
|
13848
13847
|
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
|
|
13849
13848
|
|
|
13850
|
-
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\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( ( material.ior - 1.0 ) / ( material.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, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
13849
|
+
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\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( ( material.ior - 1.0 ) / ( material.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, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
13851
13850
|
|
|
13852
|
-
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_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\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}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\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#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\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}";
|
|
13851
|
+
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\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_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\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}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\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#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\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}";
|
|
13853
13852
|
|
|
13854
13853
|
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\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, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\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, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\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 ], geometryNormal );\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";
|
|
13855
13854
|
|
|
@@ -13857,13 +13856,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
|
|
|
13857
13856
|
|
|
13858
13857
|
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
13859
13858
|
|
|
13860
|
-
var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )
|
|
13859
|
+
var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
13861
13860
|
|
|
13862
|
-
var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )
|
|
13861
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
13863
13862
|
|
|
13864
|
-
var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\
|
|
13863
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
13865
13864
|
|
|
13866
|
-
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\
|
|
13865
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
13867
13866
|
|
|
13868
13867
|
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
13869
13868
|
|
|
@@ -13923,7 +13922,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
13923
13922
|
|
|
13924
13923
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
13925
13924
|
|
|
13926
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\
|
|
13925
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif";
|
|
13927
13926
|
|
|
13928
13927
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
13929
13928
|
|
|
@@ -13945,11 +13944,11 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
|
|
|
13945
13944
|
|
|
13946
13945
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
13947
13946
|
|
|
13948
|
-
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\
|
|
13947
|
+
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
13949
13948
|
|
|
13950
|
-
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
13949
|
+
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
13951
13950
|
|
|
13952
|
-
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness,
|
|
13951
|
+
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
|
|
13953
13952
|
|
|
13954
13953
|
var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
|
|
13955
13954
|
|
|
@@ -14009,7 +14008,7 @@ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;
|
|
|
14009
14008
|
|
|
14010
14009
|
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_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}";
|
|
14011
14010
|
|
|
14012
|
-
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_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 USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\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 <iridescence_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <alphahash_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 + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
14011
|
+
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_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 USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\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 <iridescence_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <alphahash_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 + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
14013
14012
|
|
|
14014
14013
|
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_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}";
|
|
14015
14014
|
|
|
@@ -14071,7 +14070,6 @@ const ShaderChunk = {
|
|
|
14071
14070
|
fog_fragment: fog_fragment,
|
|
14072
14071
|
fog_pars_fragment: fog_pars_fragment,
|
|
14073
14072
|
gradientmap_pars_fragment: gradientmap_pars_fragment,
|
|
14074
|
-
lightmap_fragment: lightmap_fragment,
|
|
14075
14073
|
lightmap_pars_fragment: lightmap_pars_fragment,
|
|
14076
14074
|
lights_lambert_fragment: lights_lambert_fragment,
|
|
14077
14075
|
lights_lambert_pars_fragment: lights_lambert_pars_fragment,
|
|
@@ -14486,7 +14484,7 @@ const ShaderLib = {
|
|
|
14486
14484
|
emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },
|
|
14487
14485
|
roughness: { value: 1.0 },
|
|
14488
14486
|
metalness: { value: 0.0 },
|
|
14489
|
-
envMapIntensity: { value: 1 }
|
|
14487
|
+
envMapIntensity: { value: 1 }
|
|
14490
14488
|
}
|
|
14491
14489
|
] ),
|
|
14492
14490
|
|
|
@@ -14707,6 +14705,7 @@ ShaderLib.physical = {
|
|
|
14707
14705
|
clearcoatRoughness: { value: 0 },
|
|
14708
14706
|
clearcoatRoughnessMap: { value: null },
|
|
14709
14707
|
clearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },
|
|
14708
|
+
dispersion: { value: 0 },
|
|
14710
14709
|
iridescence: { value: 0 },
|
|
14711
14710
|
iridescenceMap: { value: null },
|
|
14712
14711
|
iridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },
|
|
@@ -14765,9 +14764,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
14765
14764
|
let currentBackgroundVersion = 0;
|
|
14766
14765
|
let currentTonemapping = null;
|
|
14767
14766
|
|
|
14768
|
-
function
|
|
14767
|
+
function getBackground( scene ) {
|
|
14769
14768
|
|
|
14770
|
-
let forceClear = false;
|
|
14771
14769
|
let background = scene.isScene === true ? scene.background : null;
|
|
14772
14770
|
|
|
14773
14771
|
if ( background && background.isTexture ) {
|
|
@@ -14777,6 +14775,15 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
14777
14775
|
|
|
14778
14776
|
}
|
|
14779
14777
|
|
|
14778
|
+
return background;
|
|
14779
|
+
|
|
14780
|
+
}
|
|
14781
|
+
|
|
14782
|
+
function render( scene ) {
|
|
14783
|
+
|
|
14784
|
+
let forceClear = false;
|
|
14785
|
+
const background = getBackground( scene );
|
|
14786
|
+
|
|
14780
14787
|
if ( background === null ) {
|
|
14781
14788
|
|
|
14782
14789
|
setClear( clearColor, clearAlpha );
|
|
@@ -14806,6 +14813,12 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
14806
14813
|
|
|
14807
14814
|
}
|
|
14808
14815
|
|
|
14816
|
+
}
|
|
14817
|
+
|
|
14818
|
+
function addToRenderList( renderList, scene ) {
|
|
14819
|
+
|
|
14820
|
+
const background = getBackground( scene );
|
|
14821
|
+
|
|
14809
14822
|
if ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {
|
|
14810
14823
|
|
|
14811
14824
|
if ( boxMesh === undefined ) {
|
|
@@ -14986,19 +14999,17 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
14986
14999
|
setClear( clearColor, clearAlpha );
|
|
14987
15000
|
|
|
14988
15001
|
},
|
|
14989
|
-
render: render
|
|
15002
|
+
render: render,
|
|
15003
|
+
addToRenderList: addToRenderList
|
|
14990
15004
|
|
|
14991
15005
|
};
|
|
14992
15006
|
|
|
14993
15007
|
}
|
|
14994
15008
|
|
|
14995
|
-
function WebGLBindingStates( gl,
|
|
15009
|
+
function WebGLBindingStates( gl, attributes ) {
|
|
14996
15010
|
|
|
14997
15011
|
const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
|
|
14998
15012
|
|
|
14999
|
-
const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
|
|
15000
|
-
const vaoAvailable = capabilities.isWebGL2 || extension !== null;
|
|
15001
|
-
|
|
15002
15013
|
const bindingStates = {};
|
|
15003
15014
|
|
|
15004
15015
|
const defaultState = createBindingState( null );
|
|
@@ -15009,38 +15020,18 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15009
15020
|
|
|
15010
15021
|
let updateBuffers = false;
|
|
15011
15022
|
|
|
15012
|
-
|
|
15023
|
+
const state = getBindingState( geometry, program, material );
|
|
15013
15024
|
|
|
15014
|
-
|
|
15025
|
+
if ( currentState !== state ) {
|
|
15015
15026
|
|
|
15016
|
-
|
|
15027
|
+
currentState = state;
|
|
15028
|
+
bindVertexArrayObject( currentState.object );
|
|
15017
15029
|
|
|
15018
|
-
|
|
15019
|
-
bindVertexArrayObject( currentState.object );
|
|
15020
|
-
|
|
15021
|
-
}
|
|
15022
|
-
|
|
15023
|
-
updateBuffers = needsUpdate( object, geometry, program, index );
|
|
15024
|
-
|
|
15025
|
-
if ( updateBuffers ) saveCache( object, geometry, program, index );
|
|
15026
|
-
|
|
15027
|
-
} else {
|
|
15028
|
-
|
|
15029
|
-
const wireframe = ( material.wireframe === true );
|
|
15030
|
-
|
|
15031
|
-
if ( currentState.geometry !== geometry.id ||
|
|
15032
|
-
currentState.program !== program.id ||
|
|
15033
|
-
currentState.wireframe !== wireframe ) {
|
|
15034
|
-
|
|
15035
|
-
currentState.geometry = geometry.id;
|
|
15036
|
-
currentState.program = program.id;
|
|
15037
|
-
currentState.wireframe = wireframe;
|
|
15038
|
-
|
|
15039
|
-
updateBuffers = true;
|
|
15030
|
+
}
|
|
15040
15031
|
|
|
15041
|
-
|
|
15032
|
+
updateBuffers = needsUpdate( object, geometry, program, index );
|
|
15042
15033
|
|
|
15043
|
-
|
|
15034
|
+
if ( updateBuffers ) saveCache( object, geometry, program, index );
|
|
15044
15035
|
|
|
15045
15036
|
if ( index !== null ) {
|
|
15046
15037
|
|
|
@@ -15066,25 +15057,19 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15066
15057
|
|
|
15067
15058
|
function createVertexArrayObject() {
|
|
15068
15059
|
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
return extension.createVertexArrayOES();
|
|
15060
|
+
return gl.createVertexArray();
|
|
15072
15061
|
|
|
15073
15062
|
}
|
|
15074
15063
|
|
|
15075
15064
|
function bindVertexArrayObject( vao ) {
|
|
15076
15065
|
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
return extension.bindVertexArrayOES( vao );
|
|
15066
|
+
return gl.bindVertexArray( vao );
|
|
15080
15067
|
|
|
15081
15068
|
}
|
|
15082
15069
|
|
|
15083
15070
|
function deleteVertexArrayObject( vao ) {
|
|
15084
15071
|
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
return extension.deleteVertexArrayOES( vao );
|
|
15072
|
+
return gl.deleteVertexArray( vao );
|
|
15088
15073
|
|
|
15089
15074
|
}
|
|
15090
15075
|
|
|
@@ -15282,9 +15267,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15282
15267
|
|
|
15283
15268
|
if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
|
|
15284
15269
|
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );
|
|
15270
|
+
gl.vertexAttribDivisor( attribute, meshPerAttribute );
|
|
15288
15271
|
attributeDivisors[ attribute ] = meshPerAttribute;
|
|
15289
15272
|
|
|
15290
15273
|
}
|
|
@@ -15325,12 +15308,6 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15325
15308
|
|
|
15326
15309
|
function setupVertexAttributes( object, material, program, geometry ) {
|
|
15327
15310
|
|
|
15328
|
-
if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
|
|
15329
|
-
|
|
15330
|
-
if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
|
|
15331
|
-
|
|
15332
|
-
}
|
|
15333
|
-
|
|
15334
15311
|
initAttributes();
|
|
15335
15312
|
|
|
15336
15313
|
const geometryAttributes = geometry.attributes;
|
|
@@ -15369,9 +15346,9 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15369
15346
|
const type = attribute.type;
|
|
15370
15347
|
const bytesPerElement = attribute.bytesPerElement;
|
|
15371
15348
|
|
|
15372
|
-
// check for integer attributes
|
|
15349
|
+
// check for integer attributes
|
|
15373
15350
|
|
|
15374
|
-
const integer = (
|
|
15351
|
+
const integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );
|
|
15375
15352
|
|
|
15376
15353
|
if ( geometryAttribute.isInterleavedBufferAttribute ) {
|
|
15377
15354
|
|
|
@@ -15619,9 +15596,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
|
15619
15596
|
|
|
15620
15597
|
}
|
|
15621
15598
|
|
|
15622
|
-
function WebGLBufferRenderer( gl, extensions, info
|
|
15623
|
-
|
|
15624
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
15599
|
+
function WebGLBufferRenderer( gl, extensions, info ) {
|
|
15625
15600
|
|
|
15626
15601
|
let mode;
|
|
15627
15602
|
|
|
@@ -15643,49 +15618,60 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
15643
15618
|
|
|
15644
15619
|
if ( primcount === 0 ) return;
|
|
15645
15620
|
|
|
15646
|
-
|
|
15621
|
+
gl.drawArraysInstanced( mode, start, count, primcount );
|
|
15647
15622
|
|
|
15648
|
-
|
|
15623
|
+
info.update( count, mode, primcount );
|
|
15649
15624
|
|
|
15650
|
-
|
|
15651
|
-
methodName = 'drawArraysInstanced';
|
|
15625
|
+
}
|
|
15652
15626
|
|
|
15653
|
-
|
|
15627
|
+
function renderMultiDraw( starts, counts, drawCount ) {
|
|
15654
15628
|
|
|
15655
|
-
|
|
15656
|
-
methodName = 'drawArraysInstancedANGLE';
|
|
15629
|
+
if ( drawCount === 0 ) return;
|
|
15657
15630
|
|
|
15658
|
-
|
|
15631
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15659
15632
|
|
|
15660
|
-
|
|
15661
|
-
|
|
15633
|
+
if ( extension === null ) {
|
|
15634
|
+
|
|
15635
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15636
|
+
|
|
15637
|
+
this.render( starts[ i ], counts[ i ] );
|
|
15662
15638
|
|
|
15663
15639
|
}
|
|
15664
15640
|
|
|
15665
|
-
}
|
|
15641
|
+
} else {
|
|
15666
15642
|
|
|
15667
|
-
|
|
15643
|
+
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15668
15644
|
|
|
15669
|
-
|
|
15645
|
+
let elementCount = 0;
|
|
15646
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15647
|
+
|
|
15648
|
+
elementCount += counts[ i ];
|
|
15649
|
+
|
|
15650
|
+
}
|
|
15651
|
+
|
|
15652
|
+
info.update( elementCount, mode, 1 );
|
|
15653
|
+
|
|
15654
|
+
}
|
|
15670
15655
|
|
|
15671
15656
|
}
|
|
15672
15657
|
|
|
15673
|
-
function
|
|
15658
|
+
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
15674
15659
|
|
|
15675
15660
|
if ( drawCount === 0 ) return;
|
|
15676
15661
|
|
|
15677
15662
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15663
|
+
|
|
15678
15664
|
if ( extension === null ) {
|
|
15679
15665
|
|
|
15680
|
-
for ( let i = 0; i <
|
|
15666
|
+
for ( let i = 0; i < starts.length; i ++ ) {
|
|
15681
15667
|
|
|
15682
|
-
|
|
15668
|
+
renderInstances( starts[ i ], counts[ i ], primcount[ i ] );
|
|
15683
15669
|
|
|
15684
15670
|
}
|
|
15685
15671
|
|
|
15686
15672
|
} else {
|
|
15687
15673
|
|
|
15688
|
-
extension.
|
|
15674
|
+
extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );
|
|
15689
15675
|
|
|
15690
15676
|
let elementCount = 0;
|
|
15691
15677
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
@@ -15694,7 +15680,11 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
15694
15680
|
|
|
15695
15681
|
}
|
|
15696
15682
|
|
|
15697
|
-
|
|
15683
|
+
for ( let i = 0; i < primcount.length; i ++ ) {
|
|
15684
|
+
|
|
15685
|
+
info.update( elementCount, mode, primcount[ i ] );
|
|
15686
|
+
|
|
15687
|
+
}
|
|
15698
15688
|
|
|
15699
15689
|
}
|
|
15700
15690
|
|
|
@@ -15706,10 +15696,11 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
15706
15696
|
this.render = render;
|
|
15707
15697
|
this.renderInstances = renderInstances;
|
|
15708
15698
|
this.renderMultiDraw = renderMultiDraw;
|
|
15699
|
+
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
15709
15700
|
|
|
15710
15701
|
}
|
|
15711
15702
|
|
|
15712
|
-
function WebGLCapabilities( gl, extensions, parameters ) {
|
|
15703
|
+
function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
15713
15704
|
|
|
15714
15705
|
let maxAnisotropy;
|
|
15715
15706
|
|
|
@@ -15733,6 +15724,33 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
15733
15724
|
|
|
15734
15725
|
}
|
|
15735
15726
|
|
|
15727
|
+
function textureFormatReadable( textureFormat ) {
|
|
15728
|
+
|
|
15729
|
+
if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {
|
|
15730
|
+
|
|
15731
|
+
return false;
|
|
15732
|
+
|
|
15733
|
+
}
|
|
15734
|
+
|
|
15735
|
+
return true;
|
|
15736
|
+
|
|
15737
|
+
}
|
|
15738
|
+
|
|
15739
|
+
function textureTypeReadable( textureType ) {
|
|
15740
|
+
|
|
15741
|
+
const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
|
|
15742
|
+
|
|
15743
|
+
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
15744
|
+
textureType !== FloatType && ! halfFloatSupportedByExt ) {
|
|
15745
|
+
|
|
15746
|
+
return false;
|
|
15747
|
+
|
|
15748
|
+
}
|
|
15749
|
+
|
|
15750
|
+
return true;
|
|
15751
|
+
|
|
15752
|
+
}
|
|
15753
|
+
|
|
15736
15754
|
function getMaxPrecision( precision ) {
|
|
15737
15755
|
|
|
15738
15756
|
if ( precision === 'highp' ) {
|
|
@@ -15763,8 +15781,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
15763
15781
|
|
|
15764
15782
|
}
|
|
15765
15783
|
|
|
15766
|
-
const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
|
|
15767
|
-
|
|
15768
15784
|
let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
|
|
15769
15785
|
const maxPrecision = getMaxPrecision( precision );
|
|
15770
15786
|
|
|
@@ -15775,8 +15791,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
15775
15791
|
|
|
15776
15792
|
}
|
|
15777
15793
|
|
|
15778
|
-
const drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );
|
|
15779
|
-
|
|
15780
15794
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
15781
15795
|
|
|
15782
15796
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
@@ -15790,20 +15804,19 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
15790
15804
|
const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
|
|
15791
15805
|
|
|
15792
15806
|
const vertexTextures = maxVertexTextures > 0;
|
|
15793
|
-
const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
|
|
15794
|
-
const floatVertexTextures = vertexTextures && floatFragmentTextures;
|
|
15795
15807
|
|
|
15796
|
-
const maxSamples =
|
|
15808
|
+
const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
|
|
15797
15809
|
|
|
15798
15810
|
return {
|
|
15799
15811
|
|
|
15800
|
-
isWebGL2:
|
|
15801
|
-
|
|
15802
|
-
drawBuffers: drawBuffers,
|
|
15812
|
+
isWebGL2: true, // keeping this for backwards compatibility
|
|
15803
15813
|
|
|
15804
15814
|
getMaxAnisotropy: getMaxAnisotropy,
|
|
15805
15815
|
getMaxPrecision: getMaxPrecision,
|
|
15806
15816
|
|
|
15817
|
+
textureFormatReadable: textureFormatReadable,
|
|
15818
|
+
textureTypeReadable: textureTypeReadable,
|
|
15819
|
+
|
|
15807
15820
|
precision: precision,
|
|
15808
15821
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
15809
15822
|
|
|
@@ -15818,8 +15831,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
15818
15831
|
maxFragmentUniforms: maxFragmentUniforms,
|
|
15819
15832
|
|
|
15820
15833
|
vertexTextures: vertexTextures,
|
|
15821
|
-
floatFragmentTextures: floatFragmentTextures,
|
|
15822
|
-
floatVertexTextures: floatVertexTextures,
|
|
15823
15834
|
|
|
15824
15835
|
maxSamples: maxSamples
|
|
15825
15836
|
|
|
@@ -16238,6 +16249,7 @@ const _clearColor = /*@__PURE__*/ new Color();
|
|
|
16238
16249
|
let _oldTarget = null;
|
|
16239
16250
|
let _oldActiveCubeFace = 0;
|
|
16240
16251
|
let _oldActiveMipmapLevel = 0;
|
|
16252
|
+
let _oldXrEnabled = false;
|
|
16241
16253
|
|
|
16242
16254
|
// Golden Ratio
|
|
16243
16255
|
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
@@ -16246,16 +16258,16 @@ const INV_PHI = 1 / PHI;
|
|
|
16246
16258
|
// Vertices of a dodecahedron (except the opposites, which represent the
|
|
16247
16259
|
// same axis), used as axis directions evenly spread on a sphere.
|
|
16248
16260
|
const _axisDirections = [
|
|
16249
|
-
/*@__PURE__*/ new Vector3(
|
|
16250
|
-
/*@__PURE__*/ new Vector3( - 1, 1, 1 ),
|
|
16251
|
-
/*@__PURE__*/ new Vector3( 1, 1, - 1 ),
|
|
16252
|
-
/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
|
|
16253
|
-
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
16254
|
-
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
16255
|
-
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
16256
|
-
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
16261
|
+
/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
16257
16262
|
/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
16258
|
-
/*@__PURE__*/ new Vector3( -
|
|
16263
|
+
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
16264
|
+
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
16265
|
+
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
16266
|
+
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
16267
|
+
/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
|
|
16268
|
+
/*@__PURE__*/ new Vector3( 1, 1, - 1 ),
|
|
16269
|
+
/*@__PURE__*/ new Vector3( - 1, 1, 1 ),
|
|
16270
|
+
/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
16259
16271
|
|
|
16260
16272
|
/**
|
|
16261
16273
|
* This class generates a Prefiltered, Mipmapped Radiance Environment Map
|
|
@@ -16305,6 +16317,9 @@ class PMREMGenerator {
|
|
|
16305
16317
|
_oldTarget = this._renderer.getRenderTarget();
|
|
16306
16318
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
16307
16319
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
16320
|
+
_oldXrEnabled = this._renderer.xr.enabled;
|
|
16321
|
+
|
|
16322
|
+
this._renderer.xr.enabled = false;
|
|
16308
16323
|
|
|
16309
16324
|
this._setSize( 256 );
|
|
16310
16325
|
|
|
@@ -16420,6 +16435,8 @@ class PMREMGenerator {
|
|
|
16420
16435
|
_cleanup( outputTarget ) {
|
|
16421
16436
|
|
|
16422
16437
|
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
|
|
16438
|
+
this._renderer.xr.enabled = _oldXrEnabled;
|
|
16439
|
+
|
|
16423
16440
|
outputTarget.scissorTest = false;
|
|
16424
16441
|
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
|
|
16425
16442
|
|
|
@@ -16440,6 +16457,9 @@ class PMREMGenerator {
|
|
|
16440
16457
|
_oldTarget = this._renderer.getRenderTarget();
|
|
16441
16458
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
16442
16459
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
16460
|
+
_oldXrEnabled = this._renderer.xr.enabled;
|
|
16461
|
+
|
|
16462
|
+
this._renderer.xr.enabled = false;
|
|
16443
16463
|
|
|
16444
16464
|
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
16445
16465
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
@@ -16633,12 +16653,13 @@ class PMREMGenerator {
|
|
|
16633
16653
|
const renderer = this._renderer;
|
|
16634
16654
|
const autoClear = renderer.autoClear;
|
|
16635
16655
|
renderer.autoClear = false;
|
|
16656
|
+
const n = this._lodPlanes.length;
|
|
16636
16657
|
|
|
16637
|
-
for ( let i = 1; i <
|
|
16658
|
+
for ( let i = 1; i < n; i ++ ) {
|
|
16638
16659
|
|
|
16639
16660
|
const sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );
|
|
16640
16661
|
|
|
16641
|
-
const poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];
|
|
16662
|
+
const poleAxis = _axisDirections[ ( n - i - 1 ) % _axisDirections.length ];
|
|
16642
16663
|
|
|
16643
16664
|
this._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );
|
|
16644
16665
|
|
|
@@ -17122,24 +17143,26 @@ function WebGLCubeUVMaps( renderer ) {
|
|
|
17122
17143
|
|
|
17123
17144
|
if ( isEquirectMap || isCubeMap ) {
|
|
17124
17145
|
|
|
17125
|
-
|
|
17146
|
+
let renderTarget = cubeUVmaps.get( texture );
|
|
17126
17147
|
|
|
17127
|
-
|
|
17148
|
+
const currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;
|
|
17128
17149
|
|
|
17129
|
-
|
|
17150
|
+
if ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {
|
|
17130
17151
|
|
|
17131
17152
|
if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
|
|
17132
17153
|
|
|
17133
17154
|
renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );
|
|
17155
|
+
renderTarget.texture.pmremVersion = texture.pmremVersion;
|
|
17156
|
+
|
|
17134
17157
|
cubeUVmaps.set( texture, renderTarget );
|
|
17135
17158
|
|
|
17136
17159
|
return renderTarget.texture;
|
|
17137
17160
|
|
|
17138
17161
|
} else {
|
|
17139
17162
|
|
|
17140
|
-
if (
|
|
17163
|
+
if ( renderTarget !== undefined ) {
|
|
17141
17164
|
|
|
17142
|
-
return
|
|
17165
|
+
return renderTarget.texture;
|
|
17143
17166
|
|
|
17144
17167
|
} else {
|
|
17145
17168
|
|
|
@@ -17149,7 +17172,9 @@ function WebGLCubeUVMaps( renderer ) {
|
|
|
17149
17172
|
|
|
17150
17173
|
if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
|
|
17151
17174
|
|
|
17152
|
-
|
|
17175
|
+
renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
|
|
17176
|
+
renderTarget.texture.pmremVersion = texture.pmremVersion;
|
|
17177
|
+
|
|
17153
17178
|
cubeUVmaps.set( texture, renderTarget );
|
|
17154
17179
|
|
|
17155
17180
|
texture.addEventListener( 'dispose', onTextureDispose );
|
|
@@ -17280,29 +17305,14 @@ function WebGLExtensions( gl ) {
|
|
|
17280
17305
|
|
|
17281
17306
|
},
|
|
17282
17307
|
|
|
17283
|
-
init: function (
|
|
17284
|
-
|
|
17285
|
-
if ( capabilities.isWebGL2 ) {
|
|
17286
|
-
|
|
17287
|
-
getExtension( 'EXT_color_buffer_float' );
|
|
17288
|
-
getExtension( 'WEBGL_clip_cull_distance' );
|
|
17289
|
-
|
|
17290
|
-
} else {
|
|
17291
|
-
|
|
17292
|
-
getExtension( 'WEBGL_depth_texture' );
|
|
17293
|
-
getExtension( 'OES_texture_float' );
|
|
17294
|
-
getExtension( 'OES_texture_half_float' );
|
|
17295
|
-
getExtension( 'OES_texture_half_float_linear' );
|
|
17296
|
-
getExtension( 'OES_standard_derivatives' );
|
|
17297
|
-
getExtension( 'OES_element_index_uint' );
|
|
17298
|
-
getExtension( 'OES_vertex_array_object' );
|
|
17299
|
-
getExtension( 'ANGLE_instanced_arrays' );
|
|
17300
|
-
|
|
17301
|
-
}
|
|
17308
|
+
init: function () {
|
|
17302
17309
|
|
|
17310
|
+
getExtension( 'EXT_color_buffer_float' );
|
|
17311
|
+
getExtension( 'WEBGL_clip_cull_distance' );
|
|
17303
17312
|
getExtension( 'OES_texture_float_linear' );
|
|
17304
17313
|
getExtension( 'EXT_color_buffer_half_float' );
|
|
17305
17314
|
getExtension( 'WEBGL_multisampled_render_to_texture' );
|
|
17315
|
+
getExtension( 'WEBGL_render_shared_exponent' );
|
|
17306
17316
|
|
|
17307
17317
|
},
|
|
17308
17318
|
|
|
@@ -17530,9 +17540,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
|
|
|
17530
17540
|
|
|
17531
17541
|
}
|
|
17532
17542
|
|
|
17533
|
-
function WebGLIndexedBufferRenderer( gl, extensions, info
|
|
17534
|
-
|
|
17535
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
17543
|
+
function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
17536
17544
|
|
|
17537
17545
|
let mode;
|
|
17538
17546
|
|
|
@@ -17563,49 +17571,60 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
17563
17571
|
|
|
17564
17572
|
if ( primcount === 0 ) return;
|
|
17565
17573
|
|
|
17566
|
-
|
|
17574
|
+
gl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );
|
|
17567
17575
|
|
|
17568
|
-
|
|
17576
|
+
info.update( count, mode, primcount );
|
|
17569
17577
|
|
|
17570
|
-
|
|
17571
|
-
methodName = 'drawElementsInstanced';
|
|
17578
|
+
}
|
|
17572
17579
|
|
|
17573
|
-
|
|
17580
|
+
function renderMultiDraw( starts, counts, drawCount ) {
|
|
17574
17581
|
|
|
17575
|
-
|
|
17576
|
-
methodName = 'drawElementsInstancedANGLE';
|
|
17582
|
+
if ( drawCount === 0 ) return;
|
|
17577
17583
|
|
|
17578
|
-
|
|
17584
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17579
17585
|
|
|
17580
|
-
|
|
17581
|
-
|
|
17586
|
+
if ( extension === null ) {
|
|
17587
|
+
|
|
17588
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17589
|
+
|
|
17590
|
+
this.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
17582
17591
|
|
|
17583
17592
|
}
|
|
17584
17593
|
|
|
17585
|
-
}
|
|
17594
|
+
} else {
|
|
17586
17595
|
|
|
17587
|
-
|
|
17596
|
+
extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
|
|
17588
17597
|
|
|
17589
|
-
|
|
17598
|
+
let elementCount = 0;
|
|
17599
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17600
|
+
|
|
17601
|
+
elementCount += counts[ i ];
|
|
17602
|
+
|
|
17603
|
+
}
|
|
17604
|
+
|
|
17605
|
+
info.update( elementCount, mode, 1 );
|
|
17606
|
+
|
|
17607
|
+
}
|
|
17590
17608
|
|
|
17591
17609
|
}
|
|
17592
17610
|
|
|
17593
|
-
function
|
|
17611
|
+
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
17594
17612
|
|
|
17595
17613
|
if ( drawCount === 0 ) return;
|
|
17596
17614
|
|
|
17597
17615
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17616
|
+
|
|
17598
17617
|
if ( extension === null ) {
|
|
17599
17618
|
|
|
17600
|
-
for ( let i = 0; i <
|
|
17619
|
+
for ( let i = 0; i < starts.length; i ++ ) {
|
|
17601
17620
|
|
|
17602
|
-
|
|
17621
|
+
renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );
|
|
17603
17622
|
|
|
17604
17623
|
}
|
|
17605
17624
|
|
|
17606
17625
|
} else {
|
|
17607
17626
|
|
|
17608
|
-
extension.
|
|
17627
|
+
extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );
|
|
17609
17628
|
|
|
17610
17629
|
let elementCount = 0;
|
|
17611
17630
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
@@ -17614,7 +17633,11 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
17614
17633
|
|
|
17615
17634
|
}
|
|
17616
17635
|
|
|
17617
|
-
|
|
17636
|
+
for ( let i = 0; i < primcount.length; i ++ ) {
|
|
17637
|
+
|
|
17638
|
+
info.update( elementCount, mode, primcount[ i ] );
|
|
17639
|
+
|
|
17640
|
+
}
|
|
17618
17641
|
|
|
17619
17642
|
}
|
|
17620
17643
|
|
|
@@ -17627,6 +17650,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
|
|
|
17627
17650
|
this.render = render;
|
|
17628
17651
|
this.renderInstances = renderInstances;
|
|
17629
17652
|
this.renderMultiDraw = renderMultiDraw;
|
|
17653
|
+
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
17630
17654
|
|
|
17631
17655
|
}
|
|
17632
17656
|
|
|
@@ -17699,296 +17723,158 @@ function WebGLInfo( gl ) {
|
|
|
17699
17723
|
|
|
17700
17724
|
}
|
|
17701
17725
|
|
|
17702
|
-
function numericalSort( a, b ) {
|
|
17703
|
-
|
|
17704
|
-
return a[ 0 ] - b[ 0 ];
|
|
17705
|
-
|
|
17706
|
-
}
|
|
17707
|
-
|
|
17708
|
-
function absNumericalSort( a, b ) {
|
|
17709
|
-
|
|
17710
|
-
return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );
|
|
17711
|
-
|
|
17712
|
-
}
|
|
17713
|
-
|
|
17714
17726
|
function WebGLMorphtargets( gl, capabilities, textures ) {
|
|
17715
17727
|
|
|
17716
|
-
const influencesList = {};
|
|
17717
|
-
const morphInfluences = new Float32Array( 8 );
|
|
17718
17728
|
const morphTextures = new WeakMap();
|
|
17719
17729
|
const morph = new Vector4();
|
|
17720
17730
|
|
|
17721
|
-
const workInfluences = [];
|
|
17722
|
-
|
|
17723
|
-
for ( let i = 0; i < 8; i ++ ) {
|
|
17724
|
-
|
|
17725
|
-
workInfluences[ i ] = [ i, 0 ];
|
|
17726
|
-
|
|
17727
|
-
}
|
|
17728
|
-
|
|
17729
17731
|
function update( object, geometry, program ) {
|
|
17730
17732
|
|
|
17731
17733
|
const objectInfluences = object.morphTargetInfluences;
|
|
17732
17734
|
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
17736
|
-
// into an array of data textures. Each layer represents a single morph target.
|
|
17737
|
-
|
|
17738
|
-
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
17739
|
-
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
17740
|
-
|
|
17741
|
-
let entry = morphTextures.get( geometry );
|
|
17742
|
-
|
|
17743
|
-
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
17744
|
-
|
|
17745
|
-
if ( entry !== undefined ) entry.texture.dispose();
|
|
17746
|
-
|
|
17747
|
-
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
17748
|
-
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
17749
|
-
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
17750
|
-
|
|
17751
|
-
const morphTargets = geometry.morphAttributes.position || [];
|
|
17752
|
-
const morphNormals = geometry.morphAttributes.normal || [];
|
|
17753
|
-
const morphColors = geometry.morphAttributes.color || [];
|
|
17754
|
-
|
|
17755
|
-
let vertexDataCount = 0;
|
|
17735
|
+
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
17736
|
+
// into an array of data textures. Each layer represents a single morph target.
|
|
17756
17737
|
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
17738
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
17739
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
17760
17740
|
|
|
17761
|
-
|
|
17762
|
-
let height = 1;
|
|
17741
|
+
let entry = morphTextures.get( geometry );
|
|
17763
17742
|
|
|
17764
|
-
|
|
17743
|
+
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
17765
17744
|
|
|
17766
|
-
|
|
17767
|
-
width = capabilities.maxTextureSize;
|
|
17745
|
+
if ( entry !== undefined ) entry.texture.dispose();
|
|
17768
17746
|
|
|
17769
|
-
|
|
17747
|
+
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
17748
|
+
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
17749
|
+
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
17770
17750
|
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
texture.type = FloatType;
|
|
17775
|
-
texture.needsUpdate = true;
|
|
17751
|
+
const morphTargets = geometry.morphAttributes.position || [];
|
|
17752
|
+
const morphNormals = geometry.morphAttributes.normal || [];
|
|
17753
|
+
const morphColors = geometry.morphAttributes.color || [];
|
|
17776
17754
|
|
|
17777
|
-
|
|
17755
|
+
let vertexDataCount = 0;
|
|
17778
17756
|
|
|
17779
|
-
|
|
17757
|
+
if ( hasMorphPosition === true ) vertexDataCount = 1;
|
|
17758
|
+
if ( hasMorphNormals === true ) vertexDataCount = 2;
|
|
17759
|
+
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
17780
17760
|
|
|
17781
|
-
|
|
17761
|
+
let width = geometry.attributes.position.count * vertexDataCount;
|
|
17762
|
+
let height = 1;
|
|
17782
17763
|
|
|
17783
|
-
|
|
17784
|
-
const morphNormal = morphNormals[ i ];
|
|
17785
|
-
const morphColor = morphColors[ i ];
|
|
17764
|
+
if ( width > capabilities.maxTextureSize ) {
|
|
17786
17765
|
|
|
17787
|
-
|
|
17766
|
+
height = Math.ceil( width / capabilities.maxTextureSize );
|
|
17767
|
+
width = capabilities.maxTextureSize;
|
|
17788
17768
|
|
|
17789
|
-
|
|
17769
|
+
}
|
|
17790
17770
|
|
|
17791
|
-
|
|
17771
|
+
const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
|
|
17792
17772
|
|
|
17793
|
-
|
|
17773
|
+
const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
|
|
17774
|
+
texture.type = FloatType;
|
|
17775
|
+
texture.needsUpdate = true;
|
|
17794
17776
|
|
|
17795
|
-
|
|
17777
|
+
// fill buffer
|
|
17796
17778
|
|
|
17797
|
-
|
|
17798
|
-
buffer[ offset + stride + 1 ] = morph.y;
|
|
17799
|
-
buffer[ offset + stride + 2 ] = morph.z;
|
|
17800
|
-
buffer[ offset + stride + 3 ] = 0;
|
|
17779
|
+
const vertexDataStride = vertexDataCount * 4;
|
|
17801
17780
|
|
|
17802
|
-
|
|
17781
|
+
for ( let i = 0; i < morphTargetsCount; i ++ ) {
|
|
17803
17782
|
|
|
17804
|
-
|
|
17783
|
+
const morphTarget = morphTargets[ i ];
|
|
17784
|
+
const morphNormal = morphNormals[ i ];
|
|
17785
|
+
const morphColor = morphColors[ i ];
|
|
17805
17786
|
|
|
17806
|
-
|
|
17787
|
+
const offset = width * height * 4 * i;
|
|
17807
17788
|
|
|
17808
|
-
|
|
17809
|
-
buffer[ offset + stride + 5 ] = morph.y;
|
|
17810
|
-
buffer[ offset + stride + 6 ] = morph.z;
|
|
17811
|
-
buffer[ offset + stride + 7 ] = 0;
|
|
17789
|
+
for ( let j = 0; j < morphTarget.count; j ++ ) {
|
|
17812
17790
|
|
|
17813
|
-
|
|
17791
|
+
const stride = j * vertexDataStride;
|
|
17814
17792
|
|
|
17815
|
-
|
|
17793
|
+
if ( hasMorphPosition === true ) {
|
|
17816
17794
|
|
|
17817
|
-
|
|
17795
|
+
morph.fromBufferAttribute( morphTarget, j );
|
|
17818
17796
|
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
}
|
|
17797
|
+
buffer[ offset + stride + 0 ] = morph.x;
|
|
17798
|
+
buffer[ offset + stride + 1 ] = morph.y;
|
|
17799
|
+
buffer[ offset + stride + 2 ] = morph.z;
|
|
17800
|
+
buffer[ offset + stride + 3 ] = 0;
|
|
17825
17801
|
|
|
17826
17802
|
}
|
|
17827
17803
|
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
entry = {
|
|
17831
|
-
count: morphTargetsCount,
|
|
17832
|
-
texture: texture,
|
|
17833
|
-
size: new Vector2( width, height )
|
|
17834
|
-
};
|
|
17835
|
-
|
|
17836
|
-
morphTextures.set( geometry, entry );
|
|
17837
|
-
|
|
17838
|
-
function disposeTexture() {
|
|
17839
|
-
|
|
17840
|
-
texture.dispose();
|
|
17804
|
+
if ( hasMorphNormals === true ) {
|
|
17841
17805
|
|
|
17842
|
-
|
|
17806
|
+
morph.fromBufferAttribute( morphNormal, j );
|
|
17843
17807
|
|
|
17844
|
-
|
|
17808
|
+
buffer[ offset + stride + 4 ] = morph.x;
|
|
17809
|
+
buffer[ offset + stride + 5 ] = morph.y;
|
|
17810
|
+
buffer[ offset + stride + 6 ] = morph.z;
|
|
17811
|
+
buffer[ offset + stride + 7 ] = 0;
|
|
17845
17812
|
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
geometry.addEventListener( 'dispose', disposeTexture );
|
|
17849
|
-
|
|
17850
|
-
}
|
|
17851
|
-
|
|
17852
|
-
//
|
|
17853
|
-
if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
|
|
17854
|
-
|
|
17855
|
-
program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
|
|
17813
|
+
}
|
|
17856
17814
|
|
|
17857
|
-
|
|
17815
|
+
if ( hasMorphColors === true ) {
|
|
17858
17816
|
|
|
17859
|
-
|
|
17817
|
+
morph.fromBufferAttribute( morphColor, j );
|
|
17860
17818
|
|
|
17861
|
-
|
|
17819
|
+
buffer[ offset + stride + 8 ] = morph.x;
|
|
17820
|
+
buffer[ offset + stride + 9 ] = morph.y;
|
|
17821
|
+
buffer[ offset + stride + 10 ] = morph.z;
|
|
17822
|
+
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
|
|
17862
17823
|
|
|
17863
|
-
|
|
17824
|
+
}
|
|
17864
17825
|
|
|
17865
17826
|
}
|
|
17866
17827
|
|
|
17867
|
-
const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
|
|
17871
|
-
program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
|
|
17872
|
-
|
|
17873
17828
|
}
|
|
17874
17829
|
|
|
17875
|
-
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
// When object doesn't have morph target influences defined, we treat it as a 0-length array
|
|
17881
|
-
// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
|
|
17882
|
-
|
|
17883
|
-
const length = objectInfluences === undefined ? 0 : objectInfluences.length;
|
|
17884
|
-
|
|
17885
|
-
let influences = influencesList[ geometry.id ];
|
|
17886
|
-
|
|
17887
|
-
if ( influences === undefined || influences.length !== length ) {
|
|
17888
|
-
|
|
17889
|
-
// initialise list
|
|
17890
|
-
|
|
17891
|
-
influences = [];
|
|
17892
|
-
|
|
17893
|
-
for ( let i = 0; i < length; i ++ ) {
|
|
17894
|
-
|
|
17895
|
-
influences[ i ] = [ i, 0 ];
|
|
17896
|
-
|
|
17897
|
-
}
|
|
17898
|
-
|
|
17899
|
-
influencesList[ geometry.id ] = influences;
|
|
17830
|
+
entry = {
|
|
17831
|
+
count: morphTargetsCount,
|
|
17832
|
+
texture: texture,
|
|
17833
|
+
size: new Vector2( width, height )
|
|
17834
|
+
};
|
|
17900
17835
|
|
|
17901
|
-
|
|
17836
|
+
morphTextures.set( geometry, entry );
|
|
17902
17837
|
|
|
17903
|
-
|
|
17838
|
+
function disposeTexture() {
|
|
17904
17839
|
|
|
17905
|
-
|
|
17840
|
+
texture.dispose();
|
|
17906
17841
|
|
|
17907
|
-
|
|
17842
|
+
morphTextures.delete( geometry );
|
|
17908
17843
|
|
|
17909
|
-
|
|
17910
|
-
influence[ 1 ] = objectInfluences[ i ];
|
|
17844
|
+
geometry.removeEventListener( 'dispose', disposeTexture );
|
|
17911
17845
|
|
|
17912
17846
|
}
|
|
17913
17847
|
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
for ( let i = 0; i < 8; i ++ ) {
|
|
17917
|
-
|
|
17918
|
-
if ( i < length && influences[ i ][ 1 ] ) {
|
|
17919
|
-
|
|
17920
|
-
workInfluences[ i ][ 0 ] = influences[ i ][ 0 ];
|
|
17921
|
-
workInfluences[ i ][ 1 ] = influences[ i ][ 1 ];
|
|
17922
|
-
|
|
17923
|
-
} else {
|
|
17924
|
-
|
|
17925
|
-
workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;
|
|
17926
|
-
workInfluences[ i ][ 1 ] = 0;
|
|
17848
|
+
geometry.addEventListener( 'dispose', disposeTexture );
|
|
17927
17849
|
|
|
17928
|
-
|
|
17850
|
+
}
|
|
17929
17851
|
|
|
17930
|
-
|
|
17852
|
+
//
|
|
17853
|
+
if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
|
|
17931
17854
|
|
|
17932
|
-
|
|
17855
|
+
program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
|
|
17933
17856
|
|
|
17934
|
-
|
|
17935
|
-
const morphNormals = geometry.morphAttributes.normal;
|
|
17857
|
+
} else {
|
|
17936
17858
|
|
|
17937
17859
|
let morphInfluencesSum = 0;
|
|
17938
17860
|
|
|
17939
|
-
for ( let i = 0; i <
|
|
17940
|
-
|
|
17941
|
-
const influence = workInfluences[ i ];
|
|
17942
|
-
const index = influence[ 0 ];
|
|
17943
|
-
const value = influence[ 1 ];
|
|
17944
|
-
|
|
17945
|
-
if ( index !== Number.MAX_SAFE_INTEGER && value ) {
|
|
17946
|
-
|
|
17947
|
-
if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {
|
|
17948
|
-
|
|
17949
|
-
geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );
|
|
17950
|
-
|
|
17951
|
-
}
|
|
17952
|
-
|
|
17953
|
-
if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {
|
|
17954
|
-
|
|
17955
|
-
geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );
|
|
17956
|
-
|
|
17957
|
-
}
|
|
17958
|
-
|
|
17959
|
-
morphInfluences[ i ] = value;
|
|
17960
|
-
morphInfluencesSum += value;
|
|
17961
|
-
|
|
17962
|
-
} else {
|
|
17861
|
+
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
17963
17862
|
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
geometry.deleteAttribute( 'morphTarget' + i );
|
|
17967
|
-
|
|
17968
|
-
}
|
|
17969
|
-
|
|
17970
|
-
if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {
|
|
17971
|
-
|
|
17972
|
-
geometry.deleteAttribute( 'morphNormal' + i );
|
|
17973
|
-
|
|
17974
|
-
}
|
|
17975
|
-
|
|
17976
|
-
morphInfluences[ i ] = 0;
|
|
17977
|
-
|
|
17978
|
-
}
|
|
17863
|
+
morphInfluencesSum += objectInfluences[ i ];
|
|
17979
17864
|
|
|
17980
17865
|
}
|
|
17981
17866
|
|
|
17982
|
-
// GLSL shader uses formula baseinfluence * base + sum(target * influence)
|
|
17983
|
-
// This allows us to switch between absolute morphs and relative morphs without changing shader code
|
|
17984
|
-
// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
|
|
17985
17867
|
const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
17986
17868
|
|
|
17869
|
+
|
|
17987
17870
|
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
|
|
17988
|
-
program.getUniforms().setValue( gl, 'morphTargetInfluences',
|
|
17871
|
+
program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
|
|
17989
17872
|
|
|
17990
17873
|
}
|
|
17991
17874
|
|
|
17875
|
+
program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
|
|
17876
|
+
program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
|
|
17877
|
+
|
|
17992
17878
|
}
|
|
17993
17879
|
|
|
17994
17880
|
return {
|
|
@@ -19538,19 +19424,6 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
19538
19424
|
|
|
19539
19425
|
}
|
|
19540
19426
|
|
|
19541
|
-
function generateExtensions( parameters ) {
|
|
19542
|
-
|
|
19543
|
-
const chunks = [
|
|
19544
|
-
( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
|
|
19545
|
-
( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
|
|
19546
|
-
( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
|
|
19547
|
-
( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
|
|
19548
|
-
];
|
|
19549
|
-
|
|
19550
|
-
return chunks.filter( filterEmptyLine ).join( '\n' );
|
|
19551
|
-
|
|
19552
|
-
}
|
|
19553
|
-
|
|
19554
19427
|
function generateVertexExtensions( parameters ) {
|
|
19555
19428
|
|
|
19556
19429
|
const chunks = [
|
|
@@ -19653,11 +19526,7 @@ function resolveIncludes( string ) {
|
|
|
19653
19526
|
|
|
19654
19527
|
}
|
|
19655
19528
|
|
|
19656
|
-
const shaderChunkMap = new Map(
|
|
19657
|
-
[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154
|
|
19658
|
-
[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154
|
|
19659
|
-
[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154
|
|
19660
|
-
] );
|
|
19529
|
+
const shaderChunkMap = new Map();
|
|
19661
19530
|
|
|
19662
19531
|
function includeReplacer( match, include ) {
|
|
19663
19532
|
|
|
@@ -19718,27 +19587,21 @@ function generatePrecision( parameters ) {
|
|
|
19718
19587
|
precision ${parameters.precision} int;
|
|
19719
19588
|
precision ${parameters.precision} sampler2D;
|
|
19720
19589
|
precision ${parameters.precision} samplerCube;
|
|
19590
|
+
precision ${parameters.precision} sampler3D;
|
|
19591
|
+
precision ${parameters.precision} sampler2DArray;
|
|
19592
|
+
precision ${parameters.precision} sampler2DShadow;
|
|
19593
|
+
precision ${parameters.precision} samplerCubeShadow;
|
|
19594
|
+
precision ${parameters.precision} sampler2DArrayShadow;
|
|
19595
|
+
precision ${parameters.precision} isampler2D;
|
|
19596
|
+
precision ${parameters.precision} isampler3D;
|
|
19597
|
+
precision ${parameters.precision} isamplerCube;
|
|
19598
|
+
precision ${parameters.precision} isampler2DArray;
|
|
19599
|
+
precision ${parameters.precision} usampler2D;
|
|
19600
|
+
precision ${parameters.precision} usampler3D;
|
|
19601
|
+
precision ${parameters.precision} usamplerCube;
|
|
19602
|
+
precision ${parameters.precision} usampler2DArray;
|
|
19721
19603
|
`;
|
|
19722
19604
|
|
|
19723
|
-
if ( parameters.isWebGL2 ) {
|
|
19724
|
-
|
|
19725
|
-
precisionstring += `precision ${parameters.precision} sampler3D;
|
|
19726
|
-
precision ${parameters.precision} sampler2DArray;
|
|
19727
|
-
precision ${parameters.precision} sampler2DShadow;
|
|
19728
|
-
precision ${parameters.precision} samplerCubeShadow;
|
|
19729
|
-
precision ${parameters.precision} sampler2DArrayShadow;
|
|
19730
|
-
precision ${parameters.precision} isampler2D;
|
|
19731
|
-
precision ${parameters.precision} isampler3D;
|
|
19732
|
-
precision ${parameters.precision} isamplerCube;
|
|
19733
|
-
precision ${parameters.precision} isampler2DArray;
|
|
19734
|
-
precision ${parameters.precision} usampler2D;
|
|
19735
|
-
precision ${parameters.precision} usampler3D;
|
|
19736
|
-
precision ${parameters.precision} usamplerCube;
|
|
19737
|
-
precision ${parameters.precision} usampler2DArray;
|
|
19738
|
-
`;
|
|
19739
|
-
|
|
19740
|
-
}
|
|
19741
|
-
|
|
19742
19605
|
if ( parameters.precision === 'highp' ) {
|
|
19743
19606
|
|
|
19744
19607
|
precisionstring += '\n#define HIGH_PRECISION';
|
|
@@ -19887,8 +19750,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
19887
19750
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
19888
19751
|
const envMapCubeUVSize = generateCubeUVSize( parameters );
|
|
19889
19752
|
|
|
19890
|
-
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
19891
|
-
|
|
19892
19753
|
const customVertexExtensions = generateVertexExtensions( parameters );
|
|
19893
19754
|
|
|
19894
19755
|
const customDefines = generateDefines( defines );
|
|
@@ -19919,8 +19780,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
19919
19780
|
|
|
19920
19781
|
prefixFragment = [
|
|
19921
19782
|
|
|
19922
|
-
customExtensions,
|
|
19923
|
-
|
|
19924
19783
|
'#define SHADER_TYPE ' + parameters.shaderType,
|
|
19925
19784
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
19926
19785
|
|
|
@@ -20042,10 +19901,10 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20042
19901
|
|
|
20043
19902
|
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
|
|
20044
19903
|
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
|
|
20045
|
-
( parameters.morphColors
|
|
20046
|
-
( parameters.morphTargetsCount > 0
|
|
20047
|
-
( parameters.morphTargetsCount > 0
|
|
20048
|
-
( parameters.morphTargetsCount > 0
|
|
19904
|
+
( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',
|
|
19905
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',
|
|
19906
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
|
|
19907
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
|
|
20049
19908
|
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
|
|
20050
19909
|
parameters.flipSided ? '#define FLIP_SIDED' : '',
|
|
20051
19910
|
|
|
@@ -20059,7 +19918,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20059
19918
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
20060
19919
|
|
|
20061
19920
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20062
|
-
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
20063
19921
|
|
|
20064
19922
|
'uniform mat4 modelMatrix;',
|
|
20065
19923
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -20163,8 +20021,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20163
20021
|
|
|
20164
20022
|
prefixFragment = [
|
|
20165
20023
|
|
|
20166
|
-
customExtensions,
|
|
20167
|
-
|
|
20168
20024
|
generatePrecision( parameters ),
|
|
20169
20025
|
|
|
20170
20026
|
'#define SHADER_TYPE ' + parameters.shaderType,
|
|
@@ -20201,6 +20057,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20201
20057
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
20202
20058
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
20203
20059
|
|
|
20060
|
+
parameters.dispersion ? '#define USE_DISPERSION' : '',
|
|
20061
|
+
|
|
20204
20062
|
parameters.iridescence ? '#define USE_IRIDESCENCE' : '',
|
|
20205
20063
|
parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
|
|
20206
20064
|
parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
|
|
@@ -20252,7 +20110,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20252
20110
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
20253
20111
|
|
|
20254
20112
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20255
|
-
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
20256
20113
|
|
|
20257
20114
|
'uniform mat4 viewMatrix;',
|
|
20258
20115
|
'uniform vec3 cameraPosition;',
|
|
@@ -20287,7 +20144,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20287
20144
|
vertexShader = unrollLoops( vertexShader );
|
|
20288
20145
|
fragmentShader = unrollLoops( fragmentShader );
|
|
20289
20146
|
|
|
20290
|
-
if ( parameters.
|
|
20147
|
+
if ( parameters.isRawShaderMaterial !== true ) {
|
|
20291
20148
|
|
|
20292
20149
|
// GLSL 3.0 conversion for built-in materials and ShaderMaterial
|
|
20293
20150
|
|
|
@@ -20295,14 +20152,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20295
20152
|
|
|
20296
20153
|
prefixVertex = [
|
|
20297
20154
|
customVertexExtensions,
|
|
20298
|
-
'precision mediump sampler2DArray;',
|
|
20299
20155
|
'#define attribute in',
|
|
20300
20156
|
'#define varying out',
|
|
20301
20157
|
'#define texture2D texture'
|
|
20302
20158
|
].join( '\n' ) + '\n' + prefixVertex;
|
|
20303
20159
|
|
|
20304
20160
|
prefixFragment = [
|
|
20305
|
-
'precision mediump sampler2DArray;',
|
|
20306
20161
|
'#define varying in',
|
|
20307
20162
|
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
20308
20163
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
@@ -20693,7 +20548,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20693
20548
|
const _activeChannels = new Set();
|
|
20694
20549
|
const programs = [];
|
|
20695
20550
|
|
|
20696
|
-
const IS_WEBGL2 = capabilities.isWebGL2;
|
|
20697
20551
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
20698
20552
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
20699
20553
|
|
|
@@ -20810,6 +20664,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20810
20664
|
|
|
20811
20665
|
const HAS_ANISOTROPY = material.anisotropy > 0;
|
|
20812
20666
|
const HAS_CLEARCOAT = material.clearcoat > 0;
|
|
20667
|
+
const HAS_DISPERSION = material.dispersion > 0;
|
|
20813
20668
|
const HAS_IRIDESCENCE = material.iridescence > 0;
|
|
20814
20669
|
const HAS_SHEEN = material.sheen > 0;
|
|
20815
20670
|
const HAS_TRANSMISSION = material.transmission > 0;
|
|
@@ -20857,8 +20712,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20857
20712
|
|
|
20858
20713
|
const parameters = {
|
|
20859
20714
|
|
|
20860
|
-
isWebGL2: IS_WEBGL2,
|
|
20861
|
-
|
|
20862
20715
|
shaderID: shaderID,
|
|
20863
20716
|
shaderType: material.type,
|
|
20864
20717
|
shaderName: material.name,
|
|
@@ -20911,6 +20764,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20911
20764
|
clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,
|
|
20912
20765
|
clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,
|
|
20913
20766
|
|
|
20767
|
+
dispersion: HAS_DISPERSION,
|
|
20768
|
+
|
|
20914
20769
|
iridescence: HAS_IRIDESCENCE,
|
|
20915
20770
|
iridescenceMap: HAS_IRIDESCENCEMAP,
|
|
20916
20771
|
iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,
|
|
@@ -21033,16 +20888,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
21033
20888
|
|
|
21034
20889
|
index0AttributeName: material.index0AttributeName,
|
|
21035
20890
|
|
|
21036
|
-
extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,
|
|
21037
|
-
extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
|
|
21038
|
-
extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
|
|
21039
|
-
extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
|
|
21040
20891
|
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
21041
20892
|
extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
|
|
21042
20893
|
|
|
21043
|
-
rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
|
|
21044
|
-
rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
|
|
21045
|
-
rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
|
|
21046
20894
|
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
21047
20895
|
|
|
21048
20896
|
customProgramCacheKey: material.customProgramCacheKey()
|
|
@@ -21158,47 +21006,47 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
21158
21006
|
|
|
21159
21007
|
_programLayers.disableAll();
|
|
21160
21008
|
|
|
21161
|
-
if ( parameters.isWebGL2 )
|
|
21162
|
-
_programLayers.enable( 0 );
|
|
21163
21009
|
if ( parameters.supportsVertexTextures )
|
|
21164
|
-
_programLayers.enable(
|
|
21010
|
+
_programLayers.enable( 0 );
|
|
21165
21011
|
if ( parameters.instancing )
|
|
21166
|
-
_programLayers.enable(
|
|
21012
|
+
_programLayers.enable( 1 );
|
|
21167
21013
|
if ( parameters.instancingColor )
|
|
21168
|
-
_programLayers.enable(
|
|
21014
|
+
_programLayers.enable( 2 );
|
|
21169
21015
|
if ( parameters.instancingMorph )
|
|
21170
|
-
_programLayers.enable(
|
|
21016
|
+
_programLayers.enable( 3 );
|
|
21171
21017
|
if ( parameters.matcap )
|
|
21172
|
-
_programLayers.enable(
|
|
21018
|
+
_programLayers.enable( 4 );
|
|
21173
21019
|
if ( parameters.envMap )
|
|
21174
|
-
_programLayers.enable(
|
|
21020
|
+
_programLayers.enable( 5 );
|
|
21175
21021
|
if ( parameters.normalMapObjectSpace )
|
|
21176
|
-
_programLayers.enable(
|
|
21022
|
+
_programLayers.enable( 6 );
|
|
21177
21023
|
if ( parameters.normalMapTangentSpace )
|
|
21178
|
-
_programLayers.enable(
|
|
21024
|
+
_programLayers.enable( 7 );
|
|
21179
21025
|
if ( parameters.clearcoat )
|
|
21180
|
-
_programLayers.enable(
|
|
21026
|
+
_programLayers.enable( 8 );
|
|
21181
21027
|
if ( parameters.iridescence )
|
|
21182
|
-
_programLayers.enable(
|
|
21028
|
+
_programLayers.enable( 9 );
|
|
21183
21029
|
if ( parameters.alphaTest )
|
|
21184
|
-
_programLayers.enable(
|
|
21030
|
+
_programLayers.enable( 10 );
|
|
21185
21031
|
if ( parameters.vertexColors )
|
|
21186
|
-
_programLayers.enable(
|
|
21032
|
+
_programLayers.enable( 11 );
|
|
21187
21033
|
if ( parameters.vertexAlphas )
|
|
21188
|
-
_programLayers.enable(
|
|
21034
|
+
_programLayers.enable( 12 );
|
|
21189
21035
|
if ( parameters.vertexUv1s )
|
|
21190
|
-
_programLayers.enable(
|
|
21036
|
+
_programLayers.enable( 13 );
|
|
21191
21037
|
if ( parameters.vertexUv2s )
|
|
21192
|
-
_programLayers.enable(
|
|
21038
|
+
_programLayers.enable( 14 );
|
|
21193
21039
|
if ( parameters.vertexUv3s )
|
|
21194
|
-
_programLayers.enable(
|
|
21040
|
+
_programLayers.enable( 15 );
|
|
21195
21041
|
if ( parameters.vertexTangents )
|
|
21196
|
-
_programLayers.enable(
|
|
21042
|
+
_programLayers.enable( 16 );
|
|
21197
21043
|
if ( parameters.anisotropy )
|
|
21198
|
-
_programLayers.enable(
|
|
21044
|
+
_programLayers.enable( 17 );
|
|
21199
21045
|
if ( parameters.alphaHash )
|
|
21200
|
-
_programLayers.enable(
|
|
21046
|
+
_programLayers.enable( 18 );
|
|
21201
21047
|
if ( parameters.batching )
|
|
21048
|
+
_programLayers.enable( 19 );
|
|
21049
|
+
if ( parameters.dispersion )
|
|
21202
21050
|
_programLayers.enable( 20 );
|
|
21203
21051
|
|
|
21204
21052
|
array.push( _programLayers.mask );
|
|
@@ -21774,7 +21622,7 @@ function shadowCastingAndTexturingLightsFirst( lightA, lightB ) {
|
|
|
21774
21622
|
|
|
21775
21623
|
}
|
|
21776
21624
|
|
|
21777
|
-
function WebGLLights( extensions
|
|
21625
|
+
function WebGLLights( extensions ) {
|
|
21778
21626
|
|
|
21779
21627
|
const cache = new UniformsCache();
|
|
21780
21628
|
|
|
@@ -22023,41 +21871,15 @@ function WebGLLights( extensions, capabilities ) {
|
|
|
22023
21871
|
|
|
22024
21872
|
if ( rectAreaLength > 0 ) {
|
|
22025
21873
|
|
|
22026
|
-
if (
|
|
21874
|
+
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
22027
21875
|
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
22031
|
-
|
|
22032
|
-
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
22033
|
-
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
22034
|
-
|
|
22035
|
-
} else {
|
|
22036
|
-
|
|
22037
|
-
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
22038
|
-
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
22039
|
-
|
|
22040
|
-
}
|
|
21876
|
+
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
21877
|
+
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
22041
21878
|
|
|
22042
21879
|
} else {
|
|
22043
21880
|
|
|
22044
|
-
|
|
22045
|
-
|
|
22046
|
-
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
22047
|
-
|
|
22048
|
-
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
22049
|
-
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
22050
|
-
|
|
22051
|
-
} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
|
|
22052
|
-
|
|
22053
|
-
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
22054
|
-
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
22055
|
-
|
|
22056
|
-
} else {
|
|
22057
|
-
|
|
22058
|
-
console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
|
|
22059
|
-
|
|
22060
|
-
}
|
|
21881
|
+
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
21882
|
+
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
22061
21883
|
|
|
22062
21884
|
}
|
|
22063
21885
|
|
|
@@ -22210,14 +22032,16 @@ function WebGLLights( extensions, capabilities ) {
|
|
|
22210
22032
|
|
|
22211
22033
|
}
|
|
22212
22034
|
|
|
22213
|
-
function WebGLRenderState( extensions
|
|
22035
|
+
function WebGLRenderState( extensions ) {
|
|
22214
22036
|
|
|
22215
|
-
const lights = new WebGLLights( extensions
|
|
22037
|
+
const lights = new WebGLLights( extensions );
|
|
22216
22038
|
|
|
22217
22039
|
const lightsArray = [];
|
|
22218
22040
|
const shadowsArray = [];
|
|
22219
22041
|
|
|
22220
|
-
function init() {
|
|
22042
|
+
function init( camera ) {
|
|
22043
|
+
|
|
22044
|
+
state.camera = camera;
|
|
22221
22045
|
|
|
22222
22046
|
lightsArray.length = 0;
|
|
22223
22047
|
shadowsArray.length = 0;
|
|
@@ -22252,7 +22076,11 @@ function WebGLRenderState( extensions, capabilities ) {
|
|
|
22252
22076
|
lightsArray: lightsArray,
|
|
22253
22077
|
shadowsArray: shadowsArray,
|
|
22254
22078
|
|
|
22255
|
-
|
|
22079
|
+
camera: null,
|
|
22080
|
+
|
|
22081
|
+
lights: lights,
|
|
22082
|
+
|
|
22083
|
+
transmissionRenderTarget: {}
|
|
22256
22084
|
};
|
|
22257
22085
|
|
|
22258
22086
|
return {
|
|
@@ -22267,7 +22095,7 @@ function WebGLRenderState( extensions, capabilities ) {
|
|
|
22267
22095
|
|
|
22268
22096
|
}
|
|
22269
22097
|
|
|
22270
|
-
function WebGLRenderStates( extensions
|
|
22098
|
+
function WebGLRenderStates( extensions ) {
|
|
22271
22099
|
|
|
22272
22100
|
let renderStates = new WeakMap();
|
|
22273
22101
|
|
|
@@ -22278,14 +22106,14 @@ function WebGLRenderStates( extensions, capabilities ) {
|
|
|
22278
22106
|
|
|
22279
22107
|
if ( renderStateArray === undefined ) {
|
|
22280
22108
|
|
|
22281
|
-
renderState = new WebGLRenderState( extensions
|
|
22109
|
+
renderState = new WebGLRenderState( extensions );
|
|
22282
22110
|
renderStates.set( scene, [ renderState ] );
|
|
22283
22111
|
|
|
22284
22112
|
} else {
|
|
22285
22113
|
|
|
22286
22114
|
if ( renderCallDepth >= renderStateArray.length ) {
|
|
22287
22115
|
|
|
22288
|
-
renderState = new WebGLRenderState( extensions
|
|
22116
|
+
renderState = new WebGLRenderState( extensions );
|
|
22289
22117
|
renderStateArray.push( renderState );
|
|
22290
22118
|
|
|
22291
22119
|
} else {
|
|
@@ -22407,7 +22235,7 @@ const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
|
|
|
22407
22235
|
|
|
22408
22236
|
const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
|
|
22409
22237
|
|
|
22410
|
-
function WebGLShadowMap(
|
|
22238
|
+
function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
22411
22239
|
|
|
22412
22240
|
let _frustum = new Frustum();
|
|
22413
22241
|
|
|
@@ -22421,7 +22249,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22421
22249
|
|
|
22422
22250
|
_materialCache = {},
|
|
22423
22251
|
|
|
22424
|
-
_maxTextureSize =
|
|
22252
|
+
_maxTextureSize = capabilities.maxTextureSize;
|
|
22425
22253
|
|
|
22426
22254
|
const shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };
|
|
22427
22255
|
|
|
@@ -22471,11 +22299,11 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22471
22299
|
|
|
22472
22300
|
if ( lights.length === 0 ) return;
|
|
22473
22301
|
|
|
22474
|
-
const currentRenderTarget =
|
|
22475
|
-
const activeCubeFace =
|
|
22476
|
-
const activeMipmapLevel =
|
|
22302
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
22303
|
+
const activeCubeFace = renderer.getActiveCubeFace();
|
|
22304
|
+
const activeMipmapLevel = renderer.getActiveMipmapLevel();
|
|
22477
22305
|
|
|
22478
|
-
const _state =
|
|
22306
|
+
const _state = renderer.state;
|
|
22479
22307
|
|
|
22480
22308
|
// Set GL state for depth map.
|
|
22481
22309
|
_state.setBlending( NoBlending );
|
|
@@ -22549,8 +22377,8 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22549
22377
|
|
|
22550
22378
|
}
|
|
22551
22379
|
|
|
22552
|
-
|
|
22553
|
-
|
|
22380
|
+
renderer.setRenderTarget( shadow.map );
|
|
22381
|
+
renderer.clear();
|
|
22554
22382
|
|
|
22555
22383
|
const viewportCount = shadow.getViewportCount();
|
|
22556
22384
|
|
|
@@ -22591,13 +22419,13 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22591
22419
|
|
|
22592
22420
|
scope.needsUpdate = false;
|
|
22593
22421
|
|
|
22594
|
-
|
|
22422
|
+
renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );
|
|
22595
22423
|
|
|
22596
22424
|
};
|
|
22597
22425
|
|
|
22598
22426
|
function VSMPass( shadow, camera ) {
|
|
22599
22427
|
|
|
22600
|
-
const geometry =
|
|
22428
|
+
const geometry = objects.update( fullScreenMesh );
|
|
22601
22429
|
|
|
22602
22430
|
if ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {
|
|
22603
22431
|
|
|
@@ -22620,18 +22448,18 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22620
22448
|
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
|
|
22621
22449
|
shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
|
|
22622
22450
|
shadowMaterialVertical.uniforms.radius.value = shadow.radius;
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22451
|
+
renderer.setRenderTarget( shadow.mapPass );
|
|
22452
|
+
renderer.clear();
|
|
22453
|
+
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
|
|
22626
22454
|
|
|
22627
22455
|
// horizontal pass
|
|
22628
22456
|
|
|
22629
22457
|
shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
|
|
22630
22458
|
shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
|
|
22631
22459
|
shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22460
|
+
renderer.setRenderTarget( shadow.map );
|
|
22461
|
+
renderer.clear();
|
|
22462
|
+
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );
|
|
22635
22463
|
|
|
22636
22464
|
}
|
|
22637
22465
|
|
|
@@ -22649,7 +22477,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22649
22477
|
|
|
22650
22478
|
result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;
|
|
22651
22479
|
|
|
22652
|
-
if ( (
|
|
22480
|
+
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
|
|
22653
22481
|
( material.displacementMap && material.displacementScale !== 0 ) ||
|
|
22654
22482
|
( material.alphaMap && material.alphaTest > 0 ) ||
|
|
22655
22483
|
( material.map && material.alphaTest > 0 ) ) {
|
|
@@ -22714,7 +22542,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22714
22542
|
|
|
22715
22543
|
if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {
|
|
22716
22544
|
|
|
22717
|
-
const materialProperties =
|
|
22545
|
+
const materialProperties = renderer.properties.get( result );
|
|
22718
22546
|
materialProperties.light = light;
|
|
22719
22547
|
|
|
22720
22548
|
}
|
|
@@ -22735,7 +22563,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22735
22563
|
|
|
22736
22564
|
object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );
|
|
22737
22565
|
|
|
22738
|
-
const geometry =
|
|
22566
|
+
const geometry = objects.update( object );
|
|
22739
22567
|
const material = object.material;
|
|
22740
22568
|
|
|
22741
22569
|
if ( Array.isArray( material ) ) {
|
|
@@ -22751,11 +22579,11 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22751
22579
|
|
|
22752
22580
|
const depthMaterial = getDepthMaterial( object, groupMaterial, light, type );
|
|
22753
22581
|
|
|
22754
|
-
object.onBeforeShadow(
|
|
22582
|
+
object.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
22755
22583
|
|
|
22756
|
-
|
|
22584
|
+
renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
22757
22585
|
|
|
22758
|
-
object.onAfterShadow(
|
|
22586
|
+
object.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
22759
22587
|
|
|
22760
22588
|
}
|
|
22761
22589
|
|
|
@@ -22765,11 +22593,11 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22765
22593
|
|
|
22766
22594
|
const depthMaterial = getDepthMaterial( object, material, light, type );
|
|
22767
22595
|
|
|
22768
|
-
object.onBeforeShadow(
|
|
22596
|
+
object.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
22769
22597
|
|
|
22770
|
-
|
|
22598
|
+
renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
22771
22599
|
|
|
22772
|
-
object.onAfterShadow(
|
|
22600
|
+
object.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
22773
22601
|
|
|
22774
22602
|
}
|
|
22775
22603
|
|
|
@@ -22815,9 +22643,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
22815
22643
|
|
|
22816
22644
|
}
|
|
22817
22645
|
|
|
22818
|
-
function WebGLState( gl
|
|
22819
|
-
|
|
22820
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
22646
|
+
function WebGLState( gl ) {
|
|
22821
22647
|
|
|
22822
22648
|
function ColorBuffer() {
|
|
22823
22649
|
|
|
@@ -23189,7 +23015,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
23189
23015
|
|
|
23190
23016
|
for ( let i = 0; i < count; i ++ ) {
|
|
23191
23017
|
|
|
23192
|
-
if (
|
|
23018
|
+
if ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {
|
|
23193
23019
|
|
|
23194
23020
|
gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
|
|
23195
23021
|
|
|
@@ -23208,13 +23034,8 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
23208
23034
|
const emptyTextures = {};
|
|
23209
23035
|
emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
|
|
23210
23036
|
emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
|
|
23211
|
-
|
|
23212
|
-
|
|
23213
|
-
|
|
23214
|
-
emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
|
|
23215
|
-
emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
|
|
23216
|
-
|
|
23217
|
-
}
|
|
23037
|
+
emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
|
|
23038
|
+
emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
|
|
23218
23039
|
|
|
23219
23040
|
// init
|
|
23220
23041
|
|
|
@@ -23263,21 +23084,17 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
23263
23084
|
|
|
23264
23085
|
currentBoundFramebuffers[ target ] = framebuffer;
|
|
23265
23086
|
|
|
23266
|
-
|
|
23087
|
+
// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
|
|
23267
23088
|
|
|
23268
|
-
|
|
23089
|
+
if ( target === gl.DRAW_FRAMEBUFFER ) {
|
|
23269
23090
|
|
|
23270
|
-
|
|
23091
|
+
currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
|
|
23271
23092
|
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
}
|
|
23275
|
-
|
|
23276
|
-
if ( target === gl.FRAMEBUFFER ) {
|
|
23093
|
+
}
|
|
23277
23094
|
|
|
23278
|
-
|
|
23095
|
+
if ( target === gl.FRAMEBUFFER ) {
|
|
23279
23096
|
|
|
23280
|
-
|
|
23097
|
+
currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
|
|
23281
23098
|
|
|
23282
23099
|
}
|
|
23283
23100
|
|
|
@@ -23336,23 +23153,10 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
23336
23153
|
|
|
23337
23154
|
if ( needsUpdate ) {
|
|
23338
23155
|
|
|
23339
|
-
|
|
23340
|
-
|
|
23341
|
-
gl.drawBuffers( drawBuffers );
|
|
23342
|
-
|
|
23343
|
-
} else if ( extensions.has( 'WEBGL_draw_buffers' ) === true ) {
|
|
23344
|
-
|
|
23345
|
-
extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
|
|
23346
|
-
|
|
23347
|
-
} else {
|
|
23348
|
-
|
|
23349
|
-
throw new Error( 'THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension' );
|
|
23350
|
-
|
|
23351
|
-
}
|
|
23156
|
+
gl.drawBuffers( drawBuffers );
|
|
23352
23157
|
|
|
23353
23158
|
}
|
|
23354
23159
|
|
|
23355
|
-
|
|
23356
23160
|
}
|
|
23357
23161
|
|
|
23358
23162
|
function useProgram( program ) {
|
|
@@ -23377,23 +23181,8 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
23377
23181
|
[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
|
|
23378
23182
|
};
|
|
23379
23183
|
|
|
23380
|
-
|
|
23381
|
-
|
|
23382
|
-
equationToGL[ MinEquation ] = gl.MIN;
|
|
23383
|
-
equationToGL[ MaxEquation ] = gl.MAX;
|
|
23384
|
-
|
|
23385
|
-
} else {
|
|
23386
|
-
|
|
23387
|
-
const extension = extensions.get( 'EXT_blend_minmax' );
|
|
23388
|
-
|
|
23389
|
-
if ( extension !== null ) {
|
|
23390
|
-
|
|
23391
|
-
equationToGL[ MinEquation ] = extension.MIN_EXT;
|
|
23392
|
-
equationToGL[ MaxEquation ] = extension.MAX_EXT;
|
|
23393
|
-
|
|
23394
|
-
}
|
|
23395
|
-
|
|
23396
|
-
}
|
|
23184
|
+
equationToGL[ MinEquation ] = gl.MIN;
|
|
23185
|
+
equationToGL[ MaxEquation ] = gl.MAX;
|
|
23397
23186
|
|
|
23398
23187
|
const factorToGL = {
|
|
23399
23188
|
[ ZeroFactor ]: gl.ZERO,
|
|
@@ -24017,13 +23806,8 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
24017
23806
|
gl.activeTexture( gl.TEXTURE0 );
|
|
24018
23807
|
|
|
24019
23808
|
gl.bindFramebuffer( gl.FRAMEBUFFER, null );
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
|
|
24024
|
-
gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
|
|
24025
|
-
|
|
24026
|
-
}
|
|
23809
|
+
gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
|
|
23810
|
+
gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
|
|
24027
23811
|
|
|
24028
23812
|
gl.useProgram( null );
|
|
24029
23813
|
|
|
@@ -24130,7 +23914,6 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
24130
23914
|
|
|
24131
23915
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
24132
23916
|
|
|
24133
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
24134
23917
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
24135
23918
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
24136
23919
|
const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
|
|
@@ -24172,7 +23955,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24172
23955
|
|
|
24173
23956
|
}
|
|
24174
23957
|
|
|
24175
|
-
function resizeImage( image,
|
|
23958
|
+
function resizeImage( image, needsNewCanvas, maxSize ) {
|
|
24176
23959
|
|
|
24177
23960
|
let scale = 1;
|
|
24178
23961
|
|
|
@@ -24188,7 +23971,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24188
23971
|
|
|
24189
23972
|
// only perform resize if necessary
|
|
24190
23973
|
|
|
24191
|
-
if ( scale < 1
|
|
23974
|
+
if ( scale < 1 ) {
|
|
24192
23975
|
|
|
24193
23976
|
// only perform resize for certain image types
|
|
24194
23977
|
|
|
@@ -24197,10 +23980,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24197
23980
|
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
|
|
24198
23981
|
( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
|
|
24199
23982
|
|
|
24200
|
-
const
|
|
24201
|
-
|
|
24202
|
-
const width = floor( scale * dimensions.width );
|
|
24203
|
-
const height = floor( scale * dimensions.height );
|
|
23983
|
+
const width = Math.floor( scale * dimensions.width );
|
|
23984
|
+
const height = Math.floor( scale * dimensions.height );
|
|
24204
23985
|
|
|
24205
23986
|
if ( _canvas === undefined ) _canvas = createCanvas( width, height );
|
|
24206
23987
|
|
|
@@ -24236,27 +24017,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24236
24017
|
|
|
24237
24018
|
}
|
|
24238
24019
|
|
|
24239
|
-
function
|
|
24240
|
-
|
|
24241
|
-
const dimensions = getDimensions( image );
|
|
24242
|
-
|
|
24243
|
-
return isPowerOfTwo( dimensions.width ) && isPowerOfTwo( dimensions.height );
|
|
24244
|
-
|
|
24245
|
-
}
|
|
24246
|
-
|
|
24247
|
-
function textureNeedsPowerOfTwo( texture ) {
|
|
24248
|
-
|
|
24249
|
-
if ( isWebGL2 ) return false;
|
|
24020
|
+
function textureNeedsGenerateMipmaps( texture ) {
|
|
24250
24021
|
|
|
24251
|
-
return
|
|
24252
|
-
( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
|
|
24253
|
-
|
|
24254
|
-
}
|
|
24255
|
-
|
|
24256
|
-
function textureNeedsGenerateMipmaps( texture, supportsMips ) {
|
|
24257
|
-
|
|
24258
|
-
return texture.generateMipmaps && supportsMips &&
|
|
24259
|
-
texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
|
|
24022
|
+
return texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
|
|
24260
24023
|
|
|
24261
24024
|
}
|
|
24262
24025
|
|
|
@@ -24268,8 +24031,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24268
24031
|
|
|
24269
24032
|
function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
|
|
24270
24033
|
|
|
24271
|
-
if ( isWebGL2 === false ) return glFormat;
|
|
24272
|
-
|
|
24273
24034
|
if ( internalFormatName !== null ) {
|
|
24274
24035
|
|
|
24275
24036
|
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
|
|
@@ -24318,6 +24079,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24318
24079
|
|
|
24319
24080
|
}
|
|
24320
24081
|
|
|
24082
|
+
if ( glFormat === _gl.RGB ) {
|
|
24083
|
+
|
|
24084
|
+
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
24085
|
+
|
|
24086
|
+
}
|
|
24087
|
+
|
|
24321
24088
|
if ( glFormat === _gl.RGBA ) {
|
|
24322
24089
|
|
|
24323
24090
|
const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
|
|
@@ -24342,9 +24109,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24342
24109
|
|
|
24343
24110
|
}
|
|
24344
24111
|
|
|
24345
|
-
function getMipLevels( texture, image
|
|
24112
|
+
function getMipLevels( texture, image ) {
|
|
24346
24113
|
|
|
24347
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
24114
|
+
if ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
|
|
24348
24115
|
|
|
24349
24116
|
return Math.log2( Math.max( image.width, image.height ) ) + 1;
|
|
24350
24117
|
|
|
@@ -24368,20 +24135,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24368
24135
|
|
|
24369
24136
|
}
|
|
24370
24137
|
|
|
24371
|
-
// Fallback filters for non-power-of-2 textures
|
|
24372
|
-
|
|
24373
|
-
function filterFallback( f ) {
|
|
24374
|
-
|
|
24375
|
-
if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
|
|
24376
|
-
|
|
24377
|
-
return _gl.NEAREST;
|
|
24378
|
-
|
|
24379
|
-
}
|
|
24380
|
-
|
|
24381
|
-
return _gl.LINEAR;
|
|
24382
|
-
|
|
24383
|
-
}
|
|
24384
|
-
|
|
24385
24138
|
//
|
|
24386
24139
|
|
|
24387
24140
|
function onTextureDispose( event ) {
|
|
@@ -24699,7 +24452,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24699
24452
|
[ NotEqualCompare ]: _gl.NOTEQUAL
|
|
24700
24453
|
};
|
|
24701
24454
|
|
|
24702
|
-
function setTextureParameters( textureType, texture
|
|
24455
|
+
function setTextureParameters( textureType, texture ) {
|
|
24703
24456
|
|
|
24704
24457
|
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
|
|
24705
24458
|
( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
|
|
@@ -24709,48 +24462,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24709
24462
|
|
|
24710
24463
|
}
|
|
24711
24464
|
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
|
|
24715
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
|
|
24716
|
-
|
|
24717
|
-
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24465
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
|
|
24466
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
|
|
24718
24467
|
|
|
24719
|
-
|
|
24468
|
+
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24720
24469
|
|
|
24721
|
-
|
|
24722
|
-
|
|
24723
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
|
|
24724
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
|
|
24725
|
-
|
|
24726
|
-
} else {
|
|
24727
|
-
|
|
24728
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
|
|
24729
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
|
|
24730
|
-
|
|
24731
|
-
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24732
|
-
|
|
24733
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
|
|
24734
|
-
|
|
24735
|
-
}
|
|
24736
|
-
|
|
24737
|
-
if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
|
|
24738
|
-
|
|
24739
|
-
console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
|
|
24740
|
-
|
|
24741
|
-
}
|
|
24742
|
-
|
|
24743
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
|
|
24744
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
|
|
24745
|
-
|
|
24746
|
-
if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {
|
|
24747
|
-
|
|
24748
|
-
console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
|
|
24749
|
-
|
|
24750
|
-
}
|
|
24470
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
|
|
24751
24471
|
|
|
24752
24472
|
}
|
|
24753
24473
|
|
|
24474
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
|
|
24475
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
|
|
24476
|
+
|
|
24754
24477
|
if ( texture.compareFunction ) {
|
|
24755
24478
|
|
|
24756
24479
|
_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
|
|
@@ -24762,8 +24485,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24762
24485
|
|
|
24763
24486
|
if ( texture.magFilter === NearestFilter ) return;
|
|
24764
24487
|
if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
|
|
24765
|
-
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
|
|
24766
|
-
if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only
|
|
24488
|
+
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
|
|
24767
24489
|
|
|
24768
24490
|
if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
|
|
24769
24491
|
|
|
@@ -24921,97 +24643,41 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24921
24643
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
24922
24644
|
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
24923
24645
|
|
|
24924
|
-
|
|
24925
|
-
let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
|
|
24646
|
+
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
24926
24647
|
image = verifyColorSpace( texture, image );
|
|
24927
24648
|
|
|
24928
|
-
const
|
|
24929
|
-
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24649
|
+
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24930
24650
|
|
|
24931
|
-
|
|
24932
|
-
|
|
24651
|
+
const glType = utils.convert( texture.type );
|
|
24652
|
+
let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
|
|
24933
24653
|
|
|
24934
|
-
setTextureParameters( textureType, texture
|
|
24654
|
+
setTextureParameters( textureType, texture );
|
|
24935
24655
|
|
|
24936
24656
|
let mipmap;
|
|
24937
24657
|
const mipmaps = texture.mipmaps;
|
|
24938
24658
|
|
|
24939
|
-
const useTexStorage = (
|
|
24659
|
+
const useTexStorage = ( texture.isVideoTexture !== true );
|
|
24940
24660
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
24941
24661
|
const dataReady = source.dataReady;
|
|
24942
|
-
const levels = getMipLevels( texture, image
|
|
24662
|
+
const levels = getMipLevels( texture, image );
|
|
24943
24663
|
|
|
24944
24664
|
if ( texture.isDepthTexture ) {
|
|
24945
24665
|
|
|
24946
24666
|
// populate depth texture with dummy data
|
|
24947
24667
|
|
|
24948
|
-
glInternalFormat = _gl.
|
|
24949
|
-
|
|
24950
|
-
if ( isWebGL2 ) {
|
|
24951
|
-
|
|
24952
|
-
if ( texture.type === FloatType ) {
|
|
24953
|
-
|
|
24954
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24955
|
-
|
|
24956
|
-
} else if ( texture.type === UnsignedIntType ) {
|
|
24957
|
-
|
|
24958
|
-
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24959
|
-
|
|
24960
|
-
} else if ( texture.type === UnsignedInt248Type ) {
|
|
24961
|
-
|
|
24962
|
-
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
24963
|
-
|
|
24964
|
-
} else {
|
|
24965
|
-
|
|
24966
|
-
glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
|
|
24967
|
-
|
|
24968
|
-
}
|
|
24969
|
-
|
|
24970
|
-
} else {
|
|
24971
|
-
|
|
24972
|
-
if ( texture.type === FloatType ) {
|
|
24973
|
-
|
|
24974
|
-
console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
|
|
24975
|
-
|
|
24976
|
-
}
|
|
24977
|
-
|
|
24978
|
-
}
|
|
24979
|
-
|
|
24980
|
-
// validation checks for WebGL 1
|
|
24981
|
-
|
|
24982
|
-
if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
24983
|
-
|
|
24984
|
-
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
24985
|
-
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
24986
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
24987
|
-
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
24988
|
-
|
|
24989
|
-
console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
|
|
24990
|
-
|
|
24991
|
-
texture.type = UnsignedIntType;
|
|
24992
|
-
glType = utils.convert( texture.type );
|
|
24993
|
-
|
|
24994
|
-
}
|
|
24995
|
-
|
|
24996
|
-
}
|
|
24668
|
+
glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
24997
24669
|
|
|
24998
|
-
if ( texture.
|
|
24670
|
+
if ( texture.type === FloatType ) {
|
|
24999
24671
|
|
|
25000
|
-
|
|
25001
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
25002
|
-
glInternalFormat = _gl.DEPTH_STENCIL;
|
|
24672
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
25003
24673
|
|
|
25004
|
-
|
|
25005
|
-
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
|
|
25006
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
25007
|
-
if ( texture.type !== UnsignedInt248Type ) {
|
|
24674
|
+
} else if ( texture.type === UnsignedIntType ) {
|
|
25008
24675
|
|
|
25009
|
-
|
|
24676
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
25010
24677
|
|
|
25011
|
-
|
|
25012
|
-
glType = utils.convert( texture.type );
|
|
24678
|
+
} else if ( texture.type === UnsignedInt248Type ) {
|
|
25013
24679
|
|
|
25014
|
-
|
|
24680
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
25015
24681
|
|
|
25016
24682
|
}
|
|
25017
24683
|
|
|
@@ -25037,7 +24703,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25037
24703
|
// if there are no manual mipmaps
|
|
25038
24704
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
25039
24705
|
|
|
25040
|
-
if ( mipmaps.length > 0
|
|
24706
|
+
if ( mipmaps.length > 0 ) {
|
|
25041
24707
|
|
|
25042
24708
|
if ( useTexStorage && allocateMemory ) {
|
|
25043
24709
|
|
|
@@ -25284,7 +24950,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25284
24950
|
// if there are no manual mipmaps
|
|
25285
24951
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
25286
24952
|
|
|
25287
|
-
if ( mipmaps.length > 0
|
|
24953
|
+
if ( mipmaps.length > 0 ) {
|
|
25288
24954
|
|
|
25289
24955
|
if ( useTexStorage && allocateMemory ) {
|
|
25290
24956
|
|
|
@@ -25344,7 +25010,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25344
25010
|
|
|
25345
25011
|
}
|
|
25346
25012
|
|
|
25347
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25013
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25348
25014
|
|
|
25349
25015
|
generateMipmap( textureType );
|
|
25350
25016
|
|
|
@@ -25394,7 +25060,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25394
25060
|
|
|
25395
25061
|
if ( ! isCompressed && ! isDataTexture ) {
|
|
25396
25062
|
|
|
25397
|
-
cubeImage[ i ] = resizeImage( texture.image[ i ],
|
|
25063
|
+
cubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );
|
|
25398
25064
|
|
|
25399
25065
|
} else {
|
|
25400
25066
|
|
|
@@ -25407,17 +25073,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25407
25073
|
}
|
|
25408
25074
|
|
|
25409
25075
|
const image = cubeImage[ 0 ],
|
|
25410
|
-
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
25411
25076
|
glFormat = utils.convert( texture.format, texture.colorSpace ),
|
|
25412
25077
|
glType = utils.convert( texture.type ),
|
|
25413
25078
|
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
25414
25079
|
|
|
25415
|
-
const useTexStorage = (
|
|
25080
|
+
const useTexStorage = ( texture.isVideoTexture !== true );
|
|
25416
25081
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
25417
25082
|
const dataReady = source.dataReady;
|
|
25418
|
-
let levels = getMipLevels( texture, image
|
|
25083
|
+
let levels = getMipLevels( texture, image );
|
|
25419
25084
|
|
|
25420
|
-
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture
|
|
25085
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
|
|
25421
25086
|
|
|
25422
25087
|
let mipmaps;
|
|
25423
25088
|
|
|
@@ -25582,7 +25247,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25582
25247
|
|
|
25583
25248
|
}
|
|
25584
25249
|
|
|
25585
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25250
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25586
25251
|
|
|
25587
25252
|
// We assume images for cube map have the same size.
|
|
25588
25253
|
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
@@ -25724,7 +25389,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25724
25389
|
|
|
25725
25390
|
} else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
25726
25391
|
|
|
25727
|
-
let glInternalFormat =
|
|
25392
|
+
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
25728
25393
|
|
|
25729
25394
|
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
25730
25395
|
|
|
@@ -26003,7 +25668,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26003
25668
|
|
|
26004
25669
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
26005
25670
|
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
26006
|
-
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
26007
25671
|
|
|
26008
25672
|
if ( ! isMultipleRenderTargets ) {
|
|
26009
25673
|
|
|
@@ -26026,7 +25690,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26026
25690
|
|
|
26027
25691
|
for ( let i = 0; i < 6; i ++ ) {
|
|
26028
25692
|
|
|
26029
|
-
if (
|
|
25693
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
26030
25694
|
|
|
26031
25695
|
renderTargetProperties.__webglFramebuffer[ i ] = [];
|
|
26032
25696
|
|
|
@@ -26046,7 +25710,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26046
25710
|
|
|
26047
25711
|
} else {
|
|
26048
25712
|
|
|
26049
|
-
if (
|
|
25713
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
26050
25714
|
|
|
26051
25715
|
renderTargetProperties.__webglFramebuffer = [];
|
|
26052
25716
|
|
|
@@ -26064,31 +25728,23 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26064
25728
|
|
|
26065
25729
|
if ( isMultipleRenderTargets ) {
|
|
26066
25730
|
|
|
26067
|
-
|
|
26068
|
-
|
|
26069
|
-
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
26070
|
-
|
|
26071
|
-
const attachmentProperties = properties.get( textures[ i ] );
|
|
25731
|
+
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
26072
25732
|
|
|
26073
|
-
|
|
25733
|
+
const attachmentProperties = properties.get( textures[ i ] );
|
|
26074
25734
|
|
|
26075
|
-
|
|
25735
|
+
if ( attachmentProperties.__webglTexture === undefined ) {
|
|
26076
25736
|
|
|
26077
|
-
|
|
25737
|
+
attachmentProperties.__webglTexture = _gl.createTexture();
|
|
26078
25738
|
|
|
26079
|
-
|
|
25739
|
+
info.memory.textures ++;
|
|
26080
25740
|
|
|
26081
25741
|
}
|
|
26082
25742
|
|
|
26083
|
-
} else {
|
|
26084
|
-
|
|
26085
|
-
console.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
|
|
26086
|
-
|
|
26087
25743
|
}
|
|
26088
25744
|
|
|
26089
25745
|
}
|
|
26090
25746
|
|
|
26091
|
-
if ( (
|
|
25747
|
+
if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
26092
25748
|
|
|
26093
25749
|
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
26094
25750
|
renderTargetProperties.__webglColorRenderbuffer = [];
|
|
@@ -26132,11 +25788,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26132
25788
|
if ( isCube ) {
|
|
26133
25789
|
|
|
26134
25790
|
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
|
|
26135
|
-
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture
|
|
25791
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
|
|
26136
25792
|
|
|
26137
25793
|
for ( let i = 0; i < 6; i ++ ) {
|
|
26138
25794
|
|
|
26139
|
-
if (
|
|
25795
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
26140
25796
|
|
|
26141
25797
|
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
26142
25798
|
|
|
@@ -26152,7 +25808,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26152
25808
|
|
|
26153
25809
|
}
|
|
26154
25810
|
|
|
26155
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25811
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
26156
25812
|
|
|
26157
25813
|
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
26158
25814
|
|
|
@@ -26168,10 +25824,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26168
25824
|
const attachmentProperties = properties.get( attachment );
|
|
26169
25825
|
|
|
26170
25826
|
state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
26171
|
-
setTextureParameters( _gl.TEXTURE_2D, attachment
|
|
25827
|
+
setTextureParameters( _gl.TEXTURE_2D, attachment );
|
|
26172
25828
|
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
|
|
26173
25829
|
|
|
26174
|
-
if ( textureNeedsGenerateMipmaps( attachment
|
|
25830
|
+
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
26175
25831
|
|
|
26176
25832
|
generateMipmap( _gl.TEXTURE_2D );
|
|
26177
25833
|
|
|
@@ -26187,15 +25843,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26187
25843
|
|
|
26188
25844
|
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
26189
25845
|
|
|
26190
|
-
|
|
26191
|
-
|
|
26192
|
-
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
26193
|
-
|
|
26194
|
-
} else {
|
|
26195
|
-
|
|
26196
|
-
console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
|
|
26197
|
-
|
|
26198
|
-
}
|
|
25846
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
26199
25847
|
|
|
26200
25848
|
}
|
|
26201
25849
|
|
|
@@ -26206,9 +25854,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26206
25854
|
}
|
|
26207
25855
|
|
|
26208
25856
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
26209
|
-
setTextureParameters( glTextureType, texture
|
|
25857
|
+
setTextureParameters( glTextureType, texture );
|
|
26210
25858
|
|
|
26211
|
-
if (
|
|
25859
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
26212
25860
|
|
|
26213
25861
|
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
26214
25862
|
|
|
@@ -26222,7 +25870,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26222
25870
|
|
|
26223
25871
|
}
|
|
26224
25872
|
|
|
26225
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25873
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
26226
25874
|
|
|
26227
25875
|
generateMipmap( glTextureType );
|
|
26228
25876
|
|
|
@@ -26244,15 +25892,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26244
25892
|
|
|
26245
25893
|
function updateRenderTargetMipmap( renderTarget ) {
|
|
26246
25894
|
|
|
26247
|
-
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
26248
|
-
|
|
26249
25895
|
const textures = renderTarget.textures;
|
|
26250
25896
|
|
|
26251
25897
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
26252
25898
|
|
|
26253
25899
|
const texture = textures[ i ];
|
|
26254
25900
|
|
|
26255
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25901
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
26256
25902
|
|
|
26257
25903
|
const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
|
|
26258
25904
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
@@ -26267,109 +25913,120 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26267
25913
|
|
|
26268
25914
|
}
|
|
26269
25915
|
|
|
25916
|
+
const invalidationArrayRead = [];
|
|
25917
|
+
const invalidationArrayDraw = [];
|
|
25918
|
+
|
|
26270
25919
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
26271
25920
|
|
|
26272
|
-
if (
|
|
25921
|
+
if ( renderTarget.samples > 0 ) {
|
|
26273
25922
|
|
|
26274
|
-
|
|
26275
|
-
const width = renderTarget.width;
|
|
26276
|
-
const height = renderTarget.height;
|
|
26277
|
-
let mask = _gl.COLOR_BUFFER_BIT;
|
|
26278
|
-
const invalidationArray = [];
|
|
26279
|
-
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
26280
|
-
const renderTargetProperties = properties.get( renderTarget );
|
|
26281
|
-
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
25923
|
+
if ( useMultisampledRTT( renderTarget ) === false ) {
|
|
26282
25924
|
|
|
26283
|
-
|
|
26284
|
-
|
|
25925
|
+
const textures = renderTarget.textures;
|
|
25926
|
+
const width = renderTarget.width;
|
|
25927
|
+
const height = renderTarget.height;
|
|
25928
|
+
let mask = _gl.COLOR_BUFFER_BIT;
|
|
25929
|
+
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
25930
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
25931
|
+
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
26285
25932
|
|
|
26286
|
-
|
|
25933
|
+
// If MRT we need to remove FBO attachments
|
|
25934
|
+
if ( isMultipleRenderTargets ) {
|
|
25935
|
+
|
|
25936
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
26287
25937
|
|
|
26288
|
-
|
|
26289
|
-
|
|
25938
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25939
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );
|
|
26290
25940
|
|
|
26291
|
-
|
|
26292
|
-
|
|
25941
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25942
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );
|
|
25943
|
+
|
|
25944
|
+
}
|
|
26293
25945
|
|
|
26294
25946
|
}
|
|
26295
25947
|
|
|
26296
|
-
|
|
25948
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25949
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
26297
25950
|
|
|
26298
|
-
|
|
26299
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25951
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
26300
25952
|
|
|
26301
|
-
|
|
25953
|
+
if ( renderTarget.resolveDepthBuffer ) {
|
|
26302
25954
|
|
|
26303
|
-
|
|
25955
|
+
if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
|
|
26304
25956
|
|
|
26305
|
-
|
|
25957
|
+
// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
|
|
26306
25958
|
|
|
26307
|
-
|
|
25959
|
+
if ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;
|
|
26308
25960
|
|
|
26309
|
-
|
|
25961
|
+
}
|
|
26310
25962
|
|
|
26311
|
-
|
|
25963
|
+
if ( isMultipleRenderTargets ) {
|
|
26312
25964
|
|
|
26313
|
-
|
|
25965
|
+
_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
26314
25966
|
|
|
26315
|
-
|
|
26316
|
-
|
|
25967
|
+
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
25968
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
26317
25969
|
|
|
26318
|
-
|
|
25970
|
+
}
|
|
26319
25971
|
|
|
26320
|
-
|
|
25972
|
+
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
|
|
26321
25973
|
|
|
26322
|
-
|
|
25974
|
+
if ( supportsInvalidateFramebuffer === true ) {
|
|
26323
25975
|
|
|
26324
|
-
|
|
25976
|
+
invalidationArrayRead.length = 0;
|
|
25977
|
+
invalidationArrayDraw.length = 0;
|
|
26325
25978
|
|
|
26326
|
-
|
|
25979
|
+
invalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );
|
|
26327
25980
|
|
|
26328
|
-
|
|
26329
|
-
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
25981
|
+
if ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {
|
|
26330
25982
|
|
|
26331
|
-
|
|
25983
|
+
invalidationArrayRead.push( depthStyle );
|
|
25984
|
+
invalidationArrayDraw.push( depthStyle );
|
|
26332
25985
|
|
|
26333
|
-
|
|
25986
|
+
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );
|
|
25987
|
+
|
|
25988
|
+
}
|
|
26334
25989
|
|
|
26335
|
-
|
|
26336
|
-
|
|
25990
|
+
_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );
|
|
25991
|
+
|
|
25992
|
+
}
|
|
26337
25993
|
|
|
26338
25994
|
}
|
|
26339
25995
|
|
|
26340
|
-
|
|
25996
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|
|
25997
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
26341
25998
|
|
|
26342
|
-
|
|
25999
|
+
// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments
|
|
26000
|
+
if ( isMultipleRenderTargets ) {
|
|
26343
26001
|
|
|
26344
|
-
|
|
26002
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
26345
26003
|
|
|
26346
|
-
|
|
26004
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
26005
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
26347
26006
|
|
|
26007
|
+
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
26348
26008
|
|
|
26349
|
-
|
|
26009
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
26010
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
26350
26011
|
|
|
26351
|
-
|
|
26352
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
26012
|
+
}
|
|
26353
26013
|
|
|
26354
|
-
|
|
26355
|
-
if ( isMultipleRenderTargets ) {
|
|
26014
|
+
}
|
|
26356
26015
|
|
|
26357
|
-
|
|
26016
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
26358
26017
|
|
|
26359
|
-
|
|
26360
|
-
|
|
26018
|
+
} else {
|
|
26019
|
+
|
|
26020
|
+
if ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {
|
|
26361
26021
|
|
|
26362
|
-
const
|
|
26022
|
+
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
26363
26023
|
|
|
26364
|
-
|
|
26365
|
-
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
26024
|
+
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
26366
26025
|
|
|
26367
26026
|
}
|
|
26368
26027
|
|
|
26369
26028
|
}
|
|
26370
26029
|
|
|
26371
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
26372
|
-
|
|
26373
26030
|
}
|
|
26374
26031
|
|
|
26375
26032
|
}
|
|
@@ -26384,7 +26041,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26384
26041
|
|
|
26385
26042
|
const renderTargetProperties = properties.get( renderTarget );
|
|
26386
26043
|
|
|
26387
|
-
return
|
|
26044
|
+
return renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
|
|
26388
26045
|
|
|
26389
26046
|
}
|
|
26390
26047
|
|
|
@@ -26409,7 +26066,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26409
26066
|
const format = texture.format;
|
|
26410
26067
|
const type = texture.type;
|
|
26411
26068
|
|
|
26412
|
-
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true
|
|
26069
|
+
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;
|
|
26413
26070
|
|
|
26414
26071
|
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
26415
26072
|
|
|
@@ -26417,36 +26074,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26417
26074
|
|
|
26418
26075
|
if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
|
|
26419
26076
|
|
|
26420
|
-
if
|
|
26077
|
+
// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
|
|
26421
26078
|
|
|
26422
|
-
|
|
26079
|
+
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
26423
26080
|
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
texture.format = _SRGBAFormat;
|
|
26427
|
-
|
|
26428
|
-
// it's not possible to generate mips in WebGL 1 with this extension
|
|
26429
|
-
|
|
26430
|
-
texture.minFilter = LinearFilter;
|
|
26431
|
-
texture.generateMipmaps = false;
|
|
26432
|
-
|
|
26433
|
-
} else {
|
|
26434
|
-
|
|
26435
|
-
// slow fallback (CPU decode)
|
|
26436
|
-
|
|
26437
|
-
image = ImageUtils.sRGBToLinear( image );
|
|
26438
|
-
|
|
26439
|
-
}
|
|
26440
|
-
|
|
26441
|
-
} else {
|
|
26442
|
-
|
|
26443
|
-
// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
|
|
26444
|
-
|
|
26445
|
-
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
26446
|
-
|
|
26447
|
-
console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
26448
|
-
|
|
26449
|
-
}
|
|
26081
|
+
console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
26450
26082
|
|
|
26451
26083
|
}
|
|
26452
26084
|
|
|
@@ -26510,9 +26142,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
26510
26142
|
|
|
26511
26143
|
}
|
|
26512
26144
|
|
|
26513
|
-
function WebGLUtils( gl, extensions
|
|
26514
|
-
|
|
26515
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
26145
|
+
function WebGLUtils( gl, extensions ) {
|
|
26516
26146
|
|
|
26517
26147
|
function convert( p, colorSpace = NoColorSpace ) {
|
|
26518
26148
|
|
|
@@ -26523,6 +26153,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
26523
26153
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
26524
26154
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
26525
26155
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
26156
|
+
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
26526
26157
|
|
|
26527
26158
|
if ( p === ByteType ) return gl.BYTE;
|
|
26528
26159
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -26530,50 +26161,16 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
26530
26161
|
if ( p === IntType ) return gl.INT;
|
|
26531
26162
|
if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
|
|
26532
26163
|
if ( p === FloatType ) return gl.FLOAT;
|
|
26533
|
-
|
|
26534
|
-
if ( p === HalfFloatType ) {
|
|
26535
|
-
|
|
26536
|
-
if ( isWebGL2 ) return gl.HALF_FLOAT;
|
|
26537
|
-
|
|
26538
|
-
extension = extensions.get( 'OES_texture_half_float' );
|
|
26539
|
-
|
|
26540
|
-
if ( extension !== null ) {
|
|
26541
|
-
|
|
26542
|
-
return extension.HALF_FLOAT_OES;
|
|
26543
|
-
|
|
26544
|
-
} else {
|
|
26545
|
-
|
|
26546
|
-
return null;
|
|
26547
|
-
|
|
26548
|
-
}
|
|
26549
|
-
|
|
26550
|
-
}
|
|
26164
|
+
if ( p === HalfFloatType ) return gl.HALF_FLOAT;
|
|
26551
26165
|
|
|
26552
26166
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
26167
|
+
if ( p === RGBFormat ) return gl.RGB;
|
|
26553
26168
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
26554
26169
|
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
26555
26170
|
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
26556
26171
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
26557
26172
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
26558
26173
|
|
|
26559
|
-
// WebGL 1 sRGB fallback
|
|
26560
|
-
|
|
26561
|
-
if ( p === _SRGBAFormat ) {
|
|
26562
|
-
|
|
26563
|
-
extension = extensions.get( 'EXT_sRGB' );
|
|
26564
|
-
|
|
26565
|
-
if ( extension !== null ) {
|
|
26566
|
-
|
|
26567
|
-
return extension.SRGB_ALPHA_EXT;
|
|
26568
|
-
|
|
26569
|
-
} else {
|
|
26570
|
-
|
|
26571
|
-
return null;
|
|
26572
|
-
|
|
26573
|
-
}
|
|
26574
|
-
|
|
26575
|
-
}
|
|
26576
|
-
|
|
26577
26174
|
// WebGL2 formats.
|
|
26578
26175
|
|
|
26579
26176
|
if ( p === RedFormat ) return gl.RED;
|
|
@@ -26645,33 +26242,15 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
26645
26242
|
|
|
26646
26243
|
}
|
|
26647
26244
|
|
|
26648
|
-
//
|
|
26649
|
-
|
|
26650
|
-
if ( p === RGB_ETC1_Format ) {
|
|
26245
|
+
// ETC
|
|
26651
26246
|
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
if ( extension !== null ) {
|
|
26655
|
-
|
|
26656
|
-
return extension.COMPRESSED_RGB_ETC1_WEBGL;
|
|
26657
|
-
|
|
26658
|
-
} else {
|
|
26659
|
-
|
|
26660
|
-
return null;
|
|
26661
|
-
|
|
26662
|
-
}
|
|
26663
|
-
|
|
26664
|
-
}
|
|
26665
|
-
|
|
26666
|
-
// ETC2
|
|
26667
|
-
|
|
26668
|
-
if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
|
|
26247
|
+
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
|
|
26669
26248
|
|
|
26670
26249
|
extension = extensions.get( 'WEBGL_compressed_texture_etc' );
|
|
26671
26250
|
|
|
26672
26251
|
if ( extension !== null ) {
|
|
26673
26252
|
|
|
26674
|
-
if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
26253
|
+
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
26675
26254
|
if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
26676
26255
|
|
|
26677
26256
|
} else {
|
|
@@ -26760,23 +26339,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
26760
26339
|
|
|
26761
26340
|
//
|
|
26762
26341
|
|
|
26763
|
-
if ( p === UnsignedInt248Type )
|
|
26764
|
-
|
|
26765
|
-
if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
|
|
26766
|
-
|
|
26767
|
-
extension = extensions.get( 'WEBGL_depth_texture' );
|
|
26768
|
-
|
|
26769
|
-
if ( extension !== null ) {
|
|
26770
|
-
|
|
26771
|
-
return extension.UNSIGNED_INT_24_8_WEBGL;
|
|
26772
|
-
|
|
26773
|
-
} else {
|
|
26774
|
-
|
|
26775
|
-
return null;
|
|
26776
|
-
|
|
26777
|
-
}
|
|
26778
|
-
|
|
26779
|
-
}
|
|
26342
|
+
if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
|
|
26780
26343
|
|
|
26781
26344
|
// if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
|
|
26782
26345
|
|
|
@@ -27752,11 +27315,11 @@ void main() {
|
|
|
27752
27315
|
|
|
27753
27316
|
if ( coord.x >= 1.0 ) {
|
|
27754
27317
|
|
|
27755
|
-
|
|
27318
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
27756
27319
|
|
|
27757
27320
|
} else {
|
|
27758
27321
|
|
|
27759
|
-
|
|
27322
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
27760
27323
|
|
|
27761
27324
|
}
|
|
27762
27325
|
|
|
@@ -27804,7 +27367,6 @@ class WebXRDepthSensing {
|
|
|
27804
27367
|
|
|
27805
27368
|
const viewport = cameraXR.cameras[ 0 ].viewport;
|
|
27806
27369
|
const material = new ShaderMaterial( {
|
|
27807
|
-
extensions: { fragDepth: true },
|
|
27808
27370
|
vertexShader: _occlusion_vertex,
|
|
27809
27371
|
fragmentShader: _occlusion_fragment,
|
|
27810
27372
|
uniforms: {
|
|
@@ -28110,10 +27672,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
28110
27672
|
currentPixelRatio = renderer.getPixelRatio();
|
|
28111
27673
|
renderer.getSize( currentSize );
|
|
28112
27674
|
|
|
28113
|
-
if (
|
|
27675
|
+
if ( session.renderState.layers === undefined ) {
|
|
28114
27676
|
|
|
28115
27677
|
const layerInit = {
|
|
28116
|
-
antialias:
|
|
27678
|
+
antialias: attributes.antialias,
|
|
28117
27679
|
alpha: true,
|
|
28118
27680
|
depth: attributes.depth,
|
|
28119
27681
|
stencil: attributes.stencil,
|
|
@@ -28181,7 +27743,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
28181
27743
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
28182
27744
|
stencilBuffer: attributes.stencil,
|
|
28183
27745
|
colorSpace: renderer.outputColorSpace,
|
|
28184
|
-
samples: attributes.antialias ? 4 : 0
|
|
27746
|
+
samples: attributes.antialias ? 4 : 0,
|
|
27747
|
+
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
|
|
28185
27748
|
};
|
|
28186
27749
|
|
|
28187
27750
|
if ( scope.isMultiview ) {
|
|
@@ -28201,9 +27764,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
28201
27764
|
|
|
28202
27765
|
}
|
|
28203
27766
|
|
|
28204
|
-
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
28205
|
-
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
28206
|
-
|
|
28207
27767
|
}
|
|
28208
27768
|
|
|
28209
27769
|
newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
|
|
@@ -29092,11 +28652,10 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
29092
28652
|
|
|
29093
28653
|
}
|
|
29094
28654
|
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
if ( envMap ) {
|
|
28655
|
+
if ( material.envMap ) {
|
|
29098
28656
|
|
|
29099
28657
|
//uniforms.envMap.value = material.envMap; // part of uniforms common
|
|
28658
|
+
|
|
29100
28659
|
uniforms.envMapIntensity.value = material.envMapIntensity;
|
|
29101
28660
|
|
|
29102
28661
|
}
|
|
@@ -29170,6 +28729,12 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
29170
28729
|
|
|
29171
28730
|
}
|
|
29172
28731
|
|
|
28732
|
+
if ( material.dispersion > 0 ) {
|
|
28733
|
+
|
|
28734
|
+
uniforms.dispersion.value = material.dispersion;
|
|
28735
|
+
|
|
28736
|
+
}
|
|
28737
|
+
|
|
29173
28738
|
if ( material.iridescence > 0 ) {
|
|
29174
28739
|
|
|
29175
28740
|
uniforms.iridescence.value = material.iridescence;
|
|
@@ -29292,7 +28857,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
29292
28857
|
let updateList = {};
|
|
29293
28858
|
let allocatedBindingPoints = [];
|
|
29294
28859
|
|
|
29295
|
-
const maxBindingPoints =
|
|
28860
|
+
const maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program
|
|
29296
28861
|
|
|
29297
28862
|
function bind( uniformsGroup, program ) {
|
|
29298
28863
|
|
|
@@ -29684,7 +29249,7 @@ class WebGLRenderer {
|
|
|
29684
29249
|
canvas = createCanvasElement(),
|
|
29685
29250
|
context = null,
|
|
29686
29251
|
depth = true,
|
|
29687
|
-
stencil =
|
|
29252
|
+
stencil = false,
|
|
29688
29253
|
alpha = false,
|
|
29689
29254
|
antialias = false,
|
|
29690
29255
|
premultipliedAlpha = true,
|
|
@@ -29700,6 +29265,12 @@ class WebGLRenderer {
|
|
|
29700
29265
|
|
|
29701
29266
|
if ( context !== null ) {
|
|
29702
29267
|
|
|
29268
|
+
if ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {
|
|
29269
|
+
|
|
29270
|
+
throw new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );
|
|
29271
|
+
|
|
29272
|
+
}
|
|
29273
|
+
|
|
29703
29274
|
_alpha = context.getContextAttributes().alpha;
|
|
29704
29275
|
|
|
29705
29276
|
} else {
|
|
@@ -29812,15 +29383,10 @@ class WebGLRenderer {
|
|
|
29812
29383
|
let _clippingEnabled = false;
|
|
29813
29384
|
let _localClippingEnabled = false;
|
|
29814
29385
|
|
|
29815
|
-
// transmission
|
|
29816
|
-
|
|
29817
|
-
let _transmissionRenderTarget = null;
|
|
29818
|
-
|
|
29819
29386
|
// camera matrices cache
|
|
29820
29387
|
|
|
29821
29388
|
const _projScreenMatrix = new Matrix4();
|
|
29822
29389
|
|
|
29823
|
-
const _vector2 = new Vector2();
|
|
29824
29390
|
const _vector3 = new Vector3();
|
|
29825
29391
|
|
|
29826
29392
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
@@ -29835,17 +29401,9 @@ class WebGLRenderer {
|
|
|
29835
29401
|
|
|
29836
29402
|
let _gl = context;
|
|
29837
29403
|
|
|
29838
|
-
function getContext(
|
|
29839
|
-
|
|
29840
|
-
for ( let i = 0; i < contextNames.length; i ++ ) {
|
|
29404
|
+
function getContext( contextName, contextAttributes ) {
|
|
29841
29405
|
|
|
29842
|
-
|
|
29843
|
-
const context = canvas.getContext( contextName, contextAttributes );
|
|
29844
|
-
if ( context !== null ) return context;
|
|
29845
|
-
|
|
29846
|
-
}
|
|
29847
|
-
|
|
29848
|
-
return null;
|
|
29406
|
+
return canvas.getContext( contextName, contextAttributes );
|
|
29849
29407
|
|
|
29850
29408
|
}
|
|
29851
29409
|
|
|
@@ -29872,19 +29430,13 @@ class WebGLRenderer {
|
|
|
29872
29430
|
|
|
29873
29431
|
if ( _gl === null ) {
|
|
29874
29432
|
|
|
29875
|
-
const
|
|
29433
|
+
const contextName = 'webgl2';
|
|
29876
29434
|
|
|
29877
|
-
|
|
29878
|
-
|
|
29879
|
-
contextNames.shift();
|
|
29880
|
-
|
|
29881
|
-
}
|
|
29882
|
-
|
|
29883
|
-
_gl = getContext( contextNames, contextAttributes );
|
|
29435
|
+
_gl = getContext( contextName, contextAttributes );
|
|
29884
29436
|
|
|
29885
29437
|
if ( _gl === null ) {
|
|
29886
29438
|
|
|
29887
|
-
if ( getContext(
|
|
29439
|
+
if ( getContext( contextName ) ) {
|
|
29888
29440
|
|
|
29889
29441
|
throw new Error( 'Error creating WebGL context with your selected attributes.' );
|
|
29890
29442
|
|
|
@@ -29898,24 +29450,6 @@ class WebGLRenderer {
|
|
|
29898
29450
|
|
|
29899
29451
|
}
|
|
29900
29452
|
|
|
29901
|
-
if ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
|
|
29902
|
-
|
|
29903
|
-
console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
|
|
29904
|
-
|
|
29905
|
-
}
|
|
29906
|
-
|
|
29907
|
-
// Some experimental-webgl implementations do not have getShaderPrecisionFormat
|
|
29908
|
-
|
|
29909
|
-
if ( _gl.getShaderPrecisionFormat === undefined ) {
|
|
29910
|
-
|
|
29911
|
-
_gl.getShaderPrecisionFormat = function () {
|
|
29912
|
-
|
|
29913
|
-
return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
|
|
29914
|
-
|
|
29915
|
-
};
|
|
29916
|
-
|
|
29917
|
-
}
|
|
29918
|
-
|
|
29919
29453
|
} catch ( error ) {
|
|
29920
29454
|
|
|
29921
29455
|
console.error( 'THREE.WebGLRenderer: ' + error.message );
|
|
@@ -29935,22 +29469,21 @@ class WebGLRenderer {
|
|
|
29935
29469
|
function initGLContext() {
|
|
29936
29470
|
|
|
29937
29471
|
extensions = new WebGLExtensions( _gl );
|
|
29472
|
+
extensions.init();
|
|
29938
29473
|
|
|
29939
|
-
|
|
29940
|
-
|
|
29941
|
-
extensions.init( capabilities );
|
|
29474
|
+
utils = new WebGLUtils( _gl, extensions );
|
|
29942
29475
|
|
|
29943
|
-
|
|
29476
|
+
capabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );
|
|
29944
29477
|
|
|
29945
|
-
state = new WebGLState( _gl
|
|
29478
|
+
state = new WebGLState( _gl );
|
|
29946
29479
|
|
|
29947
29480
|
info = new WebGLInfo( _gl );
|
|
29948
29481
|
properties = new WebGLProperties();
|
|
29949
29482
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
29950
29483
|
cubemaps = new WebGLCubeMaps( _this );
|
|
29951
29484
|
cubeuvmaps = new WebGLCubeUVMaps( _this );
|
|
29952
|
-
attributes = new WebGLAttributes( _gl
|
|
29953
|
-
bindingStates = new WebGLBindingStates( _gl,
|
|
29485
|
+
attributes = new WebGLAttributes( _gl );
|
|
29486
|
+
bindingStates = new WebGLBindingStates( _gl, attributes );
|
|
29954
29487
|
geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
|
|
29955
29488
|
objects = new WebGLObjects( _gl, geometries, attributes, info );
|
|
29956
29489
|
morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
|
|
@@ -29958,14 +29491,14 @@ class WebGLRenderer {
|
|
|
29958
29491
|
programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
|
|
29959
29492
|
materials = new WebGLMaterials( _this, properties );
|
|
29960
29493
|
renderLists = new WebGLRenderLists();
|
|
29961
|
-
renderStates = new WebGLRenderStates( extensions
|
|
29494
|
+
renderStates = new WebGLRenderStates( extensions );
|
|
29962
29495
|
background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
|
|
29963
29496
|
multiview = new WebGLMultiview( _this, extensions, _gl );
|
|
29964
29497
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
29965
29498
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
29966
29499
|
|
|
29967
|
-
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info
|
|
29968
|
-
indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info
|
|
29500
|
+
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );
|
|
29501
|
+
indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );
|
|
29969
29502
|
|
|
29970
29503
|
info.programs = programCache.programs;
|
|
29971
29504
|
|
|
@@ -30297,13 +29830,6 @@ class WebGLRenderer {
|
|
|
30297
29830
|
xr.removeEventListener( 'sessionstart', onXRSessionStart );
|
|
30298
29831
|
xr.removeEventListener( 'sessionend', onXRSessionEnd );
|
|
30299
29832
|
|
|
30300
|
-
if ( _transmissionRenderTarget ) {
|
|
30301
|
-
|
|
30302
|
-
_transmissionRenderTarget.dispose();
|
|
30303
|
-
_transmissionRenderTarget = null;
|
|
30304
|
-
|
|
30305
|
-
}
|
|
30306
|
-
|
|
30307
29833
|
animation.stop();
|
|
30308
29834
|
|
|
30309
29835
|
};
|
|
@@ -30514,7 +30040,15 @@ class WebGLRenderer {
|
|
|
30514
30040
|
|
|
30515
30041
|
if ( object.isBatchedMesh ) {
|
|
30516
30042
|
|
|
30517
|
-
|
|
30043
|
+
if ( object._multiDrawInstances !== null ) {
|
|
30044
|
+
|
|
30045
|
+
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
30046
|
+
|
|
30047
|
+
} else {
|
|
30048
|
+
|
|
30049
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
30050
|
+
|
|
30051
|
+
}
|
|
30518
30052
|
|
|
30519
30053
|
} else if ( object.isInstancedMesh ) {
|
|
30520
30054
|
|
|
@@ -30564,7 +30098,7 @@ class WebGLRenderer {
|
|
|
30564
30098
|
if ( targetScene === null ) targetScene = scene;
|
|
30565
30099
|
|
|
30566
30100
|
currentRenderState = renderStates.get( targetScene );
|
|
30567
|
-
currentRenderState.init();
|
|
30101
|
+
currentRenderState.init( camera );
|
|
30568
30102
|
|
|
30569
30103
|
renderStateStack.push( currentRenderState );
|
|
30570
30104
|
|
|
@@ -30781,7 +30315,7 @@ class WebGLRenderer {
|
|
|
30781
30315
|
if ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );
|
|
30782
30316
|
|
|
30783
30317
|
currentRenderState = renderStates.get( scene, renderStateStack.length );
|
|
30784
|
-
currentRenderState.init();
|
|
30318
|
+
currentRenderState.init( camera );
|
|
30785
30319
|
|
|
30786
30320
|
renderStateStack.push( currentRenderState );
|
|
30787
30321
|
|
|
@@ -30806,6 +30340,13 @@ class WebGLRenderer {
|
|
|
30806
30340
|
|
|
30807
30341
|
}
|
|
30808
30342
|
|
|
30343
|
+
const renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
|
|
30344
|
+
if ( renderBackground ) {
|
|
30345
|
+
|
|
30346
|
+
background.addToRenderList( currentRenderList, scene );
|
|
30347
|
+
|
|
30348
|
+
}
|
|
30349
|
+
|
|
30809
30350
|
//
|
|
30810
30351
|
|
|
30811
30352
|
this.info.render.frame ++;
|
|
@@ -30822,20 +30363,30 @@ class WebGLRenderer {
|
|
|
30822
30363
|
|
|
30823
30364
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
30824
30365
|
|
|
30366
|
+
// render scene
|
|
30825
30367
|
|
|
30826
|
-
|
|
30368
|
+
const opaqueObjects = currentRenderList.opaque;
|
|
30369
|
+
const transmissiveObjects = currentRenderList.transmissive;
|
|
30827
30370
|
|
|
30828
|
-
|
|
30371
|
+
currentRenderState.setupLights( _this._useLegacyLights );
|
|
30829
30372
|
|
|
30830
|
-
|
|
30373
|
+
if ( camera.isArrayCamera ) {
|
|
30831
30374
|
|
|
30832
|
-
|
|
30375
|
+
const cameras = camera.cameras;
|
|
30833
30376
|
|
|
30834
|
-
|
|
30377
|
+
if ( transmissiveObjects.length > 0 ) {
|
|
30835
30378
|
|
|
30836
|
-
|
|
30379
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
30837
30380
|
|
|
30838
|
-
|
|
30381
|
+
const camera2 = cameras[ i ];
|
|
30382
|
+
|
|
30383
|
+
renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );
|
|
30384
|
+
|
|
30385
|
+
}
|
|
30386
|
+
|
|
30387
|
+
}
|
|
30388
|
+
|
|
30389
|
+
if ( renderBackground ) background.render( scene );
|
|
30839
30390
|
|
|
30840
30391
|
if ( xr.enabled && xr.isMultiview ) {
|
|
30841
30392
|
|
|
@@ -30845,8 +30396,6 @@ class WebGLRenderer {
|
|
|
30845
30396
|
|
|
30846
30397
|
} else {
|
|
30847
30398
|
|
|
30848
|
-
const cameras = camera.cameras;
|
|
30849
|
-
|
|
30850
30399
|
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
30851
30400
|
|
|
30852
30401
|
const camera2 = cameras[ i ];
|
|
@@ -30859,6 +30408,10 @@ class WebGLRenderer {
|
|
|
30859
30408
|
|
|
30860
30409
|
} else {
|
|
30861
30410
|
|
|
30411
|
+
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
30412
|
+
|
|
30413
|
+
if ( renderBackground ) background.render( scene );
|
|
30414
|
+
|
|
30862
30415
|
renderScene( currentRenderList, scene, camera );
|
|
30863
30416
|
|
|
30864
30417
|
}
|
|
@@ -30900,6 +30453,8 @@ class WebGLRenderer {
|
|
|
30900
30453
|
|
|
30901
30454
|
currentRenderState = renderStateStack[ renderStateStack.length - 1 ];
|
|
30902
30455
|
|
|
30456
|
+
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );
|
|
30457
|
+
|
|
30903
30458
|
} else {
|
|
30904
30459
|
|
|
30905
30460
|
currentRenderState = null;
|
|
@@ -31044,8 +30599,6 @@ class WebGLRenderer {
|
|
|
31044
30599
|
|
|
31045
30600
|
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );
|
|
31046
30601
|
|
|
31047
|
-
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
31048
|
-
|
|
31049
30602
|
if ( viewport ) state.viewport( _currentViewport.copy( viewport ) );
|
|
31050
30603
|
|
|
31051
30604
|
if ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );
|
|
@@ -31072,15 +30625,16 @@ class WebGLRenderer {
|
|
|
31072
30625
|
|
|
31073
30626
|
}
|
|
31074
30627
|
|
|
31075
|
-
|
|
30628
|
+
if ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {
|
|
31076
30629
|
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
|
|
30630
|
+
currentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {
|
|
31080
30631
|
generateMipmaps: true,
|
|
31081
|
-
type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
|
|
30632
|
+
type: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,
|
|
31082
30633
|
minFilter: LinearMipmapLinearFilter,
|
|
31083
|
-
samples:
|
|
30634
|
+
samples: 4,
|
|
30635
|
+
stencilBuffer: stencil,
|
|
30636
|
+
resolveDepthBuffer: false,
|
|
30637
|
+
resolveStencilBuffer: false
|
|
31084
30638
|
} );
|
|
31085
30639
|
|
|
31086
30640
|
// debug
|
|
@@ -31095,22 +30649,15 @@ class WebGLRenderer {
|
|
|
31095
30649
|
|
|
31096
30650
|
}
|
|
31097
30651
|
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
if ( isWebGL2 ) {
|
|
30652
|
+
const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];
|
|
31101
30653
|
|
|
31102
|
-
|
|
31103
|
-
|
|
31104
|
-
} else {
|
|
31105
|
-
|
|
31106
|
-
_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
|
|
31107
|
-
|
|
31108
|
-
}
|
|
30654
|
+
const activeViewport = camera.viewport || _currentViewport;
|
|
30655
|
+
transmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );
|
|
31109
30656
|
|
|
31110
30657
|
//
|
|
31111
30658
|
|
|
31112
30659
|
const currentRenderTarget = _this.getRenderTarget();
|
|
31113
|
-
_this.setRenderTarget(
|
|
30660
|
+
_this.setRenderTarget( transmissionRenderTarget );
|
|
31114
30661
|
|
|
31115
30662
|
_this.getClearColor( _currentClearColor );
|
|
31116
30663
|
_currentClearAlpha = _this.getClearAlpha();
|
|
@@ -31123,44 +30670,57 @@ class WebGLRenderer {
|
|
|
31123
30670
|
const currentToneMapping = _this.toneMapping;
|
|
31124
30671
|
_this.toneMapping = NoToneMapping;
|
|
31125
30672
|
|
|
30673
|
+
// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).
|
|
30674
|
+
// Transmission render pass requires viewport to match the transmissionRenderTarget.
|
|
30675
|
+
const currentCameraViewport = camera.viewport;
|
|
30676
|
+
if ( camera.viewport !== undefined ) camera.viewport = undefined;
|
|
30677
|
+
|
|
30678
|
+
currentRenderState.setupLightsView( camera );
|
|
30679
|
+
|
|
30680
|
+
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );
|
|
30681
|
+
|
|
31126
30682
|
renderObjects( opaqueObjects, scene, camera );
|
|
31127
30683
|
|
|
31128
|
-
textures.updateMultisampleRenderTarget(
|
|
31129
|
-
textures.updateRenderTargetMipmap(
|
|
30684
|
+
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
30685
|
+
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
31130
30686
|
|
|
31131
|
-
|
|
30687
|
+
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131
|
|
31132
30688
|
|
|
31133
|
-
|
|
30689
|
+
let renderTargetNeedsUpdate = false;
|
|
31134
30690
|
|
|
31135
|
-
|
|
30691
|
+
for ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {
|
|
31136
30692
|
|
|
31137
|
-
|
|
31138
|
-
const geometry = renderItem.geometry;
|
|
31139
|
-
const material = renderItem.material;
|
|
31140
|
-
const group = renderItem.group;
|
|
30693
|
+
const renderItem = transmissiveObjects[ i ];
|
|
31141
30694
|
|
|
31142
|
-
|
|
30695
|
+
const object = renderItem.object;
|
|
30696
|
+
const geometry = renderItem.geometry;
|
|
30697
|
+
const material = renderItem.material;
|
|
30698
|
+
const group = renderItem.group;
|
|
31143
30699
|
|
|
31144
|
-
|
|
30700
|
+
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
31145
30701
|
|
|
31146
|
-
|
|
31147
|
-
material.needsUpdate = true;
|
|
30702
|
+
const currentSide = material.side;
|
|
31148
30703
|
|
|
31149
|
-
|
|
30704
|
+
material.side = BackSide;
|
|
30705
|
+
material.needsUpdate = true;
|
|
31150
30706
|
|
|
31151
|
-
|
|
31152
|
-
material.needsUpdate = true;
|
|
30707
|
+
renderObject( object, scene, camera, geometry, material, group );
|
|
31153
30708
|
|
|
31154
|
-
|
|
30709
|
+
material.side = currentSide;
|
|
30710
|
+
material.needsUpdate = true;
|
|
30711
|
+
|
|
30712
|
+
renderTargetNeedsUpdate = true;
|
|
30713
|
+
|
|
30714
|
+
}
|
|
31155
30715
|
|
|
31156
30716
|
}
|
|
31157
30717
|
|
|
31158
|
-
|
|
30718
|
+
if ( renderTargetNeedsUpdate === true ) {
|
|
31159
30719
|
|
|
31160
|
-
|
|
30720
|
+
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
30721
|
+
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
31161
30722
|
|
|
31162
|
-
|
|
31163
|
-
textures.updateRenderTargetMipmap( _transmissionRenderTarget );
|
|
30723
|
+
}
|
|
31164
30724
|
|
|
31165
30725
|
}
|
|
31166
30726
|
|
|
@@ -31168,6 +30728,8 @@ class WebGLRenderer {
|
|
|
31168
30728
|
|
|
31169
30729
|
_this.setClearColor( _currentClearColor, _currentClearAlpha );
|
|
31170
30730
|
|
|
30731
|
+
if ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;
|
|
30732
|
+
|
|
31171
30733
|
_this.toneMapping = currentToneMapping;
|
|
31172
30734
|
|
|
31173
30735
|
}
|
|
@@ -31520,7 +31082,7 @@ class WebGLRenderer {
|
|
|
31520
31082
|
|
|
31521
31083
|
needsProgramChange = true;
|
|
31522
31084
|
|
|
31523
|
-
} else if (
|
|
31085
|
+
} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {
|
|
31524
31086
|
|
|
31525
31087
|
needsProgramChange = true;
|
|
31526
31088
|
|
|
@@ -31642,17 +31204,9 @@ class WebGLRenderer {
|
|
|
31642
31204
|
|
|
31643
31205
|
if ( skeleton ) {
|
|
31644
31206
|
|
|
31645
|
-
if (
|
|
31646
|
-
|
|
31647
|
-
if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
|
|
31207
|
+
if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
|
|
31648
31208
|
|
|
31649
|
-
|
|
31650
|
-
|
|
31651
|
-
} else {
|
|
31652
|
-
|
|
31653
|
-
console.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
|
|
31654
|
-
|
|
31655
|
-
}
|
|
31209
|
+
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
|
|
31656
31210
|
|
|
31657
31211
|
}
|
|
31658
31212
|
|
|
@@ -31667,7 +31221,7 @@ class WebGLRenderer {
|
|
|
31667
31221
|
|
|
31668
31222
|
const morphAttributes = geometry.morphAttributes;
|
|
31669
31223
|
|
|
31670
|
-
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined
|
|
31224
|
+
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {
|
|
31671
31225
|
|
|
31672
31226
|
morphtargets.update( object, geometry, program );
|
|
31673
31227
|
|
|
@@ -31690,6 +31244,12 @@ class WebGLRenderer {
|
|
|
31690
31244
|
|
|
31691
31245
|
}
|
|
31692
31246
|
|
|
31247
|
+
if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
|
|
31248
|
+
|
|
31249
|
+
m_uniforms.envMapIntensity.value = scene.environmentIntensity;
|
|
31250
|
+
|
|
31251
|
+
}
|
|
31252
|
+
|
|
31693
31253
|
if ( refreshMaterial ) {
|
|
31694
31254
|
|
|
31695
31255
|
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
|
@@ -31717,7 +31277,7 @@ class WebGLRenderer {
|
|
|
31717
31277
|
|
|
31718
31278
|
}
|
|
31719
31279
|
|
|
31720
|
-
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height,
|
|
31280
|
+
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );
|
|
31721
31281
|
|
|
31722
31282
|
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
31723
31283
|
|
|
@@ -31759,18 +31319,10 @@ class WebGLRenderer {
|
|
|
31759
31319
|
|
|
31760
31320
|
for ( let i = 0, l = groups.length; i < l; i ++ ) {
|
|
31761
31321
|
|
|
31762
|
-
|
|
31763
|
-
|
|
31764
|
-
const group = groups[ i ];
|
|
31765
|
-
|
|
31766
|
-
uniformsGroups.update( group, program );
|
|
31767
|
-
uniformsGroups.bind( group, program );
|
|
31768
|
-
|
|
31769
|
-
} else {
|
|
31770
|
-
|
|
31771
|
-
console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
|
|
31322
|
+
const group = groups[ i ];
|
|
31772
31323
|
|
|
31773
|
-
|
|
31324
|
+
uniformsGroups.update( group, program );
|
|
31325
|
+
uniformsGroups.bind( group, program );
|
|
31774
31326
|
|
|
31775
31327
|
}
|
|
31776
31328
|
|
|
@@ -31939,7 +31491,7 @@ class WebGLRenderer {
|
|
|
31939
31491
|
|
|
31940
31492
|
isCube = true;
|
|
31941
31493
|
|
|
31942
|
-
} else if ( (
|
|
31494
|
+
} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
31943
31495
|
|
|
31944
31496
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
31945
31497
|
|
|
@@ -31971,7 +31523,7 @@ class WebGLRenderer {
|
|
|
31971
31523
|
|
|
31972
31524
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
31973
31525
|
|
|
31974
|
-
if ( framebufferBound &&
|
|
31526
|
+
if ( framebufferBound && useDefaultFramebuffer ) {
|
|
31975
31527
|
|
|
31976
31528
|
state.drawBuffers( renderTarget, framebuffer );
|
|
31977
31529
|
|
|
@@ -32025,18 +31577,14 @@ class WebGLRenderer {
|
|
|
32025
31577
|
const textureFormat = texture.format;
|
|
32026
31578
|
const textureType = texture.type;
|
|
32027
31579
|
|
|
32028
|
-
if (
|
|
31580
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32029
31581
|
|
|
32030
31582
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
32031
31583
|
return;
|
|
32032
31584
|
|
|
32033
31585
|
}
|
|
32034
31586
|
|
|
32035
|
-
|
|
32036
|
-
|
|
32037
|
-
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
32038
|
-
! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
|
|
32039
|
-
! halfFloatSupportedByExt ) {
|
|
31587
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32040
31588
|
|
|
32041
31589
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
32042
31590
|
return;
|
|
@@ -32120,16 +31668,9 @@ class WebGLRenderer {
|
|
|
32120
31668
|
|
|
32121
31669
|
this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {
|
|
32122
31670
|
|
|
32123
|
-
|
|
32124
|
-
|
|
32125
|
-
|
|
32126
|
-
return;
|
|
32127
|
-
|
|
32128
|
-
}
|
|
32129
|
-
|
|
32130
|
-
const width = Math.round( sourceBox.max.x - sourceBox.min.x );
|
|
32131
|
-
const height = Math.round( sourceBox.max.y - sourceBox.min.y );
|
|
32132
|
-
const depth = sourceBox.max.z - sourceBox.min.z + 1;
|
|
31671
|
+
const width = sourceBox.max.x - sourceBox.min.x;
|
|
31672
|
+
const height = sourceBox.max.y - sourceBox.min.y;
|
|
31673
|
+
const depth = sourceBox.max.z - sourceBox.min.z;
|
|
32133
31674
|
const glFormat = utils.convert( dstTexture.format );
|
|
32134
31675
|
const glType = utils.convert( dstTexture.type );
|
|
32135
31676
|
let glTarget;
|
|
@@ -32281,10 +31822,6 @@ class WebGLRenderer {
|
|
|
32281
31822
|
|
|
32282
31823
|
}
|
|
32283
31824
|
|
|
32284
|
-
class WebGL1Renderer extends WebGLRenderer {}
|
|
32285
|
-
|
|
32286
|
-
WebGL1Renderer.prototype.isWebGL1Renderer = true;
|
|
32287
|
-
|
|
32288
31825
|
class FogExp2 {
|
|
32289
31826
|
|
|
32290
31827
|
constructor( color, density = 0.00025 ) {
|
|
@@ -32369,6 +31906,8 @@ class Scene extends Object3D {
|
|
|
32369
31906
|
this.backgroundBlurriness = 0;
|
|
32370
31907
|
this.backgroundIntensity = 1;
|
|
32371
31908
|
this.backgroundRotation = new Euler();
|
|
31909
|
+
|
|
31910
|
+
this.environmentIntensity = 1;
|
|
32372
31911
|
this.environmentRotation = new Euler();
|
|
32373
31912
|
|
|
32374
31913
|
this.overrideMaterial = null;
|
|
@@ -32392,6 +31931,8 @@ class Scene extends Object3D {
|
|
|
32392
31931
|
this.backgroundBlurriness = source.backgroundBlurriness;
|
|
32393
31932
|
this.backgroundIntensity = source.backgroundIntensity;
|
|
32394
31933
|
this.backgroundRotation.copy( source.backgroundRotation );
|
|
31934
|
+
|
|
31935
|
+
this.environmentIntensity = source.environmentIntensity;
|
|
32395
31936
|
this.environmentRotation.copy( source.environmentRotation );
|
|
32396
31937
|
|
|
32397
31938
|
if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
|
|
@@ -32407,10 +31948,12 @@ class Scene extends Object3D {
|
|
|
32407
31948
|
const data = super.toJSON( meta );
|
|
32408
31949
|
|
|
32409
31950
|
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
|
|
31951
|
+
|
|
32410
31952
|
if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
|
|
32411
31953
|
if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
|
|
32412
|
-
|
|
32413
31954
|
data.object.backgroundRotation = this.backgroundRotation.toArray();
|
|
31955
|
+
|
|
31956
|
+
if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
|
|
32414
31957
|
data.object.environmentRotation = this.environmentRotation.toArray();
|
|
32415
31958
|
|
|
32416
31959
|
return data;
|
|
@@ -34039,6 +33582,7 @@ class InstancedMesh extends Mesh {
|
|
|
34039
33582
|
|
|
34040
33583
|
this.instanceMatrix.copy( source.instanceMatrix );
|
|
34041
33584
|
|
|
33585
|
+
if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
|
|
34042
33586
|
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
|
|
34043
33587
|
|
|
34044
33588
|
this.count = source.count;
|
|
@@ -34190,6 +33734,15 @@ class InstancedMesh extends Mesh {
|
|
|
34190
33734
|
|
|
34191
33735
|
this.dispatchEvent( { type: 'dispose' } );
|
|
34192
33736
|
|
|
33737
|
+
if ( this.morphTexture !== null ) {
|
|
33738
|
+
|
|
33739
|
+
this.morphTexture.dispose();
|
|
33740
|
+
this.morphTexture = null;
|
|
33741
|
+
|
|
33742
|
+
}
|
|
33743
|
+
|
|
33744
|
+
return this;
|
|
33745
|
+
|
|
34193
33746
|
}
|
|
34194
33747
|
|
|
34195
33748
|
}
|
|
@@ -34336,6 +33889,7 @@ class BatchedMesh extends Mesh {
|
|
|
34336
33889
|
this._multiDrawCounts = new Int32Array( maxGeometryCount );
|
|
34337
33890
|
this._multiDrawStarts = new Int32Array( maxGeometryCount );
|
|
34338
33891
|
this._multiDrawCount = 0;
|
|
33892
|
+
this._multiDrawInstances = null;
|
|
34339
33893
|
this._visibilityChanged = true;
|
|
34340
33894
|
|
|
34341
33895
|
// Local matrix per geometry by using data texture
|
|
@@ -34379,8 +33933,7 @@ class BatchedMesh extends Mesh {
|
|
|
34379
33933
|
const { array, itemSize, normalized } = srcAttribute;
|
|
34380
33934
|
|
|
34381
33935
|
const dstArray = new array.constructor( maxVertexCount * itemSize );
|
|
34382
|
-
const dstAttribute = new
|
|
34383
|
-
dstAttribute.setUsage( srcAttribute.usage );
|
|
33936
|
+
const dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );
|
|
34384
33937
|
|
|
34385
33938
|
geometry.setAttribute( attributeName, dstAttribute );
|
|
34386
33939
|
|
|
@@ -34407,7 +33960,7 @@ class BatchedMesh extends Mesh {
|
|
|
34407
33960
|
|
|
34408
33961
|
}
|
|
34409
33962
|
|
|
34410
|
-
// Make sure the geometry is compatible with the existing combined geometry
|
|
33963
|
+
// Make sure the geometry is compatible with the existing combined geometry attributes
|
|
34411
33964
|
_validateGeometry( geometry ) {
|
|
34412
33965
|
|
|
34413
33966
|
// check that the geometry doesn't have a version of our reserved id attribute
|
|
@@ -34698,6 +34251,7 @@ class BatchedMesh extends Mesh {
|
|
|
34698
34251
|
}
|
|
34699
34252
|
|
|
34700
34253
|
dstAttribute.needsUpdate = true;
|
|
34254
|
+
dstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );
|
|
34701
34255
|
|
|
34702
34256
|
}
|
|
34703
34257
|
|
|
@@ -34721,6 +34275,7 @@ class BatchedMesh extends Mesh {
|
|
|
34721
34275
|
}
|
|
34722
34276
|
|
|
34723
34277
|
dstIndex.needsUpdate = true;
|
|
34278
|
+
dstIndex.addUpdateRange( indexStart, reservedRange.indexCount );
|
|
34724
34279
|
|
|
34725
34280
|
}
|
|
34726
34281
|
|
|
@@ -34776,6 +34331,28 @@ class BatchedMesh extends Mesh {
|
|
|
34776
34331
|
|
|
34777
34332
|
}
|
|
34778
34333
|
|
|
34334
|
+
getInstanceCountAt( id ) {
|
|
34335
|
+
|
|
34336
|
+
if ( this._multiDrawInstances === null ) return null;
|
|
34337
|
+
|
|
34338
|
+
return this._multiDrawInstances[ id ];
|
|
34339
|
+
|
|
34340
|
+
}
|
|
34341
|
+
|
|
34342
|
+
setInstanceCountAt( id, instanceCount ) {
|
|
34343
|
+
|
|
34344
|
+
if ( this._multiDrawInstances === null ) {
|
|
34345
|
+
|
|
34346
|
+
this._multiDrawInstances = new Int32Array( this._maxGeometryCount ).fill( 1 );
|
|
34347
|
+
|
|
34348
|
+
}
|
|
34349
|
+
|
|
34350
|
+
this._multiDrawInstances[ id ] = instanceCount;
|
|
34351
|
+
|
|
34352
|
+
return id;
|
|
34353
|
+
|
|
34354
|
+
}
|
|
34355
|
+
|
|
34779
34356
|
// get bounding box and compute it if it doesn't exist
|
|
34780
34357
|
getBoundingBoxAt( id, target ) {
|
|
34781
34358
|
|
|
@@ -35245,12 +34822,16 @@ class LineBasicMaterial extends Material {
|
|
|
35245
34822
|
|
|
35246
34823
|
}
|
|
35247
34824
|
|
|
35248
|
-
const
|
|
35249
|
-
const
|
|
34825
|
+
const _vStart = /*@__PURE__*/ new Vector3();
|
|
34826
|
+
const _vEnd = /*@__PURE__*/ new Vector3();
|
|
34827
|
+
|
|
35250
34828
|
const _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
35251
34829
|
const _ray$1 = /*@__PURE__*/ new Ray();
|
|
35252
34830
|
const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
35253
34831
|
|
|
34832
|
+
const _intersectPointOnRay = /*@__PURE__*/ new Vector3();
|
|
34833
|
+
const _intersectPointOnSegment = /*@__PURE__*/ new Vector3();
|
|
34834
|
+
|
|
35254
34835
|
class Line extends Object3D {
|
|
35255
34836
|
|
|
35256
34837
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
@@ -35292,11 +34873,11 @@ class Line extends Object3D {
|
|
|
35292
34873
|
|
|
35293
34874
|
for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {
|
|
35294
34875
|
|
|
35295
|
-
|
|
35296
|
-
|
|
34876
|
+
_vStart.fromBufferAttribute( positionAttribute, i - 1 );
|
|
34877
|
+
_vEnd.fromBufferAttribute( positionAttribute, i );
|
|
35297
34878
|
|
|
35298
34879
|
lineDistances[ i ] = lineDistances[ i - 1 ];
|
|
35299
|
-
lineDistances[ i ] +=
|
|
34880
|
+
lineDistances[ i ] += _vStart.distanceTo( _vEnd );
|
|
35300
34881
|
|
|
35301
34882
|
}
|
|
35302
34883
|
|
|
@@ -35337,10 +34918,6 @@ class Line extends Object3D {
|
|
|
35337
34918
|
const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
|
|
35338
34919
|
const localThresholdSq = localThreshold * localThreshold;
|
|
35339
34920
|
|
|
35340
|
-
const vStart = new Vector3();
|
|
35341
|
-
const vEnd = new Vector3();
|
|
35342
|
-
const interSegment = new Vector3();
|
|
35343
|
-
const interRay = new Vector3();
|
|
35344
34921
|
const step = this.isLineSegments ? 2 : 1;
|
|
35345
34922
|
|
|
35346
34923
|
const index = geometry.index;
|
|
@@ -35357,31 +34934,28 @@ class Line extends Object3D {
|
|
|
35357
34934
|
const a = index.getX( i );
|
|
35358
34935
|
const b = index.getX( i + 1 );
|
|
35359
34936
|
|
|
35360
|
-
|
|
35361
|
-
vEnd.fromBufferAttribute( positionAttribute, b );
|
|
34937
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
35362
34938
|
|
|
35363
|
-
|
|
34939
|
+
if ( intersect ) {
|
|
35364
34940
|
|
|
35365
|
-
|
|
34941
|
+
intersects.push( intersect );
|
|
35366
34942
|
|
|
35367
|
-
|
|
34943
|
+
}
|
|
35368
34944
|
|
|
35369
|
-
|
|
34945
|
+
}
|
|
35370
34946
|
|
|
35371
|
-
|
|
34947
|
+
if ( this.isLineLoop ) {
|
|
35372
34948
|
|
|
35373
|
-
|
|
34949
|
+
const a = index.getX( end - 1 );
|
|
34950
|
+
const b = index.getX( start );
|
|
35374
34951
|
|
|
35375
|
-
|
|
35376
|
-
// What do we want? intersection point on the ray or on the segment??
|
|
35377
|
-
// point: raycaster.ray.at( distance ),
|
|
35378
|
-
point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
35379
|
-
index: i,
|
|
35380
|
-
face: null,
|
|
35381
|
-
faceIndex: null,
|
|
35382
|
-
object: this
|
|
34952
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
35383
34953
|
|
|
35384
|
-
|
|
34954
|
+
if ( intersect ) {
|
|
34955
|
+
|
|
34956
|
+
intersects.push( intersect );
|
|
34957
|
+
|
|
34958
|
+
}
|
|
35385
34959
|
|
|
35386
34960
|
}
|
|
35387
34961
|
|
|
@@ -35392,31 +34966,25 @@ class Line extends Object3D {
|
|
|
35392
34966
|
|
|
35393
34967
|
for ( let i = start, l = end - 1; i < l; i += step ) {
|
|
35394
34968
|
|
|
35395
|
-
|
|
35396
|
-
|
|
34969
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );
|
|
34970
|
+
|
|
34971
|
+
if ( intersect ) {
|
|
35397
34972
|
|
|
35398
|
-
|
|
34973
|
+
intersects.push( intersect );
|
|
35399
34974
|
|
|
35400
|
-
|
|
34975
|
+
}
|
|
35401
34976
|
|
|
35402
|
-
|
|
34977
|
+
}
|
|
35403
34978
|
|
|
35404
|
-
|
|
34979
|
+
if ( this.isLineLoop ) {
|
|
35405
34980
|
|
|
35406
|
-
|
|
34981
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );
|
|
35407
34982
|
|
|
35408
|
-
|
|
34983
|
+
if ( intersect ) {
|
|
35409
34984
|
|
|
35410
|
-
|
|
35411
|
-
// What do we want? intersection point on the ray or on the segment??
|
|
35412
|
-
// point: raycaster.ray.at( distance ),
|
|
35413
|
-
point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
35414
|
-
index: i,
|
|
35415
|
-
face: null,
|
|
35416
|
-
faceIndex: null,
|
|
35417
|
-
object: this
|
|
34985
|
+
intersects.push( intersect );
|
|
35418
34986
|
|
|
35419
|
-
}
|
|
34987
|
+
}
|
|
35420
34988
|
|
|
35421
34989
|
}
|
|
35422
34990
|
|
|
@@ -35457,6 +35025,38 @@ class Line extends Object3D {
|
|
|
35457
35025
|
|
|
35458
35026
|
}
|
|
35459
35027
|
|
|
35028
|
+
function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
35029
|
+
|
|
35030
|
+
const positionAttribute = object.geometry.attributes.position;
|
|
35031
|
+
|
|
35032
|
+
_vStart.fromBufferAttribute( positionAttribute, a );
|
|
35033
|
+
_vEnd.fromBufferAttribute( positionAttribute, b );
|
|
35034
|
+
|
|
35035
|
+
const distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );
|
|
35036
|
+
|
|
35037
|
+
if ( distSq > thresholdSq ) return;
|
|
35038
|
+
|
|
35039
|
+
_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation
|
|
35040
|
+
|
|
35041
|
+
const distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );
|
|
35042
|
+
|
|
35043
|
+
if ( distance < raycaster.near || distance > raycaster.far ) return;
|
|
35044
|
+
|
|
35045
|
+
return {
|
|
35046
|
+
|
|
35047
|
+
distance: distance,
|
|
35048
|
+
// What do we want? intersection point on the ray or on the segment??
|
|
35049
|
+
// point: raycaster.ray.at( distance ),
|
|
35050
|
+
point: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),
|
|
35051
|
+
index: a,
|
|
35052
|
+
face: null,
|
|
35053
|
+
faceIndex: null,
|
|
35054
|
+
object: object
|
|
35055
|
+
|
|
35056
|
+
};
|
|
35057
|
+
|
|
35058
|
+
}
|
|
35059
|
+
|
|
35460
35060
|
const _start = /*@__PURE__*/ new Vector3();
|
|
35461
35061
|
const _end = /*@__PURE__*/ new Vector3();
|
|
35462
35062
|
|
|
@@ -42094,6 +41694,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
42094
41694
|
|
|
42095
41695
|
this._anisotropy = 0;
|
|
42096
41696
|
this._clearcoat = 0;
|
|
41697
|
+
this._dispersion = 0;
|
|
42097
41698
|
this._iridescence = 0;
|
|
42098
41699
|
this._sheen = 0.0;
|
|
42099
41700
|
this._transmission = 0;
|
|
@@ -42156,6 +41757,24 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
42156
41757
|
|
|
42157
41758
|
}
|
|
42158
41759
|
|
|
41760
|
+
get dispersion() {
|
|
41761
|
+
|
|
41762
|
+
return this._dispersion;
|
|
41763
|
+
|
|
41764
|
+
}
|
|
41765
|
+
|
|
41766
|
+
set dispersion( value ) {
|
|
41767
|
+
|
|
41768
|
+
if ( this._dispersion > 0 !== value > 0 ) {
|
|
41769
|
+
|
|
41770
|
+
this.version ++;
|
|
41771
|
+
|
|
41772
|
+
}
|
|
41773
|
+
|
|
41774
|
+
this._dispersion = value;
|
|
41775
|
+
|
|
41776
|
+
}
|
|
41777
|
+
|
|
42159
41778
|
get sheen() {
|
|
42160
41779
|
|
|
42161
41780
|
return this._sheen;
|
|
@@ -42214,6 +41833,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
42214
41833
|
this.clearcoatNormalMap = source.clearcoatNormalMap;
|
|
42215
41834
|
this.clearcoatNormalScale.copy( source.clearcoatNormalScale );
|
|
42216
41835
|
|
|
41836
|
+
this.dispersion = source.dispersion;
|
|
42217
41837
|
this.ior = source.ior;
|
|
42218
41838
|
|
|
42219
41839
|
this.iridescence = source.iridescence;
|
|
@@ -44067,7 +43687,7 @@ VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
|
|
|
44067
43687
|
|
|
44068
43688
|
class AnimationClip {
|
|
44069
43689
|
|
|
44070
|
-
constructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {
|
|
43690
|
+
constructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {
|
|
44071
43691
|
|
|
44072
43692
|
this.name = name;
|
|
44073
43693
|
this.tracks = tracks;
|
|
@@ -44887,7 +44507,7 @@ class FileLoader extends Loader {
|
|
|
44887
44507
|
|
|
44888
44508
|
// Nginx needs X-File-Size check
|
|
44889
44509
|
// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
|
|
44890
|
-
const contentLength = response.headers.get( '
|
|
44510
|
+
const contentLength = response.headers.get( 'X-File-Size' ) || response.headers.get( 'Content-Length' );
|
|
44891
44511
|
const total = contentLength ? parseInt( contentLength ) : 0;
|
|
44892
44512
|
const lengthComputable = total !== 0;
|
|
44893
44513
|
let loaded = 0;
|
|
@@ -46488,6 +46108,7 @@ class MaterialLoader extends Loader {
|
|
|
46488
46108
|
if ( json.shininess !== undefined ) material.shininess = json.shininess;
|
|
46489
46109
|
if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
|
|
46490
46110
|
if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
|
|
46111
|
+
if ( json.dispersion !== undefined ) material.dispersion = json.dispersion;
|
|
46491
46112
|
if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
|
|
46492
46113
|
if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
|
|
46493
46114
|
if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
|
|
@@ -47820,6 +47441,8 @@ class ObjectLoader extends Loader {
|
|
|
47820
47441
|
if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
|
|
47821
47442
|
if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
|
|
47822
47443
|
if ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );
|
|
47444
|
+
|
|
47445
|
+
if ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;
|
|
47823
47446
|
if ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );
|
|
47824
47447
|
|
|
47825
47448
|
break;
|
|
@@ -52451,11 +52074,9 @@ function intersect( object, raycaster, intersects, recursive ) {
|
|
|
52451
52074
|
/**
|
|
52452
52075
|
* Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
|
|
52453
52076
|
*
|
|
52454
|
-
*
|
|
52455
|
-
*
|
|
52077
|
+
* phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.
|
|
52078
|
+
* theta (the azimuthal angle) is measured from the positive z-axis.
|
|
52456
52079
|
*/
|
|
52457
|
-
|
|
52458
|
-
|
|
52459
52080
|
class Spherical {
|
|
52460
52081
|
|
|
52461
52082
|
constructor( radius = 1, phi = 0, theta = 0 ) {
|
|
@@ -54765,6 +54386,7 @@ exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
|
|
|
54765
54386
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
54766
54387
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
54767
54388
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
54389
|
+
exports.RGBFormat = RGBFormat;
|
|
54768
54390
|
exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
|
|
54769
54391
|
exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
|
|
54770
54392
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
@@ -54850,6 +54472,7 @@ exports.UniformsLib = UniformsLib;
|
|
|
54850
54472
|
exports.UniformsUtils = UniformsUtils;
|
|
54851
54473
|
exports.UnsignedByteType = UnsignedByteType;
|
|
54852
54474
|
exports.UnsignedInt248Type = UnsignedInt248Type;
|
|
54475
|
+
exports.UnsignedInt5999Type = UnsignedInt5999Type;
|
|
54853
54476
|
exports.UnsignedIntType = UnsignedIntType;
|
|
54854
54477
|
exports.UnsignedShort4444Type = UnsignedShort4444Type;
|
|
54855
54478
|
exports.UnsignedShort5551Type = UnsignedShort5551Type;
|
|
@@ -54860,7 +54483,6 @@ exports.Vector3 = Vector3;
|
|
|
54860
54483
|
exports.Vector4 = Vector4;
|
|
54861
54484
|
exports.VectorKeyframeTrack = VectorKeyframeTrack;
|
|
54862
54485
|
exports.VideoTexture = VideoTexture;
|
|
54863
|
-
exports.WebGL1Renderer = WebGL1Renderer;
|
|
54864
54486
|
exports.WebGL3DRenderTarget = WebGL3DRenderTarget;
|
|
54865
54487
|
exports.WebGLArrayRenderTarget = WebGLArrayRenderTarget;
|
|
54866
54488
|
exports.WebGLCoordinateSystem = WebGLCoordinateSystem;
|
|
@@ -54876,5 +54498,4 @@ exports.ZeroCurvatureEnding = ZeroCurvatureEnding;
|
|
|
54876
54498
|
exports.ZeroFactor = ZeroFactor;
|
|
54877
54499
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
54878
54500
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
54879
|
-
exports._SRGBAFormat = _SRGBAFormat;
|
|
54880
54501
|
exports.createCanvasElement = createCanvasElement;
|