@plastic-software/three 0.181.3 → 0.182.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/README.md +3 -4
- package/build/three.cjs +1192 -522
- package/build/three.core.js +345 -219
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +864 -328
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +15 -3
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3660 -1545
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3659 -1544
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/controls/MapControls.js +55 -1
- package/examples/jsm/controls/OrbitControls.js +6 -6
- package/examples/jsm/controls/TrackballControls.js +6 -6
- package/examples/jsm/csm/CSM.js +2 -1
- package/examples/jsm/environments/RoomEnvironment.js +2 -0
- package/examples/jsm/geometries/DecalGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
- package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
- package/examples/jsm/inspector/Inspector.js +53 -9
- package/examples/jsm/inspector/RendererInspector.js +12 -2
- package/examples/jsm/inspector/tabs/Console.js +2 -2
- package/examples/jsm/inspector/tabs/Parameters.js +2 -2
- package/examples/jsm/inspector/tabs/Performance.js +2 -2
- package/examples/jsm/inspector/tabs/Viewer.js +4 -4
- package/examples/jsm/inspector/ui/Profiler.js +1836 -31
- package/examples/jsm/inspector/ui/Style.js +948 -13
- package/examples/jsm/inspector/ui/Tab.js +188 -1
- package/examples/jsm/inspector/ui/Values.js +17 -1
- package/examples/jsm/loaders/3DMLoader.js +5 -4
- package/examples/jsm/loaders/DRACOLoader.js +5 -5
- package/examples/jsm/loaders/FBXLoader.js +0 -2
- package/examples/jsm/loaders/HDRLoader.js +0 -1
- package/examples/jsm/loaders/KTX2Loader.js +16 -0
- package/examples/jsm/loaders/LDrawLoader.js +2 -3
- package/examples/jsm/loaders/PCDLoader.js +1 -0
- package/examples/jsm/loaders/SVGLoader.js +1 -1
- package/examples/jsm/loaders/TDSLoader.js +0 -2
- package/examples/jsm/loaders/TGALoader.js +0 -2
- package/examples/jsm/loaders/UltraHDRLoader.js +110 -137
- package/examples/jsm/loaders/VOXLoader.js +660 -117
- package/examples/jsm/loaders/VRMLLoader.js +2 -2
- package/examples/jsm/loaders/usd/USDCParser.js +1 -1
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -1
- package/examples/jsm/materials/WoodNodeMaterial.js +11 -11
- package/examples/jsm/math/Octree.js +131 -1
- package/examples/jsm/misc/Volume.js +0 -1
- package/examples/jsm/misc/VolumeSlice.js +0 -1
- package/examples/jsm/objects/SkyMesh.js +13 -3
- package/examples/jsm/physics/AmmoPhysics.js +12 -7
- package/examples/jsm/physics/JoltPhysics.js +3 -1
- package/examples/jsm/physics/RapierPhysics.js +3 -1
- package/examples/jsm/postprocessing/OutputPass.js +9 -0
- package/examples/jsm/postprocessing/RenderPass.js +10 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +48 -18
- package/examples/jsm/renderers/Projector.js +268 -30
- package/examples/jsm/renderers/SVGRenderer.js +191 -58
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -4
- package/examples/jsm/transpiler/AST.js +44 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +61 -4
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
- package/examples/jsm/transpiler/TSLEncoder.js +46 -3
- package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
- package/examples/jsm/transpiler/WGSLEncoder.js +27 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -0
- package/examples/jsm/tsl/display/BloomNode.js +11 -1
- package/examples/jsm/tsl/display/GTAONode.js +3 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +2 -1
- package/examples/jsm/tsl/display/SSGINode.js +7 -19
- package/examples/jsm/tsl/display/SSRNode.js +1 -1
- package/examples/jsm/tsl/display/SSSNode.js +4 -2
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
- package/examples/jsm/tsl/display/TRAANode.js +265 -114
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/utils/ShadowMapViewer.js +24 -10
- package/examples/jsm/utils/ShadowMapViewerGPU.js +1 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
- package/package.json +14 -12
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +14 -2
- package/src/animation/AnimationUtils.js +1 -12
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
- package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
- package/src/constants.js +61 -5
- package/src/core/BufferGeometry.js +14 -2
- package/src/core/Raycaster.js +2 -2
- package/src/extras/PMREMGenerator.js +3 -10
- package/src/extras/TextureUtils.js +5 -1
- package/src/geometries/ExtrudeGeometry.js +2 -2
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/helpers/PointLightHelper.js +1 -1
- package/src/lights/DirectionalLight.js +13 -0
- package/src/lights/HemisphereLight.js +10 -0
- package/src/lights/Light.js +1 -11
- package/src/lights/LightProbe.js +0 -15
- package/src/lights/LightShadow.js +0 -3
- package/src/lights/PointLight.js +15 -0
- package/src/lights/PointLightShadow.js +0 -86
- package/src/lights/SpotLight.js +22 -1
- package/src/loaders/MaterialLoader.js +2 -1
- package/src/loaders/ObjectLoader.js +3 -1
- package/src/loaders/nodes/NodeLoader.js +2 -2
- package/src/materials/Material.js +2 -0
- package/src/materials/ShaderMaterial.js +20 -1
- package/src/materials/nodes/Line2NodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +3 -2
- package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
- package/src/materials/nodes/NodeMaterial.js +59 -3
- package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
- package/src/math/Matrix4.js +40 -40
- package/src/math/Sphere.js +1 -1
- package/src/math/Vector3.js +0 -2
- package/src/nodes/TSL.js +4 -1
- package/src/nodes/accessors/BatchNode.js +10 -10
- package/src/nodes/accessors/BufferAttributeNode.js +98 -12
- package/src/nodes/accessors/BufferNode.js +29 -2
- package/src/nodes/accessors/ClippingNode.js +4 -4
- package/src/nodes/accessors/CubeTextureNode.js +20 -1
- package/src/nodes/accessors/InstanceNode.js +69 -29
- package/src/nodes/accessors/MaterialNode.js +9 -1
- package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +2 -2
- package/src/nodes/accessors/ReferenceBaseNode.js +4 -4
- package/src/nodes/accessors/ReferenceNode.js +4 -4
- package/src/nodes/accessors/RendererReferenceNode.js +1 -2
- package/src/nodes/accessors/SkinningNode.js +15 -2
- package/src/nodes/accessors/StorageBufferNode.js +4 -2
- package/src/nodes/accessors/Tangent.js +1 -11
- package/src/nodes/accessors/Texture3DNode.js +26 -1
- package/src/nodes/accessors/UniformArrayNode.js +2 -2
- package/src/nodes/accessors/UserDataNode.js +1 -2
- package/src/nodes/accessors/VertexColorNode.js +1 -2
- package/src/nodes/code/FunctionNode.js +1 -2
- package/src/nodes/core/ArrayNode.js +20 -1
- package/src/nodes/core/AssignNode.js +2 -2
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/ContextNode.js +103 -4
- package/src/nodes/core/NodeBuilder.js +56 -14
- package/src/nodes/core/NodeFrame.js +12 -4
- package/src/nodes/core/NodeUtils.js +5 -5
- package/src/nodes/core/ParameterNode.js +1 -2
- package/src/nodes/core/PropertyNode.js +19 -3
- package/src/nodes/core/StackNode.js +56 -8
- package/src/nodes/core/StructNode.js +1 -2
- package/src/nodes/core/StructTypeNode.js +11 -17
- package/src/nodes/core/UniformNode.js +19 -4
- package/src/nodes/core/VarNode.js +46 -21
- package/src/nodes/display/NormalMapNode.js +37 -2
- package/src/nodes/display/PassNode.js +77 -7
- package/src/nodes/display/ScreenNode.js +1 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +3 -3
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
- package/src/nodes/functions/PhysicalLightingModel.js +102 -43
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -2
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -3
- package/src/nodes/lighting/AnalyticLightNode.js +53 -0
- package/src/nodes/lighting/LightsNode.js +2 -2
- package/src/nodes/lighting/PointShadowNode.js +141 -140
- package/src/nodes/lighting/ShadowFilterNode.js +53 -37
- package/src/nodes/lighting/ShadowNode.js +53 -19
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/pmrem/PMREMNode.js +1 -1
- package/src/nodes/tsl/TSLCore.js +4 -4
- package/src/nodes/utils/ArrayElementNode.js +13 -0
- package/src/nodes/utils/EventNode.js +1 -2
- package/src/nodes/utils/Packing.js +13 -1
- package/src/nodes/utils/PostProcessingUtils.js +33 -1
- package/src/nodes/utils/ReflectorNode.js +1 -1
- package/src/nodes/utils/SampleNode.js +1 -1
- package/src/nodes/utils/UVUtils.js +26 -0
- package/src/objects/BatchedMesh.js +5 -2
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Skeleton.js +9 -0
- package/src/renderers/WebGLRenderer.js +145 -33
- package/src/renderers/common/Backend.js +8 -0
- package/src/renderers/common/Background.js +19 -9
- package/src/renderers/common/Binding.js +11 -0
- package/src/renderers/common/Bindings.js +7 -7
- package/src/renderers/common/Buffer.js +40 -0
- package/src/renderers/common/ChainMap.js +30 -6
- package/src/renderers/common/Geometries.js +12 -0
- package/src/renderers/common/RenderContexts.js +8 -1
- package/src/renderers/common/RenderObject.js +14 -1
- package/src/renderers/common/Renderer.js +53 -35
- package/src/renderers/common/Textures.js +1 -1
- package/src/renderers/common/UniformsGroup.js +1 -0
- package/src/renderers/common/XRManager.js +1 -0
- package/src/renderers/common/extras/PMREMGenerator.js +2 -8
- package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
- package/src/renderers/shaders/DFGLUTData.js +19 -34
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +90 -51
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +194 -186
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +3 -3
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +3 -3
- package/src/renderers/webgl/WebGLCapabilities.js +3 -4
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLOutput.js +267 -0
- package/src/renderers/webgl/WebGLProgram.js +43 -107
- package/src/renderers/webgl/WebGLPrograms.js +35 -45
- package/src/renderers/webgl/WebGLShadowMap.js +188 -25
- package/src/renderers/webgl/WebGLState.js +20 -20
- package/src/renderers/webgl/WebGLTextures.js +89 -28
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUtils.js +6 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +79 -13
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +59 -7
- package/src/renderers/webgl-fallback/utils/WebGLState.js +18 -3
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +5 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -9
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +6 -2
- package/src/renderers/webgpu/WebGPUBackend.js +61 -4
- package/src/renderers/webgpu/WebGPURenderer.js +1 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +65 -23
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -17
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +354 -186
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +20 -7
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -17
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +7 -7
- package/src/renderers/webgpu/utils/WebGPUUtils.js +7 -5
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/Source.js +1 -1
- package/src/textures/Texture.js +1 -1
- package/src/utils.js +13 -1
- package/src/nodes/functions/BSDF/DFGApprox.js +0 -71
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '182';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -917,6 +917,38 @@ const RGB_ETC2_Format = 37492;
|
|
|
917
917
|
*/
|
|
918
918
|
const RGBA_ETC2_EAC_Format = 37496;
|
|
919
919
|
|
|
920
|
+
/**
|
|
921
|
+
* EAC R11 UNORM format.
|
|
922
|
+
*
|
|
923
|
+
* @type {number}
|
|
924
|
+
* @constant
|
|
925
|
+
*/
|
|
926
|
+
const R11_EAC_Format = 37488; // 0x9270
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* EAC R11 SNORM format.
|
|
930
|
+
*
|
|
931
|
+
* @type {number}
|
|
932
|
+
* @constant
|
|
933
|
+
*/
|
|
934
|
+
const SIGNED_R11_EAC_Format = 37489; // 0x9271
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* EAC RG11 UNORM format.
|
|
938
|
+
*
|
|
939
|
+
* @type {number}
|
|
940
|
+
* @constant
|
|
941
|
+
*/
|
|
942
|
+
const RG11_EAC_Format = 37490; // 0x9272
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* EAC RG11 SNORM format.
|
|
946
|
+
*
|
|
947
|
+
* @type {number}
|
|
948
|
+
* @constant
|
|
949
|
+
*/
|
|
950
|
+
const SIGNED_RG11_EAC_Format = 37491; // 0x9273
|
|
951
|
+
|
|
920
952
|
/**
|
|
921
953
|
* ASTC RGBA 4x4 format.
|
|
922
954
|
*
|
|
@@ -1201,7 +1233,7 @@ const TriangleStripDrawMode = 1;
|
|
|
1201
1233
|
const TriangleFanDrawMode = 2;
|
|
1202
1234
|
|
|
1203
1235
|
/**
|
|
1204
|
-
*
|
|
1236
|
+
* The depth value is inverted (1.0 - z) for visualization purposes.
|
|
1205
1237
|
*
|
|
1206
1238
|
* @type {number}
|
|
1207
1239
|
* @constant
|
|
@@ -1209,7 +1241,7 @@ const TriangleFanDrawMode = 2;
|
|
|
1209
1241
|
const BasicDepthPacking = 3200;
|
|
1210
1242
|
|
|
1211
1243
|
/**
|
|
1212
|
-
*
|
|
1244
|
+
* The depth value is packed into 32 bit RGBA.
|
|
1213
1245
|
*
|
|
1214
1246
|
* @type {number}
|
|
1215
1247
|
* @constant
|
|
@@ -1217,7 +1249,7 @@ const BasicDepthPacking = 3200;
|
|
|
1217
1249
|
const RGBADepthPacking = 3201;
|
|
1218
1250
|
|
|
1219
1251
|
/**
|
|
1220
|
-
*
|
|
1252
|
+
* The depth value is packed into 24 bit RGB.
|
|
1221
1253
|
*
|
|
1222
1254
|
* @type {number}
|
|
1223
1255
|
* @constant
|
|
@@ -1225,7 +1257,7 @@ const RGBADepthPacking = 3201;
|
|
|
1225
1257
|
const RGBDepthPacking = 3202;
|
|
1226
1258
|
|
|
1227
1259
|
/**
|
|
1228
|
-
*
|
|
1260
|
+
* The depth value is packed into 16 bit RG.
|
|
1229
1261
|
*
|
|
1230
1262
|
* @type {number}
|
|
1231
1263
|
* @constant
|
|
@@ -1290,6 +1322,30 @@ const LinearTransfer = 'linear';
|
|
|
1290
1322
|
*/
|
|
1291
1323
|
const SRGBTransfer = 'srgb';
|
|
1292
1324
|
|
|
1325
|
+
/**
|
|
1326
|
+
* No normal map packing.
|
|
1327
|
+
*
|
|
1328
|
+
* @type {string}
|
|
1329
|
+
* @constant
|
|
1330
|
+
*/
|
|
1331
|
+
const NoNormalPacking = '';
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Normal RG packing.
|
|
1335
|
+
*
|
|
1336
|
+
* @type {string}
|
|
1337
|
+
* @constant
|
|
1338
|
+
*/
|
|
1339
|
+
const NormalRGPacking = 'rg';
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Normal GA packing.
|
|
1343
|
+
*
|
|
1344
|
+
* @type {string}
|
|
1345
|
+
* @constant
|
|
1346
|
+
*/
|
|
1347
|
+
const NormalGAPacking = 'ga';
|
|
1348
|
+
|
|
1293
1349
|
/**
|
|
1294
1350
|
* Sets the stencil buffer value to `0`.
|
|
1295
1351
|
*
|
|
@@ -1716,6 +1772,18 @@ function getTypedArray( type, buffer ) {
|
|
|
1716
1772
|
|
|
1717
1773
|
}
|
|
1718
1774
|
|
|
1775
|
+
/**
|
|
1776
|
+
* Returns `true` if the given object is a typed array.
|
|
1777
|
+
*
|
|
1778
|
+
* @param {any} array - The object to check.
|
|
1779
|
+
* @return {boolean} Whether the given object is a typed array.
|
|
1780
|
+
*/
|
|
1781
|
+
function isTypedArray( array ) {
|
|
1782
|
+
|
|
1783
|
+
return ArrayBuffer.isView( array ) && ! ( array instanceof DataView );
|
|
1784
|
+
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1719
1787
|
function createElementNS( name ) {
|
|
1720
1788
|
|
|
1721
1789
|
return document.createElementNS( 'http://www.w3.org/1999/xhtml', name );
|
|
@@ -5232,8 +5300,6 @@ class Vector3 {
|
|
|
5232
5300
|
|
|
5233
5301
|
}
|
|
5234
5302
|
|
|
5235
|
-
// TODO lengthSquared?
|
|
5236
|
-
|
|
5237
5303
|
/**
|
|
5238
5304
|
* Computes the square of the Euclidean length (straight-line length) from
|
|
5239
5305
|
* (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should
|
|
@@ -6789,7 +6855,7 @@ class Source {
|
|
|
6789
6855
|
|
|
6790
6856
|
target.set( data.videoWidth, data.videoHeight, 0 );
|
|
6791
6857
|
|
|
6792
|
-
} else if ( data instanceof VideoFrame ) {
|
|
6858
|
+
} else if ( ( typeof VideoFrame !== 'undefined' ) && ( data instanceof VideoFrame ) ) {
|
|
6793
6859
|
|
|
6794
6860
|
target.set( data.displayHeight, data.displayWidth, 0 );
|
|
6795
6861
|
|
|
@@ -7069,7 +7135,7 @@ class Texture extends EventDispatcher {
|
|
|
7069
7135
|
* texture samples being used.
|
|
7070
7136
|
*
|
|
7071
7137
|
* @type {number}
|
|
7072
|
-
* @default
|
|
7138
|
+
* @default Texture.DEFAULT_ANISOTROPY
|
|
7073
7139
|
*/
|
|
7074
7140
|
this.anisotropy = anisotropy;
|
|
7075
7141
|
|
|
@@ -10717,7 +10783,7 @@ class Sphere {
|
|
|
10717
10783
|
* Returns a serialized structure of the bounding sphere.
|
|
10718
10784
|
*
|
|
10719
10785
|
* @param {Object} json - The serialized json to set the sphere from.
|
|
10720
|
-
* @return {
|
|
10786
|
+
* @return {Sphere} A reference to this bounding sphere.
|
|
10721
10787
|
*/
|
|
10722
10788
|
fromJSON( json ) {
|
|
10723
10789
|
|
|
@@ -11614,6 +11680,16 @@ class Matrix4 {
|
|
|
11614
11680
|
*/
|
|
11615
11681
|
extractBasis( xAxis, yAxis, zAxis ) {
|
|
11616
11682
|
|
|
11683
|
+
if ( this.determinant() === 0 ) {
|
|
11684
|
+
|
|
11685
|
+
xAxis.set( 1, 0, 0 );
|
|
11686
|
+
yAxis.set( 0, 1, 0 );
|
|
11687
|
+
zAxis.set( 0, 0, 1 );
|
|
11688
|
+
|
|
11689
|
+
return this;
|
|
11690
|
+
|
|
11691
|
+
}
|
|
11692
|
+
|
|
11617
11693
|
xAxis.setFromMatrixColumn( this, 0 );
|
|
11618
11694
|
yAxis.setFromMatrixColumn( this, 1 );
|
|
11619
11695
|
zAxis.setFromMatrixColumn( this, 2 );
|
|
@@ -11654,6 +11730,12 @@ class Matrix4 {
|
|
|
11654
11730
|
*/
|
|
11655
11731
|
extractRotation( m ) {
|
|
11656
11732
|
|
|
11733
|
+
if ( m.determinant() === 0 ) {
|
|
11734
|
+
|
|
11735
|
+
return this.identity();
|
|
11736
|
+
|
|
11737
|
+
}
|
|
11738
|
+
|
|
11657
11739
|
const te = this.elements;
|
|
11658
11740
|
const me = m.elements;
|
|
11659
11741
|
|
|
@@ -11994,43 +12076,18 @@ class Matrix4 {
|
|
|
11994
12076
|
const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
|
|
11995
12077
|
const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
|
|
11996
12078
|
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
n41 * (
|
|
12001
|
-
+ n14 * n23 * n32
|
|
12002
|
-
- n13 * n24 * n32
|
|
12003
|
-
- n14 * n22 * n33
|
|
12004
|
-
+ n12 * n24 * n33
|
|
12005
|
-
+ n13 * n22 * n34
|
|
12006
|
-
- n12 * n23 * n34
|
|
12007
|
-
) +
|
|
12008
|
-
n42 * (
|
|
12009
|
-
+ n11 * n23 * n34
|
|
12010
|
-
- n11 * n24 * n33
|
|
12011
|
-
+ n14 * n21 * n33
|
|
12012
|
-
- n13 * n21 * n34
|
|
12013
|
-
+ n13 * n24 * n31
|
|
12014
|
-
- n14 * n23 * n31
|
|
12015
|
-
) +
|
|
12016
|
-
n43 * (
|
|
12017
|
-
+ n11 * n24 * n32
|
|
12018
|
-
- n11 * n22 * n34
|
|
12019
|
-
- n14 * n21 * n32
|
|
12020
|
-
+ n12 * n21 * n34
|
|
12021
|
-
+ n14 * n22 * n31
|
|
12022
|
-
- n12 * n24 * n31
|
|
12023
|
-
) +
|
|
12024
|
-
n44 * (
|
|
12025
|
-
- n13 * n22 * n31
|
|
12026
|
-
- n11 * n23 * n32
|
|
12027
|
-
+ n11 * n22 * n33
|
|
12028
|
-
+ n13 * n21 * n32
|
|
12029
|
-
- n12 * n21 * n33
|
|
12030
|
-
+ n12 * n23 * n31
|
|
12031
|
-
)
|
|
12079
|
+
const t11 = n23 * n34 - n24 * n33;
|
|
12080
|
+
const t12 = n22 * n34 - n24 * n32;
|
|
12081
|
+
const t13 = n22 * n33 - n23 * n32;
|
|
12032
12082
|
|
|
12033
|
-
|
|
12083
|
+
const t21 = n21 * n34 - n24 * n31;
|
|
12084
|
+
const t22 = n21 * n33 - n23 * n31;
|
|
12085
|
+
const t23 = n21 * n32 - n22 * n31;
|
|
12086
|
+
|
|
12087
|
+
return n11 * ( n42 * t11 - n43 * t12 + n44 * t13 ) -
|
|
12088
|
+
n12 * ( n41 * t11 - n43 * t21 + n44 * t22 ) +
|
|
12089
|
+
n13 * ( n41 * t12 - n42 * t21 + n44 * t23 ) -
|
|
12090
|
+
n14 * ( n41 * t13 - n42 * t22 + n43 * t23 );
|
|
12034
12091
|
|
|
12035
12092
|
}
|
|
12036
12093
|
|
|
@@ -12431,6 +12488,19 @@ class Matrix4 {
|
|
|
12431
12488
|
|
|
12432
12489
|
const te = this.elements;
|
|
12433
12490
|
|
|
12491
|
+
position.x = te[ 12 ];
|
|
12492
|
+
position.y = te[ 13 ];
|
|
12493
|
+
position.z = te[ 14 ];
|
|
12494
|
+
|
|
12495
|
+
if ( this.determinant() === 0 ) {
|
|
12496
|
+
|
|
12497
|
+
scale.set( 1, 1, 1 );
|
|
12498
|
+
quaternion.identity();
|
|
12499
|
+
|
|
12500
|
+
return this;
|
|
12501
|
+
|
|
12502
|
+
}
|
|
12503
|
+
|
|
12434
12504
|
let sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
|
|
12435
12505
|
const sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
|
|
12436
12506
|
const sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
|
|
@@ -12439,10 +12509,6 @@ class Matrix4 {
|
|
|
12439
12509
|
const det = this.determinant();
|
|
12440
12510
|
if ( det < 0 ) sx = - sx;
|
|
12441
12511
|
|
|
12442
|
-
position.x = te[ 12 ];
|
|
12443
|
-
position.y = te[ 13 ];
|
|
12444
|
-
position.z = te[ 14 ];
|
|
12445
|
-
|
|
12446
12512
|
// scale the rotation part
|
|
12447
12513
|
_m1$4.copy( this );
|
|
12448
12514
|
|
|
@@ -17172,6 +17238,7 @@ class Material extends EventDispatcher {
|
|
|
17172
17238
|
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
|
|
17173
17239
|
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
|
|
17174
17240
|
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
|
|
17241
|
+
if ( this.allowOverride === false ) data.allowOverride = false;
|
|
17175
17242
|
|
|
17176
17243
|
if ( this.wireframe === true ) data.wireframe = true;
|
|
17177
17244
|
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
@@ -17307,6 +17374,7 @@ class Material extends EventDispatcher {
|
|
|
17307
17374
|
this.alphaToCoverage = source.alphaToCoverage;
|
|
17308
17375
|
this.premultipliedAlpha = source.premultipliedAlpha;
|
|
17309
17376
|
this.forceSinglePass = source.forceSinglePass;
|
|
17377
|
+
this.allowOverride = source.allowOverride;
|
|
17310
17378
|
|
|
17311
17379
|
this.visible = source.visible;
|
|
17312
17380
|
|
|
@@ -18930,6 +18998,16 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18930
18998
|
*/
|
|
18931
18999
|
this.indirect = null;
|
|
18932
19000
|
|
|
19001
|
+
/**
|
|
19002
|
+
* The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
|
|
19003
|
+
*
|
|
19004
|
+
* Can only be used with {@link WebGPURenderer} and a WebGPU backend.
|
|
19005
|
+
*
|
|
19006
|
+
* @type {number|Array<number>}
|
|
19007
|
+
* @default 0
|
|
19008
|
+
*/
|
|
19009
|
+
this.indirectOffset = 0;
|
|
19010
|
+
|
|
18933
19011
|
/**
|
|
18934
19012
|
* This dictionary has as id the name of the attribute to be set and as value
|
|
18935
19013
|
* the buffer attribute to set it to. Rather than accessing this property directly,
|
|
@@ -18943,7 +19021,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18943
19021
|
* This dictionary holds the morph targets of the geometry.
|
|
18944
19022
|
*
|
|
18945
19023
|
* Note: Once the geometry has been rendered, the morph attribute data cannot
|
|
18946
|
-
* be changed. You will have to call `dispose()
|
|
19024
|
+
* be changed. You will have to call `dispose()`, and create a new geometry instance.
|
|
18947
19025
|
*
|
|
18948
19026
|
* @type {Object}
|
|
18949
19027
|
*/
|
|
@@ -19043,11 +19121,13 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19043
19121
|
* Sets the given indirect attribute to this geometry.
|
|
19044
19122
|
*
|
|
19045
19123
|
* @param {BufferAttribute} indirect - The attribute holding indirect draw calls.
|
|
19124
|
+
* @param {number|Array<number>} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
|
|
19046
19125
|
* @return {BufferGeometry} A reference to this instance.
|
|
19047
19126
|
*/
|
|
19048
|
-
setIndirect( indirect ) {
|
|
19127
|
+
setIndirect( indirect, indirectOffset = 0 ) {
|
|
19049
19128
|
|
|
19050
19129
|
this.indirect = indirect;
|
|
19130
|
+
this.indirectOffset = indirectOffset;
|
|
19051
19131
|
|
|
19052
19132
|
return this;
|
|
19053
19133
|
|
|
@@ -20332,7 +20412,7 @@ class Mesh extends Object3D {
|
|
|
20332
20412
|
* morph targets name, the value its attribute index. This member is `undefined`
|
|
20333
20413
|
* by default and only set when morph targets are detected in the geometry.
|
|
20334
20414
|
*
|
|
20335
|
-
* @type {Object<
|
|
20415
|
+
* @type {Object<string,number>|undefined}
|
|
20336
20416
|
* @default undefined
|
|
20337
20417
|
*/
|
|
20338
20418
|
this.morphTargetDictionary = undefined;
|
|
@@ -21246,9 +21326,22 @@ class ShaderMaterial extends Material {
|
|
|
21246
21326
|
this.wireframeLinewidth = 1;
|
|
21247
21327
|
|
|
21248
21328
|
/**
|
|
21249
|
-
*
|
|
21329
|
+
* Defines whether the material color is affected by global fog settings; `true`
|
|
21250
21330
|
* to pass fog uniforms to the shader.
|
|
21251
21331
|
*
|
|
21332
|
+
* Setting this property to `true` requires the definition of fog uniforms. It is
|
|
21333
|
+
* recommended to use `UniformsUtils.merge()` to combine the custom shader uniforms
|
|
21334
|
+
* with predefined fog uniforms.
|
|
21335
|
+
*
|
|
21336
|
+
* ```js
|
|
21337
|
+
* const material = new ShaderMaterial( {
|
|
21338
|
+
* uniforms: UniformsUtils.merge( [ UniformsLib[ 'fog' ], shaderUniforms ] );
|
|
21339
|
+
* vertexShader: vertexShader,
|
|
21340
|
+
* fragmentShader: fragmentShader,
|
|
21341
|
+
* fog: true
|
|
21342
|
+
* } );
|
|
21343
|
+
* ```
|
|
21344
|
+
*
|
|
21252
21345
|
* @type {boolean}
|
|
21253
21346
|
* @default false
|
|
21254
21347
|
*/
|
|
@@ -21367,6 +21460,12 @@ class ShaderMaterial extends Material {
|
|
|
21367
21460
|
|
|
21368
21461
|
this.glslVersion = source.glslVersion;
|
|
21369
21462
|
|
|
21463
|
+
this.defaultAttributeValues = Object.assign( {}, source.defaultAttributeValues );
|
|
21464
|
+
|
|
21465
|
+
this.index0AttributeName = source.index0AttributeName;
|
|
21466
|
+
|
|
21467
|
+
this.uniformsNeedUpdate = source.uniformsNeedUpdate;
|
|
21468
|
+
|
|
21370
21469
|
return this;
|
|
21371
21470
|
|
|
21372
21471
|
}
|
|
@@ -25320,6 +25419,15 @@ class Skeleton {
|
|
|
25320
25419
|
*/
|
|
25321
25420
|
this.boneMatrices = null;
|
|
25322
25421
|
|
|
25422
|
+
/**
|
|
25423
|
+
* An array buffer holding the bone data of the previous frame.
|
|
25424
|
+
* Required for computing velocity. Maintained in {@link SkinningNode}.
|
|
25425
|
+
*
|
|
25426
|
+
* @type {?Float32Array}
|
|
25427
|
+
* @default null
|
|
25428
|
+
*/
|
|
25429
|
+
this.previousBoneMatrices = null;
|
|
25430
|
+
|
|
25323
25431
|
/**
|
|
25324
25432
|
* A texture holding the bone data for use
|
|
25325
25433
|
* in the vertex shader.
|
|
@@ -27833,10 +27941,9 @@ class BatchedMesh extends Mesh {
|
|
|
27833
27941
|
}
|
|
27834
27942
|
|
|
27835
27943
|
/**
|
|
27836
|
-
* Repacks the sub geometries in
|
|
27944
|
+
* Repacks the sub geometries in BatchedMesh to remove any unused space remaining from
|
|
27837
27945
|
* previously deleted geometry, freeing up space to add new geometry.
|
|
27838
27946
|
*
|
|
27839
|
-
* @param {number} instanceId - The ID of the instance to remove from the batch.
|
|
27840
27947
|
* @return {BatchedMesh} A reference to this batched mesh.
|
|
27841
27948
|
*/
|
|
27842
27949
|
optimize() {
|
|
@@ -27888,6 +27995,7 @@ class BatchedMesh extends Mesh {
|
|
|
27888
27995
|
|
|
27889
27996
|
index.array.copyWithin( nextIndexStart, indexStart, indexStart + reservedIndexCount );
|
|
27890
27997
|
index.addUpdateRange( nextIndexStart, reservedIndexCount );
|
|
27998
|
+
index.needsUpdate = true;
|
|
27891
27999
|
|
|
27892
28000
|
geometryInfo.indexStart = nextIndexStart;
|
|
27893
28001
|
|
|
@@ -27908,6 +28016,7 @@ class BatchedMesh extends Mesh {
|
|
|
27908
28016
|
const { array, itemSize } = attribute;
|
|
27909
28017
|
array.copyWithin( nextVertexStart * itemSize, vertexStart * itemSize, ( vertexStart + reservedVertexCount ) * itemSize );
|
|
27910
28018
|
attribute.addUpdateRange( nextVertexStart * itemSize, reservedVertexCount * itemSize );
|
|
28019
|
+
attribute.needsUpdate = true;
|
|
27911
28020
|
|
|
27912
28021
|
}
|
|
27913
28022
|
|
|
@@ -27924,6 +28033,8 @@ class BatchedMesh extends Mesh {
|
|
|
27924
28033
|
|
|
27925
28034
|
}
|
|
27926
28035
|
|
|
28036
|
+
this._visibilityChanged = true;
|
|
28037
|
+
|
|
27927
28038
|
return this;
|
|
27928
28039
|
|
|
27929
28040
|
}
|
|
@@ -28804,7 +28915,7 @@ class Line extends Object3D {
|
|
|
28804
28915
|
* morph targets name, the value its attribute index. This member is `undefined`
|
|
28805
28916
|
* by default and only set when morph targets are detected in the geometry.
|
|
28806
28917
|
*
|
|
28807
|
-
* @type {Object<
|
|
28918
|
+
* @type {Object<string,number>|undefined}
|
|
28808
28919
|
* @default undefined
|
|
28809
28920
|
*/
|
|
28810
28921
|
this.morphTargetDictionary = undefined;
|
|
@@ -29339,7 +29450,7 @@ class Points extends Object3D {
|
|
|
29339
29450
|
* morph targets name, the value its attribute index. This member is `undefined`
|
|
29340
29451
|
* by default and only set when morph targets are detected in the geometry.
|
|
29341
29452
|
*
|
|
29342
|
-
* @type {Object<
|
|
29453
|
+
* @type {Object<string,number>|undefined}
|
|
29343
29454
|
* @default undefined
|
|
29344
29455
|
*/
|
|
29345
29456
|
this.morphTargetDictionary = undefined;
|
|
@@ -30131,6 +30242,78 @@ class DepthTexture extends Texture {
|
|
|
30131
30242
|
|
|
30132
30243
|
}
|
|
30133
30244
|
|
|
30245
|
+
/**
|
|
30246
|
+
* This class can be used to automatically save the depth information of a
|
|
30247
|
+
* cube rendering into a cube texture with depth format. Used for PointLight shadows.
|
|
30248
|
+
*
|
|
30249
|
+
* @augments DepthTexture
|
|
30250
|
+
*/
|
|
30251
|
+
class CubeDepthTexture extends DepthTexture {
|
|
30252
|
+
|
|
30253
|
+
/**
|
|
30254
|
+
* Constructs a new cube depth texture.
|
|
30255
|
+
*
|
|
30256
|
+
* @param {number} size - The size (width and height) of each cube face.
|
|
30257
|
+
* @param {number} [type=UnsignedIntType] - The texture type.
|
|
30258
|
+
* @param {number} [mapping=CubeReflectionMapping] - The texture mapping.
|
|
30259
|
+
* @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.
|
|
30260
|
+
* @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.
|
|
30261
|
+
* @param {number} [magFilter=NearestFilter] - The mag filter value.
|
|
30262
|
+
* @param {number} [minFilter=NearestFilter] - The min filter value.
|
|
30263
|
+
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
|
|
30264
|
+
* @param {number} [format=DepthFormat] - The texture format.
|
|
30265
|
+
*/
|
|
30266
|
+
constructor( size, type = UnsignedIntType, mapping = CubeReflectionMapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, format = DepthFormat ) {
|
|
30267
|
+
|
|
30268
|
+
// Create 6 identical image descriptors for the cube faces
|
|
30269
|
+
const image = { width: size, height: size, depth: 1 };
|
|
30270
|
+
const images = [ image, image, image, image, image, image ];
|
|
30271
|
+
|
|
30272
|
+
// Call DepthTexture constructor with width, height
|
|
30273
|
+
super( size, size, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format );
|
|
30274
|
+
|
|
30275
|
+
// Replace the single image with the array of 6 images
|
|
30276
|
+
this.image = images;
|
|
30277
|
+
|
|
30278
|
+
/**
|
|
30279
|
+
* This flag can be used for type testing.
|
|
30280
|
+
*
|
|
30281
|
+
* @type {boolean}
|
|
30282
|
+
* @readonly
|
|
30283
|
+
* @default true
|
|
30284
|
+
*/
|
|
30285
|
+
this.isCubeDepthTexture = true;
|
|
30286
|
+
|
|
30287
|
+
/**
|
|
30288
|
+
* Set to true for cube texture handling in WebGLTextures.
|
|
30289
|
+
*
|
|
30290
|
+
* @type {boolean}
|
|
30291
|
+
* @readonly
|
|
30292
|
+
* @default true
|
|
30293
|
+
*/
|
|
30294
|
+
this.isCubeTexture = true;
|
|
30295
|
+
|
|
30296
|
+
}
|
|
30297
|
+
|
|
30298
|
+
/**
|
|
30299
|
+
* Alias for {@link CubeDepthTexture#image}.
|
|
30300
|
+
*
|
|
30301
|
+
* @type {Array<Image>}
|
|
30302
|
+
*/
|
|
30303
|
+
get images() {
|
|
30304
|
+
|
|
30305
|
+
return this.image;
|
|
30306
|
+
|
|
30307
|
+
}
|
|
30308
|
+
|
|
30309
|
+
set images( value ) {
|
|
30310
|
+
|
|
30311
|
+
this.image = value;
|
|
30312
|
+
|
|
30313
|
+
}
|
|
30314
|
+
|
|
30315
|
+
}
|
|
30316
|
+
|
|
30134
30317
|
/**
|
|
30135
30318
|
* Represents a texture created externally with the same renderer context.
|
|
30136
30319
|
*
|
|
@@ -31261,7 +31444,7 @@ class PolyhedronGeometry extends BufferGeometry {
|
|
|
31261
31444
|
*/
|
|
31262
31445
|
static fromJSON( data ) {
|
|
31263
31446
|
|
|
31264
|
-
return new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.
|
|
31447
|
+
return new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.detail );
|
|
31265
31448
|
|
|
31266
31449
|
}
|
|
31267
31450
|
|
|
@@ -35320,9 +35503,9 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35320
35503
|
|
|
35321
35504
|
// SETUP TNB variables
|
|
35322
35505
|
|
|
35323
|
-
|
|
35506
|
+
const isClosed = extrudePath.isCatmullRomCurve3 ? extrudePath.closed : false;
|
|
35324
35507
|
|
|
35325
|
-
splineTube = extrudePath.computeFrenetFrames( steps,
|
|
35508
|
+
splineTube = extrudePath.computeFrenetFrames( steps, isClosed );
|
|
35326
35509
|
|
|
35327
35510
|
// log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
|
|
35328
35511
|
|
|
@@ -40954,18 +41137,6 @@ function convertArray( array, type ) {
|
|
|
40954
41137
|
|
|
40955
41138
|
}
|
|
40956
41139
|
|
|
40957
|
-
/**
|
|
40958
|
-
* Returns `true` if the given object is a typed array.
|
|
40959
|
-
*
|
|
40960
|
-
* @param {any} object - The object to check.
|
|
40961
|
-
* @return {boolean} Whether the given object is a typed array.
|
|
40962
|
-
*/
|
|
40963
|
-
function isTypedArray( object ) {
|
|
40964
|
-
|
|
40965
|
-
return ArrayBuffer.isView( object ) && ! ( object instanceof DataView );
|
|
40966
|
-
|
|
40967
|
-
}
|
|
40968
|
-
|
|
40969
41140
|
/**
|
|
40970
41141
|
* Returns an array by which times and values can be sorted.
|
|
40971
41142
|
*
|
|
@@ -42533,7 +42704,7 @@ class KeyframeTrack {
|
|
|
42533
42704
|
/**
|
|
42534
42705
|
* The value type name.
|
|
42535
42706
|
*
|
|
42536
|
-
* @type {
|
|
42707
|
+
* @type {string}
|
|
42537
42708
|
* @default ''
|
|
42538
42709
|
*/
|
|
42539
42710
|
KeyframeTrack.prototype.ValueTypeName = '';
|
|
@@ -42590,7 +42761,7 @@ class BooleanKeyframeTrack extends KeyframeTrack {
|
|
|
42590
42761
|
/**
|
|
42591
42762
|
* The value type name.
|
|
42592
42763
|
*
|
|
42593
|
-
* @type {
|
|
42764
|
+
* @type {string}
|
|
42594
42765
|
* @default 'bool'
|
|
42595
42766
|
*/
|
|
42596
42767
|
BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
|
|
@@ -42639,7 +42810,7 @@ class ColorKeyframeTrack extends KeyframeTrack {
|
|
|
42639
42810
|
/**
|
|
42640
42811
|
* The value type name.
|
|
42641
42812
|
*
|
|
42642
|
-
* @type {
|
|
42813
|
+
* @type {string}
|
|
42643
42814
|
* @default 'color'
|
|
42644
42815
|
*/
|
|
42645
42816
|
ColorKeyframeTrack.prototype.ValueTypeName = 'color';
|
|
@@ -42670,7 +42841,7 @@ class NumberKeyframeTrack extends KeyframeTrack {
|
|
|
42670
42841
|
/**
|
|
42671
42842
|
* The value type name.
|
|
42672
42843
|
*
|
|
42673
|
-
* @type {
|
|
42844
|
+
* @type {string}
|
|
42674
42845
|
* @default 'number'
|
|
42675
42846
|
*/
|
|
42676
42847
|
NumberKeyframeTrack.prototype.ValueTypeName = 'number';
|
|
@@ -42757,7 +42928,7 @@ class QuaternionKeyframeTrack extends KeyframeTrack {
|
|
|
42757
42928
|
/**
|
|
42758
42929
|
* The value type name.
|
|
42759
42930
|
*
|
|
42760
|
-
* @type {
|
|
42931
|
+
* @type {string}
|
|
42761
42932
|
* @default 'quaternion'
|
|
42762
42933
|
*/
|
|
42763
42934
|
QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';
|
|
@@ -42793,7 +42964,7 @@ class StringKeyframeTrack extends KeyframeTrack {
|
|
|
42793
42964
|
/**
|
|
42794
42965
|
* The value type name.
|
|
42795
42966
|
*
|
|
42796
|
-
* @type {
|
|
42967
|
+
* @type {string}
|
|
42797
42968
|
* @default 'string'
|
|
42798
42969
|
*/
|
|
42799
42970
|
StringKeyframeTrack.prototype.ValueTypeName = 'string';
|
|
@@ -42842,7 +43013,7 @@ class VectorKeyframeTrack extends KeyframeTrack {
|
|
|
42842
43013
|
/**
|
|
42843
43014
|
* The value type name.
|
|
42844
43015
|
*
|
|
42845
|
-
* @type {
|
|
43016
|
+
* @type {string}
|
|
42846
43017
|
* @default 'vector'
|
|
42847
43018
|
*/
|
|
42848
43019
|
VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
|
|
@@ -45213,7 +45384,7 @@ class Light extends Object3D {
|
|
|
45213
45384
|
*/
|
|
45214
45385
|
dispose() {
|
|
45215
45386
|
|
|
45216
|
-
|
|
45387
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
45217
45388
|
|
|
45218
45389
|
}
|
|
45219
45390
|
|
|
@@ -45235,16 +45406,6 @@ class Light extends Object3D {
|
|
|
45235
45406
|
data.object.color = this.color.getHex();
|
|
45236
45407
|
data.object.intensity = this.intensity;
|
|
45237
45408
|
|
|
45238
|
-
if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
|
|
45239
|
-
|
|
45240
|
-
if ( this.distance !== undefined ) data.object.distance = this.distance;
|
|
45241
|
-
if ( this.angle !== undefined ) data.object.angle = this.angle;
|
|
45242
|
-
if ( this.decay !== undefined ) data.object.decay = this.decay;
|
|
45243
|
-
if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
|
|
45244
|
-
|
|
45245
|
-
if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
|
|
45246
|
-
if ( this.target !== undefined ) data.object.target = this.target.uuid;
|
|
45247
|
-
|
|
45248
45409
|
return data;
|
|
45249
45410
|
|
|
45250
45411
|
}
|
|
@@ -45310,6 +45471,16 @@ class HemisphereLight extends Light {
|
|
|
45310
45471
|
|
|
45311
45472
|
}
|
|
45312
45473
|
|
|
45474
|
+
toJSON( meta ) {
|
|
45475
|
+
|
|
45476
|
+
const data = super.toJSON( meta );
|
|
45477
|
+
|
|
45478
|
+
data.object.groundColor = this.groundColor.getHex();
|
|
45479
|
+
|
|
45480
|
+
return data;
|
|
45481
|
+
|
|
45482
|
+
}
|
|
45483
|
+
|
|
45313
45484
|
}
|
|
45314
45485
|
|
|
45315
45486
|
const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
@@ -45376,9 +45547,6 @@ class LightShadow {
|
|
|
45376
45547
|
* map size will allow for a higher value to be used here before these effects
|
|
45377
45548
|
* become visible.
|
|
45378
45549
|
*
|
|
45379
|
-
* The property has no effect when the shadow map type is `PCFSoftShadowMap` and
|
|
45380
|
-
* and it is recommended to increase softness by decreasing the shadow map size instead.
|
|
45381
|
-
*
|
|
45382
45550
|
* The property has no effect when the shadow map type is `BasicShadowMap`.
|
|
45383
45551
|
*
|
|
45384
45552
|
* @type {number}
|
|
@@ -45862,6 +46030,8 @@ class SpotLight extends Light {
|
|
|
45862
46030
|
|
|
45863
46031
|
dispose() {
|
|
45864
46032
|
|
|
46033
|
+
super.dispose();
|
|
46034
|
+
|
|
45865
46035
|
this.shadow.dispose();
|
|
45866
46036
|
|
|
45867
46037
|
}
|
|
@@ -45876,18 +46046,33 @@ class SpotLight extends Light {
|
|
|
45876
46046
|
this.decay = source.decay;
|
|
45877
46047
|
|
|
45878
46048
|
this.target = source.target.clone();
|
|
45879
|
-
|
|
46049
|
+
this.map = source.map;
|
|
45880
46050
|
this.shadow = source.shadow.clone();
|
|
45881
46051
|
|
|
45882
46052
|
return this;
|
|
45883
46053
|
|
|
45884
46054
|
}
|
|
45885
46055
|
|
|
45886
|
-
|
|
46056
|
+
toJSON( meta ) {
|
|
45887
46057
|
|
|
45888
|
-
const
|
|
45889
|
-
|
|
45890
|
-
|
|
46058
|
+
const data = super.toJSON( meta );
|
|
46059
|
+
|
|
46060
|
+
data.object.distance = this.distance;
|
|
46061
|
+
data.object.angle = this.angle;
|
|
46062
|
+
data.object.decay = this.decay;
|
|
46063
|
+
data.object.penumbra = this.penumbra;
|
|
46064
|
+
|
|
46065
|
+
data.object.target = this.target.uuid;
|
|
46066
|
+
|
|
46067
|
+
if ( this.map && this.map.isTexture ) data.object.map = this.map.toJSON( meta ).uuid;
|
|
46068
|
+
|
|
46069
|
+
data.object.shadow = this.shadow.toJSON();
|
|
46070
|
+
|
|
46071
|
+
return data;
|
|
46072
|
+
|
|
46073
|
+
}
|
|
46074
|
+
|
|
46075
|
+
}
|
|
45891
46076
|
|
|
45892
46077
|
/**
|
|
45893
46078
|
* Represents the shadow configuration of point lights.
|
|
@@ -45912,84 +46097,6 @@ class PointLightShadow extends LightShadow {
|
|
|
45912
46097
|
*/
|
|
45913
46098
|
this.isPointLightShadow = true;
|
|
45914
46099
|
|
|
45915
|
-
this._frameExtents = new Vector2( 4, 2 );
|
|
45916
|
-
|
|
45917
|
-
this._viewportCount = 6;
|
|
45918
|
-
|
|
45919
|
-
this._viewports = [
|
|
45920
|
-
// These viewports map a cube-map onto a 2D texture with the
|
|
45921
|
-
// following orientation:
|
|
45922
|
-
//
|
|
45923
|
-
// xzXZ
|
|
45924
|
-
// y Y
|
|
45925
|
-
//
|
|
45926
|
-
// X - Positive x direction
|
|
45927
|
-
// x - Negative x direction
|
|
45928
|
-
// Y - Positive y direction
|
|
45929
|
-
// y - Negative y direction
|
|
45930
|
-
// Z - Positive z direction
|
|
45931
|
-
// z - Negative z direction
|
|
45932
|
-
|
|
45933
|
-
// positive X
|
|
45934
|
-
new Vector4( 2, 1, 1, 1 ),
|
|
45935
|
-
// negative X
|
|
45936
|
-
new Vector4( 0, 1, 1, 1 ),
|
|
45937
|
-
// positive Z
|
|
45938
|
-
new Vector4( 3, 1, 1, 1 ),
|
|
45939
|
-
// negative Z
|
|
45940
|
-
new Vector4( 1, 1, 1, 1 ),
|
|
45941
|
-
// positive Y
|
|
45942
|
-
new Vector4( 3, 0, 1, 1 ),
|
|
45943
|
-
// negative Y
|
|
45944
|
-
new Vector4( 1, 0, 1, 1 )
|
|
45945
|
-
];
|
|
45946
|
-
|
|
45947
|
-
this._cubeDirections = [
|
|
45948
|
-
new Vector3( 1, 0, 0 ), new Vector3( -1, 0, 0 ), new Vector3( 0, 0, 1 ),
|
|
45949
|
-
new Vector3( 0, 0, -1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, -1, 0 )
|
|
45950
|
-
];
|
|
45951
|
-
|
|
45952
|
-
this._cubeUps = [
|
|
45953
|
-
new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),
|
|
45954
|
-
new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, -1 )
|
|
45955
|
-
];
|
|
45956
|
-
|
|
45957
|
-
}
|
|
45958
|
-
|
|
45959
|
-
/**
|
|
45960
|
-
* Update the matrices for the camera and shadow, used internally by the renderer.
|
|
45961
|
-
*
|
|
45962
|
-
* @param {Light} light - The light for which the shadow is being rendered.
|
|
45963
|
-
* @param {number} [viewportIndex=0] - The viewport index.
|
|
45964
|
-
*/
|
|
45965
|
-
updateMatrices( light, viewportIndex = 0 ) {
|
|
45966
|
-
|
|
45967
|
-
const camera = this.camera;
|
|
45968
|
-
const shadowMatrix = this.matrix;
|
|
45969
|
-
|
|
45970
|
-
const far = light.distance || camera.far;
|
|
45971
|
-
|
|
45972
|
-
if ( far !== camera.far ) {
|
|
45973
|
-
|
|
45974
|
-
camera.far = far;
|
|
45975
|
-
camera.updateProjectionMatrix();
|
|
45976
|
-
|
|
45977
|
-
}
|
|
45978
|
-
|
|
45979
|
-
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
|
|
45980
|
-
camera.position.copy( _lightPositionWorld );
|
|
45981
|
-
|
|
45982
|
-
_lookTarget.copy( camera.position );
|
|
45983
|
-
_lookTarget.add( this._cubeDirections[ viewportIndex ] );
|
|
45984
|
-
camera.up.copy( this._cubeUps[ viewportIndex ] );
|
|
45985
|
-
camera.lookAt( _lookTarget );
|
|
45986
|
-
camera.updateMatrixWorld();
|
|
45987
|
-
|
|
45988
|
-
shadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );
|
|
45989
|
-
|
|
45990
|
-
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
45991
|
-
this._frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );
|
|
45992
|
-
|
|
45993
46100
|
}
|
|
45994
46101
|
|
|
45995
46102
|
}
|
|
@@ -46087,6 +46194,8 @@ class PointLight extends Light {
|
|
|
46087
46194
|
|
|
46088
46195
|
dispose() {
|
|
46089
46196
|
|
|
46197
|
+
super.dispose();
|
|
46198
|
+
|
|
46090
46199
|
this.shadow.dispose();
|
|
46091
46200
|
|
|
46092
46201
|
}
|
|
@@ -46104,6 +46213,19 @@ class PointLight extends Light {
|
|
|
46104
46213
|
|
|
46105
46214
|
}
|
|
46106
46215
|
|
|
46216
|
+
toJSON( meta ) {
|
|
46217
|
+
|
|
46218
|
+
const data = super.toJSON( meta );
|
|
46219
|
+
|
|
46220
|
+
data.object.distance = this.distance;
|
|
46221
|
+
data.object.decay = this.decay;
|
|
46222
|
+
|
|
46223
|
+
data.object.shadow = this.shadow.toJSON();
|
|
46224
|
+
|
|
46225
|
+
return data;
|
|
46226
|
+
|
|
46227
|
+
}
|
|
46228
|
+
|
|
46107
46229
|
}
|
|
46108
46230
|
|
|
46109
46231
|
/**
|
|
@@ -46453,6 +46575,8 @@ class DirectionalLight extends Light {
|
|
|
46453
46575
|
|
|
46454
46576
|
dispose() {
|
|
46455
46577
|
|
|
46578
|
+
super.dispose();
|
|
46579
|
+
|
|
46456
46580
|
this.shadow.dispose();
|
|
46457
46581
|
|
|
46458
46582
|
}
|
|
@@ -46468,6 +46592,17 @@ class DirectionalLight extends Light {
|
|
|
46468
46592
|
|
|
46469
46593
|
}
|
|
46470
46594
|
|
|
46595
|
+
toJSON( meta ) {
|
|
46596
|
+
|
|
46597
|
+
const data = super.toJSON( meta );
|
|
46598
|
+
|
|
46599
|
+
data.object.shadow = this.shadow.toJSON();
|
|
46600
|
+
data.object.target = this.target.uuid;
|
|
46601
|
+
|
|
46602
|
+
return data;
|
|
46603
|
+
|
|
46604
|
+
}
|
|
46605
|
+
|
|
46471
46606
|
}
|
|
46472
46607
|
|
|
46473
46608
|
/**
|
|
@@ -47018,21 +47153,6 @@ class LightProbe extends Light {
|
|
|
47018
47153
|
|
|
47019
47154
|
}
|
|
47020
47155
|
|
|
47021
|
-
/**
|
|
47022
|
-
* Deserializes the light prove from the given JSON.
|
|
47023
|
-
*
|
|
47024
|
-
* @param {Object} json - The JSON holding the serialized light probe.
|
|
47025
|
-
* @return {LightProbe} A reference to this light probe.
|
|
47026
|
-
*/
|
|
47027
|
-
fromJSON( json ) {
|
|
47028
|
-
|
|
47029
|
-
this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
|
|
47030
|
-
this.sh.fromArray( json.sh );
|
|
47031
|
-
|
|
47032
|
-
return this;
|
|
47033
|
-
|
|
47034
|
-
}
|
|
47035
|
-
|
|
47036
47156
|
toJSON( meta ) {
|
|
47037
47157
|
|
|
47038
47158
|
const data = super.toJSON( meta );
|
|
@@ -47046,7 +47166,7 @@ class LightProbe extends Light {
|
|
|
47046
47166
|
}
|
|
47047
47167
|
|
|
47048
47168
|
/**
|
|
47049
|
-
* Class for loading
|
|
47169
|
+
* Class for loading materials. The files are internally
|
|
47050
47170
|
* loaded via {@link FileLoader}.
|
|
47051
47171
|
*
|
|
47052
47172
|
* ```js
|
|
@@ -47220,6 +47340,7 @@ class MaterialLoader extends Loader {
|
|
|
47220
47340
|
if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
|
|
47221
47341
|
if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
|
|
47222
47342
|
if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
|
|
47343
|
+
if ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;
|
|
47223
47344
|
|
|
47224
47345
|
if ( json.visible !== undefined ) material.visible = json.visible;
|
|
47225
47346
|
|
|
@@ -48654,7 +48775,8 @@ class ObjectLoader extends Loader {
|
|
|
48654
48775
|
|
|
48655
48776
|
case 'LightProbe':
|
|
48656
48777
|
|
|
48657
|
-
|
|
48778
|
+
const sh = new SphericalHarmonics3().fromArray( data.sh );
|
|
48779
|
+
object = new LightProbe( sh, data.intensity );
|
|
48658
48780
|
|
|
48659
48781
|
break;
|
|
48660
48782
|
|
|
@@ -54880,7 +55002,7 @@ class Raycaster {
|
|
|
54880
55002
|
this.near = near;
|
|
54881
55003
|
|
|
54882
55004
|
/**
|
|
54883
|
-
* All results returned are
|
|
55005
|
+
* All results returned are closer than far. Far can't be lower than near.
|
|
54884
55006
|
*
|
|
54885
55007
|
* @type {number}
|
|
54886
55008
|
* @default Infinity
|
|
@@ -55009,7 +55131,7 @@ class Raycaster {
|
|
|
55009
55131
|
* @property {Object3D} object - The 3D object that has been intersected.
|
|
55010
55132
|
* @property {Vector2} uv - U,V coordinates at point of intersection.
|
|
55011
55133
|
* @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection.
|
|
55012
|
-
* @property {Vector3}
|
|
55134
|
+
* @property {Vector3} normal - Interpolated normal vector at point of intersection.
|
|
55013
55135
|
* @property {number} instanceId - The index number of the instance where the ray
|
|
55014
55136
|
* intersects the {@link InstancedMesh}.
|
|
55015
55137
|
*/
|
|
@@ -56744,7 +56866,7 @@ class PointLightHelper extends Mesh {
|
|
|
56744
56866
|
/**
|
|
56745
56867
|
* The light being visualized.
|
|
56746
56868
|
*
|
|
56747
|
-
* @type {
|
|
56869
|
+
* @type {PointLight}
|
|
56748
56870
|
*/
|
|
56749
56871
|
this.light = light;
|
|
56750
56872
|
|
|
@@ -58784,8 +58906,12 @@ function getByteLength( width, height, format, type ) {
|
|
|
58784
58906
|
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
|
|
58785
58907
|
case RGB_ETC1_Format:
|
|
58786
58908
|
case RGB_ETC2_Format:
|
|
58909
|
+
case R11_EAC_Format:
|
|
58910
|
+
case SIGNED_R11_EAC_Format:
|
|
58787
58911
|
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
58788
58912
|
case RGBA_ETC2_EAC_Format:
|
|
58913
|
+
case RG11_EAC_Format:
|
|
58914
|
+
case SIGNED_RG11_EAC_Format:
|
|
58789
58915
|
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
58790
58916
|
|
|
58791
58917
|
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
|
|
@@ -59345,11 +59471,11 @@ var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor
|
|
|
59345
59471
|
|
|
59346
59472
|
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";
|
|
59347
59473
|
|
|
59348
|
-
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 =
|
|
59474
|
+
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = 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 = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, 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.0001, 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";
|
|
59349
59475
|
|
|
59350
|
-
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct 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 * transpose( 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\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\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}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\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_Multiscatter( 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}";
|
|
59476
|
+
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\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\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\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 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.specularColorBlended;\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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\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\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\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}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\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.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * 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 \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\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\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\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 ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\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}";
|
|
59351
59477
|
|
|
59352
|
-
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.
|
|
59478
|
+
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.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\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 ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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";
|
|
59353
59479
|
|
|
59354
59480
|
var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
|
|
59355
59481
|
|
|
@@ -59423,13 +59549,13 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
59423
59549
|
|
|
59424
59550
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
59425
59551
|
|
|
59426
|
-
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 shadowIntensity;\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 shadowIntensity;\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
|
|
59552
|
+
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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadow = step( depth, dp );\n\t\t\t#else\n\t\t\t\tshadow = step( dp, depth );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif";
|
|
59427
59553
|
|
|
59428
59554
|
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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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";
|
|
59429
59555
|
|
|
59430
59556
|
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif";
|
|
59431
59557
|
|
|
59432
|
-
var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
|
|
59558
|
+
var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
|
|
59433
59559
|
|
|
59434
59560
|
var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
|
|
59435
59561
|
|
|
@@ -59447,7 +59573,7 @@ var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = to
|
|
|
59447
59573
|
|
|
59448
59574
|
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 CineonToneMapping( 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; }";
|
|
59449
59575
|
|
|
59450
|
-
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.
|
|
59576
|
+
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.diffuseContribution, material.specularColorBlended, 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";
|
|
59451
59577
|
|
|
59452
59578
|
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\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\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#else\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#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";
|
|
59453
59579
|
|
|
@@ -59477,7 +59603,7 @@ const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\
|
|
|
59477
59603
|
|
|
59478
59604
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
59479
59605
|
|
|
59480
|
-
const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <
|
|
59606
|
+
const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\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 <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}";
|
|
59481
59607
|
|
|
59482
59608
|
const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
|
|
59483
59609
|
|
|
@@ -59493,7 +59619,7 @@ const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_
|
|
|
59493
59619
|
|
|
59494
59620
|
const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_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 <batching_vertex>\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
59495
59621
|
|
|
59496
|
-
const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <
|
|
59622
|
+
const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
|
|
59497
59623
|
|
|
59498
59624
|
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
59499
59625
|
|
|
@@ -59501,19 +59627,19 @@ const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity
|
|
|
59501
59627
|
|
|
59502
59628
|
const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
|
|
59503
59629
|
|
|
59504
|
-
const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <
|
|
59630
|
+
const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
|
|
59505
59631
|
|
|
59506
59632
|
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_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 <batching_vertex>\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
59507
59633
|
|
|
59508
|
-
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <
|
|
59634
|
+
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
|
|
59509
59635
|
|
|
59510
59636
|
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 <batching_vertex>\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_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}";
|
|
59511
59637
|
|
|
59512
|
-
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 <
|
|
59638
|
+
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 <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 <triplanar_fragment>\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 \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \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}";
|
|
59513
59639
|
|
|
59514
59640
|
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 <batching_vertex>\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_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}";
|
|
59515
59641
|
|
|
59516
|
-
const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <
|
|
59642
|
+
const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\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}";
|
|
59517
59643
|
|
|
59518
59644
|
const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <batching_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
|
|
59519
59645
|
|
|
@@ -59521,7 +59647,7 @@ const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <com
|
|
|
59521
59647
|
|
|
59522
59648
|
const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
59523
59649
|
|
|
59524
|
-
const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <
|
|
59650
|
+
const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
59525
59651
|
|
|
59526
59652
|
const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
|
|
59527
59653
|
|
|
@@ -59645,8 +59771,8 @@ const ShaderChunk = {
|
|
|
59645
59771
|
cube_frag: fragment$f,
|
|
59646
59772
|
depth_vert: vertex$e,
|
|
59647
59773
|
depth_frag: fragment$e,
|
|
59648
|
-
|
|
59649
|
-
|
|
59774
|
+
distance_vert: vertex$d,
|
|
59775
|
+
distance_frag: fragment$d,
|
|
59650
59776
|
equirect_vert: vertex$c,
|
|
59651
59777
|
equirect_frag: fragment$c,
|
|
59652
59778
|
linedashed_vert: vertex$b,
|
|
@@ -60162,7 +60288,7 @@ const ShaderLib = {
|
|
|
60162
60288
|
|
|
60163
60289
|
},
|
|
60164
60290
|
|
|
60165
|
-
|
|
60291
|
+
distance: {
|
|
60166
60292
|
|
|
60167
60293
|
uniforms: /*@__PURE__*/ mergeUniforms( [
|
|
60168
60294
|
UniformsLib.common,
|
|
@@ -60174,8 +60300,8 @@ const ShaderLib = {
|
|
|
60174
60300
|
}
|
|
60175
60301
|
] ),
|
|
60176
60302
|
|
|
60177
|
-
vertexShader: ShaderChunk.
|
|
60178
|
-
fragmentShader: ShaderChunk.
|
|
60303
|
+
vertexShader: ShaderChunk.distance_vert,
|
|
60304
|
+
fragmentShader: ShaderChunk.distance_frag
|
|
60179
60305
|
|
|
60180
60306
|
},
|
|
60181
60307
|
|
|
@@ -61324,9 +61450,8 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
61324
61450
|
const maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );
|
|
61325
61451
|
const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
|
|
61326
61452
|
|
|
61327
|
-
const vertexTextures = maxVertexTextures > 0;
|
|
61328
|
-
|
|
61329
61453
|
const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
|
|
61454
|
+
const samples = gl.getParameter( gl.SAMPLES );
|
|
61330
61455
|
|
|
61331
61456
|
return {
|
|
61332
61457
|
|
|
@@ -61352,9 +61477,9 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
61352
61477
|
maxVaryings: maxVaryings,
|
|
61353
61478
|
maxFragmentUniforms: maxFragmentUniforms,
|
|
61354
61479
|
|
|
61355
|
-
|
|
61480
|
+
maxSamples: maxSamples,
|
|
61356
61481
|
|
|
61357
|
-
|
|
61482
|
+
samples: samples
|
|
61358
61483
|
|
|
61359
61484
|
};
|
|
61360
61485
|
|
|
@@ -61700,7 +61825,7 @@ class PMREMGenerator {
|
|
|
61700
61825
|
* @param {number} [far=100] - The far plane distance.
|
|
61701
61826
|
* @param {Object} [options={}] - The configuration options.
|
|
61702
61827
|
* @param {number} [options.size=256] - The texture size of the PMREM.
|
|
61703
|
-
* @param {Vector3} [options.
|
|
61828
|
+
* @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene.
|
|
61704
61829
|
* @return {WebGLRenderTarget} The resulting PMREM.
|
|
61705
61830
|
*/
|
|
61706
61831
|
fromScene( scene, sigma = 0, near = 0.1, far = 100, options = {} ) {
|
|
@@ -61911,6 +62036,7 @@ class PMREMGenerator {
|
|
|
61911
62036
|
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
61912
62037
|
|
|
61913
62038
|
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
62039
|
+
this._ggxMaterial = _getGGXShader( _lodMax, width, height );
|
|
61914
62040
|
|
|
61915
62041
|
}
|
|
61916
62042
|
|
|
@@ -62116,14 +62242,6 @@ class PMREMGenerator {
|
|
|
62116
62242
|
const renderer = this._renderer;
|
|
62117
62243
|
const pingPongRenderTarget = this._pingPongRenderTarget;
|
|
62118
62244
|
|
|
62119
|
-
if ( this._ggxMaterial === null ) {
|
|
62120
|
-
|
|
62121
|
-
const width = 3 * Math.max( this._cubeSize, 16 );
|
|
62122
|
-
const height = 4 * this._cubeSize;
|
|
62123
|
-
this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
|
|
62124
|
-
|
|
62125
|
-
}
|
|
62126
|
-
|
|
62127
62245
|
const ggxMaterial = this._ggxMaterial;
|
|
62128
62246
|
const ggxMesh = this._lodMeshes[ lodOut ];
|
|
62129
62247
|
ggxMesh.material = ggxMaterial;
|
|
@@ -62136,7 +62254,7 @@ class PMREMGenerator {
|
|
|
62136
62254
|
const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
|
|
62137
62255
|
|
|
62138
62256
|
// Apply blur strength mapping for better quality across the roughness range
|
|
62139
|
-
const blurStrength = 0.
|
|
62257
|
+
const blurStrength = 0.0 + targetRoughness * 1.25;
|
|
62140
62258
|
const adjustedRoughness = incrementalRoughness * blurStrength;
|
|
62141
62259
|
|
|
62142
62260
|
// Calculate viewport position based on output LOD level
|
|
@@ -63555,6 +63673,252 @@ function WebGLObjects( gl, geometries, attributes, info ) {
|
|
|
63555
63673
|
|
|
63556
63674
|
}
|
|
63557
63675
|
|
|
63676
|
+
const toneMappingMap = {
|
|
63677
|
+
[ LinearToneMapping ]: 'LINEAR_TONE_MAPPING',
|
|
63678
|
+
[ ReinhardToneMapping ]: 'REINHARD_TONE_MAPPING',
|
|
63679
|
+
[ CineonToneMapping ]: 'CINEON_TONE_MAPPING',
|
|
63680
|
+
[ ACESFilmicToneMapping ]: 'ACES_FILMIC_TONE_MAPPING',
|
|
63681
|
+
[ AgXToneMapping ]: 'AGX_TONE_MAPPING',
|
|
63682
|
+
[ NeutralToneMapping ]: 'NEUTRAL_TONE_MAPPING',
|
|
63683
|
+
[ CustomToneMapping ]: 'CUSTOM_TONE_MAPPING'
|
|
63684
|
+
};
|
|
63685
|
+
|
|
63686
|
+
function WebGLOutput( type, width, height, depth, stencil ) {
|
|
63687
|
+
|
|
63688
|
+
// render targets for scene and post-processing
|
|
63689
|
+
const targetA = new WebGLRenderTarget( width, height, {
|
|
63690
|
+
type: type,
|
|
63691
|
+
depthBuffer: depth,
|
|
63692
|
+
stencilBuffer: stencil
|
|
63693
|
+
} );
|
|
63694
|
+
|
|
63695
|
+
const targetB = new WebGLRenderTarget( width, height, {
|
|
63696
|
+
type: HalfFloatType,
|
|
63697
|
+
depthBuffer: false,
|
|
63698
|
+
stencilBuffer: false
|
|
63699
|
+
} );
|
|
63700
|
+
|
|
63701
|
+
// create fullscreen triangle geometry
|
|
63702
|
+
const geometry = new BufferGeometry();
|
|
63703
|
+
geometry.setAttribute( 'position', new Float32BufferAttribute( [ -1, 3, 0, -1, -1, 0, 3, -1, 0 ], 3 ) );
|
|
63704
|
+
geometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
|
|
63705
|
+
|
|
63706
|
+
// create output material with tone mapping support
|
|
63707
|
+
const material = new RawShaderMaterial( {
|
|
63708
|
+
uniforms: {
|
|
63709
|
+
tDiffuse: { value: null }
|
|
63710
|
+
},
|
|
63711
|
+
vertexShader: /* glsl */`
|
|
63712
|
+
precision highp float;
|
|
63713
|
+
|
|
63714
|
+
uniform mat4 modelViewMatrix;
|
|
63715
|
+
uniform mat4 projectionMatrix;
|
|
63716
|
+
|
|
63717
|
+
attribute vec3 position;
|
|
63718
|
+
attribute vec2 uv;
|
|
63719
|
+
|
|
63720
|
+
varying vec2 vUv;
|
|
63721
|
+
|
|
63722
|
+
void main() {
|
|
63723
|
+
vUv = uv;
|
|
63724
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
63725
|
+
}`,
|
|
63726
|
+
fragmentShader: /* glsl */`
|
|
63727
|
+
precision highp float;
|
|
63728
|
+
|
|
63729
|
+
uniform sampler2D tDiffuse;
|
|
63730
|
+
|
|
63731
|
+
varying vec2 vUv;
|
|
63732
|
+
|
|
63733
|
+
#include <tonemapping_pars_fragment>
|
|
63734
|
+
#include <colorspace_pars_fragment>
|
|
63735
|
+
|
|
63736
|
+
void main() {
|
|
63737
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
63738
|
+
|
|
63739
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
63740
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
63741
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
63742
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
63743
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
63744
|
+
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
63745
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
63746
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
63747
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
63748
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
63749
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
63750
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
63751
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
63752
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
63753
|
+
#endif
|
|
63754
|
+
|
|
63755
|
+
#ifdef SRGB_TRANSFER
|
|
63756
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
63757
|
+
#endif
|
|
63758
|
+
}`,
|
|
63759
|
+
depthTest: false,
|
|
63760
|
+
depthWrite: false
|
|
63761
|
+
} );
|
|
63762
|
+
|
|
63763
|
+
const mesh = new Mesh( geometry, material );
|
|
63764
|
+
const camera = new OrthographicCamera( -1, 1, 1, -1, 0, 1 );
|
|
63765
|
+
|
|
63766
|
+
let _outputColorSpace = null;
|
|
63767
|
+
let _outputToneMapping = null;
|
|
63768
|
+
let _isCompositing = false;
|
|
63769
|
+
let _savedToneMapping;
|
|
63770
|
+
let _savedRenderTarget = null;
|
|
63771
|
+
let _effects = [];
|
|
63772
|
+
let _hasRenderPass = false;
|
|
63773
|
+
|
|
63774
|
+
this.setSize = function ( width, height ) {
|
|
63775
|
+
|
|
63776
|
+
targetA.setSize( width, height );
|
|
63777
|
+
targetB.setSize( width, height );
|
|
63778
|
+
|
|
63779
|
+
for ( let i = 0; i < _effects.length; i ++ ) {
|
|
63780
|
+
|
|
63781
|
+
const effect = _effects[ i ];
|
|
63782
|
+
if ( effect.setSize ) effect.setSize( width, height );
|
|
63783
|
+
|
|
63784
|
+
}
|
|
63785
|
+
|
|
63786
|
+
};
|
|
63787
|
+
|
|
63788
|
+
this.setEffects = function ( effects ) {
|
|
63789
|
+
|
|
63790
|
+
_effects = effects;
|
|
63791
|
+
_hasRenderPass = _effects.length > 0 && _effects[ 0 ].isRenderPass === true;
|
|
63792
|
+
|
|
63793
|
+
const width = targetA.width;
|
|
63794
|
+
const height = targetA.height;
|
|
63795
|
+
|
|
63796
|
+
for ( let i = 0; i < _effects.length; i ++ ) {
|
|
63797
|
+
|
|
63798
|
+
const effect = _effects[ i ];
|
|
63799
|
+
if ( effect.setSize ) effect.setSize( width, height );
|
|
63800
|
+
|
|
63801
|
+
}
|
|
63802
|
+
|
|
63803
|
+
};
|
|
63804
|
+
|
|
63805
|
+
this.begin = function ( renderer, renderTarget ) {
|
|
63806
|
+
|
|
63807
|
+
// Don't begin during compositing phase (post-processing effects call render())
|
|
63808
|
+
if ( _isCompositing ) return false;
|
|
63809
|
+
|
|
63810
|
+
if ( renderer.toneMapping === NoToneMapping && _effects.length === 0 ) return false;
|
|
63811
|
+
|
|
63812
|
+
_savedRenderTarget = renderTarget;
|
|
63813
|
+
|
|
63814
|
+
// resize internal buffers to match render target (e.g. XR resolution)
|
|
63815
|
+
if ( renderTarget !== null ) {
|
|
63816
|
+
|
|
63817
|
+
const width = renderTarget.width;
|
|
63818
|
+
const height = renderTarget.height;
|
|
63819
|
+
|
|
63820
|
+
if ( targetA.width !== width || targetA.height !== height ) {
|
|
63821
|
+
|
|
63822
|
+
this.setSize( width, height );
|
|
63823
|
+
|
|
63824
|
+
}
|
|
63825
|
+
|
|
63826
|
+
}
|
|
63827
|
+
|
|
63828
|
+
// if first effect is a RenderPass, it will set its own render target
|
|
63829
|
+
if ( _hasRenderPass === false ) {
|
|
63830
|
+
|
|
63831
|
+
renderer.setRenderTarget( targetA );
|
|
63832
|
+
|
|
63833
|
+
}
|
|
63834
|
+
|
|
63835
|
+
// disable tone mapping during render - it will be applied in end()
|
|
63836
|
+
_savedToneMapping = renderer.toneMapping;
|
|
63837
|
+
renderer.toneMapping = NoToneMapping;
|
|
63838
|
+
|
|
63839
|
+
return true;
|
|
63840
|
+
|
|
63841
|
+
};
|
|
63842
|
+
|
|
63843
|
+
this.hasRenderPass = function () {
|
|
63844
|
+
|
|
63845
|
+
return _hasRenderPass;
|
|
63846
|
+
|
|
63847
|
+
};
|
|
63848
|
+
|
|
63849
|
+
this.end = function ( renderer, deltaTime ) {
|
|
63850
|
+
|
|
63851
|
+
// restore tone mapping
|
|
63852
|
+
renderer.toneMapping = _savedToneMapping;
|
|
63853
|
+
|
|
63854
|
+
_isCompositing = true;
|
|
63855
|
+
|
|
63856
|
+
// run post-processing effects
|
|
63857
|
+
let readBuffer = targetA;
|
|
63858
|
+
let writeBuffer = targetB;
|
|
63859
|
+
|
|
63860
|
+
for ( let i = 0; i < _effects.length; i ++ ) {
|
|
63861
|
+
|
|
63862
|
+
const effect = _effects[ i ];
|
|
63863
|
+
|
|
63864
|
+
if ( effect.enabled === false ) continue;
|
|
63865
|
+
|
|
63866
|
+
effect.render( renderer, writeBuffer, readBuffer, deltaTime );
|
|
63867
|
+
|
|
63868
|
+
if ( effect.needsSwap !== false ) {
|
|
63869
|
+
|
|
63870
|
+
const temp = readBuffer;
|
|
63871
|
+
readBuffer = writeBuffer;
|
|
63872
|
+
writeBuffer = temp;
|
|
63873
|
+
|
|
63874
|
+
}
|
|
63875
|
+
|
|
63876
|
+
}
|
|
63877
|
+
|
|
63878
|
+
// update output material defines if settings changed
|
|
63879
|
+
if ( _outputColorSpace !== renderer.outputColorSpace || _outputToneMapping !== renderer.toneMapping ) {
|
|
63880
|
+
|
|
63881
|
+
_outputColorSpace = renderer.outputColorSpace;
|
|
63882
|
+
_outputToneMapping = renderer.toneMapping;
|
|
63883
|
+
|
|
63884
|
+
material.defines = {};
|
|
63885
|
+
|
|
63886
|
+
if ( ColorManagement.getTransfer( _outputColorSpace ) === SRGBTransfer ) material.defines.SRGB_TRANSFER = '';
|
|
63887
|
+
|
|
63888
|
+
const toneMapping = toneMappingMap[ _outputToneMapping ];
|
|
63889
|
+
if ( toneMapping ) material.defines[ toneMapping ] = '';
|
|
63890
|
+
|
|
63891
|
+
material.needsUpdate = true;
|
|
63892
|
+
|
|
63893
|
+
}
|
|
63894
|
+
|
|
63895
|
+
// final output to canvas (or XR render target)
|
|
63896
|
+
material.uniforms.tDiffuse.value = readBuffer.texture;
|
|
63897
|
+
renderer.setRenderTarget( _savedRenderTarget );
|
|
63898
|
+
renderer.render( mesh, camera );
|
|
63899
|
+
|
|
63900
|
+
_savedRenderTarget = null;
|
|
63901
|
+
_isCompositing = false;
|
|
63902
|
+
|
|
63903
|
+
};
|
|
63904
|
+
|
|
63905
|
+
this.isCompositing = function () {
|
|
63906
|
+
|
|
63907
|
+
return _isCompositing;
|
|
63908
|
+
|
|
63909
|
+
};
|
|
63910
|
+
|
|
63911
|
+
this.dispose = function () {
|
|
63912
|
+
|
|
63913
|
+
targetA.dispose();
|
|
63914
|
+
targetB.dispose();
|
|
63915
|
+
geometry.dispose();
|
|
63916
|
+
material.dispose();
|
|
63917
|
+
|
|
63918
|
+
};
|
|
63919
|
+
|
|
63920
|
+
}
|
|
63921
|
+
|
|
63558
63922
|
/**
|
|
63559
63923
|
* Uniforms of a program.
|
|
63560
63924
|
* Those form a tree structure with a special top-level container for the root,
|
|
@@ -64123,7 +64487,7 @@ function setValueT1( gl, v, textures ) {
|
|
|
64123
64487
|
|
|
64124
64488
|
if ( this.type === gl.SAMPLER_2D_SHADOW ) {
|
|
64125
64489
|
|
|
64126
|
-
emptyShadowTexture.compareFunction = LessEqualCompare;
|
|
64490
|
+
emptyShadowTexture.compareFunction = textures.isReversedDepthBuffer() ? GreaterEqualCompare : LessEqualCompare;
|
|
64127
64491
|
emptyTexture2D = emptyShadowTexture;
|
|
64128
64492
|
|
|
64129
64493
|
} else {
|
|
@@ -64373,9 +64737,21 @@ function setValueT1Array( gl, v, textures ) {
|
|
|
64373
64737
|
|
|
64374
64738
|
}
|
|
64375
64739
|
|
|
64740
|
+
let emptyTexture2D;
|
|
64741
|
+
|
|
64742
|
+
if ( this.type === gl.SAMPLER_2D_SHADOW ) {
|
|
64743
|
+
|
|
64744
|
+
emptyTexture2D = emptyShadowTexture;
|
|
64745
|
+
|
|
64746
|
+
} else {
|
|
64747
|
+
|
|
64748
|
+
emptyTexture2D = emptyTexture;
|
|
64749
|
+
|
|
64750
|
+
}
|
|
64751
|
+
|
|
64376
64752
|
for ( let i = 0; i !== n; ++ i ) {
|
|
64377
64753
|
|
|
64378
|
-
textures.setTexture2D( v[ i ] ||
|
|
64754
|
+
textures.setTexture2D( v[ i ] || emptyTexture2D, units[ i ] );
|
|
64379
64755
|
|
|
64380
64756
|
}
|
|
64381
64757
|
|
|
@@ -64661,6 +65037,31 @@ class WebGLUniforms {
|
|
|
64661
65037
|
|
|
64662
65038
|
}
|
|
64663
65039
|
|
|
65040
|
+
// Sort uniforms to prioritize shadow samplers first (for optimal texture unit allocation)
|
|
65041
|
+
|
|
65042
|
+
const shadowSamplers = [];
|
|
65043
|
+
const otherUniforms = [];
|
|
65044
|
+
|
|
65045
|
+
for ( const u of this.seq ) {
|
|
65046
|
+
|
|
65047
|
+
if ( u.type === gl.SAMPLER_2D_SHADOW || u.type === gl.SAMPLER_CUBE_SHADOW || u.type === gl.SAMPLER_2D_ARRAY_SHADOW ) {
|
|
65048
|
+
|
|
65049
|
+
shadowSamplers.push( u );
|
|
65050
|
+
|
|
65051
|
+
} else {
|
|
65052
|
+
|
|
65053
|
+
otherUniforms.push( u );
|
|
65054
|
+
|
|
65055
|
+
}
|
|
65056
|
+
|
|
65057
|
+
}
|
|
65058
|
+
|
|
65059
|
+
if ( shadowSamplers.length > 0 ) {
|
|
65060
|
+
|
|
65061
|
+
this.seq = shadowSamplers.concat( otherUniforms );
|
|
65062
|
+
|
|
65063
|
+
}
|
|
65064
|
+
|
|
64664
65065
|
}
|
|
64665
65066
|
|
|
64666
65067
|
setValue( gl, name, value, textures ) {
|
|
@@ -64815,43 +65216,24 @@ function getTexelEncodingFunction( functionName, colorSpace ) {
|
|
|
64815
65216
|
|
|
64816
65217
|
}
|
|
64817
65218
|
|
|
64818
|
-
|
|
64819
|
-
|
|
64820
|
-
|
|
64821
|
-
|
|
64822
|
-
|
|
64823
|
-
|
|
64824
|
-
|
|
64825
|
-
|
|
64826
|
-
|
|
64827
|
-
|
|
64828
|
-
case ReinhardToneMapping:
|
|
64829
|
-
toneMappingName = 'Reinhard';
|
|
64830
|
-
break;
|
|
64831
|
-
|
|
64832
|
-
case CineonToneMapping:
|
|
64833
|
-
toneMappingName = 'Cineon';
|
|
64834
|
-
break;
|
|
64835
|
-
|
|
64836
|
-
case ACESFilmicToneMapping:
|
|
64837
|
-
toneMappingName = 'ACESFilmic';
|
|
64838
|
-
break;
|
|
65219
|
+
const toneMappingFunctions = {
|
|
65220
|
+
[ LinearToneMapping ]: 'Linear',
|
|
65221
|
+
[ ReinhardToneMapping ]: 'Reinhard',
|
|
65222
|
+
[ CineonToneMapping ]: 'Cineon',
|
|
65223
|
+
[ ACESFilmicToneMapping ]: 'ACESFilmic',
|
|
65224
|
+
[ AgXToneMapping ]: 'AgX',
|
|
65225
|
+
[ NeutralToneMapping ]: 'Neutral',
|
|
65226
|
+
[ CustomToneMapping ]: 'Custom'
|
|
65227
|
+
};
|
|
64839
65228
|
|
|
64840
|
-
|
|
64841
|
-
toneMappingName = 'AgX';
|
|
64842
|
-
break;
|
|
65229
|
+
function getToneMappingFunction( functionName, toneMapping ) {
|
|
64843
65230
|
|
|
64844
|
-
|
|
64845
|
-
toneMappingName = 'Neutral';
|
|
64846
|
-
break;
|
|
65231
|
+
const toneMappingName = toneMappingFunctions[ toneMapping ];
|
|
64847
65232
|
|
|
64848
|
-
|
|
64849
|
-
toneMappingName = 'Custom';
|
|
64850
|
-
break;
|
|
65233
|
+
if ( toneMappingName === undefined ) {
|
|
64851
65234
|
|
|
64852
|
-
|
|
64853
|
-
|
|
64854
|
-
toneMappingName = 'Linear';
|
|
65235
|
+
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
|
|
65236
|
+
return 'vec3 ' + functionName + '( vec3 color ) { return LinearToneMapping( color ); }';
|
|
64855
65237
|
|
|
64856
65238
|
}
|
|
64857
65239
|
|
|
@@ -65079,99 +65461,54 @@ function generatePrecision( parameters ) {
|
|
|
65079
65461
|
|
|
65080
65462
|
}
|
|
65081
65463
|
|
|
65082
|
-
|
|
65083
|
-
|
|
65084
|
-
|
|
65085
|
-
|
|
65086
|
-
if ( parameters.shadowMapType === PCFShadowMap ) {
|
|
65087
|
-
|
|
65088
|
-
shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';
|
|
65089
|
-
|
|
65090
|
-
} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {
|
|
65091
|
-
|
|
65092
|
-
shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';
|
|
65093
|
-
|
|
65094
|
-
} else if ( parameters.shadowMapType === VSMShadowMap ) {
|
|
65095
|
-
|
|
65096
|
-
shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';
|
|
65464
|
+
const shadowMapTypeDefines = {
|
|
65465
|
+
[ PCFShadowMap ]: 'SHADOWMAP_TYPE_PCF',
|
|
65466
|
+
[ VSMShadowMap ]: 'SHADOWMAP_TYPE_VSM'
|
|
65467
|
+
};
|
|
65097
65468
|
|
|
65098
|
-
|
|
65469
|
+
function generateShadowMapTypeDefine( parameters ) {
|
|
65099
65470
|
|
|
65100
|
-
return
|
|
65471
|
+
return shadowMapTypeDefines[ parameters.shadowMapType ] || 'SHADOWMAP_TYPE_BASIC';
|
|
65101
65472
|
|
|
65102
65473
|
}
|
|
65103
65474
|
|
|
65104
|
-
|
|
65105
|
-
|
|
65106
|
-
|
|
65107
|
-
|
|
65108
|
-
|
|
65109
|
-
|
|
65110
|
-
switch ( parameters.envMapMode ) {
|
|
65111
|
-
|
|
65112
|
-
case CubeReflectionMapping:
|
|
65113
|
-
case CubeRefractionMapping:
|
|
65114
|
-
envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
|
|
65115
|
-
break;
|
|
65475
|
+
const envMapTypeDefines = {
|
|
65476
|
+
[ CubeReflectionMapping ]: 'ENVMAP_TYPE_CUBE',
|
|
65477
|
+
[ CubeRefractionMapping ]: 'ENVMAP_TYPE_CUBE',
|
|
65478
|
+
[ CubeUVReflectionMapping ]: 'ENVMAP_TYPE_CUBE_UV'
|
|
65479
|
+
};
|
|
65116
65480
|
|
|
65117
|
-
|
|
65118
|
-
envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';
|
|
65119
|
-
break;
|
|
65481
|
+
function generateEnvMapTypeDefine( parameters ) {
|
|
65120
65482
|
|
|
65121
|
-
|
|
65483
|
+
if ( parameters.envMap === false ) return 'ENVMAP_TYPE_CUBE';
|
|
65122
65484
|
|
|
65123
|
-
|
|
65124
|
-
|
|
65125
|
-
return envMapTypeDefine;
|
|
65485
|
+
return envMapTypeDefines[ parameters.envMapMode ] || 'ENVMAP_TYPE_CUBE';
|
|
65126
65486
|
|
|
65127
65487
|
}
|
|
65128
65488
|
|
|
65129
|
-
|
|
65130
|
-
|
|
65131
|
-
|
|
65132
|
-
|
|
65133
|
-
if ( parameters.envMap ) {
|
|
65134
|
-
|
|
65135
|
-
switch ( parameters.envMapMode ) {
|
|
65136
|
-
|
|
65137
|
-
case CubeRefractionMapping:
|
|
65138
|
-
|
|
65139
|
-
envMapModeDefine = 'ENVMAP_MODE_REFRACTION';
|
|
65140
|
-
break;
|
|
65489
|
+
const envMapModeDefines = {
|
|
65490
|
+
[ CubeRefractionMapping ]: 'ENVMAP_MODE_REFRACTION'
|
|
65491
|
+
};
|
|
65141
65492
|
|
|
65142
|
-
|
|
65493
|
+
function generateEnvMapModeDefine( parameters ) {
|
|
65143
65494
|
|
|
65144
|
-
|
|
65495
|
+
if ( parameters.envMap === false ) return 'ENVMAP_MODE_REFLECTION';
|
|
65145
65496
|
|
|
65146
|
-
return
|
|
65497
|
+
return envMapModeDefines[ parameters.envMapMode ] || 'ENVMAP_MODE_REFLECTION';
|
|
65147
65498
|
|
|
65148
65499
|
}
|
|
65149
65500
|
|
|
65150
|
-
|
|
65151
|
-
|
|
65152
|
-
|
|
65153
|
-
|
|
65154
|
-
|
|
65155
|
-
|
|
65156
|
-
switch ( parameters.combine ) {
|
|
65157
|
-
|
|
65158
|
-
case MultiplyOperation:
|
|
65159
|
-
envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';
|
|
65160
|
-
break;
|
|
65161
|
-
|
|
65162
|
-
case MixOperation:
|
|
65163
|
-
envMapBlendingDefine = 'ENVMAP_BLENDING_MIX';
|
|
65164
|
-
break;
|
|
65165
|
-
|
|
65166
|
-
case AddOperation:
|
|
65167
|
-
envMapBlendingDefine = 'ENVMAP_BLENDING_ADD';
|
|
65168
|
-
break;
|
|
65501
|
+
const envMapBlendingDefines = {
|
|
65502
|
+
[ MultiplyOperation ]: 'ENVMAP_BLENDING_MULTIPLY',
|
|
65503
|
+
[ MixOperation ]: 'ENVMAP_BLENDING_MIX',
|
|
65504
|
+
[ AddOperation ]: 'ENVMAP_BLENDING_ADD'
|
|
65505
|
+
};
|
|
65169
65506
|
|
|
65170
|
-
|
|
65507
|
+
function generateEnvMapBlendingDefine( parameters ) {
|
|
65171
65508
|
|
|
65172
|
-
|
|
65509
|
+
if ( parameters.envMap === false ) return 'ENVMAP_BLENDING_NONE';
|
|
65173
65510
|
|
|
65174
|
-
return
|
|
65511
|
+
return envMapBlendingDefines[ parameters.combine ] || 'ENVMAP_BLENDING_NONE';
|
|
65175
65512
|
|
|
65176
65513
|
}
|
|
65177
65514
|
|
|
@@ -65956,15 +66293,15 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65956
66293
|
const _customShaders = new WebGLShaderCache();
|
|
65957
66294
|
const _activeChannels = new Set();
|
|
65958
66295
|
const programs = [];
|
|
66296
|
+
const programsMap = new Map();
|
|
65959
66297
|
|
|
65960
66298
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
65961
|
-
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
65962
66299
|
|
|
65963
66300
|
let precision = capabilities.precision;
|
|
65964
66301
|
|
|
65965
66302
|
const shaderIDs = {
|
|
65966
66303
|
MeshDepthMaterial: 'depth',
|
|
65967
|
-
MeshDistanceMaterial: '
|
|
66304
|
+
MeshDistanceMaterial: 'distance',
|
|
65968
66305
|
MeshNormalMaterial: 'normal',
|
|
65969
66306
|
MeshBasicMaterial: 'basic',
|
|
65970
66307
|
MeshLambertMaterial: 'lambert',
|
|
@@ -66143,7 +66480,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66143
66480
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
66144
66481
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
66145
66482
|
|
|
66146
|
-
supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
|
|
66147
66483
|
outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
|
|
66148
66484
|
alphaToCoverage: !! material.alphaToCoverage,
|
|
66149
66485
|
|
|
@@ -66156,7 +66492,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66156
66492
|
lightMap: HAS_LIGHTMAP,
|
|
66157
66493
|
bumpMap: HAS_BUMPMAP,
|
|
66158
66494
|
normalMap: HAS_NORMALMAP,
|
|
66159
|
-
displacementMap:
|
|
66495
|
+
displacementMap: HAS_DISPLACEMENTMAP,
|
|
66160
66496
|
emissiveMap: HAS_EMISSIVEMAP,
|
|
66161
66497
|
|
|
66162
66498
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
@@ -66430,54 +66766,52 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66430
66766
|
|
|
66431
66767
|
_programLayers.disableAll();
|
|
66432
66768
|
|
|
66433
|
-
if ( parameters.supportsVertexTextures )
|
|
66434
|
-
_programLayers.enable( 0 );
|
|
66435
66769
|
if ( parameters.instancing )
|
|
66436
|
-
_programLayers.enable(
|
|
66770
|
+
_programLayers.enable( 0 );
|
|
66437
66771
|
if ( parameters.instancingColor )
|
|
66438
|
-
_programLayers.enable(
|
|
66772
|
+
_programLayers.enable( 1 );
|
|
66439
66773
|
if ( parameters.instancingMorph )
|
|
66440
|
-
_programLayers.enable(
|
|
66774
|
+
_programLayers.enable( 2 );
|
|
66441
66775
|
if ( parameters.matcap )
|
|
66442
|
-
_programLayers.enable(
|
|
66776
|
+
_programLayers.enable( 3 );
|
|
66443
66777
|
if ( parameters.envMap )
|
|
66444
|
-
_programLayers.enable(
|
|
66778
|
+
_programLayers.enable( 4 );
|
|
66445
66779
|
if ( parameters.normalMapObjectSpace )
|
|
66446
|
-
_programLayers.enable(
|
|
66780
|
+
_programLayers.enable( 5 );
|
|
66447
66781
|
if ( parameters.normalMapTangentSpace )
|
|
66448
|
-
_programLayers.enable(
|
|
66782
|
+
_programLayers.enable( 6 );
|
|
66449
66783
|
if ( parameters.clearcoat )
|
|
66450
|
-
_programLayers.enable(
|
|
66784
|
+
_programLayers.enable( 7 );
|
|
66451
66785
|
if ( parameters.iridescence )
|
|
66452
|
-
_programLayers.enable(
|
|
66786
|
+
_programLayers.enable( 8 );
|
|
66453
66787
|
if ( parameters.alphaTest )
|
|
66454
|
-
_programLayers.enable(
|
|
66788
|
+
_programLayers.enable( 9 );
|
|
66455
66789
|
if ( parameters.vertexColors )
|
|
66456
|
-
_programLayers.enable(
|
|
66790
|
+
_programLayers.enable( 10 );
|
|
66457
66791
|
if ( parameters.vertexAlphas )
|
|
66458
|
-
_programLayers.enable(
|
|
66792
|
+
_programLayers.enable( 11 );
|
|
66459
66793
|
if ( parameters.vertexUv1s )
|
|
66460
|
-
_programLayers.enable(
|
|
66794
|
+
_programLayers.enable( 12 );
|
|
66461
66795
|
if ( parameters.vertexUv2s )
|
|
66462
|
-
_programLayers.enable(
|
|
66796
|
+
_programLayers.enable( 13 );
|
|
66463
66797
|
if ( parameters.vertexUv3s )
|
|
66464
|
-
_programLayers.enable(
|
|
66798
|
+
_programLayers.enable( 14 );
|
|
66465
66799
|
if ( parameters.vertexTangents )
|
|
66466
|
-
_programLayers.enable(
|
|
66800
|
+
_programLayers.enable( 15 );
|
|
66467
66801
|
if ( parameters.anisotropy )
|
|
66468
|
-
_programLayers.enable(
|
|
66802
|
+
_programLayers.enable( 16 );
|
|
66469
66803
|
if ( parameters.alphaHash )
|
|
66470
|
-
_programLayers.enable(
|
|
66804
|
+
_programLayers.enable( 17 );
|
|
66471
66805
|
if ( parameters.batching )
|
|
66472
|
-
_programLayers.enable(
|
|
66806
|
+
_programLayers.enable( 18 );
|
|
66473
66807
|
if ( parameters.dispersion )
|
|
66474
|
-
_programLayers.enable(
|
|
66808
|
+
_programLayers.enable( 19 );
|
|
66475
66809
|
if ( parameters.batchingColor )
|
|
66476
|
-
_programLayers.enable(
|
|
66810
|
+
_programLayers.enable( 20 );
|
|
66477
66811
|
if ( parameters.gradientMap )
|
|
66478
|
-
_programLayers.enable(
|
|
66812
|
+
_programLayers.enable( 21 );
|
|
66479
66813
|
if ( parameters.batchingMatrix )
|
|
66480
|
-
_programLayers.enable(
|
|
66814
|
+
_programLayers.enable( 22 );
|
|
66481
66815
|
|
|
66482
66816
|
array.push( _programLayers.mask );
|
|
66483
66817
|
_programLayers.disableAll();
|
|
@@ -66553,29 +66887,19 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66553
66887
|
|
|
66554
66888
|
function acquireProgram( parameters, cacheKey ) {
|
|
66555
66889
|
|
|
66556
|
-
let program;
|
|
66557
|
-
|
|
66558
|
-
// Check if code has been already compiled
|
|
66559
|
-
for ( let p = 0, pl = programs.length; p < pl; p ++ ) {
|
|
66890
|
+
let program = programsMap.get( cacheKey );
|
|
66560
66891
|
|
|
66561
|
-
|
|
66892
|
+
if ( program !== undefined ) {
|
|
66562
66893
|
|
|
66563
|
-
|
|
66894
|
+
++ program.usedTimes;
|
|
66564
66895
|
|
|
66565
|
-
|
|
66566
|
-
++ program.usedTimes;
|
|
66567
|
-
|
|
66568
|
-
break;
|
|
66569
|
-
|
|
66570
|
-
}
|
|
66571
|
-
|
|
66572
|
-
}
|
|
66573
|
-
|
|
66574
|
-
if ( program === undefined ) {
|
|
66896
|
+
} else {
|
|
66575
66897
|
|
|
66576
66898
|
program = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );
|
|
66577
66899
|
programs.push( program );
|
|
66578
66900
|
|
|
66901
|
+
programsMap.set( cacheKey, program );
|
|
66902
|
+
|
|
66579
66903
|
}
|
|
66580
66904
|
|
|
66581
66905
|
return program;
|
|
@@ -66591,6 +66915,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66591
66915
|
programs[ i ] = programs[ programs.length - 1 ];
|
|
66592
66916
|
programs.pop();
|
|
66593
66917
|
|
|
66918
|
+
// Remove from map
|
|
66919
|
+
programsMap.delete( program.cacheKey );
|
|
66920
|
+
|
|
66594
66921
|
// Free WebGL resources
|
|
66595
66922
|
program.destroy();
|
|
66596
66923
|
|
|
@@ -67148,7 +67475,23 @@ function WebGLLights( extensions ) {
|
|
|
67148
67475
|
const intensity = light.intensity;
|
|
67149
67476
|
const distance = light.distance;
|
|
67150
67477
|
|
|
67151
|
-
|
|
67478
|
+
let shadowMap = null;
|
|
67479
|
+
|
|
67480
|
+
if ( light.shadow && light.shadow.map ) {
|
|
67481
|
+
|
|
67482
|
+
if ( light.shadow.map.texture.format === RGFormat ) {
|
|
67483
|
+
|
|
67484
|
+
// VSM uses color texture with blurred mean/std_dev
|
|
67485
|
+
shadowMap = light.shadow.map.texture;
|
|
67486
|
+
|
|
67487
|
+
} else {
|
|
67488
|
+
|
|
67489
|
+
// Other types use depth texture
|
|
67490
|
+
shadowMap = light.shadow.map.depthTexture || light.shadow.map.texture;
|
|
67491
|
+
|
|
67492
|
+
}
|
|
67493
|
+
|
|
67494
|
+
}
|
|
67152
67495
|
|
|
67153
67496
|
if ( light.isAmbientLight ) {
|
|
67154
67497
|
|
|
@@ -67583,7 +67926,21 @@ function WebGLRenderStates( extensions ) {
|
|
|
67583
67926
|
|
|
67584
67927
|
const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
|
|
67585
67928
|
|
|
67586
|
-
const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\
|
|
67929
|
+
const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\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( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}";
|
|
67930
|
+
|
|
67931
|
+
const _cubeDirections = [
|
|
67932
|
+
/*@__PURE__*/ new Vector3( 1, 0, 0 ), /*@__PURE__*/ new Vector3( -1, 0, 0 ), /*@__PURE__*/ new Vector3( 0, 1, 0 ),
|
|
67933
|
+
/*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, 0, 1 ), /*@__PURE__*/ new Vector3( 0, 0, -1 )
|
|
67934
|
+
];
|
|
67935
|
+
|
|
67936
|
+
const _cubeUps = [
|
|
67937
|
+
/*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, 0, 1 ),
|
|
67938
|
+
/*@__PURE__*/ new Vector3( 0, 0, -1 ), /*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, -1, 0 )
|
|
67939
|
+
];
|
|
67940
|
+
|
|
67941
|
+
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
67942
|
+
const _lightPositionWorld = /*@__PURE__*/ new Vector3();
|
|
67943
|
+
const _lookTarget = /*@__PURE__*/ new Vector3();
|
|
67587
67944
|
|
|
67588
67945
|
function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
67589
67946
|
|
|
@@ -67594,7 +67951,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67594
67951
|
|
|
67595
67952
|
_viewport = new Vector4(),
|
|
67596
67953
|
|
|
67597
|
-
_depthMaterial = new MeshDepthMaterial(
|
|
67954
|
+
_depthMaterial = new MeshDepthMaterial(),
|
|
67598
67955
|
_distanceMaterial = new MeshDistanceMaterial(),
|
|
67599
67956
|
|
|
67600
67957
|
_materialCache = {},
|
|
@@ -67649,6 +68006,13 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67649
68006
|
|
|
67650
68007
|
if ( lights.length === 0 ) return;
|
|
67651
68008
|
|
|
68009
|
+
if ( lights.type === PCFSoftShadowMap ) {
|
|
68010
|
+
|
|
68011
|
+
warn( 'WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.' );
|
|
68012
|
+
lights.type = PCFShadowMap;
|
|
68013
|
+
|
|
68014
|
+
}
|
|
68015
|
+
|
|
67652
68016
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
67653
68017
|
const activeCubeFace = renderer.getActiveCubeFace();
|
|
67654
68018
|
const activeMipmapLevel = renderer.getActiveMipmapLevel();
|
|
@@ -67673,8 +68037,31 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67673
68037
|
|
|
67674
68038
|
// check for shadow map type changes
|
|
67675
68039
|
|
|
67676
|
-
const
|
|
67677
|
-
|
|
68040
|
+
const typeChanged = _previousType !== this.type;
|
|
68041
|
+
|
|
68042
|
+
// When shadow map type changes, materials need recompilation because sampler types change
|
|
68043
|
+
// (sampler2DShadow for PCF vs sampler2D for Basic)
|
|
68044
|
+
if ( typeChanged ) {
|
|
68045
|
+
|
|
68046
|
+
scene.traverse( function ( object ) {
|
|
68047
|
+
|
|
68048
|
+
if ( object.material ) {
|
|
68049
|
+
|
|
68050
|
+
if ( Array.isArray( object.material ) ) {
|
|
68051
|
+
|
|
68052
|
+
object.material.forEach( mat => mat.needsUpdate = true );
|
|
68053
|
+
|
|
68054
|
+
} else {
|
|
68055
|
+
|
|
68056
|
+
object.material.needsUpdate = true;
|
|
68057
|
+
|
|
68058
|
+
}
|
|
68059
|
+
|
|
68060
|
+
}
|
|
68061
|
+
|
|
68062
|
+
} );
|
|
68063
|
+
|
|
68064
|
+
}
|
|
67678
68065
|
|
|
67679
68066
|
// render depth map
|
|
67680
68067
|
|
|
@@ -67720,42 +68107,153 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67720
68107
|
|
|
67721
68108
|
}
|
|
67722
68109
|
|
|
67723
|
-
if ( shadow.map === null ||
|
|
67724
|
-
|
|
67725
|
-
const pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};
|
|
68110
|
+
if ( shadow.map === null || typeChanged === true ) {
|
|
67726
68111
|
|
|
67727
68112
|
if ( shadow.map !== null ) {
|
|
67728
68113
|
|
|
68114
|
+
if ( shadow.map.depthTexture !== null ) {
|
|
68115
|
+
|
|
68116
|
+
shadow.map.depthTexture.dispose();
|
|
68117
|
+
shadow.map.depthTexture = null;
|
|
68118
|
+
|
|
68119
|
+
}
|
|
68120
|
+
|
|
67729
68121
|
shadow.map.dispose();
|
|
67730
68122
|
|
|
67731
68123
|
}
|
|
67732
68124
|
|
|
67733
|
-
|
|
67734
|
-
|
|
68125
|
+
if ( this.type === VSMShadowMap ) {
|
|
68126
|
+
|
|
68127
|
+
if ( light.isPointLight ) {
|
|
68128
|
+
|
|
68129
|
+
warn( 'WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.' );
|
|
68130
|
+
continue;
|
|
68131
|
+
|
|
68132
|
+
}
|
|
68133
|
+
|
|
68134
|
+
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, {
|
|
68135
|
+
format: RGFormat,
|
|
68136
|
+
type: HalfFloatType,
|
|
68137
|
+
minFilter: LinearFilter,
|
|
68138
|
+
magFilter: LinearFilter,
|
|
68139
|
+
generateMipmaps: false
|
|
68140
|
+
} );
|
|
68141
|
+
shadow.map.texture.name = light.name + '.shadowMap';
|
|
68142
|
+
|
|
68143
|
+
// Native depth texture for VSM - depth is captured here, then blurred into the color texture
|
|
68144
|
+
shadow.map.depthTexture = new DepthTexture( _shadowMapSize.x, _shadowMapSize.y, FloatType );
|
|
68145
|
+
shadow.map.depthTexture.name = light.name + '.shadowMapDepth';
|
|
68146
|
+
shadow.map.depthTexture.format = DepthFormat;
|
|
68147
|
+
shadow.map.depthTexture.compareFunction = null; // For regular sampling (not shadow comparison)
|
|
68148
|
+
shadow.map.depthTexture.minFilter = NearestFilter;
|
|
68149
|
+
shadow.map.depthTexture.magFilter = NearestFilter;
|
|
68150
|
+
|
|
68151
|
+
} else {
|
|
68152
|
+
|
|
68153
|
+
if ( light.isPointLight ) {
|
|
68154
|
+
|
|
68155
|
+
shadow.map = new WebGLCubeRenderTarget( _shadowMapSize.x );
|
|
68156
|
+
shadow.map.depthTexture = new CubeDepthTexture( _shadowMapSize.x, UnsignedIntType );
|
|
68157
|
+
|
|
68158
|
+
} else {
|
|
68159
|
+
|
|
68160
|
+
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );
|
|
68161
|
+
shadow.map.depthTexture = new DepthTexture( _shadowMapSize.x, _shadowMapSize.y, UnsignedIntType );
|
|
68162
|
+
|
|
68163
|
+
}
|
|
68164
|
+
|
|
68165
|
+
shadow.map.depthTexture.name = light.name + '.shadowMap';
|
|
68166
|
+
shadow.map.depthTexture.format = DepthFormat;
|
|
68167
|
+
|
|
68168
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
68169
|
+
|
|
68170
|
+
if ( this.type === PCFShadowMap ) {
|
|
68171
|
+
|
|
68172
|
+
shadow.map.depthTexture.compareFunction = reversedDepthBuffer ? GreaterEqualCompare : LessEqualCompare;
|
|
68173
|
+
shadow.map.depthTexture.minFilter = LinearFilter;
|
|
68174
|
+
shadow.map.depthTexture.magFilter = LinearFilter;
|
|
68175
|
+
|
|
68176
|
+
} else {
|
|
68177
|
+
|
|
68178
|
+
shadow.map.depthTexture.compareFunction = null;
|
|
68179
|
+
shadow.map.depthTexture.minFilter = NearestFilter;
|
|
68180
|
+
shadow.map.depthTexture.magFilter = NearestFilter;
|
|
68181
|
+
|
|
68182
|
+
}
|
|
68183
|
+
|
|
68184
|
+
}
|
|
67735
68185
|
|
|
67736
68186
|
shadow.camera.updateProjectionMatrix();
|
|
67737
68187
|
|
|
67738
68188
|
}
|
|
67739
68189
|
|
|
67740
|
-
|
|
67741
|
-
|
|
68190
|
+
// For cube render targets (PointLights), render all 6 faces. Otherwise, render once.
|
|
68191
|
+
const faceCount = shadow.map.isWebGLCubeRenderTarget ? 6 : 1;
|
|
67742
68192
|
|
|
67743
|
-
|
|
68193
|
+
for ( let face = 0; face < faceCount; face ++ ) {
|
|
67744
68194
|
|
|
67745
|
-
|
|
68195
|
+
// For cube render targets, render to each face separately
|
|
68196
|
+
if ( shadow.map.isWebGLCubeRenderTarget ) {
|
|
67746
68197
|
|
|
67747
|
-
|
|
68198
|
+
renderer.setRenderTarget( shadow.map, face );
|
|
68199
|
+
renderer.clear();
|
|
67748
68200
|
|
|
67749
|
-
|
|
67750
|
-
|
|
67751
|
-
|
|
67752
|
-
|
|
67753
|
-
|
|
67754
|
-
|
|
68201
|
+
} else {
|
|
68202
|
+
|
|
68203
|
+
// For 2D render targets, use viewports
|
|
68204
|
+
if ( face === 0 ) {
|
|
68205
|
+
|
|
68206
|
+
renderer.setRenderTarget( shadow.map );
|
|
68207
|
+
renderer.clear();
|
|
68208
|
+
|
|
68209
|
+
}
|
|
68210
|
+
|
|
68211
|
+
const viewport = shadow.getViewport( face );
|
|
68212
|
+
|
|
68213
|
+
_viewport.set(
|
|
68214
|
+
_viewportSize.x * viewport.x,
|
|
68215
|
+
_viewportSize.y * viewport.y,
|
|
68216
|
+
_viewportSize.x * viewport.z,
|
|
68217
|
+
_viewportSize.y * viewport.w
|
|
68218
|
+
);
|
|
68219
|
+
|
|
68220
|
+
_state.viewport( _viewport );
|
|
68221
|
+
|
|
68222
|
+
}
|
|
68223
|
+
|
|
68224
|
+
if ( light.isPointLight ) {
|
|
68225
|
+
|
|
68226
|
+
const camera = shadow.camera;
|
|
68227
|
+
const shadowMatrix = shadow.matrix;
|
|
68228
|
+
|
|
68229
|
+
const far = light.distance || camera.far;
|
|
67755
68230
|
|
|
67756
|
-
|
|
68231
|
+
if ( far !== camera.far ) {
|
|
67757
68232
|
|
|
67758
|
-
|
|
68233
|
+
camera.far = far;
|
|
68234
|
+
camera.updateProjectionMatrix();
|
|
68235
|
+
|
|
68236
|
+
}
|
|
68237
|
+
|
|
68238
|
+
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
|
|
68239
|
+
camera.position.copy( _lightPositionWorld );
|
|
68240
|
+
|
|
68241
|
+
_lookTarget.copy( camera.position );
|
|
68242
|
+
_lookTarget.add( _cubeDirections[ face ] );
|
|
68243
|
+
camera.up.copy( _cubeUps[ face ] );
|
|
68244
|
+
camera.lookAt( _lookTarget );
|
|
68245
|
+
camera.updateMatrixWorld();
|
|
68246
|
+
|
|
68247
|
+
shadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );
|
|
68248
|
+
|
|
68249
|
+
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
68250
|
+
shadow._frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );
|
|
68251
|
+
|
|
68252
|
+
} else {
|
|
68253
|
+
|
|
68254
|
+
shadow.updateMatrices( light );
|
|
68255
|
+
|
|
68256
|
+
}
|
|
67759
68257
|
|
|
67760
68258
|
_frustum = shadow.getFrustum();
|
|
67761
68259
|
|
|
@@ -67799,13 +68297,16 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67799
68297
|
|
|
67800
68298
|
if ( shadow.mapPass === null ) {
|
|
67801
68299
|
|
|
67802
|
-
shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y
|
|
68300
|
+
shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, {
|
|
68301
|
+
format: RGFormat,
|
|
68302
|
+
type: HalfFloatType
|
|
68303
|
+
} );
|
|
67803
68304
|
|
|
67804
68305
|
}
|
|
67805
68306
|
|
|
67806
|
-
// vertical pass
|
|
68307
|
+
// vertical pass - read from native depth texture
|
|
67807
68308
|
|
|
67808
|
-
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.
|
|
68309
|
+
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;
|
|
67809
68310
|
shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
|
|
67810
68311
|
shadowMaterialVertical.uniforms.radius.value = shadow.radius;
|
|
67811
68312
|
renderer.setRenderTarget( shadow.mapPass );
|
|
@@ -68984,9 +69485,9 @@ function WebGLState( gl, extensions ) {
|
|
|
68984
69485
|
|
|
68985
69486
|
gl.compressedTexImage2D( ...arguments );
|
|
68986
69487
|
|
|
68987
|
-
} catch (
|
|
69488
|
+
} catch ( e ) {
|
|
68988
69489
|
|
|
68989
|
-
error( 'WebGLState:',
|
|
69490
|
+
error( 'WebGLState:', e );
|
|
68990
69491
|
|
|
68991
69492
|
}
|
|
68992
69493
|
|
|
@@ -68998,9 +69499,9 @@ function WebGLState( gl, extensions ) {
|
|
|
68998
69499
|
|
|
68999
69500
|
gl.compressedTexImage3D( ...arguments );
|
|
69000
69501
|
|
|
69001
|
-
} catch (
|
|
69502
|
+
} catch ( e ) {
|
|
69002
69503
|
|
|
69003
|
-
error( 'WebGLState:',
|
|
69504
|
+
error( 'WebGLState:', e );
|
|
69004
69505
|
|
|
69005
69506
|
}
|
|
69006
69507
|
|
|
@@ -69012,9 +69513,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69012
69513
|
|
|
69013
69514
|
gl.texSubImage2D( ...arguments );
|
|
69014
69515
|
|
|
69015
|
-
} catch (
|
|
69516
|
+
} catch ( e ) {
|
|
69016
69517
|
|
|
69017
|
-
error( 'WebGLState:',
|
|
69518
|
+
error( 'WebGLState:', e );
|
|
69018
69519
|
|
|
69019
69520
|
}
|
|
69020
69521
|
|
|
@@ -69026,9 +69527,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69026
69527
|
|
|
69027
69528
|
gl.texSubImage3D( ...arguments );
|
|
69028
69529
|
|
|
69029
|
-
} catch (
|
|
69530
|
+
} catch ( e ) {
|
|
69030
69531
|
|
|
69031
|
-
error( 'WebGLState:',
|
|
69532
|
+
error( 'WebGLState:', e );
|
|
69032
69533
|
|
|
69033
69534
|
}
|
|
69034
69535
|
|
|
@@ -69040,9 +69541,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69040
69541
|
|
|
69041
69542
|
gl.compressedTexSubImage2D( ...arguments );
|
|
69042
69543
|
|
|
69043
|
-
} catch (
|
|
69544
|
+
} catch ( e ) {
|
|
69044
69545
|
|
|
69045
|
-
error( 'WebGLState:',
|
|
69546
|
+
error( 'WebGLState:', e );
|
|
69046
69547
|
|
|
69047
69548
|
}
|
|
69048
69549
|
|
|
@@ -69054,9 +69555,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69054
69555
|
|
|
69055
69556
|
gl.compressedTexSubImage3D( ...arguments );
|
|
69056
69557
|
|
|
69057
|
-
} catch (
|
|
69558
|
+
} catch ( e ) {
|
|
69058
69559
|
|
|
69059
|
-
error( 'WebGLState:',
|
|
69560
|
+
error( 'WebGLState:', e );
|
|
69060
69561
|
|
|
69061
69562
|
}
|
|
69062
69563
|
|
|
@@ -69068,9 +69569,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69068
69569
|
|
|
69069
69570
|
gl.texStorage2D( ...arguments );
|
|
69070
69571
|
|
|
69071
|
-
} catch (
|
|
69572
|
+
} catch ( e ) {
|
|
69072
69573
|
|
|
69073
|
-
error( 'WebGLState:',
|
|
69574
|
+
error( 'WebGLState:', e );
|
|
69074
69575
|
|
|
69075
69576
|
}
|
|
69076
69577
|
|
|
@@ -69082,9 +69583,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69082
69583
|
|
|
69083
69584
|
gl.texStorage3D( ...arguments );
|
|
69084
69585
|
|
|
69085
|
-
} catch (
|
|
69586
|
+
} catch ( e ) {
|
|
69086
69587
|
|
|
69087
|
-
error( 'WebGLState:',
|
|
69588
|
+
error( 'WebGLState:', e );
|
|
69088
69589
|
|
|
69089
69590
|
}
|
|
69090
69591
|
|
|
@@ -69096,9 +69597,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69096
69597
|
|
|
69097
69598
|
gl.texImage2D( ...arguments );
|
|
69098
69599
|
|
|
69099
|
-
} catch (
|
|
69600
|
+
} catch ( e ) {
|
|
69100
69601
|
|
|
69101
|
-
error( 'WebGLState:',
|
|
69602
|
+
error( 'WebGLState:', e );
|
|
69102
69603
|
|
|
69103
69604
|
}
|
|
69104
69605
|
|
|
@@ -69110,9 +69611,9 @@ function WebGLState( gl, extensions ) {
|
|
|
69110
69611
|
|
|
69111
69612
|
gl.texImage3D( ...arguments );
|
|
69112
69613
|
|
|
69113
|
-
} catch (
|
|
69614
|
+
} catch ( e ) {
|
|
69114
69615
|
|
|
69115
|
-
error( 'WebGLState:',
|
|
69616
|
+
error( 'WebGLState:', e );
|
|
69116
69617
|
|
|
69117
69618
|
}
|
|
69118
69619
|
|
|
@@ -69350,9 +69851,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69350
69851
|
try {
|
|
69351
69852
|
|
|
69352
69853
|
useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'
|
|
69353
|
-
// eslint-disable-next-line compat/compat
|
|
69354
69854
|
&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;
|
|
69355
69855
|
|
|
69856
|
+
|
|
69356
69857
|
} catch ( err ) {
|
|
69357
69858
|
|
|
69358
69859
|
// Ignore any errors
|
|
@@ -69364,7 +69865,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69364
69865
|
// Use OffscreenCanvas when available. Specially needed in web workers
|
|
69365
69866
|
|
|
69366
69867
|
return useOffscreenCanvas ?
|
|
69367
|
-
// eslint-disable-next-line compat/compat
|
|
69368
69868
|
new OffscreenCanvas( width, height ) : createElementNS( 'canvas' );
|
|
69369
69869
|
|
|
69370
69870
|
}
|
|
@@ -69909,7 +70409,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69909
70409
|
|
|
69910
70410
|
const textureProperties = properties.get( texture );
|
|
69911
70411
|
|
|
69912
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
70412
|
+
if ( texture.isCubeDepthTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
69913
70413
|
|
|
69914
70414
|
uploadCubeTexture( textureProperties, texture, slot );
|
|
69915
70415
|
return;
|
|
@@ -70901,7 +71401,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70901
71401
|
}
|
|
70902
71402
|
|
|
70903
71403
|
// Setup storage for internal depth/stencil buffers and bind to correct framebuffer
|
|
70904
|
-
function setupRenderBufferStorage( renderbuffer, renderTarget,
|
|
71404
|
+
function setupRenderBufferStorage( renderbuffer, renderTarget, useMultisample ) {
|
|
70905
71405
|
|
|
70906
71406
|
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
70907
71407
|
|
|
@@ -70914,15 +71414,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70914
71414
|
const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
70915
71415
|
|
|
70916
71416
|
// set up the attachment
|
|
70917
|
-
|
|
70918
|
-
const isUseMultisampledRTT = useMultisampledRTT( renderTarget );
|
|
70919
|
-
if ( isUseMultisampledRTT ) {
|
|
71417
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
70920
71418
|
|
|
70921
|
-
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER,
|
|
71419
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );
|
|
70922
71420
|
|
|
70923
|
-
} else if (
|
|
71421
|
+
} else if ( useMultisample ) {
|
|
70924
71422
|
|
|
70925
|
-
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER,
|
|
71423
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );
|
|
70926
71424
|
|
|
70927
71425
|
} else {
|
|
70928
71426
|
|
|
@@ -70943,15 +71441,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70943
71441
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
70944
71442
|
const glType = utils.convert( texture.type );
|
|
70945
71443
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
70946
|
-
const samples = getRenderTargetSamples( renderTarget );
|
|
70947
71444
|
|
|
70948
|
-
if (
|
|
71445
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
70949
71446
|
|
|
70950
|
-
|
|
71447
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );
|
|
70951
71448
|
|
|
70952
|
-
} else if (
|
|
71449
|
+
} else if ( useMultisample ) {
|
|
70953
71450
|
|
|
70954
|
-
|
|
71451
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, getRenderTargetSamples( renderTarget ), glInternalFormat, renderTarget.width, renderTarget.height );
|
|
70955
71452
|
|
|
70956
71453
|
} else {
|
|
70957
71454
|
|
|
@@ -70968,10 +71465,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70968
71465
|
}
|
|
70969
71466
|
|
|
70970
71467
|
// Setup resources for a Depth Texture for a FBO (needs an extension)
|
|
70971
|
-
function setupDepthTexture( framebuffer, renderTarget ) {
|
|
71468
|
+
function setupDepthTexture( framebuffer, renderTarget, cubeFace ) {
|
|
70972
71469
|
|
|
70973
|
-
const isCube = ( renderTarget
|
|
70974
|
-
if ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );
|
|
71470
|
+
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
70975
71471
|
|
|
70976
71472
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
70977
71473
|
|
|
@@ -70995,20 +71491,69 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70995
71491
|
|
|
70996
71492
|
}
|
|
70997
71493
|
|
|
70998
|
-
|
|
71494
|
+
if ( isCube ) {
|
|
71495
|
+
|
|
71496
|
+
// For cube depth textures, initialize and bind without uploading image data
|
|
71497
|
+
if ( textureProperties.__webglInit === undefined ) {
|
|
71498
|
+
|
|
71499
|
+
textureProperties.__webglInit = true;
|
|
71500
|
+
renderTarget.depthTexture.addEventListener( 'dispose', onTextureDispose );
|
|
71501
|
+
|
|
71502
|
+
}
|
|
71503
|
+
|
|
71504
|
+
// Only create and allocate storage once
|
|
71505
|
+
if ( textureProperties.__webglTexture === undefined ) {
|
|
71506
|
+
|
|
71507
|
+
textureProperties.__webglTexture = _gl.createTexture();
|
|
71508
|
+
|
|
71509
|
+
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
|
|
71510
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget.depthTexture );
|
|
71511
|
+
|
|
71512
|
+
// Allocate storage for all 6 faces with correct depth texture format
|
|
71513
|
+
const glFormat = utils.convert( renderTarget.depthTexture.format );
|
|
71514
|
+
const glType = utils.convert( renderTarget.depthTexture.type );
|
|
71515
|
+
|
|
71516
|
+
// Use proper internal format for depth textures
|
|
71517
|
+
let glInternalFormat;
|
|
71518
|
+
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
71519
|
+
|
|
71520
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
71521
|
+
|
|
71522
|
+
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
71523
|
+
|
|
71524
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
71525
|
+
|
|
71526
|
+
}
|
|
71527
|
+
|
|
71528
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
71529
|
+
|
|
71530
|
+
_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
|
|
71531
|
+
|
|
71532
|
+
}
|
|
71533
|
+
|
|
71534
|
+
}
|
|
71535
|
+
|
|
71536
|
+
} else {
|
|
71537
|
+
|
|
71538
|
+
setTexture2D( renderTarget.depthTexture, 0 );
|
|
71539
|
+
|
|
71540
|
+
}
|
|
70999
71541
|
|
|
71000
71542
|
const webglDepthTexture = textureProperties.__webglTexture;
|
|
71001
71543
|
const samples = getRenderTargetSamples( renderTarget );
|
|
71002
71544
|
|
|
71545
|
+
const glTextureType = isCube ? _gl.TEXTURE_CUBE_MAP_POSITIVE_X + cubeFace : _gl.TEXTURE_2D;
|
|
71546
|
+
const glAttachmentType = renderTarget.depthTexture.format === DepthStencilFormat ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
71547
|
+
|
|
71003
71548
|
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
71004
71549
|
|
|
71005
71550
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
71006
71551
|
|
|
71007
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER,
|
|
71552
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0, samples );
|
|
71008
71553
|
|
|
71009
71554
|
} else {
|
|
71010
71555
|
|
|
71011
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER,
|
|
71556
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0 );
|
|
71012
71557
|
|
|
71013
71558
|
}
|
|
71014
71559
|
|
|
@@ -71016,11 +71561,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
71016
71561
|
|
|
71017
71562
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
71018
71563
|
|
|
71019
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER,
|
|
71564
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0, samples );
|
|
71020
71565
|
|
|
71021
71566
|
} else {
|
|
71022
71567
|
|
|
71023
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER,
|
|
71568
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, glAttachmentType, glTextureType, webglDepthTexture, 0 );
|
|
71024
71569
|
|
|
71025
71570
|
}
|
|
71026
71571
|
|
|
@@ -71071,17 +71616,28 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
71071
71616
|
|
|
71072
71617
|
if ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
71073
71618
|
|
|
71074
|
-
if ( isCube )
|
|
71619
|
+
if ( isCube ) {
|
|
71075
71620
|
|
|
71076
|
-
|
|
71621
|
+
// For cube render targets with depth texture, setup each face
|
|
71622
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
71077
71623
|
|
|
71078
|
-
|
|
71624
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, i );
|
|
71079
71625
|
|
|
71080
|
-
|
|
71626
|
+
}
|
|
71081
71627
|
|
|
71082
71628
|
} else {
|
|
71083
71629
|
|
|
71084
|
-
|
|
71630
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
71631
|
+
|
|
71632
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
71633
|
+
|
|
71634
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget, 0 );
|
|
71635
|
+
|
|
71636
|
+
} else {
|
|
71637
|
+
|
|
71638
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget, 0 );
|
|
71639
|
+
|
|
71640
|
+
}
|
|
71085
71641
|
|
|
71086
71642
|
}
|
|
71087
71643
|
|
|
@@ -71663,6 +72219,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
71663
72219
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
71664
72220
|
this.useMultisampledRTT = useMultisampledRTT;
|
|
71665
72221
|
|
|
72222
|
+
this.isReversedDepthBuffer = function () {
|
|
72223
|
+
|
|
72224
|
+
return state.buffers.depth.getReversed();
|
|
72225
|
+
|
|
72226
|
+
};
|
|
72227
|
+
|
|
71666
72228
|
}
|
|
71667
72229
|
|
|
71668
72230
|
function WebGLUtils( gl, extensions ) {
|
|
@@ -71766,7 +72328,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71766
72328
|
|
|
71767
72329
|
// ETC
|
|
71768
72330
|
|
|
71769
|
-
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
|
|
72331
|
+
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format || p === R11_EAC_Format || p === SIGNED_R11_EAC_Format || p === RG11_EAC_Format || p === SIGNED_RG11_EAC_Format ) {
|
|
71770
72332
|
|
|
71771
72333
|
extension = extensions.get( 'WEBGL_compressed_texture_etc' );
|
|
71772
72334
|
|
|
@@ -71774,6 +72336,10 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71774
72336
|
|
|
71775
72337
|
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
71776
72338
|
if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
72339
|
+
if ( p === R11_EAC_Format ) return extension.COMPRESSED_R11_EAC;
|
|
72340
|
+
if ( p === SIGNED_R11_EAC_Format ) return extension.COMPRESSED_SIGNED_R11_EAC;
|
|
72341
|
+
if ( p === RG11_EAC_Format ) return extension.COMPRESSED_RG11_EAC;
|
|
72342
|
+
if ( p === SIGNED_RG11_EAC_Format ) return extension.COMPRESSED_SIGNED_RG11_EAC;
|
|
71777
72343
|
|
|
71778
72344
|
} else {
|
|
71779
72345
|
|
|
@@ -74097,45 +74663,29 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
74097
74663
|
|
|
74098
74664
|
/**
|
|
74099
74665
|
* Precomputed DFG LUT for Image-Based Lighting
|
|
74100
|
-
* Resolution:
|
|
74666
|
+
* Resolution: 16x16
|
|
74101
74667
|
* Samples: 4096 per texel
|
|
74102
74668
|
* Format: RG16F (2 half floats per texel: scale, bias)
|
|
74103
74669
|
*/
|
|
74104
74670
|
|
|
74105
74671
|
|
|
74106
74672
|
const DATA = new Uint16Array( [
|
|
74107
|
-
|
|
74108
|
-
|
|
74109
|
-
|
|
74110
|
-
|
|
74111
|
-
|
|
74112
|
-
|
|
74113
|
-
|
|
74114
|
-
|
|
74115
|
-
|
|
74116
|
-
|
|
74117
|
-
|
|
74118
|
-
|
|
74119
|
-
|
|
74120
|
-
|
|
74121
|
-
|
|
74122
|
-
|
|
74123
|
-
0x3bc9, 0x26d3, 0x3bc9, 0x26d4, 0x3bc9, 0x26d9, 0x3bc8, 0x26e3, 0x3bc6, 0x26ef, 0x3bc2, 0x2705, 0x3bbd, 0x271a, 0x3bb6, 0x2731, 0x3baa, 0x273c, 0x3b9a, 0x273d, 0x3b81, 0x2726, 0x3b65, 0x26f7, 0x3b46, 0x26af, 0x3b20, 0x2650, 0x3af7, 0x25e1, 0x3acd, 0x256a, 0x3aa1, 0x24eb, 0x3a75, 0x246f, 0x3a46, 0x23ee, 0x3a17, 0x230d, 0x39e9, 0x223e, 0x39b7, 0x2183, 0x3985, 0x20d8, 0x3953, 0x2043, 0x391e, 0x1f7a, 0x38e9, 0x1e8d, 0x38b3, 0x1dbf, 0x387c, 0x1d0b, 0x3845, 0x1c6c, 0x380e, 0x1bc4, 0x37b0, 0x1ad2, 0x3745, 0x19fd,
|
|
74124
|
-
0x3bd9, 0x24e4, 0x3bd9, 0x24e5, 0x3bd9, 0x24e8, 0x3bd8, 0x24f2, 0x3bd5, 0x24fe, 0x3bd2, 0x2512, 0x3bce, 0x252b, 0x3bc6, 0x2544, 0x3bbc, 0x255a, 0x3bac, 0x256b, 0x3b93, 0x2569, 0x3b7a, 0x2557, 0x3b5b, 0x252f, 0x3b34, 0x24f7, 0x3b0c, 0x24ad, 0x3adf, 0x2458, 0x3ab1, 0x23f8, 0x3a82, 0x233f, 0x3a4f, 0x2286, 0x3a1e, 0x21d5, 0x39eb, 0x2130, 0x39b6, 0x2098, 0x3982, 0x200e, 0x394b, 0x1f25, 0x3914, 0x1e45, 0x38dc, 0x1d83, 0x38a3, 0x1cd6, 0x386b, 0x1c3d, 0x3831, 0x1b71, 0x37f2, 0x1a87, 0x3782, 0x19bc, 0x3714, 0x1909,
|
|
74125
|
-
0x3be5, 0x22d8, 0x3be5, 0x22d9, 0x3be4, 0x22df, 0x3be4, 0x22ef, 0x3be1, 0x2305, 0x3bde, 0x232a, 0x3bda, 0x2358, 0x3bd4, 0x2392, 0x3bcb, 0x23ca, 0x3bbb, 0x23f4, 0x3ba3, 0x2405, 0x3b8c, 0x2405, 0x3b6c, 0x23ec, 0x3b47, 0x23ae, 0x3b1d, 0x2353, 0x3af0, 0x22e2, 0x3ac0, 0x2261, 0x3a8e, 0x21d9, 0x3a5a, 0x214e, 0x3a26, 0x20c7, 0x39ee, 0x2045, 0x39b7, 0x1f97, 0x397f, 0x1eba, 0x3945, 0x1df0, 0x390b, 0x1d3a, 0x38d0, 0x1c9a, 0x3895, 0x1c0a, 0x385a, 0x1b18, 0x381f, 0x1a39, 0x37c9, 0x1975, 0x3756, 0x18cc, 0x36e6, 0x1836,
|
|
74126
|
-
0x3bed, 0x20a8, 0x3bed, 0x20a9, 0x3bed, 0x20ae, 0x3bed, 0x20bb, 0x3beb, 0x20cf, 0x3be8, 0x20ef, 0x3be4, 0x2119, 0x3bde, 0x214f, 0x3bd6, 0x2189, 0x3bc6, 0x21b8, 0x3bb1, 0x21de, 0x3b9a, 0x21f2, 0x3b7b, 0x21f2, 0x3b57, 0x21d8, 0x3b2d, 0x21a4, 0x3b00, 0x215f, 0x3acf, 0x2108, 0x3a99, 0x20a8, 0x3a64, 0x2043, 0x3a2c, 0x1fba, 0x39f2, 0x1ef3, 0x39b8, 0x1e36, 0x397c, 0x1d86, 0x3940, 0x1ce5, 0x3903, 0x1c52, 0x38c6, 0x1b9e, 0x3888, 0x1ab3, 0x384a, 0x19e4, 0x380e, 0x192b, 0x37a3, 0x188b, 0x372d, 0x17f7, 0x36ba, 0x1701,
|
|
74127
|
-
0x3bf4, 0x1e23, 0x3bf4, 0x1e25, 0x3bf4, 0x1e2d, 0x3bf3, 0x1e41, 0x3bf1, 0x1e64, 0x3bef, 0x1e9c, 0x3beb, 0x1ee1, 0x3be6, 0x1f40, 0x3bde, 0x1fa7, 0x3bce, 0x2001, 0x3bbd, 0x202f, 0x3ba6, 0x204e, 0x3b88, 0x205f, 0x3b64, 0x205b, 0x3b3b, 0x2044, 0x3b0e, 0x201f, 0x3adb, 0x1fcf, 0x3aa6, 0x1f4e, 0x3a6e, 0x1ec1, 0x3a33, 0x1e2b, 0x39f7, 0x1d95, 0x39ba, 0x1d06, 0x397b, 0x1c7d, 0x393c, 0x1bfc, 0x38fc, 0x1b13, 0x38bc, 0x1a40, 0x387c, 0x1983, 0x383c, 0x18da, 0x37fa, 0x1842, 0x377f, 0x177f, 0x3706, 0x1695, 0x3691, 0x15c8,
|
|
74128
|
-
0x3bf8, 0x1bca, 0x3bf8, 0x1bcc, 0x3bf8, 0x1bd8, 0x3bf8, 0x1bf7, 0x3bf6, 0x1c1b, 0x3bf4, 0x1c45, 0x3bf1, 0x1c83, 0x3bec, 0x1cce, 0x3be4, 0x1d21, 0x3bd5, 0x1d78, 0x3bc5, 0x1dd1, 0x3bb0, 0x1e17, 0x3b93, 0x1e4a, 0x3b70, 0x1e5f, 0x3b48, 0x1e57, 0x3b1b, 0x1e35, 0x3ae7, 0x1df6, 0x3ab2, 0x1da4, 0x3a77, 0x1d44, 0x3a3a, 0x1cdb, 0x39fc, 0x1c6e, 0x39bb, 0x1c03, 0x397a, 0x1b35, 0x3938, 0x1a72, 0x38f5, 0x19bb, 0x38b3, 0x1914, 0x3870, 0x187d, 0x382e, 0x17eb, 0x37db, 0x16f9, 0x375c, 0x1621, 0x36e1, 0x1565, 0x3669, 0x14be,
|
|
74129
|
-
0x3bfb, 0x18b9, 0x3bfb, 0x18ba, 0x3bfb, 0x18c3, 0x3bfb, 0x18da, 0x3bf9, 0x190a, 0x3bf7, 0x1948, 0x3bf5, 0x19ac, 0x3bf0, 0x1a20, 0x3be9, 0x1ab3, 0x3bdb, 0x1b49, 0x3bcd, 0x1be6, 0x3bb7, 0x1c34, 0x3b9c, 0x1c6d, 0x3b7a, 0x1c8e, 0x3b54, 0x1c9e, 0x3b26, 0x1c96, 0x3af2, 0x1c75, 0x3abc, 0x1c47, 0x3a80, 0x1c09, 0x3a42, 0x1b85, 0x3a01, 0x1aec, 0x39be, 0x1a50, 0x397a, 0x19b5, 0x3935, 0x1921, 0x38f0, 0x1895, 0x38aa, 0x1814, 0x3866, 0x173a, 0x3821, 0x1665, 0x37be, 0x15a4, 0x373c, 0x14f9, 0x36be, 0x1460, 0x3644, 0x13b3,
|
|
74130
|
-
0x3bfd, 0x156b, 0x3bfd, 0x156c, 0x3bfd, 0x1578, 0x3bfd, 0x1598, 0x3bfc, 0x15dd, 0x3bfa, 0x163c, 0x3bf7, 0x16cb, 0x3bf3, 0x177b, 0x3beb, 0x1833, 0x3be0, 0x18ad, 0x3bd2, 0x192e, 0x3bbd, 0x19a6, 0x3ba4, 0x1a0c, 0x3b83, 0x1a5a, 0x3b5d, 0x1a8c, 0x3b30, 0x1a9b, 0x3afd, 0x1a86, 0x3ac6, 0x1a5c, 0x3a89, 0x1a11, 0x3a49, 0x19b7, 0x3a06, 0x194f, 0x39c1, 0x18e3, 0x397a, 0x1873, 0x3933, 0x1805, 0x38eb, 0x173a, 0x38a3, 0x1676, 0x385c, 0x15bf, 0x3816, 0x1519, 0x37a2, 0x1482, 0x371d, 0x13f7, 0x369c, 0x1306, 0x3620, 0x1231,
|
|
74131
|
-
0x3bff, 0x11cb, 0x3bff, 0x11cd, 0x3bfe, 0x11dd, 0x3bfe, 0x1219, 0x3bfd, 0x126b, 0x3bfb, 0x12e9, 0x3bf9, 0x13c5, 0x3bf5, 0x1460, 0x3bee, 0x150f, 0x3be3, 0x15c9, 0x3bd6, 0x168a, 0x3bc3, 0x174f, 0x3baa, 0x1806, 0x3b8b, 0x184f, 0x3b66, 0x1888, 0x3b39, 0x18a6, 0x3b07, 0x18ad, 0x3acf, 0x189c, 0x3a92, 0x1876, 0x3a50, 0x1840, 0x3a0c, 0x17fd, 0x39c4, 0x176a, 0x397b, 0x16ce, 0x3931, 0x1634, 0x38e6, 0x1599, 0x389c, 0x1508, 0x3852, 0x147f, 0x380a, 0x1401, 0x3788, 0x131c, 0x36ff, 0x124a, 0x367c, 0x1190, 0x35fe, 0x10ea,
|
|
74132
|
-
0x3bff, 0x0daa, 0x3bff, 0x0dad, 0x3bff, 0x0dc0, 0x3bff, 0x0e0e, 0x3bfe, 0x0e87, 0x3bfc, 0x0f14, 0x3bfb, 0x1029, 0x3bf7, 0x10d1, 0x3bf0, 0x11d3, 0x3be6, 0x12c9, 0x3bd9, 0x13fc, 0x3bc7, 0x1499, 0x3bb0, 0x152a, 0x3b92, 0x15ab, 0x3b6e, 0x1615, 0x3b42, 0x165a, 0x3b10, 0x1681, 0x3ad8, 0x1683, 0x3a9a, 0x1665, 0x3a57, 0x1629, 0x3a11, 0x15dd, 0x39c8, 0x1580, 0x397c, 0x1518, 0x3930, 0x14ae, 0x38e3, 0x1441, 0x3896, 0x13b1, 0x384a, 0x12e9, 0x37ff, 0x122f, 0x376f, 0x1182, 0x36e3, 0x10e5, 0x365e, 0x1057, 0x35de, 0x0fac,
|
|
74133
|
-
0x3c00, 0x08ea, 0x3c00, 0x08ed, 0x3c00, 0x0902, 0x3c00, 0x0961, 0x3bff, 0x09f3, 0x3bfd, 0x0abc, 0x3bfb, 0x0c1f, 0x3bf8, 0x0d15, 0x3bf1, 0x0e5b, 0x3be8, 0x0fb4, 0x3bdc, 0x10b0, 0x3bcb, 0x1190, 0x3bb5, 0x126c, 0x3b97, 0x132c, 0x3b74, 0x13de, 0x3b4a, 0x1432, 0x3b18, 0x145e, 0x3ae0, 0x1472, 0x3aa2, 0x146f, 0x3a5f, 0x1456, 0x3a17, 0x142e, 0x39cc, 0x13ee, 0x397e, 0x136b, 0x392f, 0x12e1, 0x38df, 0x124f, 0x3890, 0x11bd, 0x3842, 0x1131, 0x37eb, 0x10ac, 0x3757, 0x102e, 0x36c9, 0x0f76, 0x3640, 0x0ea3, 0x35bf, 0x0de4,
|
|
74134
|
-
0x3c00, 0x039b, 0x3c00, 0x039d, 0x3c00, 0x03b2, 0x3c00, 0x041c, 0x3bff, 0x04be, 0x3bfd, 0x05d6, 0x3bfc, 0x0764, 0x3bf8, 0x08e2, 0x3bf2, 0x0a67, 0x3bea, 0x0c1b, 0x3bde, 0x0d41, 0x3bcd, 0x0e5f, 0x3bb8, 0x0f8c, 0x3b9c, 0x1057, 0x3b7a, 0x10e5, 0x3b51, 0x1155, 0x3b20, 0x11a5, 0x3ae8, 0x11da, 0x3aaa, 0x11ef, 0x3a66, 0x11e5, 0x3a1d, 0x11c1, 0x39d0, 0x1185, 0x3980, 0x113b, 0x392e, 0x10e5, 0x38dc, 0x1087, 0x388b, 0x1028, 0x383b, 0x0f94, 0x37d9, 0x0edb, 0x3741, 0x0e2c, 0x36af, 0x0d89, 0x3625, 0x0cf2, 0x35a1, 0x0c69,
|
|
74135
|
-
0x3c00, 0x0107, 0x3c00, 0x0108, 0x3c00, 0x0110, 0x3c00, 0x0145, 0x3bff, 0x0197, 0x3bfe, 0x0224, 0x3bfc, 0x030c, 0x3bf8, 0x0478, 0x3bf3, 0x062c, 0x3beb, 0x0833, 0x3be0, 0x0979, 0x3bd0, 0x0aeb, 0x3bbc, 0x0c3d, 0x3ba0, 0x0d01, 0x3b80, 0x0dbd, 0x3b57, 0x0e69, 0x3b27, 0x0eeb, 0x3af0, 0x0f53, 0x3ab1, 0x0f8a, 0x3a6c, 0x0f9f, 0x3a22, 0x0f8b, 0x39d4, 0x0f5b, 0x3982, 0x0f0f, 0x392f, 0x0eac, 0x38da, 0x0e3d, 0x3886, 0x0dc9, 0x3834, 0x0d51, 0x37c7, 0x0cd9, 0x372c, 0x0c65, 0x3697, 0x0bef, 0x360a, 0x0b20, 0x3585, 0x0a62,
|
|
74136
|
-
0x3c00, 0x0031, 0x3c00, 0x0031, 0x3c00, 0x0034, 0x3c00, 0x004b, 0x3bff, 0x006f, 0x3bfe, 0x00c9, 0x3bfc, 0x011b, 0x3bf9, 0x0207, 0x3bf4, 0x02d6, 0x3bec, 0x0415, 0x3be1, 0x0587, 0x3bd2, 0x0703, 0x3bbf, 0x087d, 0x3ba5, 0x096a, 0x3b85, 0x0a59, 0x3b5d, 0x0b32, 0x3b2e, 0x0bee, 0x3af7, 0x0c44, 0x3ab8, 0x0c7c, 0x3a73, 0x0c9c, 0x3a28, 0x0ca4, 0x39d8, 0x0c98, 0x3985, 0x0c77, 0x392f, 0x0c4a, 0x38d9, 0x0c10, 0x3882, 0x0ba0, 0x382e, 0x0b14, 0x37b6, 0x0a84, 0x3717, 0x09f5, 0x3680, 0x0969, 0x35f0, 0x08e6, 0x356a, 0x086a,
|
|
74137
|
-
0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x000d, 0x3bff, 0x0021, 0x3bfe, 0x003b, 0x3bfd, 0x0070, 0x3bf9, 0x00c7, 0x3bf4, 0x012e, 0x3bed, 0x01c8, 0x3be3, 0x0274, 0x3bd4, 0x033b, 0x3bc1, 0x043a, 0x3ba8, 0x0534, 0x3b89, 0x0641, 0x3b62, 0x073b, 0x3b34, 0x0815, 0x3afd, 0x087c, 0x3abf, 0x08d0, 0x3a7a, 0x090a, 0x3a2e, 0x092c, 0x39dd, 0x0936, 0x3988, 0x0928, 0x3930, 0x0907, 0x38d7, 0x08d7, 0x387f, 0x089b, 0x3828, 0x0855, 0x37a7, 0x080b, 0x3704, 0x077b, 0x366a, 0x06e1, 0x35d8, 0x0649, 0x3550, 0x05b8,
|
|
74138
|
-
0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0003, 0x3bff, 0x0012, 0x3bfe, 0x001a, 0x3bfd, 0x0035, 0x3bfa, 0x0050, 0x3bf4, 0x0061, 0x3bed, 0x00a5, 0x3be4, 0x00ee, 0x3bd6, 0x0146, 0x3bc3, 0x01ab, 0x3bab, 0x0211, 0x3b8d, 0x028e, 0x3b67, 0x0303, 0x3b39, 0x0375, 0x3b04, 0x03e2, 0x3ac6, 0x0441, 0x3a80, 0x0492, 0x3a34, 0x04cd, 0x39e1, 0x04f2, 0x398b, 0x0504, 0x3931, 0x0502, 0x38d6, 0x04ec, 0x387c, 0x04c7, 0x3822, 0x0496, 0x3798, 0x045c, 0x36f2, 0x041a, 0x3655, 0x03d5, 0x35c1, 0x038e, 0x3537, 0x0347
|
|
74673
|
+
0x30b5, 0x3ad1, 0x314c, 0x3a4d, 0x33d2, 0x391c, 0x35ef, 0x3828, 0x37f3, 0x36a6, 0x38d1, 0x3539, 0x3979, 0x3410, 0x39f8, 0x3252, 0x3a53, 0x30f0, 0x3a94, 0x2fc9, 0x3abf, 0x2e35, 0x3ada, 0x2d05, 0x3ae8, 0x2c1f, 0x3aed, 0x2ae0, 0x3aea, 0x29d1, 0x3ae1, 0x28ff,
|
|
74674
|
+
0x3638, 0x38e4, 0x364a, 0x38ce, 0x3699, 0x385e, 0x374e, 0x372c, 0x3839, 0x35a4, 0x38dc, 0x3462, 0x396e, 0x32c4, 0x39de, 0x3134, 0x3a2b, 0x3003, 0x3a59, 0x2e3a, 0x3a6d, 0x2ce1, 0x3a6e, 0x2bba, 0x3a5f, 0x2a33, 0x3a49, 0x290a, 0x3a2d, 0x2826, 0x3a0a, 0x26e8,
|
|
74675
|
+
0x3894, 0x36d7, 0x3897, 0x36c9, 0x38a3, 0x3675, 0x38bc, 0x35ac, 0x38ee, 0x349c, 0x393e, 0x3332, 0x3997, 0x3186, 0x39e2, 0x3038, 0x3a13, 0x2e75, 0x3a29, 0x2cf5, 0x3a2d, 0x2bac, 0x3a21, 0x29ff, 0x3a04, 0x28bc, 0x39dc, 0x2790, 0x39ad, 0x261a, 0x3978, 0x24fa,
|
|
74676
|
+
0x39ac, 0x34a8, 0x39ac, 0x34a3, 0x39ae, 0x3480, 0x39ae, 0x3423, 0x39b1, 0x330e, 0x39c2, 0x31a9, 0x39e0, 0x3063, 0x39fc, 0x2eb5, 0x3a0c, 0x2d1d, 0x3a14, 0x2bcf, 0x3a07, 0x29ff, 0x39e9, 0x28a3, 0x39be, 0x273c, 0x3989, 0x25b3, 0x394a, 0x2488, 0x3907, 0x2345,
|
|
74677
|
+
0x3a77, 0x3223, 0x3a76, 0x321f, 0x3a73, 0x3204, 0x3a6a, 0x31b3, 0x3a58, 0x3114, 0x3a45, 0x303b, 0x3a34, 0x2eb6, 0x3a26, 0x2d31, 0x3a1e, 0x2bef, 0x3a0b, 0x2a0d, 0x39ec, 0x28a1, 0x39c0, 0x271b, 0x3987, 0x2580, 0x3944, 0x2449, 0x38fa, 0x22bd, 0x38ac, 0x2155,
|
|
74678
|
+
0x3b07, 0x2fca, 0x3b06, 0x2fca, 0x3b00, 0x2fb8, 0x3af4, 0x2f7c, 0x3adb, 0x2eea, 0x3ab4, 0x2e00, 0x3a85, 0x2cec, 0x3a5e, 0x2bc5, 0x3a36, 0x2a00, 0x3a0d, 0x2899, 0x39dc, 0x2707, 0x39a0, 0x2562, 0x395a, 0x2424, 0x390b, 0x2268, 0x38b7, 0x20fd, 0x385f, 0x1fd1,
|
|
74679
|
+
0x3b69, 0x2cb9, 0x3b68, 0x2cbb, 0x3b62, 0x2cbb, 0x3b56, 0x2cae, 0x3b3b, 0x2c78, 0x3b0d, 0x2c0a, 0x3acf, 0x2ae3, 0x3a92, 0x2998, 0x3a54, 0x2867, 0x3a17, 0x26d0, 0x39d3, 0x253c, 0x3989, 0x2402, 0x3935, 0x2226, 0x38dc, 0x20bd, 0x387d, 0x1f54, 0x381d, 0x1db3,
|
|
74680
|
+
0x3ba9, 0x296b, 0x3ba8, 0x296f, 0x3ba3, 0x297b, 0x3b98, 0x2987, 0x3b7f, 0x2976, 0x3b4e, 0x2927, 0x3b0e, 0x2895, 0x3ac2, 0x27b7, 0x3a73, 0x263b, 0x3a23, 0x24e7, 0x39d0, 0x239b, 0x3976, 0x21d9, 0x3917, 0x207e, 0x38b2, 0x1ee7, 0x384b, 0x1d53, 0x37c7, 0x1c1e,
|
|
74681
|
+
0x3bd2, 0x25cb, 0x3bd1, 0x25d3, 0x3bcd, 0x25f0, 0x3bc2, 0x261f, 0x3bad, 0x2645, 0x3b7d, 0x262d, 0x3b3e, 0x25c4, 0x3aec, 0x250f, 0x3a93, 0x243a, 0x3a32, 0x22ce, 0x39d0, 0x215b, 0x3969, 0x202a, 0x38fe, 0x1e6e, 0x388f, 0x1cf1, 0x381f, 0x1b9b, 0x3762, 0x19dd,
|
|
74682
|
+
0x3be9, 0x21ab, 0x3be9, 0x21b7, 0x3be5, 0x21e5, 0x3bdd, 0x2241, 0x3bc9, 0x22a7, 0x3ba0, 0x22ec, 0x3b62, 0x22cd, 0x3b0f, 0x2247, 0x3aae, 0x2175, 0x3a44, 0x2088, 0x39d4, 0x1f49, 0x3960, 0x1dbe, 0x38e9, 0x1c77, 0x3870, 0x1ae8, 0x37f1, 0x1953, 0x3708, 0x181b,
|
|
74683
|
+
0x3bf6, 0x1cea, 0x3bf6, 0x1cfb, 0x3bf3, 0x1d38, 0x3bec, 0x1dbd, 0x3bda, 0x1e7c, 0x3bb7, 0x1f25, 0x3b7d, 0x1f79, 0x3b2c, 0x1f4c, 0x3ac6, 0x1ea6, 0x3a55, 0x1dbb, 0x39da, 0x1cbd, 0x395a, 0x1b9d, 0x38d8, 0x1a00, 0x3855, 0x18ac, 0x37ab, 0x173c, 0x36b7, 0x1598,
|
|
74684
|
+
0x3bfc, 0x1736, 0x3bfc, 0x1759, 0x3bf9, 0x17e7, 0x3bf4, 0x1896, 0x3be4, 0x1997, 0x3bc6, 0x1aa8, 0x3b91, 0x1b84, 0x3b43, 0x1bd2, 0x3ade, 0x1b8a, 0x3a65, 0x1acd, 0x39e2, 0x19d3, 0x3957, 0x18cd, 0x38ca, 0x17b3, 0x383e, 0x1613, 0x376d, 0x14bf, 0x366f, 0x135e,
|
|
74685
|
+
0x3bff, 0x101b, 0x3bff, 0x1039, 0x3bfc, 0x10c8, 0x3bf9, 0x1226, 0x3bea, 0x1428, 0x3bcf, 0x1584, 0x3b9f, 0x16c5, 0x3b54, 0x179a, 0x3af0, 0x17ce, 0x3a76, 0x1771, 0x39ea, 0x16a4, 0x3956, 0x15a7, 0x38bf, 0x14a7, 0x3829, 0x1379, 0x3735, 0x11ea, 0x362d, 0x10a1,
|
|
74686
|
+
0x3c00, 0x061b, 0x3c00, 0x066a, 0x3bfe, 0x081c, 0x3bfa, 0x0a4c, 0x3bed, 0x0d16, 0x3bd5, 0x0fb3, 0x3ba9, 0x114d, 0x3b63, 0x127c, 0x3b01, 0x132f, 0x3a85, 0x1344, 0x39f4, 0x12d2, 0x3957, 0x120d, 0x38b5, 0x1122, 0x3817, 0x103c, 0x3703, 0x0ed3, 0x35f0, 0x0d6d,
|
|
74687
|
+
0x3c00, 0x007a, 0x3c00, 0x0089, 0x3bfe, 0x011d, 0x3bfb, 0x027c, 0x3bf0, 0x04fa, 0x3bda, 0x0881, 0x3bb1, 0x0acd, 0x3b6f, 0x0c97, 0x3b10, 0x0d7b, 0x3a93, 0x0df1, 0x39fe, 0x0def, 0x3959, 0x0d8a, 0x38af, 0x0ce9, 0x3808, 0x0c31, 0x36d5, 0x0af0, 0x35b9, 0x09a3,
|
|
74688
|
+
0x3c00, 0x0000, 0x3c00, 0x0001, 0x3bff, 0x0015, 0x3bfb, 0x0059, 0x3bf2, 0x00fd, 0x3bdd, 0x01df, 0x3bb7, 0x031c, 0x3b79, 0x047c, 0x3b1d, 0x05d4, 0x3aa0, 0x06d5, 0x3a08, 0x075a, 0x395d, 0x075e, 0x38aa, 0x06f7, 0x37f4, 0x0648, 0x36ac, 0x0576, 0x3586, 0x049f
|
|
74139
74689
|
] );
|
|
74140
74690
|
|
|
74141
74691
|
let lut = null;
|
|
@@ -74144,7 +74694,8 @@ function getDFGLUT() {
|
|
|
74144
74694
|
|
|
74145
74695
|
if ( lut === null ) {
|
|
74146
74696
|
|
|
74147
|
-
lut = new DataTexture( DATA,
|
|
74697
|
+
lut = new DataTexture( DATA, 16, 16, RGFormat, HalfFloatType );
|
|
74698
|
+
lut.name = 'DFG_LUT';
|
|
74148
74699
|
lut.minFilter = LinearFilter;
|
|
74149
74700
|
lut.magFilter = LinearFilter;
|
|
74150
74701
|
lut.wrapS = ClampToEdgeWrapping;
|
|
@@ -74184,6 +74735,7 @@ class WebGLRenderer {
|
|
|
74184
74735
|
powerPreference = 'default',
|
|
74185
74736
|
failIfMajorPerformanceCaveat = false,
|
|
74186
74737
|
reversedDepthBuffer = false,
|
|
74738
|
+
outputBufferType = UnsignedByteType,
|
|
74187
74739
|
} = parameters;
|
|
74188
74740
|
|
|
74189
74741
|
/**
|
|
@@ -74213,6 +74765,8 @@ class WebGLRenderer {
|
|
|
74213
74765
|
|
|
74214
74766
|
}
|
|
74215
74767
|
|
|
74768
|
+
const _outputBufferType = outputBufferType;
|
|
74769
|
+
|
|
74216
74770
|
const INTEGER_FORMATS = new Set( [
|
|
74217
74771
|
RGBAIntegerFormat,
|
|
74218
74772
|
RGIntegerFormat,
|
|
@@ -74240,6 +74794,10 @@ class WebGLRenderer {
|
|
|
74240
74794
|
const renderListStack = [];
|
|
74241
74795
|
const renderStateStack = [];
|
|
74242
74796
|
|
|
74797
|
+
// internal render target for non-UnsignedByteType color buffer
|
|
74798
|
+
|
|
74799
|
+
let output = null;
|
|
74800
|
+
|
|
74243
74801
|
// public properties
|
|
74244
74802
|
|
|
74245
74803
|
/**
|
|
@@ -74500,10 +75058,10 @@ class WebGLRenderer {
|
|
|
74500
75058
|
|
|
74501
75059
|
}
|
|
74502
75060
|
|
|
74503
|
-
} catch (
|
|
75061
|
+
} catch ( e ) {
|
|
74504
75062
|
|
|
74505
|
-
error( 'WebGLRenderer: ' +
|
|
74506
|
-
throw
|
|
75063
|
+
error( 'WebGLRenderer: ' + e.message );
|
|
75064
|
+
throw e;
|
|
74507
75065
|
|
|
74508
75066
|
}
|
|
74509
75067
|
|
|
@@ -74635,6 +75193,14 @@ class WebGLRenderer {
|
|
|
74635
75193
|
|
|
74636
75194
|
initGLContext();
|
|
74637
75195
|
|
|
75196
|
+
// initialize internal render target for non-UnsignedByteType color buffer
|
|
75197
|
+
|
|
75198
|
+
if ( _outputBufferType !== UnsignedByteType ) {
|
|
75199
|
+
|
|
75200
|
+
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );
|
|
75201
|
+
|
|
75202
|
+
}
|
|
75203
|
+
|
|
74638
75204
|
// xr
|
|
74639
75205
|
|
|
74640
75206
|
const xr = new WebXRManager( _this, _gl );
|
|
@@ -74757,6 +75323,12 @@ class WebGLRenderer {
|
|
|
74757
75323
|
|
|
74758
75324
|
}
|
|
74759
75325
|
|
|
75326
|
+
if ( output !== null ) {
|
|
75327
|
+
|
|
75328
|
+
output.setSize( canvas.width, canvas.height );
|
|
75329
|
+
|
|
75330
|
+
}
|
|
75331
|
+
|
|
74760
75332
|
this.setViewport( 0, 0, width, height );
|
|
74761
75333
|
|
|
74762
75334
|
};
|
|
@@ -74800,6 +75372,39 @@ class WebGLRenderer {
|
|
|
74800
75372
|
|
|
74801
75373
|
};
|
|
74802
75374
|
|
|
75375
|
+
/**
|
|
75376
|
+
* Sets the post-processing effects to be applied after rendering.
|
|
75377
|
+
*
|
|
75378
|
+
* @param {Array} effects - An array of post-processing effects.
|
|
75379
|
+
*/
|
|
75380
|
+
this.setEffects = function ( effects ) {
|
|
75381
|
+
|
|
75382
|
+
if ( _outputBufferType === UnsignedByteType ) {
|
|
75383
|
+
|
|
75384
|
+
console.error( 'THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
|
|
75385
|
+
return;
|
|
75386
|
+
|
|
75387
|
+
}
|
|
75388
|
+
|
|
75389
|
+
if ( effects ) {
|
|
75390
|
+
|
|
75391
|
+
for ( let i = 0; i < effects.length; i ++ ) {
|
|
75392
|
+
|
|
75393
|
+
if ( effects[ i ].isOutputPass === true ) {
|
|
75394
|
+
|
|
75395
|
+
console.warn( 'THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
|
|
75396
|
+
break;
|
|
75397
|
+
|
|
75398
|
+
}
|
|
75399
|
+
|
|
75400
|
+
}
|
|
75401
|
+
|
|
75402
|
+
}
|
|
75403
|
+
|
|
75404
|
+
output.setEffects( effects || [] );
|
|
75405
|
+
|
|
75406
|
+
};
|
|
75407
|
+
|
|
74803
75408
|
/**
|
|
74804
75409
|
* Returns the current viewport definition.
|
|
74805
75410
|
*
|
|
@@ -75649,6 +76254,12 @@ class WebGLRenderer {
|
|
|
75649
76254
|
|
|
75650
76255
|
if ( _isContextLost === true ) return;
|
|
75651
76256
|
|
|
76257
|
+
// use internal render target for HalfFloatType color buffer (only when tone mapping is enabled)
|
|
76258
|
+
|
|
76259
|
+
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
76260
|
+
|
|
76261
|
+
const useOutput = output !== null && ( _currentRenderTarget === null || isXRPresenting ) && output.begin( _this, _currentRenderTarget );
|
|
76262
|
+
|
|
75652
76263
|
// update scene graph
|
|
75653
76264
|
|
|
75654
76265
|
if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
|
|
@@ -75657,7 +76268,7 @@ class WebGLRenderer {
|
|
|
75657
76268
|
|
|
75658
76269
|
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
|
|
75659
76270
|
|
|
75660
|
-
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
76271
|
+
if ( xr.enabled === true && xr.isPresenting === true && ( output === null || output.isCompositing() === false ) ) {
|
|
75661
76272
|
|
|
75662
76273
|
if ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );
|
|
75663
76274
|
|
|
@@ -75729,46 +76340,52 @@ class WebGLRenderer {
|
|
|
75729
76340
|
|
|
75730
76341
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
75731
76342
|
|
|
75732
|
-
// render scene
|
|
76343
|
+
// render scene (skip if first effect is a render pass - it will render the scene itself)
|
|
75733
76344
|
|
|
75734
|
-
const
|
|
75735
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
76345
|
+
const skipSceneRender = useOutput && output.hasRenderPass();
|
|
75736
76346
|
|
|
75737
|
-
|
|
76347
|
+
if ( skipSceneRender === false ) {
|
|
75738
76348
|
|
|
75739
|
-
|
|
76349
|
+
const opaqueObjects = currentRenderList.opaque;
|
|
76350
|
+
const transmissiveObjects = currentRenderList.transmissive;
|
|
75740
76351
|
|
|
75741
|
-
|
|
76352
|
+
currentRenderState.setupLights();
|
|
75742
76353
|
|
|
75743
|
-
if (
|
|
76354
|
+
if ( camera.isArrayCamera ) {
|
|
75744
76355
|
|
|
75745
|
-
|
|
76356
|
+
const cameras = camera.cameras;
|
|
75746
76357
|
|
|
75747
|
-
|
|
76358
|
+
if ( transmissiveObjects.length > 0 ) {
|
|
75748
76359
|
|
|
75749
|
-
|
|
76360
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
76361
|
+
|
|
76362
|
+
const camera2 = cameras[ i ];
|
|
76363
|
+
|
|
76364
|
+
renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );
|
|
76365
|
+
|
|
76366
|
+
}
|
|
75750
76367
|
|
|
75751
76368
|
}
|
|
75752
76369
|
|
|
75753
|
-
|
|
76370
|
+
if ( _renderBackground ) background.render( scene );
|
|
75754
76371
|
|
|
75755
|
-
|
|
76372
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
75756
76373
|
|
|
75757
|
-
|
|
76374
|
+
const camera2 = cameras[ i ];
|
|
75758
76375
|
|
|
75759
|
-
|
|
76376
|
+
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
75760
76377
|
|
|
75761
|
-
|
|
76378
|
+
}
|
|
75762
76379
|
|
|
75763
|
-
}
|
|
76380
|
+
} else {
|
|
75764
76381
|
|
|
75765
|
-
|
|
76382
|
+
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
75766
76383
|
|
|
75767
|
-
|
|
76384
|
+
if ( _renderBackground ) background.render( scene );
|
|
75768
76385
|
|
|
75769
|
-
|
|
76386
|
+
renderScene( currentRenderList, scene, camera );
|
|
75770
76387
|
|
|
75771
|
-
|
|
76388
|
+
}
|
|
75772
76389
|
|
|
75773
76390
|
}
|
|
75774
76391
|
|
|
@@ -75786,6 +76403,14 @@ class WebGLRenderer {
|
|
|
75786
76403
|
|
|
75787
76404
|
}
|
|
75788
76405
|
|
|
76406
|
+
// copy from internal render target to canvas using fullscreen quad
|
|
76407
|
+
|
|
76408
|
+
if ( useOutput ) {
|
|
76409
|
+
|
|
76410
|
+
output.end( _this );
|
|
76411
|
+
|
|
76412
|
+
}
|
|
76413
|
+
|
|
75789
76414
|
//
|
|
75790
76415
|
|
|
75791
76416
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
@@ -75974,11 +76599,13 @@ class WebGLRenderer {
|
|
|
75974
76599
|
|
|
75975
76600
|
if ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {
|
|
75976
76601
|
|
|
76602
|
+
const hasHalfFloatSupport = extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' );
|
|
76603
|
+
|
|
75977
76604
|
currentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {
|
|
75978
76605
|
generateMipmaps: true,
|
|
75979
|
-
type:
|
|
76606
|
+
type: hasHalfFloatSupport ? HalfFloatType : UnsignedByteType,
|
|
75980
76607
|
minFilter: LinearMipmapLinearFilter,
|
|
75981
|
-
samples:
|
|
76608
|
+
samples: capabilities.samples,
|
|
75982
76609
|
stencilBuffer: stencil,
|
|
75983
76610
|
resolveDepthBuffer: false,
|
|
75984
76611
|
resolveStencilBuffer: false,
|
|
@@ -76554,6 +77181,30 @@ class WebGLRenderer {
|
|
|
76554
77181
|
|
|
76555
77182
|
}
|
|
76556
77183
|
|
|
77184
|
+
// Pre-allocate texture units for shadow samplers before setting data textures
|
|
77185
|
+
if ( materialProperties.needsLights ) {
|
|
77186
|
+
|
|
77187
|
+
// Set shadow map uniforms first to ensure they get the first texture units
|
|
77188
|
+
if ( lights.state.directionalShadowMap.length > 0 ) {
|
|
77189
|
+
|
|
77190
|
+
p_uniforms.setValue( _gl, 'directionalShadowMap', lights.state.directionalShadowMap, textures );
|
|
77191
|
+
|
|
77192
|
+
}
|
|
77193
|
+
|
|
77194
|
+
if ( lights.state.spotShadowMap.length > 0 ) {
|
|
77195
|
+
|
|
77196
|
+
p_uniforms.setValue( _gl, 'spotShadowMap', lights.state.spotShadowMap, textures );
|
|
77197
|
+
|
|
77198
|
+
}
|
|
77199
|
+
|
|
77200
|
+
if ( lights.state.pointShadowMap.length > 0 ) {
|
|
77201
|
+
|
|
77202
|
+
p_uniforms.setValue( _gl, 'pointShadowMap', lights.state.pointShadowMap, textures );
|
|
77203
|
+
|
|
77204
|
+
}
|
|
77205
|
+
|
|
77206
|
+
}
|
|
77207
|
+
|
|
76557
77208
|
// skinning and morph target uniforms must be set even if material didn't change
|
|
76558
77209
|
// auto-setting of texture unit for bone and morph texture must go before other textures
|
|
76559
77210
|
// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures
|
|
@@ -76816,7 +77467,6 @@ class WebGLRenderer {
|
|
|
76816
77467
|
_currentActiveCubeFace = activeCubeFace;
|
|
76817
77468
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
76818
77469
|
|
|
76819
|
-
let useDefaultFramebuffer = true;
|
|
76820
77470
|
let framebuffer = null;
|
|
76821
77471
|
let isCube = false;
|
|
76822
77472
|
let isRenderTarget3D = false;
|
|
@@ -76827,9 +77477,21 @@ class WebGLRenderer {
|
|
|
76827
77477
|
|
|
76828
77478
|
if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
|
|
76829
77479
|
|
|
76830
|
-
//
|
|
76831
|
-
|
|
76832
|
-
|
|
77480
|
+
// Externally-managed framebuffer (e.g. XR)
|
|
77481
|
+
// Bind to the stored framebuffer (may be null for default, or a WebGLFramebuffer)
|
|
77482
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
77483
|
+
|
|
77484
|
+
_currentViewport.copy( renderTarget.viewport );
|
|
77485
|
+
_currentScissor.copy( renderTarget.scissor );
|
|
77486
|
+
_currentScissorTest = renderTarget.scissorTest;
|
|
77487
|
+
|
|
77488
|
+
state.viewport( _currentViewport );
|
|
77489
|
+
state.scissor( _currentScissor );
|
|
77490
|
+
state.setScissorTest( _currentScissorTest );
|
|
77491
|
+
|
|
77492
|
+
_currentMaterialId = -1;
|
|
77493
|
+
|
|
77494
|
+
return;
|
|
76833
77495
|
|
|
76834
77496
|
} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
|
|
76835
77497
|
|
|
@@ -76928,7 +77590,7 @@ class WebGLRenderer {
|
|
|
76928
77590
|
|
|
76929
77591
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
76930
77592
|
|
|
76931
|
-
if ( framebufferBound
|
|
77593
|
+
if ( framebufferBound ) {
|
|
76932
77594
|
|
|
76933
77595
|
state.drawBuffers( renderTarget, framebuffer );
|
|
76934
77596
|
|
|
@@ -77606,6 +78268,7 @@ exports.ConstantAlphaFactor = ConstantAlphaFactor;
|
|
|
77606
78268
|
exports.ConstantColorFactor = ConstantColorFactor;
|
|
77607
78269
|
exports.Controls = Controls;
|
|
77608
78270
|
exports.CubeCamera = CubeCamera;
|
|
78271
|
+
exports.CubeDepthTexture = CubeDepthTexture;
|
|
77609
78272
|
exports.CubeReflectionMapping = CubeReflectionMapping;
|
|
77610
78273
|
exports.CubeRefractionMapping = CubeRefractionMapping;
|
|
77611
78274
|
exports.CubeTexture = CubeTexture;
|
|
@@ -77776,9 +78439,12 @@ exports.NeverDepth = NeverDepth;
|
|
|
77776
78439
|
exports.NeverStencilFunc = NeverStencilFunc;
|
|
77777
78440
|
exports.NoBlending = NoBlending;
|
|
77778
78441
|
exports.NoColorSpace = NoColorSpace;
|
|
78442
|
+
exports.NoNormalPacking = NoNormalPacking;
|
|
77779
78443
|
exports.NoToneMapping = NoToneMapping;
|
|
77780
78444
|
exports.NormalAnimationBlendMode = NormalAnimationBlendMode;
|
|
77781
78445
|
exports.NormalBlending = NormalBlending;
|
|
78446
|
+
exports.NormalGAPacking = NormalGAPacking;
|
|
78447
|
+
exports.NormalRGPacking = NormalRGPacking;
|
|
77782
78448
|
exports.NotEqualCompare = NotEqualCompare;
|
|
77783
78449
|
exports.NotEqualDepth = NotEqualDepth;
|
|
77784
78450
|
exports.NotEqualStencilFunc = NotEqualStencilFunc;
|
|
@@ -77817,9 +78483,11 @@ exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
|
|
|
77817
78483
|
exports.Quaternion = Quaternion;
|
|
77818
78484
|
exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack;
|
|
77819
78485
|
exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant;
|
|
78486
|
+
exports.R11_EAC_Format = R11_EAC_Format;
|
|
77820
78487
|
exports.RED_GREEN_RGTC2_Format = RED_GREEN_RGTC2_Format;
|
|
77821
78488
|
exports.RED_RGTC1_Format = RED_RGTC1_Format;
|
|
77822
78489
|
exports.REVISION = REVISION;
|
|
78490
|
+
exports.RG11_EAC_Format = RG11_EAC_Format;
|
|
77823
78491
|
exports.RGBADepthPacking = RGBADepthPacking;
|
|
77824
78492
|
exports.RGBAFormat = RGBAFormat;
|
|
77825
78493
|
exports.RGBAIntegerFormat = RGBAIntegerFormat;
|
|
@@ -77870,8 +78538,10 @@ exports.RepeatWrapping = RepeatWrapping;
|
|
|
77870
78538
|
exports.ReplaceStencilOp = ReplaceStencilOp;
|
|
77871
78539
|
exports.ReverseSubtractEquation = ReverseSubtractEquation;
|
|
77872
78540
|
exports.RingGeometry = RingGeometry;
|
|
78541
|
+
exports.SIGNED_R11_EAC_Format = SIGNED_R11_EAC_Format;
|
|
77873
78542
|
exports.SIGNED_RED_GREEN_RGTC2_Format = SIGNED_RED_GREEN_RGTC2_Format;
|
|
77874
78543
|
exports.SIGNED_RED_RGTC1_Format = SIGNED_RED_RGTC1_Format;
|
|
78544
|
+
exports.SIGNED_RG11_EAC_Format = SIGNED_RG11_EAC_Format;
|
|
77875
78545
|
exports.SRGBColorSpace = SRGBColorSpace;
|
|
77876
78546
|
exports.SRGBTransfer = SRGBTransfer;
|
|
77877
78547
|
exports.Scene = Scene;
|