super-three 0.184.0 → 0.185.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +1260 -927
- package/build/three.core.js +1104 -829
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +156 -98
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +11 -4
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +7538 -3367
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7538 -3366
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -0
- package/examples/jsm/controls/ArcballControls.js +6 -2
- package/examples/jsm/controls/FirstPersonControls.js +79 -42
- package/examples/jsm/controls/TransformControls.js +68 -15
- package/examples/jsm/csm/CSMFrustum.js +31 -6
- package/examples/jsm/csm/CSMShadowNode.js +4 -1
- package/examples/jsm/effects/AsciiEffect.js +14 -1
- package/examples/jsm/exporters/DRACOExporter.js +27 -6
- package/examples/jsm/exporters/GLTFExporter.js +114 -12
- package/examples/jsm/exporters/PLYExporter.js +286 -73
- package/examples/jsm/exporters/USDZExporter.js +347 -112
- package/examples/jsm/generators/CityGenerator.js +346 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.js +504 -0
- package/examples/jsm/generators/TreeGenerator.js +377 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +5 -4
- package/examples/jsm/helpers/ViewHelper.js +16 -6
- package/examples/jsm/inspector/Inspector.js +53 -15
- package/examples/jsm/inspector/RendererInspector.js +152 -36
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
- package/examples/jsm/inspector/tabs/Console.js +200 -18
- package/examples/jsm/inspector/tabs/Memory.js +8 -0
- package/examples/jsm/inspector/tabs/Parameters.js +64 -4
- package/examples/jsm/inspector/tabs/Performance.js +21 -6
- package/examples/jsm/inspector/tabs/Settings.js +51 -9
- package/examples/jsm/inspector/tabs/Timeline.js +178 -93
- package/examples/jsm/inspector/tabs/Viewer.js +628 -16
- package/examples/jsm/inspector/ui/Graph.js +162 -25
- package/examples/jsm/inspector/ui/Item.js +92 -13
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +90 -45
- package/examples/jsm/inspector/ui/Style.js +1788 -1401
- package/examples/jsm/inspector/ui/Tab.js +5 -3
- package/examples/jsm/inspector/ui/Values.js +71 -6
- package/examples/jsm/inspector/ui/utils.js +130 -10
- package/examples/jsm/libs/basis/README.md +0 -1
- package/examples/jsm/libs/demuxer_mp4.js +3 -3
- package/examples/jsm/libs/draco/README.md +0 -1
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.module.js +34 -9
- package/examples/jsm/lighting/ClusteredLighting.js +55 -0
- package/examples/jsm/lighting/LightProbeGrid.js +106 -76
- package/examples/jsm/lines/LineMaterial.js +38 -15
- package/examples/jsm/lines/LineSegments2.js +8 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +46 -13
- package/examples/jsm/loaders/EXRLoader.js +27 -55
- package/examples/jsm/loaders/HDRLoader.js +6 -28
- package/examples/jsm/loaders/KTX2Loader.js +31 -12
- package/examples/jsm/loaders/LDrawLoader.js +8 -8
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
- package/examples/jsm/loaders/LWOLoader.js +4 -0
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MaterialXLoader.js +31 -9
- package/examples/jsm/loaders/NRRDLoader.js +3 -3
- package/examples/jsm/loaders/PCDLoader.js +7 -7
- package/examples/jsm/loaders/PLYLoader.js +218 -55
- package/examples/jsm/loaders/SVGLoader.js +547 -495
- package/examples/jsm/loaders/TTFLoader.js +1 -1
- package/examples/jsm/loaders/USDLoader.js +33 -9
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +93 -20
- package/examples/jsm/loaders/usd/USDCParser.js +1 -1
- package/examples/jsm/loaders/usd/USDComposer.js +52 -19
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/Volume.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +1 -1
- package/examples/jsm/objects/Reflector.js +2 -3
- package/examples/jsm/objects/Water2Mesh.js +1 -1
- package/examples/jsm/physics/AmmoPhysics.js +15 -8
- package/examples/jsm/physics/RapierPhysics.js +27 -2
- package/examples/jsm/shaders/VolumeShader.js +31 -44
- package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
- package/examples/jsm/transpiler/Linker.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +59 -19
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +11 -12
- package/examples/jsm/tsl/display/GTAONode.js +34 -13
- package/examples/jsm/tsl/display/GodraysNode.js +1 -1
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
- package/examples/jsm/tsl/display/SSGINode.js +89 -39
- package/examples/jsm/tsl/display/SSRNode.js +829 -132
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
- package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
- package/examples/jsm/utils/SceneOptimizer.js +1 -1
- package/examples/jsm/webxr/ARButton.js +1 -1
- package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
- package/package.json +7 -7
- package/src/Three.TSL.js +10 -3
- package/src/Three.WebGPU.js +4 -0
- package/src/animation/AnimationAction.js +15 -11
- package/src/animation/AnimationClip.js +0 -139
- package/src/animation/KeyframeTrack.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/Camera.js +2 -2
- package/src/cameras/StereoCamera.js +5 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +29 -7
- package/src/core/Object3D.js +17 -7
- package/src/core/Raycaster.js +1 -1
- package/src/core/RenderTarget.js +15 -2
- package/src/extras/PMREMGenerator.js +6 -4
- package/src/extras/TextureUtils.js +1 -1
- package/src/extras/core/ShapePath.js +149 -160
- package/src/geometries/SphereGeometry.js +8 -3
- package/src/helpers/DirectionalLightHelper.js +2 -0
- package/src/helpers/HemisphereLightHelper.js +2 -0
- package/src/helpers/PointLightHelper.js +2 -0
- package/src/helpers/SpotLightHelper.js +1 -1
- package/src/loaders/DataTextureLoader.js +69 -38
- package/src/loaders/LoadingManager.js +5 -0
- package/src/loaders/MaterialLoader.js +36 -266
- package/src/loaders/ObjectLoader.js +3 -1
- package/src/materials/LineBasicMaterial.js +4 -0
- package/src/materials/Material.js +196 -1
- package/src/materials/MeshBasicMaterial.js +24 -0
- package/src/materials/MeshDepthMaterial.js +10 -0
- package/src/materials/MeshDistanceMaterial.js +10 -0
- package/src/materials/MeshLambertMaterial.js +40 -1
- package/src/materials/MeshMatcapMaterial.js +25 -1
- package/src/materials/MeshNormalMaterial.js +9 -1
- package/src/materials/MeshPhongMaterial.js +40 -1
- package/src/materials/MeshPhysicalMaterial.js +38 -0
- package/src/materials/MeshStandardMaterial.js +42 -1
- package/src/materials/MeshToonMaterial.js +34 -1
- package/src/materials/PointsMaterial.js +7 -0
- package/src/materials/ShaderMaterial.js +86 -0
- package/src/materials/SpriteMaterial.js +7 -0
- package/src/materials/nodes/Line2NodeMaterial.js +378 -322
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
- package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
- package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
- package/src/materials/nodes/NodeMaterial.js +115 -71
- package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
- package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
- package/src/math/Box3.js +5 -0
- package/src/math/FrustumArray.js +103 -133
- package/src/math/Interpolant.js +1 -1
- package/src/math/MathUtils.js +2 -2
- package/src/math/Matrix3.js +11 -0
- package/src/math/Matrix4.js +28 -3
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +2 -2
- package/src/math/Vector4.js +2 -2
- package/src/math/interpolants/BezierInterpolant.js +4 -6
- package/src/nodes/Nodes.js +2 -5
- package/src/nodes/TSL.js +8 -6
- package/src/nodes/accessors/Arrays.js +4 -4
- package/src/nodes/accessors/Batch.js +108 -0
- package/src/nodes/accessors/Bitangent.js +2 -2
- package/src/nodes/accessors/BufferAttributeNode.js +13 -2
- package/src/nodes/accessors/Camera.js +7 -7
- package/src/nodes/accessors/ClippingNode.js +1 -1
- package/src/nodes/accessors/Instance.js +264 -0
- package/src/nodes/accessors/MaterialNode.js +18 -2
- package/src/nodes/accessors/MaterialProperties.js +4 -3
- package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
- package/src/nodes/accessors/Normal.js +13 -13
- package/src/nodes/accessors/Position.js +5 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -0
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneProperties.js +1 -1
- package/src/nodes/accessors/Skinning.js +263 -0
- package/src/nodes/accessors/StorageBufferNode.js +2 -2
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.js +39 -7
- package/src/nodes/accessors/Tangent.js +4 -4
- package/src/nodes/accessors/TextureNode.js +60 -5
- package/src/nodes/code/FunctionNode.js +2 -16
- package/src/nodes/core/MRTNode.js +7 -2
- package/src/nodes/core/Node.js +39 -2
- package/src/nodes/core/NodeBuilder.js +201 -41
- package/src/nodes/core/NodeUtils.js +13 -13
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/OverrideContextNode.js +153 -0
- package/src/nodes/core/PropertyNode.js +51 -5
- package/src/nodes/core/StackNode.js +56 -34
- package/src/nodes/core/StructNode.js +4 -6
- package/src/nodes/core/StructTypeNode.js +6 -6
- package/src/nodes/core/VarNode.js +8 -0
- package/src/nodes/core/VaryingNode.js +12 -2
- package/src/nodes/display/BlendModes.js +1 -41
- package/src/nodes/display/BumpMapNode.js +6 -1
- package/src/nodes/display/ColorAdjustment.js +10 -9
- package/src/nodes/display/FrontFacingNode.js +38 -9
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +35 -43
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.js +12 -3
- package/src/nodes/functions/VolumetricLightingModel.js +40 -7
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/EnvironmentNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +40 -2
- package/src/nodes/lighting/LightingContextNode.js +10 -2
- package/src/nodes/lighting/LightsNode.js +90 -37
- package/src/nodes/lighting/PointShadowNode.js +6 -1
- package/src/nodes/lighting/ShadowFilterNode.js +21 -52
- package/src/nodes/lighting/ShadowNode.js +34 -14
- package/src/nodes/materialx/lib/mx_noise.js +2 -2
- package/src/nodes/math/ConditionalNode.js +3 -3
- package/src/nodes/math/MathNode.js +39 -11
- package/src/nodes/math/OperatorNode.js +23 -23
- package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
- package/src/nodes/pmrem/PMREMNode.js +33 -2
- package/src/nodes/tsl/TSLCore.js +63 -18
- package/src/nodes/utils/EquirectUV.js +30 -5
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/Packing.js +35 -4
- package/src/nodes/utils/RTTNode.js +40 -24
- package/src/nodes/utils/ReflectorNode.js +1 -0
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/objects/BatchedMesh.js +22 -14
- package/src/objects/InstancedMesh.js +0 -11
- package/src/objects/Skeleton.js +0 -9
- package/src/renderers/WebGLRenderer.js +19 -15
- package/src/renderers/common/Backend.js +49 -5
- package/src/renderers/common/Bindings.js +114 -45
- package/src/renderers/common/Buffer.js +9 -0
- package/src/renderers/common/ClippingContext.js +10 -2
- package/src/renderers/common/Info.js +63 -22
- package/src/renderers/common/Lighting.js +53 -5
- package/src/renderers/common/RenderList.js +41 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +281 -108
- package/src/renderers/common/Sampler.js +16 -48
- package/src/renderers/common/Textures.js +32 -5
- package/src/renderers/common/TimestampQueryPool.js +1 -1
- package/src/renderers/common/UniformsGroup.js +31 -9
- package/src/renderers/common/XRManager.js +340 -22
- package/src/renderers/common/extras/PMREMGenerator.js +15 -38
- package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
- package/src/renderers/common/nodes/NodeLibrary.js +4 -4
- package/src/renderers/common/nodes/NodeManager.js +63 -14
- package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
- package/src/renderers/webgl/WebGLOutput.js +2 -1
- package/src/renderers/webgl/WebGLProgram.js +5 -4
- package/src/renderers/webgl/WebGLPrograms.js +12 -5
- package/src/renderers/webgl/WebGLRenderLists.js +9 -1
- package/src/renderers/webgl/WebGLShaderCache.js +5 -11
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
- package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
- package/src/renderers/webgpu/WebGPUBackend.js +480 -169
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
- package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
- package/src/textures/DepthTexture.js +1 -1
- package/src/textures/ExternalTexture.js +0 -3
- package/examples/fonts/LICENSE +0 -13
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
- package/examples/fonts/README.md +0 -11
- package/examples/fonts/droid/NOTICE +0 -190
- package/examples/fonts/droid/README.txt +0 -18
- package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
- package/examples/fonts/gentilis_bold.typeface.json +0 -1
- package/examples/fonts/gentilis_regular.typeface.json +0 -1
- package/examples/fonts/helvetiker_bold.typeface.json +0 -1
- package/examples/fonts/helvetiker_regular.typeface.json +0 -1
- package/examples/fonts/optimer_bold.typeface.json +0 -1
- package/examples/fonts/optimer_regular.typeface.json +0 -1
- package/examples/fonts/ttf/README.md +0 -9
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/inspector/extensions/extensions.json +0 -6
- package/examples/jsm/libs/ammo.wasm.js +0 -822
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
- package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
- package/examples/jsm/libs/opentype.module.js +0 -14506
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lighting/TiledLighting.js +0 -42
- package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
- package/src/nodes/accessors/BatchNode.js +0 -163
- package/src/nodes/accessors/InstanceNode.js +0 -349
- package/src/nodes/accessors/InstancedMeshNode.js +0 -50
- package/src/nodes/accessors/SkinningNode.js +0 -328
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '185';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -2677,7 +2677,7 @@ function denormalize( value, array ) {
|
|
|
2677
2677
|
|
|
2678
2678
|
default:
|
|
2679
2679
|
|
|
2680
|
-
throw new Error( 'Invalid component type.' );
|
|
2680
|
+
throw new Error( 'THREE.MathUtils: Invalid component type.' );
|
|
2681
2681
|
|
|
2682
2682
|
}
|
|
2683
2683
|
|
|
@@ -2724,7 +2724,7 @@ function normalize( value, array ) {
|
|
|
2724
2724
|
|
|
2725
2725
|
default:
|
|
2726
2726
|
|
|
2727
|
-
throw new Error( 'Invalid component type.' );
|
|
2727
|
+
throw new Error( 'THREE.MathUtils: Invalid component type.' );
|
|
2728
2728
|
|
|
2729
2729
|
}
|
|
2730
2730
|
|
|
@@ -3150,7 +3150,7 @@ class Vector2 {
|
|
|
3150
3150
|
|
|
3151
3151
|
case 0: this.x = value; break;
|
|
3152
3152
|
case 1: this.y = value; break;
|
|
3153
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
3153
|
+
default: throw new Error( 'THREE.Vector2: index is out of range: ' + index );
|
|
3154
3154
|
|
|
3155
3155
|
}
|
|
3156
3156
|
|
|
@@ -3170,7 +3170,7 @@ class Vector2 {
|
|
|
3170
3170
|
|
|
3171
3171
|
case 0: return this.x;
|
|
3172
3172
|
case 1: return this.y;
|
|
3173
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
3173
|
+
default: throw new Error( 'THREE.Vector2: index is out of range: ' + index );
|
|
3174
3174
|
|
|
3175
3175
|
}
|
|
3176
3176
|
|
|
@@ -4925,7 +4925,7 @@ class Vector3 {
|
|
|
4925
4925
|
case 0: this.x = value; break;
|
|
4926
4926
|
case 1: this.y = value; break;
|
|
4927
4927
|
case 2: this.z = value; break;
|
|
4928
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
4928
|
+
default: throw new Error( 'THREE.Vector3: index is out of range: ' + index );
|
|
4929
4929
|
|
|
4930
4930
|
}
|
|
4931
4931
|
|
|
@@ -4946,7 +4946,7 @@ class Vector3 {
|
|
|
4946
4946
|
case 0: return this.x;
|
|
4947
4947
|
case 1: return this.y;
|
|
4948
4948
|
case 2: return this.z;
|
|
4949
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
4949
|
+
default: throw new Error( 'THREE.Vector3: index is out of range: ' + index );
|
|
4950
4950
|
|
|
4951
4951
|
}
|
|
4952
4952
|
|
|
@@ -6429,12 +6429,15 @@ class Matrix3 {
|
|
|
6429
6429
|
/**
|
|
6430
6430
|
* Scales this matrix with the given scalar values.
|
|
6431
6431
|
*
|
|
6432
|
+
* @deprecated
|
|
6432
6433
|
* @param {number} sx - The amount to scale in the X axis.
|
|
6433
6434
|
* @param {number} sy - The amount to scale in the Y axis.
|
|
6434
6435
|
* @return {Matrix3} A reference to this matrix.
|
|
6435
6436
|
*/
|
|
6436
6437
|
scale( sx, sy ) {
|
|
6437
6438
|
|
|
6439
|
+
warnOnce( 'Matrix3: .scale() is deprecated. Use .makeScale() instead.' ); // @deprecated r185
|
|
6440
|
+
|
|
6438
6441
|
this.premultiply( _m3.makeScale( sx, sy ) );
|
|
6439
6442
|
|
|
6440
6443
|
return this;
|
|
@@ -6444,11 +6447,14 @@ class Matrix3 {
|
|
|
6444
6447
|
/**
|
|
6445
6448
|
* Rotates this matrix by the given angle.
|
|
6446
6449
|
*
|
|
6450
|
+
* @deprecated
|
|
6447
6451
|
* @param {number} theta - The rotation in radians.
|
|
6448
6452
|
* @return {Matrix3} A reference to this matrix.
|
|
6449
6453
|
*/
|
|
6450
6454
|
rotate( theta ) {
|
|
6451
6455
|
|
|
6456
|
+
warnOnce( 'Matrix3: .rotate() is deprecated. Use .makeRotation() instead.' ); // @deprecated r185
|
|
6457
|
+
|
|
6452
6458
|
this.premultiply( _m3.makeRotation( - theta ) );
|
|
6453
6459
|
|
|
6454
6460
|
return this;
|
|
@@ -6458,12 +6464,15 @@ class Matrix3 {
|
|
|
6458
6464
|
/**
|
|
6459
6465
|
* Translates this matrix by the given scalar values.
|
|
6460
6466
|
*
|
|
6467
|
+
* @deprecated
|
|
6461
6468
|
* @param {number} tx - The amount to translate in the X axis.
|
|
6462
6469
|
* @param {number} ty - The amount to translate in the Y axis.
|
|
6463
6470
|
* @return {Matrix3} A reference to this matrix.
|
|
6464
6471
|
*/
|
|
6465
6472
|
translate( tx, ty ) {
|
|
6466
6473
|
|
|
6474
|
+
warnOnce( 'Matrix3: .translate() is deprecated. Use .makeTranslation() instead.' ); // @deprecated r185
|
|
6475
|
+
|
|
6467
6476
|
this.premultiply( _m3.makeTranslation( tx, ty ) );
|
|
6468
6477
|
|
|
6469
6478
|
return this;
|
|
@@ -8220,7 +8229,7 @@ class Vector4 {
|
|
|
8220
8229
|
case 1: this.y = value; break;
|
|
8221
8230
|
case 2: this.z = value; break;
|
|
8222
8231
|
case 3: this.w = value; break;
|
|
8223
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
8232
|
+
default: throw new Error( 'THREE.Vector4: index is out of range: ' + index );
|
|
8224
8233
|
|
|
8225
8234
|
}
|
|
8226
8235
|
|
|
@@ -8243,7 +8252,7 @@ class Vector4 {
|
|
|
8243
8252
|
case 1: return this.y;
|
|
8244
8253
|
case 2: return this.z;
|
|
8245
8254
|
case 3: return this.w;
|
|
8246
|
-
default: throw new Error( 'index is out of range: ' + index );
|
|
8255
|
+
default: throw new Error( 'THREE.Vector4: index is out of range: ' + index );
|
|
8247
8256
|
|
|
8248
8257
|
}
|
|
8249
8258
|
|
|
@@ -9094,7 +9103,8 @@ class RenderTarget extends EventDispatcher {
|
|
|
9094
9103
|
* @property {number} [samples=0] - The MSAA samples count.
|
|
9095
9104
|
* @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.
|
|
9096
9105
|
* @property {number} [depth=1] - The texture depth.
|
|
9097
|
-
* @property {boolean} [multiview=false] - Whether this target is used for multiview rendering.
|
|
9106
|
+
* @property {boolean} [multiview=false] - Whether this target is used for multiview rendering (WebGL OVR_multiview2 extension).
|
|
9107
|
+
* @property {boolean} [useArrayDepthTexture=false] - Whether to create the depth texture as an array texture for per-layer depth testing. This is separate from multiview so layered render targets can use array depth without the multiview extension.
|
|
9098
9108
|
*/
|
|
9099
9109
|
|
|
9100
9110
|
/**
|
|
@@ -9120,7 +9130,8 @@ class RenderTarget extends EventDispatcher {
|
|
|
9120
9130
|
samples: 0,
|
|
9121
9131
|
count: 1,
|
|
9122
9132
|
depth: 1,
|
|
9123
|
-
multiview: false
|
|
9133
|
+
multiview: false,
|
|
9134
|
+
useArrayDepthTexture: false
|
|
9124
9135
|
}, options );
|
|
9125
9136
|
|
|
9126
9137
|
/**
|
|
@@ -9257,6 +9268,16 @@ class RenderTarget extends EventDispatcher {
|
|
|
9257
9268
|
*/
|
|
9258
9269
|
this.multiview = options.multiview;
|
|
9259
9270
|
|
|
9271
|
+
/**
|
|
9272
|
+
* Whether to create the depth texture as an array texture for per-layer depth testing.
|
|
9273
|
+
* This is separate from multiview so layered render targets can use array depth without
|
|
9274
|
+
* the multiview extension.
|
|
9275
|
+
*
|
|
9276
|
+
* @type {boolean}
|
|
9277
|
+
* @default false
|
|
9278
|
+
*/
|
|
9279
|
+
this.useArrayDepthTexture = options.useArrayDepthTexture;
|
|
9280
|
+
|
|
9260
9281
|
}
|
|
9261
9282
|
|
|
9262
9283
|
_setTextureOptions( options = {} ) {
|
|
@@ -9428,6 +9449,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
9428
9449
|
|
|
9429
9450
|
this.samples = source.samples;
|
|
9430
9451
|
this.multiview = source.multiview;
|
|
9452
|
+
this.useArrayDepthTexture = source.useArrayDepthTexture;
|
|
9431
9453
|
|
|
9432
9454
|
return this;
|
|
9433
9455
|
|
|
@@ -10041,7 +10063,7 @@ class Matrix4 {
|
|
|
10041
10063
|
*/
|
|
10042
10064
|
extractBasis( xAxis, yAxis, zAxis ) {
|
|
10043
10065
|
|
|
10044
|
-
if ( this.
|
|
10066
|
+
if ( this.determinantAffine() === 0 ) {
|
|
10045
10067
|
|
|
10046
10068
|
xAxis.set( 1, 0, 0 );
|
|
10047
10069
|
yAxis.set( 0, 1, 0 );
|
|
@@ -10091,7 +10113,7 @@ class Matrix4 {
|
|
|
10091
10113
|
*/
|
|
10092
10114
|
extractRotation( m ) {
|
|
10093
10115
|
|
|
10094
|
-
if ( m.
|
|
10116
|
+
if ( m.determinantAffine() === 0 ) {
|
|
10095
10117
|
|
|
10096
10118
|
return this.identity();
|
|
10097
10119
|
|
|
@@ -10452,6 +10474,31 @@ class Matrix4 {
|
|
|
10452
10474
|
|
|
10453
10475
|
}
|
|
10454
10476
|
|
|
10477
|
+
/**
|
|
10478
|
+
* Computes and returns the determinant of the 4x4 matrix, but assumes the
|
|
10479
|
+
* matrix is affine, saving some computations.
|
|
10480
|
+
*
|
|
10481
|
+
* For affine matrices (like an object's world matrix), this value equals the
|
|
10482
|
+
* full 4x4 {@link Matrix4#determinant} but is cheaper to compute.
|
|
10483
|
+
*
|
|
10484
|
+
* Assumes the bottom row is [0, 0, 0, 1].
|
|
10485
|
+
*
|
|
10486
|
+
* @return {number} The determinant of the matrix.
|
|
10487
|
+
*/
|
|
10488
|
+
determinantAffine() {
|
|
10489
|
+
|
|
10490
|
+
const te = this.elements;
|
|
10491
|
+
|
|
10492
|
+
const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ];
|
|
10493
|
+
const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ];
|
|
10494
|
+
const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ];
|
|
10495
|
+
|
|
10496
|
+
return n11 * ( n22 * n33 - n23 * n32 ) -
|
|
10497
|
+
n12 * ( n21 * n33 - n23 * n31 ) +
|
|
10498
|
+
n13 * ( n21 * n32 - n22 * n31 );
|
|
10499
|
+
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10455
10502
|
/**
|
|
10456
10503
|
* Transposes this matrix in place.
|
|
10457
10504
|
*
|
|
@@ -10861,7 +10908,7 @@ class Matrix4 {
|
|
|
10861
10908
|
position.y = te[ 13 ];
|
|
10862
10909
|
position.z = te[ 14 ];
|
|
10863
10910
|
|
|
10864
|
-
const det = this.
|
|
10911
|
+
const det = this.determinantAffine();
|
|
10865
10912
|
|
|
10866
10913
|
if ( det === 0 ) {
|
|
10867
10914
|
|
|
@@ -12876,8 +12923,10 @@ class Object3D extends EventDispatcher {
|
|
|
12876
12923
|
*
|
|
12877
12924
|
* @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.
|
|
12878
12925
|
* @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.
|
|
12926
|
+
* @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even
|
|
12927
|
+
* when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
|
|
12879
12928
|
*/
|
|
12880
|
-
updateWorldMatrix( updateParents, updateChildren ) {
|
|
12929
|
+
updateWorldMatrix( updateParents, updateChildren, force = false ) {
|
|
12881
12930
|
|
|
12882
12931
|
const parent = this.parent;
|
|
12883
12932
|
|
|
@@ -12889,18 +12938,26 @@ class Object3D extends EventDispatcher {
|
|
|
12889
12938
|
|
|
12890
12939
|
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
12891
12940
|
|
|
12892
|
-
if ( this.
|
|
12941
|
+
if ( this.matrixWorldNeedsUpdate || force ) {
|
|
12893
12942
|
|
|
12894
|
-
if ( this.
|
|
12943
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
12895
12944
|
|
|
12896
|
-
|
|
12945
|
+
if ( this.parent === null ) {
|
|
12897
12946
|
|
|
12898
|
-
|
|
12947
|
+
this.matrixWorld.copy( this.matrix );
|
|
12899
12948
|
|
|
12900
|
-
|
|
12949
|
+
} else {
|
|
12950
|
+
|
|
12951
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
12952
|
+
|
|
12953
|
+
}
|
|
12901
12954
|
|
|
12902
12955
|
}
|
|
12903
12956
|
|
|
12957
|
+
this.matrixWorldNeedsUpdate = false;
|
|
12958
|
+
|
|
12959
|
+
force = true;
|
|
12960
|
+
|
|
12904
12961
|
}
|
|
12905
12962
|
|
|
12906
12963
|
// make sure descendants are updated
|
|
@@ -12913,7 +12970,7 @@ class Object3D extends EventDispatcher {
|
|
|
12913
12970
|
|
|
12914
12971
|
const child = children[ i ];
|
|
12915
12972
|
|
|
12916
|
-
child.updateWorldMatrix( false, true );
|
|
12973
|
+
child.updateWorldMatrix( false, true, force );
|
|
12917
12974
|
|
|
12918
12975
|
}
|
|
12919
12976
|
|
|
@@ -15782,6 +15839,11 @@ class Box3 {
|
|
|
15782
15839
|
* (including its children), accounting for the object's, and children's,
|
|
15783
15840
|
* world transforms. The function may result in a larger box than strictly necessary.
|
|
15784
15841
|
*
|
|
15842
|
+
* Note: To compute the correct bounding box, make sure the given 3D object
|
|
15843
|
+
* has an up-to-date world matrix that reflects the current transformation of its
|
|
15844
|
+
* ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if
|
|
15845
|
+
* you're unsure.
|
|
15846
|
+
*
|
|
15785
15847
|
* @param {Object3D} object - The 3D object to compute the bounding box for.
|
|
15786
15848
|
* @param {boolean} [precise=false] - If set to `true`, the method computes the smallest
|
|
15787
15849
|
* world-axis-aligned bounding box at the expense of more computation.
|
|
@@ -18287,6 +18349,19 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18287
18349
|
*/
|
|
18288
18350
|
this.userData = {};
|
|
18289
18351
|
|
|
18352
|
+
/**
|
|
18353
|
+
* `true` when the geometry has been transformed since construction
|
|
18354
|
+
* (e.g. via {@link BufferGeometry#applyMatrix4}). Only relevant for
|
|
18355
|
+
* geometry generators (subclasses that populate `parameters`): when set,
|
|
18356
|
+
* {@link BufferGeometry#toJSON} omits `parameters` since they no longer
|
|
18357
|
+
* describe the geometry.
|
|
18358
|
+
*
|
|
18359
|
+
* @private
|
|
18360
|
+
* @type {boolean}
|
|
18361
|
+
* @default false
|
|
18362
|
+
*/
|
|
18363
|
+
this._transformed = false;
|
|
18364
|
+
|
|
18290
18365
|
}
|
|
18291
18366
|
|
|
18292
18367
|
/**
|
|
@@ -18498,6 +18573,8 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18498
18573
|
|
|
18499
18574
|
}
|
|
18500
18575
|
|
|
18576
|
+
this._transformed = true;
|
|
18577
|
+
|
|
18501
18578
|
return this;
|
|
18502
18579
|
|
|
18503
18580
|
}
|
|
@@ -18933,13 +19010,14 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18933
19010
|
const normalAttribute = attributes.normal;
|
|
18934
19011
|
const uvAttribute = attributes.uv;
|
|
18935
19012
|
|
|
18936
|
-
|
|
19013
|
+
let tangentAttribute = this.getAttribute( 'tangent' );
|
|
18937
19014
|
|
|
18938
|
-
|
|
19015
|
+
if ( tangentAttribute === undefined || tangentAttribute.count !== positionAttribute.count ) {
|
|
18939
19016
|
|
|
18940
|
-
|
|
19017
|
+
tangentAttribute = new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 );
|
|
19018
|
+
this.setAttribute( 'tangent', tangentAttribute );
|
|
18941
19019
|
|
|
18942
|
-
|
|
19020
|
+
}
|
|
18943
19021
|
|
|
18944
19022
|
const tan1 = [], tan2 = [];
|
|
18945
19023
|
|
|
@@ -19068,6 +19146,8 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19068
19146
|
|
|
19069
19147
|
}
|
|
19070
19148
|
|
|
19149
|
+
this._transformed = true;
|
|
19150
|
+
|
|
19071
19151
|
}
|
|
19072
19152
|
|
|
19073
19153
|
/**
|
|
@@ -19085,7 +19165,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19085
19165
|
|
|
19086
19166
|
let normalAttribute = this.getAttribute( 'normal' );
|
|
19087
19167
|
|
|
19088
|
-
if ( normalAttribute === undefined ) {
|
|
19168
|
+
if ( normalAttribute === undefined || normalAttribute.count !== positionAttribute.count ) {
|
|
19089
19169
|
|
|
19090
19170
|
normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );
|
|
19091
19171
|
this.setAttribute( 'normal', normalAttribute );
|
|
@@ -19314,11 +19394,11 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19314
19394
|
// standard BufferGeometry serialization
|
|
19315
19395
|
|
|
19316
19396
|
data.uuid = this.uuid;
|
|
19317
|
-
data.type = this.type;
|
|
19397
|
+
data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
|
|
19318
19398
|
if ( this.name !== '' ) data.name = this.name;
|
|
19319
19399
|
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
|
|
19320
19400
|
|
|
19321
|
-
if ( this.parameters !== undefined ) {
|
|
19401
|
+
if ( this.parameters !== undefined && this._transformed !== true ) {
|
|
19322
19402
|
|
|
19323
19403
|
const parameters = this.parameters;
|
|
19324
19404
|
|
|
@@ -19529,6 +19609,10 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19529
19609
|
|
|
19530
19610
|
this.userData = source.userData;
|
|
19531
19611
|
|
|
19612
|
+
// transformed flag
|
|
19613
|
+
|
|
19614
|
+
this._transformed = source._transformed;
|
|
19615
|
+
|
|
19532
19616
|
return this;
|
|
19533
19617
|
|
|
19534
19618
|
}
|
|
@@ -20952,7 +21036,11 @@ class Material extends EventDispatcher {
|
|
|
20952
21036
|
|
|
20953
21037
|
currentValue.set( newValue );
|
|
20954
21038
|
|
|
20955
|
-
} else if (
|
|
21039
|
+
} else if (
|
|
21040
|
+
( ( currentValue && currentValue.isVector2 ) && ( newValue && newValue.isVector2 ) ) ||
|
|
21041
|
+
( ( currentValue && currentValue.isEuler ) && ( newValue && newValue.isEuler ) ) ||
|
|
21042
|
+
( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) )
|
|
21043
|
+
) {
|
|
20956
21044
|
|
|
20957
21045
|
currentValue.copy( newValue );
|
|
20958
21046
|
|
|
@@ -21253,6 +21341,196 @@ class Material extends EventDispatcher {
|
|
|
21253
21341
|
|
|
21254
21342
|
}
|
|
21255
21343
|
|
|
21344
|
+
/**
|
|
21345
|
+
* Deserializes the material from the given JSON.
|
|
21346
|
+
*
|
|
21347
|
+
* @param {Object} json - The JSON holding the serialized material.
|
|
21348
|
+
* @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
|
|
21349
|
+
* @return {Material} A reference to this material.
|
|
21350
|
+
*/
|
|
21351
|
+
fromJSON( json, textures ) {
|
|
21352
|
+
|
|
21353
|
+
if ( json.uuid !== undefined ) this.uuid = json.uuid;
|
|
21354
|
+
if ( json.name !== undefined ) this.name = json.name;
|
|
21355
|
+
if ( json.color !== undefined && this.color !== undefined ) this.color.setHex( json.color );
|
|
21356
|
+
if ( json.roughness !== undefined ) this.roughness = json.roughness;
|
|
21357
|
+
if ( json.metalness !== undefined ) this.metalness = json.metalness;
|
|
21358
|
+
if ( json.sheen !== undefined ) this.sheen = json.sheen;
|
|
21359
|
+
if ( json.sheenColor !== undefined ) this.sheenColor = new Color().setHex( json.sheenColor );
|
|
21360
|
+
if ( json.sheenRoughness !== undefined ) this.sheenRoughness = json.sheenRoughness;
|
|
21361
|
+
if ( json.emissive !== undefined && this.emissive !== undefined ) this.emissive.setHex( json.emissive );
|
|
21362
|
+
if ( json.specular !== undefined && this.specular !== undefined ) this.specular.setHex( json.specular );
|
|
21363
|
+
if ( json.specularIntensity !== undefined ) this.specularIntensity = json.specularIntensity;
|
|
21364
|
+
if ( json.specularColor !== undefined && this.specularColor !== undefined ) this.specularColor.setHex( json.specularColor );
|
|
21365
|
+
if ( json.shininess !== undefined ) this.shininess = json.shininess;
|
|
21366
|
+
if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
|
|
21367
|
+
if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
|
|
21368
|
+
if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
|
|
21369
|
+
if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
|
|
21370
|
+
if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
|
|
21371
|
+
if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
|
|
21372
|
+
if ( json.transmission !== undefined ) this.transmission = json.transmission;
|
|
21373
|
+
if ( json.thickness !== undefined ) this.thickness = json.thickness;
|
|
21374
|
+
if ( json.attenuationDistance !== undefined ) this.attenuationDistance = json.attenuationDistance;
|
|
21375
|
+
if ( json.attenuationColor !== undefined && this.attenuationColor !== undefined ) this.attenuationColor.setHex( json.attenuationColor );
|
|
21376
|
+
if ( json.anisotropy !== undefined ) this.anisotropy = json.anisotropy;
|
|
21377
|
+
if ( json.anisotropyRotation !== undefined ) this.anisotropyRotation = json.anisotropyRotation;
|
|
21378
|
+
if ( json.fog !== undefined ) this.fog = json.fog;
|
|
21379
|
+
if ( json.flatShading !== undefined ) this.flatShading = json.flatShading;
|
|
21380
|
+
if ( json.blending !== undefined ) this.blending = json.blending;
|
|
21381
|
+
if ( json.combine !== undefined ) this.combine = json.combine;
|
|
21382
|
+
if ( json.side !== undefined ) this.side = json.side;
|
|
21383
|
+
if ( json.shadowSide !== undefined ) this.shadowSide = json.shadowSide;
|
|
21384
|
+
if ( json.opacity !== undefined ) this.opacity = json.opacity;
|
|
21385
|
+
if ( json.transparent !== undefined ) this.transparent = json.transparent;
|
|
21386
|
+
if ( json.alphaTest !== undefined ) this.alphaTest = json.alphaTest;
|
|
21387
|
+
if ( json.alphaHash !== undefined ) this.alphaHash = json.alphaHash;
|
|
21388
|
+
if ( json.depthFunc !== undefined ) this.depthFunc = json.depthFunc;
|
|
21389
|
+
if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
|
|
21390
|
+
if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
|
|
21391
|
+
if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
|
|
21392
|
+
if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
|
|
21393
|
+
if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
|
|
21394
|
+
if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
|
|
21395
|
+
if ( json.blendSrcAlpha !== undefined ) this.blendSrcAlpha = json.blendSrcAlpha;
|
|
21396
|
+
if ( json.blendDstAlpha !== undefined ) this.blendDstAlpha = json.blendDstAlpha;
|
|
21397
|
+
if ( json.blendEquationAlpha !== undefined ) this.blendEquationAlpha = json.blendEquationAlpha;
|
|
21398
|
+
if ( json.blendColor !== undefined && this.blendColor !== undefined ) this.blendColor.setHex( json.blendColor );
|
|
21399
|
+
if ( json.blendAlpha !== undefined ) this.blendAlpha = json.blendAlpha;
|
|
21400
|
+
if ( json.stencilWriteMask !== undefined ) this.stencilWriteMask = json.stencilWriteMask;
|
|
21401
|
+
if ( json.stencilFunc !== undefined ) this.stencilFunc = json.stencilFunc;
|
|
21402
|
+
if ( json.stencilRef !== undefined ) this.stencilRef = json.stencilRef;
|
|
21403
|
+
if ( json.stencilFuncMask !== undefined ) this.stencilFuncMask = json.stencilFuncMask;
|
|
21404
|
+
if ( json.stencilFail !== undefined ) this.stencilFail = json.stencilFail;
|
|
21405
|
+
if ( json.stencilZFail !== undefined ) this.stencilZFail = json.stencilZFail;
|
|
21406
|
+
if ( json.stencilZPass !== undefined ) this.stencilZPass = json.stencilZPass;
|
|
21407
|
+
if ( json.stencilWrite !== undefined ) this.stencilWrite = json.stencilWrite;
|
|
21408
|
+
|
|
21409
|
+
if ( json.wireframe !== undefined ) this.wireframe = json.wireframe;
|
|
21410
|
+
if ( json.wireframeLinewidth !== undefined ) this.wireframeLinewidth = json.wireframeLinewidth;
|
|
21411
|
+
if ( json.wireframeLinecap !== undefined ) this.wireframeLinecap = json.wireframeLinecap;
|
|
21412
|
+
if ( json.wireframeLinejoin !== undefined ) this.wireframeLinejoin = json.wireframeLinejoin;
|
|
21413
|
+
|
|
21414
|
+
if ( json.rotation !== undefined ) this.rotation = json.rotation;
|
|
21415
|
+
|
|
21416
|
+
if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
|
|
21417
|
+
if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
|
|
21418
|
+
if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
|
|
21419
|
+
if ( json.scale !== undefined ) this.scale = json.scale;
|
|
21420
|
+
|
|
21421
|
+
if ( json.polygonOffset !== undefined ) this.polygonOffset = json.polygonOffset;
|
|
21422
|
+
if ( json.polygonOffsetFactor !== undefined ) this.polygonOffsetFactor = json.polygonOffsetFactor;
|
|
21423
|
+
if ( json.polygonOffsetUnits !== undefined ) this.polygonOffsetUnits = json.polygonOffsetUnits;
|
|
21424
|
+
|
|
21425
|
+
if ( json.dithering !== undefined ) this.dithering = json.dithering;
|
|
21426
|
+
|
|
21427
|
+
if ( json.alphaToCoverage !== undefined ) this.alphaToCoverage = json.alphaToCoverage;
|
|
21428
|
+
if ( json.premultipliedAlpha !== undefined ) this.premultipliedAlpha = json.premultipliedAlpha;
|
|
21429
|
+
if ( json.forceSinglePass !== undefined ) this.forceSinglePass = json.forceSinglePass;
|
|
21430
|
+
if ( json.allowOverride !== undefined ) this.allowOverride = json.allowOverride;
|
|
21431
|
+
|
|
21432
|
+
if ( json.visible !== undefined ) this.visible = json.visible;
|
|
21433
|
+
|
|
21434
|
+
if ( json.toneMapped !== undefined ) this.toneMapped = json.toneMapped;
|
|
21435
|
+
|
|
21436
|
+
if ( json.userData !== undefined ) this.userData = json.userData;
|
|
21437
|
+
|
|
21438
|
+
if ( json.vertexColors !== undefined ) {
|
|
21439
|
+
|
|
21440
|
+
if ( typeof json.vertexColors === 'number' ) {
|
|
21441
|
+
|
|
21442
|
+
this.vertexColors = json.vertexColors > 0;
|
|
21443
|
+
|
|
21444
|
+
} else {
|
|
21445
|
+
|
|
21446
|
+
this.vertexColors = json.vertexColors;
|
|
21447
|
+
|
|
21448
|
+
}
|
|
21449
|
+
|
|
21450
|
+
}
|
|
21451
|
+
|
|
21452
|
+
// for PointsMaterial
|
|
21453
|
+
|
|
21454
|
+
if ( json.size !== undefined ) this.size = json.size;
|
|
21455
|
+
if ( json.sizeAttenuation !== undefined ) this.sizeAttenuation = json.sizeAttenuation;
|
|
21456
|
+
|
|
21457
|
+
// maps
|
|
21458
|
+
|
|
21459
|
+
if ( json.map !== undefined ) this.map = textures[ json.map ] || null;
|
|
21460
|
+
if ( json.matcap !== undefined ) this.matcap = textures[ json.matcap ] || null;
|
|
21461
|
+
|
|
21462
|
+
if ( json.alphaMap !== undefined ) this.alphaMap = textures[ json.alphaMap ] || null;
|
|
21463
|
+
|
|
21464
|
+
if ( json.bumpMap !== undefined ) this.bumpMap = textures[ json.bumpMap ] || null;
|
|
21465
|
+
if ( json.bumpScale !== undefined ) this.bumpScale = json.bumpScale;
|
|
21466
|
+
|
|
21467
|
+
if ( json.normalMap !== undefined ) this.normalMap = textures[ json.normalMap ] || null;
|
|
21468
|
+
if ( json.normalMapType !== undefined ) this.normalMapType = json.normalMapType;
|
|
21469
|
+
if ( json.normalScale !== undefined ) {
|
|
21470
|
+
|
|
21471
|
+
let normalScale = json.normalScale;
|
|
21472
|
+
|
|
21473
|
+
if ( Array.isArray( normalScale ) === false ) {
|
|
21474
|
+
|
|
21475
|
+
// Blender exporter used to export a scalar. See #7459
|
|
21476
|
+
|
|
21477
|
+
normalScale = [ normalScale, normalScale ];
|
|
21478
|
+
|
|
21479
|
+
}
|
|
21480
|
+
|
|
21481
|
+
this.normalScale = new Vector2().fromArray( normalScale );
|
|
21482
|
+
|
|
21483
|
+
}
|
|
21484
|
+
|
|
21485
|
+
if ( json.displacementMap !== undefined ) this.displacementMap = textures[ json.displacementMap ] || null;
|
|
21486
|
+
if ( json.displacementScale !== undefined ) this.displacementScale = json.displacementScale;
|
|
21487
|
+
if ( json.displacementBias !== undefined ) this.displacementBias = json.displacementBias;
|
|
21488
|
+
|
|
21489
|
+
if ( json.roughnessMap !== undefined ) this.roughnessMap = textures[ json.roughnessMap ] || null;
|
|
21490
|
+
if ( json.metalnessMap !== undefined ) this.metalnessMap = textures[ json.metalnessMap ] || null;
|
|
21491
|
+
|
|
21492
|
+
if ( json.emissiveMap !== undefined ) this.emissiveMap = textures[ json.emissiveMap ] || null;
|
|
21493
|
+
if ( json.emissiveIntensity !== undefined ) this.emissiveIntensity = json.emissiveIntensity;
|
|
21494
|
+
|
|
21495
|
+
if ( json.specularMap !== undefined ) this.specularMap = textures[ json.specularMap ] || null;
|
|
21496
|
+
if ( json.specularIntensityMap !== undefined ) this.specularIntensityMap = textures[ json.specularIntensityMap ] || null;
|
|
21497
|
+
if ( json.specularColorMap !== undefined ) this.specularColorMap = textures[ json.specularColorMap ] || null;
|
|
21498
|
+
|
|
21499
|
+
if ( json.envMap !== undefined ) this.envMap = textures[ json.envMap ] || null;
|
|
21500
|
+
if ( json.envMapRotation !== undefined ) this.envMapRotation.fromArray( json.envMapRotation );
|
|
21501
|
+
if ( json.envMapIntensity !== undefined ) this.envMapIntensity = json.envMapIntensity;
|
|
21502
|
+
|
|
21503
|
+
if ( json.reflectivity !== undefined ) this.reflectivity = json.reflectivity;
|
|
21504
|
+
if ( json.refractionRatio !== undefined ) this.refractionRatio = json.refractionRatio;
|
|
21505
|
+
|
|
21506
|
+
if ( json.lightMap !== undefined ) this.lightMap = textures[ json.lightMap ] || null;
|
|
21507
|
+
if ( json.lightMapIntensity !== undefined ) this.lightMapIntensity = json.lightMapIntensity;
|
|
21508
|
+
|
|
21509
|
+
if ( json.aoMap !== undefined ) this.aoMap = textures[ json.aoMap ] || null;
|
|
21510
|
+
if ( json.aoMapIntensity !== undefined ) this.aoMapIntensity = json.aoMapIntensity;
|
|
21511
|
+
|
|
21512
|
+
if ( json.gradientMap !== undefined ) this.gradientMap = textures[ json.gradientMap ] || null;
|
|
21513
|
+
|
|
21514
|
+
if ( json.clearcoatMap !== undefined ) this.clearcoatMap = textures[ json.clearcoatMap ] || null;
|
|
21515
|
+
if ( json.clearcoatRoughnessMap !== undefined ) this.clearcoatRoughnessMap = textures[ json.clearcoatRoughnessMap ] || null;
|
|
21516
|
+
if ( json.clearcoatNormalMap !== undefined ) this.clearcoatNormalMap = textures[ json.clearcoatNormalMap ] || null;
|
|
21517
|
+
if ( json.clearcoatNormalScale !== undefined ) this.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
|
|
21518
|
+
|
|
21519
|
+
if ( json.iridescenceMap !== undefined ) this.iridescenceMap = textures[ json.iridescenceMap ] || null;
|
|
21520
|
+
if ( json.iridescenceThicknessMap !== undefined ) this.iridescenceThicknessMap = textures[ json.iridescenceThicknessMap ] || null;
|
|
21521
|
+
|
|
21522
|
+
if ( json.transmissionMap !== undefined ) this.transmissionMap = textures[ json.transmissionMap ] || null;
|
|
21523
|
+
if ( json.thicknessMap !== undefined ) this.thicknessMap = textures[ json.thicknessMap ] || null;
|
|
21524
|
+
|
|
21525
|
+
if ( json.anisotropyMap !== undefined ) this.anisotropyMap = textures[ json.anisotropyMap ] || null;
|
|
21526
|
+
|
|
21527
|
+
if ( json.sheenColorMap !== undefined ) this.sheenColorMap = textures[ json.sheenColorMap ] || null;
|
|
21528
|
+
if ( json.sheenRoughnessMap !== undefined ) this.sheenRoughnessMap = textures[ json.sheenRoughnessMap ] || null;
|
|
21529
|
+
|
|
21530
|
+
return this;
|
|
21531
|
+
|
|
21532
|
+
}
|
|
21533
|
+
|
|
21256
21534
|
/**
|
|
21257
21535
|
* Returns a new material with copied values from this instance.
|
|
21258
21536
|
*
|
|
@@ -21439,6 +21717,10 @@ class SpriteMaterial extends Material {
|
|
|
21439
21717
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
21440
21718
|
* color is modulated by the diffuse `color`.
|
|
21441
21719
|
*
|
|
21720
|
+
* `map` represents color data, and the texture must be assigned a
|
|
21721
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
21722
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
21723
|
+
*
|
|
21442
21724
|
* @type {?Texture}
|
|
21443
21725
|
* @default null
|
|
21444
21726
|
*/
|
|
@@ -21454,6 +21736,9 @@ class SpriteMaterial extends Material {
|
|
|
21454
21736
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
21455
21737
|
* luminance/alpha textures will also still work as expected.
|
|
21456
21738
|
*
|
|
21739
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
21740
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
21741
|
+
*
|
|
21457
21742
|
* @type {?Texture}
|
|
21458
21743
|
* @default null
|
|
21459
21744
|
*/
|
|
@@ -22774,6 +23059,10 @@ class MeshBasicMaterial extends Material {
|
|
|
22774
23059
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
22775
23060
|
* color is modulated by the diffuse `color`.
|
|
22776
23061
|
*
|
|
23062
|
+
* `map` represents color data, and the texture must be assigned a
|
|
23063
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
23064
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
23065
|
+
*
|
|
22777
23066
|
* @type {?Texture}
|
|
22778
23067
|
* @default null
|
|
22779
23068
|
*/
|
|
@@ -22782,6 +23071,11 @@ class MeshBasicMaterial extends Material {
|
|
|
22782
23071
|
/**
|
|
22783
23072
|
* The light map. Requires a second set of UVs.
|
|
22784
23073
|
*
|
|
23074
|
+
* `lightMap` represents pre-baked illuminance data, and the texture must be assigned
|
|
23075
|
+
* a {@link Texture#colorSpace}. Most `lightMap` textures set
|
|
23076
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
23077
|
+
* such as `.exr` or `.hdr`.
|
|
23078
|
+
*
|
|
22785
23079
|
* @type {?Texture}
|
|
22786
23080
|
* @default null
|
|
22787
23081
|
*/
|
|
@@ -22799,6 +23093,9 @@ class MeshBasicMaterial extends Material {
|
|
|
22799
23093
|
* The red channel of this texture is used as the ambient occlusion map.
|
|
22800
23094
|
* Requires a second set of UVs.
|
|
22801
23095
|
*
|
|
23096
|
+
* `aoMap` represents non-color data. Any texture assigned must have
|
|
23097
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
23098
|
+
*
|
|
22802
23099
|
* @type {?Texture}
|
|
22803
23100
|
* @default null
|
|
22804
23101
|
*/
|
|
@@ -22817,6 +23114,10 @@ class MeshBasicMaterial extends Material {
|
|
|
22817
23114
|
/**
|
|
22818
23115
|
* Specular map used by the material.
|
|
22819
23116
|
*
|
|
23117
|
+
* `specularMap` represents color data, and the texture must be assigned a
|
|
23118
|
+
* {@link Texture#colorSpace}. Most `specularMap` textures set
|
|
23119
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
23120
|
+
*
|
|
22820
23121
|
* @type {?Texture}
|
|
22821
23122
|
* @default null
|
|
22822
23123
|
*/
|
|
@@ -22832,6 +23133,9 @@ class MeshBasicMaterial extends Material {
|
|
|
22832
23133
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
22833
23134
|
* luminance/alpha textures will also still work as expected.
|
|
22834
23135
|
*
|
|
23136
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
23137
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
23138
|
+
*
|
|
22835
23139
|
* @type {?Texture}
|
|
22836
23140
|
* @default null
|
|
22837
23141
|
*/
|
|
@@ -22840,6 +23144,11 @@ class MeshBasicMaterial extends Material {
|
|
|
22840
23144
|
/**
|
|
22841
23145
|
* The environment map.
|
|
22842
23146
|
*
|
|
23147
|
+
* `envMap` represents luminance data, and the texture must be assigned
|
|
23148
|
+
* a {@link Texture#colorSpace}. Most `envMap` textures set
|
|
23149
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
23150
|
+
* such as `.exr` or `.hdr`.
|
|
23151
|
+
*
|
|
22843
23152
|
* @type {?Texture}
|
|
22844
23153
|
* @default null
|
|
22845
23154
|
*/
|
|
@@ -23997,15 +24306,6 @@ class Skeleton {
|
|
|
23997
24306
|
*/
|
|
23998
24307
|
this.boneMatrices = null;
|
|
23999
24308
|
|
|
24000
|
-
/**
|
|
24001
|
-
* An array buffer holding the bone data of the previous frame.
|
|
24002
|
-
* Required for computing velocity. Maintained in {@link SkinningNode}.
|
|
24003
|
-
*
|
|
24004
|
-
* @type {?Float32Array}
|
|
24005
|
-
* @default null
|
|
24006
|
-
*/
|
|
24007
|
-
this.previousBoneMatrices = null;
|
|
24008
|
-
|
|
24009
24309
|
/**
|
|
24010
24310
|
* A texture holding the bone data for use
|
|
24011
24311
|
* in the vertex shader.
|
|
@@ -24431,15 +24731,6 @@ class InstancedMesh extends Mesh {
|
|
|
24431
24731
|
*/
|
|
24432
24732
|
this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
|
|
24433
24733
|
|
|
24434
|
-
/**
|
|
24435
|
-
* Represents the local transformation of all instances of the previous frame.
|
|
24436
|
-
* Required for computing velocity. Maintained in {@link InstanceNode}.
|
|
24437
|
-
*
|
|
24438
|
-
* @type {?InstancedBufferAttribute}
|
|
24439
|
-
* @default null
|
|
24440
|
-
*/
|
|
24441
|
-
this.previousInstanceMatrix = null;
|
|
24442
|
-
|
|
24443
24734
|
/**
|
|
24444
24735
|
* Represents the color of all instances. You have to set its
|
|
24445
24736
|
* {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data
|
|
@@ -24569,8 +24860,6 @@ class InstancedMesh extends Mesh {
|
|
|
24569
24860
|
|
|
24570
24861
|
this.instanceMatrix.copy( source.instanceMatrix );
|
|
24571
24862
|
|
|
24572
|
-
if ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();
|
|
24573
|
-
|
|
24574
24863
|
if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
|
|
24575
24864
|
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
|
|
24576
24865
|
|
|
@@ -25436,7 +25725,6 @@ class Frustum {
|
|
|
25436
25725
|
}
|
|
25437
25726
|
|
|
25438
25727
|
const _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();
|
|
25439
|
-
const _frustum$1 = /*@__PURE__*/ new Frustum();
|
|
25440
25728
|
|
|
25441
25729
|
/**
|
|
25442
25730
|
* FrustumArray is used to determine if an object is visible in at least one camera
|
|
@@ -25458,220 +25746,191 @@ class FrustumArray {
|
|
|
25458
25746
|
*/
|
|
25459
25747
|
this.coordinateSystem = WebGLCoordinateSystem;
|
|
25460
25748
|
|
|
25749
|
+
/**
|
|
25750
|
+
* A pool of frustum instances. It may hold more entries than are
|
|
25751
|
+
* currently in use; surplus instances are kept for reuse to avoid
|
|
25752
|
+
* reallocating when array cameras of different lengths are rendered.
|
|
25753
|
+
*
|
|
25754
|
+
* @private
|
|
25755
|
+
* @type {Array<Frustum>}
|
|
25756
|
+
*/
|
|
25757
|
+
this._frustums = [];
|
|
25758
|
+
|
|
25759
|
+
/**
|
|
25760
|
+
* The number of frustums in {@link FrustumArray#_frustums} that are currently
|
|
25761
|
+
* in use.
|
|
25762
|
+
*
|
|
25763
|
+
* @private
|
|
25764
|
+
* @type {number}
|
|
25765
|
+
* @default 0
|
|
25766
|
+
*/
|
|
25767
|
+
this._count = 0;
|
|
25768
|
+
|
|
25461
25769
|
}
|
|
25462
25770
|
|
|
25463
25771
|
/**
|
|
25464
|
-
*
|
|
25465
|
-
* from the camera array.
|
|
25772
|
+
* Computes and caches a frustum for each camera of the given array camera.
|
|
25466
25773
|
*
|
|
25467
|
-
* @param {
|
|
25468
|
-
* @
|
|
25469
|
-
* @return {boolean} Whether the 3D object is visible in any camera.
|
|
25774
|
+
* @param {ArrayCamera} cameraArray - The array camera whose sub-cameras define the frustums.
|
|
25775
|
+
* @return {FrustumArray} A reference to this frustum array.
|
|
25470
25776
|
*/
|
|
25471
|
-
|
|
25777
|
+
setFromArrayCamera( cameraArray ) {
|
|
25472
25778
|
|
|
25473
|
-
|
|
25779
|
+
const cameras = cameraArray.cameras;
|
|
25780
|
+
const frustums = this._frustums;
|
|
25474
25781
|
|
|
25475
|
-
|
|
25782
|
+
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
25476
25783
|
|
|
25477
|
-
|
|
25784
|
+
const camera = cameras[ i ];
|
|
25478
25785
|
|
|
25479
|
-
|
|
25786
|
+
_projScreenMatrix$2.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
25480
25787
|
|
|
25481
|
-
|
|
25788
|
+
if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
|
|
25482
25789
|
|
|
25483
|
-
_projScreenMatrix$2.
|
|
25484
|
-
camera.projectionMatrix,
|
|
25485
|
-
camera.matrixWorldInverse
|
|
25486
|
-
);
|
|
25487
|
-
|
|
25488
|
-
_frustum$1.setFromProjectionMatrix(
|
|
25489
|
-
_projScreenMatrix$2,
|
|
25490
|
-
camera.coordinateSystem,
|
|
25491
|
-
camera.reversedDepth
|
|
25492
|
-
);
|
|
25493
|
-
|
|
25494
|
-
if ( _frustum$1.intersectsObject( object ) ) {
|
|
25495
|
-
|
|
25496
|
-
return true; // Object is visible in at least one camera
|
|
25497
|
-
|
|
25498
|
-
}
|
|
25790
|
+
frustums[ i ].setFromProjectionMatrix( _projScreenMatrix$2, camera.coordinateSystem, camera.reversedDepth );
|
|
25499
25791
|
|
|
25500
25792
|
}
|
|
25501
25793
|
|
|
25502
|
-
|
|
25794
|
+
this._count = cameras.length;
|
|
25795
|
+
|
|
25796
|
+
return this;
|
|
25503
25797
|
|
|
25504
25798
|
}
|
|
25505
25799
|
|
|
25506
25800
|
/**
|
|
25507
|
-
* Returns `true` if the
|
|
25508
|
-
* from the camera array.
|
|
25801
|
+
* Returns `true` if the 3D object's bounding sphere is intersecting any cached frustum.
|
|
25509
25802
|
*
|
|
25510
|
-
* @
|
|
25511
|
-
*
|
|
25512
|
-
* @
|
|
25803
|
+
* {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
|
|
25804
|
+
*
|
|
25805
|
+
* @param {Object3D} object - The 3D object to test.
|
|
25806
|
+
* @return {boolean} Whether the 3D object is visible in any camera.
|
|
25513
25807
|
*/
|
|
25514
|
-
|
|
25808
|
+
intersectsObject( object ) {
|
|
25515
25809
|
|
|
25516
|
-
|
|
25810
|
+
const frustums = this._frustums;
|
|
25517
25811
|
|
|
25518
|
-
|
|
25812
|
+
for ( let i = 0; i < this._count; i ++ ) {
|
|
25519
25813
|
|
|
25520
|
-
|
|
25814
|
+
if ( frustums[ i ].intersectsObject( object ) ) return true;
|
|
25521
25815
|
|
|
25522
|
-
|
|
25816
|
+
}
|
|
25523
25817
|
|
|
25524
|
-
|
|
25818
|
+
return false;
|
|
25525
25819
|
|
|
25526
|
-
|
|
25527
|
-
camera.projectionMatrix,
|
|
25528
|
-
camera.matrixWorldInverse
|
|
25529
|
-
);
|
|
25820
|
+
}
|
|
25530
25821
|
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
25534
|
-
|
|
25535
|
-
|
|
25822
|
+
/**
|
|
25823
|
+
* Returns `true` if the given sprite is intersecting any cached frustum.
|
|
25824
|
+
*
|
|
25825
|
+
* {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
|
|
25826
|
+
*
|
|
25827
|
+
* @param {Sprite} sprite - The sprite to test.
|
|
25828
|
+
* @return {boolean} Whether the sprite is visible in any camera.
|
|
25829
|
+
*/
|
|
25830
|
+
intersectsSprite( sprite ) {
|
|
25536
25831
|
|
|
25537
|
-
|
|
25832
|
+
const frustums = this._frustums;
|
|
25538
25833
|
|
|
25539
|
-
|
|
25834
|
+
for ( let i = 0; i < this._count; i ++ ) {
|
|
25540
25835
|
|
|
25541
|
-
|
|
25836
|
+
if ( frustums[ i ].intersectsSprite( sprite ) ) return true;
|
|
25542
25837
|
|
|
25543
25838
|
}
|
|
25544
25839
|
|
|
25545
|
-
return false;
|
|
25840
|
+
return false;
|
|
25546
25841
|
|
|
25547
25842
|
}
|
|
25548
25843
|
|
|
25549
25844
|
/**
|
|
25550
|
-
* Returns `true` if the given bounding sphere is intersecting any frustum
|
|
25551
|
-
*
|
|
25845
|
+
* Returns `true` if the given bounding sphere is intersecting any cached frustum.
|
|
25846
|
+
*
|
|
25847
|
+
* {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
|
|
25552
25848
|
*
|
|
25553
25849
|
* @param {Sphere} sphere - The bounding sphere to test.
|
|
25554
|
-
* @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
|
|
25555
25850
|
* @return {boolean} Whether the sphere is visible in any camera.
|
|
25556
25851
|
*/
|
|
25557
|
-
intersectsSphere( sphere
|
|
25558
|
-
|
|
25559
|
-
if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
|
|
25560
|
-
|
|
25561
|
-
return false;
|
|
25562
|
-
|
|
25563
|
-
}
|
|
25564
|
-
|
|
25565
|
-
for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
|
|
25566
|
-
|
|
25567
|
-
const camera = cameraArray.cameras[ i ];
|
|
25568
|
-
|
|
25569
|
-
_projScreenMatrix$2.multiplyMatrices(
|
|
25570
|
-
camera.projectionMatrix,
|
|
25571
|
-
camera.matrixWorldInverse
|
|
25572
|
-
);
|
|
25573
|
-
|
|
25574
|
-
_frustum$1.setFromProjectionMatrix(
|
|
25575
|
-
_projScreenMatrix$2,
|
|
25576
|
-
camera.coordinateSystem,
|
|
25577
|
-
camera.reversedDepth
|
|
25578
|
-
);
|
|
25852
|
+
intersectsSphere( sphere ) {
|
|
25579
25853
|
|
|
25580
|
-
|
|
25854
|
+
const frustums = this._frustums;
|
|
25581
25855
|
|
|
25582
|
-
|
|
25856
|
+
for ( let i = 0; i < this._count; i ++ ) {
|
|
25583
25857
|
|
|
25584
|
-
|
|
25858
|
+
if ( frustums[ i ].intersectsSphere( sphere ) ) return true;
|
|
25585
25859
|
|
|
25586
25860
|
}
|
|
25587
25861
|
|
|
25588
|
-
return false;
|
|
25862
|
+
return false;
|
|
25589
25863
|
|
|
25590
25864
|
}
|
|
25591
25865
|
|
|
25592
25866
|
/**
|
|
25593
|
-
* Returns `true` if the given bounding box is intersecting any frustum
|
|
25594
|
-
*
|
|
25867
|
+
* Returns `true` if the given bounding box is intersecting any cached frustum.
|
|
25868
|
+
*
|
|
25869
|
+
* {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
|
|
25595
25870
|
*
|
|
25596
25871
|
* @param {Box3} box - The bounding box to test.
|
|
25597
|
-
* @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
|
|
25598
25872
|
* @return {boolean} Whether the box is visible in any camera.
|
|
25599
25873
|
*/
|
|
25600
|
-
intersectsBox( box
|
|
25601
|
-
|
|
25602
|
-
if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
|
|
25603
|
-
|
|
25604
|
-
return false;
|
|
25605
|
-
|
|
25606
|
-
}
|
|
25607
|
-
|
|
25608
|
-
for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
|
|
25609
|
-
|
|
25610
|
-
const camera = cameraArray.cameras[ i ];
|
|
25611
|
-
|
|
25612
|
-
_projScreenMatrix$2.multiplyMatrices(
|
|
25613
|
-
camera.projectionMatrix,
|
|
25614
|
-
camera.matrixWorldInverse
|
|
25615
|
-
);
|
|
25616
|
-
|
|
25617
|
-
_frustum$1.setFromProjectionMatrix(
|
|
25618
|
-
_projScreenMatrix$2,
|
|
25619
|
-
camera.coordinateSystem,
|
|
25620
|
-
camera.reversedDepth
|
|
25621
|
-
);
|
|
25874
|
+
intersectsBox( box ) {
|
|
25622
25875
|
|
|
25623
|
-
|
|
25876
|
+
const frustums = this._frustums;
|
|
25624
25877
|
|
|
25625
|
-
|
|
25878
|
+
for ( let i = 0; i < this._count; i ++ ) {
|
|
25626
25879
|
|
|
25627
|
-
|
|
25880
|
+
if ( frustums[ i ].intersectsBox( box ) ) return true;
|
|
25628
25881
|
|
|
25629
25882
|
}
|
|
25630
25883
|
|
|
25631
|
-
return false;
|
|
25884
|
+
return false;
|
|
25632
25885
|
|
|
25633
25886
|
}
|
|
25634
25887
|
|
|
25635
25888
|
/**
|
|
25636
|
-
* Returns `true` if the given point lies within any frustum
|
|
25637
|
-
*
|
|
25889
|
+
* Returns `true` if the given point lies within any cached frustum.
|
|
25890
|
+
*
|
|
25891
|
+
* {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
|
|
25638
25892
|
*
|
|
25639
25893
|
* @param {Vector3} point - The point to test.
|
|
25640
|
-
* @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
|
|
25641
25894
|
* @return {boolean} Whether the point is visible in any camera.
|
|
25642
25895
|
*/
|
|
25643
|
-
containsPoint( point
|
|
25896
|
+
containsPoint( point ) {
|
|
25644
25897
|
|
|
25645
|
-
|
|
25898
|
+
const frustums = this._frustums;
|
|
25646
25899
|
|
|
25647
|
-
|
|
25900
|
+
for ( let i = 0; i < this._count; i ++ ) {
|
|
25901
|
+
|
|
25902
|
+
if ( frustums[ i ].containsPoint( point ) ) return true;
|
|
25648
25903
|
|
|
25649
25904
|
}
|
|
25650
25905
|
|
|
25651
|
-
|
|
25906
|
+
return false;
|
|
25652
25907
|
|
|
25653
|
-
|
|
25908
|
+
}
|
|
25654
25909
|
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
|
|
25910
|
+
/**
|
|
25911
|
+
* Copies the values of the given frustum array to this instance.
|
|
25912
|
+
*
|
|
25913
|
+
* @param {FrustumArray} frustumArray - The frustum array to copy.
|
|
25914
|
+
* @return {FrustumArray} A reference to this frustum array.
|
|
25915
|
+
*/
|
|
25916
|
+
copy( source ) {
|
|
25659
25917
|
|
|
25660
|
-
|
|
25661
|
-
_projScreenMatrix$2,
|
|
25662
|
-
camera.coordinateSystem,
|
|
25663
|
-
camera.reversedDepth
|
|
25664
|
-
);
|
|
25918
|
+
this.coordinateSystem = source.coordinateSystem;
|
|
25665
25919
|
|
|
25666
|
-
|
|
25920
|
+
const frustums = this._frustums;
|
|
25921
|
+
const sourceFrustums = source._frustums;
|
|
25667
25922
|
|
|
25668
|
-
|
|
25923
|
+
for ( let i = 0; i < source._count; i ++ ) {
|
|
25669
25924
|
|
|
25670
|
-
|
|
25925
|
+
if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
|
|
25926
|
+
|
|
25927
|
+
frustums[ i ].copy( sourceFrustums[ i ] );
|
|
25671
25928
|
|
|
25672
25929
|
}
|
|
25673
25930
|
|
|
25674
|
-
|
|
25931
|
+
this._count = source._count;
|
|
25932
|
+
|
|
25933
|
+
return this;
|
|
25675
25934
|
|
|
25676
25935
|
}
|
|
25677
25936
|
|
|
@@ -25682,7 +25941,7 @@ class FrustumArray {
|
|
|
25682
25941
|
*/
|
|
25683
25942
|
clone() {
|
|
25684
25943
|
|
|
25685
|
-
return new FrustumArray();
|
|
25944
|
+
return new FrustumArray().copy( this );
|
|
25686
25945
|
|
|
25687
25946
|
}
|
|
25688
25947
|
|
|
@@ -26953,7 +27212,7 @@ class BatchedMesh extends Mesh {
|
|
|
26953
27212
|
// throw an error if it can't be shrunk to the desired size
|
|
26954
27213
|
if ( maxInstanceCount < instanceInfo.length ) {
|
|
26955
27214
|
|
|
26956
|
-
throw new Error( `BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
|
|
27215
|
+
throw new Error( `THREE.BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
|
|
26957
27216
|
|
|
26958
27217
|
}
|
|
26959
27218
|
|
|
@@ -27005,7 +27264,7 @@ class BatchedMesh extends Mesh {
|
|
|
27005
27264
|
const requiredVertexLength = Math.max( ...validRanges.map( range => range.vertexStart + range.reservedVertexCount ) );
|
|
27006
27265
|
if ( requiredVertexLength > maxVertexCount ) {
|
|
27007
27266
|
|
|
27008
|
-
throw new Error( `BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
|
|
27267
|
+
throw new Error( `THREE.BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
|
|
27009
27268
|
|
|
27010
27269
|
}
|
|
27011
27270
|
|
|
@@ -27015,7 +27274,7 @@ class BatchedMesh extends Mesh {
|
|
|
27015
27274
|
const requiredIndexLength = Math.max( ...validRanges.map( range => range.indexStart + range.reservedIndexCount ) );
|
|
27016
27275
|
if ( requiredIndexLength > maxIndexCount ) {
|
|
27017
27276
|
|
|
27018
|
-
throw new Error( `BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
|
|
27277
|
+
throw new Error( `THREE.BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
|
|
27019
27278
|
|
|
27020
27279
|
}
|
|
27021
27280
|
|
|
@@ -27228,17 +27487,25 @@ class BatchedMesh extends Mesh {
|
|
|
27228
27487
|
|
|
27229
27488
|
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
27230
27489
|
// prepare the frustum in the local frame
|
|
27231
|
-
if ( perObjectFrustumCulled
|
|
27490
|
+
if ( perObjectFrustumCulled ) {
|
|
27232
27491
|
|
|
27233
|
-
|
|
27234
|
-
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
|
|
27235
|
-
.multiply( this.matrixWorld );
|
|
27492
|
+
if ( camera.isArrayCamera ) {
|
|
27236
27493
|
|
|
27237
|
-
|
|
27238
|
-
|
|
27239
|
-
|
|
27240
|
-
|
|
27241
|
-
|
|
27494
|
+
frustum.setFromArrayCamera( camera );
|
|
27495
|
+
|
|
27496
|
+
} else {
|
|
27497
|
+
|
|
27498
|
+
_matrix$1
|
|
27499
|
+
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
|
|
27500
|
+
.multiply( this.matrixWorld );
|
|
27501
|
+
|
|
27502
|
+
frustum.setFromProjectionMatrix(
|
|
27503
|
+
_matrix$1,
|
|
27504
|
+
camera.coordinateSystem,
|
|
27505
|
+
camera.reversedDepth
|
|
27506
|
+
);
|
|
27507
|
+
|
|
27508
|
+
}
|
|
27242
27509
|
|
|
27243
27510
|
}
|
|
27244
27511
|
|
|
@@ -27264,7 +27531,7 @@ class BatchedMesh extends Mesh {
|
|
|
27264
27531
|
let culled = false;
|
|
27265
27532
|
if ( perObjectFrustumCulled ) {
|
|
27266
27533
|
|
|
27267
|
-
culled = ! frustum.intersectsSphere( _sphere$2
|
|
27534
|
+
culled = ! frustum.intersectsSphere( _sphere$2 );
|
|
27268
27535
|
|
|
27269
27536
|
}
|
|
27270
27537
|
|
|
@@ -27321,7 +27588,7 @@ class BatchedMesh extends Mesh {
|
|
|
27321
27588
|
// get the bounds in world space
|
|
27322
27589
|
this.getMatrixAt( i, _matrix$1 );
|
|
27323
27590
|
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
27324
|
-
culled = ! frustum.intersectsSphere( _sphere$2
|
|
27591
|
+
culled = ! frustum.intersectsSphere( _sphere$2 );
|
|
27325
27592
|
|
|
27326
27593
|
}
|
|
27327
27594
|
|
|
@@ -27404,6 +27671,10 @@ class LineBasicMaterial extends Material {
|
|
|
27404
27671
|
* Sets the color of the lines using data from a texture. The texture map
|
|
27405
27672
|
* color is modulated by the diffuse `color`.
|
|
27406
27673
|
*
|
|
27674
|
+
* `map` represents color data, and the texture must be assigned a
|
|
27675
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
27676
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
27677
|
+
*
|
|
27407
27678
|
* @type {?Texture}
|
|
27408
27679
|
* @default null
|
|
27409
27680
|
*/
|
|
@@ -27957,6 +28228,10 @@ class PointsMaterial extends Material {
|
|
|
27957
28228
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
27958
28229
|
* color is modulated by the diffuse `color`.
|
|
27959
28230
|
*
|
|
28231
|
+
* `map` represents color data, and the texture must be assigned a
|
|
28232
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
28233
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
28234
|
+
*
|
|
27960
28235
|
* @type {?Texture}
|
|
27961
28236
|
* @default null
|
|
27962
28237
|
*/
|
|
@@ -27972,6 +28247,9 @@ class PointsMaterial extends Material {
|
|
|
27972
28247
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
27973
28248
|
* luminance/alpha textures will also still work as expected.
|
|
27974
28249
|
*
|
|
28250
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
28251
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
28252
|
+
*
|
|
27975
28253
|
* @type {?Texture}
|
|
27976
28254
|
* @default null
|
|
27977
28255
|
*/
|
|
@@ -28949,7 +29227,7 @@ class DepthTexture extends Texture {
|
|
|
28949
29227
|
|
|
28950
29228
|
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
28951
29229
|
|
|
28952
|
-
throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
29230
|
+
throw new Error( 'THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
28953
29231
|
|
|
28954
29232
|
}
|
|
28955
29233
|
|
|
@@ -29099,9 +29377,6 @@ class CubeDepthTexture extends DepthTexture {
|
|
|
29099
29377
|
* This may be a texture from a protected media stream, device camera feed,
|
|
29100
29378
|
* or other data feeds like a depth sensor.
|
|
29101
29379
|
*
|
|
29102
|
-
* Note that this class is only supported in {@link WebGLRenderer}, and in
|
|
29103
|
-
* the {@link WebGPURenderer} WebGPU backend.
|
|
29104
|
-
*
|
|
29105
29380
|
* @augments Texture
|
|
29106
29381
|
*/
|
|
29107
29382
|
class ExternalTexture extends Texture {
|
|
@@ -36223,6 +36498,10 @@ class SphereGeometry extends BufferGeometry {
|
|
|
36223
36498
|
const verticesRow = [];
|
|
36224
36499
|
|
|
36225
36500
|
const v = iy / heightSegments;
|
|
36501
|
+
const theta = thetaStart + v * thetaLength;
|
|
36502
|
+
|
|
36503
|
+
const y = radius * Math.cos( theta );
|
|
36504
|
+
const ringRadius = Math.sqrt( radius * radius - y * y );
|
|
36226
36505
|
|
|
36227
36506
|
// special case for the poles
|
|
36228
36507
|
|
|
@@ -36241,12 +36520,13 @@ class SphereGeometry extends BufferGeometry {
|
|
|
36241
36520
|
for ( let ix = 0; ix <= widthSegments; ix ++ ) {
|
|
36242
36521
|
|
|
36243
36522
|
const u = ix / widthSegments;
|
|
36523
|
+
const phi = phiStart + u * phiLength;
|
|
36244
36524
|
|
|
36245
36525
|
// vertex
|
|
36246
36526
|
|
|
36247
|
-
vertex.x = -
|
|
36248
|
-
vertex.y =
|
|
36249
|
-
vertex.z =
|
|
36527
|
+
vertex.x = - ringRadius * Math.cos( phi );
|
|
36528
|
+
vertex.y = y;
|
|
36529
|
+
vertex.z = ringRadius * Math.sin( phi );
|
|
36250
36530
|
|
|
36251
36531
|
vertices.push( vertex.x, vertex.y, vertex.z );
|
|
36252
36532
|
|
|
@@ -37817,6 +38097,86 @@ class ShaderMaterial extends Material {
|
|
|
37817
38097
|
|
|
37818
38098
|
}
|
|
37819
38099
|
|
|
38100
|
+
/**
|
|
38101
|
+
* Deserializes the material from the given JSON.
|
|
38102
|
+
*
|
|
38103
|
+
* @param {Object} json - The JSON holding the serialized material.
|
|
38104
|
+
* @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
|
|
38105
|
+
* @return {ShaderMaterial} A reference to this material.
|
|
38106
|
+
*/
|
|
38107
|
+
fromJSON( json, textures ) {
|
|
38108
|
+
|
|
38109
|
+
super.fromJSON( json, textures );
|
|
38110
|
+
|
|
38111
|
+
if ( json.uniforms !== undefined ) {
|
|
38112
|
+
|
|
38113
|
+
for ( const name in json.uniforms ) {
|
|
38114
|
+
|
|
38115
|
+
const uniform = json.uniforms[ name ];
|
|
38116
|
+
|
|
38117
|
+
this.uniforms[ name ] = {};
|
|
38118
|
+
|
|
38119
|
+
switch ( uniform.type ) {
|
|
38120
|
+
|
|
38121
|
+
case 't':
|
|
38122
|
+
this.uniforms[ name ].value = textures[ uniform.value ] || null;
|
|
38123
|
+
break;
|
|
38124
|
+
|
|
38125
|
+
case 'c':
|
|
38126
|
+
this.uniforms[ name ].value = new Color().setHex( uniform.value );
|
|
38127
|
+
break;
|
|
38128
|
+
|
|
38129
|
+
case 'v2':
|
|
38130
|
+
this.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
|
|
38131
|
+
break;
|
|
38132
|
+
|
|
38133
|
+
case 'v3':
|
|
38134
|
+
this.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
|
|
38135
|
+
break;
|
|
38136
|
+
|
|
38137
|
+
case 'v4':
|
|
38138
|
+
this.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
|
|
38139
|
+
break;
|
|
38140
|
+
|
|
38141
|
+
case 'm3':
|
|
38142
|
+
this.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
|
|
38143
|
+
break;
|
|
38144
|
+
|
|
38145
|
+
case 'm4':
|
|
38146
|
+
this.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
|
|
38147
|
+
break;
|
|
38148
|
+
|
|
38149
|
+
default:
|
|
38150
|
+
this.uniforms[ name ].value = uniform.value;
|
|
38151
|
+
|
|
38152
|
+
}
|
|
38153
|
+
|
|
38154
|
+
}
|
|
38155
|
+
|
|
38156
|
+
}
|
|
38157
|
+
|
|
38158
|
+
if ( json.defines !== undefined ) this.defines = json.defines;
|
|
38159
|
+
if ( json.vertexShader !== undefined ) this.vertexShader = json.vertexShader;
|
|
38160
|
+
if ( json.fragmentShader !== undefined ) this.fragmentShader = json.fragmentShader;
|
|
38161
|
+
if ( json.glslVersion !== undefined ) this.glslVersion = json.glslVersion;
|
|
38162
|
+
|
|
38163
|
+
if ( json.extensions !== undefined ) {
|
|
38164
|
+
|
|
38165
|
+
for ( const key in json.extensions ) {
|
|
38166
|
+
|
|
38167
|
+
this.extensions[ key ] = json.extensions[ key ];
|
|
38168
|
+
|
|
38169
|
+
}
|
|
38170
|
+
|
|
38171
|
+
}
|
|
38172
|
+
|
|
38173
|
+
if ( json.lights !== undefined ) this.lights = json.lights;
|
|
38174
|
+
if ( json.clipping !== undefined ) this.clipping = json.clipping;
|
|
38175
|
+
|
|
38176
|
+
return this;
|
|
38177
|
+
|
|
38178
|
+
}
|
|
38179
|
+
|
|
37820
38180
|
}
|
|
37821
38181
|
|
|
37822
38182
|
/**
|
|
@@ -37954,6 +38314,10 @@ class MeshStandardMaterial extends Material {
|
|
|
37954
38314
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
37955
38315
|
* color is modulated by the diffuse `color`.
|
|
37956
38316
|
*
|
|
38317
|
+
* `map` represents color data, and the texture must be assigned a
|
|
38318
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
38319
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
38320
|
+
*
|
|
37957
38321
|
* @type {?Texture}
|
|
37958
38322
|
* @default null
|
|
37959
38323
|
*/
|
|
@@ -37962,6 +38326,11 @@ class MeshStandardMaterial extends Material {
|
|
|
37962
38326
|
/**
|
|
37963
38327
|
* The light map. Requires a second set of UVs.
|
|
37964
38328
|
*
|
|
38329
|
+
* `lightMap` represents pre-baked illuminance data, and the texture must be assigned
|
|
38330
|
+
* a {@link Texture#colorSpace}. Most `lightMap` textures set
|
|
38331
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
38332
|
+
* such as `.exr` or `.hdr`.
|
|
38333
|
+
*
|
|
37965
38334
|
* @type {?Texture}
|
|
37966
38335
|
* @default null
|
|
37967
38336
|
*/
|
|
@@ -37979,6 +38348,9 @@ class MeshStandardMaterial extends Material {
|
|
|
37979
38348
|
* The red channel of this texture is used as the ambient occlusion map.
|
|
37980
38349
|
* Requires a second set of UVs.
|
|
37981
38350
|
*
|
|
38351
|
+
* `aoMap` represents non-color data. Any texture assigned must have
|
|
38352
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38353
|
+
*
|
|
37982
38354
|
* @type {?Texture}
|
|
37983
38355
|
* @default null
|
|
37984
38356
|
*/
|
|
@@ -38016,6 +38388,10 @@ class MeshStandardMaterial extends Material {
|
|
|
38016
38388
|
* emissive color and the emissive intensity. If you have an emissive map,
|
|
38017
38389
|
* be sure to set the emissive color to something other than black.
|
|
38018
38390
|
*
|
|
38391
|
+
* `emissiveMap` represents color data, and the texture must be assigned a
|
|
38392
|
+
* {@link Texture#colorSpace}. Most `emissiveMap` textures set
|
|
38393
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
38394
|
+
*
|
|
38019
38395
|
* @type {?Texture}
|
|
38020
38396
|
* @default null
|
|
38021
38397
|
*/
|
|
@@ -38027,6 +38403,9 @@ class MeshStandardMaterial extends Material {
|
|
|
38027
38403
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
38028
38404
|
* this will be ignored.
|
|
38029
38405
|
*
|
|
38406
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
38407
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38408
|
+
*
|
|
38030
38409
|
* @type {?Texture}
|
|
38031
38410
|
* @default null
|
|
38032
38411
|
*/
|
|
@@ -38048,6 +38427,9 @@ class MeshStandardMaterial extends Material {
|
|
|
38048
38427
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
38049
38428
|
* for the different handedness.
|
|
38050
38429
|
*
|
|
38430
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
38431
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38432
|
+
*
|
|
38051
38433
|
* @type {?Texture}
|
|
38052
38434
|
* @default null
|
|
38053
38435
|
*/
|
|
@@ -38075,7 +38457,12 @@ class MeshStandardMaterial extends Material {
|
|
|
38075
38457
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
38076
38458
|
* act as real geometry. The displacement texture is an image where the value
|
|
38077
38459
|
* of each pixel (white being the highest) is mapped against, and
|
|
38078
|
-
* repositions, the vertices of the mesh.
|
|
38460
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
38461
|
+
* displacement map with a matching normal map, since the renderer can
|
|
38462
|
+
* not recompute surface normals from the displaced vertices.
|
|
38463
|
+
*
|
|
38464
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
38465
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38079
38466
|
*
|
|
38080
38467
|
* @type {?Texture}
|
|
38081
38468
|
* @default null
|
|
@@ -38106,6 +38493,9 @@ class MeshStandardMaterial extends Material {
|
|
|
38106
38493
|
* The green channel of this texture is used to alter the roughness of the
|
|
38107
38494
|
* material.
|
|
38108
38495
|
*
|
|
38496
|
+
* `roughnessMap` represents non-color data. Any texture assigned must have
|
|
38497
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38498
|
+
*
|
|
38109
38499
|
* @type {?Texture}
|
|
38110
38500
|
* @default null
|
|
38111
38501
|
*/
|
|
@@ -38115,6 +38505,9 @@ class MeshStandardMaterial extends Material {
|
|
|
38115
38505
|
* The blue channel of this texture is used to alter the metalness of the
|
|
38116
38506
|
* material.
|
|
38117
38507
|
*
|
|
38508
|
+
* `metalnessMap` represents non-color data. Any texture assigned must have
|
|
38509
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38510
|
+
*
|
|
38118
38511
|
* @type {?Texture}
|
|
38119
38512
|
* @default null
|
|
38120
38513
|
*/
|
|
@@ -38130,6 +38523,9 @@ class MeshStandardMaterial extends Material {
|
|
|
38130
38523
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
38131
38524
|
* luminance/alpha textures will also still work as expected.
|
|
38132
38525
|
*
|
|
38526
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
38527
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38528
|
+
*
|
|
38133
38529
|
* @type {?Texture}
|
|
38134
38530
|
* @default null
|
|
38135
38531
|
*/
|
|
@@ -38139,6 +38535,11 @@ class MeshStandardMaterial extends Material {
|
|
|
38139
38535
|
* The environment map. To ensure a physically correct rendering, environment maps
|
|
38140
38536
|
* are internally pre-processed with {@link PMREMGenerator}.
|
|
38141
38537
|
*
|
|
38538
|
+
* `envMap` represents luminance data, and the texture must be assigned
|
|
38539
|
+
* a {@link Texture#colorSpace}. Most `envMap` textures set
|
|
38540
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
38541
|
+
* such as `.exr` or `.hdr`.
|
|
38542
|
+
*
|
|
38142
38543
|
* @type {?Texture}
|
|
38143
38544
|
* @default null
|
|
38144
38545
|
*/
|
|
@@ -38350,6 +38751,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38350
38751
|
* bitangent space, to be rotated by `anisotropyRotation`. The blue channel
|
|
38351
38752
|
* contains strength as `[0, 1]` to be multiplied by `anisotropy`.
|
|
38352
38753
|
*
|
|
38754
|
+
* `anisotropyMap` represents non-color data. Any texture assigned must have
|
|
38755
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38756
|
+
*
|
|
38353
38757
|
* @type {?Texture}
|
|
38354
38758
|
* @default null
|
|
38355
38759
|
*/
|
|
@@ -38359,6 +38763,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38359
38763
|
* The red channel of this texture is multiplied against `clearcoat`,
|
|
38360
38764
|
* for per-pixel control over a coating's intensity.
|
|
38361
38765
|
*
|
|
38766
|
+
* `clearcoatMap` represents non-color data. Any texture assigned must have
|
|
38767
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38768
|
+
*
|
|
38362
38769
|
* @type {?Texture}
|
|
38363
38770
|
* @default null
|
|
38364
38771
|
*/
|
|
@@ -38376,6 +38783,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38376
38783
|
* The green channel of this texture is multiplied against
|
|
38377
38784
|
* `clearcoatRoughness`, for per-pixel control over a coating's roughness.
|
|
38378
38785
|
*
|
|
38786
|
+
* `clearcoatRoughnessMap` represents non-color data. Any texture assigned must have
|
|
38787
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38788
|
+
*
|
|
38379
38789
|
* @type {?Texture}
|
|
38380
38790
|
* @default null
|
|
38381
38791
|
*/
|
|
@@ -38393,6 +38803,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38393
38803
|
/**
|
|
38394
38804
|
* Can be used to enable independent normals for the clear coat layer.
|
|
38395
38805
|
*
|
|
38806
|
+
* `clearcoatNormalMap` represents non-color data. Any texture assigned must have
|
|
38807
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38808
|
+
*
|
|
38396
38809
|
* @type {?Texture}
|
|
38397
38810
|
* @default null
|
|
38398
38811
|
*/
|
|
@@ -38434,6 +38847,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38434
38847
|
* The red channel of this texture is multiplied against `iridescence`, for per-pixel
|
|
38435
38848
|
* control over iridescence.
|
|
38436
38849
|
*
|
|
38850
|
+
* `iridescenceMap` represents non-color data. Any texture assigned must have
|
|
38851
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38852
|
+
*
|
|
38437
38853
|
* @type {?Texture}
|
|
38438
38854
|
* @default null
|
|
38439
38855
|
*/
|
|
@@ -38464,6 +38880,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38464
38880
|
* - `1.0` in the green channel will result in thickness equal to second element of the array.
|
|
38465
38881
|
* - Values in-between will linearly interpolate between the elements of the array.
|
|
38466
38882
|
*
|
|
38883
|
+
* `iridescenceThicknessMap` represents non-color data. Any texture assigned must have
|
|
38884
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38885
|
+
*
|
|
38467
38886
|
* @type {?Texture}
|
|
38468
38887
|
* @default null
|
|
38469
38888
|
*/
|
|
@@ -38481,6 +38900,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38481
38900
|
* The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control
|
|
38482
38901
|
* over sheen tint.
|
|
38483
38902
|
*
|
|
38903
|
+
* `sheenColorMap` represents color data, and the texture must be assigned a
|
|
38904
|
+
* {@link Texture#colorSpace}. Most `sheenColorMap` textures set
|
|
38905
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
38906
|
+
*
|
|
38484
38907
|
* @type {?Texture}
|
|
38485
38908
|
* @default null
|
|
38486
38909
|
*/
|
|
@@ -38498,6 +38921,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38498
38921
|
* The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control
|
|
38499
38922
|
* over sheen roughness.
|
|
38500
38923
|
*
|
|
38924
|
+
* `sheenRoughnessMap` represents non-color data. Any texture assigned must have
|
|
38925
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38926
|
+
*
|
|
38501
38927
|
* @type {?Texture}
|
|
38502
38928
|
* @default null
|
|
38503
38929
|
*/
|
|
@@ -38507,6 +38933,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38507
38933
|
* The red channel of this texture is multiplied against `transmission`, for per-pixel control over
|
|
38508
38934
|
* optical transparency.
|
|
38509
38935
|
*
|
|
38936
|
+
* `transmissionMap` represents non-color data. Any texture assigned must have
|
|
38937
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38938
|
+
*
|
|
38510
38939
|
* @type {?Texture}
|
|
38511
38940
|
* @default null
|
|
38512
38941
|
*/
|
|
@@ -38526,6 +38955,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38526
38955
|
* A texture that defines the thickness, stored in the green channel. This will
|
|
38527
38956
|
* be multiplied by `thickness`.
|
|
38528
38957
|
*
|
|
38958
|
+
* `thicknessMap` represents non-color data. Any texture assigned must have
|
|
38959
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
38960
|
+
*
|
|
38529
38961
|
* @type {?Texture}
|
|
38530
38962
|
* @default null
|
|
38531
38963
|
*/
|
|
@@ -38563,6 +38995,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38563
38995
|
* The alpha channel of this texture is multiplied against `specularIntensity`,
|
|
38564
38996
|
* for per-pixel control over specular intensity.
|
|
38565
38997
|
*
|
|
38998
|
+
* `specularIntensityMap` represents non-color data. Any texture assigned must have
|
|
38999
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39000
|
+
*
|
|
38566
39001
|
* @type {?Texture}
|
|
38567
39002
|
* @default null
|
|
38568
39003
|
*/
|
|
@@ -38580,6 +39015,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38580
39015
|
* The RGB channels of this texture are multiplied against `specularColor`,
|
|
38581
39016
|
* for per-pixel control over specular color.
|
|
38582
39017
|
*
|
|
39018
|
+
* `specularColorMap` represents color data, and the texture must be assigned a
|
|
39019
|
+
* {@link Texture#colorSpace}. Most `specularColorMap` textures set
|
|
39020
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39021
|
+
*
|
|
38583
39022
|
* @type {?Texture}
|
|
38584
39023
|
* @default null
|
|
38585
39024
|
*/
|
|
@@ -38877,6 +39316,10 @@ class MeshPhongMaterial extends Material {
|
|
|
38877
39316
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
38878
39317
|
* color is modulated by the diffuse `color`.
|
|
38879
39318
|
*
|
|
39319
|
+
* `map` represents color data, and the texture must be assigned a
|
|
39320
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
39321
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39322
|
+
*
|
|
38880
39323
|
* @type {?Texture}
|
|
38881
39324
|
* @default null
|
|
38882
39325
|
*/
|
|
@@ -38885,6 +39328,11 @@ class MeshPhongMaterial extends Material {
|
|
|
38885
39328
|
/**
|
|
38886
39329
|
* The light map. Requires a second set of UVs.
|
|
38887
39330
|
*
|
|
39331
|
+
* `lightMap` represents pre-baked illuminance data, and the texture must be assigned
|
|
39332
|
+
* a {@link Texture#colorSpace}. Most `lightMap` textures set
|
|
39333
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
39334
|
+
* such as `.exr` or `.hdr`.
|
|
39335
|
+
*
|
|
38888
39336
|
* @type {?Texture}
|
|
38889
39337
|
* @default null
|
|
38890
39338
|
*/
|
|
@@ -38902,6 +39350,9 @@ class MeshPhongMaterial extends Material {
|
|
|
38902
39350
|
* The red channel of this texture is used as the ambient occlusion map.
|
|
38903
39351
|
* Requires a second set of UVs.
|
|
38904
39352
|
*
|
|
39353
|
+
* `aoMap` represents non-color data. Any texture assigned must have
|
|
39354
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39355
|
+
*
|
|
38905
39356
|
* @type {?Texture}
|
|
38906
39357
|
* @default null
|
|
38907
39358
|
*/
|
|
@@ -38939,6 +39390,10 @@ class MeshPhongMaterial extends Material {
|
|
|
38939
39390
|
* emissive color and the emissive intensity. If you have an emissive map,
|
|
38940
39391
|
* be sure to set the emissive color to something other than black.
|
|
38941
39392
|
*
|
|
39393
|
+
* `emissiveMap` represents color data, and the texture must be assigned a
|
|
39394
|
+
* {@link Texture#colorSpace}. Most `emissiveMap` textures set
|
|
39395
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39396
|
+
*
|
|
38942
39397
|
* @type {?Texture}
|
|
38943
39398
|
* @default null
|
|
38944
39399
|
*/
|
|
@@ -38950,6 +39405,9 @@ class MeshPhongMaterial extends Material {
|
|
|
38950
39405
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
38951
39406
|
* this will be ignored.
|
|
38952
39407
|
*
|
|
39408
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
39409
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39410
|
+
*
|
|
38953
39411
|
* @type {?Texture}
|
|
38954
39412
|
* @default null
|
|
38955
39413
|
*/
|
|
@@ -38971,6 +39429,9 @@ class MeshPhongMaterial extends Material {
|
|
|
38971
39429
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
38972
39430
|
* for the different handedness.
|
|
38973
39431
|
*
|
|
39432
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
39433
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39434
|
+
*
|
|
38974
39435
|
* @type {?Texture}
|
|
38975
39436
|
* @default null
|
|
38976
39437
|
*/
|
|
@@ -38998,7 +39459,12 @@ class MeshPhongMaterial extends Material {
|
|
|
38998
39459
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
38999
39460
|
* act as real geometry. The displacement texture is an image where the value
|
|
39000
39461
|
* of each pixel (white being the highest) is mapped against, and
|
|
39001
|
-
* repositions, the vertices of the mesh.
|
|
39462
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
39463
|
+
* displacement map with a matching normal map, since the renderer can
|
|
39464
|
+
* not recompute surface normals from the displaced vertices.
|
|
39465
|
+
*
|
|
39466
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
39467
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39002
39468
|
*
|
|
39003
39469
|
* @type {?Texture}
|
|
39004
39470
|
* @default null
|
|
@@ -39030,6 +39496,10 @@ class MeshPhongMaterial extends Material {
|
|
|
39030
39496
|
* highlight contributes and how much of the environment map affects the
|
|
39031
39497
|
* surface.
|
|
39032
39498
|
*
|
|
39499
|
+
* `specularMap` represents color data, and the texture must be assigned a
|
|
39500
|
+
* {@link Texture#colorSpace}. Most `specularMap` textures set
|
|
39501
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39502
|
+
*
|
|
39033
39503
|
* @type {?Texture}
|
|
39034
39504
|
* @default null
|
|
39035
39505
|
*/
|
|
@@ -39045,6 +39515,9 @@ class MeshPhongMaterial extends Material {
|
|
|
39045
39515
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
39046
39516
|
* luminance/alpha textures will also still work as expected.
|
|
39047
39517
|
*
|
|
39518
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
39519
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39520
|
+
*
|
|
39048
39521
|
* @type {?Texture}
|
|
39049
39522
|
* @default null
|
|
39050
39523
|
*/
|
|
@@ -39053,6 +39526,11 @@ class MeshPhongMaterial extends Material {
|
|
|
39053
39526
|
/**
|
|
39054
39527
|
* The environment map.
|
|
39055
39528
|
*
|
|
39529
|
+
* `envMap` represents luminance data, and the texture must be assigned
|
|
39530
|
+
* a {@link Texture#colorSpace}. Most `envMap` textures set
|
|
39531
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
39532
|
+
* such as `.exr` or `.hdr`.
|
|
39533
|
+
*
|
|
39056
39534
|
* @type {?Texture}
|
|
39057
39535
|
* @default null
|
|
39058
39536
|
*/
|
|
@@ -39267,6 +39745,10 @@ class MeshToonMaterial extends Material {
|
|
|
39267
39745
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
39268
39746
|
* color is modulated by the diffuse `color`.
|
|
39269
39747
|
*
|
|
39748
|
+
* `map` represents color data, and the texture must be assigned a
|
|
39749
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
39750
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39751
|
+
*
|
|
39270
39752
|
* @type {?Texture}
|
|
39271
39753
|
* @default null
|
|
39272
39754
|
*/
|
|
@@ -39277,6 +39759,9 @@ class MeshToonMaterial extends Material {
|
|
|
39277
39759
|
* {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
|
|
39278
39760
|
* when using this type of texture.
|
|
39279
39761
|
*
|
|
39762
|
+
* `gradientMap` represents non-color data. Any texture assigned must have
|
|
39763
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39764
|
+
*
|
|
39280
39765
|
* @type {?Texture}
|
|
39281
39766
|
* @default null
|
|
39282
39767
|
*/
|
|
@@ -39285,6 +39770,11 @@ class MeshToonMaterial extends Material {
|
|
|
39285
39770
|
/**
|
|
39286
39771
|
* The light map. Requires a second set of UVs.
|
|
39287
39772
|
*
|
|
39773
|
+
* `lightMap` represents pre-baked illuminance data, and the texture must be assigned
|
|
39774
|
+
* a {@link Texture#colorSpace}. Most `lightMap` textures set
|
|
39775
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
39776
|
+
* such as `.exr` or `.hdr`.
|
|
39777
|
+
*
|
|
39288
39778
|
* @type {?Texture}
|
|
39289
39779
|
* @default null
|
|
39290
39780
|
*/
|
|
@@ -39302,6 +39792,9 @@ class MeshToonMaterial extends Material {
|
|
|
39302
39792
|
* The red channel of this texture is used as the ambient occlusion map.
|
|
39303
39793
|
* Requires a second set of UVs.
|
|
39304
39794
|
*
|
|
39795
|
+
* `aoMap` represents non-color data. Any texture assigned must have
|
|
39796
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39797
|
+
*
|
|
39305
39798
|
* @type {?Texture}
|
|
39306
39799
|
* @default null
|
|
39307
39800
|
*/
|
|
@@ -39339,6 +39832,10 @@ class MeshToonMaterial extends Material {
|
|
|
39339
39832
|
* emissive color and the emissive intensity. If you have an emissive map,
|
|
39340
39833
|
* be sure to set the emissive color to something other than black.
|
|
39341
39834
|
*
|
|
39835
|
+
* `emissiveMap` represents color data, and the texture must be assigned a
|
|
39836
|
+
* {@link Texture#colorSpace}. Most `emissiveMap` textures set
|
|
39837
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
39838
|
+
*
|
|
39342
39839
|
* @type {?Texture}
|
|
39343
39840
|
* @default null
|
|
39344
39841
|
*/
|
|
@@ -39350,6 +39847,9 @@ class MeshToonMaterial extends Material {
|
|
|
39350
39847
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
39351
39848
|
* this will be ignored.
|
|
39352
39849
|
*
|
|
39850
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
39851
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39852
|
+
*
|
|
39353
39853
|
* @type {?Texture}
|
|
39354
39854
|
* @default null
|
|
39355
39855
|
*/
|
|
@@ -39371,6 +39871,9 @@ class MeshToonMaterial extends Material {
|
|
|
39371
39871
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
39372
39872
|
* for the different handedness.
|
|
39373
39873
|
*
|
|
39874
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
39875
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39876
|
+
*
|
|
39374
39877
|
* @type {?Texture}
|
|
39375
39878
|
* @default null
|
|
39376
39879
|
*/
|
|
@@ -39398,7 +39901,12 @@ class MeshToonMaterial extends Material {
|
|
|
39398
39901
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
39399
39902
|
* act as real geometry. The displacement texture is an image where the value
|
|
39400
39903
|
* of each pixel (white being the highest) is mapped against, and
|
|
39401
|
-
* repositions, the vertices of the mesh.
|
|
39904
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
39905
|
+
* displacement map with a matching normal map, since the renderer can
|
|
39906
|
+
* not recompute surface normals from the displaced vertices.
|
|
39907
|
+
*
|
|
39908
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
39909
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39402
39910
|
*
|
|
39403
39911
|
* @type {?Texture}
|
|
39404
39912
|
* @default null
|
|
@@ -39435,6 +39943,9 @@ class MeshToonMaterial extends Material {
|
|
|
39435
39943
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
39436
39944
|
* luminance/alpha textures will also still work as expected.
|
|
39437
39945
|
*
|
|
39946
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
39947
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39948
|
+
*
|
|
39438
39949
|
* @type {?Texture}
|
|
39439
39950
|
* @default null
|
|
39440
39951
|
*/
|
|
@@ -39573,6 +40084,9 @@ class MeshNormalMaterial extends Material {
|
|
|
39573
40084
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
39574
40085
|
* this will be ignored.
|
|
39575
40086
|
*
|
|
40087
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
40088
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40089
|
+
*
|
|
39576
40090
|
* @type {?Texture}
|
|
39577
40091
|
* @default null
|
|
39578
40092
|
*/
|
|
@@ -39594,6 +40108,9 @@ class MeshNormalMaterial extends Material {
|
|
|
39594
40108
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
39595
40109
|
* for the different handedness.
|
|
39596
40110
|
*
|
|
40111
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
40112
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40113
|
+
*
|
|
39597
40114
|
* @type {?Texture}
|
|
39598
40115
|
* @default null
|
|
39599
40116
|
*/
|
|
@@ -39621,7 +40138,9 @@ class MeshNormalMaterial extends Material {
|
|
|
39621
40138
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
39622
40139
|
* act as real geometry. The displacement texture is an image where the value
|
|
39623
40140
|
* of each pixel (white being the highest) is mapped against, and
|
|
39624
|
-
* repositions, the vertices of the mesh.
|
|
40141
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
40142
|
+
* displacement map with a matching normal map, since the renderer can
|
|
40143
|
+
* not recompute surface normals from the displaced vertices.
|
|
39625
40144
|
*
|
|
39626
40145
|
* @type {?Texture}
|
|
39627
40146
|
* @default null
|
|
@@ -39761,6 +40280,10 @@ class MeshLambertMaterial extends Material {
|
|
|
39761
40280
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
39762
40281
|
* color is modulated by the diffuse `color`.
|
|
39763
40282
|
*
|
|
40283
|
+
* `map` represents color data, and the texture must be assigned a
|
|
40284
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
40285
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40286
|
+
*
|
|
39764
40287
|
* @type {?Texture}
|
|
39765
40288
|
* @default null
|
|
39766
40289
|
*/
|
|
@@ -39769,6 +40292,11 @@ class MeshLambertMaterial extends Material {
|
|
|
39769
40292
|
/**
|
|
39770
40293
|
* The light map. Requires a second set of UVs.
|
|
39771
40294
|
*
|
|
40295
|
+
* `lightMap` represents pre-baked illuminance data, and the texture must be assigned
|
|
40296
|
+
* a {@link Texture#colorSpace}. Most `lightMap` textures set
|
|
40297
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
40298
|
+
* such as `.exr` or `.hdr`.
|
|
40299
|
+
*
|
|
39772
40300
|
* @type {?Texture}
|
|
39773
40301
|
* @default null
|
|
39774
40302
|
*/
|
|
@@ -39786,6 +40314,9 @@ class MeshLambertMaterial extends Material {
|
|
|
39786
40314
|
* The red channel of this texture is used as the ambient occlusion map.
|
|
39787
40315
|
* Requires a second set of UVs.
|
|
39788
40316
|
*
|
|
40317
|
+
* `aoMap` represents non-color data. Any texture assigned must have
|
|
40318
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40319
|
+
*
|
|
39789
40320
|
* @type {?Texture}
|
|
39790
40321
|
* @default null
|
|
39791
40322
|
*/
|
|
@@ -39823,6 +40354,10 @@ class MeshLambertMaterial extends Material {
|
|
|
39823
40354
|
* emissive color and the emissive intensity. If you have an emissive map,
|
|
39824
40355
|
* be sure to set the emissive color to something other than black.
|
|
39825
40356
|
*
|
|
40357
|
+
* `emissiveMap` represents color data, and the texture must be assigned a
|
|
40358
|
+
* {@link Texture#colorSpace}. Most `emissiveMap` textures set
|
|
40359
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40360
|
+
*
|
|
39826
40361
|
* @type {?Texture}
|
|
39827
40362
|
* @default null
|
|
39828
40363
|
*/
|
|
@@ -39834,6 +40369,9 @@ class MeshLambertMaterial extends Material {
|
|
|
39834
40369
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
39835
40370
|
* this will be ignored.
|
|
39836
40371
|
*
|
|
40372
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
40373
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40374
|
+
*
|
|
39837
40375
|
* @type {?Texture}
|
|
39838
40376
|
* @default null
|
|
39839
40377
|
*/
|
|
@@ -39855,6 +40393,9 @@ class MeshLambertMaterial extends Material {
|
|
|
39855
40393
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
39856
40394
|
* for the different handedness.
|
|
39857
40395
|
*
|
|
40396
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
40397
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40398
|
+
*
|
|
39858
40399
|
* @type {?Texture}
|
|
39859
40400
|
* @default null
|
|
39860
40401
|
*/
|
|
@@ -39882,7 +40423,12 @@ class MeshLambertMaterial extends Material {
|
|
|
39882
40423
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
39883
40424
|
* act as real geometry. The displacement texture is an image where the value
|
|
39884
40425
|
* of each pixel (white being the highest) is mapped against, and
|
|
39885
|
-
* repositions, the vertices of the mesh.
|
|
40426
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
40427
|
+
* displacement map with a matching normal map, since the renderer can
|
|
40428
|
+
* not recompute surface normals from the displaced vertices.
|
|
40429
|
+
*
|
|
40430
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
40431
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
39886
40432
|
*
|
|
39887
40433
|
* @type {?Texture}
|
|
39888
40434
|
* @default null
|
|
@@ -39912,6 +40458,10 @@ class MeshLambertMaterial extends Material {
|
|
|
39912
40458
|
/**
|
|
39913
40459
|
* Specular map used by the material.
|
|
39914
40460
|
*
|
|
40461
|
+
* `specularMap` represents color data, and the texture must be assigned a
|
|
40462
|
+
* {@link Texture#colorSpace}. Most `specularMap` textures set
|
|
40463
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40464
|
+
*
|
|
39915
40465
|
* @type {?Texture}
|
|
39916
40466
|
* @default null
|
|
39917
40467
|
*/
|
|
@@ -39927,6 +40477,9 @@ class MeshLambertMaterial extends Material {
|
|
|
39927
40477
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
39928
40478
|
* luminance/alpha textures will also still work as expected.
|
|
39929
40479
|
*
|
|
40480
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
40481
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40482
|
+
*
|
|
39930
40483
|
* @type {?Texture}
|
|
39931
40484
|
* @default null
|
|
39932
40485
|
*/
|
|
@@ -39935,6 +40488,11 @@ class MeshLambertMaterial extends Material {
|
|
|
39935
40488
|
/**
|
|
39936
40489
|
* The environment map.
|
|
39937
40490
|
*
|
|
40491
|
+
* `envMap` represents luminance data, and the texture must be assigned
|
|
40492
|
+
* a {@link Texture#colorSpace}. Most `envMap` textures set
|
|
40493
|
+
* `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
|
|
40494
|
+
* such as `.exr` or `.hdr`.
|
|
40495
|
+
*
|
|
39938
40496
|
* @type {?Texture}
|
|
39939
40497
|
* @default null
|
|
39940
40498
|
*/
|
|
@@ -40145,6 +40703,10 @@ class MeshDepthMaterial extends Material {
|
|
|
40145
40703
|
* The color map. May optionally include an alpha channel, typically combined
|
|
40146
40704
|
* with {@link Material#transparent} or {@link Material#alphaTest}.
|
|
40147
40705
|
*
|
|
40706
|
+
* `map` represents color data, and the texture must be assigned a
|
|
40707
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
40708
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40709
|
+
*
|
|
40148
40710
|
* @type {?Texture}
|
|
40149
40711
|
* @default null
|
|
40150
40712
|
*/
|
|
@@ -40160,6 +40722,9 @@ class MeshDepthMaterial extends Material {
|
|
|
40160
40722
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
40161
40723
|
* luminance/alpha textures will also still work as expected.
|
|
40162
40724
|
*
|
|
40725
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
40726
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40727
|
+
*
|
|
40163
40728
|
* @type {?Texture}
|
|
40164
40729
|
* @default null
|
|
40165
40730
|
*/
|
|
@@ -40173,6 +40738,9 @@ class MeshDepthMaterial extends Material {
|
|
|
40173
40738
|
* of each pixel (white being the highest) is mapped against, and
|
|
40174
40739
|
* repositions, the vertices of the mesh.
|
|
40175
40740
|
*
|
|
40741
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
40742
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40743
|
+
*
|
|
40176
40744
|
* @type {?Texture}
|
|
40177
40745
|
* @default null
|
|
40178
40746
|
*/
|
|
@@ -40285,6 +40853,10 @@ class MeshDistanceMaterial extends Material {
|
|
|
40285
40853
|
* The color map. May optionally include an alpha channel, typically combined
|
|
40286
40854
|
* with {@link Material#transparent} or {@link Material#alphaTest}.
|
|
40287
40855
|
*
|
|
40856
|
+
* `map` represents color data, and the texture must be assigned a
|
|
40857
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
40858
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40859
|
+
*
|
|
40288
40860
|
* @type {?Texture}
|
|
40289
40861
|
* @default null
|
|
40290
40862
|
*/
|
|
@@ -40300,6 +40872,9 @@ class MeshDistanceMaterial extends Material {
|
|
|
40300
40872
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
40301
40873
|
* luminance/alpha textures will also still work as expected.
|
|
40302
40874
|
*
|
|
40875
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
40876
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40877
|
+
*
|
|
40303
40878
|
* @type {?Texture}
|
|
40304
40879
|
* @default null
|
|
40305
40880
|
*/
|
|
@@ -40313,6 +40888,9 @@ class MeshDistanceMaterial extends Material {
|
|
|
40313
40888
|
* of each pixel (white being the highest) is mapped against, and
|
|
40314
40889
|
* repositions, the vertices of the mesh.
|
|
40315
40890
|
*
|
|
40891
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
40892
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40893
|
+
*
|
|
40316
40894
|
* @type {?Texture}
|
|
40317
40895
|
* @default null
|
|
40318
40896
|
*/
|
|
@@ -40411,6 +40989,12 @@ class MeshMatcapMaterial extends Material {
|
|
|
40411
40989
|
/**
|
|
40412
40990
|
* The matcap map.
|
|
40413
40991
|
*
|
|
40992
|
+
* `matcap` represents luminance data, and the texture must be assigned
|
|
40993
|
+
* a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`)
|
|
40994
|
+
* typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR
|
|
40995
|
+
* `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set
|
|
40996
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
40997
|
+
*
|
|
40414
40998
|
* @type {?Texture}
|
|
40415
40999
|
* @default null
|
|
40416
41000
|
*/
|
|
@@ -40421,6 +41005,10 @@ class MeshMatcapMaterial extends Material {
|
|
|
40421
41005
|
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
40422
41006
|
* color is modulated by the diffuse `color`.
|
|
40423
41007
|
*
|
|
41008
|
+
* `map` represents color data, and the texture must be assigned a
|
|
41009
|
+
* {@link Texture#colorSpace}. Most `map` textures set
|
|
41010
|
+
* `texture.colorSpace = SRGBColorSpace`.
|
|
41011
|
+
*
|
|
40424
41012
|
* @type {?Texture}
|
|
40425
41013
|
* @default null
|
|
40426
41014
|
*/
|
|
@@ -40432,6 +41020,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
40432
41020
|
* the geometry of the object, only the lighting. If a normal map is defined
|
|
40433
41021
|
* this will be ignored.
|
|
40434
41022
|
*
|
|
41023
|
+
* `bumpMap` represents non-color data. Any texture assigned must have
|
|
41024
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
41025
|
+
*
|
|
40435
41026
|
* @type {?Texture}
|
|
40436
41027
|
* @default null
|
|
40437
41028
|
*/
|
|
@@ -40453,6 +41044,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
40453
41044
|
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
40454
41045
|
* for the different handedness.
|
|
40455
41046
|
*
|
|
41047
|
+
* `normalMap` represents non-color data. Any texture assigned must have
|
|
41048
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
41049
|
+
*
|
|
40456
41050
|
* @type {?Texture}
|
|
40457
41051
|
* @default null
|
|
40458
41052
|
*/
|
|
@@ -40480,7 +41074,12 @@ class MeshMatcapMaterial extends Material {
|
|
|
40480
41074
|
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
40481
41075
|
* act as real geometry. The displacement texture is an image where the value
|
|
40482
41076
|
* of each pixel (white being the highest) is mapped against, and
|
|
40483
|
-
* repositions, the vertices of the mesh.
|
|
41077
|
+
* repositions, the vertices of the mesh. For best results, pair a
|
|
41078
|
+
* displacement map with a matching normal map, since the renderer can
|
|
41079
|
+
* not recompute surface normals from the displaced vertices.
|
|
41080
|
+
*
|
|
41081
|
+
* `displacementMap` represents non-color data. Any texture assigned must have
|
|
41082
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
40484
41083
|
*
|
|
40485
41084
|
* @type {?Texture}
|
|
40486
41085
|
* @default null
|
|
@@ -40517,6 +41116,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
40517
41116
|
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
40518
41117
|
* luminance/alpha textures will also still work as expected.
|
|
40519
41118
|
*
|
|
41119
|
+
* `alphaMap` represents non-color data. Any texture assigned must have
|
|
41120
|
+
* `texture.colorSpace = NoColorSpace` (default).
|
|
41121
|
+
*
|
|
40520
41122
|
* @type {?Texture}
|
|
40521
41123
|
* @default null
|
|
40522
41124
|
*/
|
|
@@ -41462,7 +42064,7 @@ class Interpolant {
|
|
|
41462
42064
|
*/
|
|
41463
42065
|
interpolate_( /* i1, t0, t, t1 */ ) {
|
|
41464
42066
|
|
|
41465
|
-
throw new Error( '
|
|
42067
|
+
throw new Error( 'THREE.Interpolant: Call to abstract method.' );
|
|
41466
42068
|
// implementations shall return this.resultBuffer
|
|
41467
42069
|
|
|
41468
42070
|
}
|
|
@@ -41721,9 +42323,8 @@ class DiscreteInterpolant extends Interpolant {
|
|
|
41721
42323
|
* each keyframe has explicit in/out tangent control points specified as
|
|
41722
42324
|
* 2D coordinates (time, value).
|
|
41723
42325
|
*
|
|
41724
|
-
*
|
|
41725
|
-
*
|
|
41726
|
-
* - `settings.outTangents`: Float32Array with [time, value] pairs per keyframe per component
|
|
42326
|
+
* Tangent data is read from `inTangents` and `outTangents` on the interpolant
|
|
42327
|
+
* (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`).
|
|
41727
42328
|
*
|
|
41728
42329
|
* For a track with N keyframes and stride S:
|
|
41729
42330
|
* - Each tangent array has N * S * 2 values
|
|
@@ -41743,9 +42344,8 @@ class BezierInterpolant extends Interpolant {
|
|
|
41743
42344
|
const offset1 = i1 * stride;
|
|
41744
42345
|
const offset0 = offset1 - stride;
|
|
41745
42346
|
|
|
41746
|
-
const
|
|
41747
|
-
const
|
|
41748
|
-
const outTangents = settings.outTangents;
|
|
42347
|
+
const inTangents = this.inTangents;
|
|
42348
|
+
const outTangents = this.outTangents;
|
|
41749
42349
|
|
|
41750
42350
|
// If no tangent data, fall back to linear interpolation
|
|
41751
42351
|
if ( ! inTangents || ! outTangents ) {
|
|
@@ -41966,10 +42566,10 @@ class KeyframeTrack {
|
|
|
41966
42566
|
|
|
41967
42567
|
const interpolant = new BezierInterpolant( this.times, this.values, this.getValueSize(), result );
|
|
41968
42568
|
|
|
41969
|
-
// Pass tangent data from track settings to interpolant
|
|
41970
42569
|
if ( this.settings ) {
|
|
41971
42570
|
|
|
41972
|
-
interpolant.
|
|
42571
|
+
interpolant.inTangents = this.settings.inTangents;
|
|
42572
|
+
interpolant.outTangents = this.settings.outTangents;
|
|
41973
42573
|
|
|
41974
42574
|
}
|
|
41975
42575
|
|
|
@@ -43011,144 +43611,6 @@ class AnimationClip {
|
|
|
43011
43611
|
|
|
43012
43612
|
}
|
|
43013
43613
|
|
|
43014
|
-
/**
|
|
43015
|
-
* Parses the `animation.hierarchy` format and returns a new animation clip.
|
|
43016
|
-
*
|
|
43017
|
-
* @static
|
|
43018
|
-
* @deprecated since r175.
|
|
43019
|
-
* @param {Object} animation - A serialized animation clip as JSON.
|
|
43020
|
-
* @param {Array<Bone>} bones - An array of bones.
|
|
43021
|
-
* @return {?AnimationClip} The new animation clip.
|
|
43022
|
-
*/
|
|
43023
|
-
static parseAnimation( animation, bones ) {
|
|
43024
|
-
|
|
43025
|
-
warn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );
|
|
43026
|
-
|
|
43027
|
-
if ( ! animation ) {
|
|
43028
|
-
|
|
43029
|
-
error( 'AnimationClip: No animation in JSONLoader data.' );
|
|
43030
|
-
return null;
|
|
43031
|
-
|
|
43032
|
-
}
|
|
43033
|
-
|
|
43034
|
-
const addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
|
|
43035
|
-
|
|
43036
|
-
// only return track if there are actually keys.
|
|
43037
|
-
if ( animationKeys.length !== 0 ) {
|
|
43038
|
-
|
|
43039
|
-
const times = [];
|
|
43040
|
-
const values = [];
|
|
43041
|
-
|
|
43042
|
-
flattenJSON( animationKeys, times, values, propertyName );
|
|
43043
|
-
|
|
43044
|
-
// empty keys are filtered out, so check again
|
|
43045
|
-
if ( times.length !== 0 ) {
|
|
43046
|
-
|
|
43047
|
-
destTracks.push( new trackType( trackName, times, values ) );
|
|
43048
|
-
|
|
43049
|
-
}
|
|
43050
|
-
|
|
43051
|
-
}
|
|
43052
|
-
|
|
43053
|
-
};
|
|
43054
|
-
|
|
43055
|
-
const tracks = [];
|
|
43056
|
-
|
|
43057
|
-
const clipName = animation.name || 'default';
|
|
43058
|
-
const fps = animation.fps || 30;
|
|
43059
|
-
const blendMode = animation.blendMode;
|
|
43060
|
-
|
|
43061
|
-
// automatic length determination in AnimationClip.
|
|
43062
|
-
let duration = animation.length || -1;
|
|
43063
|
-
|
|
43064
|
-
const hierarchyTracks = animation.hierarchy || [];
|
|
43065
|
-
|
|
43066
|
-
for ( let h = 0; h < hierarchyTracks.length; h ++ ) {
|
|
43067
|
-
|
|
43068
|
-
const animationKeys = hierarchyTracks[ h ].keys;
|
|
43069
|
-
|
|
43070
|
-
// skip empty tracks
|
|
43071
|
-
if ( ! animationKeys || animationKeys.length === 0 ) continue;
|
|
43072
|
-
|
|
43073
|
-
// process morph targets
|
|
43074
|
-
if ( animationKeys[ 0 ].morphTargets ) {
|
|
43075
|
-
|
|
43076
|
-
// figure out all morph targets used in this track
|
|
43077
|
-
const morphTargetNames = {};
|
|
43078
|
-
|
|
43079
|
-
let k;
|
|
43080
|
-
|
|
43081
|
-
for ( k = 0; k < animationKeys.length; k ++ ) {
|
|
43082
|
-
|
|
43083
|
-
if ( animationKeys[ k ].morphTargets ) {
|
|
43084
|
-
|
|
43085
|
-
for ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {
|
|
43086
|
-
|
|
43087
|
-
morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = -1;
|
|
43088
|
-
|
|
43089
|
-
}
|
|
43090
|
-
|
|
43091
|
-
}
|
|
43092
|
-
|
|
43093
|
-
}
|
|
43094
|
-
|
|
43095
|
-
// create a track for each morph target with all zero
|
|
43096
|
-
// morphTargetInfluences except for the keys in which
|
|
43097
|
-
// the morphTarget is named.
|
|
43098
|
-
for ( const morphTargetName in morphTargetNames ) {
|
|
43099
|
-
|
|
43100
|
-
const times = [];
|
|
43101
|
-
const values = [];
|
|
43102
|
-
|
|
43103
|
-
for ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {
|
|
43104
|
-
|
|
43105
|
-
const animationKey = animationKeys[ k ];
|
|
43106
|
-
|
|
43107
|
-
times.push( animationKey.time );
|
|
43108
|
-
values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );
|
|
43109
|
-
|
|
43110
|
-
}
|
|
43111
|
-
|
|
43112
|
-
tracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
|
|
43113
|
-
|
|
43114
|
-
}
|
|
43115
|
-
|
|
43116
|
-
duration = morphTargetNames.length * fps;
|
|
43117
|
-
|
|
43118
|
-
} else {
|
|
43119
|
-
|
|
43120
|
-
// ...assume skeletal animation
|
|
43121
|
-
|
|
43122
|
-
const boneName = '.bones[' + bones[ h ].name + ']';
|
|
43123
|
-
|
|
43124
|
-
addNonemptyTrack(
|
|
43125
|
-
VectorKeyframeTrack, boneName + '.position',
|
|
43126
|
-
animationKeys, 'pos', tracks );
|
|
43127
|
-
|
|
43128
|
-
addNonemptyTrack(
|
|
43129
|
-
QuaternionKeyframeTrack, boneName + '.quaternion',
|
|
43130
|
-
animationKeys, 'rot', tracks );
|
|
43131
|
-
|
|
43132
|
-
addNonemptyTrack(
|
|
43133
|
-
VectorKeyframeTrack, boneName + '.scale',
|
|
43134
|
-
animationKeys, 'scl', tracks );
|
|
43135
|
-
|
|
43136
|
-
}
|
|
43137
|
-
|
|
43138
|
-
}
|
|
43139
|
-
|
|
43140
|
-
if ( tracks.length === 0 ) {
|
|
43141
|
-
|
|
43142
|
-
return null;
|
|
43143
|
-
|
|
43144
|
-
}
|
|
43145
|
-
|
|
43146
|
-
const clip = new this( clipName, duration, tracks, blendMode );
|
|
43147
|
-
|
|
43148
|
-
return clip;
|
|
43149
|
-
|
|
43150
|
-
}
|
|
43151
|
-
|
|
43152
43614
|
/**
|
|
43153
43615
|
* Sets the duration of this clip to the duration of its longest keyframe track.
|
|
43154
43616
|
*
|
|
@@ -43613,6 +44075,11 @@ class LoadingManager {
|
|
|
43613
44075
|
*/
|
|
43614
44076
|
this.resolveURL = function ( url ) {
|
|
43615
44077
|
|
|
44078
|
+
// Normalize to NFC so that Unicode URIs (e.g. from glTF)
|
|
44079
|
+
// are percent-encoded correctly per RFC 3987.
|
|
44080
|
+
|
|
44081
|
+
url = url.normalize( 'NFC' );
|
|
44082
|
+
|
|
43616
44083
|
if ( urlModifier ) {
|
|
43617
44084
|
|
|
43618
44085
|
return urlModifier( url );
|
|
@@ -44930,77 +45397,108 @@ class DataTextureLoader extends Loader {
|
|
|
44930
45397
|
|
|
44931
45398
|
}
|
|
44932
45399
|
|
|
44933
|
-
|
|
45400
|
+
scope._applyTexData( texture, texData );
|
|
44934
45401
|
|
|
44935
|
-
|
|
45402
|
+
if ( onLoad ) onLoad( texture, texData );
|
|
44936
45403
|
|
|
44937
|
-
|
|
45404
|
+
}, onProgress, onError );
|
|
44938
45405
|
|
|
44939
|
-
texture.image.width = texData.width;
|
|
44940
|
-
texture.image.height = texData.height;
|
|
44941
|
-
texture.image.data = texData.data;
|
|
44942
45406
|
|
|
44943
|
-
|
|
45407
|
+
return texture;
|
|
44944
45408
|
|
|
44945
|
-
|
|
44946
|
-
texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
|
|
45409
|
+
}
|
|
44947
45410
|
|
|
44948
|
-
|
|
44949
|
-
|
|
45411
|
+
/**
|
|
45412
|
+
* Parses the given buffer and returns a configured data texture. Use this method
|
|
45413
|
+
* for parsing texture data that is already in memory (e.g. drag and drop or data
|
|
45414
|
+
* loaded from a server) without going through {@link DataTextureLoader#load}.
|
|
45415
|
+
*
|
|
45416
|
+
* @param {ArrayBuffer} buffer - The raw texture data.
|
|
45417
|
+
* @return {DataTexture} The data texture.
|
|
45418
|
+
*/
|
|
45419
|
+
createDataTexture( buffer ) {
|
|
44950
45420
|
|
|
44951
|
-
|
|
45421
|
+
const texture = new DataTexture();
|
|
44952
45422
|
|
|
44953
|
-
|
|
45423
|
+
this._applyTexData( texture, this.parse( buffer ) );
|
|
44954
45424
|
|
|
44955
|
-
|
|
45425
|
+
return texture;
|
|
44956
45426
|
|
|
44957
|
-
|
|
45427
|
+
}
|
|
45428
|
+
|
|
45429
|
+
/**
|
|
45430
|
+
* Applies the given parsed texture data to the given data texture.
|
|
45431
|
+
*
|
|
45432
|
+
* @private
|
|
45433
|
+
* @param {DataTexture} texture - The data texture.
|
|
45434
|
+
* @param {DataTextureLoader~TexData} texData - The parsed texture data.
|
|
45435
|
+
*/
|
|
45436
|
+
_applyTexData( texture, texData ) {
|
|
44958
45437
|
|
|
44959
|
-
|
|
45438
|
+
if ( texData.image !== undefined ) {
|
|
44960
45439
|
|
|
44961
|
-
|
|
45440
|
+
texture.image = texData.image;
|
|
44962
45441
|
|
|
44963
|
-
|
|
45442
|
+
} else if ( texData.data !== undefined ) {
|
|
44964
45443
|
|
|
44965
|
-
|
|
45444
|
+
texture.image.width = texData.width;
|
|
45445
|
+
texture.image.height = texData.height;
|
|
45446
|
+
texture.image.data = texData.data;
|
|
44966
45447
|
|
|
44967
|
-
|
|
45448
|
+
}
|
|
44968
45449
|
|
|
44969
|
-
|
|
45450
|
+
texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
|
|
45451
|
+
texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
|
|
44970
45452
|
|
|
44971
|
-
|
|
45453
|
+
texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
|
|
45454
|
+
texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
|
|
44972
45455
|
|
|
44973
|
-
|
|
45456
|
+
texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
|
|
44974
45457
|
|
|
44975
|
-
|
|
45458
|
+
if ( texData.colorSpace !== undefined ) {
|
|
44976
45459
|
|
|
44977
|
-
|
|
45460
|
+
texture.colorSpace = texData.colorSpace;
|
|
44978
45461
|
|
|
44979
|
-
|
|
44980
|
-
texture.minFilter = LinearMipmapLinearFilter; // presumably...
|
|
45462
|
+
}
|
|
44981
45463
|
|
|
44982
|
-
|
|
45464
|
+
if ( texData.flipY !== undefined ) {
|
|
44983
45465
|
|
|
44984
|
-
|
|
45466
|
+
texture.flipY = texData.flipY;
|
|
44985
45467
|
|
|
44986
|
-
|
|
45468
|
+
}
|
|
44987
45469
|
|
|
44988
|
-
|
|
45470
|
+
if ( texData.format !== undefined ) {
|
|
44989
45471
|
|
|
44990
|
-
|
|
45472
|
+
texture.format = texData.format;
|
|
44991
45473
|
|
|
44992
|
-
|
|
45474
|
+
}
|
|
44993
45475
|
|
|
44994
|
-
|
|
45476
|
+
if ( texData.type !== undefined ) {
|
|
44995
45477
|
|
|
44996
|
-
texture.
|
|
45478
|
+
texture.type = texData.type;
|
|
44997
45479
|
|
|
44998
|
-
|
|
45480
|
+
}
|
|
44999
45481
|
|
|
45000
|
-
|
|
45482
|
+
if ( texData.mipmaps !== undefined ) {
|
|
45001
45483
|
|
|
45484
|
+
texture.mipmaps = texData.mipmaps;
|
|
45485
|
+
texture.minFilter = LinearMipmapLinearFilter; // presumably...
|
|
45002
45486
|
|
|
45003
|
-
|
|
45487
|
+
}
|
|
45488
|
+
|
|
45489
|
+
if ( texData.mipmapCount === 1 ) {
|
|
45490
|
+
|
|
45491
|
+
texture.minFilter = LinearFilter;
|
|
45492
|
+
|
|
45493
|
+
}
|
|
45494
|
+
|
|
45495
|
+
if ( texData.generateMipmaps !== undefined ) {
|
|
45496
|
+
|
|
45497
|
+
texture.generateMipmaps = texData.generateMipmaps;
|
|
45498
|
+
|
|
45499
|
+
}
|
|
45500
|
+
|
|
45501
|
+
texture.needsUpdate = true;
|
|
45004
45502
|
|
|
45005
45503
|
}
|
|
45006
45504
|
|
|
@@ -45690,9 +46188,9 @@ class Camera extends Object3D {
|
|
|
45690
46188
|
|
|
45691
46189
|
}
|
|
45692
46190
|
|
|
45693
|
-
updateWorldMatrix( updateParents, updateChildren ) {
|
|
46191
|
+
updateWorldMatrix( updateParents, updateChildren, force = false ) {
|
|
45694
46192
|
|
|
45695
|
-
super.updateWorldMatrix( updateParents, updateChildren );
|
|
46193
|
+
super.updateWorldMatrix( updateParents, updateChildren, force );
|
|
45696
46194
|
|
|
45697
46195
|
// exclude scale from view matrix to be glTF conform
|
|
45698
46196
|
|
|
@@ -47474,6 +47972,8 @@ class LightProbe extends Light {
|
|
|
47474
47972
|
|
|
47475
47973
|
}
|
|
47476
47974
|
|
|
47975
|
+
const _customMaterials = {};
|
|
47976
|
+
|
|
47477
47977
|
/**
|
|
47478
47978
|
* Class for loading materials. The files are internally
|
|
47479
47979
|
* loaded via {@link FileLoader}.
|
|
@@ -47556,265 +48056,9 @@ class MaterialLoader extends Loader {
|
|
|
47556
48056
|
*/
|
|
47557
48057
|
parse( json ) {
|
|
47558
48058
|
|
|
47559
|
-
const textures = this.textures;
|
|
47560
|
-
|
|
47561
|
-
function getTexture( name ) {
|
|
47562
|
-
|
|
47563
|
-
if ( textures[ name ] === undefined ) {
|
|
47564
|
-
|
|
47565
|
-
warn( 'MaterialLoader: Undefined texture', name );
|
|
47566
|
-
|
|
47567
|
-
}
|
|
47568
|
-
|
|
47569
|
-
return textures[ name ];
|
|
47570
|
-
|
|
47571
|
-
}
|
|
47572
|
-
|
|
47573
48059
|
const material = this.createMaterialFromType( json.type );
|
|
47574
48060
|
|
|
47575
|
-
|
|
47576
|
-
if ( json.name !== undefined ) material.name = json.name;
|
|
47577
|
-
if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
|
|
47578
|
-
if ( json.roughness !== undefined ) material.roughness = json.roughness;
|
|
47579
|
-
if ( json.metalness !== undefined ) material.metalness = json.metalness;
|
|
47580
|
-
if ( json.sheen !== undefined ) material.sheen = json.sheen;
|
|
47581
|
-
if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
|
|
47582
|
-
if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
|
|
47583
|
-
if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
|
|
47584
|
-
if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
|
|
47585
|
-
if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
|
|
47586
|
-
if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
|
|
47587
|
-
if ( json.shininess !== undefined ) material.shininess = json.shininess;
|
|
47588
|
-
if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
|
|
47589
|
-
if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
|
|
47590
|
-
if ( json.dispersion !== undefined ) material.dispersion = json.dispersion;
|
|
47591
|
-
if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
|
|
47592
|
-
if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
|
|
47593
|
-
if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
|
|
47594
|
-
if ( json.transmission !== undefined ) material.transmission = json.transmission;
|
|
47595
|
-
if ( json.thickness !== undefined ) material.thickness = json.thickness;
|
|
47596
|
-
if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
|
|
47597
|
-
if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
|
|
47598
|
-
if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
|
|
47599
|
-
if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
|
|
47600
|
-
if ( json.fog !== undefined ) material.fog = json.fog;
|
|
47601
|
-
if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
|
|
47602
|
-
if ( json.blending !== undefined ) material.blending = json.blending;
|
|
47603
|
-
if ( json.combine !== undefined ) material.combine = json.combine;
|
|
47604
|
-
if ( json.side !== undefined ) material.side = json.side;
|
|
47605
|
-
if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
|
|
47606
|
-
if ( json.opacity !== undefined ) material.opacity = json.opacity;
|
|
47607
|
-
if ( json.transparent !== undefined ) material.transparent = json.transparent;
|
|
47608
|
-
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
|
|
47609
|
-
if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
|
|
47610
|
-
if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
|
|
47611
|
-
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
|
|
47612
|
-
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
|
|
47613
|
-
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
|
|
47614
|
-
if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
|
|
47615
|
-
if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
|
|
47616
|
-
if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
|
|
47617
|
-
if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
|
|
47618
|
-
if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
|
|
47619
|
-
if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
|
|
47620
|
-
if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
|
|
47621
|
-
if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
|
|
47622
|
-
if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
|
|
47623
|
-
if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
|
|
47624
|
-
if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
|
|
47625
|
-
if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;
|
|
47626
|
-
if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
|
|
47627
|
-
if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
|
|
47628
|
-
if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
|
|
47629
|
-
if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
|
|
47630
|
-
|
|
47631
|
-
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
|
|
47632
|
-
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
|
|
47633
|
-
if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
|
|
47634
|
-
if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
|
|
47635
|
-
|
|
47636
|
-
if ( json.rotation !== undefined ) material.rotation = json.rotation;
|
|
47637
|
-
|
|
47638
|
-
if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
|
|
47639
|
-
if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
|
|
47640
|
-
if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
|
|
47641
|
-
if ( json.scale !== undefined ) material.scale = json.scale;
|
|
47642
|
-
|
|
47643
|
-
if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;
|
|
47644
|
-
if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;
|
|
47645
|
-
if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;
|
|
47646
|
-
|
|
47647
|
-
if ( json.dithering !== undefined ) material.dithering = json.dithering;
|
|
47648
|
-
|
|
47649
|
-
if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
|
|
47650
|
-
if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
|
|
47651
|
-
if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
|
|
47652
|
-
if ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;
|
|
47653
|
-
|
|
47654
|
-
if ( json.visible !== undefined ) material.visible = json.visible;
|
|
47655
|
-
|
|
47656
|
-
if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
|
|
47657
|
-
|
|
47658
|
-
if ( json.userData !== undefined ) material.userData = json.userData;
|
|
47659
|
-
|
|
47660
|
-
if ( json.vertexColors !== undefined ) {
|
|
47661
|
-
|
|
47662
|
-
if ( typeof json.vertexColors === 'number' ) {
|
|
47663
|
-
|
|
47664
|
-
material.vertexColors = json.vertexColors > 0;
|
|
47665
|
-
|
|
47666
|
-
} else {
|
|
47667
|
-
|
|
47668
|
-
material.vertexColors = json.vertexColors;
|
|
47669
|
-
|
|
47670
|
-
}
|
|
47671
|
-
|
|
47672
|
-
}
|
|
47673
|
-
|
|
47674
|
-
// Shader Material
|
|
47675
|
-
|
|
47676
|
-
if ( json.uniforms !== undefined ) {
|
|
47677
|
-
|
|
47678
|
-
for ( const name in json.uniforms ) {
|
|
47679
|
-
|
|
47680
|
-
const uniform = json.uniforms[ name ];
|
|
47681
|
-
|
|
47682
|
-
material.uniforms[ name ] = {};
|
|
47683
|
-
|
|
47684
|
-
switch ( uniform.type ) {
|
|
47685
|
-
|
|
47686
|
-
case 't':
|
|
47687
|
-
material.uniforms[ name ].value = getTexture( uniform.value );
|
|
47688
|
-
break;
|
|
47689
|
-
|
|
47690
|
-
case 'c':
|
|
47691
|
-
material.uniforms[ name ].value = new Color().setHex( uniform.value );
|
|
47692
|
-
break;
|
|
47693
|
-
|
|
47694
|
-
case 'v2':
|
|
47695
|
-
material.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
|
|
47696
|
-
break;
|
|
47697
|
-
|
|
47698
|
-
case 'v3':
|
|
47699
|
-
material.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
|
|
47700
|
-
break;
|
|
47701
|
-
|
|
47702
|
-
case 'v4':
|
|
47703
|
-
material.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
|
|
47704
|
-
break;
|
|
47705
|
-
|
|
47706
|
-
case 'm3':
|
|
47707
|
-
material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
|
|
47708
|
-
break;
|
|
47709
|
-
|
|
47710
|
-
case 'm4':
|
|
47711
|
-
material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
|
|
47712
|
-
break;
|
|
47713
|
-
|
|
47714
|
-
default:
|
|
47715
|
-
material.uniforms[ name ].value = uniform.value;
|
|
47716
|
-
|
|
47717
|
-
}
|
|
47718
|
-
|
|
47719
|
-
}
|
|
47720
|
-
|
|
47721
|
-
}
|
|
47722
|
-
|
|
47723
|
-
if ( json.defines !== undefined ) material.defines = json.defines;
|
|
47724
|
-
if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
|
|
47725
|
-
if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
|
|
47726
|
-
if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
|
|
47727
|
-
|
|
47728
|
-
if ( json.extensions !== undefined ) {
|
|
47729
|
-
|
|
47730
|
-
for ( const key in json.extensions ) {
|
|
47731
|
-
|
|
47732
|
-
material.extensions[ key ] = json.extensions[ key ];
|
|
47733
|
-
|
|
47734
|
-
}
|
|
47735
|
-
|
|
47736
|
-
}
|
|
47737
|
-
|
|
47738
|
-
if ( json.lights !== undefined ) material.lights = json.lights;
|
|
47739
|
-
if ( json.clipping !== undefined ) material.clipping = json.clipping;
|
|
47740
|
-
|
|
47741
|
-
// for PointsMaterial
|
|
47742
|
-
|
|
47743
|
-
if ( json.size !== undefined ) material.size = json.size;
|
|
47744
|
-
if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
|
|
47745
|
-
|
|
47746
|
-
// maps
|
|
47747
|
-
|
|
47748
|
-
if ( json.map !== undefined ) material.map = getTexture( json.map );
|
|
47749
|
-
if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
|
|
47750
|
-
|
|
47751
|
-
if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );
|
|
47752
|
-
|
|
47753
|
-
if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );
|
|
47754
|
-
if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
|
|
47755
|
-
|
|
47756
|
-
if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );
|
|
47757
|
-
if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;
|
|
47758
|
-
if ( json.normalScale !== undefined ) {
|
|
47759
|
-
|
|
47760
|
-
let normalScale = json.normalScale;
|
|
47761
|
-
|
|
47762
|
-
if ( Array.isArray( normalScale ) === false ) {
|
|
47763
|
-
|
|
47764
|
-
// Blender exporter used to export a scalar. See #7459
|
|
47765
|
-
|
|
47766
|
-
normalScale = [ normalScale, normalScale ];
|
|
47767
|
-
|
|
47768
|
-
}
|
|
47769
|
-
|
|
47770
|
-
material.normalScale = new Vector2().fromArray( normalScale );
|
|
47771
|
-
|
|
47772
|
-
}
|
|
47773
|
-
|
|
47774
|
-
if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );
|
|
47775
|
-
if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
|
|
47776
|
-
if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
|
|
47777
|
-
|
|
47778
|
-
if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
|
|
47779
|
-
if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
|
|
47780
|
-
|
|
47781
|
-
if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
|
|
47782
|
-
if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
|
|
47783
|
-
|
|
47784
|
-
if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
|
|
47785
|
-
if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
|
|
47786
|
-
if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
|
|
47787
|
-
|
|
47788
|
-
if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
|
|
47789
|
-
if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
|
|
47790
|
-
if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
|
|
47791
|
-
|
|
47792
|
-
if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
|
|
47793
|
-
if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
|
|
47794
|
-
|
|
47795
|
-
if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
|
|
47796
|
-
if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
|
|
47797
|
-
|
|
47798
|
-
if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
|
|
47799
|
-
if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
|
|
47800
|
-
|
|
47801
|
-
if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
|
|
47802
|
-
|
|
47803
|
-
if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );
|
|
47804
|
-
if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );
|
|
47805
|
-
if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );
|
|
47806
|
-
if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
|
|
47807
|
-
|
|
47808
|
-
if ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );
|
|
47809
|
-
if ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );
|
|
47810
|
-
|
|
47811
|
-
if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
|
|
47812
|
-
if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
|
|
47813
|
-
|
|
47814
|
-
if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
|
|
47815
|
-
|
|
47816
|
-
if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
|
|
47817
|
-
if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
|
|
48061
|
+
material.fromJSON( json, this.textures );
|
|
47818
48062
|
|
|
47819
48063
|
return material;
|
|
47820
48064
|
|
|
@@ -47873,10 +48117,40 @@ class MaterialLoader extends Loader {
|
|
|
47873
48117
|
MeshMatcapMaterial,
|
|
47874
48118
|
LineDashedMaterial,
|
|
47875
48119
|
LineBasicMaterial,
|
|
47876
|
-
Material
|
|
48120
|
+
Material,
|
|
48121
|
+
... _customMaterials
|
|
47877
48122
|
};
|
|
47878
48123
|
|
|
47879
|
-
|
|
48124
|
+
const MaterialType = materialLib[ type ];
|
|
48125
|
+
|
|
48126
|
+
let materialInstance;
|
|
48127
|
+
|
|
48128
|
+
if ( MaterialType === undefined ) {
|
|
48129
|
+
|
|
48130
|
+
warnOnce( `MaterialLoader: Unknown material type "${ type }". Use .registerMaterial() before starting the deserialization process.` );
|
|
48131
|
+
materialInstance = new Material();
|
|
48132
|
+
|
|
48133
|
+
} else {
|
|
48134
|
+
|
|
48135
|
+
materialInstance = new MaterialType();
|
|
48136
|
+
|
|
48137
|
+
}
|
|
48138
|
+
|
|
48139
|
+
return materialInstance;
|
|
48140
|
+
|
|
48141
|
+
}
|
|
48142
|
+
|
|
48143
|
+
/**
|
|
48144
|
+
* Registers the given material at the internal
|
|
48145
|
+
* material library.
|
|
48146
|
+
*
|
|
48147
|
+
* @static
|
|
48148
|
+
* @param {string} type - The material type.
|
|
48149
|
+
* @param {Material.constructor} materialClass - The material class.
|
|
48150
|
+
*/
|
|
48151
|
+
static registerMaterial( type, materialClass ) {
|
|
48152
|
+
|
|
48153
|
+
_customMaterials[ type ] = materialClass;
|
|
47880
48154
|
|
|
47881
48155
|
}
|
|
47882
48156
|
|
|
@@ -48342,7 +48616,7 @@ class ObjectLoader extends Loader {
|
|
|
48342
48616
|
|
|
48343
48617
|
} catch ( e ) {
|
|
48344
48618
|
|
|
48345
|
-
throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
|
|
48619
|
+
throw new Error( 'THREE.ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
|
|
48346
48620
|
|
|
48347
48621
|
}
|
|
48348
48622
|
|
|
@@ -48636,6 +48910,8 @@ class ObjectLoader extends Loader {
|
|
|
48636
48910
|
|
|
48637
48911
|
function loadImage( url ) {
|
|
48638
48912
|
|
|
48913
|
+
url = scope.manager.resolveURL( url );
|
|
48914
|
+
|
|
48639
48915
|
scope.manager.itemStart( url );
|
|
48640
48916
|
|
|
48641
48917
|
return loader.load( url, function () {
|
|
@@ -49970,8 +50246,11 @@ class StereoCamera {
|
|
|
49970
50246
|
|
|
49971
50247
|
}
|
|
49972
50248
|
|
|
49973
|
-
this.cameraL.
|
|
49974
|
-
this.
|
|
50249
|
+
this.cameraL.matrix.copy( camera.matrixWorld ).multiply( _eyeLeft );
|
|
50250
|
+
this.cameraL.matrixWorldNeedsUpdate = true;
|
|
50251
|
+
|
|
50252
|
+
this.cameraR.matrix.copy( camera.matrixWorld ).multiply( _eyeRight );
|
|
50253
|
+
this.cameraR.matrixWorldNeedsUpdate = true;
|
|
49975
50254
|
|
|
49976
50255
|
}
|
|
49977
50256
|
|
|
@@ -52388,7 +52667,7 @@ class PropertyBinding {
|
|
|
52388
52667
|
|
|
52389
52668
|
if ( matches === null ) {
|
|
52390
52669
|
|
|
52391
|
-
throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
|
|
52670
|
+
throw new Error( 'THREE.PropertyBinding: Cannot parse trackName: ' + trackName );
|
|
52392
52671
|
|
|
52393
52672
|
}
|
|
52394
52673
|
|
|
@@ -52422,7 +52701,7 @@ class PropertyBinding {
|
|
|
52422
52701
|
|
|
52423
52702
|
if ( results.propertyName === null || results.propertyName.length === 0 ) {
|
|
52424
52703
|
|
|
52425
|
-
throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
|
|
52704
|
+
throw new Error( 'THREE.PropertyBinding: can not parse propertyName from trackName: ' + trackName );
|
|
52426
52705
|
|
|
52427
52706
|
}
|
|
52428
52707
|
|
|
@@ -53413,15 +53692,6 @@ class AnimationAction {
|
|
|
53413
53692
|
|
|
53414
53693
|
const interpolant = tracks[ i ].createInterpolant( null );
|
|
53415
53694
|
interpolants[ i ] = interpolant;
|
|
53416
|
-
|
|
53417
|
-
// preserve interpolant settings (like tangent data from BezierInterpolant)
|
|
53418
|
-
|
|
53419
|
-
if ( interpolant.settings ) {
|
|
53420
|
-
|
|
53421
|
-
Object.assign( interpolantSettings, interpolant.settings );
|
|
53422
|
-
|
|
53423
|
-
}
|
|
53424
|
-
|
|
53425
53695
|
interpolant.settings = interpolantSettings;
|
|
53426
53696
|
|
|
53427
53697
|
}
|
|
@@ -53437,6 +53707,7 @@ class AnimationAction {
|
|
|
53437
53707
|
this._byClipCacheIndex = null; // for the memory manager
|
|
53438
53708
|
|
|
53439
53709
|
this._timeScaleInterpolant = null;
|
|
53710
|
+
this._restoreTimeScale = null;
|
|
53440
53711
|
this._weightInterpolant = null;
|
|
53441
53712
|
|
|
53442
53713
|
/**
|
|
@@ -53724,6 +53995,10 @@ class AnimationAction {
|
|
|
53724
53995
|
startEndRatio = fadeOutDuration / fadeInDuration,
|
|
53725
53996
|
endStartRatio = fadeInDuration / fadeOutDuration;
|
|
53726
53997
|
|
|
53998
|
+
|
|
53999
|
+
fadeOutAction._restoreTimeScale = fadeOutAction.timeScale;
|
|
54000
|
+
this._restoreTimeScale = this.timeScale;
|
|
54001
|
+
|
|
53727
54002
|
fadeOutAction.warp( 1.0, startEndRatio, duration );
|
|
53728
54003
|
this.warp( endStartRatio, 1.0, duration );
|
|
53729
54004
|
|
|
@@ -53892,6 +54167,8 @@ class AnimationAction {
|
|
|
53892
54167
|
|
|
53893
54168
|
}
|
|
53894
54169
|
|
|
54170
|
+
this._restoreTimeScale = null;
|
|
54171
|
+
|
|
53895
54172
|
return this;
|
|
53896
54173
|
|
|
53897
54174
|
}
|
|
@@ -54064,8 +54341,6 @@ class AnimationAction {
|
|
|
54064
54341
|
|
|
54065
54342
|
if ( time > interpolant.parameterPositions[ 1 ] ) {
|
|
54066
54343
|
|
|
54067
|
-
this.stopWarping();
|
|
54068
|
-
|
|
54069
54344
|
if ( timeScale === 0 ) {
|
|
54070
54345
|
|
|
54071
54346
|
// motion has halted, pause
|
|
@@ -54073,11 +54348,19 @@ class AnimationAction {
|
|
|
54073
54348
|
|
|
54074
54349
|
} else {
|
|
54075
54350
|
|
|
54351
|
+
if ( this._restoreTimeScale !== null ) {
|
|
54352
|
+
|
|
54353
|
+
timeScale = this._restoreTimeScale;
|
|
54354
|
+
|
|
54355
|
+
}
|
|
54356
|
+
|
|
54076
54357
|
// warp done - apply final time scale
|
|
54077
54358
|
this.timeScale = timeScale;
|
|
54078
54359
|
|
|
54079
54360
|
}
|
|
54080
54361
|
|
|
54362
|
+
this.stopWarping();
|
|
54363
|
+
|
|
54081
54364
|
}
|
|
54082
54365
|
|
|
54083
54366
|
}
|
|
@@ -55790,7 +56073,7 @@ class Raycaster {
|
|
|
55790
56073
|
|
|
55791
56074
|
} else if ( camera.isOrthographicCamera ) {
|
|
55792
56075
|
|
|
55793
|
-
this.ray.origin.set( coords.x, coords.y,
|
|
56076
|
+
this.ray.origin.set( coords.x, coords.y, camera.projectionMatrix.elements[ 14 ] ).unproject( camera ); // set origin in plane of camera
|
|
55794
56077
|
this.ray.direction.set( 0, 0, -1 ).transformDirection( camera.matrixWorld );
|
|
55795
56078
|
this.camera = camera;
|
|
55796
56079
|
|
|
@@ -57278,7 +57561,7 @@ class SpotLightHelper extends Object3D {
|
|
|
57278
57561
|
|
|
57279
57562
|
}
|
|
57280
57563
|
|
|
57281
|
-
this.
|
|
57564
|
+
this.matrixWorldNeedsUpdate = true;
|
|
57282
57565
|
|
|
57283
57566
|
const coneLength = this.light.distance ? this.light.distance : 1000;
|
|
57284
57567
|
const coneWidth = coneLength * Math.tan( this.light.angle );
|
|
@@ -57561,6 +57844,8 @@ class PointLightHelper extends Mesh {
|
|
|
57561
57844
|
*/
|
|
57562
57845
|
update() {
|
|
57563
57846
|
|
|
57847
|
+
this.matrixWorldNeedsUpdate = true;
|
|
57848
|
+
|
|
57564
57849
|
this.light.updateWorldMatrix( true, false );
|
|
57565
57850
|
|
|
57566
57851
|
if ( this.color !== undefined ) {
|
|
@@ -57704,6 +57989,8 @@ class HemisphereLightHelper extends Object3D {
|
|
|
57704
57989
|
|
|
57705
57990
|
}
|
|
57706
57991
|
|
|
57992
|
+
this.matrixWorldNeedsUpdate = true;
|
|
57993
|
+
|
|
57707
57994
|
this.light.updateWorldMatrix( true, false );
|
|
57708
57995
|
|
|
57709
57996
|
mesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );
|
|
@@ -58015,6 +58302,8 @@ class DirectionalLightHelper extends Object3D {
|
|
|
58015
58302
|
*/
|
|
58016
58303
|
update() {
|
|
58017
58304
|
|
|
58305
|
+
this.matrixWorldNeedsUpdate = true;
|
|
58306
|
+
|
|
58018
58307
|
this.light.updateWorldMatrix( true, false );
|
|
58019
58308
|
this.light.target.updateWorldMatrix( true, false );
|
|
58020
58309
|
|
|
@@ -58968,6 +59257,14 @@ class ShapePath {
|
|
|
58968
59257
|
*/
|
|
58969
59258
|
this.currentPath = null;
|
|
58970
59259
|
|
|
59260
|
+
/**
|
|
59261
|
+
* An object that can be used to store custom data about the shape path.
|
|
59262
|
+
* Mainly used by SVGLoader to store style information.
|
|
59263
|
+
*
|
|
59264
|
+
* @type {Object}
|
|
59265
|
+
*/
|
|
59266
|
+
this.userData = {};
|
|
59267
|
+
|
|
58971
59268
|
}
|
|
58972
59269
|
|
|
58973
59270
|
/**
|
|
@@ -59059,235 +59356,213 @@ class ShapePath {
|
|
|
59059
59356
|
/**
|
|
59060
59357
|
* Converts the paths into an array of shapes.
|
|
59061
59358
|
*
|
|
59062
|
-
* @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
|
|
59063
|
-
* If this flag is set to `true`, then those are flipped.
|
|
59064
59359
|
* @return {Array<Shape>} An array of shapes.
|
|
59065
59360
|
*/
|
|
59066
|
-
toShapes(
|
|
59067
|
-
|
|
59068
|
-
function toShapesNoHoles( inSubpaths ) {
|
|
59069
|
-
|
|
59070
|
-
const shapes = [];
|
|
59361
|
+
toShapes() {
|
|
59071
59362
|
|
|
59072
|
-
|
|
59363
|
+
// Point-in-polygon test using the even-odd ray-casting rule. Valid for
|
|
59364
|
+
// simple (non self-intersecting) polygons.
|
|
59365
|
+
function pointInPolygon( p, polygon ) {
|
|
59073
59366
|
|
|
59074
|
-
const tmpPath = inSubpaths[ i ];
|
|
59075
|
-
|
|
59076
|
-
const tmpShape = new Shape();
|
|
59077
|
-
tmpShape.curves = tmpPath.curves;
|
|
59078
|
-
|
|
59079
|
-
shapes.push( tmpShape );
|
|
59080
|
-
|
|
59081
|
-
}
|
|
59082
|
-
|
|
59083
|
-
return shapes;
|
|
59084
|
-
|
|
59085
|
-
}
|
|
59086
|
-
|
|
59087
|
-
function isPointInsidePolygon( inPt, inPolygon ) {
|
|
59088
|
-
|
|
59089
|
-
const polyLen = inPolygon.length;
|
|
59090
|
-
|
|
59091
|
-
// inPt on polygon contour => immediate success or
|
|
59092
|
-
// toggling of inside/outside at every single! intersection point of an edge
|
|
59093
|
-
// with the horizontal line through inPt, left of inPt
|
|
59094
|
-
// not counting lowerY endpoints of edges and whole edges on that line
|
|
59095
59367
|
let inside = false;
|
|
59096
|
-
|
|
59097
|
-
|
|
59098
|
-
let edgeLowPt = inPolygon[ p ];
|
|
59099
|
-
let edgeHighPt = inPolygon[ q ];
|
|
59100
|
-
|
|
59101
|
-
let edgeDx = edgeHighPt.x - edgeLowPt.x;
|
|
59102
|
-
let edgeDy = edgeHighPt.y - edgeLowPt.y;
|
|
59368
|
+
const n = polygon.length;
|
|
59103
59369
|
|
|
59104
|
-
|
|
59370
|
+
for ( let i = 0, j = n - 1; i < n; j = i ++ ) {
|
|
59105
59371
|
|
|
59106
|
-
|
|
59107
|
-
|
|
59372
|
+
const a = polygon[ i ];
|
|
59373
|
+
const b = polygon[ j ];
|
|
59108
59374
|
|
|
59109
|
-
|
|
59110
|
-
|
|
59111
|
-
|
|
59112
|
-
}
|
|
59375
|
+
if ( ( a.y > p.y ) !== ( b.y > p.y ) &&
|
|
59376
|
+
p.x < ( b.x - a.x ) * ( p.y - a.y ) / ( b.y - a.y ) + a.x ) {
|
|
59113
59377
|
|
|
59114
|
-
|
|
59115
|
-
|
|
59116
|
-
if ( inPt.y === edgeLowPt.y ) {
|
|
59117
|
-
|
|
59118
|
-
if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ?
|
|
59119
|
-
// continue; // no intersection or edgeLowPt => doesn't count !!!
|
|
59120
|
-
|
|
59121
|
-
} else {
|
|
59122
|
-
|
|
59123
|
-
const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );
|
|
59124
|
-
if ( perpEdge === 0 ) return true; // inPt is on contour ?
|
|
59125
|
-
if ( perpEdge < 0 ) continue;
|
|
59126
|
-
inside = ! inside; // true intersection left of inPt
|
|
59127
|
-
|
|
59128
|
-
}
|
|
59129
|
-
|
|
59130
|
-
} else {
|
|
59131
|
-
|
|
59132
|
-
// parallel or collinear
|
|
59133
|
-
if ( inPt.y !== edgeLowPt.y ) continue; // parallel
|
|
59134
|
-
// edge lies on the same horizontal line as inPt
|
|
59135
|
-
if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
|
|
59136
|
-
( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
|
|
59137
|
-
// continue;
|
|
59378
|
+
inside = ! inside;
|
|
59138
59379
|
|
|
59139
59380
|
}
|
|
59140
59381
|
|
|
59141
59382
|
}
|
|
59142
59383
|
|
|
59143
|
-
return
|
|
59384
|
+
return inside;
|
|
59144
59385
|
|
|
59145
59386
|
}
|
|
59146
59387
|
|
|
59147
|
-
|
|
59148
|
-
|
|
59149
|
-
|
|
59150
|
-
|
|
59151
|
-
|
|
59152
|
-
|
|
59153
|
-
|
|
59154
|
-
|
|
59155
|
-
if ( subPaths.length === 1 ) {
|
|
59388
|
+
// Returns a point guaranteed to be strictly inside the given simple
|
|
59389
|
+
// polygon. First tries the bounding-box center; if that falls outside
|
|
59390
|
+
// the polygon, casts a horizontal ray at the center's y and picks the
|
|
59391
|
+
// midpoint between the first two sorted intercepts.
|
|
59392
|
+
//
|
|
59393
|
+
// Port of paper.js' Path#getInteriorPoint()
|
|
59394
|
+
// https://github.com/paperjs/paper.js/blob/develop/src/path/PathItem.Boolean.js
|
|
59395
|
+
function getInteriorPoint( polygon, boundingBox ) {
|
|
59156
59396
|
|
|
59157
|
-
|
|
59158
|
-
tmpShape = new Shape();
|
|
59159
|
-
tmpShape.curves = tmpPath.curves;
|
|
59160
|
-
shapes.push( tmpShape );
|
|
59161
|
-
return shapes;
|
|
59397
|
+
const point = boundingBox.getCenter( new Vector2() );
|
|
59162
59398
|
|
|
59163
|
-
|
|
59399
|
+
if ( pointInPolygon( point, polygon ) ) return point;
|
|
59164
59400
|
|
|
59165
|
-
|
|
59166
|
-
|
|
59401
|
+
const y = point.y;
|
|
59402
|
+
const intercepts = [];
|
|
59403
|
+
const n = polygon.length;
|
|
59167
59404
|
|
|
59168
|
-
|
|
59405
|
+
for ( let i = 0; i < n; i ++ ) {
|
|
59169
59406
|
|
|
59170
|
-
|
|
59171
|
-
|
|
59172
|
-
let newShapeHoles = [];
|
|
59173
|
-
let mainIdx = 0;
|
|
59174
|
-
let tmpPoints;
|
|
59407
|
+
const a = polygon[ i ];
|
|
59408
|
+
const b = polygon[ ( i + 1 ) % n ];
|
|
59175
59409
|
|
|
59176
|
-
|
|
59177
|
-
|
|
59410
|
+
// Half-open crossing rule — counts each vertex exactly once and
|
|
59411
|
+
// skips horizontal edges.
|
|
59412
|
+
if ( ( a.y > y ) !== ( b.y > y ) ) {
|
|
59178
59413
|
|
|
59179
|
-
|
|
59414
|
+
const x = a.x + ( y - a.y ) * ( b.x - a.x ) / ( b.y - a.y );
|
|
59415
|
+
intercepts.push( x );
|
|
59180
59416
|
|
|
59181
|
-
|
|
59182
|
-
tmpPoints = tmpPath.getPoints();
|
|
59183
|
-
solid = isClockWise( tmpPoints );
|
|
59184
|
-
solid = isCCW ? ! solid : solid;
|
|
59417
|
+
}
|
|
59185
59418
|
|
|
59186
|
-
|
|
59419
|
+
}
|
|
59187
59420
|
|
|
59188
|
-
|
|
59421
|
+
if ( intercepts.length > 1 ) {
|
|
59189
59422
|
|
|
59190
|
-
|
|
59191
|
-
|
|
59423
|
+
intercepts.sort( ( a, b ) => a - b );
|
|
59424
|
+
point.x = ( intercepts[ 0 ] + intercepts[ 1 ] ) / 2;
|
|
59192
59425
|
|
|
59193
|
-
|
|
59194
|
-
newShapeHoles[ mainIdx ] = [];
|
|
59426
|
+
}
|
|
59195
59427
|
|
|
59196
|
-
|
|
59428
|
+
return point;
|
|
59197
59429
|
|
|
59198
|
-
|
|
59430
|
+
}
|
|
59199
59431
|
|
|
59200
|
-
|
|
59432
|
+
// Resolve fill-rule. Defaults to 'nonzero'.
|
|
59433
|
+
let fillRule = ( this.userData.style && this.userData.style.fillRule ) || 'nonzero';
|
|
59201
59434
|
|
|
59202
|
-
|
|
59435
|
+
if ( fillRule !== 'nonzero' && fillRule !== 'evenodd' ) {
|
|
59203
59436
|
|
|
59204
|
-
|
|
59437
|
+
warn( 'Fill-rule "' + fillRule + '" is not supported, falling back to "nonzero".' );
|
|
59438
|
+
fillRule = 'nonzero';
|
|
59205
59439
|
|
|
59206
59440
|
}
|
|
59207
59441
|
|
|
59208
|
-
//
|
|
59209
|
-
|
|
59442
|
+
// Predicate that decides whether a winding number falls inside the fill
|
|
59443
|
+
// region, per the SVG fill-rule spec. Works for negative windings too,
|
|
59444
|
+
// because JavaScript's bitwise AND preserves odd/even under two's
|
|
59445
|
+
// complement.
|
|
59446
|
+
const isInside = fillRule === 'nonzero'
|
|
59447
|
+
? ( w => w !== 0 )
|
|
59448
|
+
: ( w => ( w & 1 ) !== 0 );
|
|
59210
59449
|
|
|
59450
|
+
// Build an entry per usable subpath. Self-winding follows the standard
|
|
59451
|
+
// convention used by ShapeUtils: counter-clockwise (signed area > 0)
|
|
59452
|
+
// contributes +1 to the winding number at an interior point,
|
|
59453
|
+
// clockwise contributes -1.
|
|
59454
|
+
const entries = [];
|
|
59211
59455
|
|
|
59212
|
-
|
|
59456
|
+
for ( const subPath of this.subPaths ) {
|
|
59213
59457
|
|
|
59214
|
-
|
|
59215
|
-
|
|
59458
|
+
const points = subPath.getPoints();
|
|
59459
|
+
if ( points.length < 3 ) continue;
|
|
59216
59460
|
|
|
59217
|
-
|
|
59461
|
+
const area = ShapeUtils.area( points );
|
|
59462
|
+
if ( area === 0 ) continue;
|
|
59218
59463
|
|
|
59219
|
-
|
|
59464
|
+
const boundingBox = new Box2();
|
|
59465
|
+
for ( let i = 0; i < points.length; i ++ ) boundingBox.expandByPoint( points[ i ] );
|
|
59220
59466
|
|
|
59221
|
-
|
|
59222
|
-
|
|
59223
|
-
|
|
59467
|
+
entries.push( {
|
|
59468
|
+
subPath: subPath,
|
|
59469
|
+
points: points,
|
|
59470
|
+
boundingBox: boundingBox,
|
|
59471
|
+
interiorPoint: getInteriorPoint( points, boundingBox ),
|
|
59472
|
+
absArea: Math.abs( area ),
|
|
59473
|
+
winding: area < 0 ? -1 : 1,
|
|
59474
|
+
container: null,
|
|
59475
|
+
exclude: false,
|
|
59476
|
+
role: null
|
|
59477
|
+
} );
|
|
59224
59478
|
|
|
59225
|
-
|
|
59479
|
+
}
|
|
59226
59480
|
|
|
59227
|
-
|
|
59481
|
+
// Sort by area descending. This guarantees that any subpath that could
|
|
59482
|
+
// contain `entries[i]` is located at a smaller index and has already
|
|
59483
|
+
// been processed when it's entries[i]'s turn. Port of paper.js'
|
|
59484
|
+
// reorientPaths() algorithm.
|
|
59485
|
+
entries.sort( ( a, b ) => b.absArea - a.absArea );
|
|
59228
59486
|
|
|
59229
|
-
|
|
59230
|
-
|
|
59487
|
+
// Walk already-processed entries from closest-in-size to largest,
|
|
59488
|
+
// stopping at the innermost container. Accumulate the container's
|
|
59489
|
+
// cumulative winding into this entry's winding so that the final value
|
|
59490
|
+
// equals the winding number at this entry's interior point.
|
|
59491
|
+
//
|
|
59492
|
+
// A subpath only contributes to the fill boundary when crossing it
|
|
59493
|
+
// actually flips the "insideness" per the fill rule; otherwise it's a
|
|
59494
|
+
// redundant overlap and gets excluded to avoid double-counting.
|
|
59495
|
+
for ( let i = 0; i < entries.length; i ++ ) {
|
|
59231
59496
|
|
|
59232
|
-
|
|
59497
|
+
const entry = entries[ i ];
|
|
59498
|
+
let containerWinding = 0;
|
|
59233
59499
|
|
|
59234
|
-
|
|
59500
|
+
for ( let j = i - 1; j >= 0; j -- ) {
|
|
59235
59501
|
|
|
59236
|
-
|
|
59502
|
+
const candidate = entries[ j ];
|
|
59237
59503
|
|
|
59238
|
-
|
|
59504
|
+
if ( ! candidate.boundingBox.containsBox( entry.boundingBox ) ) continue;
|
|
59505
|
+
if ( ! pointInPolygon( entry.interiorPoint, candidate.points ) ) continue;
|
|
59239
59506
|
|
|
59240
|
-
|
|
59241
|
-
|
|
59507
|
+
entry.container = candidate.exclude ? candidate.container : candidate;
|
|
59508
|
+
containerWinding = candidate.winding;
|
|
59509
|
+
entry.winding += containerWinding;
|
|
59510
|
+
break;
|
|
59242
59511
|
|
|
59243
|
-
|
|
59512
|
+
}
|
|
59244
59513
|
|
|
59245
|
-
|
|
59514
|
+
if ( isInside( entry.winding ) === isInside( containerWinding ) ) {
|
|
59246
59515
|
|
|
59247
|
-
|
|
59516
|
+
entry.exclude = true;
|
|
59248
59517
|
|
|
59249
|
-
|
|
59250
|
-
|
|
59251
|
-
}
|
|
59518
|
+
}
|
|
59252
59519
|
|
|
59253
|
-
|
|
59520
|
+
}
|
|
59254
59521
|
|
|
59255
|
-
|
|
59522
|
+
// Classify retained entries. An entry is an outer shape if it has no
|
|
59523
|
+
// container or if its container is itself a hole (a solid nested inside
|
|
59524
|
+
// a hole becomes a new top-level shape); otherwise it's a hole in its
|
|
59525
|
+
// container. Entries were already sorted outermost-first, so each
|
|
59526
|
+
// container's role is known by the time we look at it.
|
|
59527
|
+
for ( const entry of entries ) {
|
|
59256
59528
|
|
|
59257
|
-
|
|
59529
|
+
if ( entry.exclude ) continue;
|
|
59530
|
+
entry.role = ( entry.container === null || entry.container.role === 'hole' ) ? 'outer' : 'hole';
|
|
59258
59531
|
|
|
59259
|
-
|
|
59532
|
+
}
|
|
59260
59533
|
|
|
59261
|
-
|
|
59534
|
+
// Build Shapes for outers first, then attach holes to their container's
|
|
59535
|
+
// Shape.
|
|
59536
|
+
const shapes = [];
|
|
59537
|
+
const shapeByEntry = new Map();
|
|
59262
59538
|
|
|
59263
|
-
|
|
59539
|
+
for ( const entry of entries ) {
|
|
59264
59540
|
|
|
59265
|
-
|
|
59541
|
+
if ( entry.exclude || entry.role !== 'outer' ) continue;
|
|
59266
59542
|
|
|
59267
|
-
|
|
59543
|
+
const shape = new Shape();
|
|
59544
|
+
shape.curves = entry.subPath.curves;
|
|
59545
|
+
shapes.push( shape );
|
|
59546
|
+
shapeByEntry.set( entry, shape );
|
|
59268
59547
|
|
|
59269
59548
|
}
|
|
59270
59549
|
|
|
59271
|
-
|
|
59550
|
+
for ( const entry of entries ) {
|
|
59272
59551
|
|
|
59273
|
-
|
|
59552
|
+
if ( entry.exclude || entry.role !== 'hole' ) continue;
|
|
59274
59553
|
|
|
59275
|
-
|
|
59276
|
-
|
|
59277
|
-
tmpHoles = newShapeHoles[ i ];
|
|
59554
|
+
const shape = shapeByEntry.get( entry.container );
|
|
59555
|
+
if ( ! shape ) continue;
|
|
59278
59556
|
|
|
59279
|
-
|
|
59280
|
-
|
|
59281
|
-
|
|
59282
|
-
|
|
59283
|
-
}
|
|
59557
|
+
const hole = new Path();
|
|
59558
|
+
hole.curves = entry.subPath.curves;
|
|
59559
|
+
shape.holes.push( hole );
|
|
59284
59560
|
|
|
59285
59561
|
}
|
|
59286
59562
|
|
|
59287
|
-
//log("shape", shapes);
|
|
59288
|
-
|
|
59289
59563
|
return shapes;
|
|
59290
59564
|
|
|
59565
|
+
|
|
59291
59566
|
}
|
|
59292
59567
|
|
|
59293
59568
|
}
|
|
@@ -59632,7 +59907,7 @@ function getTextureTypeByteLength( type ) {
|
|
|
59632
59907
|
|
|
59633
59908
|
}
|
|
59634
59909
|
|
|
59635
|
-
throw new Error( `Unknown texture type ${type}.` );
|
|
59910
|
+
throw new Error( `THREE.TextureUtils: Unknown texture type ${type}.` );
|
|
59636
59911
|
|
|
59637
59912
|
}
|
|
59638
59913
|
|
|
@@ -60058,11 +60333,11 @@ var color_pars_vertex = "#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
|
60058
60333
|
|
|
60059
60334
|
var color_vertex = "#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif";
|
|
60060
60335
|
|
|
60061
|
-
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3
|
|
60336
|
+
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\n#define inverseTransformDirection transformDirectionByInverseViewMatrix\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n}\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
|
|
60062
60337
|
|
|
60063
60338
|
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
60064
60339
|
|
|
60065
|
-
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n
|
|
60340
|
+
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n#endif";
|
|
60066
60341
|
|
|
60067
60342
|
var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
|
|
60068
60343
|
|
|
@@ -60076,7 +60351,7 @@ var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
|
60076
60351
|
|
|
60077
60352
|
var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
60078
60353
|
|
|
60079
|
-
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal =
|
|
60354
|
+
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif";
|
|
60080
60355
|
|
|
60081
60356
|
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif";
|
|
60082
60357
|
|
|
@@ -60084,7 +60359,7 @@ var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t
|
|
|
60084
60359
|
|
|
60085
60360
|
var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
|
|
60086
60361
|
|
|
60087
|
-
var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal =
|
|
60362
|
+
var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
|
|
60088
60363
|
|
|
60089
60364
|
var fog_vertex = "#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";
|
|
60090
60365
|
|
|
@@ -60102,9 +60377,9 @@ var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor
|
|
|
60102
60377
|
|
|
60103
60378
|
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial 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}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
|
|
60104
60379
|
|
|
60105
|
-
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal =
|
|
60380
|
+
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif\n#include <lightprobes_pars_fragment>";
|
|
60106
60381
|
|
|
60107
|
-
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal =
|
|
60382
|
+
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
|
|
60108
60383
|
|
|
60109
60384
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
60110
60385
|
|
|
@@ -60118,7 +60393,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColo
|
|
|
60118
60393
|
|
|
60119
60394
|
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\treturn 0.5 / max( gv + gl, EPSILON );\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 + ( material.specularF90 - 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\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\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}";
|
|
60120
60395
|
|
|
60121
|
-
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\t#ifdef USE_LIGHT_PROBES_GRID\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal =
|
|
60396
|
+
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\t#ifdef USE_LIGHT_PROBES_GRID\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n\t\tirradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
60122
60397
|
|
|
60123
60398
|
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( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\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";
|
|
60124
60399
|
|
|
@@ -60156,7 +60431,7 @@ var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING
|
|
|
60156
60431
|
|
|
60157
60432
|
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";
|
|
60158
60433
|
|
|
60159
|
-
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#
|
|
60434
|
+
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
|
|
60160
60435
|
|
|
60161
60436
|
var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#if defined( USE_PACKED_NORMALMAP )\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\t#endif\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
60162
60437
|
|
|
@@ -60164,7 +60439,7 @@ var normal_pars_fragment = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifd
|
|
|
60164
60439
|
|
|
60165
60440
|
var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
|
|
60166
60441
|
|
|
60167
|
-
var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
|
|
60442
|
+
var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t\t#ifdef FLIP_SIDED\n\t\t\tvBitangent = - vBitangent;\n\t\t#endif\n\t#endif\n#endif";
|
|
60168
60443
|
|
|
60169
60444
|
var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
|
|
60170
60445
|
|
|
@@ -60196,7 +60471,7 @@ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSp
|
|
|
60196
60471
|
|
|
60197
60472
|
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";
|
|
60198
60473
|
|
|
60199
|
-
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#ifdef HAS_NORMAL\n\t\tvec3 shadowWorldNormal =
|
|
60474
|
+
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#ifdef HAS_NORMAL\n\t\tvec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\t#else\n\t\tvec3 shadowWorldNormal = vec3( 0.0 );\n\t#endif\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";
|
|
60200
60475
|
|
|
60201
60476
|
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}";
|
|
60202
60477
|
|
|
@@ -60216,7 +60491,7 @@ var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = to
|
|
|
60216
60491
|
|
|
60217
60492
|
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; }";
|
|
60218
60493
|
|
|
60219
|
-
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 =
|
|
60494
|
+
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 = transformNormalByInverseViewMatrix( 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";
|
|
60220
60495
|
|
|
60221
60496
|
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";
|
|
60222
60497
|
|
|
@@ -60246,7 +60521,7 @@ const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\
|
|
|
60246
60521
|
|
|
60247
60522
|
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 <uv_vertex>\n\t#include <batching_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}";
|
|
60248
60523
|
|
|
60249
|
-
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
|
|
60524
|
+
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}";
|
|
60250
60525
|
|
|
60251
60526
|
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}";
|
|
60252
60527
|
|
|
@@ -62457,8 +62732,9 @@ class PMREMGenerator {
|
|
|
62457
62732
|
|
|
62458
62733
|
/**
|
|
62459
62734
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
62460
|
-
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
62461
|
-
*
|
|
62735
|
+
* or HDR. The ideal input image size is 1k (1024 x 512), as this matches best
|
|
62736
|
+
* with the 256 x 256 cubemap output. The minimum supported input image size
|
|
62737
|
+
* is 64 x 32.
|
|
62462
62738
|
*
|
|
62463
62739
|
* @param {Texture} equirectangular - The equirectangular texture to be converted.
|
|
62464
62740
|
* @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
|
|
@@ -62472,8 +62748,9 @@ class PMREMGenerator {
|
|
|
62472
62748
|
|
|
62473
62749
|
/**
|
|
62474
62750
|
* Generates a PMREM from an cubemap texture, which can be either LDR
|
|
62475
|
-
* or HDR. The ideal input cube size is 256 x 256,
|
|
62476
|
-
*
|
|
62751
|
+
* or HDR. The ideal input cube size is 256 x 256, as this matches best
|
|
62752
|
+
* with the 256 x 256 cubemap output. The minimum supported input cube
|
|
62753
|
+
* size is 16 x 16 per face.
|
|
62477
62754
|
*
|
|
62478
62755
|
* @param {Texture} cubemap - The cubemap texture to be converted.
|
|
62479
62756
|
* @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
|
|
@@ -64608,13 +64885,14 @@ const toneMappingMap = {
|
|
|
64608
64885
|
[ CustomToneMapping ]: 'CUSTOM_TONE_MAPPING'
|
|
64609
64886
|
};
|
|
64610
64887
|
|
|
64611
|
-
function WebGLOutput( type, width, height, depth, stencil ) {
|
|
64888
|
+
function WebGLOutput( type, width, height, antialias, depth, stencil ) {
|
|
64612
64889
|
|
|
64613
64890
|
// render targets for scene and post-processing
|
|
64614
64891
|
const targetA = new WebGLRenderTarget( width, height, {
|
|
64615
64892
|
type: type,
|
|
64616
64893
|
depthBuffer: depth,
|
|
64617
64894
|
stencilBuffer: stencil,
|
|
64895
|
+
samples: antialias ? 4 : 0,
|
|
64618
64896
|
depthTexture: depth ? new DepthTexture( width, height ) : undefined
|
|
64619
64897
|
} );
|
|
64620
64898
|
|
|
@@ -66311,7 +66589,7 @@ function includeReplacer( match, include ) {
|
|
|
66311
66589
|
|
|
66312
66590
|
} else {
|
|
66313
66591
|
|
|
66314
|
-
throw new Error( 'Can not resolve #include <' + include + '>' );
|
|
66592
|
+
throw new Error( 'THREE.WebGLProgram: Can not resolve #include <' + include + '>' );
|
|
66315
66593
|
|
|
66316
66594
|
}
|
|
66317
66595
|
|
|
@@ -66942,9 +67220,10 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
66942
67220
|
|
|
66943
67221
|
gl.bindAttribLocation( program, 0, parameters.index0AttributeName );
|
|
66944
67222
|
|
|
66945
|
-
} else if ( parameters.
|
|
67223
|
+
} else if ( parameters.hasPositionAttribute === true ) {
|
|
67224
|
+
|
|
67225
|
+
// below avoids the "Attribute 0 is disabled" performance penalty
|
|
66946
67226
|
|
|
66947
|
-
// programs with morphTargets displace position out of attribute 0
|
|
66948
67227
|
gl.bindAttribLocation( program, 0, 'position' );
|
|
66949
67228
|
|
|
66950
67229
|
}
|
|
@@ -66983,7 +67262,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
66983
67262
|
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
66984
67263
|
|
|
66985
67264
|
error(
|
|
66986
|
-
'
|
|
67265
|
+
'WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
66987
67266
|
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
66988
67267
|
'Material Name: ' + self.name + '\n' +
|
|
66989
67268
|
'Material Type: ' + self.type + '\n\n' +
|
|
@@ -67135,13 +67414,7 @@ class WebGLShaderCache {
|
|
|
67135
67414
|
|
|
67136
67415
|
}
|
|
67137
67416
|
|
|
67138
|
-
update( material ) {
|
|
67139
|
-
|
|
67140
|
-
const vertexShader = material.vertexShader;
|
|
67141
|
-
const fragmentShader = material.fragmentShader;
|
|
67142
|
-
|
|
67143
|
-
const vertexShaderStage = this._getShaderStage( vertexShader );
|
|
67144
|
-
const fragmentShaderStage = this._getShaderStage( fragmentShader );
|
|
67417
|
+
update( material, vertexShaderStage, fragmentShaderStage ) {
|
|
67145
67418
|
|
|
67146
67419
|
const materialShaders = this._getShaderCacheForMaterial( material );
|
|
67147
67420
|
|
|
@@ -67181,15 +67454,15 @@ class WebGLShaderCache {
|
|
|
67181
67454
|
|
|
67182
67455
|
}
|
|
67183
67456
|
|
|
67184
|
-
|
|
67457
|
+
getVertexShaderStage( material ) {
|
|
67185
67458
|
|
|
67186
|
-
return this._getShaderStage( material.vertexShader )
|
|
67459
|
+
return this._getShaderStage( material.vertexShader );
|
|
67187
67460
|
|
|
67188
67461
|
}
|
|
67189
67462
|
|
|
67190
|
-
|
|
67463
|
+
getFragmentShaderStage( material ) {
|
|
67191
67464
|
|
|
67192
|
-
return this._getShaderStage( material.fragmentShader )
|
|
67465
|
+
return this._getShaderStage( material.fragmentShader );
|
|
67193
67466
|
|
|
67194
67467
|
}
|
|
67195
67468
|
|
|
@@ -67348,10 +67621,13 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
67348
67621
|
vertexShader = material.vertexShader;
|
|
67349
67622
|
fragmentShader = material.fragmentShader;
|
|
67350
67623
|
|
|
67351
|
-
_customShaders.
|
|
67624
|
+
const vertexShaderStage = _customShaders.getVertexShaderStage( material );
|
|
67625
|
+
const fragmentShaderStage = _customShaders.getFragmentShaderStage( material );
|
|
67626
|
+
|
|
67627
|
+
_customShaders.update( material, vertexShaderStage, fragmentShaderStage );
|
|
67352
67628
|
|
|
67353
|
-
customVertexShaderID =
|
|
67354
|
-
customFragmentShaderID =
|
|
67629
|
+
customVertexShaderID = vertexShaderStage.id;
|
|
67630
|
+
customFragmentShaderID = fragmentShaderStage.id;
|
|
67355
67631
|
|
|
67356
67632
|
}
|
|
67357
67633
|
|
|
@@ -67368,7 +67644,7 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
67368
67644
|
const HAS_ENVMAP = !! envMap;
|
|
67369
67645
|
const HAS_AOMAP = !! material.aoMap;
|
|
67370
67646
|
const HAS_LIGHTMAP = !! material.lightMap;
|
|
67371
|
-
const HAS_BUMPMAP = !! material.bumpMap;
|
|
67647
|
+
const HAS_BUMPMAP = !! material.bumpMap && material.wireframe === false;
|
|
67372
67648
|
const HAS_NORMALMAP = !! material.normalMap;
|
|
67373
67649
|
const HAS_DISPLACEMENTMAP = !! material.displacementMap;
|
|
67374
67650
|
const HAS_EMISSIVEMAP = !! material.emissiveMap;
|
|
@@ -67567,6 +67843,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
67567
67843
|
|
|
67568
67844
|
skinning: object.isSkinnedMesh === true,
|
|
67569
67845
|
|
|
67846
|
+
hasPositionAttribute: geometry.attributes.position !== undefined,
|
|
67847
|
+
|
|
67570
67848
|
morphTargets: geometry.morphAttributes.position !== undefined,
|
|
67571
67849
|
morphNormals: geometry.morphAttributes.normal !== undefined,
|
|
67572
67850
|
morphColors: geometry.morphAttributes.color !== undefined,
|
|
@@ -67828,8 +68106,10 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
67828
68106
|
_programLayers.enable( 21 );
|
|
67829
68107
|
if ( parameters.numLightProbeGrids > 0 )
|
|
67830
68108
|
_programLayers.enable( 22 );
|
|
67831
|
-
if ( parameters.
|
|
68109
|
+
if ( parameters.hasPositionAttribute )
|
|
67832
68110
|
_programLayers.enable( 23 );
|
|
68111
|
+
if ( parameters.numMultiviewViews )
|
|
68112
|
+
_programLayers.enable( 24 );
|
|
67833
68113
|
|
|
67834
68114
|
array.push( _programLayers.mask );
|
|
67835
68115
|
|
|
@@ -68135,12 +68415,20 @@ function WebGLRenderList() {
|
|
|
68135
68415
|
|
|
68136
68416
|
}
|
|
68137
68417
|
|
|
68138
|
-
function sort( customOpaqueSort, customTransparentSort ) {
|
|
68418
|
+
function sort( customOpaqueSort, customTransparentSort, reversedDepth ) {
|
|
68139
68419
|
|
|
68140
68420
|
if ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );
|
|
68141
68421
|
if ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );
|
|
68142
68422
|
if ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );
|
|
68143
68423
|
|
|
68424
|
+
if ( reversedDepth ) {
|
|
68425
|
+
|
|
68426
|
+
opaque.reverse();
|
|
68427
|
+
transmissive.reverse();
|
|
68428
|
+
transparent.reverse();
|
|
68429
|
+
|
|
68430
|
+
}
|
|
68431
|
+
|
|
68144
68432
|
}
|
|
68145
68433
|
|
|
68146
68434
|
function finish() {
|
|
@@ -72201,12 +72489,25 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
72201
72489
|
|
|
72202
72490
|
}
|
|
72203
72491
|
|
|
72204
|
-
|
|
72205
|
-
|
|
72206
|
-
|
|
72207
|
-
|
|
72492
|
+
if ( _gl.texElementImage2D.length === 3 ) {
|
|
72493
|
+
|
|
72494
|
+
// Chrome 150+
|
|
72495
|
+
|
|
72496
|
+
_gl.texElementImage2D( _gl.TEXTURE_2D, _gl.RGBA8, image );
|
|
72497
|
+
|
|
72498
|
+
} else {
|
|
72499
|
+
|
|
72500
|
+
// Chrome 138 - 149
|
|
72501
|
+
|
|
72502
|
+
const level = 0;
|
|
72503
|
+
const internalFormat = _gl.RGBA;
|
|
72504
|
+
const srcFormat = _gl.RGBA;
|
|
72505
|
+
const srcType = _gl.UNSIGNED_BYTE;
|
|
72506
|
+
|
|
72507
|
+
_gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image );
|
|
72508
|
+
|
|
72509
|
+
}
|
|
72208
72510
|
|
|
72209
|
-
_gl.texElementImage2D( _gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image );
|
|
72210
72511
|
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
|
|
72211
72512
|
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
|
|
72212
72513
|
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
|
|
@@ -72728,7 +73029,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
72728
73029
|
|
|
72729
73030
|
if ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {
|
|
72730
73031
|
|
|
72731
|
-
throw new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );
|
|
73032
|
+
throw new Error( 'THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.' );
|
|
72732
73033
|
|
|
72733
73034
|
}
|
|
72734
73035
|
|
|
@@ -72867,7 +73168,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
72867
73168
|
|
|
72868
73169
|
} else {
|
|
72869
73170
|
|
|
72870
|
-
throw new Error( 'Unknown depthTexture format' );
|
|
73171
|
+
throw new Error( 'THREE.WebGLTextures: Unknown depthTexture format.' );
|
|
72871
73172
|
|
|
72872
73173
|
}
|
|
72873
73174
|
|
|
@@ -75779,73 +76080,101 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
75779
76080
|
|
|
75780
76081
|
for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
|
|
75781
76082
|
|
|
75782
|
-
const
|
|
76083
|
+
const uniformItem = uniforms[ i ];
|
|
75783
76084
|
|
|
75784
|
-
|
|
76085
|
+
if ( Array.isArray( uniformItem ) ) {
|
|
75785
76086
|
|
|
75786
|
-
|
|
76087
|
+
for ( let j = 0, jl = uniformItem.length; j < jl; j ++ ) {
|
|
75787
76088
|
|
|
75788
|
-
|
|
76089
|
+
updateUniform( uniformItem[ j ], i, j, cache );
|
|
75789
76090
|
|
|
75790
|
-
|
|
76091
|
+
}
|
|
75791
76092
|
|
|
75792
|
-
|
|
76093
|
+
} else {
|
|
75793
76094
|
|
|
75794
|
-
|
|
76095
|
+
updateUniform( uniformItem, i, 0, cache );
|
|
75795
76096
|
|
|
75796
|
-
|
|
76097
|
+
}
|
|
75797
76098
|
|
|
75798
|
-
|
|
76099
|
+
}
|
|
75799
76100
|
|
|
75800
|
-
|
|
76101
|
+
gl.bindBuffer( gl.UNIFORM_BUFFER, null );
|
|
75801
76102
|
|
|
75802
|
-
|
|
75803
|
-
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
76103
|
+
}
|
|
75804
76104
|
|
|
75805
|
-
|
|
75806
|
-
gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
|
|
76105
|
+
function updateUniform( uniform, index, indexArray, cache ) {
|
|
75807
76106
|
|
|
75808
|
-
|
|
76107
|
+
if ( hasUniformChanged( uniform, index, indexArray, cache ) === true ) {
|
|
75809
76108
|
|
|
75810
|
-
|
|
76109
|
+
const offset = uniform.__offset;
|
|
76110
|
+
const value = uniform.value;
|
|
75811
76111
|
|
|
75812
|
-
|
|
75813
|
-
uniform.__data[ 1 ] = value.elements[ 1 ];
|
|
75814
|
-
uniform.__data[ 2 ] = value.elements[ 2 ];
|
|
75815
|
-
uniform.__data[ 3 ] = 0;
|
|
75816
|
-
uniform.__data[ 4 ] = value.elements[ 3 ];
|
|
75817
|
-
uniform.__data[ 5 ] = value.elements[ 4 ];
|
|
75818
|
-
uniform.__data[ 6 ] = value.elements[ 5 ];
|
|
75819
|
-
uniform.__data[ 7 ] = 0;
|
|
75820
|
-
uniform.__data[ 8 ] = value.elements[ 6 ];
|
|
75821
|
-
uniform.__data[ 9 ] = value.elements[ 7 ];
|
|
75822
|
-
uniform.__data[ 10 ] = value.elements[ 8 ];
|
|
75823
|
-
uniform.__data[ 11 ] = 0;
|
|
76112
|
+
if ( Array.isArray( value ) ) {
|
|
75824
76113
|
|
|
75825
|
-
|
|
76114
|
+
let arrayOffset = 0;
|
|
75826
76115
|
|
|
75827
|
-
|
|
75828
|
-
uniform.__data.set( new value.constructor( value.buffer, value.byteOffset, uniform.__data.length ) );
|
|
76116
|
+
for ( let k = 0; k < value.length; k ++ ) {
|
|
75829
76117
|
|
|
75830
|
-
|
|
76118
|
+
const val = value[ k ];
|
|
76119
|
+
const info = getUniformSize( val );
|
|
75831
76120
|
|
|
75832
|
-
|
|
76121
|
+
writeUniformValue( val, uniform.__data, arrayOffset );
|
|
75833
76122
|
|
|
75834
|
-
|
|
76123
|
+
// only toArray() values advance arrayOffset
|
|
76124
|
+
if ( typeof val !== 'number' && typeof val !== 'boolean' && ! val.isMatrix3 && ! ArrayBuffer.isView( val ) ) {
|
|
75835
76125
|
|
|
75836
|
-
|
|
76126
|
+
arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
75837
76127
|
|
|
75838
76128
|
}
|
|
75839
76129
|
|
|
75840
|
-
gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
|
|
75841
|
-
|
|
75842
76130
|
}
|
|
75843
76131
|
|
|
76132
|
+
} else {
|
|
76133
|
+
|
|
76134
|
+
writeUniformValue( value, uniform.__data, 0 );
|
|
76135
|
+
|
|
75844
76136
|
}
|
|
75845
76137
|
|
|
76138
|
+
gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
|
|
76139
|
+
|
|
75846
76140
|
}
|
|
75847
76141
|
|
|
75848
|
-
|
|
76142
|
+
}
|
|
76143
|
+
|
|
76144
|
+
function writeUniformValue( value, data, offset ) {
|
|
76145
|
+
|
|
76146
|
+
// TODO add integer and struct support
|
|
76147
|
+
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
76148
|
+
|
|
76149
|
+
data[ 0 ] = value;
|
|
76150
|
+
|
|
76151
|
+
} else if ( value.isMatrix3 ) {
|
|
76152
|
+
|
|
76153
|
+
// manually converting 3x3 to 3x4
|
|
76154
|
+
|
|
76155
|
+
data[ 0 ] = value.elements[ 0 ];
|
|
76156
|
+
data[ 1 ] = value.elements[ 1 ];
|
|
76157
|
+
data[ 2 ] = value.elements[ 2 ];
|
|
76158
|
+
data[ 3 ] = 0;
|
|
76159
|
+
data[ 4 ] = value.elements[ 3 ];
|
|
76160
|
+
data[ 5 ] = value.elements[ 4 ];
|
|
76161
|
+
data[ 6 ] = value.elements[ 5 ];
|
|
76162
|
+
data[ 7 ] = 0;
|
|
76163
|
+
data[ 8 ] = value.elements[ 6 ];
|
|
76164
|
+
data[ 9 ] = value.elements[ 7 ];
|
|
76165
|
+
data[ 10 ] = value.elements[ 8 ];
|
|
76166
|
+
data[ 11 ] = 0;
|
|
76167
|
+
|
|
76168
|
+
} else if ( ArrayBuffer.isView( value ) ) {
|
|
76169
|
+
|
|
76170
|
+
// copy the buffer data using "set"
|
|
76171
|
+
data.set( new value.constructor( value.buffer, value.byteOffset, data.length ) );
|
|
76172
|
+
|
|
76173
|
+
} else {
|
|
76174
|
+
|
|
76175
|
+
value.toArray( data, offset );
|
|
76176
|
+
|
|
76177
|
+
}
|
|
75849
76178
|
|
|
75850
76179
|
}
|
|
75851
76180
|
|
|
@@ -76379,6 +76708,10 @@ class WebGLRenderer {
|
|
|
76379
76708
|
let _isContextLost = false;
|
|
76380
76709
|
let _nodesHandler = null;
|
|
76381
76710
|
|
|
76711
|
+
let _scratchFramebuffer = null;
|
|
76712
|
+
let _srcFramebuffer = null;
|
|
76713
|
+
let _dstFramebuffer = null;
|
|
76714
|
+
|
|
76382
76715
|
// internal state cache
|
|
76383
76716
|
|
|
76384
76717
|
this._outputColorSpace = SRGBColorSpace;
|
|
@@ -76478,11 +76811,11 @@ class WebGLRenderer {
|
|
|
76478
76811
|
|
|
76479
76812
|
if ( getContext( contextName ) ) {
|
|
76480
76813
|
|
|
76481
|
-
throw new Error( 'Error creating WebGL context with your selected attributes.' );
|
|
76814
|
+
throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.' );
|
|
76482
76815
|
|
|
76483
76816
|
} else {
|
|
76484
76817
|
|
|
76485
|
-
throw new Error( 'Error creating WebGL context.' );
|
|
76818
|
+
throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context.' );
|
|
76486
76819
|
|
|
76487
76820
|
}
|
|
76488
76821
|
|
|
@@ -76523,6 +76856,10 @@ class WebGLRenderer {
|
|
|
76523
76856
|
|
|
76524
76857
|
}
|
|
76525
76858
|
|
|
76859
|
+
_scratchFramebuffer = _gl.createFramebuffer();
|
|
76860
|
+
_srcFramebuffer = _gl.createFramebuffer();
|
|
76861
|
+
_dstFramebuffer = _gl.createFramebuffer();
|
|
76862
|
+
|
|
76526
76863
|
info = new WebGLInfo( _gl );
|
|
76527
76864
|
properties = new WebGLProperties();
|
|
76528
76865
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -76630,7 +76967,7 @@ class WebGLRenderer {
|
|
|
76630
76967
|
|
|
76631
76968
|
if ( _outputBufferType !== UnsignedByteType ) {
|
|
76632
76969
|
|
|
76633
|
-
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );
|
|
76970
|
+
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, antialias, depth, stencil );
|
|
76634
76971
|
|
|
76635
76972
|
}
|
|
76636
76973
|
|
|
@@ -76814,7 +77151,7 @@ class WebGLRenderer {
|
|
|
76814
77151
|
|
|
76815
77152
|
if ( _outputBufferType === UnsignedByteType ) {
|
|
76816
77153
|
|
|
76817
|
-
error( '
|
|
77154
|
+
error( 'WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
|
|
76818
77155
|
return;
|
|
76819
77156
|
|
|
76820
77157
|
}
|
|
@@ -76825,7 +77162,7 @@ class WebGLRenderer {
|
|
|
76825
77162
|
|
|
76826
77163
|
if ( effects[ i ].isOutputPass === true ) {
|
|
76827
77164
|
|
|
76828
|
-
warn( '
|
|
77165
|
+
warn( 'WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
|
|
76829
77166
|
break;
|
|
76830
77167
|
|
|
76831
77168
|
}
|
|
@@ -77263,7 +77600,7 @@ class WebGLRenderer {
|
|
|
77263
77600
|
|
|
77264
77601
|
if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
|
|
77265
77602
|
|
|
77266
|
-
const frontFaceCW = ( object.isMesh && object.matrixWorld.
|
|
77603
|
+
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
|
|
77267
77604
|
|
|
77268
77605
|
const program = setProgram( camera, scene, geometry, material, object );
|
|
77269
77606
|
|
|
@@ -77762,7 +78099,7 @@ class WebGLRenderer {
|
|
|
77762
78099
|
|
|
77763
78100
|
if ( _this.sortObjects === true ) {
|
|
77764
78101
|
|
|
77765
|
-
currentRenderList.sort( _opaqueSort, _transparentSort );
|
|
78102
|
+
currentRenderList.sort( _opaqueSort, _transparentSort, camera.reversedDepth );
|
|
77766
78103
|
|
|
77767
78104
|
}
|
|
77768
78105
|
|
|
@@ -77777,6 +78114,8 @@ class WebGLRenderer {
|
|
|
77777
78114
|
|
|
77778
78115
|
this.info.render.frame ++;
|
|
77779
78116
|
|
|
78117
|
+
if ( this.info.autoReset === true ) this.info.reset();
|
|
78118
|
+
|
|
77780
78119
|
if ( _clippingEnabled === true ) clipping.beginShadows();
|
|
77781
78120
|
|
|
77782
78121
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
@@ -77787,8 +78126,6 @@ class WebGLRenderer {
|
|
|
77787
78126
|
|
|
77788
78127
|
//
|
|
77789
78128
|
|
|
77790
|
-
if ( this.info.autoReset === true ) this.info.reset();
|
|
77791
|
-
|
|
77792
78129
|
// render scene (skip if first effect is a render pass - it will render the scene itself)
|
|
77793
78130
|
|
|
77794
78131
|
const skipSceneRender = useOutput && output.hasRenderPass();
|
|
@@ -79018,8 +79355,6 @@ class WebGLRenderer {
|
|
|
79018
79355
|
|
|
79019
79356
|
};
|
|
79020
79357
|
|
|
79021
|
-
const _scratchFrameBuffer = _gl.createFramebuffer();
|
|
79022
|
-
|
|
79023
79358
|
/**
|
|
79024
79359
|
* Sets the active rendertarget.
|
|
79025
79360
|
*
|
|
@@ -79090,7 +79425,7 @@ class WebGLRenderer {
|
|
|
79090
79425
|
( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
|
|
79091
79426
|
) {
|
|
79092
79427
|
|
|
79093
|
-
throw new Error( '
|
|
79428
|
+
throw new Error( 'THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.' );
|
|
79094
79429
|
|
|
79095
79430
|
}
|
|
79096
79431
|
|
|
@@ -79159,7 +79494,7 @@ class WebGLRenderer {
|
|
|
79159
79494
|
// being bound that are different sizes.
|
|
79160
79495
|
if ( activeMipmapLevel !== 0 ) {
|
|
79161
79496
|
|
|
79162
|
-
framebuffer =
|
|
79497
|
+
framebuffer = _scratchFramebuffer;
|
|
79163
79498
|
|
|
79164
79499
|
}
|
|
79165
79500
|
|
|
@@ -79402,8 +79737,6 @@ class WebGLRenderer {
|
|
|
79402
79737
|
|
|
79403
79738
|
};
|
|
79404
79739
|
|
|
79405
|
-
const _srcFramebuffer = _gl.createFramebuffer();
|
|
79406
|
-
const _dstFramebuffer = _gl.createFramebuffer();
|
|
79407
79740
|
|
|
79408
79741
|
/**
|
|
79409
79742
|
* Copies data of the given source texture into a destination texture.
|