super-three 0.179.0 → 0.181.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 +1112 -595
- package/build/three.core.js +616 -345
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +492 -254
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +37 -6
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +6573 -2150
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6572 -2149
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +1 -1
- package/examples/jsm/animation/CCDIKSolver.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +8 -8
- package/examples/jsm/controls/DragControls.js +7 -57
- package/examples/jsm/controls/FirstPersonControls.js +3 -3
- package/examples/jsm/controls/FlyControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +2 -10
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +33 -25
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +9 -2
- package/examples/jsm/geometries/DecalGeometry.js +2 -2
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +3 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/ViewHelper.js +43 -5
- package/examples/jsm/inspector/Inspector.js +427 -0
- package/examples/jsm/inspector/RendererInspector.js +415 -0
- package/examples/jsm/inspector/tabs/Console.js +204 -0
- package/examples/jsm/inspector/tabs/Parameters.js +332 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +170 -0
- package/examples/jsm/inspector/ui/Style.js +654 -0
- package/examples/jsm/inspector/ui/Tab.js +46 -0
- package/examples/jsm/inspector/ui/Values.js +423 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +6 -10
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +3 -3
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/EXRLoader.js +5 -5
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GLTFLoader.js +14 -8
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +136 -49
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TTFLoader.js +4 -4
- package/examples/jsm/loaders/UltraHDRLoader.js +2 -2
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +3 -3
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/SkyMesh.js +1 -1
- package/examples/jsm/objects/Water.js +3 -3
- package/examples/jsm/objects/WaterMesh.js +6 -6
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
- package/examples/jsm/renderers/SVGRenderer.js +1 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +2 -2
- package/examples/jsm/shaders/GodRaysShader.js +1 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +1 -1
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +22 -19
- package/examples/jsm/transpiler/TSLEncoder.js +9 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
- package/examples/jsm/tsl/display/AnamorphicNode.js +28 -4
- package/examples/jsm/tsl/display/BloomNode.js +7 -3
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +446 -90
- package/examples/jsm/tsl/display/GTAONode.js +53 -5
- package/examples/jsm/tsl/display/GaussianBlurNode.js +49 -35
- package/examples/jsm/tsl/display/OutlineNode.js +13 -2
- package/examples/jsm/tsl/display/SSGINode.js +654 -0
- package/examples/jsm/tsl/display/SSRNode.js +182 -65
- package/examples/jsm/tsl/display/SSSNode.js +488 -0
- package/examples/jsm/tsl/display/TRAANode.js +124 -7
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/hashBlur.js +16 -18
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
- package/package.json +5 -10
- package/src/Three.Core.js +4 -2
- package/src/Three.TSL.js +36 -5
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/AnimationClip.js +20 -4
- package/src/animation/AnimationMixer.js +3 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/KeyframeTrack.js +7 -6
- package/src/animation/PropertyBinding.js +12 -11
- package/src/audio/Audio.js +10 -9
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +11 -3
- package/src/core/BufferGeometry.js +10 -10
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +3 -2
- package/src/core/Raycaster.js +2 -1
- package/src/core/RenderTarget.js +10 -1
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +268 -55
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/lib/earcut.js +8 -8
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +8 -6
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +1 -0
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +2 -1
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +2 -2
- package/src/loaders/DataTextureLoader.js +1 -1
- package/src/loaders/FileLoader.js +3 -2
- package/src/loaders/ImageBitmapLoader.js +5 -4
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +3 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +13 -13
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +3 -2
- package/src/materials/Material.js +16 -3
- package/src/materials/MeshBasicMaterial.js +1 -0
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/MeshLambertMaterial.js +2 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +2 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +1 -0
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +62 -22
- package/src/materials/nodes/PointsNodeMaterial.js +81 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +3 -2
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +9 -3
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/MathUtils.js +13 -11
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +7 -7
- package/src/math/Plane.js +1 -1
- package/src/math/Quaternion.js +68 -66
- package/src/math/Spherical.js +1 -1
- package/src/nodes/Nodes.js +4 -1
- package/src/nodes/TSL.js +4 -1
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +133 -7
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +5 -4
- package/src/nodes/accessors/InstanceNode.js +25 -5
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/Normal.js +5 -4
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/Position.js +18 -2
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +3 -2
- package/src/nodes/accessors/SceneNode.js +2 -1
- package/src/nodes/accessors/StorageBufferNode.js +2 -1
- package/src/nodes/accessors/StorageTextureNode.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +14 -1
- package/src/nodes/accessors/TextureNode.js +130 -44
- package/src/nodes/code/FunctionCallNode.js +24 -4
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +1 -0
- package/src/nodes/core/AssignNode.js +4 -3
- package/src/nodes/core/AttributeNode.js +2 -1
- package/src/nodes/core/ContextNode.js +29 -10
- package/src/nodes/core/IndexNode.js +2 -2
- package/src/nodes/core/InputNode.js +2 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
- package/src/nodes/core/Node.js +152 -31
- package/src/nodes/core/NodeBuilder.js +183 -35
- package/src/nodes/core/NodeFrame.js +21 -21
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +17 -91
- package/src/nodes/core/ParameterNode.js +31 -0
- package/src/nodes/core/PropertyNode.js +7 -0
- package/src/nodes/core/StackNode.js +43 -16
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +18 -10
- package/src/nodes/core/VarNode.js +70 -33
- package/src/nodes/core/VaryingNode.js +3 -2
- package/src/nodes/display/BlendModes.js +5 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/NormalMapNode.js +2 -1
- package/src/nodes/display/PassNode.js +52 -11
- package/src/nodes/display/RenderOutputNode.js +28 -2
- package/src/nodes/display/ScreenNode.js +44 -14
- package/src/nodes/display/ToneMappingNode.js +31 -4
- package/src/nodes/display/ToonOutlinePassNode.js +8 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +42 -12
- package/src/nodes/fog/Fog.js +3 -2
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +3 -2
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +40 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
- package/src/nodes/gpgpu/ComputeNode.js +17 -5
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +6 -6
- package/src/nodes/lighting/LightsNode.js +3 -4
- package/src/nodes/lighting/PointShadowNode.js +6 -0
- package/src/nodes/lighting/ShadowFilterNode.js +2 -0
- package/src/nodes/lighting/ShadowNode.js +75 -8
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +24 -7
- package/src/nodes/math/MathNode.js +25 -19
- package/src/nodes/math/OperatorNode.js +7 -5
- package/src/nodes/pmrem/PMREMUtils.js +117 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +5 -2
- package/src/nodes/tsl/TSLCore.js +460 -159
- package/src/nodes/utils/DebugNode.js +2 -1
- package/src/nodes/utils/EventNode.js +36 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +59 -7
- package/src/nodes/utils/PostProcessingUtils.js +28 -1
- package/src/nodes/utils/RTTNode.js +13 -3
- package/src/nodes/utils/ReflectorNode.js +58 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +2 -2
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +2 -1
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Skeleton.js +3 -2
- package/src/objects/SkinnedMesh.js +3 -1
- package/src/objects/Sprite.js +4 -3
- package/src/renderers/WebGLRenderer.js +52 -43
- package/src/renderers/common/Animation.js +13 -1
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +108 -27
- package/src/renderers/common/Background.js +2 -1
- package/src/renderers/common/Bindings.js +58 -2
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Geometries.js +26 -0
- package/src/renderers/common/Info.js +4 -2
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +6 -25
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderObject.js +16 -2
- package/src/renderers/common/RenderObjects.js +1 -1
- package/src/renderers/common/Renderer.js +473 -245
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +9 -1
- package/src/renderers/common/Sampler.js +50 -12
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +121 -45
- package/src/renderers/common/TimestampQueryPool.js +65 -3
- package/src/renderers/common/UniformsGroup.js +2 -1
- package/src/renderers/common/XRManager.js +42 -22
- package/src/renderers/common/extras/PMREMGenerator.js +160 -65
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +9 -7
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/Nodes.js +38 -16
- package/src/renderers/shaders/DFGLUTData.js +64 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -15
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +1 -1
- package/src/renderers/shaders/UniformsLib.js +1 -0
- package/src/renderers/shaders/UniformsUtils.js +25 -4
- package/src/renderers/webgl/WebGLCapabilities.js +2 -1
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +15 -14
- package/src/renderers/webgl/WebGLPrograms.js +3 -2
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLState.js +15 -14
- package/src/renderers/webgl/WebGLTextures.js +19 -14
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +199 -167
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +181 -25
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +7 -6
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +169 -19
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +51 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +153 -123
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +3 -2
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +142 -50
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +7 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +53 -34
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +260 -99
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +32 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
- package/src/renderers/webxr/WebXRManager.js +41 -27
- package/src/textures/ExternalTexture.js +15 -4
- package/src/textures/Source.js +3 -2
- package/src/textures/Texture.js +3 -2
- package/src/textures/VideoTexture.js +2 -3
- package/src/utils.js +67 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '181';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -728,6 +728,14 @@ const UnsignedInt248Type = 1020;
|
|
|
728
728
|
*/
|
|
729
729
|
const UnsignedInt5999Type = 35902;
|
|
730
730
|
|
|
731
|
+
/**
|
|
732
|
+
* An unsigned int 10_11_11 (packed) data type for textures.
|
|
733
|
+
*
|
|
734
|
+
* @type {number}
|
|
735
|
+
* @constant
|
|
736
|
+
*/
|
|
737
|
+
const UnsignedInt101111Type = 35899;
|
|
738
|
+
|
|
731
739
|
/**
|
|
732
740
|
* Discards the red, green and blue components and reads just the alpha component.
|
|
733
741
|
*
|
|
@@ -1669,14 +1677,165 @@ const InterpolationSamplingMode = {
|
|
|
1669
1677
|
* @property {string} NORMAL - Normal sampling mode.
|
|
1670
1678
|
* @property {string} CENTROID - Centroid sampling mode.
|
|
1671
1679
|
* @property {string} SAMPLE - Sample-specific sampling mode.
|
|
1672
|
-
* @property {string}
|
|
1673
|
-
* @property {string}
|
|
1680
|
+
* @property {string} FIRST - Flat interpolation using the first vertex.
|
|
1681
|
+
* @property {string} EITHER - Flat interpolation using either vertex.
|
|
1674
1682
|
*/
|
|
1675
1683
|
|
|
1684
|
+
function arrayNeedsUint32( array ) {
|
|
1685
|
+
|
|
1686
|
+
// assumes larger values usually on last
|
|
1687
|
+
|
|
1688
|
+
for ( let i = array.length - 1; i >= 0; -- i ) {
|
|
1689
|
+
|
|
1690
|
+
if ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
|
|
1691
|
+
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
return false;
|
|
1695
|
+
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
const TYPED_ARRAYS = {
|
|
1699
|
+
Int8Array: Int8Array,
|
|
1700
|
+
Uint8Array: Uint8Array,
|
|
1701
|
+
Uint8ClampedArray: Uint8ClampedArray,
|
|
1702
|
+
Int16Array: Int16Array,
|
|
1703
|
+
Uint16Array: Uint16Array,
|
|
1704
|
+
Int32Array: Int32Array,
|
|
1705
|
+
Uint32Array: Uint32Array,
|
|
1706
|
+
Float32Array: Float32Array,
|
|
1707
|
+
Float64Array: Float64Array
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
function getTypedArray( type, buffer ) {
|
|
1711
|
+
|
|
1712
|
+
return new TYPED_ARRAYS[ type ]( buffer );
|
|
1713
|
+
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
function createElementNS( name ) {
|
|
1717
|
+
|
|
1718
|
+
return document.createElementNS( 'http://www.w3.org/1999/xhtml', name );
|
|
1719
|
+
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
function createCanvasElement() {
|
|
1723
|
+
|
|
1724
|
+
const canvas = createElementNS( 'canvas' );
|
|
1725
|
+
canvas.style.display = 'block';
|
|
1726
|
+
return canvas;
|
|
1727
|
+
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
const _cache = {};
|
|
1731
|
+
|
|
1732
|
+
let _setConsoleFunction = null;
|
|
1733
|
+
|
|
1734
|
+
function setConsoleFunction( fn ) {
|
|
1735
|
+
|
|
1736
|
+
_setConsoleFunction = fn;
|
|
1737
|
+
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
function getConsoleFunction() {
|
|
1741
|
+
|
|
1742
|
+
return _setConsoleFunction;
|
|
1743
|
+
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
function log( ...params ) {
|
|
1747
|
+
|
|
1748
|
+
const message = 'THREE.' + params.shift();
|
|
1749
|
+
|
|
1750
|
+
if ( _setConsoleFunction ) {
|
|
1751
|
+
|
|
1752
|
+
_setConsoleFunction( 'log', message, ...params );
|
|
1753
|
+
|
|
1754
|
+
} else {
|
|
1755
|
+
|
|
1756
|
+
console.log( message, ...params );
|
|
1757
|
+
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
function warn( ...params ) {
|
|
1763
|
+
|
|
1764
|
+
const message = 'THREE.' + params.shift();
|
|
1765
|
+
|
|
1766
|
+
if ( _setConsoleFunction ) {
|
|
1767
|
+
|
|
1768
|
+
_setConsoleFunction( 'warn', message, ...params );
|
|
1769
|
+
|
|
1770
|
+
} else {
|
|
1771
|
+
|
|
1772
|
+
console.warn( message, ...params );
|
|
1773
|
+
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
function error( ...params ) {
|
|
1779
|
+
|
|
1780
|
+
const message = 'THREE.' + params.shift();
|
|
1781
|
+
|
|
1782
|
+
if ( _setConsoleFunction ) {
|
|
1783
|
+
|
|
1784
|
+
_setConsoleFunction( 'error', message, ...params );
|
|
1785
|
+
|
|
1786
|
+
} else {
|
|
1787
|
+
|
|
1788
|
+
console.error( message, ...params );
|
|
1789
|
+
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
function warnOnce( ...params ) {
|
|
1795
|
+
|
|
1796
|
+
const message = params.join( ' ' );
|
|
1797
|
+
|
|
1798
|
+
if ( message in _cache ) return;
|
|
1799
|
+
|
|
1800
|
+
_cache[ message ] = true;
|
|
1801
|
+
|
|
1802
|
+
warn( ...params );
|
|
1803
|
+
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
function probeAsync( gl, sync, interval ) {
|
|
1807
|
+
|
|
1808
|
+
return new Promise( function ( resolve, reject ) {
|
|
1809
|
+
|
|
1810
|
+
function probe() {
|
|
1811
|
+
|
|
1812
|
+
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
1813
|
+
|
|
1814
|
+
case gl.WAIT_FAILED:
|
|
1815
|
+
reject();
|
|
1816
|
+
break;
|
|
1817
|
+
|
|
1818
|
+
case gl.TIMEOUT_EXPIRED:
|
|
1819
|
+
setTimeout( probe, interval );
|
|
1820
|
+
break;
|
|
1821
|
+
|
|
1822
|
+
default:
|
|
1823
|
+
resolve();
|
|
1824
|
+
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
setTimeout( probe, interval );
|
|
1830
|
+
|
|
1831
|
+
} );
|
|
1832
|
+
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1676
1835
|
/**
|
|
1677
1836
|
* This modules allows to dispatch event objects on custom JavaScript objects.
|
|
1678
1837
|
*
|
|
1679
|
-
* Main repository: [eventdispatcher.js]
|
|
1838
|
+
* Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/)
|
|
1680
1839
|
*
|
|
1681
1840
|
* Code Example:
|
|
1682
1841
|
* ```js
|
|
@@ -1811,7 +1970,7 @@ const DEG2RAD = Math.PI / 180;
|
|
|
1811
1970
|
const RAD2DEG = 180 / Math.PI;
|
|
1812
1971
|
|
|
1813
1972
|
/**
|
|
1814
|
-
* Generate a [UUID]
|
|
1973
|
+
* Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
1815
1974
|
* (universally unique identifier).
|
|
1816
1975
|
*
|
|
1817
1976
|
* @return {string} The UUID.
|
|
@@ -1924,7 +2083,7 @@ function lerp( x, y, t ) {
|
|
|
1924
2083
|
/**
|
|
1925
2084
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
1926
2085
|
* time to maintain frame rate independent movement. For details, see
|
|
1927
|
-
* [Frame rate independent damping using lerp]
|
|
2086
|
+
* [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
1928
2087
|
*
|
|
1929
2088
|
* @param {number} x - The current point.
|
|
1930
2089
|
* @param {number} y - The target point.
|
|
@@ -1959,7 +2118,7 @@ function pingpong( x, length = 1 ) {
|
|
|
1959
2118
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
1960
2119
|
* the `min` and `max`.
|
|
1961
2120
|
*
|
|
1962
|
-
* See [Smoothstep]
|
|
2121
|
+
* See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
1963
2122
|
*
|
|
1964
2123
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
1965
2124
|
* @param {number} min - The min value. Any x value below min will be `0`.
|
|
@@ -1978,7 +2137,7 @@ function smoothstep( x, min, max ) {
|
|
|
1978
2137
|
}
|
|
1979
2138
|
|
|
1980
2139
|
/**
|
|
1981
|
-
* A [variation on smoothstep]
|
|
2140
|
+
* A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
1982
2141
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
1983
2142
|
*
|
|
1984
2143
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
@@ -2118,7 +2277,7 @@ function floorPowerOfTwo( value ) {
|
|
|
2118
2277
|
}
|
|
2119
2278
|
|
|
2120
2279
|
/**
|
|
2121
|
-
* Sets the given quaternion from the [Intrinsic Proper Euler Angles]
|
|
2280
|
+
* Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
2122
2281
|
* defined by the given angles and order.
|
|
2123
2282
|
*
|
|
2124
2283
|
* Rotations are applied to the axes in the order specified by order:
|
|
@@ -2174,7 +2333,7 @@ function setQuaternionFromProperEuler( q, a, b, c, order ) {
|
|
|
2174
2333
|
break;
|
|
2175
2334
|
|
|
2176
2335
|
default:
|
|
2177
|
-
|
|
2336
|
+
warn( 'MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );
|
|
2178
2337
|
|
|
2179
2338
|
}
|
|
2180
2339
|
|
|
@@ -2283,7 +2442,7 @@ const MathUtils = {
|
|
|
2283
2442
|
DEG2RAD: DEG2RAD,
|
|
2284
2443
|
RAD2DEG: RAD2DEG,
|
|
2285
2444
|
/**
|
|
2286
|
-
* Generate a [UUID]
|
|
2445
|
+
* Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
2287
2446
|
* (universally unique identifier).
|
|
2288
2447
|
*
|
|
2289
2448
|
* @static
|
|
@@ -2354,7 +2513,7 @@ const MathUtils = {
|
|
|
2354
2513
|
/**
|
|
2355
2514
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
2356
2515
|
* time to maintain frame rate independent movement. For details, see
|
|
2357
|
-
* [Frame rate independent damping using lerp]
|
|
2516
|
+
* [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
2358
2517
|
*
|
|
2359
2518
|
* @static
|
|
2360
2519
|
* @method
|
|
@@ -2381,7 +2540,7 @@ const MathUtils = {
|
|
|
2381
2540
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
2382
2541
|
* the `min` and `max`.
|
|
2383
2542
|
*
|
|
2384
|
-
* See [Smoothstep]
|
|
2543
|
+
* See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
2385
2544
|
*
|
|
2386
2545
|
* @static
|
|
2387
2546
|
* @method
|
|
@@ -2392,7 +2551,7 @@ const MathUtils = {
|
|
|
2392
2551
|
*/
|
|
2393
2552
|
smoothstep: smoothstep,
|
|
2394
2553
|
/**
|
|
2395
|
-
* A [variation on smoothstep]
|
|
2554
|
+
* A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
2396
2555
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
2397
2556
|
*
|
|
2398
2557
|
* @static
|
|
@@ -2487,7 +2646,7 @@ const MathUtils = {
|
|
|
2487
2646
|
*/
|
|
2488
2647
|
floorPowerOfTwo: floorPowerOfTwo,
|
|
2489
2648
|
/**
|
|
2490
|
-
* Sets the given quaternion from the [Intrinsic Proper Euler Angles]
|
|
2649
|
+
* Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
2491
2650
|
* defined by the given angles and order.
|
|
2492
2651
|
*
|
|
2493
2652
|
* Rotations are applied to the axes in the order specified by order:
|
|
@@ -3432,7 +3591,7 @@ class Quaternion {
|
|
|
3432
3591
|
|
|
3433
3592
|
/**
|
|
3434
3593
|
* Interpolates between two quaternions via SLERP. This implementation assumes the
|
|
3435
|
-
* quaternion data are managed
|
|
3594
|
+
* quaternion data are managed in flat arrays.
|
|
3436
3595
|
*
|
|
3437
3596
|
* @param {Array<number>} dst - The destination array.
|
|
3438
3597
|
* @param {number} dstOffset - An offset into the destination array.
|
|
@@ -3445,65 +3604,78 @@ class Quaternion {
|
|
|
3445
3604
|
*/
|
|
3446
3605
|
static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
|
|
3447
3606
|
|
|
3448
|
-
// fuzz-free, array-based Quaternion SLERP operation
|
|
3449
|
-
|
|
3450
3607
|
let x0 = src0[ srcOffset0 + 0 ],
|
|
3451
3608
|
y0 = src0[ srcOffset0 + 1 ],
|
|
3452
3609
|
z0 = src0[ srcOffset0 + 2 ],
|
|
3453
3610
|
w0 = src0[ srcOffset0 + 3 ];
|
|
3454
3611
|
|
|
3455
|
-
|
|
3612
|
+
let x1 = src1[ srcOffset1 + 0 ],
|
|
3456
3613
|
y1 = src1[ srcOffset1 + 1 ],
|
|
3457
3614
|
z1 = src1[ srcOffset1 + 2 ],
|
|
3458
3615
|
w1 = src1[ srcOffset1 + 3 ];
|
|
3459
3616
|
|
|
3460
|
-
if ( t
|
|
3617
|
+
if ( t <= 0 ) {
|
|
3461
3618
|
|
|
3462
3619
|
dst[ dstOffset + 0 ] = x0;
|
|
3463
3620
|
dst[ dstOffset + 1 ] = y0;
|
|
3464
3621
|
dst[ dstOffset + 2 ] = z0;
|
|
3465
3622
|
dst[ dstOffset + 3 ] = w0;
|
|
3623
|
+
|
|
3466
3624
|
return;
|
|
3467
3625
|
|
|
3468
3626
|
}
|
|
3469
3627
|
|
|
3470
|
-
if ( t
|
|
3628
|
+
if ( t >= 1 ) {
|
|
3471
3629
|
|
|
3472
3630
|
dst[ dstOffset + 0 ] = x1;
|
|
3473
3631
|
dst[ dstOffset + 1 ] = y1;
|
|
3474
3632
|
dst[ dstOffset + 2 ] = z1;
|
|
3475
3633
|
dst[ dstOffset + 3 ] = w1;
|
|
3634
|
+
|
|
3476
3635
|
return;
|
|
3477
3636
|
|
|
3478
3637
|
}
|
|
3479
3638
|
|
|
3480
3639
|
if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {
|
|
3481
3640
|
|
|
3482
|
-
let
|
|
3483
|
-
const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
|
|
3484
|
-
dir = ( cos >= 0 ? 1 : -1 ),
|
|
3485
|
-
sqrSin = 1 - cos * cos;
|
|
3641
|
+
let dot = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1;
|
|
3486
3642
|
|
|
3487
|
-
|
|
3488
|
-
if ( sqrSin > Number.EPSILON ) {
|
|
3643
|
+
if ( dot < 0 ) {
|
|
3489
3644
|
|
|
3490
|
-
|
|
3491
|
-
|
|
3645
|
+
x1 = - x1;
|
|
3646
|
+
y1 = - y1;
|
|
3647
|
+
z1 = - z1;
|
|
3648
|
+
w1 = - w1;
|
|
3492
3649
|
|
|
3493
|
-
|
|
3494
|
-
t = Math.sin( t * len ) / sin;
|
|
3650
|
+
dot = - dot;
|
|
3495
3651
|
|
|
3496
3652
|
}
|
|
3497
3653
|
|
|
3498
|
-
|
|
3654
|
+
let s = 1 - t;
|
|
3499
3655
|
|
|
3500
|
-
|
|
3501
|
-
y0 = y0 * s + y1 * tDir;
|
|
3502
|
-
z0 = z0 * s + z1 * tDir;
|
|
3503
|
-
w0 = w0 * s + w1 * tDir;
|
|
3656
|
+
if ( dot < 0.9995 ) {
|
|
3504
3657
|
|
|
3505
|
-
|
|
3506
|
-
|
|
3658
|
+
// slerp
|
|
3659
|
+
|
|
3660
|
+
const theta = Math.acos( dot );
|
|
3661
|
+
const sin = Math.sin( theta );
|
|
3662
|
+
|
|
3663
|
+
s = Math.sin( s * theta ) / sin;
|
|
3664
|
+
t = Math.sin( t * theta ) / sin;
|
|
3665
|
+
|
|
3666
|
+
x0 = x0 * s + x1 * t;
|
|
3667
|
+
y0 = y0 * s + y1 * t;
|
|
3668
|
+
z0 = z0 * s + z1 * t;
|
|
3669
|
+
w0 = w0 * s + w1 * t;
|
|
3670
|
+
|
|
3671
|
+
} else {
|
|
3672
|
+
|
|
3673
|
+
// for small angles, lerp then normalize
|
|
3674
|
+
|
|
3675
|
+
x0 = x0 * s + x1 * t;
|
|
3676
|
+
y0 = y0 * s + y1 * t;
|
|
3677
|
+
z0 = z0 * s + z1 * t;
|
|
3678
|
+
w0 = w0 * s + w1 * t;
|
|
3507
3679
|
|
|
3508
3680
|
const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );
|
|
3509
3681
|
|
|
@@ -3757,7 +3929,7 @@ class Quaternion {
|
|
|
3757
3929
|
break;
|
|
3758
3930
|
|
|
3759
3931
|
default:
|
|
3760
|
-
|
|
3932
|
+
warn( 'Quaternion: .setFromEuler() encountered an unknown order: ' + order );
|
|
3761
3933
|
|
|
3762
3934
|
}
|
|
3763
3935
|
|
|
@@ -4113,68 +4285,56 @@ class Quaternion {
|
|
|
4113
4285
|
*/
|
|
4114
4286
|
slerp( qb, t ) {
|
|
4115
4287
|
|
|
4116
|
-
if ( t
|
|
4117
|
-
if ( t === 1 ) return this.copy( qb );
|
|
4288
|
+
if ( t <= 0 ) return this;
|
|
4118
4289
|
|
|
4119
|
-
|
|
4290
|
+
if ( t >= 1 ) return this.copy( qb ); // copy calls _onChangeCallback()
|
|
4120
4291
|
|
|
4121
|
-
|
|
4292
|
+
let x = qb._x, y = qb._y, z = qb._z, w = qb._w;
|
|
4122
4293
|
|
|
4123
|
-
let
|
|
4294
|
+
let dot = this.dot( qb );
|
|
4124
4295
|
|
|
4125
|
-
if (
|
|
4296
|
+
if ( dot < 0 ) {
|
|
4126
4297
|
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4298
|
+
x = - x;
|
|
4299
|
+
y = - y;
|
|
4300
|
+
z = - z;
|
|
4301
|
+
w = - w;
|
|
4131
4302
|
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
} else {
|
|
4135
|
-
|
|
4136
|
-
this.copy( qb );
|
|
4303
|
+
dot = - dot;
|
|
4137
4304
|
|
|
4138
4305
|
}
|
|
4139
4306
|
|
|
4140
|
-
|
|
4307
|
+
let s = 1 - t;
|
|
4141
4308
|
|
|
4142
|
-
|
|
4143
|
-
this._x = x;
|
|
4144
|
-
this._y = y;
|
|
4145
|
-
this._z = z;
|
|
4146
|
-
|
|
4147
|
-
return this;
|
|
4309
|
+
if ( dot < 0.9995 ) {
|
|
4148
4310
|
|
|
4149
|
-
|
|
4311
|
+
// slerp
|
|
4150
4312
|
|
|
4151
|
-
|
|
4313
|
+
const theta = Math.acos( dot );
|
|
4314
|
+
const sin = Math.sin( theta );
|
|
4152
4315
|
|
|
4153
|
-
|
|
4316
|
+
s = Math.sin( s * theta ) / sin;
|
|
4317
|
+
t = Math.sin( t * theta ) / sin;
|
|
4154
4318
|
|
|
4155
|
-
|
|
4156
|
-
this.
|
|
4157
|
-
this.
|
|
4158
|
-
this.
|
|
4159
|
-
this._z = s * z + t * this._z;
|
|
4319
|
+
this._x = this._x * s + x * t;
|
|
4320
|
+
this._y = this._y * s + y * t;
|
|
4321
|
+
this._z = this._z * s + z * t;
|
|
4322
|
+
this._w = this._w * s + w * t;
|
|
4160
4323
|
|
|
4161
|
-
this.
|
|
4324
|
+
this._onChangeCallback();
|
|
4162
4325
|
|
|
4163
|
-
|
|
4326
|
+
} else {
|
|
4164
4327
|
|
|
4165
|
-
|
|
4328
|
+
// for small angles, lerp then normalize
|
|
4166
4329
|
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4330
|
+
this._x = this._x * s + x * t;
|
|
4331
|
+
this._y = this._y * s + y * t;
|
|
4332
|
+
this._z = this._z * s + z * t;
|
|
4333
|
+
this._w = this._w * s + w * t;
|
|
4171
4334
|
|
|
4172
|
-
|
|
4173
|
-
this._x = ( x * ratioA + this._x * ratioB );
|
|
4174
|
-
this._y = ( y * ratioA + this._y * ratioB );
|
|
4175
|
-
this._z = ( z * ratioA + this._z * ratioB );
|
|
4335
|
+
this.normalize(); // normalize calls _onChangeCallback()
|
|
4176
4336
|
|
|
4177
|
-
|
|
4337
|
+
}
|
|
4178
4338
|
|
|
4179
4339
|
return this;
|
|
4180
4340
|
|
|
@@ -5589,7 +5749,7 @@ const _quaternion$4 = /*@__PURE__*/ new Quaternion();
|
|
|
5589
5749
|
* A Note on Row-Major and Column-Major Ordering:
|
|
5590
5750
|
*
|
|
5591
5751
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
5592
|
-
* [row-major]
|
|
5752
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
5593
5753
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
5594
5754
|
* This means that calling:
|
|
5595
5755
|
* ```js
|
|
@@ -5863,7 +6023,7 @@ class Matrix3 {
|
|
|
5863
6023
|
}
|
|
5864
6024
|
|
|
5865
6025
|
/**
|
|
5866
|
-
* Inverts this matrix, using the [analytic method]
|
|
6026
|
+
* Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
5867
6027
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
5868
6028
|
* a zero matrix instead.
|
|
5869
6029
|
*
|
|
@@ -6195,93 +6355,6 @@ class Matrix3 {
|
|
|
6195
6355
|
|
|
6196
6356
|
const _m3 = /*@__PURE__*/ new Matrix3();
|
|
6197
6357
|
|
|
6198
|
-
function arrayNeedsUint32( array ) {
|
|
6199
|
-
|
|
6200
|
-
// assumes larger values usually on last
|
|
6201
|
-
|
|
6202
|
-
for ( let i = array.length - 1; i >= 0; -- i ) {
|
|
6203
|
-
|
|
6204
|
-
if ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
|
|
6205
|
-
|
|
6206
|
-
}
|
|
6207
|
-
|
|
6208
|
-
return false;
|
|
6209
|
-
|
|
6210
|
-
}
|
|
6211
|
-
|
|
6212
|
-
const TYPED_ARRAYS = {
|
|
6213
|
-
Int8Array: Int8Array,
|
|
6214
|
-
Uint8Array: Uint8Array,
|
|
6215
|
-
Uint8ClampedArray: Uint8ClampedArray,
|
|
6216
|
-
Int16Array: Int16Array,
|
|
6217
|
-
Uint16Array: Uint16Array,
|
|
6218
|
-
Int32Array: Int32Array,
|
|
6219
|
-
Uint32Array: Uint32Array,
|
|
6220
|
-
Float32Array: Float32Array,
|
|
6221
|
-
Float64Array: Float64Array
|
|
6222
|
-
};
|
|
6223
|
-
|
|
6224
|
-
function getTypedArray( type, buffer ) {
|
|
6225
|
-
|
|
6226
|
-
return new TYPED_ARRAYS[ type ]( buffer );
|
|
6227
|
-
|
|
6228
|
-
}
|
|
6229
|
-
|
|
6230
|
-
function createElementNS( name ) {
|
|
6231
|
-
|
|
6232
|
-
return document.createElementNS( 'http://www.w3.org/1999/xhtml', name );
|
|
6233
|
-
|
|
6234
|
-
}
|
|
6235
|
-
|
|
6236
|
-
function createCanvasElement() {
|
|
6237
|
-
|
|
6238
|
-
const canvas = createElementNS( 'canvas' );
|
|
6239
|
-
canvas.style.display = 'block';
|
|
6240
|
-
return canvas;
|
|
6241
|
-
|
|
6242
|
-
}
|
|
6243
|
-
|
|
6244
|
-
const _cache = {};
|
|
6245
|
-
|
|
6246
|
-
function warnOnce( message ) {
|
|
6247
|
-
|
|
6248
|
-
if ( message in _cache ) return;
|
|
6249
|
-
|
|
6250
|
-
_cache[ message ] = true;
|
|
6251
|
-
|
|
6252
|
-
console.warn( message );
|
|
6253
|
-
|
|
6254
|
-
}
|
|
6255
|
-
|
|
6256
|
-
function probeAsync( gl, sync, interval ) {
|
|
6257
|
-
|
|
6258
|
-
return new Promise( function ( resolve, reject ) {
|
|
6259
|
-
|
|
6260
|
-
function probe() {
|
|
6261
|
-
|
|
6262
|
-
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
6263
|
-
|
|
6264
|
-
case gl.WAIT_FAILED:
|
|
6265
|
-
reject();
|
|
6266
|
-
break;
|
|
6267
|
-
|
|
6268
|
-
case gl.TIMEOUT_EXPIRED:
|
|
6269
|
-
setTimeout( probe, interval );
|
|
6270
|
-
break;
|
|
6271
|
-
|
|
6272
|
-
default:
|
|
6273
|
-
resolve();
|
|
6274
|
-
|
|
6275
|
-
}
|
|
6276
|
-
|
|
6277
|
-
}
|
|
6278
|
-
|
|
6279
|
-
setTimeout( probe, interval );
|
|
6280
|
-
|
|
6281
|
-
} );
|
|
6282
|
-
|
|
6283
|
-
}
|
|
6284
|
-
|
|
6285
6358
|
const LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(
|
|
6286
6359
|
0.4123908, 0.3575843, 0.1804808,
|
|
6287
6360
|
0.2126390, 0.7151687, 0.0721923,
|
|
@@ -6314,7 +6387,7 @@ function createColorManagement() {
|
|
|
6314
6387
|
* - luminanceCoefficients: RGB luminance coefficients
|
|
6315
6388
|
*
|
|
6316
6389
|
* Optional:
|
|
6317
|
-
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace }
|
|
6390
|
+
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }
|
|
6318
6391
|
* - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }
|
|
6319
6392
|
*
|
|
6320
6393
|
* Reference:
|
|
@@ -6383,6 +6456,12 @@ function createColorManagement() {
|
|
|
6383
6456
|
|
|
6384
6457
|
},
|
|
6385
6458
|
|
|
6459
|
+
getToneMappingMode: function ( colorSpace ) {
|
|
6460
|
+
|
|
6461
|
+
return this.spaces[ colorSpace ].outputColorSpaceConfig.toneMappingMode || 'standard';
|
|
6462
|
+
|
|
6463
|
+
},
|
|
6464
|
+
|
|
6386
6465
|
getLuminanceCoefficients: function ( target, colorSpace = this.workingColorSpace ) {
|
|
6387
6466
|
|
|
6388
6467
|
return target.fromArray( this.spaces[ colorSpace ].luminanceCoefficients );
|
|
@@ -6421,7 +6500,7 @@ function createColorManagement() {
|
|
|
6421
6500
|
|
|
6422
6501
|
fromWorkingColorSpace: function ( color, targetColorSpace ) {
|
|
6423
6502
|
|
|
6424
|
-
warnOnce( '
|
|
6503
|
+
warnOnce( 'ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().' ); // @deprecated, r177
|
|
6425
6504
|
|
|
6426
6505
|
return ColorManagement.workingToColorSpace( color, targetColorSpace );
|
|
6427
6506
|
|
|
@@ -6429,7 +6508,7 @@ function createColorManagement() {
|
|
|
6429
6508
|
|
|
6430
6509
|
toWorkingColorSpace: function ( color, sourceColorSpace ) {
|
|
6431
6510
|
|
|
6432
|
-
warnOnce( '
|
|
6511
|
+
warnOnce( 'ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().' ); // @deprecated, r177
|
|
6433
6512
|
|
|
6434
6513
|
return ColorManagement.colorSpaceToWorking( color, sourceColorSpace );
|
|
6435
6514
|
|
|
@@ -6612,7 +6691,7 @@ class ImageUtils {
|
|
|
6612
6691
|
|
|
6613
6692
|
} else {
|
|
6614
6693
|
|
|
6615
|
-
|
|
6694
|
+
warn( 'ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );
|
|
6616
6695
|
return image;
|
|
6617
6696
|
|
|
6618
6697
|
}
|
|
@@ -6703,7 +6782,7 @@ class Source {
|
|
|
6703
6782
|
|
|
6704
6783
|
const data = this.data;
|
|
6705
6784
|
|
|
6706
|
-
if ( data instanceof HTMLVideoElement ) {
|
|
6785
|
+
if ( ( typeof HTMLVideoElement !== 'undefined' ) && ( data instanceof HTMLVideoElement ) ) {
|
|
6707
6786
|
|
|
6708
6787
|
target.set( data.videoWidth, data.videoHeight, 0 );
|
|
6709
6788
|
|
|
@@ -6837,7 +6916,7 @@ function serializeImage( image ) {
|
|
|
6837
6916
|
|
|
6838
6917
|
} else {
|
|
6839
6918
|
|
|
6840
|
-
|
|
6919
|
+
warn( 'Texture: Unable to serialize Texture.' );
|
|
6841
6920
|
return {};
|
|
6842
6921
|
|
|
6843
6922
|
}
|
|
@@ -7351,7 +7430,7 @@ class Texture extends EventDispatcher {
|
|
|
7351
7430
|
|
|
7352
7431
|
if ( newValue === undefined ) {
|
|
7353
7432
|
|
|
7354
|
-
|
|
7433
|
+
warn( `Texture.setValues(): parameter '${ key }' has value of undefined.` );
|
|
7355
7434
|
continue;
|
|
7356
7435
|
|
|
7357
7436
|
}
|
|
@@ -7360,7 +7439,7 @@ class Texture extends EventDispatcher {
|
|
|
7360
7439
|
|
|
7361
7440
|
if ( currentValue === undefined ) {
|
|
7362
7441
|
|
|
7363
|
-
|
|
7442
|
+
warn( `Texture.setValues(): property '${ key }' does not exist.` );
|
|
7364
7443
|
continue;
|
|
7365
7444
|
|
|
7366
7445
|
}
|
|
@@ -8977,7 +9056,16 @@ class RenderTarget extends EventDispatcher {
|
|
|
8977
9056
|
this.textures[ i ].image.width = width;
|
|
8978
9057
|
this.textures[ i ].image.height = height;
|
|
8979
9058
|
this.textures[ i ].image.depth = depth;
|
|
8980
|
-
|
|
9059
|
+
|
|
9060
|
+
if ( this.textures[ i ].isData3DTexture !== true ) { // Fix for #31693
|
|
9061
|
+
|
|
9062
|
+
// TODO: Reconsider setting isArrayTexture flag here and in the ctor of Texture.
|
|
9063
|
+
// Maybe a method `isArrayTexture()` or just a getter could replace a flag since
|
|
9064
|
+
// both are evaluated on each call?
|
|
9065
|
+
|
|
9066
|
+
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
|
|
9067
|
+
|
|
9068
|
+
}
|
|
8981
9069
|
|
|
8982
9070
|
}
|
|
8983
9071
|
|
|
@@ -11294,7 +11382,7 @@ class Ray {
|
|
|
11294
11382
|
* Represents a 4x4 matrix.
|
|
11295
11383
|
*
|
|
11296
11384
|
* The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
|
|
11297
|
-
* For an introduction to transformation matrices as used in WebGL, check out [this tutorial]
|
|
11385
|
+
* For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices)
|
|
11298
11386
|
*
|
|
11299
11387
|
* This allows a 3D vector representing a point in 3D space to undergo
|
|
11300
11388
|
* transformations such as translation, rotation, shear, scale, reflection,
|
|
@@ -11304,7 +11392,7 @@ class Ray {
|
|
|
11304
11392
|
* A Note on Row-Major and Column-Major Ordering:
|
|
11305
11393
|
*
|
|
11306
11394
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
11307
|
-
* [row-major]
|
|
11395
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
11308
11396
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
11309
11397
|
* This means that calling:
|
|
11310
11398
|
* ```js
|
|
@@ -11598,7 +11686,7 @@ class Matrix4 {
|
|
|
11598
11686
|
* Sets the rotation component (the upper left 3x3 matrix) of this matrix to
|
|
11599
11687
|
* the rotation specified by the given Euler angles. The rest of
|
|
11600
11688
|
* the matrix is set to the identity. Depending on the {@link Euler#order},
|
|
11601
|
-
* there are six possible outcomes. See [this page]
|
|
11689
|
+
* there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)
|
|
11602
11690
|
* for a complete list.
|
|
11603
11691
|
*
|
|
11604
11692
|
* @param {Euler} euler - The Euler angles.
|
|
@@ -11728,7 +11816,7 @@ class Matrix4 {
|
|
|
11728
11816
|
|
|
11729
11817
|
/**
|
|
11730
11818
|
* Sets the rotation component of this matrix to the rotation specified by
|
|
11731
|
-
* the given Quaternion as outlined [here]
|
|
11819
|
+
* the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)
|
|
11732
11820
|
* The rest of the matrix is set to the identity.
|
|
11733
11821
|
*
|
|
11734
11822
|
* @param {Quaternion} q - The Quaternion.
|
|
@@ -11890,7 +11978,7 @@ class Matrix4 {
|
|
|
11890
11978
|
/**
|
|
11891
11979
|
* Computes and returns the determinant of this matrix.
|
|
11892
11980
|
*
|
|
11893
|
-
* Based on the method outlined [here]
|
|
11981
|
+
* Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
|
|
11894
11982
|
*
|
|
11895
11983
|
* @return {number} The determinant.
|
|
11896
11984
|
*/
|
|
@@ -11997,7 +12085,7 @@ class Matrix4 {
|
|
|
11997
12085
|
}
|
|
11998
12086
|
|
|
11999
12087
|
/**
|
|
12000
|
-
* Inverts this matrix, using the [analytic method]
|
|
12088
|
+
* Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
12001
12089
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
12002
12090
|
* a zero matrix instead.
|
|
12003
12091
|
*
|
|
@@ -12200,7 +12288,7 @@ class Matrix4 {
|
|
|
12200
12288
|
* the given angle.
|
|
12201
12289
|
*
|
|
12202
12290
|
* This is a somewhat controversial but mathematically sound alternative to
|
|
12203
|
-
* rotating via Quaternions. See the discussion [here]
|
|
12291
|
+
* rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
|
|
12204
12292
|
*
|
|
12205
12293
|
* @param {Vector3} axis - The normalized rotation axis.
|
|
12206
12294
|
* @param {number} angle - The rotation in radians.
|
|
@@ -12889,7 +12977,7 @@ class Euler {
|
|
|
12889
12977
|
|
|
12890
12978
|
default:
|
|
12891
12979
|
|
|
12892
|
-
|
|
12980
|
+
warn( 'Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );
|
|
12893
12981
|
|
|
12894
12982
|
}
|
|
12895
12983
|
|
|
@@ -13875,7 +13963,7 @@ class Object3D extends EventDispatcher {
|
|
|
13875
13963
|
|
|
13876
13964
|
if ( object === this ) {
|
|
13877
13965
|
|
|
13878
|
-
|
|
13966
|
+
error( 'Object3D.add: object can\'t be added as a child of itself.', object );
|
|
13879
13967
|
return this;
|
|
13880
13968
|
|
|
13881
13969
|
}
|
|
@@ -13894,7 +13982,7 @@ class Object3D extends EventDispatcher {
|
|
|
13894
13982
|
|
|
13895
13983
|
} else {
|
|
13896
13984
|
|
|
13897
|
-
|
|
13985
|
+
error( 'Object3D.add: object not an instance of THREE.Object3D.', object );
|
|
13898
13986
|
|
|
13899
13987
|
}
|
|
13900
13988
|
|
|
@@ -15565,7 +15653,7 @@ class Color {
|
|
|
15565
15653
|
/**
|
|
15566
15654
|
* Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,
|
|
15567
15655
|
* `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or
|
|
15568
|
-
* any [X11 color name]
|
|
15656
|
+
* any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) -
|
|
15569
15657
|
* all 140 color names are supported).
|
|
15570
15658
|
*
|
|
15571
15659
|
* @param {string} style - Color as a CSS-style string.
|
|
@@ -15580,7 +15668,7 @@ class Color {
|
|
|
15580
15668
|
|
|
15581
15669
|
if ( parseFloat( string ) < 1 ) {
|
|
15582
15670
|
|
|
15583
|
-
|
|
15671
|
+
warn( 'Color: Alpha component of ' + style + ' will be ignored.' );
|
|
15584
15672
|
|
|
15585
15673
|
}
|
|
15586
15674
|
|
|
@@ -15656,7 +15744,7 @@ class Color {
|
|
|
15656
15744
|
|
|
15657
15745
|
default:
|
|
15658
15746
|
|
|
15659
|
-
|
|
15747
|
+
warn( 'Color: Unknown color model ' + style );
|
|
15660
15748
|
|
|
15661
15749
|
}
|
|
15662
15750
|
|
|
@@ -15684,7 +15772,7 @@ class Color {
|
|
|
15684
15772
|
|
|
15685
15773
|
} else {
|
|
15686
15774
|
|
|
15687
|
-
|
|
15775
|
+
warn( 'Color: Invalid hex color ' + style );
|
|
15688
15776
|
|
|
15689
15777
|
}
|
|
15690
15778
|
|
|
@@ -15724,7 +15812,7 @@ class Color {
|
|
|
15724
15812
|
} else {
|
|
15725
15813
|
|
|
15726
15814
|
// unknown color
|
|
15727
|
-
|
|
15815
|
+
warn( 'Color: Unknown color ' + style );
|
|
15728
15816
|
|
|
15729
15817
|
}
|
|
15730
15818
|
|
|
@@ -16772,7 +16860,7 @@ class Material extends EventDispatcher {
|
|
|
16772
16860
|
*
|
|
16773
16861
|
* This method can only be used when rendering with {@link WebGLRenderer}. The
|
|
16774
16862
|
* recommended approach when customizing materials is to use `WebGPURenderer` with the new
|
|
16775
|
-
* Node Material system and [TSL]
|
|
16863
|
+
* Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).
|
|
16776
16864
|
*
|
|
16777
16865
|
* @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.
|
|
16778
16866
|
* @param {WebGLRenderer} renderer - A reference to the renderer.
|
|
@@ -16811,7 +16899,7 @@ class Material extends EventDispatcher {
|
|
|
16811
16899
|
|
|
16812
16900
|
if ( newValue === undefined ) {
|
|
16813
16901
|
|
|
16814
|
-
|
|
16902
|
+
warn( `Material: parameter '${ key }' has value of undefined.` );
|
|
16815
16903
|
continue;
|
|
16816
16904
|
|
|
16817
16905
|
}
|
|
@@ -16820,7 +16908,7 @@ class Material extends EventDispatcher {
|
|
|
16820
16908
|
|
|
16821
16909
|
if ( currentValue === undefined ) {
|
|
16822
16910
|
|
|
16823
|
-
|
|
16911
|
+
warn( `Material: '${ key }' is not a property of THREE.${ this.type }.` );
|
|
16824
16912
|
continue;
|
|
16825
16913
|
|
|
16826
16914
|
}
|
|
@@ -16914,6 +17002,18 @@ class Material extends EventDispatcher {
|
|
|
16914
17002
|
|
|
16915
17003
|
}
|
|
16916
17004
|
|
|
17005
|
+
if ( this.sheenColorMap && this.sheenColorMap.isTexture ) {
|
|
17006
|
+
|
|
17007
|
+
data.sheenColorMap = this.sheenColorMap.toJSON( meta ).uuid;
|
|
17008
|
+
|
|
17009
|
+
}
|
|
17010
|
+
|
|
17011
|
+
if ( this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture ) {
|
|
17012
|
+
|
|
17013
|
+
data.sheenRoughnessMap = this.sheenRoughnessMap.toJSON( meta ).uuid;
|
|
17014
|
+
|
|
17015
|
+
}
|
|
17016
|
+
|
|
16917
17017
|
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
16918
17018
|
|
|
16919
17019
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
@@ -17255,6 +17355,7 @@ class Material extends EventDispatcher {
|
|
|
17255
17355
|
* This material is not affected by lights.
|
|
17256
17356
|
*
|
|
17257
17357
|
* @augments Material
|
|
17358
|
+
* @demo scenes/material-browser.html#MeshBasicMaterial
|
|
17258
17359
|
*/
|
|
17259
17360
|
class MeshBasicMaterial extends Material {
|
|
17260
17361
|
|
|
@@ -17640,7 +17741,7 @@ function _generateTables() {
|
|
|
17640
17741
|
*/
|
|
17641
17742
|
function toHalfFloat( val ) {
|
|
17642
17743
|
|
|
17643
|
-
if ( Math.abs( val ) > 65504 )
|
|
17744
|
+
if ( Math.abs( val ) > 65504 ) warn( 'DataUtils.toHalfFloat(): Value out of range.' );
|
|
17644
17745
|
|
|
17645
17746
|
val = clamp( val, -65504, 65504 );
|
|
17646
17747
|
|
|
@@ -18871,7 +18972,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18871
18972
|
/**
|
|
18872
18973
|
* Bounding box for the geometry which can be calculated with `computeBoundingBox()`.
|
|
18873
18974
|
*
|
|
18874
|
-
* @type {Box3}
|
|
18975
|
+
* @type {?Box3}
|
|
18875
18976
|
* @default null
|
|
18876
18977
|
*/
|
|
18877
18978
|
this.boundingBox = null;
|
|
@@ -18879,7 +18980,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18879
18980
|
/**
|
|
18880
18981
|
* Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`.
|
|
18881
18982
|
*
|
|
18882
|
-
* @type {Sphere}
|
|
18983
|
+
* @type {?Sphere}
|
|
18883
18984
|
* @default null
|
|
18884
18985
|
*/
|
|
18885
18986
|
this.boundingSphere = null;
|
|
@@ -19311,7 +19412,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19311
19412
|
|
|
19312
19413
|
if ( points.length > positionAttribute.count ) {
|
|
19313
19414
|
|
|
19314
|
-
|
|
19415
|
+
warn( 'BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.' );
|
|
19315
19416
|
|
|
19316
19417
|
}
|
|
19317
19418
|
|
|
@@ -19341,7 +19442,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19341
19442
|
|
|
19342
19443
|
if ( position && position.isGLBufferAttribute ) {
|
|
19343
19444
|
|
|
19344
|
-
|
|
19445
|
+
error( 'BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
|
|
19345
19446
|
|
|
19346
19447
|
this.boundingBox.set(
|
|
19347
19448
|
new Vector3( - Infinity, - Infinity, - Infinity ),
|
|
@@ -19392,7 +19493,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19392
19493
|
|
|
19393
19494
|
if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
|
|
19394
19495
|
|
|
19395
|
-
|
|
19496
|
+
error( 'BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
|
|
19396
19497
|
|
|
19397
19498
|
}
|
|
19398
19499
|
|
|
@@ -19416,7 +19517,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19416
19517
|
|
|
19417
19518
|
if ( position && position.isGLBufferAttribute ) {
|
|
19418
19519
|
|
|
19419
|
-
|
|
19520
|
+
error( 'BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
|
|
19420
19521
|
|
|
19421
19522
|
this.boundingSphere.set( new Vector3(), Infinity );
|
|
19422
19523
|
|
|
@@ -19507,7 +19608,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19507
19608
|
|
|
19508
19609
|
if ( isNaN( this.boundingSphere.radius ) ) {
|
|
19509
19610
|
|
|
19510
|
-
|
|
19611
|
+
error( 'BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
|
|
19511
19612
|
|
|
19512
19613
|
}
|
|
19513
19614
|
|
|
@@ -19535,7 +19636,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19535
19636
|
attributes.normal === undefined ||
|
|
19536
19637
|
attributes.uv === undefined ) {
|
|
19537
19638
|
|
|
19538
|
-
|
|
19639
|
+
error( 'BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );
|
|
19539
19640
|
return;
|
|
19540
19641
|
|
|
19541
19642
|
}
|
|
@@ -19845,7 +19946,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19845
19946
|
|
|
19846
19947
|
if ( this.index === null ) {
|
|
19847
19948
|
|
|
19848
|
-
|
|
19949
|
+
warn( 'BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );
|
|
19849
19950
|
return this;
|
|
19850
19951
|
|
|
19851
19952
|
}
|
|
@@ -20655,6 +20756,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
20655
20756
|
* ```
|
|
20656
20757
|
*
|
|
20657
20758
|
* @augments BufferGeometry
|
|
20759
|
+
* @demo scenes/geometry-browser.html#BoxGeometry
|
|
20658
20760
|
*/
|
|
20659
20761
|
class BoxGeometry extends BufferGeometry {
|
|
20660
20762
|
|
|
@@ -20855,8 +20957,20 @@ class BoxGeometry extends BufferGeometry {
|
|
|
20855
20957
|
|
|
20856
20958
|
}
|
|
20857
20959
|
|
|
20858
|
-
|
|
20960
|
+
/**
|
|
20961
|
+
* Provides utility functions for managing uniforms.
|
|
20962
|
+
*
|
|
20963
|
+
* @module UniformsUtils
|
|
20964
|
+
*/
|
|
20859
20965
|
|
|
20966
|
+
/**
|
|
20967
|
+
* Clones the given uniform definitions by performing a deep-copy. That means
|
|
20968
|
+
* if the value of a uniform refers to an object like a Vector3 or Texture,
|
|
20969
|
+
* the cloned uniform will refer to a new object reference.
|
|
20970
|
+
*
|
|
20971
|
+
* @param {Object} src - An object representing uniform definitions.
|
|
20972
|
+
* @return {Object} The cloned uniforms.
|
|
20973
|
+
*/
|
|
20860
20974
|
function cloneUniforms( src ) {
|
|
20861
20975
|
|
|
20862
20976
|
const dst = {};
|
|
@@ -20876,7 +20990,7 @@ function cloneUniforms( src ) {
|
|
|
20876
20990
|
|
|
20877
20991
|
if ( property.isRenderTargetTexture ) {
|
|
20878
20992
|
|
|
20879
|
-
|
|
20993
|
+
warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );
|
|
20880
20994
|
dst[ u ][ p ] = null;
|
|
20881
20995
|
|
|
20882
20996
|
} else {
|
|
@@ -20903,6 +21017,14 @@ function cloneUniforms( src ) {
|
|
|
20903
21017
|
|
|
20904
21018
|
}
|
|
20905
21019
|
|
|
21020
|
+
/**
|
|
21021
|
+
* Merges the given uniform definitions into a single object. Since the
|
|
21022
|
+
* method internally uses cloneUniforms(), it performs a deep-copy when
|
|
21023
|
+
* producing the merged uniform definitions.
|
|
21024
|
+
*
|
|
21025
|
+
* @param {Array} uniforms - An array of objects containing uniform definitions.
|
|
21026
|
+
* @return {Object} The merged uniforms.
|
|
21027
|
+
*/
|
|
20906
21028
|
function mergeUniforms( uniforms ) {
|
|
20907
21029
|
|
|
20908
21030
|
const merged = {};
|
|
@@ -20980,7 +21102,7 @@ var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0
|
|
|
20980
21102
|
* - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end`
|
|
20981
21103
|
* in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has
|
|
20982
21104
|
* to be placed right above the loop. The loop formatting has to correspond to a defined standard.
|
|
20983
|
-
* - The loop has to be [normalized]
|
|
21105
|
+
* - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop).
|
|
20984
21106
|
* - The loop variable has to be *i*.
|
|
20985
21107
|
* - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly
|
|
20986
21108
|
* value of *i* for the given iteration and can be used in preprocessor
|
|
@@ -21186,7 +21308,7 @@ class ShaderMaterial extends Material {
|
|
|
21186
21308
|
};
|
|
21187
21309
|
|
|
21188
21310
|
/**
|
|
21189
|
-
* If set, this calls [gl.bindAttribLocation]
|
|
21311
|
+
* If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation)
|
|
21190
21312
|
* to bind a generic vertex index to an attribute variable.
|
|
21191
21313
|
*
|
|
21192
21314
|
* @type {string|undefined}
|
|
@@ -21473,7 +21595,7 @@ const _minTarget = /*@__PURE__*/ new Vector2();
|
|
|
21473
21595
|
const _maxTarget = /*@__PURE__*/ new Vector2();
|
|
21474
21596
|
|
|
21475
21597
|
/**
|
|
21476
|
-
* Camera that uses [perspective projection]
|
|
21598
|
+
* Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)).
|
|
21477
21599
|
*
|
|
21478
21600
|
* This projection mode is designed to mimic the way the human eye sees. It
|
|
21479
21601
|
* is the most common projection mode used for rendering a 3D scene.
|
|
@@ -23156,7 +23278,7 @@ class Scene extends Object3D {
|
|
|
23156
23278
|
* "Interleaved" means that multiple attributes, possibly of different types,
|
|
23157
23279
|
* (e.g., position, normal, uv, color) are packed into a single array buffer.
|
|
23158
23280
|
*
|
|
23159
|
-
* An introduction into interleaved arrays can be found here: [Interleaved array basics]
|
|
23281
|
+
* An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html)
|
|
23160
23282
|
*/
|
|
23161
23283
|
class InterleavedBuffer {
|
|
23162
23284
|
|
|
@@ -23876,7 +23998,7 @@ class InterleavedBufferAttribute {
|
|
|
23876
23998
|
|
|
23877
23999
|
if ( data === undefined ) {
|
|
23878
24000
|
|
|
23879
|
-
|
|
24001
|
+
log( 'InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );
|
|
23880
24002
|
|
|
23881
24003
|
const array = [];
|
|
23882
24004
|
|
|
@@ -23926,7 +24048,7 @@ class InterleavedBufferAttribute {
|
|
|
23926
24048
|
|
|
23927
24049
|
if ( data === undefined ) {
|
|
23928
24050
|
|
|
23929
|
-
|
|
24051
|
+
log( 'InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );
|
|
23930
24052
|
|
|
23931
24053
|
const array = [];
|
|
23932
24054
|
|
|
@@ -24153,7 +24275,7 @@ class Sprite extends Object3D {
|
|
|
24153
24275
|
/**
|
|
24154
24276
|
* Constructs a new sprite.
|
|
24155
24277
|
*
|
|
24156
|
-
* @param {SpriteMaterial} [material] - The sprite material.
|
|
24278
|
+
* @param {(SpriteMaterial|SpriteNodeMaterial)} [material] - The sprite material.
|
|
24157
24279
|
*/
|
|
24158
24280
|
constructor( material = new SpriteMaterial() ) {
|
|
24159
24281
|
|
|
@@ -24199,7 +24321,7 @@ class Sprite extends Object3D {
|
|
|
24199
24321
|
/**
|
|
24200
24322
|
* The sprite material.
|
|
24201
24323
|
*
|
|
24202
|
-
* @type {SpriteMaterial}
|
|
24324
|
+
* @type {(SpriteMaterial|SpriteNodeMaterial)}
|
|
24203
24325
|
*/
|
|
24204
24326
|
this.material = material;
|
|
24205
24327
|
|
|
@@ -24234,7 +24356,7 @@ class Sprite extends Object3D {
|
|
|
24234
24356
|
|
|
24235
24357
|
if ( raycaster.camera === null ) {
|
|
24236
24358
|
|
|
24237
|
-
|
|
24359
|
+
error( 'Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.' );
|
|
24238
24360
|
|
|
24239
24361
|
}
|
|
24240
24362
|
|
|
@@ -24528,7 +24650,7 @@ class LOD extends Object3D {
|
|
|
24528
24650
|
* the given distance.
|
|
24529
24651
|
*
|
|
24530
24652
|
* @param {number} distance - The LOD distance.
|
|
24531
|
-
* @return {Object3D
|
|
24653
|
+
* @return {?Object3D} The found 3D object. `null` if no 3D object has been found.
|
|
24532
24654
|
*/
|
|
24533
24655
|
getObjectForDistance( distance ) {
|
|
24534
24656
|
|
|
@@ -24695,6 +24817,7 @@ const _ray$2 = /*@__PURE__*/ new Ray();
|
|
|
24695
24817
|
* or {@link FBXLoader } import respective models.
|
|
24696
24818
|
*
|
|
24697
24819
|
* @augments Mesh
|
|
24820
|
+
* @demo scenes/bones-browser.html
|
|
24698
24821
|
*/
|
|
24699
24822
|
class SkinnedMesh extends Mesh {
|
|
24700
24823
|
|
|
@@ -24962,7 +25085,7 @@ class SkinnedMesh extends Mesh {
|
|
|
24962
25085
|
|
|
24963
25086
|
} else {
|
|
24964
25087
|
|
|
24965
|
-
|
|
25088
|
+
warn( 'SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );
|
|
24966
25089
|
|
|
24967
25090
|
}
|
|
24968
25091
|
|
|
@@ -25231,7 +25354,7 @@ class Skeleton {
|
|
|
25231
25354
|
|
|
25232
25355
|
if ( bones.length !== boneInverses.length ) {
|
|
25233
25356
|
|
|
25234
|
-
|
|
25357
|
+
warn( 'Skeleton: Number of inverse bone matrices does not match amount of bones.' );
|
|
25235
25358
|
|
|
25236
25359
|
this.boneInverses = [];
|
|
25237
25360
|
|
|
@@ -25449,7 +25572,7 @@ class Skeleton {
|
|
|
25449
25572
|
|
|
25450
25573
|
if ( bone === undefined ) {
|
|
25451
25574
|
|
|
25452
|
-
|
|
25575
|
+
warn( 'Skeleton: No bone found with UUID:', uuid );
|
|
25453
25576
|
bone = new Bone();
|
|
25454
25577
|
|
|
25455
25578
|
}
|
|
@@ -25961,7 +26084,7 @@ const _normalMatrix = /*@__PURE__*/ new Matrix3();
|
|
|
25961
26084
|
|
|
25962
26085
|
/**
|
|
25963
26086
|
* A two dimensional surface that extends infinitely in 3D space, represented
|
|
25964
|
-
* in [Hessian normal form]
|
|
26087
|
+
* in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)
|
|
25965
26088
|
* by a unit length normal vector and a constant.
|
|
25966
26089
|
*/
|
|
25967
26090
|
class Plane {
|
|
@@ -27807,7 +27930,7 @@ class BatchedMesh extends Mesh {
|
|
|
27807
27930
|
*
|
|
27808
27931
|
* @param {number} geometryId - The ID of the geometry to return the bounding box for.
|
|
27809
27932
|
* @param {Box3} target - The target object that is used to store the method's result.
|
|
27810
|
-
* @return {Box3
|
|
27933
|
+
* @return {?Box3} The geometry's bounding box. Returns `null` if no geometry has been found for the given ID.
|
|
27811
27934
|
*/
|
|
27812
27935
|
getBoundingBoxAt( geometryId, target ) {
|
|
27813
27936
|
|
|
@@ -27852,7 +27975,7 @@ class BatchedMesh extends Mesh {
|
|
|
27852
27975
|
*
|
|
27853
27976
|
* @param {number} geometryId - The ID of the geometry to return the bounding sphere for.
|
|
27854
27977
|
* @param {Sphere} target - The target object that is used to store the method's result.
|
|
27855
|
-
* @return {Sphere
|
|
27978
|
+
* @return {?Sphere} The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID.
|
|
27856
27979
|
*/
|
|
27857
27980
|
getBoundingSphereAt( geometryId, target ) {
|
|
27858
27981
|
|
|
@@ -28740,7 +28863,7 @@ class Line extends Object3D {
|
|
|
28740
28863
|
|
|
28741
28864
|
} else {
|
|
28742
28865
|
|
|
28743
|
-
|
|
28866
|
+
warn( 'Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
|
|
28744
28867
|
|
|
28745
28868
|
}
|
|
28746
28869
|
|
|
@@ -28981,7 +29104,7 @@ class LineSegments extends Line {
|
|
|
28981
29104
|
|
|
28982
29105
|
} else {
|
|
28983
29106
|
|
|
28984
|
-
|
|
29107
|
+
warn( 'LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
|
|
28985
29108
|
|
|
28986
29109
|
}
|
|
28987
29110
|
|
|
@@ -29112,7 +29235,7 @@ class PointsMaterial extends Material {
|
|
|
29112
29235
|
/**
|
|
29113
29236
|
* Defines the size of the points in pixels.
|
|
29114
29237
|
*
|
|
29115
|
-
* Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE]
|
|
29238
|
+
* Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete).
|
|
29116
29239
|
*
|
|
29117
29240
|
* @type {number}
|
|
29118
29241
|
* @default 1
|
|
@@ -29486,15 +29609,14 @@ class VideoTexture extends Texture {
|
|
|
29486
29609
|
|
|
29487
29610
|
}
|
|
29488
29611
|
|
|
29489
|
-
/**
|
|
29490
|
-
* @override
|
|
29491
|
-
*/
|
|
29492
29612
|
dispose() {
|
|
29493
29613
|
|
|
29494
29614
|
if ( this._requestVideoFrameCallbackId !== 0 ) {
|
|
29495
29615
|
|
|
29496
29616
|
this.source.data.cancelVideoFrameCallback( this._requestVideoFrameCallbackId );
|
|
29497
29617
|
|
|
29618
|
+
this._requestVideoFrameCallbackId = 0;
|
|
29619
|
+
|
|
29498
29620
|
}
|
|
29499
29621
|
|
|
29500
29622
|
super.dispose();
|
|
@@ -30006,6 +30128,59 @@ class DepthTexture extends Texture {
|
|
|
30006
30128
|
|
|
30007
30129
|
}
|
|
30008
30130
|
|
|
30131
|
+
/**
|
|
30132
|
+
* Represents a texture created externally with the same renderer context.
|
|
30133
|
+
*
|
|
30134
|
+
* This may be a texture from a protected media stream, device camera feed,
|
|
30135
|
+
* or other data feeds like a depth sensor.
|
|
30136
|
+
*
|
|
30137
|
+
* Note that this class is only supported in {@link WebGLRenderer}, and in
|
|
30138
|
+
* the {@link WebGPURenderer} WebGPU backend.
|
|
30139
|
+
*
|
|
30140
|
+
* @augments Texture
|
|
30141
|
+
*/
|
|
30142
|
+
class ExternalTexture extends Texture {
|
|
30143
|
+
|
|
30144
|
+
/**
|
|
30145
|
+
* Creates a new raw texture.
|
|
30146
|
+
*
|
|
30147
|
+
* @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.
|
|
30148
|
+
*/
|
|
30149
|
+
constructor( sourceTexture = null ) {
|
|
30150
|
+
|
|
30151
|
+
super();
|
|
30152
|
+
|
|
30153
|
+
/**
|
|
30154
|
+
* The external source texture.
|
|
30155
|
+
*
|
|
30156
|
+
* @type {?(WebGLTexture|GPUTexture)}
|
|
30157
|
+
* @default null
|
|
30158
|
+
*/
|
|
30159
|
+
this.sourceTexture = sourceTexture;
|
|
30160
|
+
|
|
30161
|
+
/**
|
|
30162
|
+
* This flag can be used for type testing.
|
|
30163
|
+
*
|
|
30164
|
+
* @type {boolean}
|
|
30165
|
+
* @readonly
|
|
30166
|
+
* @default true
|
|
30167
|
+
*/
|
|
30168
|
+
this.isExternalTexture = true;
|
|
30169
|
+
|
|
30170
|
+
}
|
|
30171
|
+
|
|
30172
|
+
copy( source ) {
|
|
30173
|
+
|
|
30174
|
+
super.copy( source );
|
|
30175
|
+
|
|
30176
|
+
this.sourceTexture = source.sourceTexture;
|
|
30177
|
+
|
|
30178
|
+
return this;
|
|
30179
|
+
|
|
30180
|
+
}
|
|
30181
|
+
|
|
30182
|
+
}
|
|
30183
|
+
|
|
30009
30184
|
/**
|
|
30010
30185
|
* A geometry class for representing a capsule.
|
|
30011
30186
|
*
|
|
@@ -30017,6 +30192,7 @@ class DepthTexture extends Texture {
|
|
|
30017
30192
|
* ```
|
|
30018
30193
|
*
|
|
30019
30194
|
* @augments BufferGeometry
|
|
30195
|
+
* @demo scenes/geometry-browser.html#CapsuleGeometry
|
|
30020
30196
|
*/
|
|
30021
30197
|
class CapsuleGeometry extends BufferGeometry {
|
|
30022
30198
|
|
|
@@ -30234,6 +30410,7 @@ class CapsuleGeometry extends BufferGeometry {
|
|
|
30234
30410
|
* ```
|
|
30235
30411
|
*
|
|
30236
30412
|
* @augments BufferGeometry
|
|
30413
|
+
* @demo scenes/geometry-browser.html#CircleGeometry
|
|
30237
30414
|
*/
|
|
30238
30415
|
class CircleGeometry extends BufferGeometry {
|
|
30239
30416
|
|
|
@@ -30363,6 +30540,7 @@ class CircleGeometry extends BufferGeometry {
|
|
|
30363
30540
|
* ```
|
|
30364
30541
|
*
|
|
30365
30542
|
* @augments BufferGeometry
|
|
30543
|
+
* @demo scenes/geometry-browser.html#CylinderGeometry
|
|
30366
30544
|
*/
|
|
30367
30545
|
class CylinderGeometry extends BufferGeometry {
|
|
30368
30546
|
|
|
@@ -30688,6 +30866,7 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
30688
30866
|
* ```
|
|
30689
30867
|
*
|
|
30690
30868
|
* @augments CylinderGeometry
|
|
30869
|
+
* @demo scenes/geometry-browser.html#ConeGeometry
|
|
30691
30870
|
*/
|
|
30692
30871
|
class ConeGeometry extends CylinderGeometry {
|
|
30693
30872
|
|
|
@@ -31096,6 +31275,7 @@ class PolyhedronGeometry extends BufferGeometry {
|
|
|
31096
31275
|
* ```
|
|
31097
31276
|
*
|
|
31098
31277
|
* @augments PolyhedronGeometry
|
|
31278
|
+
* @demo scenes/geometry-browser.html#DodecahedronGeometry
|
|
31099
31279
|
*/
|
|
31100
31280
|
class DodecahedronGeometry extends PolyhedronGeometry {
|
|
31101
31281
|
|
|
@@ -31415,7 +31595,7 @@ class Curve {
|
|
|
31415
31595
|
*/
|
|
31416
31596
|
getPoint( /* t, optionalTarget */ ) {
|
|
31417
31597
|
|
|
31418
|
-
|
|
31598
|
+
warn( 'Curve: .getPoint() not implemented.' );
|
|
31419
31599
|
|
|
31420
31600
|
}
|
|
31421
31601
|
|
|
@@ -32473,7 +32653,13 @@ class CatmullRomCurve3 extends Curve {
|
|
|
32473
32653
|
|
|
32474
32654
|
}
|
|
32475
32655
|
|
|
32476
|
-
|
|
32656
|
+
/**
|
|
32657
|
+
* Interpolations contains spline and Bézier functions internally used by concrete curve classes.
|
|
32658
|
+
*
|
|
32659
|
+
* Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve
|
|
32660
|
+
*
|
|
32661
|
+
* @module Interpolations
|
|
32662
|
+
*/
|
|
32477
32663
|
|
|
32478
32664
|
/**
|
|
32479
32665
|
* Computes a point on a Catmull-Rom spline.
|
|
@@ -34255,8 +34441,8 @@ class Shape extends Path {
|
|
|
34255
34441
|
}
|
|
34256
34442
|
|
|
34257
34443
|
/* eslint-disable */
|
|
34258
|
-
// copy of mapbox/earcut version 3.0.
|
|
34259
|
-
// https://github.com/mapbox/earcut/tree/v3.0.
|
|
34444
|
+
// copy of mapbox/earcut version 3.0.2
|
|
34445
|
+
// https://github.com/mapbox/earcut/tree/v3.0.2
|
|
34260
34446
|
|
|
34261
34447
|
function earcut(data, holeIndices, dim = 2) {
|
|
34262
34448
|
|
|
@@ -34273,10 +34459,10 @@ function earcut(data, holeIndices, dim = 2) {
|
|
|
34273
34459
|
|
|
34274
34460
|
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
34275
34461
|
if (data.length > 80 * dim) {
|
|
34276
|
-
minX =
|
|
34277
|
-
minY =
|
|
34278
|
-
let maxX =
|
|
34279
|
-
let maxY =
|
|
34462
|
+
minX = data[0];
|
|
34463
|
+
minY = data[1];
|
|
34464
|
+
let maxX = minX;
|
|
34465
|
+
let maxY = minY;
|
|
34280
34466
|
|
|
34281
34467
|
for (let i = dim; i < outerLen; i += dim) {
|
|
34282
34468
|
const x = data[i];
|
|
@@ -34552,7 +34738,7 @@ function compareXYSlope(a, b) {
|
|
|
34552
34738
|
return result;
|
|
34553
34739
|
}
|
|
34554
34740
|
|
|
34555
|
-
// find a bridge between vertices that connects hole with an outer ring and
|
|
34741
|
+
// find a bridge between vertices that connects hole with an outer ring and link it
|
|
34556
34742
|
function eliminateHole(hole, outerNode) {
|
|
34557
34743
|
const bridge = findHoleBridge(hole, outerNode);
|
|
34558
34744
|
if (!bridge) {
|
|
@@ -34743,7 +34929,7 @@ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
|
|
|
34743
34929
|
|
|
34744
34930
|
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
34745
34931
|
function isValidDiagonal(a, b) {
|
|
34746
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && //
|
|
34932
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
|
|
34747
34933
|
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
34748
34934
|
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
34749
34935
|
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
@@ -34890,6 +35076,12 @@ function signedArea(data, start, end, dim) {
|
|
|
34890
35076
|
return sum;
|
|
34891
35077
|
}
|
|
34892
35078
|
|
|
35079
|
+
/**
|
|
35080
|
+
* An implementation of the earcut polygon triangulation algorithm.
|
|
35081
|
+
* The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut).
|
|
35082
|
+
*
|
|
35083
|
+
* @see https://github.com/mapbox/earcut
|
|
35084
|
+
*/
|
|
34893
35085
|
class Earcut {
|
|
34894
35086
|
|
|
34895
35087
|
/**
|
|
@@ -35040,6 +35232,7 @@ function addContour( vertices, contour ) {
|
|
|
35040
35232
|
* ```
|
|
35041
35233
|
*
|
|
35042
35234
|
* @augments BufferGeometry
|
|
35235
|
+
* @demo scenes/geometry-browser.html#ExtrudeGeometry
|
|
35043
35236
|
*/
|
|
35044
35237
|
class ExtrudeGeometry extends BufferGeometry {
|
|
35045
35238
|
|
|
@@ -35128,7 +35321,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35128
35321
|
|
|
35129
35322
|
splineTube = extrudePath.computeFrenetFrames( steps, false );
|
|
35130
35323
|
|
|
35131
|
-
//
|
|
35324
|
+
// log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
|
|
35132
35325
|
|
|
35133
35326
|
binormal = new Vector3();
|
|
35134
35327
|
normal = new Vector3();
|
|
@@ -35233,7 +35426,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35233
35426
|
|
|
35234
35427
|
function scalePt2( pt, vec, size ) {
|
|
35235
35428
|
|
|
35236
|
-
if ( ! vec )
|
|
35429
|
+
if ( ! vec ) error( 'ExtrudeGeometry: vec does not exist' );
|
|
35237
35430
|
|
|
35238
35431
|
return pt.clone().addScaledVector( vec, size );
|
|
35239
35432
|
|
|
@@ -35348,14 +35541,14 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35348
35541
|
|
|
35349
35542
|
if ( direction_eq ) {
|
|
35350
35543
|
|
|
35351
|
-
//
|
|
35544
|
+
// log("Warning: lines are a straight sequence");
|
|
35352
35545
|
v_trans_x = - v_prev_y;
|
|
35353
35546
|
v_trans_y = v_prev_x;
|
|
35354
35547
|
shrink_by = Math.sqrt( v_prev_lensq );
|
|
35355
35548
|
|
|
35356
35549
|
} else {
|
|
35357
35550
|
|
|
35358
|
-
//
|
|
35551
|
+
// log("Warning: lines are a straight spike");
|
|
35359
35552
|
v_trans_x = v_prev_x;
|
|
35360
35553
|
v_trans_y = v_prev_y;
|
|
35361
35554
|
shrink_by = Math.sqrt( v_prev_lensq / 2 );
|
|
@@ -35377,7 +35570,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35377
35570
|
if ( k === il ) k = 0;
|
|
35378
35571
|
|
|
35379
35572
|
// (j)---(i)---(k)
|
|
35380
|
-
//
|
|
35573
|
+
// log('i,j,k', i, j , k)
|
|
35381
35574
|
|
|
35382
35575
|
contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
|
|
35383
35576
|
|
|
@@ -35674,7 +35867,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35674
35867
|
let k = i - 1;
|
|
35675
35868
|
if ( k < 0 ) k = contour.length - 1;
|
|
35676
35869
|
|
|
35677
|
-
//
|
|
35870
|
+
//log('b', i,j, i-1, k,vertices.length);
|
|
35678
35871
|
|
|
35679
35872
|
for ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {
|
|
35680
35873
|
|
|
@@ -35914,6 +36107,7 @@ function toJSON$1( shapes, options, data ) {
|
|
|
35914
36107
|
* ```
|
|
35915
36108
|
*
|
|
35916
36109
|
* @augments PolyhedronGeometry
|
|
36110
|
+
* @demo scenes/geometry-browser.html#IcosahedronGeometry
|
|
35917
36111
|
*/
|
|
35918
36112
|
class IcosahedronGeometry extends PolyhedronGeometry {
|
|
35919
36113
|
|
|
@@ -35988,6 +36182,7 @@ class IcosahedronGeometry extends PolyhedronGeometry {
|
|
|
35988
36182
|
* ```
|
|
35989
36183
|
*
|
|
35990
36184
|
* @augments BufferGeometry
|
|
36185
|
+
* @demo scenes/geometry-browser.html#LatheGeometry
|
|
35991
36186
|
*/
|
|
35992
36187
|
class LatheGeometry extends BufferGeometry {
|
|
35993
36188
|
|
|
@@ -36205,6 +36400,7 @@ class LatheGeometry extends BufferGeometry {
|
|
|
36205
36400
|
* ```
|
|
36206
36401
|
*
|
|
36207
36402
|
* @augments PolyhedronGeometry
|
|
36403
|
+
* @demo scenes/geometry-browser.html#OctahedronGeometry
|
|
36208
36404
|
*/
|
|
36209
36405
|
class OctahedronGeometry extends PolyhedronGeometry {
|
|
36210
36406
|
|
|
@@ -36271,6 +36467,7 @@ class OctahedronGeometry extends PolyhedronGeometry {
|
|
|
36271
36467
|
* ```
|
|
36272
36468
|
*
|
|
36273
36469
|
* @augments BufferGeometry
|
|
36470
|
+
* @demo scenes/geometry-browser.html#PlaneGeometry
|
|
36274
36471
|
*/
|
|
36275
36472
|
class PlaneGeometry extends BufferGeometry {
|
|
36276
36473
|
|
|
@@ -36399,6 +36596,7 @@ class PlaneGeometry extends BufferGeometry {
|
|
|
36399
36596
|
* ```
|
|
36400
36597
|
*
|
|
36401
36598
|
* @augments BufferGeometry
|
|
36599
|
+
* @demo scenes/geometry-browser.html#RingGeometry
|
|
36402
36600
|
*/
|
|
36403
36601
|
class RingGeometry extends BufferGeometry {
|
|
36404
36602
|
|
|
@@ -36560,6 +36758,7 @@ class RingGeometry extends BufferGeometry {
|
|
|
36560
36758
|
* ```
|
|
36561
36759
|
*
|
|
36562
36760
|
* @augments BufferGeometry
|
|
36761
|
+
* @demo scenes/geometry-browser.html#ShapeGeometry
|
|
36563
36762
|
*/
|
|
36564
36763
|
class ShapeGeometry extends BufferGeometry {
|
|
36565
36764
|
|
|
@@ -36781,6 +36980,7 @@ function toJSON( shapes, data ) {
|
|
|
36781
36980
|
* ```
|
|
36782
36981
|
*
|
|
36783
36982
|
* @augments BufferGeometry
|
|
36983
|
+
* @demo scenes/geometry-browser.html#SphereGeometry
|
|
36784
36984
|
*/
|
|
36785
36985
|
class SphereGeometry extends BufferGeometry {
|
|
36786
36986
|
|
|
@@ -36950,6 +37150,7 @@ class SphereGeometry extends BufferGeometry {
|
|
|
36950
37150
|
* ```
|
|
36951
37151
|
*
|
|
36952
37152
|
* @augments PolyhedronGeometry
|
|
37153
|
+
* @demo scenes/geometry-browser.html#TetrahedronGeometry
|
|
36953
37154
|
*/
|
|
36954
37155
|
class TetrahedronGeometry extends PolyhedronGeometry {
|
|
36955
37156
|
|
|
@@ -37013,6 +37214,7 @@ class TetrahedronGeometry extends PolyhedronGeometry {
|
|
|
37013
37214
|
* ```
|
|
37014
37215
|
*
|
|
37015
37216
|
* @augments BufferGeometry
|
|
37217
|
+
* @demo scenes/geometry-browser.html#TorusGeometry
|
|
37016
37218
|
*/
|
|
37017
37219
|
class TorusGeometry extends BufferGeometry {
|
|
37018
37220
|
|
|
@@ -37165,6 +37367,7 @@ class TorusGeometry extends BufferGeometry {
|
|
|
37165
37367
|
* ```
|
|
37166
37368
|
*
|
|
37167
37369
|
* @augments BufferGeometry
|
|
37370
|
+
* @demo scenes/geometry-browser.html#TorusKnotGeometry
|
|
37168
37371
|
*/
|
|
37169
37372
|
class TorusKnotGeometry extends BufferGeometry {
|
|
37170
37373
|
|
|
@@ -37377,6 +37580,7 @@ class TorusKnotGeometry extends BufferGeometry {
|
|
|
37377
37580
|
* ```
|
|
37378
37581
|
*
|
|
37379
37582
|
* @augments BufferGeometry
|
|
37583
|
+
* @demo scenes/geometry-browser.html#TubeGeometry
|
|
37380
37584
|
*/
|
|
37381
37585
|
class TubeGeometry extends BufferGeometry {
|
|
37382
37586
|
|
|
@@ -37924,9 +38128,9 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
37924
38128
|
* A standard physically based material, using Metallic-Roughness workflow.
|
|
37925
38129
|
*
|
|
37926
38130
|
* Physically based rendering (PBR) has recently become the standard in many
|
|
37927
|
-
* 3D applications, such as [Unity]
|
|
37928
|
-
* [Unreal]
|
|
37929
|
-
* [3D Studio Max]
|
|
38131
|
+
* 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/),
|
|
38132
|
+
* [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and
|
|
38133
|
+
* [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017).
|
|
37930
38134
|
*
|
|
37931
38135
|
* This approach differs from older approaches in that instead of using
|
|
37932
38136
|
* approximations for the way in which light interacts with a surface, a
|
|
@@ -37942,16 +38146,17 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
37942
38146
|
* Note that for best results you should always specify an environment map when using this material.
|
|
37943
38147
|
*
|
|
37944
38148
|
* For a non-technical introduction to the concept of PBR and how to set up a
|
|
37945
|
-
* PBR material, check out these articles by the people at [marmoset]
|
|
38149
|
+
* PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co):
|
|
37946
38150
|
*
|
|
37947
|
-
* - [Basic Theory of Physically Based Rendering]
|
|
37948
|
-
* - [Physically Based Rendering and You Can Too]
|
|
38151
|
+
* - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)
|
|
38152
|
+
* - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)
|
|
37949
38153
|
*
|
|
37950
38154
|
* Technical details of the approach used in three.js (and most other PBR systems) can be found is this
|
|
37951
|
-
* [paper from Disney]
|
|
38155
|
+
* [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf)
|
|
37952
38156
|
* (pdf), by Brent Burley.
|
|
37953
38157
|
*
|
|
37954
38158
|
* @augments Material
|
|
38159
|
+
* @demo scenes/material-browser.html#MeshStandardMaterial
|
|
37955
38160
|
*/
|
|
37956
38161
|
class MeshStandardMaterial extends Material {
|
|
37957
38162
|
|
|
@@ -38361,6 +38566,7 @@ class MeshStandardMaterial extends Material {
|
|
|
38361
38566
|
* best results, always specify an environment map when using this material.
|
|
38362
38567
|
*
|
|
38363
38568
|
* @augments MeshStandardMaterial
|
|
38569
|
+
* @demo scenes/material-browser.html#MeshPhysicalMaterial
|
|
38364
38570
|
*/
|
|
38365
38571
|
class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
38366
38572
|
|
|
@@ -38657,7 +38863,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38657
38863
|
}
|
|
38658
38864
|
|
|
38659
38865
|
/**
|
|
38660
|
-
* The anisotropy strength.
|
|
38866
|
+
* The anisotropy strength, from `0.0` to `1.0`.
|
|
38661
38867
|
*
|
|
38662
38868
|
* @type {number}
|
|
38663
38869
|
* @default 0
|
|
@@ -38869,7 +39075,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38869
39075
|
/**
|
|
38870
39076
|
* A material for shiny surfaces with specular highlights.
|
|
38871
39077
|
*
|
|
38872
|
-
* The material uses a non-physically based [Blinn-Phong]
|
|
39078
|
+
* The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model)
|
|
38873
39079
|
* model for calculating reflectance. Unlike the Lambertian model used in the
|
|
38874
39080
|
* {@link MeshLambertMaterial} this can simulate shiny surfaces with specular
|
|
38875
39081
|
* highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.
|
|
@@ -38879,6 +39085,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38879
39085
|
* some graphical accuracy.
|
|
38880
39086
|
*
|
|
38881
39087
|
* @augments Material
|
|
39088
|
+
* @demo scenes/material-browser.html#MeshPhongMaterial
|
|
38882
39089
|
*/
|
|
38883
39090
|
class MeshPhongMaterial extends Material {
|
|
38884
39091
|
|
|
@@ -39274,6 +39481,7 @@ class MeshPhongMaterial extends Material {
|
|
|
39274
39481
|
* A material implementing toon shading.
|
|
39275
39482
|
*
|
|
39276
39483
|
* @augments Material
|
|
39484
|
+
* @demo scenes/material-browser.html#MeshToonMaterial
|
|
39277
39485
|
*/
|
|
39278
39486
|
class MeshToonMaterial extends Material {
|
|
39279
39487
|
|
|
@@ -39588,6 +39796,7 @@ class MeshToonMaterial extends Material {
|
|
|
39588
39796
|
* A material that maps the normal vectors to RGB colors.
|
|
39589
39797
|
*
|
|
39590
39798
|
* @augments Material
|
|
39799
|
+
* @demo scenes/material-browser.html#MeshNormalMaterial
|
|
39591
39800
|
*/
|
|
39592
39801
|
class MeshNormalMaterial extends Material {
|
|
39593
39802
|
|
|
@@ -39756,7 +39965,7 @@ class MeshNormalMaterial extends Material {
|
|
|
39756
39965
|
/**
|
|
39757
39966
|
* A material for non-shiny surfaces, without specular highlights.
|
|
39758
39967
|
*
|
|
39759
|
-
* The material uses a non-physically based [Lambertian]
|
|
39968
|
+
* The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance)
|
|
39760
39969
|
* model for calculating reflectance. This can simulate some surfaces (such
|
|
39761
39970
|
* as untreated wood or stone) well, but cannot simulate shiny surfaces with
|
|
39762
39971
|
* specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment
|
|
@@ -39768,6 +39977,7 @@ class MeshNormalMaterial extends Material {
|
|
|
39768
39977
|
* {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy.
|
|
39769
39978
|
*
|
|
39770
39979
|
* @augments Material
|
|
39980
|
+
* @demo scenes/material-browser.html#MeshLambertMaterial
|
|
39771
39981
|
*/
|
|
39772
39982
|
class MeshLambertMaterial extends Material {
|
|
39773
39983
|
|
|
@@ -40143,6 +40353,7 @@ class MeshLambertMaterial extends Material {
|
|
|
40143
40353
|
* near and far plane. White is nearest, black is farthest.
|
|
40144
40354
|
*
|
|
40145
40355
|
* @augments Material
|
|
40356
|
+
* @demo scenes/material-browser.html#MeshDepthMaterial
|
|
40146
40357
|
*/
|
|
40147
40358
|
class MeshDepthMaterial extends Material {
|
|
40148
40359
|
|
|
@@ -40288,7 +40499,7 @@ class MeshDepthMaterial extends Material {
|
|
|
40288
40499
|
* Can also be used to customize the shadow casting of an object by assigning
|
|
40289
40500
|
* an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}.
|
|
40290
40501
|
* The following examples demonstrates this approach in order to ensure
|
|
40291
|
-
* transparent parts of objects do
|
|
40502
|
+
* transparent parts of objects do not cast shadows.
|
|
40292
40503
|
*
|
|
40293
40504
|
* @augments Material
|
|
40294
40505
|
*/
|
|
@@ -40407,6 +40618,7 @@ class MeshDistanceMaterial extends Material {
|
|
|
40407
40618
|
* shadows.
|
|
40408
40619
|
*
|
|
40409
40620
|
* @augments Material
|
|
40621
|
+
* @demo scenes/material-browser.html#MeshMatcapMaterial
|
|
40410
40622
|
*/
|
|
40411
40623
|
class MeshMatcapMaterial extends Material {
|
|
40412
40624
|
|
|
@@ -40558,6 +40770,24 @@ class MeshMatcapMaterial extends Material {
|
|
|
40558
40770
|
*/
|
|
40559
40771
|
this.alphaMap = null;
|
|
40560
40772
|
|
|
40773
|
+
/**
|
|
40774
|
+
* Renders the geometry as a wireframe.
|
|
40775
|
+
*
|
|
40776
|
+
* @type {boolean}
|
|
40777
|
+
* @default false
|
|
40778
|
+
*/
|
|
40779
|
+
this.wireframe = false;
|
|
40780
|
+
|
|
40781
|
+
/**
|
|
40782
|
+
* Controls the thickness of the wireframe.
|
|
40783
|
+
*
|
|
40784
|
+
* Can only be used with {@link SVGRenderer}.
|
|
40785
|
+
*
|
|
40786
|
+
* @type {number}
|
|
40787
|
+
* @default 1
|
|
40788
|
+
*/
|
|
40789
|
+
this.wireframeLinewidth = 1;
|
|
40790
|
+
|
|
40561
40791
|
/**
|
|
40562
40792
|
* Whether the material is rendered with flat shading or not.
|
|
40563
40793
|
*
|
|
@@ -40604,6 +40834,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
40604
40834
|
|
|
40605
40835
|
this.alphaMap = source.alphaMap;
|
|
40606
40836
|
|
|
40837
|
+
this.wireframe = source.wireframe;
|
|
40838
|
+
this.wireframeLinewidth = source.wireframeLinewidth;
|
|
40839
|
+
|
|
40607
40840
|
this.flatShading = source.flatShading;
|
|
40608
40841
|
|
|
40609
40842
|
this.fog = source.fog;
|
|
@@ -41924,7 +42157,7 @@ class KeyframeTrack {
|
|
|
41924
42157
|
|
|
41925
42158
|
}
|
|
41926
42159
|
|
|
41927
|
-
|
|
42160
|
+
warn( 'KeyframeTrack:', message );
|
|
41928
42161
|
return this;
|
|
41929
42162
|
|
|
41930
42163
|
}
|
|
@@ -42084,7 +42317,7 @@ class KeyframeTrack {
|
|
|
42084
42317
|
const valueSize = this.getValueSize();
|
|
42085
42318
|
if ( valueSize - Math.floor( valueSize ) !== 0 ) {
|
|
42086
42319
|
|
|
42087
|
-
|
|
42320
|
+
error( 'KeyframeTrack: Invalid value size in track.', this );
|
|
42088
42321
|
valid = false;
|
|
42089
42322
|
|
|
42090
42323
|
}
|
|
@@ -42096,7 +42329,7 @@ class KeyframeTrack {
|
|
|
42096
42329
|
|
|
42097
42330
|
if ( nKeys === 0 ) {
|
|
42098
42331
|
|
|
42099
|
-
|
|
42332
|
+
error( 'KeyframeTrack: Track is empty.', this );
|
|
42100
42333
|
valid = false;
|
|
42101
42334
|
|
|
42102
42335
|
}
|
|
@@ -42109,7 +42342,7 @@ class KeyframeTrack {
|
|
|
42109
42342
|
|
|
42110
42343
|
if ( typeof currTime === 'number' && isNaN( currTime ) ) {
|
|
42111
42344
|
|
|
42112
|
-
|
|
42345
|
+
error( 'KeyframeTrack: Time is not a valid number.', this, i, currTime );
|
|
42113
42346
|
valid = false;
|
|
42114
42347
|
break;
|
|
42115
42348
|
|
|
@@ -42117,7 +42350,7 @@ class KeyframeTrack {
|
|
|
42117
42350
|
|
|
42118
42351
|
if ( prevTime !== null && prevTime > currTime ) {
|
|
42119
42352
|
|
|
42120
|
-
|
|
42353
|
+
error( 'KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );
|
|
42121
42354
|
valid = false;
|
|
42122
42355
|
break;
|
|
42123
42356
|
|
|
@@ -42137,7 +42370,7 @@ class KeyframeTrack {
|
|
|
42137
42370
|
|
|
42138
42371
|
if ( isNaN( value ) ) {
|
|
42139
42372
|
|
|
42140
|
-
|
|
42373
|
+
error( 'KeyframeTrack: Value is not a valid number.', this, i, value );
|
|
42141
42374
|
valid = false;
|
|
42142
42375
|
break;
|
|
42143
42376
|
|
|
@@ -42669,6 +42902,14 @@ class AnimationClip {
|
|
|
42669
42902
|
*/
|
|
42670
42903
|
this.uuid = generateUUID();
|
|
42671
42904
|
|
|
42905
|
+
/**
|
|
42906
|
+
* An object that can be used to store custom data about the animation clip.
|
|
42907
|
+
* It should not hold references to functions as these will not be cloned.
|
|
42908
|
+
*
|
|
42909
|
+
* @type {Object}
|
|
42910
|
+
*/
|
|
42911
|
+
this.userData = {};
|
|
42912
|
+
|
|
42672
42913
|
// this means it should figure out its duration by scanning the tracks
|
|
42673
42914
|
if ( this.duration < 0 ) {
|
|
42674
42915
|
|
|
@@ -42700,6 +42941,8 @@ class AnimationClip {
|
|
|
42700
42941
|
const clip = new this( json.name, json.duration, tracks, json.blendMode );
|
|
42701
42942
|
clip.uuid = json.uuid;
|
|
42702
42943
|
|
|
42944
|
+
clip.userData = JSON.parse( json.userData || '{}' );
|
|
42945
|
+
|
|
42703
42946
|
return clip;
|
|
42704
42947
|
|
|
42705
42948
|
}
|
|
@@ -42722,7 +42965,8 @@ class AnimationClip {
|
|
|
42722
42965
|
'duration': clip.duration,
|
|
42723
42966
|
'tracks': tracks,
|
|
42724
42967
|
'uuid': clip.uuid,
|
|
42725
|
-
'blendMode': clip.blendMode
|
|
42968
|
+
'blendMode': clip.blendMode,
|
|
42969
|
+
'userData': JSON.stringify( clip.userData ),
|
|
42726
42970
|
|
|
42727
42971
|
};
|
|
42728
42972
|
|
|
@@ -42896,11 +43140,11 @@ class AnimationClip {
|
|
|
42896
43140
|
*/
|
|
42897
43141
|
static parseAnimation( animation, bones ) {
|
|
42898
43142
|
|
|
42899
|
-
|
|
43143
|
+
warn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );
|
|
42900
43144
|
|
|
42901
43145
|
if ( ! animation ) {
|
|
42902
43146
|
|
|
42903
|
-
|
|
43147
|
+
error( 'AnimationClip: No animation in JSONLoader data.' );
|
|
42904
43148
|
return null;
|
|
42905
43149
|
|
|
42906
43150
|
}
|
|
@@ -43117,7 +43361,11 @@ class AnimationClip {
|
|
|
43117
43361
|
|
|
43118
43362
|
}
|
|
43119
43363
|
|
|
43120
|
-
|
|
43364
|
+
const clip = new this.constructor( this.name, this.duration, tracks, this.blendMode );
|
|
43365
|
+
|
|
43366
|
+
clip.userData = JSON.parse( JSON.stringify( this.userData ) );
|
|
43367
|
+
|
|
43368
|
+
return clip;
|
|
43121
43369
|
|
|
43122
43370
|
}
|
|
43123
43371
|
|
|
@@ -43248,7 +43496,7 @@ const Cache = {
|
|
|
43248
43496
|
|
|
43249
43497
|
if ( this.enabled === false ) return;
|
|
43250
43498
|
|
|
43251
|
-
//
|
|
43499
|
+
// log( 'Cache', 'Adding key:', key );
|
|
43252
43500
|
|
|
43253
43501
|
this.files[ key ] = file;
|
|
43254
43502
|
|
|
@@ -43265,7 +43513,7 @@ const Cache = {
|
|
|
43265
43513
|
|
|
43266
43514
|
if ( this.enabled === false ) return;
|
|
43267
43515
|
|
|
43268
|
-
//
|
|
43516
|
+
// log( 'Cache', 'Checking key:', key );
|
|
43269
43517
|
|
|
43270
43518
|
return this.files[ key ];
|
|
43271
43519
|
|
|
@@ -43370,9 +43618,10 @@ class LoadingManager {
|
|
|
43370
43618
|
/**
|
|
43371
43619
|
* Used for aborting ongoing requests in loaders using this manager.
|
|
43372
43620
|
*
|
|
43373
|
-
* @
|
|
43621
|
+
* @private
|
|
43622
|
+
* @type {AbortController | null}
|
|
43374
43623
|
*/
|
|
43375
|
-
this.
|
|
43624
|
+
this._abortController = null;
|
|
43376
43625
|
|
|
43377
43626
|
/**
|
|
43378
43627
|
* This should be called by any loader using the manager when the loader
|
|
@@ -43583,8 +43832,9 @@ class LoadingManager {
|
|
|
43583
43832
|
*/
|
|
43584
43833
|
this.abort = function () {
|
|
43585
43834
|
|
|
43835
|
+
|
|
43586
43836
|
this.abortController.abort();
|
|
43587
|
-
this.
|
|
43837
|
+
this._abortController = null;
|
|
43588
43838
|
|
|
43589
43839
|
return this;
|
|
43590
43840
|
|
|
@@ -43592,6 +43842,26 @@ class LoadingManager {
|
|
|
43592
43842
|
|
|
43593
43843
|
}
|
|
43594
43844
|
|
|
43845
|
+
// TODO: Revert this back to a single member variable once this issue has been fixed
|
|
43846
|
+
// https://github.com/cloudflare/workerd/issues/3657
|
|
43847
|
+
|
|
43848
|
+
/**
|
|
43849
|
+
* Used for aborting ongoing requests in loaders using this manager.
|
|
43850
|
+
*
|
|
43851
|
+
* @type {AbortController}
|
|
43852
|
+
*/
|
|
43853
|
+
get abortController() {
|
|
43854
|
+
|
|
43855
|
+
if ( ! this._abortController ) {
|
|
43856
|
+
|
|
43857
|
+
this._abortController = new AbortController();
|
|
43858
|
+
|
|
43859
|
+
}
|
|
43860
|
+
|
|
43861
|
+
return this._abortController;
|
|
43862
|
+
|
|
43863
|
+
}
|
|
43864
|
+
|
|
43595
43865
|
}
|
|
43596
43866
|
|
|
43597
43867
|
/**
|
|
@@ -43656,7 +43926,7 @@ class Loader {
|
|
|
43656
43926
|
this.resourcePath = '';
|
|
43657
43927
|
|
|
43658
43928
|
/**
|
|
43659
|
-
* The [request header]
|
|
43929
|
+
* The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
43660
43930
|
* used in HTTP request.
|
|
43661
43931
|
*
|
|
43662
43932
|
* @type {Object<string, any>}
|
|
@@ -43721,7 +43991,7 @@ class Loader {
|
|
|
43721
43991
|
|
|
43722
43992
|
/**
|
|
43723
43993
|
* Whether the XMLHttpRequest uses credentials such as cookies, authorization
|
|
43724
|
-
* headers or TLS client certificates, see [XMLHttpRequest.withCredentials]
|
|
43994
|
+
* headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).
|
|
43725
43995
|
*
|
|
43726
43996
|
* Note: This setting has no effect if you are loading files locally or from the same domain.
|
|
43727
43997
|
*
|
|
@@ -43764,7 +44034,7 @@ class Loader {
|
|
|
43764
44034
|
/**
|
|
43765
44035
|
* Sets the given request header.
|
|
43766
44036
|
*
|
|
43767
|
-
* @param {Object} requestHeader - A [request header]
|
|
44037
|
+
* @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
43768
44038
|
* for configuring the HTTP request.
|
|
43769
44039
|
* @return {Loader} A reference to this instance.
|
|
43770
44040
|
*/
|
|
@@ -43856,7 +44126,7 @@ class FileLoader extends Loader {
|
|
|
43856
44126
|
|
|
43857
44127
|
/**
|
|
43858
44128
|
* The expected mime type. Valid values can be found
|
|
43859
|
-
* [here]
|
|
44129
|
+
* [here](hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
|
|
43860
44130
|
*
|
|
43861
44131
|
* @type {string}
|
|
43862
44132
|
*/
|
|
@@ -43962,7 +44232,7 @@ class FileLoader extends Loader {
|
|
|
43962
44232
|
|
|
43963
44233
|
if ( response.status === 0 ) {
|
|
43964
44234
|
|
|
43965
|
-
|
|
44235
|
+
warn( 'FileLoader: HTTP Status 0 received.' );
|
|
43966
44236
|
|
|
43967
44237
|
}
|
|
43968
44238
|
|
|
@@ -44232,7 +44502,7 @@ class AnimationLoader extends Loader {
|
|
|
44232
44502
|
|
|
44233
44503
|
} else {
|
|
44234
44504
|
|
|
44235
|
-
|
|
44505
|
+
error( e );
|
|
44236
44506
|
|
|
44237
44507
|
}
|
|
44238
44508
|
|
|
@@ -44427,7 +44697,7 @@ const _loading = new WeakMap();
|
|
|
44427
44697
|
* ```
|
|
44428
44698
|
* Please note that `ImageLoader` has dropped support for progress
|
|
44429
44699
|
* events in `r84`. For an `ImageLoader` that supports progress events, see
|
|
44430
|
-
* [this thread]
|
|
44700
|
+
* [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639).
|
|
44431
44701
|
*
|
|
44432
44702
|
* @augments Loader
|
|
44433
44703
|
*/
|
|
@@ -44736,7 +45006,7 @@ class DataTextureLoader extends Loader {
|
|
|
44736
45006
|
|
|
44737
45007
|
} else {
|
|
44738
45008
|
|
|
44739
|
-
|
|
45009
|
+
error( error );
|
|
44740
45010
|
return;
|
|
44741
45011
|
|
|
44742
45012
|
}
|
|
@@ -44831,7 +45101,7 @@ class DataTextureLoader extends Loader {
|
|
|
44831
45101
|
* ```
|
|
44832
45102
|
* Please note that `TextureLoader` has dropped support for progress
|
|
44833
45103
|
* events in `r84`. For a `TextureLoader` that supports progress events, see
|
|
44834
|
-
* [this thread]
|
|
45104
|
+
* [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).
|
|
44835
45105
|
*
|
|
44836
45106
|
* @augments Loader
|
|
44837
45107
|
*/
|
|
@@ -45834,7 +46104,7 @@ class PointLight extends Light {
|
|
|
45834
46104
|
}
|
|
45835
46105
|
|
|
45836
46106
|
/**
|
|
45837
|
-
* Camera that uses [orthographic projection]
|
|
46107
|
+
* Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection).
|
|
45838
46108
|
*
|
|
45839
46109
|
* In this projection mode, an object's size in the rendered image stays
|
|
45840
46110
|
* constant regardless of its distance from the camera. This can be useful
|
|
@@ -46834,7 +47104,7 @@ class MaterialLoader extends Loader {
|
|
|
46834
47104
|
|
|
46835
47105
|
} else {
|
|
46836
47106
|
|
|
46837
|
-
|
|
47107
|
+
error( e );
|
|
46838
47108
|
|
|
46839
47109
|
}
|
|
46840
47110
|
|
|
@@ -46860,7 +47130,7 @@ class MaterialLoader extends Loader {
|
|
|
46860
47130
|
|
|
46861
47131
|
if ( textures[ name ] === undefined ) {
|
|
46862
47132
|
|
|
46863
|
-
|
|
47133
|
+
warn( 'MaterialLoader: Undefined texture', name );
|
|
46864
47134
|
|
|
46865
47135
|
}
|
|
46866
47136
|
|
|
@@ -47352,7 +47622,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
47352
47622
|
|
|
47353
47623
|
} else {
|
|
47354
47624
|
|
|
47355
|
-
|
|
47625
|
+
error( e );
|
|
47356
47626
|
|
|
47357
47627
|
}
|
|
47358
47628
|
|
|
@@ -47525,7 +47795,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
47525
47795
|
}
|
|
47526
47796
|
|
|
47527
47797
|
/**
|
|
47528
|
-
* A loader for loading a JSON resource in the [JSON Object/Scene format]
|
|
47798
|
+
* A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
|
|
47529
47799
|
* The files are internally loaded via {@link FileLoader}.
|
|
47530
47800
|
*
|
|
47531
47801
|
* ```js
|
|
@@ -47584,7 +47854,7 @@ class ObjectLoader extends Loader {
|
|
|
47584
47854
|
|
|
47585
47855
|
if ( onError !== undefined ) onError( error );
|
|
47586
47856
|
|
|
47587
|
-
|
|
47857
|
+
error( 'ObjectLoader: Can\'t parse ' + url + '.', error.message );
|
|
47588
47858
|
|
|
47589
47859
|
return;
|
|
47590
47860
|
|
|
@@ -47596,7 +47866,7 @@ class ObjectLoader extends Loader {
|
|
|
47596
47866
|
|
|
47597
47867
|
if ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\'t load ' + url ) );
|
|
47598
47868
|
|
|
47599
|
-
|
|
47869
|
+
error( 'ObjectLoader: Can\'t load ' + url );
|
|
47600
47870
|
return;
|
|
47601
47871
|
|
|
47602
47872
|
}
|
|
@@ -47821,7 +48091,7 @@ class ObjectLoader extends Loader {
|
|
|
47821
48091
|
|
|
47822
48092
|
} else {
|
|
47823
48093
|
|
|
47824
|
-
|
|
48094
|
+
warn( `ObjectLoader: Unsupported geometry type "${ data.type }"` );
|
|
47825
48095
|
|
|
47826
48096
|
}
|
|
47827
48097
|
|
|
@@ -48112,7 +48382,7 @@ class ObjectLoader extends Loader {
|
|
|
48112
48382
|
|
|
48113
48383
|
if ( typeof value === 'number' ) return value;
|
|
48114
48384
|
|
|
48115
|
-
|
|
48385
|
+
warn( 'ObjectLoader.parseTexture: Constant should be in numeric form.', value );
|
|
48116
48386
|
|
|
48117
48387
|
return type[ value ];
|
|
48118
48388
|
|
|
@@ -48128,13 +48398,13 @@ class ObjectLoader extends Loader {
|
|
|
48128
48398
|
|
|
48129
48399
|
if ( data.image === undefined ) {
|
|
48130
48400
|
|
|
48131
|
-
|
|
48401
|
+
warn( 'ObjectLoader: No "image" specified for', data.uuid );
|
|
48132
48402
|
|
|
48133
48403
|
}
|
|
48134
48404
|
|
|
48135
48405
|
if ( images[ data.image ] === undefined ) {
|
|
48136
48406
|
|
|
48137
|
-
|
|
48407
|
+
warn( 'ObjectLoader: Undefined image', data.image );
|
|
48138
48408
|
|
|
48139
48409
|
}
|
|
48140
48410
|
|
|
@@ -48222,7 +48492,7 @@ class ObjectLoader extends Loader {
|
|
|
48222
48492
|
|
|
48223
48493
|
if ( geometries[ name ] === undefined ) {
|
|
48224
48494
|
|
|
48225
|
-
|
|
48495
|
+
warn( 'ObjectLoader: Undefined geometry', name );
|
|
48226
48496
|
|
|
48227
48497
|
}
|
|
48228
48498
|
|
|
@@ -48244,7 +48514,7 @@ class ObjectLoader extends Loader {
|
|
|
48244
48514
|
|
|
48245
48515
|
if ( materials[ uuid ] === undefined ) {
|
|
48246
48516
|
|
|
48247
|
-
|
|
48517
|
+
warn( 'ObjectLoader: Undefined material', uuid );
|
|
48248
48518
|
|
|
48249
48519
|
}
|
|
48250
48520
|
|
|
@@ -48258,7 +48528,7 @@ class ObjectLoader extends Loader {
|
|
|
48258
48528
|
|
|
48259
48529
|
if ( materials[ name ] === undefined ) {
|
|
48260
48530
|
|
|
48261
|
-
|
|
48531
|
+
warn( 'ObjectLoader: Undefined material', name );
|
|
48262
48532
|
|
|
48263
48533
|
}
|
|
48264
48534
|
|
|
@@ -48270,7 +48540,7 @@ class ObjectLoader extends Loader {
|
|
|
48270
48540
|
|
|
48271
48541
|
if ( textures[ uuid ] === undefined ) {
|
|
48272
48542
|
|
|
48273
|
-
|
|
48543
|
+
warn( 'ObjectLoader: Undefined texture', uuid );
|
|
48274
48544
|
|
|
48275
48545
|
}
|
|
48276
48546
|
|
|
@@ -48671,7 +48941,7 @@ class ObjectLoader extends Loader {
|
|
|
48671
48941
|
|
|
48672
48942
|
if ( skeleton === undefined ) {
|
|
48673
48943
|
|
|
48674
|
-
|
|
48944
|
+
warn( 'ObjectLoader: No skeleton found with UUID:', child.skeleton );
|
|
48675
48945
|
|
|
48676
48946
|
} else {
|
|
48677
48947
|
|
|
@@ -48740,7 +49010,7 @@ const TEXTURE_FILTER = {
|
|
|
48740
49010
|
const _errorMap = new WeakMap();
|
|
48741
49011
|
|
|
48742
49012
|
/**
|
|
48743
|
-
* A loader for loading images as an [ImageBitmap]
|
|
49013
|
+
* A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap).
|
|
48744
49014
|
* An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare
|
|
48745
49015
|
* textures for rendering.
|
|
48746
49016
|
*
|
|
@@ -48784,13 +49054,13 @@ class ImageBitmapLoader extends Loader {
|
|
|
48784
49054
|
|
|
48785
49055
|
if ( typeof createImageBitmap === 'undefined' ) {
|
|
48786
49056
|
|
|
48787
|
-
|
|
49057
|
+
warn( 'ImageBitmapLoader: createImageBitmap() not supported.' );
|
|
48788
49058
|
|
|
48789
49059
|
}
|
|
48790
49060
|
|
|
48791
49061
|
if ( typeof fetch === 'undefined' ) {
|
|
48792
49062
|
|
|
48793
|
-
|
|
49063
|
+
warn( 'ImageBitmapLoader: fetch() not supported.' );
|
|
48794
49064
|
|
|
48795
49065
|
}
|
|
48796
49066
|
|
|
@@ -48814,7 +49084,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
48814
49084
|
|
|
48815
49085
|
/**
|
|
48816
49086
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
48817
|
-
* [createImageBitmap]
|
|
49087
|
+
* [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
48818
49088
|
*
|
|
48819
49089
|
* @param {Object} options - The loader options to set.
|
|
48820
49090
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
@@ -49070,7 +49340,7 @@ class AudioLoader extends Loader {
|
|
|
49070
49340
|
|
|
49071
49341
|
} else {
|
|
49072
49342
|
|
|
49073
|
-
|
|
49343
|
+
error( e );
|
|
49074
49344
|
|
|
49075
49345
|
}
|
|
49076
49346
|
|
|
@@ -49089,8 +49359,8 @@ const _projectionMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
49089
49359
|
/**
|
|
49090
49360
|
* A special type of camera that uses two perspective cameras with
|
|
49091
49361
|
* stereoscopic projection. Can be used for rendering stereo effects
|
|
49092
|
-
* like [3D Anaglyph]
|
|
49093
|
-
* [Parallax Barrier]
|
|
49362
|
+
* like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or
|
|
49363
|
+
* [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier).
|
|
49094
49364
|
*/
|
|
49095
49365
|
class StereoCamera {
|
|
49096
49366
|
|
|
@@ -49613,7 +49883,7 @@ class AudioListener extends Object3D {
|
|
|
49613
49883
|
/**
|
|
49614
49884
|
* Represents a non-positional ( global ) audio object.
|
|
49615
49885
|
*
|
|
49616
|
-
* This and related audio modules make use of the [Web Audio API]
|
|
49886
|
+
* This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/).
|
|
49617
49887
|
*
|
|
49618
49888
|
* ```js
|
|
49619
49889
|
* // create an AudioListener and add it to the camera
|
|
@@ -49924,14 +50194,14 @@ class Audio extends Object3D {
|
|
|
49924
50194
|
|
|
49925
50195
|
if ( this.isPlaying === true ) {
|
|
49926
50196
|
|
|
49927
|
-
|
|
50197
|
+
warn( 'Audio: Audio is already playing.' );
|
|
49928
50198
|
return;
|
|
49929
50199
|
|
|
49930
50200
|
}
|
|
49931
50201
|
|
|
49932
50202
|
if ( this.hasPlaybackControl === false ) {
|
|
49933
50203
|
|
|
49934
|
-
|
|
50204
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
49935
50205
|
return;
|
|
49936
50206
|
|
|
49937
50207
|
}
|
|
@@ -49968,7 +50238,7 @@ class Audio extends Object3D {
|
|
|
49968
50238
|
|
|
49969
50239
|
if ( this.hasPlaybackControl === false ) {
|
|
49970
50240
|
|
|
49971
|
-
|
|
50241
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
49972
50242
|
return;
|
|
49973
50243
|
|
|
49974
50244
|
}
|
|
@@ -50010,7 +50280,7 @@ class Audio extends Object3D {
|
|
|
50010
50280
|
|
|
50011
50281
|
if ( this.hasPlaybackControl === false ) {
|
|
50012
50282
|
|
|
50013
|
-
|
|
50283
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50014
50284
|
return;
|
|
50015
50285
|
|
|
50016
50286
|
}
|
|
@@ -50203,7 +50473,7 @@ class Audio extends Object3D {
|
|
|
50203
50473
|
|
|
50204
50474
|
if ( this.hasPlaybackControl === false ) {
|
|
50205
50475
|
|
|
50206
|
-
|
|
50476
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50207
50477
|
return;
|
|
50208
50478
|
|
|
50209
50479
|
}
|
|
@@ -50252,7 +50522,7 @@ class Audio extends Object3D {
|
|
|
50252
50522
|
|
|
50253
50523
|
if ( this.hasPlaybackControl === false ) {
|
|
50254
50524
|
|
|
50255
|
-
|
|
50525
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50256
50526
|
return false;
|
|
50257
50527
|
|
|
50258
50528
|
}
|
|
@@ -50273,7 +50543,7 @@ class Audio extends Object3D {
|
|
|
50273
50543
|
|
|
50274
50544
|
if ( this.hasPlaybackControl === false ) {
|
|
50275
50545
|
|
|
50276
|
-
|
|
50546
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50277
50547
|
return;
|
|
50278
50548
|
|
|
50279
50549
|
}
|
|
@@ -50351,7 +50621,7 @@ class Audio extends Object3D {
|
|
|
50351
50621
|
|
|
50352
50622
|
if ( source.sourceType !== 'buffer' ) {
|
|
50353
50623
|
|
|
50354
|
-
|
|
50624
|
+
warn( 'Audio: Audio source type cannot be copied.' );
|
|
50355
50625
|
|
|
50356
50626
|
return this;
|
|
50357
50627
|
|
|
@@ -50536,7 +50806,7 @@ class PositionalAudio extends Audio {
|
|
|
50536
50806
|
* Defines which algorithm to use to reduce the volume of the audio source
|
|
50537
50807
|
* as it moves away from the listener.
|
|
50538
50808
|
*
|
|
50539
|
-
* Read [the spec]
|
|
50809
|
+
* Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype)
|
|
50540
50810
|
* for more details.
|
|
50541
50811
|
*
|
|
50542
50812
|
* @param {('linear'|'inverse'|'exponential')} value - The distance model to set.
|
|
@@ -51618,7 +51888,7 @@ class PropertyBinding {
|
|
|
51618
51888
|
// ensure there is a value node
|
|
51619
51889
|
if ( ! targetObject ) {
|
|
51620
51890
|
|
|
51621
|
-
|
|
51891
|
+
warn( 'PropertyBinding: No target node found for track: ' + this.path + '.' );
|
|
51622
51892
|
return;
|
|
51623
51893
|
|
|
51624
51894
|
}
|
|
@@ -51634,14 +51904,14 @@ class PropertyBinding {
|
|
|
51634
51904
|
|
|
51635
51905
|
if ( ! targetObject.material ) {
|
|
51636
51906
|
|
|
51637
|
-
|
|
51907
|
+
error( 'PropertyBinding: Can not bind to material as node does not have a material.', this );
|
|
51638
51908
|
return;
|
|
51639
51909
|
|
|
51640
51910
|
}
|
|
51641
51911
|
|
|
51642
51912
|
if ( ! targetObject.material.materials ) {
|
|
51643
51913
|
|
|
51644
|
-
|
|
51914
|
+
error( 'PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );
|
|
51645
51915
|
return;
|
|
51646
51916
|
|
|
51647
51917
|
}
|
|
@@ -51654,7 +51924,7 @@ class PropertyBinding {
|
|
|
51654
51924
|
|
|
51655
51925
|
if ( ! targetObject.skeleton ) {
|
|
51656
51926
|
|
|
51657
|
-
|
|
51927
|
+
error( 'PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );
|
|
51658
51928
|
return;
|
|
51659
51929
|
|
|
51660
51930
|
}
|
|
@@ -51689,14 +51959,14 @@ class PropertyBinding {
|
|
|
51689
51959
|
|
|
51690
51960
|
if ( ! targetObject.material ) {
|
|
51691
51961
|
|
|
51692
|
-
|
|
51962
|
+
error( 'PropertyBinding: Can not bind to material as node does not have a material.', this );
|
|
51693
51963
|
return;
|
|
51694
51964
|
|
|
51695
51965
|
}
|
|
51696
51966
|
|
|
51697
51967
|
if ( ! targetObject.material.map ) {
|
|
51698
51968
|
|
|
51699
|
-
|
|
51969
|
+
error( 'PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );
|
|
51700
51970
|
return;
|
|
51701
51971
|
|
|
51702
51972
|
}
|
|
@@ -51708,7 +51978,7 @@ class PropertyBinding {
|
|
|
51708
51978
|
|
|
51709
51979
|
if ( targetObject[ objectName ] === undefined ) {
|
|
51710
51980
|
|
|
51711
|
-
|
|
51981
|
+
error( 'PropertyBinding: Can not bind to objectName of node undefined.', this );
|
|
51712
51982
|
return;
|
|
51713
51983
|
|
|
51714
51984
|
}
|
|
@@ -51722,7 +51992,7 @@ class PropertyBinding {
|
|
|
51722
51992
|
|
|
51723
51993
|
if ( targetObject[ objectIndex ] === undefined ) {
|
|
51724
51994
|
|
|
51725
|
-
|
|
51995
|
+
error( 'PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );
|
|
51726
51996
|
return;
|
|
51727
51997
|
|
|
51728
51998
|
}
|
|
@@ -51740,7 +52010,7 @@ class PropertyBinding {
|
|
|
51740
52010
|
|
|
51741
52011
|
const nodeName = parsedPath.nodeName;
|
|
51742
52012
|
|
|
51743
|
-
|
|
52013
|
+
error( 'PropertyBinding: Trying to update property for track: ' + nodeName +
|
|
51744
52014
|
'.' + propertyName + ' but it wasn\'t found.', targetObject );
|
|
51745
52015
|
return;
|
|
51746
52016
|
|
|
@@ -51775,14 +52045,14 @@ class PropertyBinding {
|
|
|
51775
52045
|
// support resolving morphTarget names into indices.
|
|
51776
52046
|
if ( ! targetObject.geometry ) {
|
|
51777
52047
|
|
|
51778
|
-
|
|
52048
|
+
error( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );
|
|
51779
52049
|
return;
|
|
51780
52050
|
|
|
51781
52051
|
}
|
|
51782
52052
|
|
|
51783
52053
|
if ( ! targetObject.geometry.morphAttributes ) {
|
|
51784
52054
|
|
|
51785
|
-
|
|
52055
|
+
error( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );
|
|
51786
52056
|
return;
|
|
51787
52057
|
|
|
51788
52058
|
}
|
|
@@ -52074,7 +52344,7 @@ class AnimationObjectGroup {
|
|
|
52074
52344
|
|
|
52075
52345
|
} else if ( objects[ index ] !== knownObject ) {
|
|
52076
52346
|
|
|
52077
|
-
|
|
52347
|
+
error( 'AnimationObjectGroup: Different objects with the same UUID ' +
|
|
52078
52348
|
'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );
|
|
52079
52349
|
|
|
52080
52350
|
} // else the object is already where we want it to be
|
|
@@ -53869,7 +54139,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53869
54139
|
/**
|
|
53870
54140
|
* Deactivates all previously scheduled actions on this mixer.
|
|
53871
54141
|
*
|
|
53872
|
-
* @return {AnimationMixer} A reference to
|
|
54142
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53873
54143
|
*/
|
|
53874
54144
|
stopAllAction() {
|
|
53875
54145
|
|
|
@@ -53893,7 +54163,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53893
54163
|
* time from {@link Clock} or {@link Timer}.
|
|
53894
54164
|
*
|
|
53895
54165
|
* @param {number} deltaTime - The delta time in seconds.
|
|
53896
|
-
* @return {AnimationMixer} A reference to
|
|
54166
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53897
54167
|
*/
|
|
53898
54168
|
update( deltaTime ) {
|
|
53899
54169
|
|
|
@@ -53939,7 +54209,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53939
54209
|
* input parameter will be scaled by {@link AnimationMixer#timeScale}
|
|
53940
54210
|
*
|
|
53941
54211
|
* @param {number} time - The time to set in seconds.
|
|
53942
|
-
* @return {AnimationMixer} A reference to
|
|
54212
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53943
54213
|
*/
|
|
53944
54214
|
setTime( time ) {
|
|
53945
54215
|
|
|
@@ -54714,7 +54984,7 @@ class Raycaster {
|
|
|
54714
54984
|
|
|
54715
54985
|
} else {
|
|
54716
54986
|
|
|
54717
|
-
|
|
54987
|
+
error( 'Raycaster: Unsupported camera type: ' + camera.type );
|
|
54718
54988
|
|
|
54719
54989
|
}
|
|
54720
54990
|
|
|
@@ -55026,7 +55296,7 @@ function handleVisibilityChange() {
|
|
|
55026
55296
|
|
|
55027
55297
|
/**
|
|
55028
55298
|
* This class can be used to represent points in 3D space as
|
|
55029
|
-
* [Spherical coordinates]
|
|
55299
|
+
* [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system).
|
|
55030
55300
|
*/
|
|
55031
55301
|
class Spherical {
|
|
55032
55302
|
|
|
@@ -55170,7 +55440,7 @@ class Spherical {
|
|
|
55170
55440
|
|
|
55171
55441
|
/**
|
|
55172
55442
|
* This class can be used to represent points in 3D space as
|
|
55173
|
-
* [Cylindrical coordinates]
|
|
55443
|
+
* [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system).
|
|
55174
55444
|
*/
|
|
55175
55445
|
class Cylindrical {
|
|
55176
55446
|
|
|
@@ -55293,7 +55563,7 @@ class Cylindrical {
|
|
|
55293
55563
|
* A Note on Row-Major and Column-Major Ordering:
|
|
55294
55564
|
*
|
|
55295
55565
|
* The constructor and {@link Matrix2#set} method take arguments in
|
|
55296
|
-
* [row-major]
|
|
55566
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
55297
55567
|
* order, while internally they are stored in the {@link Matrix2#elements} array in column-major order.
|
|
55298
55568
|
* This means that calling:
|
|
55299
55569
|
* ```js
|
|
@@ -57029,7 +57299,7 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
57029
57299
|
* This helps with visualizing what a camera contains in its frustum. It
|
|
57030
57300
|
* visualizes the frustum of a camera using a line segments.
|
|
57031
57301
|
*
|
|
57032
|
-
* Based on frustum visualization in [lightgl.js shadowmap example]
|
|
57302
|
+
* Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html).
|
|
57033
57303
|
*
|
|
57034
57304
|
* `CameraHelper` must be a child of the scene.
|
|
57035
57305
|
*
|
|
@@ -58141,7 +58411,7 @@ class ShapePath {
|
|
|
58141
58411
|
let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
|
|
58142
58412
|
holesFirst = isCCW ? ! holesFirst : holesFirst;
|
|
58143
58413
|
|
|
58144
|
-
//
|
|
58414
|
+
// log("Holes first", holesFirst);
|
|
58145
58415
|
|
|
58146
58416
|
const betterShapeHoles = [];
|
|
58147
58417
|
const newShapes = [];
|
|
@@ -58169,13 +58439,13 @@ class ShapePath {
|
|
|
58169
58439
|
if ( holesFirst ) mainIdx ++;
|
|
58170
58440
|
newShapeHoles[ mainIdx ] = [];
|
|
58171
58441
|
|
|
58172
|
-
//
|
|
58442
|
+
//log('cw', i);
|
|
58173
58443
|
|
|
58174
58444
|
} else {
|
|
58175
58445
|
|
|
58176
58446
|
newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
|
|
58177
58447
|
|
|
58178
|
-
//
|
|
58448
|
+
//log('ccw', i);
|
|
58179
58449
|
|
|
58180
58450
|
}
|
|
58181
58451
|
|
|
@@ -58260,7 +58530,7 @@ class ShapePath {
|
|
|
58260
58530
|
|
|
58261
58531
|
}
|
|
58262
58532
|
|
|
58263
|
-
//
|
|
58533
|
+
//log("shape", shapes);
|
|
58264
58534
|
|
|
58265
58535
|
return shapes;
|
|
58266
58536
|
|
|
@@ -58280,7 +58550,7 @@ class Controls extends EventDispatcher {
|
|
|
58280
58550
|
* Constructs a new controls instance.
|
|
58281
58551
|
*
|
|
58282
58552
|
* @param {Object3D} object - The object that is managed by the controls.
|
|
58283
|
-
* @param {?
|
|
58553
|
+
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
58284
58554
|
*/
|
|
58285
58555
|
constructor( object, domElement = null ) {
|
|
58286
58556
|
|
|
@@ -58296,7 +58566,7 @@ class Controls extends EventDispatcher {
|
|
|
58296
58566
|
/**
|
|
58297
58567
|
* The HTML element used for event listeners.
|
|
58298
58568
|
*
|
|
58299
|
-
* @type {?
|
|
58569
|
+
* @type {?HTMLElement}
|
|
58300
58570
|
* @default null
|
|
58301
58571
|
*/
|
|
58302
58572
|
this.domElement = domElement;
|
|
@@ -58346,13 +58616,13 @@ class Controls extends EventDispatcher {
|
|
|
58346
58616
|
* Connects the controls to the DOM. This method has so called "side effects" since
|
|
58347
58617
|
* it adds the module's event listeners to the DOM.
|
|
58348
58618
|
*
|
|
58349
|
-
* @param {
|
|
58619
|
+
* @param {HTMLElement} element - The DOM element to connect to.
|
|
58350
58620
|
*/
|
|
58351
58621
|
connect( element ) {
|
|
58352
58622
|
|
|
58353
58623
|
if ( element === undefined ) {
|
|
58354
58624
|
|
|
58355
|
-
|
|
58625
|
+
warn( 'Controls: connect() now requires an element.' ); // @deprecated, the warning can be removed with r185
|
|
58356
58626
|
return;
|
|
58357
58627
|
|
|
58358
58628
|
}
|
|
@@ -58599,6 +58869,7 @@ function getTextureTypeByteLength( type ) {
|
|
|
58599
58869
|
case FloatType:
|
|
58600
58870
|
return { byteLength: 4, components: 1 };
|
|
58601
58871
|
case UnsignedInt5999Type:
|
|
58872
|
+
case UnsignedInt101111Type:
|
|
58602
58873
|
return { byteLength: 4, components: 3 };
|
|
58603
58874
|
|
|
58604
58875
|
}
|
|
@@ -58685,7 +58956,7 @@ if ( typeof window !== 'undefined' ) {
|
|
|
58685
58956
|
|
|
58686
58957
|
if ( window.__THREE__ ) {
|
|
58687
58958
|
|
|
58688
|
-
|
|
58959
|
+
warn( 'WARNING: Multiple instances of Three.js being imported.' );
|
|
58689
58960
|
|
|
58690
58961
|
} else {
|
|
58691
58962
|
|
|
@@ -59028,7 +59299,7 @@ var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\
|
|
|
59028
59299
|
|
|
59029
59300
|
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";
|
|
59030
59301
|
|
|
59031
|
-
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 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\
|
|
59302
|
+
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 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).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";
|
|
59032
59303
|
|
|
59033
59304
|
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";
|
|
59034
59305
|
|
|
@@ -59048,7 +59319,7 @@ var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n\tre
|
|
|
59048
59319
|
|
|
59049
59320
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
59050
59321
|
|
|
59051
|
-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\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
|
|
59322
|
+
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\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";
|
|
59052
59323
|
|
|
59053
59324
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\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\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
59054
59325
|
|
|
@@ -59074,7 +59345,7 @@ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertM
|
|
|
59074
59345
|
|
|
59075
59346
|
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 = inverseTransformDirection( 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";
|
|
59076
59347
|
|
|
59077
|
-
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 = inverseTransformDirection( 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, roughness
|
|
59348
|
+
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 = inverseTransformDirection( 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 = inverseTransformDirection( 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";
|
|
59078
59349
|
|
|
59079
59350
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
59080
59351
|
|
|
@@ -59086,7 +59357,7 @@ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhong
|
|
|
59086
59357
|
|
|
59087
59358
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
59088
59359
|
|
|
59089
|
-
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
59360
|
+
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
59090
59361
|
|
|
59091
59362
|
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
59092
59363
|
|
|
@@ -59094,13 +59365,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
|
|
|
59094
59365
|
|
|
59095
59366
|
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
59096
59367
|
|
|
59097
|
-
var logdepthbuf_fragment = "#if defined(
|
|
59368
|
+
var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
59098
59369
|
|
|
59099
|
-
var logdepthbuf_pars_fragment = "#if defined(
|
|
59370
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
59100
59371
|
|
|
59101
|
-
var logdepthbuf_pars_vertex = "#ifdef
|
|
59372
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
59102
59373
|
|
|
59103
|
-
var logdepthbuf_vertex = "#ifdef
|
|
59374
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
59104
59375
|
|
|
59105
59376
|
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
59106
59377
|
|
|
@@ -59160,7 +59431,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
59160
59431
|
|
|
59161
59432
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
59162
59433
|
|
|
59163
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ 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\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef
|
|
59434
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ 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\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
59164
59435
|
|
|
59165
59436
|
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";
|
|
59166
59437
|
|
|
@@ -59210,7 +59481,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
59210
59481
|
|
|
59211
59482
|
const vertex$e = "#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 <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\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 <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
59212
59483
|
|
|
59213
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef
|
|
59484
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
59214
59485
|
|
|
59215
59486
|
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}";
|
|
59216
59487
|
|
|
@@ -59442,6 +59713,7 @@ const UniformsLib = {
|
|
|
59442
59713
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
59443
59714
|
ior: { value: 1.5 }, // physical
|
|
59444
59715
|
refractionRatio: { value: 0.98 }, // basic, lambert, phong
|
|
59716
|
+
dfgLUT: { value: null } // DFG LUT for physically-based rendering
|
|
59445
59717
|
|
|
59446
59718
|
},
|
|
59447
59719
|
|
|
@@ -61038,7 +61310,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
61038
61310
|
|
|
61039
61311
|
if ( maxPrecision !== precision ) {
|
|
61040
61312
|
|
|
61041
|
-
|
|
61313
|
+
warn( 'WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );
|
|
61042
61314
|
precision = maxPrecision;
|
|
61043
61315
|
|
|
61044
61316
|
}
|
|
@@ -61355,16 +61627,18 @@ function WebGLCubeMaps( renderer ) {
|
|
|
61355
61627
|
|
|
61356
61628
|
const LOD_MIN = 4;
|
|
61357
61629
|
|
|
61358
|
-
// The standard deviations (radians) associated with the extra mips.
|
|
61359
|
-
//
|
|
61360
|
-
// geometric shadowing function. These sigma values squared must match the
|
|
61361
|
-
// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
61630
|
+
// The standard deviations (radians) associated with the extra mips.
|
|
61631
|
+
// Used for scene blur in fromScene() method.
|
|
61362
61632
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
61363
61633
|
|
|
61364
61634
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
61365
61635
|
// samples and exit early, but not recompile the shader.
|
|
61636
|
+
// Used for scene blur in fromScene() method.
|
|
61366
61637
|
const MAX_SAMPLES = 20;
|
|
61367
61638
|
|
|
61639
|
+
// GGX VNDF importance sampling configuration
|
|
61640
|
+
const GGX_SAMPLES = 256;
|
|
61641
|
+
|
|
61368
61642
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
61369
61643
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
61370
61644
|
let _oldTarget = null;
|
|
@@ -61372,24 +61646,6 @@ let _oldActiveCubeFace = 0;
|
|
|
61372
61646
|
let _oldActiveMipmapLevel = 0;
|
|
61373
61647
|
let _oldXrEnabled = false;
|
|
61374
61648
|
|
|
61375
|
-
// Golden Ratio
|
|
61376
|
-
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
61377
|
-
const INV_PHI = 1 / PHI;
|
|
61378
|
-
|
|
61379
|
-
// Vertices of a dodecahedron (except the opposites, which represent the
|
|
61380
|
-
// same axis), used as axis directions evenly spread on a sphere.
|
|
61381
|
-
const _axisDirections = [
|
|
61382
|
-
/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
61383
|
-
/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
61384
|
-
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
61385
|
-
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
61386
|
-
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
61387
|
-
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
61388
|
-
/*@__PURE__*/ new Vector3( -1, 1, -1 ),
|
|
61389
|
-
/*@__PURE__*/ new Vector3( 1, 1, -1 ),
|
|
61390
|
-
/*@__PURE__*/ new Vector3( -1, 1, 1 ),
|
|
61391
|
-
/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
61392
|
-
|
|
61393
61649
|
const _origin = /*@__PURE__*/ new Vector3();
|
|
61394
61650
|
|
|
61395
61651
|
/**
|
|
@@ -61403,9 +61659,11 @@ const _origin = /*@__PURE__*/ new Vector3();
|
|
|
61403
61659
|
* higher roughness levels. In this way we maintain resolution to smoothly
|
|
61404
61660
|
* interpolate diffuse lighting while limiting sampling computation.
|
|
61405
61661
|
*
|
|
61406
|
-
*
|
|
61407
|
-
*
|
|
61408
|
-
|
|
61662
|
+
* The prefiltering uses GGX VNDF (Visible Normal Distribution Function)
|
|
61663
|
+
* importance sampling based on "Sampling the GGX Distribution of Visible Normals"
|
|
61664
|
+
* (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF
|
|
61665
|
+
* used in material rendering for physically-based image-based lighting.
|
|
61666
|
+
*/
|
|
61409
61667
|
class PMREMGenerator {
|
|
61410
61668
|
|
|
61411
61669
|
/**
|
|
@@ -61420,15 +61678,17 @@ class PMREMGenerator {
|
|
|
61420
61678
|
|
|
61421
61679
|
this._lodMax = 0;
|
|
61422
61680
|
this._cubeSize = 0;
|
|
61423
|
-
this._lodPlanes = [];
|
|
61424
61681
|
this._sizeLods = [];
|
|
61425
61682
|
this._sigmas = [];
|
|
61683
|
+
this._lodMeshes = [];
|
|
61684
|
+
|
|
61685
|
+
this._backgroundBox = null;
|
|
61426
61686
|
|
|
61427
|
-
this._blurMaterial = null;
|
|
61428
61687
|
this._cubemapMaterial = null;
|
|
61429
61688
|
this._equirectMaterial = null;
|
|
61430
61689
|
|
|
61431
|
-
this.
|
|
61690
|
+
this._blurMaterial = null;
|
|
61691
|
+
this._ggxMaterial = null;
|
|
61432
61692
|
|
|
61433
61693
|
}
|
|
61434
61694
|
|
|
@@ -61553,6 +61813,13 @@ class PMREMGenerator {
|
|
|
61553
61813
|
if ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();
|
|
61554
61814
|
if ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();
|
|
61555
61815
|
|
|
61816
|
+
if ( this._backgroundBox !== null ) {
|
|
61817
|
+
|
|
61818
|
+
this._backgroundBox.geometry.dispose();
|
|
61819
|
+
this._backgroundBox.material.dispose();
|
|
61820
|
+
|
|
61821
|
+
}
|
|
61822
|
+
|
|
61556
61823
|
}
|
|
61557
61824
|
|
|
61558
61825
|
// private interface
|
|
@@ -61567,12 +61834,13 @@ class PMREMGenerator {
|
|
|
61567
61834
|
_dispose() {
|
|
61568
61835
|
|
|
61569
61836
|
if ( this._blurMaterial !== null ) this._blurMaterial.dispose();
|
|
61837
|
+
if ( this._ggxMaterial !== null ) this._ggxMaterial.dispose();
|
|
61570
61838
|
|
|
61571
61839
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
61572
61840
|
|
|
61573
|
-
for ( let i = 0; i < this.
|
|
61841
|
+
for ( let i = 0; i < this._lodMeshes.length; i ++ ) {
|
|
61574
61842
|
|
|
61575
|
-
this.
|
|
61843
|
+
this._lodMeshes[ i ].geometry.dispose();
|
|
61576
61844
|
|
|
61577
61845
|
}
|
|
61578
61846
|
|
|
@@ -61644,7 +61912,7 @@ class PMREMGenerator {
|
|
|
61644
61912
|
this._pingPongRenderTarget = _createRenderTarget( width, height, params );
|
|
61645
61913
|
|
|
61646
61914
|
const { _lodMax } = this;
|
|
61647
|
-
( {
|
|
61915
|
+
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
61648
61916
|
|
|
61649
61917
|
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
61650
61918
|
|
|
@@ -61656,8 +61924,8 @@ class PMREMGenerator {
|
|
|
61656
61924
|
|
|
61657
61925
|
_compileMaterial( material ) {
|
|
61658
61926
|
|
|
61659
|
-
const
|
|
61660
|
-
this._renderer.compile(
|
|
61927
|
+
const mesh = new Mesh( new BufferGeometry(), material );
|
|
61928
|
+
this._renderer.compile( mesh, _flatCamera );
|
|
61661
61929
|
|
|
61662
61930
|
}
|
|
61663
61931
|
|
|
@@ -61688,16 +61956,25 @@ class PMREMGenerator {
|
|
|
61688
61956
|
|
|
61689
61957
|
}
|
|
61690
61958
|
|
|
61691
|
-
|
|
61692
|
-
name: 'PMREM.Background',
|
|
61693
|
-
side: BackSide,
|
|
61694
|
-
depthWrite: false,
|
|
61695
|
-
depthTest: false,
|
|
61696
|
-
} );
|
|
61959
|
+
if ( this._backgroundBox === null ) {
|
|
61697
61960
|
|
|
61698
|
-
|
|
61961
|
+
this._backgroundBox = new Mesh(
|
|
61962
|
+
new BoxGeometry(),
|
|
61963
|
+
new MeshBasicMaterial( {
|
|
61964
|
+
name: 'PMREM.Background',
|
|
61965
|
+
side: BackSide,
|
|
61966
|
+
depthWrite: false,
|
|
61967
|
+
depthTest: false,
|
|
61968
|
+
} )
|
|
61969
|
+
);
|
|
61970
|
+
|
|
61971
|
+
}
|
|
61972
|
+
|
|
61973
|
+
const backgroundBox = this._backgroundBox;
|
|
61974
|
+
const backgroundMaterial = backgroundBox.material;
|
|
61699
61975
|
|
|
61700
61976
|
let useSolidColor = false;
|
|
61977
|
+
|
|
61701
61978
|
const background = scene.background;
|
|
61702
61979
|
|
|
61703
61980
|
if ( background ) {
|
|
@@ -61758,9 +62035,6 @@ class PMREMGenerator {
|
|
|
61758
62035
|
|
|
61759
62036
|
}
|
|
61760
62037
|
|
|
61761
|
-
backgroundBox.geometry.dispose();
|
|
61762
|
-
backgroundBox.material.dispose();
|
|
61763
|
-
|
|
61764
62038
|
renderer.toneMapping = toneMapping;
|
|
61765
62039
|
renderer.autoClear = originalAutoClear;
|
|
61766
62040
|
scene.background = background;
|
|
@@ -61794,7 +62068,9 @@ class PMREMGenerator {
|
|
|
61794
62068
|
}
|
|
61795
62069
|
|
|
61796
62070
|
const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;
|
|
61797
|
-
|
|
62071
|
+
|
|
62072
|
+
const mesh = this._lodMeshes[ 0 ];
|
|
62073
|
+
mesh.material = material;
|
|
61798
62074
|
|
|
61799
62075
|
const uniforms = material.uniforms;
|
|
61800
62076
|
|
|
@@ -61814,19 +62090,82 @@ class PMREMGenerator {
|
|
|
61814
62090
|
const renderer = this._renderer;
|
|
61815
62091
|
const autoClear = renderer.autoClear;
|
|
61816
62092
|
renderer.autoClear = false;
|
|
61817
|
-
const n = this._lodPlanes.length;
|
|
61818
62093
|
|
|
62094
|
+
const n = this._lodMeshes.length;
|
|
62095
|
+
|
|
62096
|
+
// Use GGX VNDF importance sampling
|
|
61819
62097
|
for ( let i = 1; i < n; i ++ ) {
|
|
61820
62098
|
|
|
61821
|
-
|
|
62099
|
+
this._applyGGXFilter( cubeUVRenderTarget, i - 1, i );
|
|
62100
|
+
|
|
62101
|
+
}
|
|
62102
|
+
|
|
62103
|
+
renderer.autoClear = autoClear;
|
|
62104
|
+
|
|
62105
|
+
}
|
|
62106
|
+
|
|
62107
|
+
/**
|
|
62108
|
+
* Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.
|
|
62109
|
+
* Uses Monte Carlo integration with VNDF importance sampling to accurately represent the
|
|
62110
|
+
* GGX BRDF for physically-based rendering. Reads from the previous LOD level and
|
|
62111
|
+
* applies incremental roughness filtering to avoid over-blurring.
|
|
62112
|
+
*
|
|
62113
|
+
* @private
|
|
62114
|
+
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
62115
|
+
* @param {number} lodIn - Source LOD level to read from
|
|
62116
|
+
* @param {number} lodOut - Target LOD level to write to
|
|
62117
|
+
*/
|
|
62118
|
+
_applyGGXFilter( cubeUVRenderTarget, lodIn, lodOut ) {
|
|
62119
|
+
|
|
62120
|
+
const renderer = this._renderer;
|
|
62121
|
+
const pingPongRenderTarget = this._pingPongRenderTarget;
|
|
61822
62122
|
|
|
61823
|
-
|
|
62123
|
+
if ( this._ggxMaterial === null ) {
|
|
61824
62124
|
|
|
61825
|
-
|
|
62125
|
+
const width = 3 * Math.max( this._cubeSize, 16 );
|
|
62126
|
+
const height = 4 * this._cubeSize;
|
|
62127
|
+
this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
|
|
61826
62128
|
|
|
61827
62129
|
}
|
|
61828
62130
|
|
|
61829
|
-
|
|
62131
|
+
const ggxMaterial = this._ggxMaterial;
|
|
62132
|
+
const ggxMesh = this._lodMeshes[ lodOut ];
|
|
62133
|
+
ggxMesh.material = ggxMaterial;
|
|
62134
|
+
|
|
62135
|
+
const ggxUniforms = ggxMaterial.uniforms;
|
|
62136
|
+
|
|
62137
|
+
// Calculate incremental roughness between LOD levels
|
|
62138
|
+
const targetRoughness = lodOut / ( this._lodMeshes.length - 1 );
|
|
62139
|
+
const sourceRoughness = lodIn / ( this._lodMeshes.length - 1 );
|
|
62140
|
+
const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
|
|
62141
|
+
|
|
62142
|
+
// Apply blur strength mapping for better quality across the roughness range
|
|
62143
|
+
const blurStrength = 0.05 + targetRoughness * 0.95;
|
|
62144
|
+
const adjustedRoughness = incrementalRoughness * blurStrength;
|
|
62145
|
+
|
|
62146
|
+
// Calculate viewport position based on output LOD level
|
|
62147
|
+
const { _lodMax } = this;
|
|
62148
|
+
const outputSize = this._sizeLods[ lodOut ];
|
|
62149
|
+
const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
62150
|
+
const y = 4 * ( this._cubeSize - outputSize );
|
|
62151
|
+
|
|
62152
|
+
// Read from previous LOD with incremental roughness
|
|
62153
|
+
ggxUniforms[ 'envMap' ].value = cubeUVRenderTarget.texture;
|
|
62154
|
+
ggxUniforms[ 'roughness' ].value = adjustedRoughness;
|
|
62155
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodIn; // Sample from input LOD
|
|
62156
|
+
|
|
62157
|
+
_setViewport( pingPongRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
62158
|
+
renderer.setRenderTarget( pingPongRenderTarget );
|
|
62159
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
62160
|
+
|
|
62161
|
+
// Copy from pingPong back to cubeUV (simple direct copy)
|
|
62162
|
+
ggxUniforms[ 'envMap' ].value = pingPongRenderTarget.texture;
|
|
62163
|
+
ggxUniforms[ 'roughness' ].value = 0.0; // Direct copy
|
|
62164
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodOut; // Read from the level we just wrote
|
|
62165
|
+
|
|
62166
|
+
_setViewport( cubeUVRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
62167
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
62168
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
61830
62169
|
|
|
61831
62170
|
}
|
|
61832
62171
|
|
|
@@ -61837,6 +62176,8 @@ class PMREMGenerator {
|
|
|
61837
62176
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
61838
62177
|
* accurate at the poles, but still does a decent job.
|
|
61839
62178
|
*
|
|
62179
|
+
* Used for initial scene blur in fromScene() method when sigma > 0.
|
|
62180
|
+
*
|
|
61840
62181
|
* @private
|
|
61841
62182
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
61842
62183
|
* @param {number} lodIn
|
|
@@ -61875,7 +62216,7 @@ class PMREMGenerator {
|
|
|
61875
62216
|
|
|
61876
62217
|
if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {
|
|
61877
62218
|
|
|
61878
|
-
|
|
62219
|
+
error(
|
|
61879
62220
|
'blur direction must be either latitudinal or longitudinal!' );
|
|
61880
62221
|
|
|
61881
62222
|
}
|
|
@@ -61883,7 +62224,9 @@ class PMREMGenerator {
|
|
|
61883
62224
|
// Number of standard deviations at which to cut off the discrete approximation.
|
|
61884
62225
|
const STANDARD_DEVIATIONS = 3;
|
|
61885
62226
|
|
|
61886
|
-
const blurMesh =
|
|
62227
|
+
const blurMesh = this._lodMeshes[ lodOut ];
|
|
62228
|
+
blurMesh.material = blurMaterial;
|
|
62229
|
+
|
|
61887
62230
|
const blurUniforms = blurMaterial.uniforms;
|
|
61888
62231
|
|
|
61889
62232
|
const pixels = this._sizeLods[ lodIn ] - 1;
|
|
@@ -61893,7 +62236,7 @@ class PMREMGenerator {
|
|
|
61893
62236
|
|
|
61894
62237
|
if ( samples > MAX_SAMPLES ) {
|
|
61895
62238
|
|
|
61896
|
-
|
|
62239
|
+
warn( `sigmaRadians, ${
|
|
61897
62240
|
sigmaRadians}, is too large and will clip, as it requested ${
|
|
61898
62241
|
samples} samples when the maximum is set to ${MAX_SAMPLES}` );
|
|
61899
62242
|
|
|
@@ -61957,9 +62300,9 @@ class PMREMGenerator {
|
|
|
61957
62300
|
|
|
61958
62301
|
function _createPlanes( lodMax ) {
|
|
61959
62302
|
|
|
61960
|
-
const lodPlanes = [];
|
|
61961
62303
|
const sizeLods = [];
|
|
61962
62304
|
const sigmas = [];
|
|
62305
|
+
const lodMeshes = [];
|
|
61963
62306
|
|
|
61964
62307
|
let lod = lodMax;
|
|
61965
62308
|
|
|
@@ -62021,7 +62364,7 @@ function _createPlanes( lodMax ) {
|
|
|
62021
62364
|
planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );
|
|
62022
62365
|
planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );
|
|
62023
62366
|
planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );
|
|
62024
|
-
|
|
62367
|
+
lodMeshes.push( new Mesh( planes, null ) );
|
|
62025
62368
|
|
|
62026
62369
|
if ( lod > LOD_MIN ) {
|
|
62027
62370
|
|
|
@@ -62031,7 +62374,7 @@ function _createPlanes( lodMax ) {
|
|
|
62031
62374
|
|
|
62032
62375
|
}
|
|
62033
62376
|
|
|
62034
|
-
return {
|
|
62377
|
+
return { lodMeshes, sizeLods, sigmas };
|
|
62035
62378
|
|
|
62036
62379
|
}
|
|
62037
62380
|
|
|
@@ -62052,6 +62395,147 @@ function _setViewport( target, x, y, width, height ) {
|
|
|
62052
62395
|
|
|
62053
62396
|
}
|
|
62054
62397
|
|
|
62398
|
+
function _getGGXShader( lodMax, width, height ) {
|
|
62399
|
+
|
|
62400
|
+
const shaderMaterial = new ShaderMaterial( {
|
|
62401
|
+
|
|
62402
|
+
name: 'PMREMGGXConvolution',
|
|
62403
|
+
|
|
62404
|
+
defines: {
|
|
62405
|
+
'GGX_SAMPLES': GGX_SAMPLES,
|
|
62406
|
+
'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
62407
|
+
'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
62408
|
+
'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
62409
|
+
},
|
|
62410
|
+
|
|
62411
|
+
uniforms: {
|
|
62412
|
+
'envMap': { value: null },
|
|
62413
|
+
'roughness': { value: 0.0 },
|
|
62414
|
+
'mipInt': { value: 0 }
|
|
62415
|
+
},
|
|
62416
|
+
|
|
62417
|
+
vertexShader: _getCommonVertexShader(),
|
|
62418
|
+
|
|
62419
|
+
fragmentShader: /* glsl */`
|
|
62420
|
+
|
|
62421
|
+
precision highp float;
|
|
62422
|
+
precision highp int;
|
|
62423
|
+
|
|
62424
|
+
varying vec3 vOutputDirection;
|
|
62425
|
+
|
|
62426
|
+
uniform sampler2D envMap;
|
|
62427
|
+
uniform float roughness;
|
|
62428
|
+
uniform float mipInt;
|
|
62429
|
+
|
|
62430
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
62431
|
+
#include <cube_uv_reflection_fragment>
|
|
62432
|
+
|
|
62433
|
+
#define PI 3.14159265359
|
|
62434
|
+
|
|
62435
|
+
// Van der Corput radical inverse
|
|
62436
|
+
float radicalInverse_VdC(uint bits) {
|
|
62437
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
62438
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
62439
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
62440
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
62441
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
62442
|
+
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
62443
|
+
}
|
|
62444
|
+
|
|
62445
|
+
// Hammersley sequence
|
|
62446
|
+
vec2 hammersley(uint i, uint N) {
|
|
62447
|
+
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
62448
|
+
}
|
|
62449
|
+
|
|
62450
|
+
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
62451
|
+
// "Sampling the GGX Distribution of Visible Normals"
|
|
62452
|
+
// https://jcgt.org/published/0007/04/01/
|
|
62453
|
+
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
62454
|
+
float alpha = roughness * roughness;
|
|
62455
|
+
|
|
62456
|
+
// Section 3.2: Transform view direction to hemisphere configuration
|
|
62457
|
+
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
62458
|
+
|
|
62459
|
+
// Section 4.1: Orthonormal basis
|
|
62460
|
+
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
62461
|
+
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
62462
|
+
vec3 T2 = cross(Vh, T1);
|
|
62463
|
+
|
|
62464
|
+
// Section 4.2: Parameterization of projected area
|
|
62465
|
+
float r = sqrt(Xi.x);
|
|
62466
|
+
float phi = 2.0 * PI * Xi.y;
|
|
62467
|
+
float t1 = r * cos(phi);
|
|
62468
|
+
float t2 = r * sin(phi);
|
|
62469
|
+
float s = 0.5 * (1.0 + Vh.z);
|
|
62470
|
+
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
62471
|
+
|
|
62472
|
+
// Section 4.3: Reprojection onto hemisphere
|
|
62473
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
62474
|
+
|
|
62475
|
+
// Section 3.4: Transform back to ellipsoid configuration
|
|
62476
|
+
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
62477
|
+
}
|
|
62478
|
+
|
|
62479
|
+
void main() {
|
|
62480
|
+
vec3 N = normalize(vOutputDirection);
|
|
62481
|
+
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
62482
|
+
|
|
62483
|
+
vec3 prefilteredColor = vec3(0.0);
|
|
62484
|
+
float totalWeight = 0.0;
|
|
62485
|
+
|
|
62486
|
+
// For very low roughness, just sample the environment directly
|
|
62487
|
+
if (roughness < 0.001) {
|
|
62488
|
+
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
62489
|
+
return;
|
|
62490
|
+
}
|
|
62491
|
+
|
|
62492
|
+
// Tangent space basis for VNDF sampling
|
|
62493
|
+
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
62494
|
+
vec3 tangent = normalize(cross(up, N));
|
|
62495
|
+
vec3 bitangent = cross(N, tangent);
|
|
62496
|
+
|
|
62497
|
+
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
62498
|
+
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
62499
|
+
|
|
62500
|
+
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
62501
|
+
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
62502
|
+
|
|
62503
|
+
// Transform H back to world space
|
|
62504
|
+
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
62505
|
+
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
62506
|
+
|
|
62507
|
+
float NdotL = max(dot(N, L), 0.0);
|
|
62508
|
+
|
|
62509
|
+
if(NdotL > 0.0) {
|
|
62510
|
+
// Sample environment at fixed mip level
|
|
62511
|
+
// VNDF importance sampling handles the distribution filtering
|
|
62512
|
+
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
62513
|
+
|
|
62514
|
+
// Weight by NdotL for the split-sum approximation
|
|
62515
|
+
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
62516
|
+
prefilteredColor += sampleColor * NdotL;
|
|
62517
|
+
totalWeight += NdotL;
|
|
62518
|
+
}
|
|
62519
|
+
}
|
|
62520
|
+
|
|
62521
|
+
if (totalWeight > 0.0) {
|
|
62522
|
+
prefilteredColor = prefilteredColor / totalWeight;
|
|
62523
|
+
}
|
|
62524
|
+
|
|
62525
|
+
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
62526
|
+
}
|
|
62527
|
+
`,
|
|
62528
|
+
|
|
62529
|
+
blending: NoBlending,
|
|
62530
|
+
depthTest: false,
|
|
62531
|
+
depthWrite: false
|
|
62532
|
+
|
|
62533
|
+
} );
|
|
62534
|
+
|
|
62535
|
+
return shaderMaterial;
|
|
62536
|
+
|
|
62537
|
+
}
|
|
62538
|
+
|
|
62055
62539
|
function _getBlurShader( lodMax, width, height ) {
|
|
62056
62540
|
|
|
62057
62541
|
const weights = new Float32Array( MAX_SAMPLES );
|
|
@@ -62434,30 +62918,7 @@ function WebGLExtensions( gl ) {
|
|
|
62434
62918
|
|
|
62435
62919
|
}
|
|
62436
62920
|
|
|
62437
|
-
|
|
62438
|
-
|
|
62439
|
-
switch ( name ) {
|
|
62440
|
-
|
|
62441
|
-
case 'WEBGL_depth_texture':
|
|
62442
|
-
extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );
|
|
62443
|
-
break;
|
|
62444
|
-
|
|
62445
|
-
case 'EXT_texture_filter_anisotropic':
|
|
62446
|
-
extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
|
|
62447
|
-
break;
|
|
62448
|
-
|
|
62449
|
-
case 'WEBGL_compressed_texture_s3tc':
|
|
62450
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
|
|
62451
|
-
break;
|
|
62452
|
-
|
|
62453
|
-
case 'WEBGL_compressed_texture_pvrtc':
|
|
62454
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
|
|
62455
|
-
break;
|
|
62456
|
-
|
|
62457
|
-
default:
|
|
62458
|
-
extension = gl.getExtension( name );
|
|
62459
|
-
|
|
62460
|
-
}
|
|
62921
|
+
const extension = gl.getExtension( name );
|
|
62461
62922
|
|
|
62462
62923
|
extensions[ name ] = extension;
|
|
62463
62924
|
|
|
@@ -62490,7 +62951,7 @@ function WebGLExtensions( gl ) {
|
|
|
62490
62951
|
|
|
62491
62952
|
if ( extension === null ) {
|
|
62492
62953
|
|
|
62493
|
-
warnOnce( '
|
|
62954
|
+
warnOnce( 'WebGLRenderer: ' + name + ' extension not supported.' );
|
|
62494
62955
|
|
|
62495
62956
|
}
|
|
62496
62957
|
|
|
@@ -62820,7 +63281,7 @@ function WebGLInfo( gl ) {
|
|
|
62820
63281
|
break;
|
|
62821
63282
|
|
|
62822
63283
|
default:
|
|
62823
|
-
|
|
63284
|
+
error( 'WebGLInfo: Unknown draw mode:', mode );
|
|
62824
63285
|
break;
|
|
62825
63286
|
|
|
62826
63287
|
}
|
|
@@ -64406,7 +64867,7 @@ function getEncodingComponents( colorSpace ) {
|
|
|
64406
64867
|
return [ encodingMatrix, 'sRGBTransferOETF' ];
|
|
64407
64868
|
|
|
64408
64869
|
default:
|
|
64409
|
-
|
|
64870
|
+
warn( 'WebGLProgram: Unsupported color space: ', colorSpace );
|
|
64410
64871
|
return [ encodingMatrix, 'LinearTransferOETF' ];
|
|
64411
64872
|
|
|
64412
64873
|
}
|
|
@@ -64426,7 +64887,7 @@ function getShaderErrors( gl, shader, type ) {
|
|
|
64426
64887
|
if ( errorMatches ) {
|
|
64427
64888
|
|
|
64428
64889
|
// --enable-privileged-webgl-extension
|
|
64429
|
-
//
|
|
64890
|
+
// log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
|
|
64430
64891
|
|
|
64431
64892
|
const errorLine = parseInt( errorMatches[ 1 ] );
|
|
64432
64893
|
return type.toUpperCase() + '\n\n' + errors + '\n\n' + handleSource( gl.getShaderSource( shader ), errorLine );
|
|
@@ -64490,7 +64951,7 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
64490
64951
|
break;
|
|
64491
64952
|
|
|
64492
64953
|
default:
|
|
64493
|
-
|
|
64954
|
+
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
|
|
64494
64955
|
toneMappingName = 'Linear';
|
|
64495
64956
|
|
|
64496
64957
|
}
|
|
@@ -64568,7 +65029,7 @@ function fetchAttributeLocations( gl, program ) {
|
|
|
64568
65029
|
if ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;
|
|
64569
65030
|
if ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;
|
|
64570
65031
|
|
|
64571
|
-
//
|
|
65032
|
+
// log( 'WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
|
|
64572
65033
|
|
|
64573
65034
|
attributes[ name ] = {
|
|
64574
65035
|
type: info.type,
|
|
@@ -64638,7 +65099,7 @@ function includeReplacer( match, include ) {
|
|
|
64638
65099
|
if ( newInclude !== undefined ) {
|
|
64639
65100
|
|
|
64640
65101
|
string = ShaderChunk[ newInclude ];
|
|
64641
|
-
|
|
65102
|
+
warn( 'WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude );
|
|
64642
65103
|
|
|
64643
65104
|
} else {
|
|
64644
65105
|
|
|
@@ -64834,7 +65295,7 @@ function generateCubeUVSize( parameters ) {
|
|
|
64834
65295
|
function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
64835
65296
|
|
|
64836
65297
|
// TODO Send this event to Three.js DevTools
|
|
64837
|
-
//
|
|
65298
|
+
// log( 'WebGLProgram', cacheKey );
|
|
64838
65299
|
|
|
64839
65300
|
const gl = renderer.getContext();
|
|
64840
65301
|
|
|
@@ -65014,8 +65475,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65014
65475
|
|
|
65015
65476
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
65016
65477
|
|
|
65017
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
65018
|
-
parameters.reversedDepthBuffer ? '#define
|
|
65478
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
65479
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
65019
65480
|
|
|
65020
65481
|
'uniform mat4 modelMatrix;',
|
|
65021
65482
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -65181,8 +65642,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65181
65642
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
65182
65643
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
65183
65644
|
|
|
65184
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
65185
|
-
parameters.reversedDepthBuffer ? '#define
|
|
65645
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
65646
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
65186
65647
|
|
|
65187
65648
|
'uniform mat4 viewMatrix;',
|
|
65188
65649
|
'uniform vec3 cameraPosition;',
|
|
@@ -65299,8 +65760,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65299
65760
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
65300
65761
|
const fragmentGlsl = versionString + prefixFragment + fragmentShader;
|
|
65301
65762
|
|
|
65302
|
-
//
|
|
65303
|
-
//
|
|
65763
|
+
// log( '*VERTEX*', vertexGlsl );
|
|
65764
|
+
// log( '*FRAGMENT*', fragmentGlsl );
|
|
65304
65765
|
|
|
65305
65766
|
const glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );
|
|
65306
65767
|
const glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );
|
|
@@ -65354,7 +65815,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65354
65815
|
const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
65355
65816
|
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
65356
65817
|
|
|
65357
|
-
|
|
65818
|
+
error(
|
|
65358
65819
|
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
65359
65820
|
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
65360
65821
|
'Material Name: ' + self.name + '\n' +
|
|
@@ -65368,7 +65829,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65368
65829
|
|
|
65369
65830
|
} else if ( programLog !== '' ) {
|
|
65370
65831
|
|
|
65371
|
-
|
|
65832
|
+
warn( 'WebGLProgram: Program Info Log:', programLog );
|
|
65372
65833
|
|
|
65373
65834
|
} else if ( vertexLog === '' || fragmentLog === '' ) {
|
|
65374
65835
|
|
|
@@ -65679,7 +66140,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65679
66140
|
|
|
65680
66141
|
if ( precision !== material.precision ) {
|
|
65681
66142
|
|
|
65682
|
-
|
|
66143
|
+
warn( 'WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );
|
|
65683
66144
|
|
|
65684
66145
|
}
|
|
65685
66146
|
|
|
@@ -66182,7 +66643,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
66182
66643
|
if ( parameters.alphaToCoverage )
|
|
66183
66644
|
_programLayers.enable( 21 );
|
|
66184
66645
|
if ( parameters.numMultiviewViews )
|
|
66185
|
-
_programLayers.enable(
|
|
66646
|
+
_programLayers.enable( 22 );
|
|
66186
66647
|
|
|
66187
66648
|
array.push( _programLayers.mask );
|
|
66188
66649
|
|
|
@@ -67315,7 +67776,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67315
67776
|
// Set GL state for depth map.
|
|
67316
67777
|
_state.setBlending( NoBlending );
|
|
67317
67778
|
|
|
67318
|
-
if ( _state.buffers.depth.getReversed() ) {
|
|
67779
|
+
if ( _state.buffers.depth.getReversed() === true ) {
|
|
67319
67780
|
|
|
67320
67781
|
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
67321
67782
|
|
|
@@ -67342,7 +67803,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67342
67803
|
|
|
67343
67804
|
if ( shadow === undefined ) {
|
|
67344
67805
|
|
|
67345
|
-
|
|
67806
|
+
warn( 'WebGLShadowMap:', light, 'has no shadow.' );
|
|
67346
67807
|
continue;
|
|
67347
67808
|
|
|
67348
67809
|
}
|
|
@@ -68330,7 +68791,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68330
68791
|
break;
|
|
68331
68792
|
|
|
68332
68793
|
default:
|
|
68333
|
-
|
|
68794
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
68334
68795
|
break;
|
|
68335
68796
|
|
|
68336
68797
|
}
|
|
@@ -68348,15 +68809,15 @@ function WebGLState( gl, extensions ) {
|
|
|
68348
68809
|
break;
|
|
68349
68810
|
|
|
68350
68811
|
case SubtractiveBlending:
|
|
68351
|
-
|
|
68812
|
+
error( 'WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
68352
68813
|
break;
|
|
68353
68814
|
|
|
68354
68815
|
case MultiplyBlending:
|
|
68355
|
-
|
|
68816
|
+
error( 'WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
68356
68817
|
break;
|
|
68357
68818
|
|
|
68358
68819
|
default:
|
|
68359
|
-
|
|
68820
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
68360
68821
|
break;
|
|
68361
68822
|
|
|
68362
68823
|
}
|
|
@@ -68643,7 +69104,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68643
69104
|
|
|
68644
69105
|
} catch ( error ) {
|
|
68645
69106
|
|
|
68646
|
-
|
|
69107
|
+
error( 'WebGLState:', error );
|
|
68647
69108
|
|
|
68648
69109
|
}
|
|
68649
69110
|
|
|
@@ -68657,7 +69118,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68657
69118
|
|
|
68658
69119
|
} catch ( error ) {
|
|
68659
69120
|
|
|
68660
|
-
|
|
69121
|
+
error( 'WebGLState:', error );
|
|
68661
69122
|
|
|
68662
69123
|
}
|
|
68663
69124
|
|
|
@@ -68671,7 +69132,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68671
69132
|
|
|
68672
69133
|
} catch ( error ) {
|
|
68673
69134
|
|
|
68674
|
-
|
|
69135
|
+
error( 'WebGLState:', error );
|
|
68675
69136
|
|
|
68676
69137
|
}
|
|
68677
69138
|
|
|
@@ -68685,7 +69146,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68685
69146
|
|
|
68686
69147
|
} catch ( error ) {
|
|
68687
69148
|
|
|
68688
|
-
|
|
69149
|
+
error( 'WebGLState:', error );
|
|
68689
69150
|
|
|
68690
69151
|
}
|
|
68691
69152
|
|
|
@@ -68699,7 +69160,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68699
69160
|
|
|
68700
69161
|
} catch ( error ) {
|
|
68701
69162
|
|
|
68702
|
-
|
|
69163
|
+
error( 'WebGLState:', error );
|
|
68703
69164
|
|
|
68704
69165
|
}
|
|
68705
69166
|
|
|
@@ -68713,7 +69174,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68713
69174
|
|
|
68714
69175
|
} catch ( error ) {
|
|
68715
69176
|
|
|
68716
|
-
|
|
69177
|
+
error( 'WebGLState:', error );
|
|
68717
69178
|
|
|
68718
69179
|
}
|
|
68719
69180
|
|
|
@@ -68727,7 +69188,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68727
69188
|
|
|
68728
69189
|
} catch ( error ) {
|
|
68729
69190
|
|
|
68730
|
-
|
|
69191
|
+
error( 'WebGLState:', error );
|
|
68731
69192
|
|
|
68732
69193
|
}
|
|
68733
69194
|
|
|
@@ -68741,7 +69202,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68741
69202
|
|
|
68742
69203
|
} catch ( error ) {
|
|
68743
69204
|
|
|
68744
|
-
|
|
69205
|
+
error( 'WebGLState:', error );
|
|
68745
69206
|
|
|
68746
69207
|
}
|
|
68747
69208
|
|
|
@@ -68755,7 +69216,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68755
69216
|
|
|
68756
69217
|
} catch ( error ) {
|
|
68757
69218
|
|
|
68758
|
-
|
|
69219
|
+
error( 'WebGLState:', error );
|
|
68759
69220
|
|
|
68760
69221
|
}
|
|
68761
69222
|
|
|
@@ -68769,7 +69230,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68769
69230
|
|
|
68770
69231
|
} catch ( error ) {
|
|
68771
69232
|
|
|
68772
|
-
|
|
69233
|
+
error( 'WebGLState:', error );
|
|
68773
69234
|
|
|
68774
69235
|
}
|
|
68775
69236
|
|
|
@@ -69070,7 +69531,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69070
69531
|
const context = canvas.getContext( '2d' );
|
|
69071
69532
|
context.drawImage( image, 0, 0, width, height );
|
|
69072
69533
|
|
|
69073
|
-
|
|
69534
|
+
warn( 'WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
|
|
69074
69535
|
|
|
69075
69536
|
return canvas;
|
|
69076
69537
|
|
|
@@ -69078,7 +69539,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69078
69539
|
|
|
69079
69540
|
if ( 'data' in image ) {
|
|
69080
69541
|
|
|
69081
|
-
|
|
69542
|
+
warn( 'WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
|
|
69082
69543
|
|
|
69083
69544
|
}
|
|
69084
69545
|
|
|
@@ -69119,7 +69580,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69119
69580
|
|
|
69120
69581
|
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
|
|
69121
69582
|
|
|
69122
|
-
|
|
69583
|
+
warn( 'WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'' );
|
|
69123
69584
|
|
|
69124
69585
|
}
|
|
69125
69586
|
|
|
@@ -69188,6 +69649,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69188
69649
|
if ( glFormat === _gl.RGB ) {
|
|
69189
69650
|
|
|
69190
69651
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
69652
|
+
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
69191
69653
|
|
|
69192
69654
|
}
|
|
69193
69655
|
|
|
@@ -69231,7 +69693,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69231
69693
|
} else if ( depthType === UnsignedShortType ) {
|
|
69232
69694
|
|
|
69233
69695
|
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
69234
|
-
|
|
69696
|
+
warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );
|
|
69235
69697
|
|
|
69236
69698
|
}
|
|
69237
69699
|
|
|
@@ -69461,7 +69923,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69461
69923
|
|
|
69462
69924
|
if ( textureUnit >= capabilities.maxTextures ) {
|
|
69463
69925
|
|
|
69464
|
-
|
|
69926
|
+
warn( 'WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
|
|
69465
69927
|
|
|
69466
69928
|
}
|
|
69467
69929
|
|
|
@@ -69508,11 +69970,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69508
69970
|
|
|
69509
69971
|
if ( image === null ) {
|
|
69510
69972
|
|
|
69511
|
-
|
|
69973
|
+
warn( 'WebGLRenderer: Texture marked for update but no image data found.' );
|
|
69512
69974
|
|
|
69513
69975
|
} else if ( image.complete === false ) {
|
|
69514
69976
|
|
|
69515
|
-
|
|
69977
|
+
warn( 'WebGLRenderer: Texture marked for update but image is incomplete' );
|
|
69516
69978
|
|
|
69517
69979
|
} else {
|
|
69518
69980
|
|
|
@@ -69543,6 +70005,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69543
70005
|
uploadTexture( textureProperties, texture, slot );
|
|
69544
70006
|
return;
|
|
69545
70007
|
|
|
70008
|
+
} else if ( texture.isExternalTexture ) {
|
|
70009
|
+
|
|
70010
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
70011
|
+
|
|
69546
70012
|
}
|
|
69547
70013
|
|
|
69548
70014
|
state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -69612,7 +70078,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69612
70078
|
( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
|
|
69613
70079
|
texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {
|
|
69614
70080
|
|
|
69615
|
-
|
|
70081
|
+
warn( 'WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );
|
|
69616
70082
|
|
|
69617
70083
|
}
|
|
69618
70084
|
|
|
@@ -70057,7 +70523,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70057
70523
|
|
|
70058
70524
|
} else {
|
|
70059
70525
|
|
|
70060
|
-
|
|
70526
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
70061
70527
|
|
|
70062
70528
|
}
|
|
70063
70529
|
|
|
@@ -70113,7 +70579,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70113
70579
|
|
|
70114
70580
|
} else {
|
|
70115
70581
|
|
|
70116
|
-
|
|
70582
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
70117
70583
|
|
|
70118
70584
|
}
|
|
70119
70585
|
|
|
@@ -70408,7 +70874,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70408
70874
|
|
|
70409
70875
|
} else {
|
|
70410
70876
|
|
|
70411
|
-
|
|
70877
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
|
|
70412
70878
|
|
|
70413
70879
|
}
|
|
70414
70880
|
|
|
@@ -71428,13 +71894,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
71428
71894
|
|
|
71429
71895
|
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
71430
71896
|
|
|
71431
|
-
|
|
71897
|
+
warn( 'WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
71432
71898
|
|
|
71433
71899
|
}
|
|
71434
71900
|
|
|
71435
71901
|
} else {
|
|
71436
71902
|
|
|
71437
|
-
|
|
71903
|
+
error( 'WebGLTextures: Unsupported texture color space:', colorSpace );
|
|
71438
71904
|
|
|
71439
71905
|
}
|
|
71440
71906
|
|
|
@@ -71504,6 +71970,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71504
71970
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
71505
71971
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
71506
71972
|
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
71973
|
+
if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
|
|
71507
71974
|
|
|
71508
71975
|
if ( p === ByteType ) return gl.BYTE;
|
|
71509
71976
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -71672,7 +72139,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71672
72139
|
|
|
71673
72140
|
if ( extension !== null ) {
|
|
71674
72141
|
|
|
71675
|
-
if ( p ===
|
|
72142
|
+
if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
|
|
71676
72143
|
if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
71677
72144
|
if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
71678
72145
|
if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
|
|
@@ -71732,48 +72199,6 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
71732
72199
|
|
|
71733
72200
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
71734
72201
|
|
|
71735
|
-
/**
|
|
71736
|
-
* Represents a texture created externally from the renderer context.
|
|
71737
|
-
*
|
|
71738
|
-
* This may be a texture from a protected media stream, device camera feed,
|
|
71739
|
-
* or other data feeds like a depth sensor.
|
|
71740
|
-
*
|
|
71741
|
-
* Note that this class is only supported in {@link WebGLRenderer} right now.
|
|
71742
|
-
*
|
|
71743
|
-
* @augments Texture
|
|
71744
|
-
*/
|
|
71745
|
-
class ExternalTexture extends Texture {
|
|
71746
|
-
|
|
71747
|
-
/**
|
|
71748
|
-
* Creates a new raw texture.
|
|
71749
|
-
*
|
|
71750
|
-
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
|
|
71751
|
-
*/
|
|
71752
|
-
constructor( sourceTexture = null ) {
|
|
71753
|
-
|
|
71754
|
-
super();
|
|
71755
|
-
|
|
71756
|
-
/**
|
|
71757
|
-
* The external source texture.
|
|
71758
|
-
*
|
|
71759
|
-
* @type {?WebGLTexture}
|
|
71760
|
-
* @default null
|
|
71761
|
-
*/
|
|
71762
|
-
this.sourceTexture = sourceTexture;
|
|
71763
|
-
|
|
71764
|
-
/**
|
|
71765
|
-
* This flag can be used for type testing.
|
|
71766
|
-
*
|
|
71767
|
-
* @type {boolean}
|
|
71768
|
-
* @readonly
|
|
71769
|
-
* @default true
|
|
71770
|
-
*/
|
|
71771
|
-
this.isExternalTexture = true;
|
|
71772
|
-
|
|
71773
|
-
}
|
|
71774
|
-
|
|
71775
|
-
}
|
|
71776
|
-
|
|
71777
72202
|
const _occlusion_vertex = `
|
|
71778
72203
|
void main() {
|
|
71779
72204
|
|
|
@@ -71965,6 +72390,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
71965
72390
|
let glBaseLayer = null;
|
|
71966
72391
|
let xrFrame = null;
|
|
71967
72392
|
|
|
72393
|
+
const supportsGlBinding = typeof XRWebGLBinding !== 'undefined';
|
|
72394
|
+
|
|
71968
72395
|
const depthSensing = new WebXRDepthSensing();
|
|
71969
72396
|
const cameraAccessTextures = {};
|
|
71970
72397
|
const attributes = gl.getContextAttributes();
|
|
@@ -72196,7 +72623,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72196
72623
|
|
|
72197
72624
|
if ( scope.isPresenting === true ) {
|
|
72198
72625
|
|
|
72199
|
-
|
|
72626
|
+
warn( 'WebXRManager: Cannot change framebuffer scale while presenting.' );
|
|
72200
72627
|
|
|
72201
72628
|
}
|
|
72202
72629
|
|
|
@@ -72218,7 +72645,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72218
72645
|
|
|
72219
72646
|
if ( scope.isPresenting === true ) {
|
|
72220
72647
|
|
|
72221
|
-
|
|
72648
|
+
warn( 'WebXRManager: Cannot change reference space type while presenting.' );
|
|
72222
72649
|
|
|
72223
72650
|
}
|
|
72224
72651
|
|
|
@@ -72249,6 +72676,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
72249
72676
|
/**
|
|
72250
72677
|
* Returns the current base layer.
|
|
72251
72678
|
*
|
|
72679
|
+
* This is an `XRProjectionLayer` when the targeted XR device supports the
|
|
72680
|
+
* WebXR Layers API, or an `XRWebGLLayer` otherwise.
|
|
72681
|
+
*
|
|
72252
72682
|
* @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
|
|
72253
72683
|
*/
|
|
72254
72684
|
this.getBaseLayer = function () {
|
|
@@ -72260,10 +72690,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
72260
72690
|
/**
|
|
72261
72691
|
* Returns the current XR binding.
|
|
72262
72692
|
*
|
|
72263
|
-
*
|
|
72693
|
+
* Creates a new binding if needed and the browser is
|
|
72694
|
+
* capable of doing so.
|
|
72695
|
+
*
|
|
72696
|
+
* @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.
|
|
72264
72697
|
*/
|
|
72265
72698
|
this.getBinding = function () {
|
|
72266
72699
|
|
|
72700
|
+
if ( glBinding === null && supportsGlBinding ) {
|
|
72701
|
+
|
|
72702
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
72703
|
+
|
|
72704
|
+
}
|
|
72705
|
+
|
|
72267
72706
|
return glBinding;
|
|
72268
72707
|
|
|
72269
72708
|
};
|
|
@@ -72331,17 +72770,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
72331
72770
|
currentPixelRatio = renderer.getPixelRatio();
|
|
72332
72771
|
renderer.getSize( currentSize );
|
|
72333
72772
|
|
|
72334
|
-
if ( typeof XRWebGLBinding !== 'undefined' ) {
|
|
72335
|
-
|
|
72336
|
-
glBinding = new XRWebGLBinding( session, gl );
|
|
72337
|
-
|
|
72338
|
-
}
|
|
72339
72773
|
|
|
72340
72774
|
// Check that the browser implements the necessary APIs to use an
|
|
72341
72775
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
72342
|
-
const
|
|
72776
|
+
const supportsLayers = supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
72343
72777
|
|
|
72344
|
-
if ( !
|
|
72778
|
+
if ( ! supportsLayers ) {
|
|
72345
72779
|
|
|
72346
72780
|
const layerInit = {
|
|
72347
72781
|
antialias: attributes.antialias,
|
|
@@ -72400,7 +72834,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72400
72834
|
|
|
72401
72835
|
}
|
|
72402
72836
|
|
|
72403
|
-
glBinding =
|
|
72837
|
+
glBinding = this.getBinding();
|
|
72404
72838
|
|
|
72405
72839
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
72406
72840
|
|
|
@@ -72496,6 +72930,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
72496
72930
|
/**
|
|
72497
72931
|
* Returns the current depth texture computed via depth sensing.
|
|
72498
72932
|
*
|
|
72933
|
+
* See {@link WebXRDepthSensing#getDepthTexture}.
|
|
72934
|
+
*
|
|
72499
72935
|
* @return {?Texture} The depth texture.
|
|
72500
72936
|
*/
|
|
72501
72937
|
this.getDepthTexture = function () {
|
|
@@ -72672,7 +73108,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72672
73108
|
|
|
72673
73109
|
/**
|
|
72674
73110
|
* Updates the state of the XR camera. Use this method on app level if you
|
|
72675
|
-
* set cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
73111
|
+
* set `cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
72676
73112
|
* camera of the scene as a parameter. The passed in camera's transformation
|
|
72677
73113
|
* is automatically adjusted to the position of the XR camera when calling
|
|
72678
73114
|
* this method.
|
|
@@ -72850,6 +73286,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
72850
73286
|
/**
|
|
72851
73287
|
* Returns the depth sensing mesh.
|
|
72852
73288
|
*
|
|
73289
|
+
* See {@link WebXRDepthSensing#getMesh}.
|
|
73290
|
+
*
|
|
72853
73291
|
* @return {Mesh} The depth sensing mesh.
|
|
72854
73292
|
*/
|
|
72855
73293
|
this.getDepthSensingMesh = function () {
|
|
@@ -72970,7 +73408,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
72970
73408
|
enabledFeatures.includes( 'depth-sensing' ) &&
|
|
72971
73409
|
session.depthUsage == 'gpu-optimized';
|
|
72972
73410
|
|
|
72973
|
-
if ( gpuDepthSensingEnabled &&
|
|
73411
|
+
if ( gpuDepthSensingEnabled && supportsGlBinding ) {
|
|
73412
|
+
|
|
73413
|
+
glBinding = scope.getBinding();
|
|
72974
73414
|
|
|
72975
73415
|
const depthData = glBinding.getDepthInformation( views[ 0 ] );
|
|
72976
73416
|
|
|
@@ -72985,32 +73425,30 @@ class WebXRManager extends EventDispatcher {
|
|
|
72985
73425
|
const cameraAccessEnabled = enabledFeatures &&
|
|
72986
73426
|
enabledFeatures.includes( 'camera-access' );
|
|
72987
73427
|
|
|
72988
|
-
if ( cameraAccessEnabled ) {
|
|
73428
|
+
if ( cameraAccessEnabled && supportsGlBinding ) {
|
|
72989
73429
|
|
|
72990
73430
|
renderer.state.unbindTexture();
|
|
72991
73431
|
|
|
72992
|
-
|
|
72993
|
-
|
|
72994
|
-
for ( let i = 0; i < views.length; i ++ ) {
|
|
72995
|
-
|
|
72996
|
-
const camera = views[ i ].camera;
|
|
73432
|
+
glBinding = scope.getBinding();
|
|
72997
73433
|
|
|
72998
|
-
|
|
73434
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
72999
73435
|
|
|
73000
|
-
|
|
73436
|
+
const camera = views[ i ].camera;
|
|
73001
73437
|
|
|
73002
|
-
|
|
73438
|
+
if ( camera ) {
|
|
73003
73439
|
|
|
73004
|
-
|
|
73005
|
-
cameraAccessTextures[ camera ] = cameraTex;
|
|
73440
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
73006
73441
|
|
|
73007
|
-
|
|
73442
|
+
if ( ! cameraTex ) {
|
|
73008
73443
|
|
|
73009
|
-
|
|
73010
|
-
|
|
73444
|
+
cameraTex = new ExternalTexture();
|
|
73445
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
73011
73446
|
|
|
73012
73447
|
}
|
|
73013
73448
|
|
|
73449
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
73450
|
+
cameraTex.sourceTexture = glTexture;
|
|
73451
|
+
|
|
73014
73452
|
}
|
|
73015
73453
|
|
|
73016
73454
|
}
|
|
@@ -73729,7 +74167,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
73729
74167
|
|
|
73730
74168
|
}
|
|
73731
74169
|
|
|
73732
|
-
|
|
74170
|
+
error( 'WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );
|
|
73733
74171
|
|
|
73734
74172
|
return 0;
|
|
73735
74173
|
|
|
@@ -73984,11 +74422,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
73984
74422
|
|
|
73985
74423
|
} else if ( value.isTexture ) {
|
|
73986
74424
|
|
|
73987
|
-
|
|
74425
|
+
warn( 'WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
|
|
73988
74426
|
|
|
73989
74427
|
} else {
|
|
73990
74428
|
|
|
73991
|
-
|
|
74429
|
+
warn( 'WebGLRenderer: Unsupported uniform value type.', value );
|
|
73992
74430
|
|
|
73993
74431
|
}
|
|
73994
74432
|
|
|
@@ -74037,6 +74475,69 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
74037
74475
|
|
|
74038
74476
|
}
|
|
74039
74477
|
|
|
74478
|
+
/**
|
|
74479
|
+
* Precomputed DFG LUT for Image-Based Lighting
|
|
74480
|
+
* Resolution: 32x32
|
|
74481
|
+
* Samples: 4096 per texel
|
|
74482
|
+
* Format: RG16F (2 half floats per texel: scale, bias)
|
|
74483
|
+
*/
|
|
74484
|
+
|
|
74485
|
+
|
|
74486
|
+
const DATA = new Uint16Array( [
|
|
74487
|
+
0x2cd9, 0x3b64, 0x2d0e, 0x3b43, 0x2e20, 0x3aa7, 0x3061, 0x39fb, 0x325e, 0x397c, 0x3454, 0x3908, 0x357d, 0x3893, 0x3698, 0x381e, 0x379d, 0x375b, 0x3845, 0x3689, 0x38af, 0x35ca, 0x390d, 0x351e, 0x395f, 0x3484, 0x39a8, 0x33f9, 0x39e6, 0x330a, 0x3a1c, 0x3239, 0x3a4b, 0x3183, 0x3a73, 0x30e5, 0x3a95, 0x305b, 0x3ab1, 0x2fc6, 0x3ac9, 0x2ef7, 0x3ade, 0x2e43, 0x3aee, 0x2da7, 0x3afc, 0x2d1f, 0x3b07, 0x2ca9, 0x3b10, 0x2c42, 0x3b17, 0x2bd1, 0x3b1c, 0x2b34, 0x3b1f, 0x2aaa, 0x3b22, 0x2a31, 0x3b23, 0x29c7, 0x3b23, 0x2968,
|
|
74488
|
+
0x32d4, 0x3a4b, 0x32dc, 0x3a45, 0x3308, 0x3a26, 0x3378, 0x39d0, 0x3425, 0x394a, 0x34c9, 0x38be, 0x359c, 0x383e, 0x3688, 0x3796, 0x3778, 0x36c4, 0x382f, 0x3603, 0x3898, 0x3553, 0x38f7, 0x34b3, 0x394b, 0x3424, 0x3994, 0x334c, 0x39d3, 0x326c, 0x3a08, 0x31a9, 0x3a35, 0x30fe, 0x3a5a, 0x306a, 0x3a78, 0x2fd1, 0x3a90, 0x2ef1, 0x3aa2, 0x2e2e, 0x3ab0, 0x2d86, 0x3aba, 0x2cf3, 0x3ac1, 0x2c74, 0x3ac4, 0x2c05, 0x3ac4, 0x2b49, 0x3ac2, 0x2aa1, 0x3abd, 0x2a0c, 0x3ab7, 0x298b, 0x3aaf, 0x2918, 0x3aa6, 0x28b3, 0x3a9b, 0x285a,
|
|
74489
|
+
0x3559, 0x3954, 0x355a, 0x3951, 0x3566, 0x3944, 0x3582, 0x391e, 0x35b6, 0x38d3, 0x360a, 0x386a, 0x3684, 0x37ed, 0x3720, 0x370d, 0x37d3, 0x3641, 0x3847, 0x3588, 0x38a3, 0x34e2, 0x38fa, 0x344d, 0x3948, 0x3391, 0x398d, 0x32a6, 0x39c8, 0x31d6, 0x39fa, 0x3121, 0x3a22, 0x3082, 0x3a43, 0x2ff0, 0x3a5c, 0x2f01, 0x3a6f, 0x2e32, 0x3a7c, 0x2d7e, 0x3a84, 0x2ce2, 0x3a87, 0x2c5b, 0x3a87, 0x2bcc, 0x3a83, 0x2b00, 0x3a7b, 0x2a4e, 0x3a71, 0x29b3, 0x3a66, 0x292c, 0x3a58, 0x28b4, 0x3a4b, 0x284b, 0x3a3d, 0x27dc, 0x3a2e, 0x2739,
|
|
74490
|
+
0x3709, 0x387c, 0x370a, 0x387b, 0x3710, 0x3874, 0x3720, 0x385f, 0x373d, 0x3834, 0x376a, 0x37e1, 0x37ac, 0x3732, 0x3805, 0x3675, 0x383f, 0x35bc, 0x3883, 0x3511, 0x38cb, 0x3476, 0x3912, 0x33d8, 0x3955, 0x32e2, 0x3991, 0x3208, 0x39c6, 0x3149, 0x39f1, 0x30a1, 0x3a15, 0x300f, 0x3a30, 0x2f21, 0x3a44, 0x2e45, 0x3a51, 0x2d87, 0x3a59, 0x2ce2, 0x3a5b, 0x2c53, 0x3a58, 0x2bb0, 0x3a52, 0x2ada, 0x3a49, 0x2a1f, 0x3a40, 0x297d, 0x3a34, 0x28f0, 0x3a25, 0x2874, 0x3a13, 0x2807, 0x3a00, 0x274e, 0x39eb, 0x26a6, 0x39d5, 0x2611,
|
|
74491
|
+
0x3840, 0x3780, 0x3840, 0x377e, 0x3842, 0x3776, 0x3846, 0x375e, 0x384f, 0x372a, 0x385b, 0x36d3, 0x386c, 0x3659, 0x3885, 0x35c7, 0x38a8, 0x352d, 0x38d4, 0x3497, 0x3906, 0x340c, 0x393b, 0x331a, 0x3970, 0x323a, 0x39a0, 0x3172, 0x39cb, 0x30c3, 0x39ef, 0x302a, 0x3a0c, 0x2f4a, 0x3a21, 0x2e63, 0x3a2f, 0x2d9b, 0x3a37, 0x2ced, 0x3a39, 0x2c57, 0x3a37, 0x2baa, 0x3a34, 0x2ac9, 0x3a2c, 0x2a05, 0x3a20, 0x295d, 0x3a11, 0x28ca, 0x39ff, 0x2849, 0x39eb, 0x27b2, 0x39d5, 0x26ed, 0x39be, 0x2640, 0x39a5, 0x25aa, 0x398b, 0x2523,
|
|
74492
|
+
0x38e2, 0x363b, 0x38e2, 0x363b, 0x38e3, 0x3635, 0x38e6, 0x3626, 0x38ea, 0x3606, 0x38f0, 0x35cd, 0x38f8, 0x3579, 0x3903, 0x350e, 0x3915, 0x3495, 0x392d, 0x3418, 0x394c, 0x3340, 0x3970, 0x3261, 0x3995, 0x3197, 0x39b8, 0x30e4, 0x39d8, 0x3046, 0x39f3, 0x2f76, 0x3a08, 0x2e86, 0x3a16, 0x2db5, 0x3a1e, 0x2cff, 0x3a22, 0x2c61, 0x3a24, 0x2bb3, 0x3a20, 0x2ac7, 0x3a17, 0x29fc, 0x3a0a, 0x294c, 0x39fa, 0x28b2, 0x39e7, 0x282e, 0x39d1, 0x2773, 0x39b9, 0x26a9, 0x399f, 0x25fa, 0x3985, 0x255f, 0x3968, 0x24d6, 0x394a, 0x245d,
|
|
74493
|
+
0x396e, 0x3524, 0x396e, 0x3524, 0x396e, 0x3520, 0x396f, 0x3517, 0x3971, 0x3502, 0x3973, 0x34dd, 0x3975, 0x34a5, 0x3978, 0x3458, 0x397e, 0x33f9, 0x3987, 0x3332, 0x3997, 0x326b, 0x39aa, 0x31ac, 0x39c0, 0x30fb, 0x39d7, 0x305c, 0x39eb, 0x2f9e, 0x39fc, 0x2ea7, 0x3a07, 0x2dcf, 0x3a0f, 0x2d13, 0x3a16, 0x2c70, 0x3a17, 0x2bc4, 0x3a14, 0x2ad0, 0x3a0a, 0x29fc, 0x39fd, 0x2945, 0x39ed, 0x28a6, 0x39d9, 0x281d, 0x39c2, 0x274a, 0x39a9, 0x267c, 0x398e, 0x25c7, 0x3971, 0x2528, 0x3952, 0x249e, 0x3931, 0x2425, 0x3910, 0x2374,
|
|
74494
|
+
0x39e5, 0x3436, 0x39e5, 0x3435, 0x39e5, 0x3434, 0x39e5, 0x342e, 0x39e5, 0x3420, 0x39e5, 0x3408, 0x39e3, 0x33c4, 0x39e1, 0x3359, 0x39df, 0x32d3, 0x39de, 0x323a, 0x39e1, 0x319a, 0x39e7, 0x30fb, 0x39f0, 0x3065, 0x39f9, 0x2fb6, 0x3a02, 0x2ec0, 0x3a08, 0x2de6, 0x3a0d, 0x2d26, 0x3a12, 0x2c7e, 0x3a13, 0x2bda, 0x3a0e, 0x2adc, 0x3a05, 0x2a02, 0x39f8, 0x2945, 0x39e7, 0x28a1, 0x39d3, 0x2813, 0x39bc, 0x2730, 0x39a2, 0x265c, 0x3985, 0x25a3, 0x3966, 0x2501, 0x3945, 0x2475, 0x3923, 0x23f3, 0x3901, 0x231c, 0x38dd, 0x225e,
|
|
74495
|
+
0x3a4b, 0x32d6, 0x3a4a, 0x32d6, 0x3a4a, 0x32d4, 0x3a4a, 0x32cc, 0x3a48, 0x32bb, 0x3a47, 0x329d, 0x3a43, 0x326b, 0x3a3d, 0x3222, 0x3a36, 0x31c2, 0x3a2e, 0x314f, 0x3a28, 0x30d2, 0x3a23, 0x3052, 0x3a20, 0x2fab, 0x3a1e, 0x2ec2, 0x3a1b, 0x2def, 0x3a19, 0x2d31, 0x3a1a, 0x2c89, 0x3a18, 0x2beb, 0x3a11, 0x2aea, 0x3a07, 0x2a0a, 0x39fa, 0x2948, 0x39e9, 0x28a1, 0x39d4, 0x280f, 0x39bd, 0x2721, 0x39a2, 0x2647, 0x3985, 0x258b, 0x3964, 0x24e5, 0x3942, 0x2455, 0x391f, 0x23b3, 0x38fb, 0x22d8, 0x38d4, 0x2219, 0x38ad, 0x2172,
|
|
74496
|
+
0x3aa0, 0x3180, 0x3aa0, 0x3180, 0x3aa0, 0x317f, 0x3a9f, 0x317b, 0x3a9d, 0x3170, 0x3a99, 0x315d, 0x3a95, 0x313d, 0x3a8d, 0x310c, 0x3a82, 0x30ca, 0x3a76, 0x3077, 0x3a69, 0x3019, 0x3a5c, 0x2f68, 0x3a4f, 0x2e9e, 0x3a42, 0x2dde, 0x3a37, 0x2d2b, 0x3a30, 0x2c89, 0x3a29, 0x2bef, 0x3a1f, 0x2af0, 0x3a12, 0x2a0f, 0x3a03, 0x294a, 0x39f1, 0x28a0, 0x39dc, 0x280c, 0x39c5, 0x2717, 0x39a9, 0x2638, 0x398b, 0x2578, 0x396a, 0x24d0, 0x3947, 0x243f, 0x3923, 0x2380, 0x38fc, 0x22a4, 0x38d4, 0x21e4, 0x38ac, 0x213c, 0x3883, 0x20a8,
|
|
74497
|
+
0x3ae8, 0x3062, 0x3ae8, 0x3062, 0x3ae7, 0x3061, 0x3ae6, 0x305f, 0x3ae4, 0x305a, 0x3ae0, 0x304f, 0x3ada, 0x303b, 0x3ad1, 0x301b, 0x3ac5, 0x2fdd, 0x3ab6, 0x2f6a, 0x3aa4, 0x2ede, 0x3a91, 0x2e45, 0x3a7c, 0x2da5, 0x3a67, 0x2d0a, 0x3a57, 0x2c77, 0x3a48, 0x2bdc, 0x3a38, 0x2ae5, 0x3a27, 0x2a0a, 0x3a16, 0x2947, 0x3a02, 0x289d, 0x39eb, 0x2808, 0x39d3, 0x270d, 0x39b6, 0x262b, 0x3997, 0x256a, 0x3976, 0x24bf, 0x3952, 0x242b, 0x392d, 0x2358, 0x3904, 0x227a, 0x38db, 0x21b8, 0x38b2, 0x2110, 0x3887, 0x207d, 0x385b, 0x1ff6,
|
|
74498
|
+
0x3b23, 0x2ee8, 0x3b23, 0x2ee8, 0x3b22, 0x2ee8, 0x3b21, 0x2ee7, 0x3b1f, 0x2ee3, 0x3b1a, 0x2ed6, 0x3b14, 0x2ec1, 0x3b0b, 0x2e99, 0x3afe, 0x2e60, 0x3aee, 0x2e12, 0x3ad8, 0x2dad, 0x3ac1, 0x2d3d, 0x3aa5, 0x2cc3, 0x3a8b, 0x2c48, 0x3a76, 0x2ba2, 0x3a60, 0x2ac0, 0x3a49, 0x29f2, 0x3a32, 0x2938, 0x3a1b, 0x2893, 0x3a02, 0x27ff, 0x39e8, 0x26ff, 0x39ca, 0x261e, 0x39aa, 0x255b, 0x3988, 0x24b0, 0x3964, 0x241c, 0x393d, 0x2336, 0x3913, 0x2257, 0x38e9, 0x2195, 0x38be, 0x20eb, 0x3891, 0x2059, 0x3864, 0x1fae, 0x3837, 0x1ecd,
|
|
74499
|
+
0x3b54, 0x2d61, 0x3b54, 0x2d61, 0x3b53, 0x2d61, 0x3b52, 0x2d62, 0x3b4f, 0x2d61, 0x3b4b, 0x2d5c, 0x3b45, 0x2d51, 0x3b3b, 0x2d3d, 0x3b2e, 0x2d1a, 0x3b1d, 0x2ce7, 0x3b06, 0x2ca3, 0x3aeb, 0x2c52, 0x3acb, 0x2bee, 0x3ab0, 0x2b31, 0x3a94, 0x2a74, 0x3a77, 0x29bf, 0x3a5a, 0x2915, 0x3a3f, 0x287a, 0x3a22, 0x27de, 0x3a05, 0x26e4, 0x39e5, 0x2609, 0x39c3, 0x2547, 0x39a0, 0x249f, 0x397b, 0x240c, 0x3953, 0x2314, 0x3928, 0x2238, 0x38fd, 0x2175, 0x38d0, 0x20cb, 0x38a2, 0x2038, 0x3873, 0x1f71, 0x3844, 0x1e90, 0x3815, 0x1dce,
|
|
74500
|
+
0x3b7c, 0x2c22, 0x3b7c, 0x2c22, 0x3b7b, 0x2c23, 0x3b7a, 0x2c25, 0x3b77, 0x2c27, 0x3b73, 0x2c26, 0x3b6d, 0x2c23, 0x3b64, 0x2c1a, 0x3b57, 0x2c07, 0x3b46, 0x2bd1, 0x3b2e, 0x2b79, 0x3b0f, 0x2b07, 0x3aef, 0x2a86, 0x3ad1, 0x29f8, 0x3ab0, 0x2967, 0x3a8e, 0x28d7, 0x3a6d, 0x284e, 0x3a4c, 0x279f, 0x3a2b, 0x26b7, 0x3a08, 0x25e5, 0x39e4, 0x252c, 0x39be, 0x2488, 0x3998, 0x23f0, 0x396f, 0x22f2, 0x3943, 0x2215, 0x3917, 0x2155, 0x38e8, 0x20ae, 0x38b9, 0x201c, 0x3888, 0x1f38, 0x3857, 0x1e5a, 0x3826, 0x1d9a, 0x37eb, 0x1cf0,
|
|
74501
|
+
0x3b9c, 0x2a43, 0x3b9c, 0x2a43, 0x3b9b, 0x2a46, 0x3b9a, 0x2a4a, 0x3b98, 0x2a50, 0x3b93, 0x2a54, 0x3b8e, 0x2a59, 0x3b85, 0x2a56, 0x3b79, 0x2a45, 0x3b67, 0x2a24, 0x3b4f, 0x29ee, 0x3b2f, 0x29a4, 0x3b10, 0x294b, 0x3aef, 0x28e5, 0x3ac9, 0x2877, 0x3aa4, 0x2809, 0x3a7e, 0x2739, 0x3a59, 0x266d, 0x3a34, 0x25af, 0x3a0c, 0x2503, 0x39e4, 0x2468, 0x39bb, 0x23bb, 0x3990, 0x22c6, 0x3963, 0x21f0, 0x3936, 0x2133, 0x3906, 0x208f, 0x38d5, 0x1ffd, 0x38a3, 0x1f04, 0x3870, 0x1e28, 0x383d, 0x1d69, 0x380b, 0x1cc3, 0x37b0, 0x1c32,
|
|
74502
|
+
0x3bb5, 0x28aa, 0x3bb5, 0x28ab, 0x3bb5, 0x28ad, 0x3bb4, 0x28b2, 0x3bb2, 0x28b9, 0x3bae, 0x28c2, 0x3ba8, 0x28ca, 0x3ba0, 0x28d1, 0x3b94, 0x28cd, 0x3b83, 0x28c1, 0x3b6a, 0x28a3, 0x3b4b, 0x2876, 0x3b2d, 0x283d, 0x3b09, 0x27ea, 0x3ae1, 0x274b, 0x3ab9, 0x26a6, 0x3a8f, 0x25fe, 0x3a67, 0x255d, 0x3a3d, 0x24c5, 0x3a11, 0x2439, 0x39e6, 0x2371, 0x39b9, 0x228d, 0x398a, 0x21c1, 0x395a, 0x210b, 0x3929, 0x206c, 0x38f7, 0x1fc1, 0x38c3, 0x1ecb, 0x388f, 0x1df6, 0x385a, 0x1d3a, 0x3825, 0x1c99, 0x37e1, 0x1c08, 0x3779, 0x1b1b,
|
|
74503
|
+
0x3bc9, 0x26d3, 0x3bc9, 0x26d4, 0x3bc9, 0x26d9, 0x3bc8, 0x26e3, 0x3bc6, 0x26ef, 0x3bc2, 0x2705, 0x3bbd, 0x271a, 0x3bb6, 0x2731, 0x3baa, 0x273c, 0x3b9a, 0x273d, 0x3b81, 0x2726, 0x3b65, 0x26f7, 0x3b46, 0x26af, 0x3b20, 0x2650, 0x3af7, 0x25e1, 0x3acd, 0x256a, 0x3aa1, 0x24eb, 0x3a75, 0x246f, 0x3a46, 0x23ee, 0x3a17, 0x230d, 0x39e9, 0x223e, 0x39b7, 0x2183, 0x3985, 0x20d8, 0x3953, 0x2043, 0x391e, 0x1f7a, 0x38e9, 0x1e8d, 0x38b3, 0x1dbf, 0x387c, 0x1d0b, 0x3845, 0x1c6c, 0x380e, 0x1bc4, 0x37b0, 0x1ad2, 0x3745, 0x19fd,
|
|
74504
|
+
0x3bd9, 0x24e4, 0x3bd9, 0x24e5, 0x3bd9, 0x24e8, 0x3bd8, 0x24f2, 0x3bd5, 0x24fe, 0x3bd2, 0x2512, 0x3bce, 0x252b, 0x3bc6, 0x2544, 0x3bbc, 0x255a, 0x3bac, 0x256b, 0x3b93, 0x2569, 0x3b7a, 0x2557, 0x3b5b, 0x252f, 0x3b34, 0x24f7, 0x3b0c, 0x24ad, 0x3adf, 0x2458, 0x3ab1, 0x23f8, 0x3a82, 0x233f, 0x3a4f, 0x2286, 0x3a1e, 0x21d5, 0x39eb, 0x2130, 0x39b6, 0x2098, 0x3982, 0x200e, 0x394b, 0x1f25, 0x3914, 0x1e45, 0x38dc, 0x1d83, 0x38a3, 0x1cd6, 0x386b, 0x1c3d, 0x3831, 0x1b71, 0x37f2, 0x1a87, 0x3782, 0x19bc, 0x3714, 0x1909,
|
|
74505
|
+
0x3be5, 0x22d8, 0x3be5, 0x22d9, 0x3be4, 0x22df, 0x3be4, 0x22ef, 0x3be1, 0x2305, 0x3bde, 0x232a, 0x3bda, 0x2358, 0x3bd4, 0x2392, 0x3bcb, 0x23ca, 0x3bbb, 0x23f4, 0x3ba3, 0x2405, 0x3b8c, 0x2405, 0x3b6c, 0x23ec, 0x3b47, 0x23ae, 0x3b1d, 0x2353, 0x3af0, 0x22e2, 0x3ac0, 0x2261, 0x3a8e, 0x21d9, 0x3a5a, 0x214e, 0x3a26, 0x20c7, 0x39ee, 0x2045, 0x39b7, 0x1f97, 0x397f, 0x1eba, 0x3945, 0x1df0, 0x390b, 0x1d3a, 0x38d0, 0x1c9a, 0x3895, 0x1c0a, 0x385a, 0x1b18, 0x381f, 0x1a39, 0x37c9, 0x1975, 0x3756, 0x18cc, 0x36e6, 0x1836,
|
|
74506
|
+
0x3bed, 0x20a8, 0x3bed, 0x20a9, 0x3bed, 0x20ae, 0x3bed, 0x20bb, 0x3beb, 0x20cf, 0x3be8, 0x20ef, 0x3be4, 0x2119, 0x3bde, 0x214f, 0x3bd6, 0x2189, 0x3bc6, 0x21b8, 0x3bb1, 0x21de, 0x3b9a, 0x21f2, 0x3b7b, 0x21f2, 0x3b57, 0x21d8, 0x3b2d, 0x21a4, 0x3b00, 0x215f, 0x3acf, 0x2108, 0x3a99, 0x20a8, 0x3a64, 0x2043, 0x3a2c, 0x1fba, 0x39f2, 0x1ef3, 0x39b8, 0x1e36, 0x397c, 0x1d86, 0x3940, 0x1ce5, 0x3903, 0x1c52, 0x38c6, 0x1b9e, 0x3888, 0x1ab3, 0x384a, 0x19e4, 0x380e, 0x192b, 0x37a3, 0x188b, 0x372d, 0x17f7, 0x36ba, 0x1701,
|
|
74507
|
+
0x3bf4, 0x1e23, 0x3bf4, 0x1e25, 0x3bf4, 0x1e2d, 0x3bf3, 0x1e41, 0x3bf1, 0x1e64, 0x3bef, 0x1e9c, 0x3beb, 0x1ee1, 0x3be6, 0x1f40, 0x3bde, 0x1fa7, 0x3bce, 0x2001, 0x3bbd, 0x202f, 0x3ba6, 0x204e, 0x3b88, 0x205f, 0x3b64, 0x205b, 0x3b3b, 0x2044, 0x3b0e, 0x201f, 0x3adb, 0x1fcf, 0x3aa6, 0x1f4e, 0x3a6e, 0x1ec1, 0x3a33, 0x1e2b, 0x39f7, 0x1d95, 0x39ba, 0x1d06, 0x397b, 0x1c7d, 0x393c, 0x1bfc, 0x38fc, 0x1b13, 0x38bc, 0x1a40, 0x387c, 0x1983, 0x383c, 0x18da, 0x37fa, 0x1842, 0x377f, 0x177f, 0x3706, 0x1695, 0x3691, 0x15c8,
|
|
74508
|
+
0x3bf8, 0x1bca, 0x3bf8, 0x1bcc, 0x3bf8, 0x1bd8, 0x3bf8, 0x1bf7, 0x3bf6, 0x1c1b, 0x3bf4, 0x1c45, 0x3bf1, 0x1c83, 0x3bec, 0x1cce, 0x3be4, 0x1d21, 0x3bd5, 0x1d78, 0x3bc5, 0x1dd1, 0x3bb0, 0x1e17, 0x3b93, 0x1e4a, 0x3b70, 0x1e5f, 0x3b48, 0x1e57, 0x3b1b, 0x1e35, 0x3ae7, 0x1df6, 0x3ab2, 0x1da4, 0x3a77, 0x1d44, 0x3a3a, 0x1cdb, 0x39fc, 0x1c6e, 0x39bb, 0x1c03, 0x397a, 0x1b35, 0x3938, 0x1a72, 0x38f5, 0x19bb, 0x38b3, 0x1914, 0x3870, 0x187d, 0x382e, 0x17eb, 0x37db, 0x16f9, 0x375c, 0x1621, 0x36e1, 0x1565, 0x3669, 0x14be,
|
|
74509
|
+
0x3bfb, 0x18b9, 0x3bfb, 0x18ba, 0x3bfb, 0x18c3, 0x3bfb, 0x18da, 0x3bf9, 0x190a, 0x3bf7, 0x1948, 0x3bf5, 0x19ac, 0x3bf0, 0x1a20, 0x3be9, 0x1ab3, 0x3bdb, 0x1b49, 0x3bcd, 0x1be6, 0x3bb7, 0x1c34, 0x3b9c, 0x1c6d, 0x3b7a, 0x1c8e, 0x3b54, 0x1c9e, 0x3b26, 0x1c96, 0x3af2, 0x1c75, 0x3abc, 0x1c47, 0x3a80, 0x1c09, 0x3a42, 0x1b85, 0x3a01, 0x1aec, 0x39be, 0x1a50, 0x397a, 0x19b5, 0x3935, 0x1921, 0x38f0, 0x1895, 0x38aa, 0x1814, 0x3866, 0x173a, 0x3821, 0x1665, 0x37be, 0x15a4, 0x373c, 0x14f9, 0x36be, 0x1460, 0x3644, 0x13b3,
|
|
74510
|
+
0x3bfd, 0x156b, 0x3bfd, 0x156c, 0x3bfd, 0x1578, 0x3bfd, 0x1598, 0x3bfc, 0x15dd, 0x3bfa, 0x163c, 0x3bf7, 0x16cb, 0x3bf3, 0x177b, 0x3beb, 0x1833, 0x3be0, 0x18ad, 0x3bd2, 0x192e, 0x3bbd, 0x19a6, 0x3ba4, 0x1a0c, 0x3b83, 0x1a5a, 0x3b5d, 0x1a8c, 0x3b30, 0x1a9b, 0x3afd, 0x1a86, 0x3ac6, 0x1a5c, 0x3a89, 0x1a11, 0x3a49, 0x19b7, 0x3a06, 0x194f, 0x39c1, 0x18e3, 0x397a, 0x1873, 0x3933, 0x1805, 0x38eb, 0x173a, 0x38a3, 0x1676, 0x385c, 0x15bf, 0x3816, 0x1519, 0x37a2, 0x1482, 0x371d, 0x13f7, 0x369c, 0x1306, 0x3620, 0x1231,
|
|
74511
|
+
0x3bff, 0x11cb, 0x3bff, 0x11cd, 0x3bfe, 0x11dd, 0x3bfe, 0x1219, 0x3bfd, 0x126b, 0x3bfb, 0x12e9, 0x3bf9, 0x13c5, 0x3bf5, 0x1460, 0x3bee, 0x150f, 0x3be3, 0x15c9, 0x3bd6, 0x168a, 0x3bc3, 0x174f, 0x3baa, 0x1806, 0x3b8b, 0x184f, 0x3b66, 0x1888, 0x3b39, 0x18a6, 0x3b07, 0x18ad, 0x3acf, 0x189c, 0x3a92, 0x1876, 0x3a50, 0x1840, 0x3a0c, 0x17fd, 0x39c4, 0x176a, 0x397b, 0x16ce, 0x3931, 0x1634, 0x38e6, 0x1599, 0x389c, 0x1508, 0x3852, 0x147f, 0x380a, 0x1401, 0x3788, 0x131c, 0x36ff, 0x124a, 0x367c, 0x1190, 0x35fe, 0x10ea,
|
|
74512
|
+
0x3bff, 0x0daa, 0x3bff, 0x0dad, 0x3bff, 0x0dc0, 0x3bff, 0x0e0e, 0x3bfe, 0x0e87, 0x3bfc, 0x0f14, 0x3bfb, 0x1029, 0x3bf7, 0x10d1, 0x3bf0, 0x11d3, 0x3be6, 0x12c9, 0x3bd9, 0x13fc, 0x3bc7, 0x1499, 0x3bb0, 0x152a, 0x3b92, 0x15ab, 0x3b6e, 0x1615, 0x3b42, 0x165a, 0x3b10, 0x1681, 0x3ad8, 0x1683, 0x3a9a, 0x1665, 0x3a57, 0x1629, 0x3a11, 0x15dd, 0x39c8, 0x1580, 0x397c, 0x1518, 0x3930, 0x14ae, 0x38e3, 0x1441, 0x3896, 0x13b1, 0x384a, 0x12e9, 0x37ff, 0x122f, 0x376f, 0x1182, 0x36e3, 0x10e5, 0x365e, 0x1057, 0x35de, 0x0fac,
|
|
74513
|
+
0x3c00, 0x08ea, 0x3c00, 0x08ed, 0x3c00, 0x0902, 0x3c00, 0x0961, 0x3bff, 0x09f3, 0x3bfd, 0x0abc, 0x3bfb, 0x0c1f, 0x3bf8, 0x0d15, 0x3bf1, 0x0e5b, 0x3be8, 0x0fb4, 0x3bdc, 0x10b0, 0x3bcb, 0x1190, 0x3bb5, 0x126c, 0x3b97, 0x132c, 0x3b74, 0x13de, 0x3b4a, 0x1432, 0x3b18, 0x145e, 0x3ae0, 0x1472, 0x3aa2, 0x146f, 0x3a5f, 0x1456, 0x3a17, 0x142e, 0x39cc, 0x13ee, 0x397e, 0x136b, 0x392f, 0x12e1, 0x38df, 0x124f, 0x3890, 0x11bd, 0x3842, 0x1131, 0x37eb, 0x10ac, 0x3757, 0x102e, 0x36c9, 0x0f76, 0x3640, 0x0ea3, 0x35bf, 0x0de4,
|
|
74514
|
+
0x3c00, 0x039b, 0x3c00, 0x039d, 0x3c00, 0x03b2, 0x3c00, 0x041c, 0x3bff, 0x04be, 0x3bfd, 0x05d6, 0x3bfc, 0x0764, 0x3bf8, 0x08e2, 0x3bf2, 0x0a67, 0x3bea, 0x0c1b, 0x3bde, 0x0d41, 0x3bcd, 0x0e5f, 0x3bb8, 0x0f8c, 0x3b9c, 0x1057, 0x3b7a, 0x10e5, 0x3b51, 0x1155, 0x3b20, 0x11a5, 0x3ae8, 0x11da, 0x3aaa, 0x11ef, 0x3a66, 0x11e5, 0x3a1d, 0x11c1, 0x39d0, 0x1185, 0x3980, 0x113b, 0x392e, 0x10e5, 0x38dc, 0x1087, 0x388b, 0x1028, 0x383b, 0x0f94, 0x37d9, 0x0edb, 0x3741, 0x0e2c, 0x36af, 0x0d89, 0x3625, 0x0cf2, 0x35a1, 0x0c69,
|
|
74515
|
+
0x3c00, 0x0107, 0x3c00, 0x0108, 0x3c00, 0x0110, 0x3c00, 0x0145, 0x3bff, 0x0197, 0x3bfe, 0x0224, 0x3bfc, 0x030c, 0x3bf8, 0x0478, 0x3bf3, 0x062c, 0x3beb, 0x0833, 0x3be0, 0x0979, 0x3bd0, 0x0aeb, 0x3bbc, 0x0c3d, 0x3ba0, 0x0d01, 0x3b80, 0x0dbd, 0x3b57, 0x0e69, 0x3b27, 0x0eeb, 0x3af0, 0x0f53, 0x3ab1, 0x0f8a, 0x3a6c, 0x0f9f, 0x3a22, 0x0f8b, 0x39d4, 0x0f5b, 0x3982, 0x0f0f, 0x392f, 0x0eac, 0x38da, 0x0e3d, 0x3886, 0x0dc9, 0x3834, 0x0d51, 0x37c7, 0x0cd9, 0x372c, 0x0c65, 0x3697, 0x0bef, 0x360a, 0x0b20, 0x3585, 0x0a62,
|
|
74516
|
+
0x3c00, 0x0031, 0x3c00, 0x0031, 0x3c00, 0x0034, 0x3c00, 0x004b, 0x3bff, 0x006f, 0x3bfe, 0x00c9, 0x3bfc, 0x011b, 0x3bf9, 0x0207, 0x3bf4, 0x02d6, 0x3bec, 0x0415, 0x3be1, 0x0587, 0x3bd2, 0x0703, 0x3bbf, 0x087d, 0x3ba5, 0x096a, 0x3b85, 0x0a59, 0x3b5d, 0x0b32, 0x3b2e, 0x0bee, 0x3af7, 0x0c44, 0x3ab8, 0x0c7c, 0x3a73, 0x0c9c, 0x3a28, 0x0ca4, 0x39d8, 0x0c98, 0x3985, 0x0c77, 0x392f, 0x0c4a, 0x38d9, 0x0c10, 0x3882, 0x0ba0, 0x382e, 0x0b14, 0x37b6, 0x0a84, 0x3717, 0x09f5, 0x3680, 0x0969, 0x35f0, 0x08e6, 0x356a, 0x086a,
|
|
74517
|
+
0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x000d, 0x3bff, 0x0021, 0x3bfe, 0x003b, 0x3bfd, 0x0070, 0x3bf9, 0x00c7, 0x3bf4, 0x012e, 0x3bed, 0x01c8, 0x3be3, 0x0274, 0x3bd4, 0x033b, 0x3bc1, 0x043a, 0x3ba8, 0x0534, 0x3b89, 0x0641, 0x3b62, 0x073b, 0x3b34, 0x0815, 0x3afd, 0x087c, 0x3abf, 0x08d0, 0x3a7a, 0x090a, 0x3a2e, 0x092c, 0x39dd, 0x0936, 0x3988, 0x0928, 0x3930, 0x0907, 0x38d7, 0x08d7, 0x387f, 0x089b, 0x3828, 0x0855, 0x37a7, 0x080b, 0x3704, 0x077b, 0x366a, 0x06e1, 0x35d8, 0x0649, 0x3550, 0x05b8,
|
|
74518
|
+
0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0003, 0x3bff, 0x0012, 0x3bfe, 0x001a, 0x3bfd, 0x0035, 0x3bfa, 0x0050, 0x3bf4, 0x0061, 0x3bed, 0x00a5, 0x3be4, 0x00ee, 0x3bd6, 0x0146, 0x3bc3, 0x01ab, 0x3bab, 0x0211, 0x3b8d, 0x028e, 0x3b67, 0x0303, 0x3b39, 0x0375, 0x3b04, 0x03e2, 0x3ac6, 0x0441, 0x3a80, 0x0492, 0x3a34, 0x04cd, 0x39e1, 0x04f2, 0x398b, 0x0504, 0x3931, 0x0502, 0x38d6, 0x04ec, 0x387c, 0x04c7, 0x3822, 0x0496, 0x3798, 0x045c, 0x36f2, 0x041a, 0x3655, 0x03d5, 0x35c1, 0x038e, 0x3537, 0x0347
|
|
74519
|
+
] );
|
|
74520
|
+
|
|
74521
|
+
let lut = null;
|
|
74522
|
+
|
|
74523
|
+
function getDFGLUT() {
|
|
74524
|
+
|
|
74525
|
+
if ( lut === null ) {
|
|
74526
|
+
|
|
74527
|
+
lut = new DataTexture( DATA, 32, 32, RGFormat, HalfFloatType );
|
|
74528
|
+
lut.minFilter = LinearFilter;
|
|
74529
|
+
lut.magFilter = LinearFilter;
|
|
74530
|
+
lut.wrapS = ClampToEdgeWrapping;
|
|
74531
|
+
lut.wrapT = ClampToEdgeWrapping;
|
|
74532
|
+
lut.generateMipmaps = false;
|
|
74533
|
+
lut.needsUpdate = true;
|
|
74534
|
+
|
|
74535
|
+
}
|
|
74536
|
+
|
|
74537
|
+
return lut;
|
|
74538
|
+
|
|
74539
|
+
}
|
|
74540
|
+
|
|
74040
74541
|
/**
|
|
74041
74542
|
* This renderer uses WebGL 2 to display scenes.
|
|
74042
74543
|
*
|
|
@@ -74093,6 +74594,21 @@ class WebGLRenderer {
|
|
|
74093
74594
|
|
|
74094
74595
|
}
|
|
74095
74596
|
|
|
74597
|
+
const INTEGER_FORMATS = new Set( [
|
|
74598
|
+
RGBAIntegerFormat,
|
|
74599
|
+
RGIntegerFormat,
|
|
74600
|
+
RedIntegerFormat
|
|
74601
|
+
] );
|
|
74602
|
+
|
|
74603
|
+
const UNSIGNED_TYPES = new Set( [
|
|
74604
|
+
UnsignedByteType,
|
|
74605
|
+
UnsignedIntType,
|
|
74606
|
+
UnsignedShortType,
|
|
74607
|
+
UnsignedInt248Type,
|
|
74608
|
+
UnsignedShort4444Type,
|
|
74609
|
+
UnsignedShort5551Type
|
|
74610
|
+
] );
|
|
74611
|
+
|
|
74096
74612
|
const uintClearColor = new Uint32Array( 4 );
|
|
74097
74613
|
const intClearColor = new Int32Array( 4 );
|
|
74098
74614
|
|
|
@@ -74114,7 +74630,7 @@ class WebGLRenderer {
|
|
|
74114
74630
|
* document.body.appendChild( renderer.domElement );
|
|
74115
74631
|
* ```
|
|
74116
74632
|
*
|
|
74117
|
-
* @type {
|
|
74633
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
74118
74634
|
*/
|
|
74119
74635
|
this.domElement = canvas;
|
|
74120
74636
|
|
|
@@ -74367,7 +74883,7 @@ class WebGLRenderer {
|
|
|
74367
74883
|
|
|
74368
74884
|
} catch ( error ) {
|
|
74369
74885
|
|
|
74370
|
-
|
|
74886
|
+
error( 'WebGLRenderer: ' + error.message );
|
|
74371
74887
|
throw error;
|
|
74372
74888
|
|
|
74373
74889
|
}
|
|
@@ -74504,7 +75020,7 @@ class WebGLRenderer {
|
|
|
74504
75020
|
|
|
74505
75021
|
// xr
|
|
74506
75022
|
|
|
74507
|
-
const xr = new WebXRManager( _this, _gl );
|
|
75023
|
+
const xr = new WebXRManager( _this, _gl, extensions, multiviewStereo );
|
|
74508
75024
|
|
|
74509
75025
|
/**
|
|
74510
75026
|
* A reference to the XR manager.
|
|
@@ -74606,7 +75122,7 @@ class WebGLRenderer {
|
|
|
74606
75122
|
|
|
74607
75123
|
if ( xr.isPresenting ) {
|
|
74608
75124
|
|
|
74609
|
-
|
|
75125
|
+
warn( 'WebGLRenderer: Can\'t change size while VR device is presenting.' );
|
|
74610
75126
|
return;
|
|
74611
75127
|
|
|
74612
75128
|
}
|
|
@@ -74868,9 +75384,7 @@ class WebGLRenderer {
|
|
|
74868
75384
|
if ( _currentRenderTarget !== null ) {
|
|
74869
75385
|
|
|
74870
75386
|
const targetFormat = _currentRenderTarget.texture.format;
|
|
74871
|
-
isIntegerFormat = targetFormat
|
|
74872
|
-
targetFormat === RGIntegerFormat ||
|
|
74873
|
-
targetFormat === RedIntegerFormat;
|
|
75387
|
+
isIntegerFormat = INTEGER_FORMATS.has( targetFormat );
|
|
74874
75388
|
|
|
74875
75389
|
}
|
|
74876
75390
|
|
|
@@ -74879,12 +75393,7 @@ class WebGLRenderer {
|
|
|
74879
75393
|
if ( isIntegerFormat ) {
|
|
74880
75394
|
|
|
74881
75395
|
const targetType = _currentRenderTarget.texture.type;
|
|
74882
|
-
const isUnsignedType = targetType
|
|
74883
|
-
targetType === UnsignedIntType ||
|
|
74884
|
-
targetType === UnsignedShortType ||
|
|
74885
|
-
targetType === UnsignedInt248Type ||
|
|
74886
|
-
targetType === UnsignedShort4444Type ||
|
|
74887
|
-
targetType === UnsignedShort5551Type;
|
|
75396
|
+
const isUnsignedType = UNSIGNED_TYPES.has( targetType );
|
|
74888
75397
|
|
|
74889
75398
|
const clearColor = background.getClearColor();
|
|
74890
75399
|
const a = background.getClearAlpha();
|
|
@@ -74998,7 +75507,7 @@ class WebGLRenderer {
|
|
|
74998
75507
|
|
|
74999
75508
|
event.preventDefault();
|
|
75000
75509
|
|
|
75001
|
-
|
|
75510
|
+
log( 'WebGLRenderer: Context Lost.' );
|
|
75002
75511
|
|
|
75003
75512
|
_isContextLost = true;
|
|
75004
75513
|
|
|
@@ -75006,7 +75515,7 @@ class WebGLRenderer {
|
|
|
75006
75515
|
|
|
75007
75516
|
function onContextRestore( /* event */ ) {
|
|
75008
75517
|
|
|
75009
|
-
|
|
75518
|
+
log( 'WebGLRenderer: Context Restored.' );
|
|
75010
75519
|
|
|
75011
75520
|
_isContextLost = false;
|
|
75012
75521
|
|
|
@@ -75028,7 +75537,7 @@ class WebGLRenderer {
|
|
|
75028
75537
|
|
|
75029
75538
|
function onContextCreationError( event ) {
|
|
75030
75539
|
|
|
75031
|
-
|
|
75540
|
+
error( 'WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );
|
|
75032
75541
|
|
|
75033
75542
|
}
|
|
75034
75543
|
|
|
@@ -75201,7 +75710,7 @@ class WebGLRenderer {
|
|
|
75201
75710
|
if ( object._multiDrawInstances !== null ) {
|
|
75202
75711
|
|
|
75203
75712
|
// @deprecated, r174
|
|
75204
|
-
warnOnce( '
|
|
75713
|
+
warnOnce( 'WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
|
|
75205
75714
|
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
75206
75715
|
|
|
75207
75716
|
} else {
|
|
@@ -75477,6 +75986,13 @@ class WebGLRenderer {
|
|
|
75477
75986
|
|
|
75478
75987
|
if ( typeof self !== 'undefined' ) animation.setContext( self );
|
|
75479
75988
|
|
|
75989
|
+
/**
|
|
75990
|
+
* Applications are advised to always define the animation loop
|
|
75991
|
+
* with this method and not manually with `requestAnimationFrame()`
|
|
75992
|
+
* for best compatibility.
|
|
75993
|
+
*
|
|
75994
|
+
* @param {?onAnimationCallback} callback - The application's animation loop.
|
|
75995
|
+
*/
|
|
75480
75996
|
this.setAnimationLoop = function ( callback ) {
|
|
75481
75997
|
|
|
75482
75998
|
onAnimationFrameCallback = callback;
|
|
@@ -75509,7 +76025,7 @@ class WebGLRenderer {
|
|
|
75509
76025
|
|
|
75510
76026
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
75511
76027
|
|
|
75512
|
-
|
|
76028
|
+
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
75513
76029
|
return;
|
|
75514
76030
|
|
|
75515
76031
|
}
|
|
@@ -75667,6 +76183,8 @@ class WebGLRenderer {
|
|
|
75667
76183
|
|
|
75668
76184
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
75669
76185
|
|
|
76186
|
+
textures.runDeferredUploads();
|
|
76187
|
+
|
|
75670
76188
|
// _gl.finish();
|
|
75671
76189
|
|
|
75672
76190
|
bindingStates.resetDefaultState();
|
|
@@ -75817,9 +76335,7 @@ class WebGLRenderer {
|
|
|
75817
76335
|
|
|
75818
76336
|
function renderScene( currentRenderList, scene, camera, viewport ) {
|
|
75819
76337
|
|
|
75820
|
-
const opaqueObjects = currentRenderList
|
|
75821
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
75822
|
-
const transparentObjects = currentRenderList.transparent;
|
|
76338
|
+
const { opaque: opaqueObjects, transmissive: transmissiveObjects, transparent: transparentObjects } = currentRenderList;
|
|
75823
76339
|
|
|
75824
76340
|
currentRenderState.setupLightsView( camera );
|
|
75825
76341
|
|
|
@@ -75924,10 +76440,7 @@ class WebGLRenderer {
|
|
|
75924
76440
|
|
|
75925
76441
|
const renderItem = transmissiveObjects[ i ];
|
|
75926
76442
|
|
|
75927
|
-
const object = renderItem
|
|
75928
|
-
const geometry = renderItem.geometry;
|
|
75929
|
-
const material = renderItem.material;
|
|
75930
|
-
const group = renderItem.group;
|
|
76443
|
+
const { object, geometry, material, group } = renderItem;
|
|
75931
76444
|
|
|
75932
76445
|
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
75933
76446
|
|
|
@@ -75974,9 +76487,7 @@ class WebGLRenderer {
|
|
|
75974
76487
|
|
|
75975
76488
|
const renderItem = renderList[ i ];
|
|
75976
76489
|
|
|
75977
|
-
const object = renderItem
|
|
75978
|
-
const geometry = renderItem.geometry;
|
|
75979
|
-
const group = renderItem.group;
|
|
76490
|
+
const { object, geometry, group } = renderItem;
|
|
75980
76491
|
let material = renderItem.material;
|
|
75981
76492
|
|
|
75982
76493
|
if ( material.allowOverride === true && overrideMaterial !== null ) {
|
|
@@ -76515,6 +77026,13 @@ class WebGLRenderer {
|
|
|
76515
77026
|
|
|
76516
77027
|
}
|
|
76517
77028
|
|
|
77029
|
+
// Set DFG LUT for physically-based materials
|
|
77030
|
+
if ( m_uniforms.dfgLUT !== undefined ) {
|
|
77031
|
+
|
|
77032
|
+
m_uniforms.dfgLUT.value = getDFGLUT();
|
|
77033
|
+
|
|
77034
|
+
}
|
|
77035
|
+
|
|
76518
77036
|
if ( refreshMaterial ) {
|
|
76519
77037
|
|
|
76520
77038
|
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
|
@@ -76688,7 +77206,7 @@ class WebGLRenderer {
|
|
|
76688
77206
|
const renderTargetProperties = properties.get( renderTarget );
|
|
76689
77207
|
|
|
76690
77208
|
renderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;
|
|
76691
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer
|
|
77209
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
76692
77210
|
|
|
76693
77211
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
76694
77212
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -76903,7 +77421,7 @@ class WebGLRenderer {
|
|
|
76903
77421
|
|
|
76904
77422
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
76905
77423
|
|
|
76906
|
-
|
|
77424
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
76907
77425
|
return;
|
|
76908
77426
|
|
|
76909
77427
|
}
|
|
@@ -76928,14 +77446,14 @@ class WebGLRenderer {
|
|
|
76928
77446
|
|
|
76929
77447
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
76930
77448
|
|
|
76931
|
-
|
|
77449
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
76932
77450
|
return;
|
|
76933
77451
|
|
|
76934
77452
|
}
|
|
76935
77453
|
|
|
76936
77454
|
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
76937
77455
|
|
|
76938
|
-
|
|
77456
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
76939
77457
|
return;
|
|
76940
77458
|
|
|
76941
77459
|
}
|
|
@@ -77351,15 +77869,6 @@ class WebGLRenderer {
|
|
|
77351
77869
|
|
|
77352
77870
|
};
|
|
77353
77871
|
|
|
77354
|
-
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
77355
|
-
|
|
77356
|
-
// @deprecated, r170
|
|
77357
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
77358
|
-
|
|
77359
|
-
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
77360
|
-
|
|
77361
|
-
};
|
|
77362
|
-
|
|
77363
77872
|
/**
|
|
77364
77873
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
77365
77874
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
@@ -77583,6 +78092,7 @@ exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
|
|
|
77583
78092
|
exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
|
|
77584
78093
|
exports.Euler = Euler;
|
|
77585
78094
|
exports.EventDispatcher = EventDispatcher;
|
|
78095
|
+
exports.ExternalTexture = ExternalTexture;
|
|
77586
78096
|
exports.ExtrudeGeometry = ExtrudeGeometry;
|
|
77587
78097
|
exports.FileLoader = FileLoader;
|
|
77588
78098
|
exports.Float16BufferAttribute = Float16BufferAttribute;
|
|
@@ -77861,6 +78371,7 @@ exports.UniformsGroup = UniformsGroup;
|
|
|
77861
78371
|
exports.UniformsLib = UniformsLib;
|
|
77862
78372
|
exports.UniformsUtils = UniformsUtils;
|
|
77863
78373
|
exports.UnsignedByteType = UnsignedByteType;
|
|
78374
|
+
exports.UnsignedInt101111Type = UnsignedInt101111Type;
|
|
77864
78375
|
exports.UnsignedInt248Type = UnsignedInt248Type;
|
|
77865
78376
|
exports.UnsignedInt5999Type = UnsignedInt5999Type;
|
|
77866
78377
|
exports.UnsignedIntType = UnsignedIntType;
|
|
@@ -77890,3 +78401,9 @@ exports.ZeroFactor = ZeroFactor;
|
|
|
77890
78401
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
77891
78402
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
77892
78403
|
exports.createCanvasElement = createCanvasElement;
|
|
78404
|
+
exports.error = error;
|
|
78405
|
+
exports.getConsoleFunction = getConsoleFunction;
|
|
78406
|
+
exports.log = log;
|
|
78407
|
+
exports.setConsoleFunction = setConsoleFunction;
|
|
78408
|
+
exports.warn = warn;
|
|
78409
|
+
exports.warnOnce = warnOnce;
|