@plastic-software/three 0.179.0 → 0.181.1
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 +1108 -591
- package/build/three.core.js +616 -345
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +488 -250
- 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 +6576 -2152
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6575 -2151
- 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 +48 -41
- 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 +2 -1
- 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 +42 -26
- 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.
|
|
@@ -731,6 +731,14 @@ const UnsignedInt248Type = 1020;
|
|
|
731
731
|
*/
|
|
732
732
|
const UnsignedInt5999Type = 35902;
|
|
733
733
|
|
|
734
|
+
/**
|
|
735
|
+
* An unsigned int 10_11_11 (packed) data type for textures.
|
|
736
|
+
*
|
|
737
|
+
* @type {number}
|
|
738
|
+
* @constant
|
|
739
|
+
*/
|
|
740
|
+
const UnsignedInt101111Type = 35899;
|
|
741
|
+
|
|
734
742
|
/**
|
|
735
743
|
* Discards the red, green and blue components and reads just the alpha component.
|
|
736
744
|
*
|
|
@@ -1672,14 +1680,165 @@ const InterpolationSamplingMode = {
|
|
|
1672
1680
|
* @property {string} NORMAL - Normal sampling mode.
|
|
1673
1681
|
* @property {string} CENTROID - Centroid sampling mode.
|
|
1674
1682
|
* @property {string} SAMPLE - Sample-specific sampling mode.
|
|
1675
|
-
* @property {string}
|
|
1676
|
-
* @property {string}
|
|
1683
|
+
* @property {string} FIRST - Flat interpolation using the first vertex.
|
|
1684
|
+
* @property {string} EITHER - Flat interpolation using either vertex.
|
|
1677
1685
|
*/
|
|
1678
1686
|
|
|
1687
|
+
function arrayNeedsUint32( array ) {
|
|
1688
|
+
|
|
1689
|
+
// assumes larger values usually on last
|
|
1690
|
+
|
|
1691
|
+
for ( let i = array.length - 1; i >= 0; -- i ) {
|
|
1692
|
+
|
|
1693
|
+
if ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
|
|
1694
|
+
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
return false;
|
|
1698
|
+
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
const TYPED_ARRAYS = {
|
|
1702
|
+
Int8Array: Int8Array,
|
|
1703
|
+
Uint8Array: Uint8Array,
|
|
1704
|
+
Uint8ClampedArray: Uint8ClampedArray,
|
|
1705
|
+
Int16Array: Int16Array,
|
|
1706
|
+
Uint16Array: Uint16Array,
|
|
1707
|
+
Int32Array: Int32Array,
|
|
1708
|
+
Uint32Array: Uint32Array,
|
|
1709
|
+
Float32Array: Float32Array,
|
|
1710
|
+
Float64Array: Float64Array
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
function getTypedArray( type, buffer ) {
|
|
1714
|
+
|
|
1715
|
+
return new TYPED_ARRAYS[ type ]( buffer );
|
|
1716
|
+
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
function createElementNS( name ) {
|
|
1720
|
+
|
|
1721
|
+
return document.createElementNS( 'http://www.w3.org/1999/xhtml', name );
|
|
1722
|
+
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
function createCanvasElement() {
|
|
1726
|
+
|
|
1727
|
+
const canvas = createElementNS( 'canvas' );
|
|
1728
|
+
canvas.style.display = 'block';
|
|
1729
|
+
return canvas;
|
|
1730
|
+
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
const _cache = {};
|
|
1734
|
+
|
|
1735
|
+
let _setConsoleFunction = null;
|
|
1736
|
+
|
|
1737
|
+
function setConsoleFunction( fn ) {
|
|
1738
|
+
|
|
1739
|
+
_setConsoleFunction = fn;
|
|
1740
|
+
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
function getConsoleFunction() {
|
|
1744
|
+
|
|
1745
|
+
return _setConsoleFunction;
|
|
1746
|
+
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
function log( ...params ) {
|
|
1750
|
+
|
|
1751
|
+
const message = 'THREE.' + params.shift();
|
|
1752
|
+
|
|
1753
|
+
if ( _setConsoleFunction ) {
|
|
1754
|
+
|
|
1755
|
+
_setConsoleFunction( 'log', message, ...params );
|
|
1756
|
+
|
|
1757
|
+
} else {
|
|
1758
|
+
|
|
1759
|
+
console.log( message, ...params );
|
|
1760
|
+
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
function warn( ...params ) {
|
|
1766
|
+
|
|
1767
|
+
const message = 'THREE.' + params.shift();
|
|
1768
|
+
|
|
1769
|
+
if ( _setConsoleFunction ) {
|
|
1770
|
+
|
|
1771
|
+
_setConsoleFunction( 'warn', message, ...params );
|
|
1772
|
+
|
|
1773
|
+
} else {
|
|
1774
|
+
|
|
1775
|
+
console.warn( message, ...params );
|
|
1776
|
+
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
function error( ...params ) {
|
|
1782
|
+
|
|
1783
|
+
const message = 'THREE.' + params.shift();
|
|
1784
|
+
|
|
1785
|
+
if ( _setConsoleFunction ) {
|
|
1786
|
+
|
|
1787
|
+
_setConsoleFunction( 'error', message, ...params );
|
|
1788
|
+
|
|
1789
|
+
} else {
|
|
1790
|
+
|
|
1791
|
+
console.error( message, ...params );
|
|
1792
|
+
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
function warnOnce( ...params ) {
|
|
1798
|
+
|
|
1799
|
+
const message = params.join( ' ' );
|
|
1800
|
+
|
|
1801
|
+
if ( message in _cache ) return;
|
|
1802
|
+
|
|
1803
|
+
_cache[ message ] = true;
|
|
1804
|
+
|
|
1805
|
+
warn( ...params );
|
|
1806
|
+
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
function probeAsync( gl, sync, interval ) {
|
|
1810
|
+
|
|
1811
|
+
return new Promise( function ( resolve, reject ) {
|
|
1812
|
+
|
|
1813
|
+
function probe() {
|
|
1814
|
+
|
|
1815
|
+
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
1816
|
+
|
|
1817
|
+
case gl.WAIT_FAILED:
|
|
1818
|
+
reject();
|
|
1819
|
+
break;
|
|
1820
|
+
|
|
1821
|
+
case gl.TIMEOUT_EXPIRED:
|
|
1822
|
+
setTimeout( probe, interval );
|
|
1823
|
+
break;
|
|
1824
|
+
|
|
1825
|
+
default:
|
|
1826
|
+
resolve();
|
|
1827
|
+
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
setTimeout( probe, interval );
|
|
1833
|
+
|
|
1834
|
+
} );
|
|
1835
|
+
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1679
1838
|
/**
|
|
1680
1839
|
* This modules allows to dispatch event objects on custom JavaScript objects.
|
|
1681
1840
|
*
|
|
1682
|
-
* Main repository: [eventdispatcher.js]
|
|
1841
|
+
* Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/)
|
|
1683
1842
|
*
|
|
1684
1843
|
* Code Example:
|
|
1685
1844
|
* ```js
|
|
@@ -1814,7 +1973,7 @@ const DEG2RAD = Math.PI / 180;
|
|
|
1814
1973
|
const RAD2DEG = 180 / Math.PI;
|
|
1815
1974
|
|
|
1816
1975
|
/**
|
|
1817
|
-
* Generate a [UUID]
|
|
1976
|
+
* Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
1818
1977
|
* (universally unique identifier).
|
|
1819
1978
|
*
|
|
1820
1979
|
* @return {string} The UUID.
|
|
@@ -1927,7 +2086,7 @@ function lerp( x, y, t ) {
|
|
|
1927
2086
|
/**
|
|
1928
2087
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
1929
2088
|
* time to maintain frame rate independent movement. For details, see
|
|
1930
|
-
* [Frame rate independent damping using lerp]
|
|
2089
|
+
* [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
1931
2090
|
*
|
|
1932
2091
|
* @param {number} x - The current point.
|
|
1933
2092
|
* @param {number} y - The target point.
|
|
@@ -1962,7 +2121,7 @@ function pingpong( x, length = 1 ) {
|
|
|
1962
2121
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
1963
2122
|
* the `min` and `max`.
|
|
1964
2123
|
*
|
|
1965
|
-
* See [Smoothstep]
|
|
2124
|
+
* See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
1966
2125
|
*
|
|
1967
2126
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
1968
2127
|
* @param {number} min - The min value. Any x value below min will be `0`.
|
|
@@ -1981,7 +2140,7 @@ function smoothstep( x, min, max ) {
|
|
|
1981
2140
|
}
|
|
1982
2141
|
|
|
1983
2142
|
/**
|
|
1984
|
-
* A [variation on smoothstep]
|
|
2143
|
+
* A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
1985
2144
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
1986
2145
|
*
|
|
1987
2146
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
@@ -2121,7 +2280,7 @@ function floorPowerOfTwo( value ) {
|
|
|
2121
2280
|
}
|
|
2122
2281
|
|
|
2123
2282
|
/**
|
|
2124
|
-
* Sets the given quaternion from the [Intrinsic Proper Euler Angles]
|
|
2283
|
+
* Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
2125
2284
|
* defined by the given angles and order.
|
|
2126
2285
|
*
|
|
2127
2286
|
* Rotations are applied to the axes in the order specified by order:
|
|
@@ -2177,7 +2336,7 @@ function setQuaternionFromProperEuler( q, a, b, c, order ) {
|
|
|
2177
2336
|
break;
|
|
2178
2337
|
|
|
2179
2338
|
default:
|
|
2180
|
-
|
|
2339
|
+
warn( 'MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );
|
|
2181
2340
|
|
|
2182
2341
|
}
|
|
2183
2342
|
|
|
@@ -2286,7 +2445,7 @@ const MathUtils = {
|
|
|
2286
2445
|
DEG2RAD: DEG2RAD,
|
|
2287
2446
|
RAD2DEG: RAD2DEG,
|
|
2288
2447
|
/**
|
|
2289
|
-
* Generate a [UUID]
|
|
2448
|
+
* Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
2290
2449
|
* (universally unique identifier).
|
|
2291
2450
|
*
|
|
2292
2451
|
* @static
|
|
@@ -2357,7 +2516,7 @@ const MathUtils = {
|
|
|
2357
2516
|
/**
|
|
2358
2517
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
2359
2518
|
* time to maintain frame rate independent movement. For details, see
|
|
2360
|
-
* [Frame rate independent damping using lerp]
|
|
2519
|
+
* [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
2361
2520
|
*
|
|
2362
2521
|
* @static
|
|
2363
2522
|
* @method
|
|
@@ -2384,7 +2543,7 @@ const MathUtils = {
|
|
|
2384
2543
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
2385
2544
|
* the `min` and `max`.
|
|
2386
2545
|
*
|
|
2387
|
-
* See [Smoothstep]
|
|
2546
|
+
* See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
2388
2547
|
*
|
|
2389
2548
|
* @static
|
|
2390
2549
|
* @method
|
|
@@ -2395,7 +2554,7 @@ const MathUtils = {
|
|
|
2395
2554
|
*/
|
|
2396
2555
|
smoothstep: smoothstep,
|
|
2397
2556
|
/**
|
|
2398
|
-
* A [variation on smoothstep]
|
|
2557
|
+
* A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
2399
2558
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
2400
2559
|
*
|
|
2401
2560
|
* @static
|
|
@@ -2490,7 +2649,7 @@ const MathUtils = {
|
|
|
2490
2649
|
*/
|
|
2491
2650
|
floorPowerOfTwo: floorPowerOfTwo,
|
|
2492
2651
|
/**
|
|
2493
|
-
* Sets the given quaternion from the [Intrinsic Proper Euler Angles]
|
|
2652
|
+
* Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
2494
2653
|
* defined by the given angles and order.
|
|
2495
2654
|
*
|
|
2496
2655
|
* Rotations are applied to the axes in the order specified by order:
|
|
@@ -3435,7 +3594,7 @@ class Quaternion {
|
|
|
3435
3594
|
|
|
3436
3595
|
/**
|
|
3437
3596
|
* Interpolates between two quaternions via SLERP. This implementation assumes the
|
|
3438
|
-
* quaternion data are managed
|
|
3597
|
+
* quaternion data are managed in flat arrays.
|
|
3439
3598
|
*
|
|
3440
3599
|
* @param {Array<number>} dst - The destination array.
|
|
3441
3600
|
* @param {number} dstOffset - An offset into the destination array.
|
|
@@ -3448,65 +3607,78 @@ class Quaternion {
|
|
|
3448
3607
|
*/
|
|
3449
3608
|
static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
|
|
3450
3609
|
|
|
3451
|
-
// fuzz-free, array-based Quaternion SLERP operation
|
|
3452
|
-
|
|
3453
3610
|
let x0 = src0[ srcOffset0 + 0 ],
|
|
3454
3611
|
y0 = src0[ srcOffset0 + 1 ],
|
|
3455
3612
|
z0 = src0[ srcOffset0 + 2 ],
|
|
3456
3613
|
w0 = src0[ srcOffset0 + 3 ];
|
|
3457
3614
|
|
|
3458
|
-
|
|
3615
|
+
let x1 = src1[ srcOffset1 + 0 ],
|
|
3459
3616
|
y1 = src1[ srcOffset1 + 1 ],
|
|
3460
3617
|
z1 = src1[ srcOffset1 + 2 ],
|
|
3461
3618
|
w1 = src1[ srcOffset1 + 3 ];
|
|
3462
3619
|
|
|
3463
|
-
if ( t
|
|
3620
|
+
if ( t <= 0 ) {
|
|
3464
3621
|
|
|
3465
3622
|
dst[ dstOffset + 0 ] = x0;
|
|
3466
3623
|
dst[ dstOffset + 1 ] = y0;
|
|
3467
3624
|
dst[ dstOffset + 2 ] = z0;
|
|
3468
3625
|
dst[ dstOffset + 3 ] = w0;
|
|
3626
|
+
|
|
3469
3627
|
return;
|
|
3470
3628
|
|
|
3471
3629
|
}
|
|
3472
3630
|
|
|
3473
|
-
if ( t
|
|
3631
|
+
if ( t >= 1 ) {
|
|
3474
3632
|
|
|
3475
3633
|
dst[ dstOffset + 0 ] = x1;
|
|
3476
3634
|
dst[ dstOffset + 1 ] = y1;
|
|
3477
3635
|
dst[ dstOffset + 2 ] = z1;
|
|
3478
3636
|
dst[ dstOffset + 3 ] = w1;
|
|
3637
|
+
|
|
3479
3638
|
return;
|
|
3480
3639
|
|
|
3481
3640
|
}
|
|
3482
3641
|
|
|
3483
3642
|
if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {
|
|
3484
3643
|
|
|
3485
|
-
let
|
|
3486
|
-
const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
|
|
3487
|
-
dir = ( cos >= 0 ? 1 : -1 ),
|
|
3488
|
-
sqrSin = 1 - cos * cos;
|
|
3644
|
+
let dot = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1;
|
|
3489
3645
|
|
|
3490
|
-
|
|
3491
|
-
if ( sqrSin > Number.EPSILON ) {
|
|
3646
|
+
if ( dot < 0 ) {
|
|
3492
3647
|
|
|
3493
|
-
|
|
3494
|
-
|
|
3648
|
+
x1 = - x1;
|
|
3649
|
+
y1 = - y1;
|
|
3650
|
+
z1 = - z1;
|
|
3651
|
+
w1 = - w1;
|
|
3495
3652
|
|
|
3496
|
-
|
|
3497
|
-
t = Math.sin( t * len ) / sin;
|
|
3653
|
+
dot = - dot;
|
|
3498
3654
|
|
|
3499
3655
|
}
|
|
3500
3656
|
|
|
3501
|
-
|
|
3657
|
+
let s = 1 - t;
|
|
3502
3658
|
|
|
3503
|
-
|
|
3504
|
-
y0 = y0 * s + y1 * tDir;
|
|
3505
|
-
z0 = z0 * s + z1 * tDir;
|
|
3506
|
-
w0 = w0 * s + w1 * tDir;
|
|
3659
|
+
if ( dot < 0.9995 ) {
|
|
3507
3660
|
|
|
3508
|
-
|
|
3509
|
-
|
|
3661
|
+
// slerp
|
|
3662
|
+
|
|
3663
|
+
const theta = Math.acos( dot );
|
|
3664
|
+
const sin = Math.sin( theta );
|
|
3665
|
+
|
|
3666
|
+
s = Math.sin( s * theta ) / sin;
|
|
3667
|
+
t = Math.sin( t * theta ) / sin;
|
|
3668
|
+
|
|
3669
|
+
x0 = x0 * s + x1 * t;
|
|
3670
|
+
y0 = y0 * s + y1 * t;
|
|
3671
|
+
z0 = z0 * s + z1 * t;
|
|
3672
|
+
w0 = w0 * s + w1 * t;
|
|
3673
|
+
|
|
3674
|
+
} else {
|
|
3675
|
+
|
|
3676
|
+
// for small angles, lerp then normalize
|
|
3677
|
+
|
|
3678
|
+
x0 = x0 * s + x1 * t;
|
|
3679
|
+
y0 = y0 * s + y1 * t;
|
|
3680
|
+
z0 = z0 * s + z1 * t;
|
|
3681
|
+
w0 = w0 * s + w1 * t;
|
|
3510
3682
|
|
|
3511
3683
|
const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );
|
|
3512
3684
|
|
|
@@ -3760,7 +3932,7 @@ class Quaternion {
|
|
|
3760
3932
|
break;
|
|
3761
3933
|
|
|
3762
3934
|
default:
|
|
3763
|
-
|
|
3935
|
+
warn( 'Quaternion: .setFromEuler() encountered an unknown order: ' + order );
|
|
3764
3936
|
|
|
3765
3937
|
}
|
|
3766
3938
|
|
|
@@ -4116,68 +4288,56 @@ class Quaternion {
|
|
|
4116
4288
|
*/
|
|
4117
4289
|
slerp( qb, t ) {
|
|
4118
4290
|
|
|
4119
|
-
if ( t
|
|
4120
|
-
if ( t === 1 ) return this.copy( qb );
|
|
4291
|
+
if ( t <= 0 ) return this;
|
|
4121
4292
|
|
|
4122
|
-
|
|
4293
|
+
if ( t >= 1 ) return this.copy( qb ); // copy calls _onChangeCallback()
|
|
4123
4294
|
|
|
4124
|
-
|
|
4295
|
+
let x = qb._x, y = qb._y, z = qb._z, w = qb._w;
|
|
4125
4296
|
|
|
4126
|
-
let
|
|
4297
|
+
let dot = this.dot( qb );
|
|
4127
4298
|
|
|
4128
|
-
if (
|
|
4299
|
+
if ( dot < 0 ) {
|
|
4129
4300
|
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4301
|
+
x = - x;
|
|
4302
|
+
y = - y;
|
|
4303
|
+
z = - z;
|
|
4304
|
+
w = - w;
|
|
4134
4305
|
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
} else {
|
|
4138
|
-
|
|
4139
|
-
this.copy( qb );
|
|
4306
|
+
dot = - dot;
|
|
4140
4307
|
|
|
4141
4308
|
}
|
|
4142
4309
|
|
|
4143
|
-
|
|
4310
|
+
let s = 1 - t;
|
|
4144
4311
|
|
|
4145
|
-
|
|
4146
|
-
this._x = x;
|
|
4147
|
-
this._y = y;
|
|
4148
|
-
this._z = z;
|
|
4149
|
-
|
|
4150
|
-
return this;
|
|
4312
|
+
if ( dot < 0.9995 ) {
|
|
4151
4313
|
|
|
4152
|
-
|
|
4314
|
+
// slerp
|
|
4153
4315
|
|
|
4154
|
-
|
|
4316
|
+
const theta = Math.acos( dot );
|
|
4317
|
+
const sin = Math.sin( theta );
|
|
4155
4318
|
|
|
4156
|
-
|
|
4319
|
+
s = Math.sin( s * theta ) / sin;
|
|
4320
|
+
t = Math.sin( t * theta ) / sin;
|
|
4157
4321
|
|
|
4158
|
-
|
|
4159
|
-
this.
|
|
4160
|
-
this.
|
|
4161
|
-
this.
|
|
4162
|
-
this._z = s * z + t * this._z;
|
|
4322
|
+
this._x = this._x * s + x * t;
|
|
4323
|
+
this._y = this._y * s + y * t;
|
|
4324
|
+
this._z = this._z * s + z * t;
|
|
4325
|
+
this._w = this._w * s + w * t;
|
|
4163
4326
|
|
|
4164
|
-
this.
|
|
4327
|
+
this._onChangeCallback();
|
|
4165
4328
|
|
|
4166
|
-
|
|
4329
|
+
} else {
|
|
4167
4330
|
|
|
4168
|
-
|
|
4331
|
+
// for small angles, lerp then normalize
|
|
4169
4332
|
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4333
|
+
this._x = this._x * s + x * t;
|
|
4334
|
+
this._y = this._y * s + y * t;
|
|
4335
|
+
this._z = this._z * s + z * t;
|
|
4336
|
+
this._w = this._w * s + w * t;
|
|
4174
4337
|
|
|
4175
|
-
|
|
4176
|
-
this._x = ( x * ratioA + this._x * ratioB );
|
|
4177
|
-
this._y = ( y * ratioA + this._y * ratioB );
|
|
4178
|
-
this._z = ( z * ratioA + this._z * ratioB );
|
|
4338
|
+
this.normalize(); // normalize calls _onChangeCallback()
|
|
4179
4339
|
|
|
4180
|
-
|
|
4340
|
+
}
|
|
4181
4341
|
|
|
4182
4342
|
return this;
|
|
4183
4343
|
|
|
@@ -5592,7 +5752,7 @@ const _quaternion$4 = /*@__PURE__*/ new Quaternion();
|
|
|
5592
5752
|
* A Note on Row-Major and Column-Major Ordering:
|
|
5593
5753
|
*
|
|
5594
5754
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
5595
|
-
* [row-major]
|
|
5755
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
5596
5756
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
5597
5757
|
* This means that calling:
|
|
5598
5758
|
* ```js
|
|
@@ -5866,7 +6026,7 @@ class Matrix3 {
|
|
|
5866
6026
|
}
|
|
5867
6027
|
|
|
5868
6028
|
/**
|
|
5869
|
-
* Inverts this matrix, using the [analytic method]
|
|
6029
|
+
* Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
5870
6030
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
5871
6031
|
* a zero matrix instead.
|
|
5872
6032
|
*
|
|
@@ -6198,93 +6358,6 @@ class Matrix3 {
|
|
|
6198
6358
|
|
|
6199
6359
|
const _m3 = /*@__PURE__*/ new Matrix3();
|
|
6200
6360
|
|
|
6201
|
-
function arrayNeedsUint32( array ) {
|
|
6202
|
-
|
|
6203
|
-
// assumes larger values usually on last
|
|
6204
|
-
|
|
6205
|
-
for ( let i = array.length - 1; i >= 0; -- i ) {
|
|
6206
|
-
|
|
6207
|
-
if ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
|
|
6208
|
-
|
|
6209
|
-
}
|
|
6210
|
-
|
|
6211
|
-
return false;
|
|
6212
|
-
|
|
6213
|
-
}
|
|
6214
|
-
|
|
6215
|
-
const TYPED_ARRAYS = {
|
|
6216
|
-
Int8Array: Int8Array,
|
|
6217
|
-
Uint8Array: Uint8Array,
|
|
6218
|
-
Uint8ClampedArray: Uint8ClampedArray,
|
|
6219
|
-
Int16Array: Int16Array,
|
|
6220
|
-
Uint16Array: Uint16Array,
|
|
6221
|
-
Int32Array: Int32Array,
|
|
6222
|
-
Uint32Array: Uint32Array,
|
|
6223
|
-
Float32Array: Float32Array,
|
|
6224
|
-
Float64Array: Float64Array
|
|
6225
|
-
};
|
|
6226
|
-
|
|
6227
|
-
function getTypedArray( type, buffer ) {
|
|
6228
|
-
|
|
6229
|
-
return new TYPED_ARRAYS[ type ]( buffer );
|
|
6230
|
-
|
|
6231
|
-
}
|
|
6232
|
-
|
|
6233
|
-
function createElementNS( name ) {
|
|
6234
|
-
|
|
6235
|
-
return document.createElementNS( 'http://www.w3.org/1999/xhtml', name );
|
|
6236
|
-
|
|
6237
|
-
}
|
|
6238
|
-
|
|
6239
|
-
function createCanvasElement() {
|
|
6240
|
-
|
|
6241
|
-
const canvas = createElementNS( 'canvas' );
|
|
6242
|
-
canvas.style.display = 'block';
|
|
6243
|
-
return canvas;
|
|
6244
|
-
|
|
6245
|
-
}
|
|
6246
|
-
|
|
6247
|
-
const _cache = {};
|
|
6248
|
-
|
|
6249
|
-
function warnOnce( message ) {
|
|
6250
|
-
|
|
6251
|
-
if ( message in _cache ) return;
|
|
6252
|
-
|
|
6253
|
-
_cache[ message ] = true;
|
|
6254
|
-
|
|
6255
|
-
console.warn( message );
|
|
6256
|
-
|
|
6257
|
-
}
|
|
6258
|
-
|
|
6259
|
-
function probeAsync( gl, sync, interval ) {
|
|
6260
|
-
|
|
6261
|
-
return new Promise( function ( resolve, reject ) {
|
|
6262
|
-
|
|
6263
|
-
function probe() {
|
|
6264
|
-
|
|
6265
|
-
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
6266
|
-
|
|
6267
|
-
case gl.WAIT_FAILED:
|
|
6268
|
-
reject();
|
|
6269
|
-
break;
|
|
6270
|
-
|
|
6271
|
-
case gl.TIMEOUT_EXPIRED:
|
|
6272
|
-
setTimeout( probe, interval );
|
|
6273
|
-
break;
|
|
6274
|
-
|
|
6275
|
-
default:
|
|
6276
|
-
resolve();
|
|
6277
|
-
|
|
6278
|
-
}
|
|
6279
|
-
|
|
6280
|
-
}
|
|
6281
|
-
|
|
6282
|
-
setTimeout( probe, interval );
|
|
6283
|
-
|
|
6284
|
-
} );
|
|
6285
|
-
|
|
6286
|
-
}
|
|
6287
|
-
|
|
6288
6361
|
const LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(
|
|
6289
6362
|
0.4123908, 0.3575843, 0.1804808,
|
|
6290
6363
|
0.2126390, 0.7151687, 0.0721923,
|
|
@@ -6317,7 +6390,7 @@ function createColorManagement() {
|
|
|
6317
6390
|
* - luminanceCoefficients: RGB luminance coefficients
|
|
6318
6391
|
*
|
|
6319
6392
|
* Optional:
|
|
6320
|
-
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace }
|
|
6393
|
+
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }
|
|
6321
6394
|
* - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }
|
|
6322
6395
|
*
|
|
6323
6396
|
* Reference:
|
|
@@ -6386,6 +6459,12 @@ function createColorManagement() {
|
|
|
6386
6459
|
|
|
6387
6460
|
},
|
|
6388
6461
|
|
|
6462
|
+
getToneMappingMode: function ( colorSpace ) {
|
|
6463
|
+
|
|
6464
|
+
return this.spaces[ colorSpace ].outputColorSpaceConfig.toneMappingMode || 'standard';
|
|
6465
|
+
|
|
6466
|
+
},
|
|
6467
|
+
|
|
6389
6468
|
getLuminanceCoefficients: function ( target, colorSpace = this.workingColorSpace ) {
|
|
6390
6469
|
|
|
6391
6470
|
return target.fromArray( this.spaces[ colorSpace ].luminanceCoefficients );
|
|
@@ -6424,7 +6503,7 @@ function createColorManagement() {
|
|
|
6424
6503
|
|
|
6425
6504
|
fromWorkingColorSpace: function ( color, targetColorSpace ) {
|
|
6426
6505
|
|
|
6427
|
-
warnOnce( '
|
|
6506
|
+
warnOnce( 'ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().' ); // @deprecated, r177
|
|
6428
6507
|
|
|
6429
6508
|
return ColorManagement.workingToColorSpace( color, targetColorSpace );
|
|
6430
6509
|
|
|
@@ -6432,7 +6511,7 @@ function createColorManagement() {
|
|
|
6432
6511
|
|
|
6433
6512
|
toWorkingColorSpace: function ( color, sourceColorSpace ) {
|
|
6434
6513
|
|
|
6435
|
-
warnOnce( '
|
|
6514
|
+
warnOnce( 'ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().' ); // @deprecated, r177
|
|
6436
6515
|
|
|
6437
6516
|
return ColorManagement.colorSpaceToWorking( color, sourceColorSpace );
|
|
6438
6517
|
|
|
@@ -6615,7 +6694,7 @@ class ImageUtils {
|
|
|
6615
6694
|
|
|
6616
6695
|
} else {
|
|
6617
6696
|
|
|
6618
|
-
|
|
6697
|
+
warn( 'ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );
|
|
6619
6698
|
return image;
|
|
6620
6699
|
|
|
6621
6700
|
}
|
|
@@ -6706,7 +6785,7 @@ class Source {
|
|
|
6706
6785
|
|
|
6707
6786
|
const data = this.data;
|
|
6708
6787
|
|
|
6709
|
-
if ( data instanceof HTMLVideoElement ) {
|
|
6788
|
+
if ( ( typeof HTMLVideoElement !== 'undefined' ) && ( data instanceof HTMLVideoElement ) ) {
|
|
6710
6789
|
|
|
6711
6790
|
target.set( data.videoWidth, data.videoHeight, 0 );
|
|
6712
6791
|
|
|
@@ -6840,7 +6919,7 @@ function serializeImage( image ) {
|
|
|
6840
6919
|
|
|
6841
6920
|
} else {
|
|
6842
6921
|
|
|
6843
|
-
|
|
6922
|
+
warn( 'Texture: Unable to serialize Texture.' );
|
|
6844
6923
|
return {};
|
|
6845
6924
|
|
|
6846
6925
|
}
|
|
@@ -7354,7 +7433,7 @@ class Texture extends EventDispatcher {
|
|
|
7354
7433
|
|
|
7355
7434
|
if ( newValue === undefined ) {
|
|
7356
7435
|
|
|
7357
|
-
|
|
7436
|
+
warn( `Texture.setValues(): parameter '${ key }' has value of undefined.` );
|
|
7358
7437
|
continue;
|
|
7359
7438
|
|
|
7360
7439
|
}
|
|
@@ -7363,7 +7442,7 @@ class Texture extends EventDispatcher {
|
|
|
7363
7442
|
|
|
7364
7443
|
if ( currentValue === undefined ) {
|
|
7365
7444
|
|
|
7366
|
-
|
|
7445
|
+
warn( `Texture.setValues(): property '${ key }' does not exist.` );
|
|
7367
7446
|
continue;
|
|
7368
7447
|
|
|
7369
7448
|
}
|
|
@@ -8980,7 +9059,16 @@ class RenderTarget extends EventDispatcher {
|
|
|
8980
9059
|
this.textures[ i ].image.width = width;
|
|
8981
9060
|
this.textures[ i ].image.height = height;
|
|
8982
9061
|
this.textures[ i ].image.depth = depth;
|
|
8983
|
-
|
|
9062
|
+
|
|
9063
|
+
if ( this.textures[ i ].isData3DTexture !== true ) { // Fix for #31693
|
|
9064
|
+
|
|
9065
|
+
// TODO: Reconsider setting isArrayTexture flag here and in the ctor of Texture.
|
|
9066
|
+
// Maybe a method `isArrayTexture()` or just a getter could replace a flag since
|
|
9067
|
+
// both are evaluated on each call?
|
|
9068
|
+
|
|
9069
|
+
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
|
|
9070
|
+
|
|
9071
|
+
}
|
|
8984
9072
|
|
|
8985
9073
|
}
|
|
8986
9074
|
|
|
@@ -11297,7 +11385,7 @@ class Ray {
|
|
|
11297
11385
|
* Represents a 4x4 matrix.
|
|
11298
11386
|
*
|
|
11299
11387
|
* The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
|
|
11300
|
-
* For an introduction to transformation matrices as used in WebGL, check out [this tutorial]
|
|
11388
|
+
* For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices)
|
|
11301
11389
|
*
|
|
11302
11390
|
* This allows a 3D vector representing a point in 3D space to undergo
|
|
11303
11391
|
* transformations such as translation, rotation, shear, scale, reflection,
|
|
@@ -11307,7 +11395,7 @@ class Ray {
|
|
|
11307
11395
|
* A Note on Row-Major and Column-Major Ordering:
|
|
11308
11396
|
*
|
|
11309
11397
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
11310
|
-
* [row-major]
|
|
11398
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
11311
11399
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
11312
11400
|
* This means that calling:
|
|
11313
11401
|
* ```js
|
|
@@ -11601,7 +11689,7 @@ class Matrix4 {
|
|
|
11601
11689
|
* Sets the rotation component (the upper left 3x3 matrix) of this matrix to
|
|
11602
11690
|
* the rotation specified by the given Euler angles. The rest of
|
|
11603
11691
|
* the matrix is set to the identity. Depending on the {@link Euler#order},
|
|
11604
|
-
* there are six possible outcomes. See [this page]
|
|
11692
|
+
* there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)
|
|
11605
11693
|
* for a complete list.
|
|
11606
11694
|
*
|
|
11607
11695
|
* @param {Euler} euler - The Euler angles.
|
|
@@ -11731,7 +11819,7 @@ class Matrix4 {
|
|
|
11731
11819
|
|
|
11732
11820
|
/**
|
|
11733
11821
|
* Sets the rotation component of this matrix to the rotation specified by
|
|
11734
|
-
* the given Quaternion as outlined [here]
|
|
11822
|
+
* the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)
|
|
11735
11823
|
* The rest of the matrix is set to the identity.
|
|
11736
11824
|
*
|
|
11737
11825
|
* @param {Quaternion} q - The Quaternion.
|
|
@@ -11893,7 +11981,7 @@ class Matrix4 {
|
|
|
11893
11981
|
/**
|
|
11894
11982
|
* Computes and returns the determinant of this matrix.
|
|
11895
11983
|
*
|
|
11896
|
-
* Based on the method outlined [here]
|
|
11984
|
+
* Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
|
|
11897
11985
|
*
|
|
11898
11986
|
* @return {number} The determinant.
|
|
11899
11987
|
*/
|
|
@@ -12000,7 +12088,7 @@ class Matrix4 {
|
|
|
12000
12088
|
}
|
|
12001
12089
|
|
|
12002
12090
|
/**
|
|
12003
|
-
* Inverts this matrix, using the [analytic method]
|
|
12091
|
+
* Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
12004
12092
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
12005
12093
|
* a zero matrix instead.
|
|
12006
12094
|
*
|
|
@@ -12203,7 +12291,7 @@ class Matrix4 {
|
|
|
12203
12291
|
* the given angle.
|
|
12204
12292
|
*
|
|
12205
12293
|
* This is a somewhat controversial but mathematically sound alternative to
|
|
12206
|
-
* rotating via Quaternions. See the discussion [here]
|
|
12294
|
+
* rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
|
|
12207
12295
|
*
|
|
12208
12296
|
* @param {Vector3} axis - The normalized rotation axis.
|
|
12209
12297
|
* @param {number} angle - The rotation in radians.
|
|
@@ -12892,7 +12980,7 @@ class Euler {
|
|
|
12892
12980
|
|
|
12893
12981
|
default:
|
|
12894
12982
|
|
|
12895
|
-
|
|
12983
|
+
warn( 'Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );
|
|
12896
12984
|
|
|
12897
12985
|
}
|
|
12898
12986
|
|
|
@@ -13878,7 +13966,7 @@ class Object3D extends EventDispatcher {
|
|
|
13878
13966
|
|
|
13879
13967
|
if ( object === this ) {
|
|
13880
13968
|
|
|
13881
|
-
|
|
13969
|
+
error( 'Object3D.add: object can\'t be added as a child of itself.', object );
|
|
13882
13970
|
return this;
|
|
13883
13971
|
|
|
13884
13972
|
}
|
|
@@ -13897,7 +13985,7 @@ class Object3D extends EventDispatcher {
|
|
|
13897
13985
|
|
|
13898
13986
|
} else {
|
|
13899
13987
|
|
|
13900
|
-
|
|
13988
|
+
error( 'Object3D.add: object not an instance of THREE.Object3D.', object );
|
|
13901
13989
|
|
|
13902
13990
|
}
|
|
13903
13991
|
|
|
@@ -15568,7 +15656,7 @@ class Color {
|
|
|
15568
15656
|
/**
|
|
15569
15657
|
* Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,
|
|
15570
15658
|
* `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or
|
|
15571
|
-
* any [X11 color name]
|
|
15659
|
+
* any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) -
|
|
15572
15660
|
* all 140 color names are supported).
|
|
15573
15661
|
*
|
|
15574
15662
|
* @param {string} style - Color as a CSS-style string.
|
|
@@ -15583,7 +15671,7 @@ class Color {
|
|
|
15583
15671
|
|
|
15584
15672
|
if ( parseFloat( string ) < 1 ) {
|
|
15585
15673
|
|
|
15586
|
-
|
|
15674
|
+
warn( 'Color: Alpha component of ' + style + ' will be ignored.' );
|
|
15587
15675
|
|
|
15588
15676
|
}
|
|
15589
15677
|
|
|
@@ -15659,7 +15747,7 @@ class Color {
|
|
|
15659
15747
|
|
|
15660
15748
|
default:
|
|
15661
15749
|
|
|
15662
|
-
|
|
15750
|
+
warn( 'Color: Unknown color model ' + style );
|
|
15663
15751
|
|
|
15664
15752
|
}
|
|
15665
15753
|
|
|
@@ -15687,7 +15775,7 @@ class Color {
|
|
|
15687
15775
|
|
|
15688
15776
|
} else {
|
|
15689
15777
|
|
|
15690
|
-
|
|
15778
|
+
warn( 'Color: Invalid hex color ' + style );
|
|
15691
15779
|
|
|
15692
15780
|
}
|
|
15693
15781
|
|
|
@@ -15727,7 +15815,7 @@ class Color {
|
|
|
15727
15815
|
} else {
|
|
15728
15816
|
|
|
15729
15817
|
// unknown color
|
|
15730
|
-
|
|
15818
|
+
warn( 'Color: Unknown color ' + style );
|
|
15731
15819
|
|
|
15732
15820
|
}
|
|
15733
15821
|
|
|
@@ -16775,7 +16863,7 @@ class Material extends EventDispatcher {
|
|
|
16775
16863
|
*
|
|
16776
16864
|
* This method can only be used when rendering with {@link WebGLRenderer}. The
|
|
16777
16865
|
* recommended approach when customizing materials is to use `WebGPURenderer` with the new
|
|
16778
|
-
* Node Material system and [TSL]
|
|
16866
|
+
* Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).
|
|
16779
16867
|
*
|
|
16780
16868
|
* @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.
|
|
16781
16869
|
* @param {WebGLRenderer} renderer - A reference to the renderer.
|
|
@@ -16814,7 +16902,7 @@ class Material extends EventDispatcher {
|
|
|
16814
16902
|
|
|
16815
16903
|
if ( newValue === undefined ) {
|
|
16816
16904
|
|
|
16817
|
-
|
|
16905
|
+
warn( `Material: parameter '${ key }' has value of undefined.` );
|
|
16818
16906
|
continue;
|
|
16819
16907
|
|
|
16820
16908
|
}
|
|
@@ -16823,7 +16911,7 @@ class Material extends EventDispatcher {
|
|
|
16823
16911
|
|
|
16824
16912
|
if ( currentValue === undefined ) {
|
|
16825
16913
|
|
|
16826
|
-
|
|
16914
|
+
warn( `Material: '${ key }' is not a property of THREE.${ this.type }.` );
|
|
16827
16915
|
continue;
|
|
16828
16916
|
|
|
16829
16917
|
}
|
|
@@ -16917,6 +17005,18 @@ class Material extends EventDispatcher {
|
|
|
16917
17005
|
|
|
16918
17006
|
}
|
|
16919
17007
|
|
|
17008
|
+
if ( this.sheenColorMap && this.sheenColorMap.isTexture ) {
|
|
17009
|
+
|
|
17010
|
+
data.sheenColorMap = this.sheenColorMap.toJSON( meta ).uuid;
|
|
17011
|
+
|
|
17012
|
+
}
|
|
17013
|
+
|
|
17014
|
+
if ( this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture ) {
|
|
17015
|
+
|
|
17016
|
+
data.sheenRoughnessMap = this.sheenRoughnessMap.toJSON( meta ).uuid;
|
|
17017
|
+
|
|
17018
|
+
}
|
|
17019
|
+
|
|
16920
17020
|
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
16921
17021
|
|
|
16922
17022
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
@@ -17258,6 +17358,7 @@ class Material extends EventDispatcher {
|
|
|
17258
17358
|
* This material is not affected by lights.
|
|
17259
17359
|
*
|
|
17260
17360
|
* @augments Material
|
|
17361
|
+
* @demo scenes/material-browser.html#MeshBasicMaterial
|
|
17261
17362
|
*/
|
|
17262
17363
|
class MeshBasicMaterial extends Material {
|
|
17263
17364
|
|
|
@@ -17643,7 +17744,7 @@ function _generateTables() {
|
|
|
17643
17744
|
*/
|
|
17644
17745
|
function toHalfFloat( val ) {
|
|
17645
17746
|
|
|
17646
|
-
if ( Math.abs( val ) > 65504 )
|
|
17747
|
+
if ( Math.abs( val ) > 65504 ) warn( 'DataUtils.toHalfFloat(): Value out of range.' );
|
|
17647
17748
|
|
|
17648
17749
|
val = clamp( val, -65504, 65504 );
|
|
17649
17750
|
|
|
@@ -18874,7 +18975,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18874
18975
|
/**
|
|
18875
18976
|
* Bounding box for the geometry which can be calculated with `computeBoundingBox()`.
|
|
18876
18977
|
*
|
|
18877
|
-
* @type {Box3}
|
|
18978
|
+
* @type {?Box3}
|
|
18878
18979
|
* @default null
|
|
18879
18980
|
*/
|
|
18880
18981
|
this.boundingBox = null;
|
|
@@ -18882,7 +18983,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
18882
18983
|
/**
|
|
18883
18984
|
* Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`.
|
|
18884
18985
|
*
|
|
18885
|
-
* @type {Sphere}
|
|
18986
|
+
* @type {?Sphere}
|
|
18886
18987
|
* @default null
|
|
18887
18988
|
*/
|
|
18888
18989
|
this.boundingSphere = null;
|
|
@@ -19314,7 +19415,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19314
19415
|
|
|
19315
19416
|
if ( points.length > positionAttribute.count ) {
|
|
19316
19417
|
|
|
19317
|
-
|
|
19418
|
+
warn( 'BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.' );
|
|
19318
19419
|
|
|
19319
19420
|
}
|
|
19320
19421
|
|
|
@@ -19344,7 +19445,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19344
19445
|
|
|
19345
19446
|
if ( position && position.isGLBufferAttribute ) {
|
|
19346
19447
|
|
|
19347
|
-
|
|
19448
|
+
error( 'BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
|
|
19348
19449
|
|
|
19349
19450
|
this.boundingBox.set(
|
|
19350
19451
|
new Vector3( - Infinity, - Infinity, - Infinity ),
|
|
@@ -19395,7 +19496,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19395
19496
|
|
|
19396
19497
|
if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
|
|
19397
19498
|
|
|
19398
|
-
|
|
19499
|
+
error( 'BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
|
|
19399
19500
|
|
|
19400
19501
|
}
|
|
19401
19502
|
|
|
@@ -19419,7 +19520,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19419
19520
|
|
|
19420
19521
|
if ( position && position.isGLBufferAttribute ) {
|
|
19421
19522
|
|
|
19422
|
-
|
|
19523
|
+
error( 'BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
|
|
19423
19524
|
|
|
19424
19525
|
this.boundingSphere.set( new Vector3(), Infinity );
|
|
19425
19526
|
|
|
@@ -19510,7 +19611,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19510
19611
|
|
|
19511
19612
|
if ( isNaN( this.boundingSphere.radius ) ) {
|
|
19512
19613
|
|
|
19513
|
-
|
|
19614
|
+
error( 'BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
|
|
19514
19615
|
|
|
19515
19616
|
}
|
|
19516
19617
|
|
|
@@ -19538,7 +19639,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19538
19639
|
attributes.normal === undefined ||
|
|
19539
19640
|
attributes.uv === undefined ) {
|
|
19540
19641
|
|
|
19541
|
-
|
|
19642
|
+
error( 'BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );
|
|
19542
19643
|
return;
|
|
19543
19644
|
|
|
19544
19645
|
}
|
|
@@ -19848,7 +19949,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
19848
19949
|
|
|
19849
19950
|
if ( this.index === null ) {
|
|
19850
19951
|
|
|
19851
|
-
|
|
19952
|
+
warn( 'BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );
|
|
19852
19953
|
return this;
|
|
19853
19954
|
|
|
19854
19955
|
}
|
|
@@ -20658,6 +20759,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
20658
20759
|
* ```
|
|
20659
20760
|
*
|
|
20660
20761
|
* @augments BufferGeometry
|
|
20762
|
+
* @demo scenes/geometry-browser.html#BoxGeometry
|
|
20661
20763
|
*/
|
|
20662
20764
|
class BoxGeometry extends BufferGeometry {
|
|
20663
20765
|
|
|
@@ -20858,8 +20960,20 @@ class BoxGeometry extends BufferGeometry {
|
|
|
20858
20960
|
|
|
20859
20961
|
}
|
|
20860
20962
|
|
|
20861
|
-
|
|
20963
|
+
/**
|
|
20964
|
+
* Provides utility functions for managing uniforms.
|
|
20965
|
+
*
|
|
20966
|
+
* @module UniformsUtils
|
|
20967
|
+
*/
|
|
20862
20968
|
|
|
20969
|
+
/**
|
|
20970
|
+
* Clones the given uniform definitions by performing a deep-copy. That means
|
|
20971
|
+
* if the value of a uniform refers to an object like a Vector3 or Texture,
|
|
20972
|
+
* the cloned uniform will refer to a new object reference.
|
|
20973
|
+
*
|
|
20974
|
+
* @param {Object} src - An object representing uniform definitions.
|
|
20975
|
+
* @return {Object} The cloned uniforms.
|
|
20976
|
+
*/
|
|
20863
20977
|
function cloneUniforms( src ) {
|
|
20864
20978
|
|
|
20865
20979
|
const dst = {};
|
|
@@ -20879,7 +20993,7 @@ function cloneUniforms( src ) {
|
|
|
20879
20993
|
|
|
20880
20994
|
if ( property.isRenderTargetTexture ) {
|
|
20881
20995
|
|
|
20882
|
-
|
|
20996
|
+
warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );
|
|
20883
20997
|
dst[ u ][ p ] = null;
|
|
20884
20998
|
|
|
20885
20999
|
} else {
|
|
@@ -20906,6 +21020,14 @@ function cloneUniforms( src ) {
|
|
|
20906
21020
|
|
|
20907
21021
|
}
|
|
20908
21022
|
|
|
21023
|
+
/**
|
|
21024
|
+
* Merges the given uniform definitions into a single object. Since the
|
|
21025
|
+
* method internally uses cloneUniforms(), it performs a deep-copy when
|
|
21026
|
+
* producing the merged uniform definitions.
|
|
21027
|
+
*
|
|
21028
|
+
* @param {Array} uniforms - An array of objects containing uniform definitions.
|
|
21029
|
+
* @return {Object} The merged uniforms.
|
|
21030
|
+
*/
|
|
20909
21031
|
function mergeUniforms( uniforms ) {
|
|
20910
21032
|
|
|
20911
21033
|
const merged = {};
|
|
@@ -20983,7 +21105,7 @@ var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0
|
|
|
20983
21105
|
* - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end`
|
|
20984
21106
|
* in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has
|
|
20985
21107
|
* to be placed right above the loop. The loop formatting has to correspond to a defined standard.
|
|
20986
|
-
* - The loop has to be [normalized]
|
|
21108
|
+
* - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop).
|
|
20987
21109
|
* - The loop variable has to be *i*.
|
|
20988
21110
|
* - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly
|
|
20989
21111
|
* value of *i* for the given iteration and can be used in preprocessor
|
|
@@ -21189,7 +21311,7 @@ class ShaderMaterial extends Material {
|
|
|
21189
21311
|
};
|
|
21190
21312
|
|
|
21191
21313
|
/**
|
|
21192
|
-
* If set, this calls [gl.bindAttribLocation]
|
|
21314
|
+
* If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation)
|
|
21193
21315
|
* to bind a generic vertex index to an attribute variable.
|
|
21194
21316
|
*
|
|
21195
21317
|
* @type {string|undefined}
|
|
@@ -21476,7 +21598,7 @@ const _minTarget = /*@__PURE__*/ new Vector2();
|
|
|
21476
21598
|
const _maxTarget = /*@__PURE__*/ new Vector2();
|
|
21477
21599
|
|
|
21478
21600
|
/**
|
|
21479
|
-
* Camera that uses [perspective projection]
|
|
21601
|
+
* Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)).
|
|
21480
21602
|
*
|
|
21481
21603
|
* This projection mode is designed to mimic the way the human eye sees. It
|
|
21482
21604
|
* is the most common projection mode used for rendering a 3D scene.
|
|
@@ -23159,7 +23281,7 @@ class Scene extends Object3D {
|
|
|
23159
23281
|
* "Interleaved" means that multiple attributes, possibly of different types,
|
|
23160
23282
|
* (e.g., position, normal, uv, color) are packed into a single array buffer.
|
|
23161
23283
|
*
|
|
23162
|
-
* An introduction into interleaved arrays can be found here: [Interleaved array basics]
|
|
23284
|
+
* An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html)
|
|
23163
23285
|
*/
|
|
23164
23286
|
class InterleavedBuffer {
|
|
23165
23287
|
|
|
@@ -23879,7 +24001,7 @@ class InterleavedBufferAttribute {
|
|
|
23879
24001
|
|
|
23880
24002
|
if ( data === undefined ) {
|
|
23881
24003
|
|
|
23882
|
-
|
|
24004
|
+
log( 'InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );
|
|
23883
24005
|
|
|
23884
24006
|
const array = [];
|
|
23885
24007
|
|
|
@@ -23929,7 +24051,7 @@ class InterleavedBufferAttribute {
|
|
|
23929
24051
|
|
|
23930
24052
|
if ( data === undefined ) {
|
|
23931
24053
|
|
|
23932
|
-
|
|
24054
|
+
log( 'InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );
|
|
23933
24055
|
|
|
23934
24056
|
const array = [];
|
|
23935
24057
|
|
|
@@ -24156,7 +24278,7 @@ class Sprite extends Object3D {
|
|
|
24156
24278
|
/**
|
|
24157
24279
|
* Constructs a new sprite.
|
|
24158
24280
|
*
|
|
24159
|
-
* @param {SpriteMaterial} [material] - The sprite material.
|
|
24281
|
+
* @param {(SpriteMaterial|SpriteNodeMaterial)} [material] - The sprite material.
|
|
24160
24282
|
*/
|
|
24161
24283
|
constructor( material = new SpriteMaterial() ) {
|
|
24162
24284
|
|
|
@@ -24202,7 +24324,7 @@ class Sprite extends Object3D {
|
|
|
24202
24324
|
/**
|
|
24203
24325
|
* The sprite material.
|
|
24204
24326
|
*
|
|
24205
|
-
* @type {SpriteMaterial}
|
|
24327
|
+
* @type {(SpriteMaterial|SpriteNodeMaterial)}
|
|
24206
24328
|
*/
|
|
24207
24329
|
this.material = material;
|
|
24208
24330
|
|
|
@@ -24237,7 +24359,7 @@ class Sprite extends Object3D {
|
|
|
24237
24359
|
|
|
24238
24360
|
if ( raycaster.camera === null ) {
|
|
24239
24361
|
|
|
24240
|
-
|
|
24362
|
+
error( 'Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.' );
|
|
24241
24363
|
|
|
24242
24364
|
}
|
|
24243
24365
|
|
|
@@ -24531,7 +24653,7 @@ class LOD extends Object3D {
|
|
|
24531
24653
|
* the given distance.
|
|
24532
24654
|
*
|
|
24533
24655
|
* @param {number} distance - The LOD distance.
|
|
24534
|
-
* @return {Object3D
|
|
24656
|
+
* @return {?Object3D} The found 3D object. `null` if no 3D object has been found.
|
|
24535
24657
|
*/
|
|
24536
24658
|
getObjectForDistance( distance ) {
|
|
24537
24659
|
|
|
@@ -24698,6 +24820,7 @@ const _ray$2 = /*@__PURE__*/ new Ray();
|
|
|
24698
24820
|
* or {@link FBXLoader } import respective models.
|
|
24699
24821
|
*
|
|
24700
24822
|
* @augments Mesh
|
|
24823
|
+
* @demo scenes/bones-browser.html
|
|
24701
24824
|
*/
|
|
24702
24825
|
class SkinnedMesh extends Mesh {
|
|
24703
24826
|
|
|
@@ -24965,7 +25088,7 @@ class SkinnedMesh extends Mesh {
|
|
|
24965
25088
|
|
|
24966
25089
|
} else {
|
|
24967
25090
|
|
|
24968
|
-
|
|
25091
|
+
warn( 'SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );
|
|
24969
25092
|
|
|
24970
25093
|
}
|
|
24971
25094
|
|
|
@@ -25234,7 +25357,7 @@ class Skeleton {
|
|
|
25234
25357
|
|
|
25235
25358
|
if ( bones.length !== boneInverses.length ) {
|
|
25236
25359
|
|
|
25237
|
-
|
|
25360
|
+
warn( 'Skeleton: Number of inverse bone matrices does not match amount of bones.' );
|
|
25238
25361
|
|
|
25239
25362
|
this.boneInverses = [];
|
|
25240
25363
|
|
|
@@ -25452,7 +25575,7 @@ class Skeleton {
|
|
|
25452
25575
|
|
|
25453
25576
|
if ( bone === undefined ) {
|
|
25454
25577
|
|
|
25455
|
-
|
|
25578
|
+
warn( 'Skeleton: No bone found with UUID:', uuid );
|
|
25456
25579
|
bone = new Bone();
|
|
25457
25580
|
|
|
25458
25581
|
}
|
|
@@ -25964,7 +26087,7 @@ const _normalMatrix = /*@__PURE__*/ new Matrix3();
|
|
|
25964
26087
|
|
|
25965
26088
|
/**
|
|
25966
26089
|
* A two dimensional surface that extends infinitely in 3D space, represented
|
|
25967
|
-
* in [Hessian normal form]
|
|
26090
|
+
* in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)
|
|
25968
26091
|
* by a unit length normal vector and a constant.
|
|
25969
26092
|
*/
|
|
25970
26093
|
class Plane {
|
|
@@ -27810,7 +27933,7 @@ class BatchedMesh extends Mesh {
|
|
|
27810
27933
|
*
|
|
27811
27934
|
* @param {number} geometryId - The ID of the geometry to return the bounding box for.
|
|
27812
27935
|
* @param {Box3} target - The target object that is used to store the method's result.
|
|
27813
|
-
* @return {Box3
|
|
27936
|
+
* @return {?Box3} The geometry's bounding box. Returns `null` if no geometry has been found for the given ID.
|
|
27814
27937
|
*/
|
|
27815
27938
|
getBoundingBoxAt( geometryId, target ) {
|
|
27816
27939
|
|
|
@@ -27855,7 +27978,7 @@ class BatchedMesh extends Mesh {
|
|
|
27855
27978
|
*
|
|
27856
27979
|
* @param {number} geometryId - The ID of the geometry to return the bounding sphere for.
|
|
27857
27980
|
* @param {Sphere} target - The target object that is used to store the method's result.
|
|
27858
|
-
* @return {Sphere
|
|
27981
|
+
* @return {?Sphere} The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID.
|
|
27859
27982
|
*/
|
|
27860
27983
|
getBoundingSphereAt( geometryId, target ) {
|
|
27861
27984
|
|
|
@@ -28743,7 +28866,7 @@ class Line extends Object3D {
|
|
|
28743
28866
|
|
|
28744
28867
|
} else {
|
|
28745
28868
|
|
|
28746
|
-
|
|
28869
|
+
warn( 'Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
|
|
28747
28870
|
|
|
28748
28871
|
}
|
|
28749
28872
|
|
|
@@ -28984,7 +29107,7 @@ class LineSegments extends Line {
|
|
|
28984
29107
|
|
|
28985
29108
|
} else {
|
|
28986
29109
|
|
|
28987
|
-
|
|
29110
|
+
warn( 'LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
|
|
28988
29111
|
|
|
28989
29112
|
}
|
|
28990
29113
|
|
|
@@ -29115,7 +29238,7 @@ class PointsMaterial extends Material {
|
|
|
29115
29238
|
/**
|
|
29116
29239
|
* Defines the size of the points in pixels.
|
|
29117
29240
|
*
|
|
29118
|
-
* Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE]
|
|
29241
|
+
* 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).
|
|
29119
29242
|
*
|
|
29120
29243
|
* @type {number}
|
|
29121
29244
|
* @default 1
|
|
@@ -29489,15 +29612,14 @@ class VideoTexture extends Texture {
|
|
|
29489
29612
|
|
|
29490
29613
|
}
|
|
29491
29614
|
|
|
29492
|
-
/**
|
|
29493
|
-
* @override
|
|
29494
|
-
*/
|
|
29495
29615
|
dispose() {
|
|
29496
29616
|
|
|
29497
29617
|
if ( this._requestVideoFrameCallbackId !== 0 ) {
|
|
29498
29618
|
|
|
29499
29619
|
this.source.data.cancelVideoFrameCallback( this._requestVideoFrameCallbackId );
|
|
29500
29620
|
|
|
29621
|
+
this._requestVideoFrameCallbackId = 0;
|
|
29622
|
+
|
|
29501
29623
|
}
|
|
29502
29624
|
|
|
29503
29625
|
super.dispose();
|
|
@@ -30009,6 +30131,59 @@ class DepthTexture extends Texture {
|
|
|
30009
30131
|
|
|
30010
30132
|
}
|
|
30011
30133
|
|
|
30134
|
+
/**
|
|
30135
|
+
* Represents a texture created externally with the same renderer context.
|
|
30136
|
+
*
|
|
30137
|
+
* This may be a texture from a protected media stream, device camera feed,
|
|
30138
|
+
* or other data feeds like a depth sensor.
|
|
30139
|
+
*
|
|
30140
|
+
* Note that this class is only supported in {@link WebGLRenderer}, and in
|
|
30141
|
+
* the {@link WebGPURenderer} WebGPU backend.
|
|
30142
|
+
*
|
|
30143
|
+
* @augments Texture
|
|
30144
|
+
*/
|
|
30145
|
+
class ExternalTexture extends Texture {
|
|
30146
|
+
|
|
30147
|
+
/**
|
|
30148
|
+
* Creates a new raw texture.
|
|
30149
|
+
*
|
|
30150
|
+
* @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.
|
|
30151
|
+
*/
|
|
30152
|
+
constructor( sourceTexture = null ) {
|
|
30153
|
+
|
|
30154
|
+
super();
|
|
30155
|
+
|
|
30156
|
+
/**
|
|
30157
|
+
* The external source texture.
|
|
30158
|
+
*
|
|
30159
|
+
* @type {?(WebGLTexture|GPUTexture)}
|
|
30160
|
+
* @default null
|
|
30161
|
+
*/
|
|
30162
|
+
this.sourceTexture = sourceTexture;
|
|
30163
|
+
|
|
30164
|
+
/**
|
|
30165
|
+
* This flag can be used for type testing.
|
|
30166
|
+
*
|
|
30167
|
+
* @type {boolean}
|
|
30168
|
+
* @readonly
|
|
30169
|
+
* @default true
|
|
30170
|
+
*/
|
|
30171
|
+
this.isExternalTexture = true;
|
|
30172
|
+
|
|
30173
|
+
}
|
|
30174
|
+
|
|
30175
|
+
copy( source ) {
|
|
30176
|
+
|
|
30177
|
+
super.copy( source );
|
|
30178
|
+
|
|
30179
|
+
this.sourceTexture = source.sourceTexture;
|
|
30180
|
+
|
|
30181
|
+
return this;
|
|
30182
|
+
|
|
30183
|
+
}
|
|
30184
|
+
|
|
30185
|
+
}
|
|
30186
|
+
|
|
30012
30187
|
/**
|
|
30013
30188
|
* A geometry class for representing a capsule.
|
|
30014
30189
|
*
|
|
@@ -30020,6 +30195,7 @@ class DepthTexture extends Texture {
|
|
|
30020
30195
|
* ```
|
|
30021
30196
|
*
|
|
30022
30197
|
* @augments BufferGeometry
|
|
30198
|
+
* @demo scenes/geometry-browser.html#CapsuleGeometry
|
|
30023
30199
|
*/
|
|
30024
30200
|
class CapsuleGeometry extends BufferGeometry {
|
|
30025
30201
|
|
|
@@ -30237,6 +30413,7 @@ class CapsuleGeometry extends BufferGeometry {
|
|
|
30237
30413
|
* ```
|
|
30238
30414
|
*
|
|
30239
30415
|
* @augments BufferGeometry
|
|
30416
|
+
* @demo scenes/geometry-browser.html#CircleGeometry
|
|
30240
30417
|
*/
|
|
30241
30418
|
class CircleGeometry extends BufferGeometry {
|
|
30242
30419
|
|
|
@@ -30366,6 +30543,7 @@ class CircleGeometry extends BufferGeometry {
|
|
|
30366
30543
|
* ```
|
|
30367
30544
|
*
|
|
30368
30545
|
* @augments BufferGeometry
|
|
30546
|
+
* @demo scenes/geometry-browser.html#CylinderGeometry
|
|
30369
30547
|
*/
|
|
30370
30548
|
class CylinderGeometry extends BufferGeometry {
|
|
30371
30549
|
|
|
@@ -30691,6 +30869,7 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
30691
30869
|
* ```
|
|
30692
30870
|
*
|
|
30693
30871
|
* @augments CylinderGeometry
|
|
30872
|
+
* @demo scenes/geometry-browser.html#ConeGeometry
|
|
30694
30873
|
*/
|
|
30695
30874
|
class ConeGeometry extends CylinderGeometry {
|
|
30696
30875
|
|
|
@@ -31099,6 +31278,7 @@ class PolyhedronGeometry extends BufferGeometry {
|
|
|
31099
31278
|
* ```
|
|
31100
31279
|
*
|
|
31101
31280
|
* @augments PolyhedronGeometry
|
|
31281
|
+
* @demo scenes/geometry-browser.html#DodecahedronGeometry
|
|
31102
31282
|
*/
|
|
31103
31283
|
class DodecahedronGeometry extends PolyhedronGeometry {
|
|
31104
31284
|
|
|
@@ -31418,7 +31598,7 @@ class Curve {
|
|
|
31418
31598
|
*/
|
|
31419
31599
|
getPoint( /* t, optionalTarget */ ) {
|
|
31420
31600
|
|
|
31421
|
-
|
|
31601
|
+
warn( 'Curve: .getPoint() not implemented.' );
|
|
31422
31602
|
|
|
31423
31603
|
}
|
|
31424
31604
|
|
|
@@ -32476,7 +32656,13 @@ class CatmullRomCurve3 extends Curve {
|
|
|
32476
32656
|
|
|
32477
32657
|
}
|
|
32478
32658
|
|
|
32479
|
-
|
|
32659
|
+
/**
|
|
32660
|
+
* Interpolations contains spline and Bézier functions internally used by concrete curve classes.
|
|
32661
|
+
*
|
|
32662
|
+
* Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve
|
|
32663
|
+
*
|
|
32664
|
+
* @module Interpolations
|
|
32665
|
+
*/
|
|
32480
32666
|
|
|
32481
32667
|
/**
|
|
32482
32668
|
* Computes a point on a Catmull-Rom spline.
|
|
@@ -34258,8 +34444,8 @@ class Shape extends Path {
|
|
|
34258
34444
|
}
|
|
34259
34445
|
|
|
34260
34446
|
/* eslint-disable */
|
|
34261
|
-
// copy of mapbox/earcut version 3.0.
|
|
34262
|
-
// https://github.com/mapbox/earcut/tree/v3.0.
|
|
34447
|
+
// copy of mapbox/earcut version 3.0.2
|
|
34448
|
+
// https://github.com/mapbox/earcut/tree/v3.0.2
|
|
34263
34449
|
|
|
34264
34450
|
function earcut(data, holeIndices, dim = 2) {
|
|
34265
34451
|
|
|
@@ -34276,10 +34462,10 @@ function earcut(data, holeIndices, dim = 2) {
|
|
|
34276
34462
|
|
|
34277
34463
|
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
34278
34464
|
if (data.length > 80 * dim) {
|
|
34279
|
-
minX =
|
|
34280
|
-
minY =
|
|
34281
|
-
let maxX =
|
|
34282
|
-
let maxY =
|
|
34465
|
+
minX = data[0];
|
|
34466
|
+
minY = data[1];
|
|
34467
|
+
let maxX = minX;
|
|
34468
|
+
let maxY = minY;
|
|
34283
34469
|
|
|
34284
34470
|
for (let i = dim; i < outerLen; i += dim) {
|
|
34285
34471
|
const x = data[i];
|
|
@@ -34555,7 +34741,7 @@ function compareXYSlope(a, b) {
|
|
|
34555
34741
|
return result;
|
|
34556
34742
|
}
|
|
34557
34743
|
|
|
34558
|
-
// find a bridge between vertices that connects hole with an outer ring and
|
|
34744
|
+
// find a bridge between vertices that connects hole with an outer ring and link it
|
|
34559
34745
|
function eliminateHole(hole, outerNode) {
|
|
34560
34746
|
const bridge = findHoleBridge(hole, outerNode);
|
|
34561
34747
|
if (!bridge) {
|
|
@@ -34746,7 +34932,7 @@ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
|
|
|
34746
34932
|
|
|
34747
34933
|
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
34748
34934
|
function isValidDiagonal(a, b) {
|
|
34749
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && //
|
|
34935
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
|
|
34750
34936
|
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
34751
34937
|
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
34752
34938
|
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
@@ -34893,6 +35079,12 @@ function signedArea(data, start, end, dim) {
|
|
|
34893
35079
|
return sum;
|
|
34894
35080
|
}
|
|
34895
35081
|
|
|
35082
|
+
/**
|
|
35083
|
+
* An implementation of the earcut polygon triangulation algorithm.
|
|
35084
|
+
* The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut).
|
|
35085
|
+
*
|
|
35086
|
+
* @see https://github.com/mapbox/earcut
|
|
35087
|
+
*/
|
|
34896
35088
|
class Earcut {
|
|
34897
35089
|
|
|
34898
35090
|
/**
|
|
@@ -35043,6 +35235,7 @@ function addContour( vertices, contour ) {
|
|
|
35043
35235
|
* ```
|
|
35044
35236
|
*
|
|
35045
35237
|
* @augments BufferGeometry
|
|
35238
|
+
* @demo scenes/geometry-browser.html#ExtrudeGeometry
|
|
35046
35239
|
*/
|
|
35047
35240
|
class ExtrudeGeometry extends BufferGeometry {
|
|
35048
35241
|
|
|
@@ -35131,7 +35324,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35131
35324
|
|
|
35132
35325
|
splineTube = extrudePath.computeFrenetFrames( steps, false );
|
|
35133
35326
|
|
|
35134
|
-
//
|
|
35327
|
+
// log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
|
|
35135
35328
|
|
|
35136
35329
|
binormal = new Vector3();
|
|
35137
35330
|
normal = new Vector3();
|
|
@@ -35236,7 +35429,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35236
35429
|
|
|
35237
35430
|
function scalePt2( pt, vec, size ) {
|
|
35238
35431
|
|
|
35239
|
-
if ( ! vec )
|
|
35432
|
+
if ( ! vec ) error( 'ExtrudeGeometry: vec does not exist' );
|
|
35240
35433
|
|
|
35241
35434
|
return pt.clone().addScaledVector( vec, size );
|
|
35242
35435
|
|
|
@@ -35351,14 +35544,14 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35351
35544
|
|
|
35352
35545
|
if ( direction_eq ) {
|
|
35353
35546
|
|
|
35354
|
-
//
|
|
35547
|
+
// log("Warning: lines are a straight sequence");
|
|
35355
35548
|
v_trans_x = - v_prev_y;
|
|
35356
35549
|
v_trans_y = v_prev_x;
|
|
35357
35550
|
shrink_by = Math.sqrt( v_prev_lensq );
|
|
35358
35551
|
|
|
35359
35552
|
} else {
|
|
35360
35553
|
|
|
35361
|
-
//
|
|
35554
|
+
// log("Warning: lines are a straight spike");
|
|
35362
35555
|
v_trans_x = v_prev_x;
|
|
35363
35556
|
v_trans_y = v_prev_y;
|
|
35364
35557
|
shrink_by = Math.sqrt( v_prev_lensq / 2 );
|
|
@@ -35380,7 +35573,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35380
35573
|
if ( k === il ) k = 0;
|
|
35381
35574
|
|
|
35382
35575
|
// (j)---(i)---(k)
|
|
35383
|
-
//
|
|
35576
|
+
// log('i,j,k', i, j , k)
|
|
35384
35577
|
|
|
35385
35578
|
contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
|
|
35386
35579
|
|
|
@@ -35677,7 +35870,7 @@ class ExtrudeGeometry extends BufferGeometry {
|
|
|
35677
35870
|
let k = i - 1;
|
|
35678
35871
|
if ( k < 0 ) k = contour.length - 1;
|
|
35679
35872
|
|
|
35680
|
-
//
|
|
35873
|
+
//log('b', i,j, i-1, k,vertices.length);
|
|
35681
35874
|
|
|
35682
35875
|
for ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {
|
|
35683
35876
|
|
|
@@ -35917,6 +36110,7 @@ function toJSON$1( shapes, options, data ) {
|
|
|
35917
36110
|
* ```
|
|
35918
36111
|
*
|
|
35919
36112
|
* @augments PolyhedronGeometry
|
|
36113
|
+
* @demo scenes/geometry-browser.html#IcosahedronGeometry
|
|
35920
36114
|
*/
|
|
35921
36115
|
class IcosahedronGeometry extends PolyhedronGeometry {
|
|
35922
36116
|
|
|
@@ -35991,6 +36185,7 @@ class IcosahedronGeometry extends PolyhedronGeometry {
|
|
|
35991
36185
|
* ```
|
|
35992
36186
|
*
|
|
35993
36187
|
* @augments BufferGeometry
|
|
36188
|
+
* @demo scenes/geometry-browser.html#LatheGeometry
|
|
35994
36189
|
*/
|
|
35995
36190
|
class LatheGeometry extends BufferGeometry {
|
|
35996
36191
|
|
|
@@ -36208,6 +36403,7 @@ class LatheGeometry extends BufferGeometry {
|
|
|
36208
36403
|
* ```
|
|
36209
36404
|
*
|
|
36210
36405
|
* @augments PolyhedronGeometry
|
|
36406
|
+
* @demo scenes/geometry-browser.html#OctahedronGeometry
|
|
36211
36407
|
*/
|
|
36212
36408
|
class OctahedronGeometry extends PolyhedronGeometry {
|
|
36213
36409
|
|
|
@@ -36274,6 +36470,7 @@ class OctahedronGeometry extends PolyhedronGeometry {
|
|
|
36274
36470
|
* ```
|
|
36275
36471
|
*
|
|
36276
36472
|
* @augments BufferGeometry
|
|
36473
|
+
* @demo scenes/geometry-browser.html#PlaneGeometry
|
|
36277
36474
|
*/
|
|
36278
36475
|
class PlaneGeometry extends BufferGeometry {
|
|
36279
36476
|
|
|
@@ -36402,6 +36599,7 @@ class PlaneGeometry extends BufferGeometry {
|
|
|
36402
36599
|
* ```
|
|
36403
36600
|
*
|
|
36404
36601
|
* @augments BufferGeometry
|
|
36602
|
+
* @demo scenes/geometry-browser.html#RingGeometry
|
|
36405
36603
|
*/
|
|
36406
36604
|
class RingGeometry extends BufferGeometry {
|
|
36407
36605
|
|
|
@@ -36563,6 +36761,7 @@ class RingGeometry extends BufferGeometry {
|
|
|
36563
36761
|
* ```
|
|
36564
36762
|
*
|
|
36565
36763
|
* @augments BufferGeometry
|
|
36764
|
+
* @demo scenes/geometry-browser.html#ShapeGeometry
|
|
36566
36765
|
*/
|
|
36567
36766
|
class ShapeGeometry extends BufferGeometry {
|
|
36568
36767
|
|
|
@@ -36784,6 +36983,7 @@ function toJSON( shapes, data ) {
|
|
|
36784
36983
|
* ```
|
|
36785
36984
|
*
|
|
36786
36985
|
* @augments BufferGeometry
|
|
36986
|
+
* @demo scenes/geometry-browser.html#SphereGeometry
|
|
36787
36987
|
*/
|
|
36788
36988
|
class SphereGeometry extends BufferGeometry {
|
|
36789
36989
|
|
|
@@ -36953,6 +37153,7 @@ class SphereGeometry extends BufferGeometry {
|
|
|
36953
37153
|
* ```
|
|
36954
37154
|
*
|
|
36955
37155
|
* @augments PolyhedronGeometry
|
|
37156
|
+
* @demo scenes/geometry-browser.html#TetrahedronGeometry
|
|
36956
37157
|
*/
|
|
36957
37158
|
class TetrahedronGeometry extends PolyhedronGeometry {
|
|
36958
37159
|
|
|
@@ -37016,6 +37217,7 @@ class TetrahedronGeometry extends PolyhedronGeometry {
|
|
|
37016
37217
|
* ```
|
|
37017
37218
|
*
|
|
37018
37219
|
* @augments BufferGeometry
|
|
37220
|
+
* @demo scenes/geometry-browser.html#TorusGeometry
|
|
37019
37221
|
*/
|
|
37020
37222
|
class TorusGeometry extends BufferGeometry {
|
|
37021
37223
|
|
|
@@ -37168,6 +37370,7 @@ class TorusGeometry extends BufferGeometry {
|
|
|
37168
37370
|
* ```
|
|
37169
37371
|
*
|
|
37170
37372
|
* @augments BufferGeometry
|
|
37373
|
+
* @demo scenes/geometry-browser.html#TorusKnotGeometry
|
|
37171
37374
|
*/
|
|
37172
37375
|
class TorusKnotGeometry extends BufferGeometry {
|
|
37173
37376
|
|
|
@@ -37380,6 +37583,7 @@ class TorusKnotGeometry extends BufferGeometry {
|
|
|
37380
37583
|
* ```
|
|
37381
37584
|
*
|
|
37382
37585
|
* @augments BufferGeometry
|
|
37586
|
+
* @demo scenes/geometry-browser.html#TubeGeometry
|
|
37383
37587
|
*/
|
|
37384
37588
|
class TubeGeometry extends BufferGeometry {
|
|
37385
37589
|
|
|
@@ -37927,9 +38131,9 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
37927
38131
|
* A standard physically based material, using Metallic-Roughness workflow.
|
|
37928
38132
|
*
|
|
37929
38133
|
* Physically based rendering (PBR) has recently become the standard in many
|
|
37930
|
-
* 3D applications, such as [Unity]
|
|
37931
|
-
* [Unreal]
|
|
37932
|
-
* [3D Studio Max]
|
|
38134
|
+
* 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/),
|
|
38135
|
+
* [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and
|
|
38136
|
+
* [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017).
|
|
37933
38137
|
*
|
|
37934
38138
|
* This approach differs from older approaches in that instead of using
|
|
37935
38139
|
* approximations for the way in which light interacts with a surface, a
|
|
@@ -37945,16 +38149,17 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
37945
38149
|
* Note that for best results you should always specify an environment map when using this material.
|
|
37946
38150
|
*
|
|
37947
38151
|
* For a non-technical introduction to the concept of PBR and how to set up a
|
|
37948
|
-
* PBR material, check out these articles by the people at [marmoset]
|
|
38152
|
+
* PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co):
|
|
37949
38153
|
*
|
|
37950
|
-
* - [Basic Theory of Physically Based Rendering]
|
|
37951
|
-
* - [Physically Based Rendering and You Can Too]
|
|
38154
|
+
* - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)
|
|
38155
|
+
* - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)
|
|
37952
38156
|
*
|
|
37953
38157
|
* Technical details of the approach used in three.js (and most other PBR systems) can be found is this
|
|
37954
|
-
* [paper from Disney]
|
|
38158
|
+
* [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf)
|
|
37955
38159
|
* (pdf), by Brent Burley.
|
|
37956
38160
|
*
|
|
37957
38161
|
* @augments Material
|
|
38162
|
+
* @demo scenes/material-browser.html#MeshStandardMaterial
|
|
37958
38163
|
*/
|
|
37959
38164
|
class MeshStandardMaterial extends Material {
|
|
37960
38165
|
|
|
@@ -38364,6 +38569,7 @@ class MeshStandardMaterial extends Material {
|
|
|
38364
38569
|
* best results, always specify an environment map when using this material.
|
|
38365
38570
|
*
|
|
38366
38571
|
* @augments MeshStandardMaterial
|
|
38572
|
+
* @demo scenes/material-browser.html#MeshPhysicalMaterial
|
|
38367
38573
|
*/
|
|
38368
38574
|
class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
38369
38575
|
|
|
@@ -38660,7 +38866,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38660
38866
|
}
|
|
38661
38867
|
|
|
38662
38868
|
/**
|
|
38663
|
-
* The anisotropy strength.
|
|
38869
|
+
* The anisotropy strength, from `0.0` to `1.0`.
|
|
38664
38870
|
*
|
|
38665
38871
|
* @type {number}
|
|
38666
38872
|
* @default 0
|
|
@@ -38872,7 +39078,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38872
39078
|
/**
|
|
38873
39079
|
* A material for shiny surfaces with specular highlights.
|
|
38874
39080
|
*
|
|
38875
|
-
* The material uses a non-physically based [Blinn-Phong]
|
|
39081
|
+
* The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model)
|
|
38876
39082
|
* model for calculating reflectance. Unlike the Lambertian model used in the
|
|
38877
39083
|
* {@link MeshLambertMaterial} this can simulate shiny surfaces with specular
|
|
38878
39084
|
* highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.
|
|
@@ -38882,6 +39088,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
38882
39088
|
* some graphical accuracy.
|
|
38883
39089
|
*
|
|
38884
39090
|
* @augments Material
|
|
39091
|
+
* @demo scenes/material-browser.html#MeshPhongMaterial
|
|
38885
39092
|
*/
|
|
38886
39093
|
class MeshPhongMaterial extends Material {
|
|
38887
39094
|
|
|
@@ -39277,6 +39484,7 @@ class MeshPhongMaterial extends Material {
|
|
|
39277
39484
|
* A material implementing toon shading.
|
|
39278
39485
|
*
|
|
39279
39486
|
* @augments Material
|
|
39487
|
+
* @demo scenes/material-browser.html#MeshToonMaterial
|
|
39280
39488
|
*/
|
|
39281
39489
|
class MeshToonMaterial extends Material {
|
|
39282
39490
|
|
|
@@ -39591,6 +39799,7 @@ class MeshToonMaterial extends Material {
|
|
|
39591
39799
|
* A material that maps the normal vectors to RGB colors.
|
|
39592
39800
|
*
|
|
39593
39801
|
* @augments Material
|
|
39802
|
+
* @demo scenes/material-browser.html#MeshNormalMaterial
|
|
39594
39803
|
*/
|
|
39595
39804
|
class MeshNormalMaterial extends Material {
|
|
39596
39805
|
|
|
@@ -39759,7 +39968,7 @@ class MeshNormalMaterial extends Material {
|
|
|
39759
39968
|
/**
|
|
39760
39969
|
* A material for non-shiny surfaces, without specular highlights.
|
|
39761
39970
|
*
|
|
39762
|
-
* The material uses a non-physically based [Lambertian]
|
|
39971
|
+
* The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance)
|
|
39763
39972
|
* model for calculating reflectance. This can simulate some surfaces (such
|
|
39764
39973
|
* as untreated wood or stone) well, but cannot simulate shiny surfaces with
|
|
39765
39974
|
* specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment
|
|
@@ -39771,6 +39980,7 @@ class MeshNormalMaterial extends Material {
|
|
|
39771
39980
|
* {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy.
|
|
39772
39981
|
*
|
|
39773
39982
|
* @augments Material
|
|
39983
|
+
* @demo scenes/material-browser.html#MeshLambertMaterial
|
|
39774
39984
|
*/
|
|
39775
39985
|
class MeshLambertMaterial extends Material {
|
|
39776
39986
|
|
|
@@ -40146,6 +40356,7 @@ class MeshLambertMaterial extends Material {
|
|
|
40146
40356
|
* near and far plane. White is nearest, black is farthest.
|
|
40147
40357
|
*
|
|
40148
40358
|
* @augments Material
|
|
40359
|
+
* @demo scenes/material-browser.html#MeshDepthMaterial
|
|
40149
40360
|
*/
|
|
40150
40361
|
class MeshDepthMaterial extends Material {
|
|
40151
40362
|
|
|
@@ -40291,7 +40502,7 @@ class MeshDepthMaterial extends Material {
|
|
|
40291
40502
|
* Can also be used to customize the shadow casting of an object by assigning
|
|
40292
40503
|
* an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}.
|
|
40293
40504
|
* The following examples demonstrates this approach in order to ensure
|
|
40294
|
-
* transparent parts of objects do
|
|
40505
|
+
* transparent parts of objects do not cast shadows.
|
|
40295
40506
|
*
|
|
40296
40507
|
* @augments Material
|
|
40297
40508
|
*/
|
|
@@ -40410,6 +40621,7 @@ class MeshDistanceMaterial extends Material {
|
|
|
40410
40621
|
* shadows.
|
|
40411
40622
|
*
|
|
40412
40623
|
* @augments Material
|
|
40624
|
+
* @demo scenes/material-browser.html#MeshMatcapMaterial
|
|
40413
40625
|
*/
|
|
40414
40626
|
class MeshMatcapMaterial extends Material {
|
|
40415
40627
|
|
|
@@ -40561,6 +40773,24 @@ class MeshMatcapMaterial extends Material {
|
|
|
40561
40773
|
*/
|
|
40562
40774
|
this.alphaMap = null;
|
|
40563
40775
|
|
|
40776
|
+
/**
|
|
40777
|
+
* Renders the geometry as a wireframe.
|
|
40778
|
+
*
|
|
40779
|
+
* @type {boolean}
|
|
40780
|
+
* @default false
|
|
40781
|
+
*/
|
|
40782
|
+
this.wireframe = false;
|
|
40783
|
+
|
|
40784
|
+
/**
|
|
40785
|
+
* Controls the thickness of the wireframe.
|
|
40786
|
+
*
|
|
40787
|
+
* Can only be used with {@link SVGRenderer}.
|
|
40788
|
+
*
|
|
40789
|
+
* @type {number}
|
|
40790
|
+
* @default 1
|
|
40791
|
+
*/
|
|
40792
|
+
this.wireframeLinewidth = 1;
|
|
40793
|
+
|
|
40564
40794
|
/**
|
|
40565
40795
|
* Whether the material is rendered with flat shading or not.
|
|
40566
40796
|
*
|
|
@@ -40607,6 +40837,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
40607
40837
|
|
|
40608
40838
|
this.alphaMap = source.alphaMap;
|
|
40609
40839
|
|
|
40840
|
+
this.wireframe = source.wireframe;
|
|
40841
|
+
this.wireframeLinewidth = source.wireframeLinewidth;
|
|
40842
|
+
|
|
40610
40843
|
this.flatShading = source.flatShading;
|
|
40611
40844
|
|
|
40612
40845
|
this.fog = source.fog;
|
|
@@ -41927,7 +42160,7 @@ class KeyframeTrack {
|
|
|
41927
42160
|
|
|
41928
42161
|
}
|
|
41929
42162
|
|
|
41930
|
-
|
|
42163
|
+
warn( 'KeyframeTrack:', message );
|
|
41931
42164
|
return this;
|
|
41932
42165
|
|
|
41933
42166
|
}
|
|
@@ -42087,7 +42320,7 @@ class KeyframeTrack {
|
|
|
42087
42320
|
const valueSize = this.getValueSize();
|
|
42088
42321
|
if ( valueSize - Math.floor( valueSize ) !== 0 ) {
|
|
42089
42322
|
|
|
42090
|
-
|
|
42323
|
+
error( 'KeyframeTrack: Invalid value size in track.', this );
|
|
42091
42324
|
valid = false;
|
|
42092
42325
|
|
|
42093
42326
|
}
|
|
@@ -42099,7 +42332,7 @@ class KeyframeTrack {
|
|
|
42099
42332
|
|
|
42100
42333
|
if ( nKeys === 0 ) {
|
|
42101
42334
|
|
|
42102
|
-
|
|
42335
|
+
error( 'KeyframeTrack: Track is empty.', this );
|
|
42103
42336
|
valid = false;
|
|
42104
42337
|
|
|
42105
42338
|
}
|
|
@@ -42112,7 +42345,7 @@ class KeyframeTrack {
|
|
|
42112
42345
|
|
|
42113
42346
|
if ( typeof currTime === 'number' && isNaN( currTime ) ) {
|
|
42114
42347
|
|
|
42115
|
-
|
|
42348
|
+
error( 'KeyframeTrack: Time is not a valid number.', this, i, currTime );
|
|
42116
42349
|
valid = false;
|
|
42117
42350
|
break;
|
|
42118
42351
|
|
|
@@ -42120,7 +42353,7 @@ class KeyframeTrack {
|
|
|
42120
42353
|
|
|
42121
42354
|
if ( prevTime !== null && prevTime > currTime ) {
|
|
42122
42355
|
|
|
42123
|
-
|
|
42356
|
+
error( 'KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );
|
|
42124
42357
|
valid = false;
|
|
42125
42358
|
break;
|
|
42126
42359
|
|
|
@@ -42140,7 +42373,7 @@ class KeyframeTrack {
|
|
|
42140
42373
|
|
|
42141
42374
|
if ( isNaN( value ) ) {
|
|
42142
42375
|
|
|
42143
|
-
|
|
42376
|
+
error( 'KeyframeTrack: Value is not a valid number.', this, i, value );
|
|
42144
42377
|
valid = false;
|
|
42145
42378
|
break;
|
|
42146
42379
|
|
|
@@ -42672,6 +42905,14 @@ class AnimationClip {
|
|
|
42672
42905
|
*/
|
|
42673
42906
|
this.uuid = generateUUID();
|
|
42674
42907
|
|
|
42908
|
+
/**
|
|
42909
|
+
* An object that can be used to store custom data about the animation clip.
|
|
42910
|
+
* It should not hold references to functions as these will not be cloned.
|
|
42911
|
+
*
|
|
42912
|
+
* @type {Object}
|
|
42913
|
+
*/
|
|
42914
|
+
this.userData = {};
|
|
42915
|
+
|
|
42675
42916
|
// this means it should figure out its duration by scanning the tracks
|
|
42676
42917
|
if ( this.duration < 0 ) {
|
|
42677
42918
|
|
|
@@ -42703,6 +42944,8 @@ class AnimationClip {
|
|
|
42703
42944
|
const clip = new this( json.name, json.duration, tracks, json.blendMode );
|
|
42704
42945
|
clip.uuid = json.uuid;
|
|
42705
42946
|
|
|
42947
|
+
clip.userData = JSON.parse( json.userData || '{}' );
|
|
42948
|
+
|
|
42706
42949
|
return clip;
|
|
42707
42950
|
|
|
42708
42951
|
}
|
|
@@ -42725,7 +42968,8 @@ class AnimationClip {
|
|
|
42725
42968
|
'duration': clip.duration,
|
|
42726
42969
|
'tracks': tracks,
|
|
42727
42970
|
'uuid': clip.uuid,
|
|
42728
|
-
'blendMode': clip.blendMode
|
|
42971
|
+
'blendMode': clip.blendMode,
|
|
42972
|
+
'userData': JSON.stringify( clip.userData ),
|
|
42729
42973
|
|
|
42730
42974
|
};
|
|
42731
42975
|
|
|
@@ -42899,11 +43143,11 @@ class AnimationClip {
|
|
|
42899
43143
|
*/
|
|
42900
43144
|
static parseAnimation( animation, bones ) {
|
|
42901
43145
|
|
|
42902
|
-
|
|
43146
|
+
warn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );
|
|
42903
43147
|
|
|
42904
43148
|
if ( ! animation ) {
|
|
42905
43149
|
|
|
42906
|
-
|
|
43150
|
+
error( 'AnimationClip: No animation in JSONLoader data.' );
|
|
42907
43151
|
return null;
|
|
42908
43152
|
|
|
42909
43153
|
}
|
|
@@ -43120,7 +43364,11 @@ class AnimationClip {
|
|
|
43120
43364
|
|
|
43121
43365
|
}
|
|
43122
43366
|
|
|
43123
|
-
|
|
43367
|
+
const clip = new this.constructor( this.name, this.duration, tracks, this.blendMode );
|
|
43368
|
+
|
|
43369
|
+
clip.userData = JSON.parse( JSON.stringify( this.userData ) );
|
|
43370
|
+
|
|
43371
|
+
return clip;
|
|
43124
43372
|
|
|
43125
43373
|
}
|
|
43126
43374
|
|
|
@@ -43251,7 +43499,7 @@ const Cache = {
|
|
|
43251
43499
|
|
|
43252
43500
|
if ( this.enabled === false ) return;
|
|
43253
43501
|
|
|
43254
|
-
//
|
|
43502
|
+
// log( 'Cache', 'Adding key:', key );
|
|
43255
43503
|
|
|
43256
43504
|
this.files[ key ] = file;
|
|
43257
43505
|
|
|
@@ -43268,7 +43516,7 @@ const Cache = {
|
|
|
43268
43516
|
|
|
43269
43517
|
if ( this.enabled === false ) return;
|
|
43270
43518
|
|
|
43271
|
-
//
|
|
43519
|
+
// log( 'Cache', 'Checking key:', key );
|
|
43272
43520
|
|
|
43273
43521
|
return this.files[ key ];
|
|
43274
43522
|
|
|
@@ -43373,9 +43621,10 @@ class LoadingManager {
|
|
|
43373
43621
|
/**
|
|
43374
43622
|
* Used for aborting ongoing requests in loaders using this manager.
|
|
43375
43623
|
*
|
|
43376
|
-
* @
|
|
43624
|
+
* @private
|
|
43625
|
+
* @type {AbortController | null}
|
|
43377
43626
|
*/
|
|
43378
|
-
this.
|
|
43627
|
+
this._abortController = null;
|
|
43379
43628
|
|
|
43380
43629
|
/**
|
|
43381
43630
|
* This should be called by any loader using the manager when the loader
|
|
@@ -43586,8 +43835,9 @@ class LoadingManager {
|
|
|
43586
43835
|
*/
|
|
43587
43836
|
this.abort = function () {
|
|
43588
43837
|
|
|
43838
|
+
|
|
43589
43839
|
this.abortController.abort();
|
|
43590
|
-
this.
|
|
43840
|
+
this._abortController = null;
|
|
43591
43841
|
|
|
43592
43842
|
return this;
|
|
43593
43843
|
|
|
@@ -43595,6 +43845,26 @@ class LoadingManager {
|
|
|
43595
43845
|
|
|
43596
43846
|
}
|
|
43597
43847
|
|
|
43848
|
+
// TODO: Revert this back to a single member variable once this issue has been fixed
|
|
43849
|
+
// https://github.com/cloudflare/workerd/issues/3657
|
|
43850
|
+
|
|
43851
|
+
/**
|
|
43852
|
+
* Used for aborting ongoing requests in loaders using this manager.
|
|
43853
|
+
*
|
|
43854
|
+
* @type {AbortController}
|
|
43855
|
+
*/
|
|
43856
|
+
get abortController() {
|
|
43857
|
+
|
|
43858
|
+
if ( ! this._abortController ) {
|
|
43859
|
+
|
|
43860
|
+
this._abortController = new AbortController();
|
|
43861
|
+
|
|
43862
|
+
}
|
|
43863
|
+
|
|
43864
|
+
return this._abortController;
|
|
43865
|
+
|
|
43866
|
+
}
|
|
43867
|
+
|
|
43598
43868
|
}
|
|
43599
43869
|
|
|
43600
43870
|
/**
|
|
@@ -43659,7 +43929,7 @@ class Loader {
|
|
|
43659
43929
|
this.resourcePath = '';
|
|
43660
43930
|
|
|
43661
43931
|
/**
|
|
43662
|
-
* The [request header]
|
|
43932
|
+
* The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
43663
43933
|
* used in HTTP request.
|
|
43664
43934
|
*
|
|
43665
43935
|
* @type {Object<string, any>}
|
|
@@ -43724,7 +43994,7 @@ class Loader {
|
|
|
43724
43994
|
|
|
43725
43995
|
/**
|
|
43726
43996
|
* Whether the XMLHttpRequest uses credentials such as cookies, authorization
|
|
43727
|
-
* headers or TLS client certificates, see [XMLHttpRequest.withCredentials]
|
|
43997
|
+
* headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).
|
|
43728
43998
|
*
|
|
43729
43999
|
* Note: This setting has no effect if you are loading files locally or from the same domain.
|
|
43730
44000
|
*
|
|
@@ -43767,7 +44037,7 @@ class Loader {
|
|
|
43767
44037
|
/**
|
|
43768
44038
|
* Sets the given request header.
|
|
43769
44039
|
*
|
|
43770
|
-
* @param {Object} requestHeader - A [request header]
|
|
44040
|
+
* @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
43771
44041
|
* for configuring the HTTP request.
|
|
43772
44042
|
* @return {Loader} A reference to this instance.
|
|
43773
44043
|
*/
|
|
@@ -43859,7 +44129,7 @@ class FileLoader extends Loader {
|
|
|
43859
44129
|
|
|
43860
44130
|
/**
|
|
43861
44131
|
* The expected mime type. Valid values can be found
|
|
43862
|
-
* [here]
|
|
44132
|
+
* [here](hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
|
|
43863
44133
|
*
|
|
43864
44134
|
* @type {string}
|
|
43865
44135
|
*/
|
|
@@ -43965,7 +44235,7 @@ class FileLoader extends Loader {
|
|
|
43965
44235
|
|
|
43966
44236
|
if ( response.status === 0 ) {
|
|
43967
44237
|
|
|
43968
|
-
|
|
44238
|
+
warn( 'FileLoader: HTTP Status 0 received.' );
|
|
43969
44239
|
|
|
43970
44240
|
}
|
|
43971
44241
|
|
|
@@ -44235,7 +44505,7 @@ class AnimationLoader extends Loader {
|
|
|
44235
44505
|
|
|
44236
44506
|
} else {
|
|
44237
44507
|
|
|
44238
|
-
|
|
44508
|
+
error( e );
|
|
44239
44509
|
|
|
44240
44510
|
}
|
|
44241
44511
|
|
|
@@ -44430,7 +44700,7 @@ const _loading = new WeakMap();
|
|
|
44430
44700
|
* ```
|
|
44431
44701
|
* Please note that `ImageLoader` has dropped support for progress
|
|
44432
44702
|
* events in `r84`. For an `ImageLoader` that supports progress events, see
|
|
44433
|
-
* [this thread]
|
|
44703
|
+
* [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639).
|
|
44434
44704
|
*
|
|
44435
44705
|
* @augments Loader
|
|
44436
44706
|
*/
|
|
@@ -44739,7 +45009,7 @@ class DataTextureLoader extends Loader {
|
|
|
44739
45009
|
|
|
44740
45010
|
} else {
|
|
44741
45011
|
|
|
44742
|
-
|
|
45012
|
+
error( error );
|
|
44743
45013
|
return;
|
|
44744
45014
|
|
|
44745
45015
|
}
|
|
@@ -44834,7 +45104,7 @@ class DataTextureLoader extends Loader {
|
|
|
44834
45104
|
* ```
|
|
44835
45105
|
* Please note that `TextureLoader` has dropped support for progress
|
|
44836
45106
|
* events in `r84`. For a `TextureLoader` that supports progress events, see
|
|
44837
|
-
* [this thread]
|
|
45107
|
+
* [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).
|
|
44838
45108
|
*
|
|
44839
45109
|
* @augments Loader
|
|
44840
45110
|
*/
|
|
@@ -45837,7 +46107,7 @@ class PointLight extends Light {
|
|
|
45837
46107
|
}
|
|
45838
46108
|
|
|
45839
46109
|
/**
|
|
45840
|
-
* Camera that uses [orthographic projection]
|
|
46110
|
+
* Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection).
|
|
45841
46111
|
*
|
|
45842
46112
|
* In this projection mode, an object's size in the rendered image stays
|
|
45843
46113
|
* constant regardless of its distance from the camera. This can be useful
|
|
@@ -46837,7 +47107,7 @@ class MaterialLoader extends Loader {
|
|
|
46837
47107
|
|
|
46838
47108
|
} else {
|
|
46839
47109
|
|
|
46840
|
-
|
|
47110
|
+
error( e );
|
|
46841
47111
|
|
|
46842
47112
|
}
|
|
46843
47113
|
|
|
@@ -46863,7 +47133,7 @@ class MaterialLoader extends Loader {
|
|
|
46863
47133
|
|
|
46864
47134
|
if ( textures[ name ] === undefined ) {
|
|
46865
47135
|
|
|
46866
|
-
|
|
47136
|
+
warn( 'MaterialLoader: Undefined texture', name );
|
|
46867
47137
|
|
|
46868
47138
|
}
|
|
46869
47139
|
|
|
@@ -47355,7 +47625,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
47355
47625
|
|
|
47356
47626
|
} else {
|
|
47357
47627
|
|
|
47358
|
-
|
|
47628
|
+
error( e );
|
|
47359
47629
|
|
|
47360
47630
|
}
|
|
47361
47631
|
|
|
@@ -47528,7 +47798,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
47528
47798
|
}
|
|
47529
47799
|
|
|
47530
47800
|
/**
|
|
47531
|
-
* A loader for loading a JSON resource in the [JSON Object/Scene format]
|
|
47801
|
+
* 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).
|
|
47532
47802
|
* The files are internally loaded via {@link FileLoader}.
|
|
47533
47803
|
*
|
|
47534
47804
|
* ```js
|
|
@@ -47587,7 +47857,7 @@ class ObjectLoader extends Loader {
|
|
|
47587
47857
|
|
|
47588
47858
|
if ( onError !== undefined ) onError( error );
|
|
47589
47859
|
|
|
47590
|
-
|
|
47860
|
+
error( 'ObjectLoader: Can\'t parse ' + url + '.', error.message );
|
|
47591
47861
|
|
|
47592
47862
|
return;
|
|
47593
47863
|
|
|
@@ -47599,7 +47869,7 @@ class ObjectLoader extends Loader {
|
|
|
47599
47869
|
|
|
47600
47870
|
if ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\'t load ' + url ) );
|
|
47601
47871
|
|
|
47602
|
-
|
|
47872
|
+
error( 'ObjectLoader: Can\'t load ' + url );
|
|
47603
47873
|
return;
|
|
47604
47874
|
|
|
47605
47875
|
}
|
|
@@ -47809,7 +48079,7 @@ class ObjectLoader extends Loader {
|
|
|
47809
48079
|
|
|
47810
48080
|
} else {
|
|
47811
48081
|
|
|
47812
|
-
|
|
48082
|
+
warn( `ObjectLoader: Unsupported geometry type "${ data.type }"` );
|
|
47813
48083
|
|
|
47814
48084
|
}
|
|
47815
48085
|
|
|
@@ -48100,7 +48370,7 @@ class ObjectLoader extends Loader {
|
|
|
48100
48370
|
|
|
48101
48371
|
if ( typeof value === 'number' ) return value;
|
|
48102
48372
|
|
|
48103
|
-
|
|
48373
|
+
warn( 'ObjectLoader.parseTexture: Constant should be in numeric form.', value );
|
|
48104
48374
|
|
|
48105
48375
|
return type[ value ];
|
|
48106
48376
|
|
|
@@ -48116,13 +48386,13 @@ class ObjectLoader extends Loader {
|
|
|
48116
48386
|
|
|
48117
48387
|
if ( data.image === undefined ) {
|
|
48118
48388
|
|
|
48119
|
-
|
|
48389
|
+
warn( 'ObjectLoader: No "image" specified for', data.uuid );
|
|
48120
48390
|
|
|
48121
48391
|
}
|
|
48122
48392
|
|
|
48123
48393
|
if ( images[ data.image ] === undefined ) {
|
|
48124
48394
|
|
|
48125
|
-
|
|
48395
|
+
warn( 'ObjectLoader: Undefined image', data.image );
|
|
48126
48396
|
|
|
48127
48397
|
}
|
|
48128
48398
|
|
|
@@ -48210,7 +48480,7 @@ class ObjectLoader extends Loader {
|
|
|
48210
48480
|
|
|
48211
48481
|
if ( geometries[ name ] === undefined ) {
|
|
48212
48482
|
|
|
48213
|
-
|
|
48483
|
+
warn( 'ObjectLoader: Undefined geometry', name );
|
|
48214
48484
|
|
|
48215
48485
|
}
|
|
48216
48486
|
|
|
@@ -48232,7 +48502,7 @@ class ObjectLoader extends Loader {
|
|
|
48232
48502
|
|
|
48233
48503
|
if ( materials[ uuid ] === undefined ) {
|
|
48234
48504
|
|
|
48235
|
-
|
|
48505
|
+
warn( 'ObjectLoader: Undefined material', uuid );
|
|
48236
48506
|
|
|
48237
48507
|
}
|
|
48238
48508
|
|
|
@@ -48246,7 +48516,7 @@ class ObjectLoader extends Loader {
|
|
|
48246
48516
|
|
|
48247
48517
|
if ( materials[ name ] === undefined ) {
|
|
48248
48518
|
|
|
48249
|
-
|
|
48519
|
+
warn( 'ObjectLoader: Undefined material', name );
|
|
48250
48520
|
|
|
48251
48521
|
}
|
|
48252
48522
|
|
|
@@ -48258,7 +48528,7 @@ class ObjectLoader extends Loader {
|
|
|
48258
48528
|
|
|
48259
48529
|
if ( textures[ uuid ] === undefined ) {
|
|
48260
48530
|
|
|
48261
|
-
|
|
48531
|
+
warn( 'ObjectLoader: Undefined texture', uuid );
|
|
48262
48532
|
|
|
48263
48533
|
}
|
|
48264
48534
|
|
|
@@ -48659,7 +48929,7 @@ class ObjectLoader extends Loader {
|
|
|
48659
48929
|
|
|
48660
48930
|
if ( skeleton === undefined ) {
|
|
48661
48931
|
|
|
48662
|
-
|
|
48932
|
+
warn( 'ObjectLoader: No skeleton found with UUID:', child.skeleton );
|
|
48663
48933
|
|
|
48664
48934
|
} else {
|
|
48665
48935
|
|
|
@@ -48730,7 +49000,7 @@ const TEXTURE_FILTER = {
|
|
|
48730
49000
|
const _errorMap = new WeakMap();
|
|
48731
49001
|
|
|
48732
49002
|
/**
|
|
48733
|
-
* A loader for loading images as an [ImageBitmap]
|
|
49003
|
+
* A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap).
|
|
48734
49004
|
* An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare
|
|
48735
49005
|
* textures for rendering.
|
|
48736
49006
|
*
|
|
@@ -48774,13 +49044,13 @@ class ImageBitmapLoader extends Loader {
|
|
|
48774
49044
|
|
|
48775
49045
|
if ( typeof createImageBitmap === 'undefined' ) {
|
|
48776
49046
|
|
|
48777
|
-
|
|
49047
|
+
warn( 'ImageBitmapLoader: createImageBitmap() not supported.' );
|
|
48778
49048
|
|
|
48779
49049
|
}
|
|
48780
49050
|
|
|
48781
49051
|
if ( typeof fetch === 'undefined' ) {
|
|
48782
49052
|
|
|
48783
|
-
|
|
49053
|
+
warn( 'ImageBitmapLoader: fetch() not supported.' );
|
|
48784
49054
|
|
|
48785
49055
|
}
|
|
48786
49056
|
|
|
@@ -48804,7 +49074,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
48804
49074
|
|
|
48805
49075
|
/**
|
|
48806
49076
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
48807
|
-
* [createImageBitmap]
|
|
49077
|
+
* [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
48808
49078
|
*
|
|
48809
49079
|
* @param {Object} options - The loader options to set.
|
|
48810
49080
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
@@ -49060,7 +49330,7 @@ class AudioLoader extends Loader {
|
|
|
49060
49330
|
|
|
49061
49331
|
} else {
|
|
49062
49332
|
|
|
49063
|
-
|
|
49333
|
+
error( e );
|
|
49064
49334
|
|
|
49065
49335
|
}
|
|
49066
49336
|
|
|
@@ -49079,8 +49349,8 @@ const _projectionMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
49079
49349
|
/**
|
|
49080
49350
|
* A special type of camera that uses two perspective cameras with
|
|
49081
49351
|
* stereoscopic projection. Can be used for rendering stereo effects
|
|
49082
|
-
* like [3D Anaglyph]
|
|
49083
|
-
* [Parallax Barrier]
|
|
49352
|
+
* like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or
|
|
49353
|
+
* [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier).
|
|
49084
49354
|
*/
|
|
49085
49355
|
class StereoCamera {
|
|
49086
49356
|
|
|
@@ -49603,7 +49873,7 @@ class AudioListener extends Object3D {
|
|
|
49603
49873
|
/**
|
|
49604
49874
|
* Represents a non-positional ( global ) audio object.
|
|
49605
49875
|
*
|
|
49606
|
-
* This and related audio modules make use of the [Web Audio API]
|
|
49876
|
+
* This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/).
|
|
49607
49877
|
*
|
|
49608
49878
|
* ```js
|
|
49609
49879
|
* // create an AudioListener and add it to the camera
|
|
@@ -49914,14 +50184,14 @@ class Audio extends Object3D {
|
|
|
49914
50184
|
|
|
49915
50185
|
if ( this.isPlaying === true ) {
|
|
49916
50186
|
|
|
49917
|
-
|
|
50187
|
+
warn( 'Audio: Audio is already playing.' );
|
|
49918
50188
|
return;
|
|
49919
50189
|
|
|
49920
50190
|
}
|
|
49921
50191
|
|
|
49922
50192
|
if ( this.hasPlaybackControl === false ) {
|
|
49923
50193
|
|
|
49924
|
-
|
|
50194
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
49925
50195
|
return;
|
|
49926
50196
|
|
|
49927
50197
|
}
|
|
@@ -49958,7 +50228,7 @@ class Audio extends Object3D {
|
|
|
49958
50228
|
|
|
49959
50229
|
if ( this.hasPlaybackControl === false ) {
|
|
49960
50230
|
|
|
49961
|
-
|
|
50231
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
49962
50232
|
return;
|
|
49963
50233
|
|
|
49964
50234
|
}
|
|
@@ -50000,7 +50270,7 @@ class Audio extends Object3D {
|
|
|
50000
50270
|
|
|
50001
50271
|
if ( this.hasPlaybackControl === false ) {
|
|
50002
50272
|
|
|
50003
|
-
|
|
50273
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50004
50274
|
return;
|
|
50005
50275
|
|
|
50006
50276
|
}
|
|
@@ -50193,7 +50463,7 @@ class Audio extends Object3D {
|
|
|
50193
50463
|
|
|
50194
50464
|
if ( this.hasPlaybackControl === false ) {
|
|
50195
50465
|
|
|
50196
|
-
|
|
50466
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50197
50467
|
return;
|
|
50198
50468
|
|
|
50199
50469
|
}
|
|
@@ -50242,7 +50512,7 @@ class Audio extends Object3D {
|
|
|
50242
50512
|
|
|
50243
50513
|
if ( this.hasPlaybackControl === false ) {
|
|
50244
50514
|
|
|
50245
|
-
|
|
50515
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50246
50516
|
return false;
|
|
50247
50517
|
|
|
50248
50518
|
}
|
|
@@ -50263,7 +50533,7 @@ class Audio extends Object3D {
|
|
|
50263
50533
|
|
|
50264
50534
|
if ( this.hasPlaybackControl === false ) {
|
|
50265
50535
|
|
|
50266
|
-
|
|
50536
|
+
warn( 'Audio: this Audio has no playback control.' );
|
|
50267
50537
|
return;
|
|
50268
50538
|
|
|
50269
50539
|
}
|
|
@@ -50341,7 +50611,7 @@ class Audio extends Object3D {
|
|
|
50341
50611
|
|
|
50342
50612
|
if ( source.sourceType !== 'buffer' ) {
|
|
50343
50613
|
|
|
50344
|
-
|
|
50614
|
+
warn( 'Audio: Audio source type cannot be copied.' );
|
|
50345
50615
|
|
|
50346
50616
|
return this;
|
|
50347
50617
|
|
|
@@ -50526,7 +50796,7 @@ class PositionalAudio extends Audio {
|
|
|
50526
50796
|
* Defines which algorithm to use to reduce the volume of the audio source
|
|
50527
50797
|
* as it moves away from the listener.
|
|
50528
50798
|
*
|
|
50529
|
-
* Read [the spec]
|
|
50799
|
+
* Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype)
|
|
50530
50800
|
* for more details.
|
|
50531
50801
|
*
|
|
50532
50802
|
* @param {('linear'|'inverse'|'exponential')} value - The distance model to set.
|
|
@@ -51608,7 +51878,7 @@ class PropertyBinding {
|
|
|
51608
51878
|
// ensure there is a value node
|
|
51609
51879
|
if ( ! targetObject ) {
|
|
51610
51880
|
|
|
51611
|
-
|
|
51881
|
+
warn( 'PropertyBinding: No target node found for track: ' + this.path + '.' );
|
|
51612
51882
|
return;
|
|
51613
51883
|
|
|
51614
51884
|
}
|
|
@@ -51624,14 +51894,14 @@ class PropertyBinding {
|
|
|
51624
51894
|
|
|
51625
51895
|
if ( ! targetObject.material ) {
|
|
51626
51896
|
|
|
51627
|
-
|
|
51897
|
+
error( 'PropertyBinding: Can not bind to material as node does not have a material.', this );
|
|
51628
51898
|
return;
|
|
51629
51899
|
|
|
51630
51900
|
}
|
|
51631
51901
|
|
|
51632
51902
|
if ( ! targetObject.material.materials ) {
|
|
51633
51903
|
|
|
51634
|
-
|
|
51904
|
+
error( 'PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );
|
|
51635
51905
|
return;
|
|
51636
51906
|
|
|
51637
51907
|
}
|
|
@@ -51644,7 +51914,7 @@ class PropertyBinding {
|
|
|
51644
51914
|
|
|
51645
51915
|
if ( ! targetObject.skeleton ) {
|
|
51646
51916
|
|
|
51647
|
-
|
|
51917
|
+
error( 'PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );
|
|
51648
51918
|
return;
|
|
51649
51919
|
|
|
51650
51920
|
}
|
|
@@ -51679,14 +51949,14 @@ class PropertyBinding {
|
|
|
51679
51949
|
|
|
51680
51950
|
if ( ! targetObject.material ) {
|
|
51681
51951
|
|
|
51682
|
-
|
|
51952
|
+
error( 'PropertyBinding: Can not bind to material as node does not have a material.', this );
|
|
51683
51953
|
return;
|
|
51684
51954
|
|
|
51685
51955
|
}
|
|
51686
51956
|
|
|
51687
51957
|
if ( ! targetObject.material.map ) {
|
|
51688
51958
|
|
|
51689
|
-
|
|
51959
|
+
error( 'PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );
|
|
51690
51960
|
return;
|
|
51691
51961
|
|
|
51692
51962
|
}
|
|
@@ -51698,7 +51968,7 @@ class PropertyBinding {
|
|
|
51698
51968
|
|
|
51699
51969
|
if ( targetObject[ objectName ] === undefined ) {
|
|
51700
51970
|
|
|
51701
|
-
|
|
51971
|
+
error( 'PropertyBinding: Can not bind to objectName of node undefined.', this );
|
|
51702
51972
|
return;
|
|
51703
51973
|
|
|
51704
51974
|
}
|
|
@@ -51712,7 +51982,7 @@ class PropertyBinding {
|
|
|
51712
51982
|
|
|
51713
51983
|
if ( targetObject[ objectIndex ] === undefined ) {
|
|
51714
51984
|
|
|
51715
|
-
|
|
51985
|
+
error( 'PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );
|
|
51716
51986
|
return;
|
|
51717
51987
|
|
|
51718
51988
|
}
|
|
@@ -51730,7 +52000,7 @@ class PropertyBinding {
|
|
|
51730
52000
|
|
|
51731
52001
|
const nodeName = parsedPath.nodeName;
|
|
51732
52002
|
|
|
51733
|
-
|
|
52003
|
+
error( 'PropertyBinding: Trying to update property for track: ' + nodeName +
|
|
51734
52004
|
'.' + propertyName + ' but it wasn\'t found.', targetObject );
|
|
51735
52005
|
return;
|
|
51736
52006
|
|
|
@@ -51765,14 +52035,14 @@ class PropertyBinding {
|
|
|
51765
52035
|
// support resolving morphTarget names into indices.
|
|
51766
52036
|
if ( ! targetObject.geometry ) {
|
|
51767
52037
|
|
|
51768
|
-
|
|
52038
|
+
error( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );
|
|
51769
52039
|
return;
|
|
51770
52040
|
|
|
51771
52041
|
}
|
|
51772
52042
|
|
|
51773
52043
|
if ( ! targetObject.geometry.morphAttributes ) {
|
|
51774
52044
|
|
|
51775
|
-
|
|
52045
|
+
error( 'PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );
|
|
51776
52046
|
return;
|
|
51777
52047
|
|
|
51778
52048
|
}
|
|
@@ -52064,7 +52334,7 @@ class AnimationObjectGroup {
|
|
|
52064
52334
|
|
|
52065
52335
|
} else if ( objects[ index ] !== knownObject ) {
|
|
52066
52336
|
|
|
52067
|
-
|
|
52337
|
+
error( 'AnimationObjectGroup: Different objects with the same UUID ' +
|
|
52068
52338
|
'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );
|
|
52069
52339
|
|
|
52070
52340
|
} // else the object is already where we want it to be
|
|
@@ -53859,7 +54129,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53859
54129
|
/**
|
|
53860
54130
|
* Deactivates all previously scheduled actions on this mixer.
|
|
53861
54131
|
*
|
|
53862
|
-
* @return {AnimationMixer} A reference to
|
|
54132
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53863
54133
|
*/
|
|
53864
54134
|
stopAllAction() {
|
|
53865
54135
|
|
|
@@ -53883,7 +54153,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53883
54153
|
* time from {@link Clock} or {@link Timer}.
|
|
53884
54154
|
*
|
|
53885
54155
|
* @param {number} deltaTime - The delta time in seconds.
|
|
53886
|
-
* @return {AnimationMixer} A reference to
|
|
54156
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53887
54157
|
*/
|
|
53888
54158
|
update( deltaTime ) {
|
|
53889
54159
|
|
|
@@ -53929,7 +54199,7 @@ class AnimationMixer extends EventDispatcher {
|
|
|
53929
54199
|
* input parameter will be scaled by {@link AnimationMixer#timeScale}
|
|
53930
54200
|
*
|
|
53931
54201
|
* @param {number} time - The time to set in seconds.
|
|
53932
|
-
* @return {AnimationMixer} A reference to
|
|
54202
|
+
* @return {AnimationMixer} A reference to this animation mixer.
|
|
53933
54203
|
*/
|
|
53934
54204
|
setTime( time ) {
|
|
53935
54205
|
|
|
@@ -54704,7 +54974,7 @@ class Raycaster {
|
|
|
54704
54974
|
|
|
54705
54975
|
} else {
|
|
54706
54976
|
|
|
54707
|
-
|
|
54977
|
+
error( 'Raycaster: Unsupported camera type: ' + camera.type );
|
|
54708
54978
|
|
|
54709
54979
|
}
|
|
54710
54980
|
|
|
@@ -55016,7 +55286,7 @@ function handleVisibilityChange() {
|
|
|
55016
55286
|
|
|
55017
55287
|
/**
|
|
55018
55288
|
* This class can be used to represent points in 3D space as
|
|
55019
|
-
* [Spherical coordinates]
|
|
55289
|
+
* [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system).
|
|
55020
55290
|
*/
|
|
55021
55291
|
class Spherical {
|
|
55022
55292
|
|
|
@@ -55160,7 +55430,7 @@ class Spherical {
|
|
|
55160
55430
|
|
|
55161
55431
|
/**
|
|
55162
55432
|
* This class can be used to represent points in 3D space as
|
|
55163
|
-
* [Cylindrical coordinates]
|
|
55433
|
+
* [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system).
|
|
55164
55434
|
*/
|
|
55165
55435
|
class Cylindrical {
|
|
55166
55436
|
|
|
@@ -55283,7 +55553,7 @@ class Cylindrical {
|
|
|
55283
55553
|
* A Note on Row-Major and Column-Major Ordering:
|
|
55284
55554
|
*
|
|
55285
55555
|
* The constructor and {@link Matrix2#set} method take arguments in
|
|
55286
|
-
* [row-major]
|
|
55556
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
55287
55557
|
* order, while internally they are stored in the {@link Matrix2#elements} array in column-major order.
|
|
55288
55558
|
* This means that calling:
|
|
55289
55559
|
* ```js
|
|
@@ -57019,7 +57289,7 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
57019
57289
|
* This helps with visualizing what a camera contains in its frustum. It
|
|
57020
57290
|
* visualizes the frustum of a camera using a line segments.
|
|
57021
57291
|
*
|
|
57022
|
-
* Based on frustum visualization in [lightgl.js shadowmap example]
|
|
57292
|
+
* Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html).
|
|
57023
57293
|
*
|
|
57024
57294
|
* `CameraHelper` must be a child of the scene.
|
|
57025
57295
|
*
|
|
@@ -58131,7 +58401,7 @@ class ShapePath {
|
|
|
58131
58401
|
let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
|
|
58132
58402
|
holesFirst = isCCW ? ! holesFirst : holesFirst;
|
|
58133
58403
|
|
|
58134
|
-
//
|
|
58404
|
+
// log("Holes first", holesFirst);
|
|
58135
58405
|
|
|
58136
58406
|
const betterShapeHoles = [];
|
|
58137
58407
|
const newShapes = [];
|
|
@@ -58159,13 +58429,13 @@ class ShapePath {
|
|
|
58159
58429
|
if ( holesFirst ) mainIdx ++;
|
|
58160
58430
|
newShapeHoles[ mainIdx ] = [];
|
|
58161
58431
|
|
|
58162
|
-
//
|
|
58432
|
+
//log('cw', i);
|
|
58163
58433
|
|
|
58164
58434
|
} else {
|
|
58165
58435
|
|
|
58166
58436
|
newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
|
|
58167
58437
|
|
|
58168
|
-
//
|
|
58438
|
+
//log('ccw', i);
|
|
58169
58439
|
|
|
58170
58440
|
}
|
|
58171
58441
|
|
|
@@ -58250,7 +58520,7 @@ class ShapePath {
|
|
|
58250
58520
|
|
|
58251
58521
|
}
|
|
58252
58522
|
|
|
58253
|
-
//
|
|
58523
|
+
//log("shape", shapes);
|
|
58254
58524
|
|
|
58255
58525
|
return shapes;
|
|
58256
58526
|
|
|
@@ -58270,7 +58540,7 @@ class Controls extends EventDispatcher {
|
|
|
58270
58540
|
* Constructs a new controls instance.
|
|
58271
58541
|
*
|
|
58272
58542
|
* @param {Object3D} object - The object that is managed by the controls.
|
|
58273
|
-
* @param {?
|
|
58543
|
+
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
58274
58544
|
*/
|
|
58275
58545
|
constructor( object, domElement = null ) {
|
|
58276
58546
|
|
|
@@ -58286,7 +58556,7 @@ class Controls extends EventDispatcher {
|
|
|
58286
58556
|
/**
|
|
58287
58557
|
* The HTML element used for event listeners.
|
|
58288
58558
|
*
|
|
58289
|
-
* @type {?
|
|
58559
|
+
* @type {?HTMLElement}
|
|
58290
58560
|
* @default null
|
|
58291
58561
|
*/
|
|
58292
58562
|
this.domElement = domElement;
|
|
@@ -58336,13 +58606,13 @@ class Controls extends EventDispatcher {
|
|
|
58336
58606
|
* Connects the controls to the DOM. This method has so called "side effects" since
|
|
58337
58607
|
* it adds the module's event listeners to the DOM.
|
|
58338
58608
|
*
|
|
58339
|
-
* @param {
|
|
58609
|
+
* @param {HTMLElement} element - The DOM element to connect to.
|
|
58340
58610
|
*/
|
|
58341
58611
|
connect( element ) {
|
|
58342
58612
|
|
|
58343
58613
|
if ( element === undefined ) {
|
|
58344
58614
|
|
|
58345
|
-
|
|
58615
|
+
warn( 'Controls: connect() now requires an element.' ); // @deprecated, the warning can be removed with r185
|
|
58346
58616
|
return;
|
|
58347
58617
|
|
|
58348
58618
|
}
|
|
@@ -58589,6 +58859,7 @@ function getTextureTypeByteLength( type ) {
|
|
|
58589
58859
|
case FloatType:
|
|
58590
58860
|
return { byteLength: 4, components: 1 };
|
|
58591
58861
|
case UnsignedInt5999Type:
|
|
58862
|
+
case UnsignedInt101111Type:
|
|
58592
58863
|
return { byteLength: 4, components: 3 };
|
|
58593
58864
|
|
|
58594
58865
|
}
|
|
@@ -58675,7 +58946,7 @@ if ( typeof window !== 'undefined' ) {
|
|
|
58675
58946
|
|
|
58676
58947
|
if ( window.__THREE__ ) {
|
|
58677
58948
|
|
|
58678
|
-
|
|
58949
|
+
warn( 'WARNING: Multiple instances of Three.js being imported.' );
|
|
58679
58950
|
|
|
58680
58951
|
} else {
|
|
58681
58952
|
|
|
@@ -59018,7 +59289,7 @@ var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\
|
|
|
59018
59289
|
|
|
59019
59290
|
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";
|
|
59020
59291
|
|
|
59021
|
-
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}\
|
|
59292
|
+
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}\n#if defined( USE_MAP_TRIPLANAR ) || \\\n defined( USE_ALPHAMAP_TRIPLANAR ) || \\\n defined( USE_NORMALMAP_TRIPLANAR ) || \\\n defined( USE_ROUGHNESSMAP_TRIPLANAR ) || \\\n defined( USE_AOMAP_TRIPLANAR ) || \\\n defined( USE_METALNESSMAP_TRIPLANAR ) || \\\n defined( USE_CLEARCOAT_NORMALMAP_TRIPLANAR )\n #define USE_TRIPLANAR\n#endif\n#if defined( USE_MAP_TRIPLANAR ) || \\\n defined( USE_ALPHAMAP_TRIPLANAR ) || \\\n defined( USE_ROUGHNESSMAP_TRIPLANAR ) || \\\n defined( USE_AOMAP_TRIPLANAR ) || \\\n defined( USE_METALNESSMAP_TRIPLANAR )\n vec4 texture2DTriplanar( sampler2D map, mat3 uvTransform, vec3 coords, vec3 weights ) {\n return weights.x * texture2D( map, (uvTransform * vec3(coords.zy, 1)).xy ) +\n weights.y * texture2D( map, (uvTransform * vec3(coords.xz, 1)).xy ) +\n weights.z * texture2D( map, (uvTransform * vec3(coords.xy, 1)).xy );\n \n }\n#endif\n#if defined( USE_NORMALMAP_TRIPLANAR ) || defined( USE_CLEARCOAT_NORMALMAP_TRIPLANAR )\n vec3 texture2DTriplanarNormal( sampler2D normalMap, mat3 uvTransform, vec2 normalMapScale, vec3 normal, vec3 coords, vec3 weights ) {\n \n vec2 uvX = coords.zy; vec2 uvY = coords.xz; vec2 uvZ = coords.xy; \n vec3 tnormalX = texture2D( normalMap, (uvTransform * vec3(uvX, 1)).xy ).xyz * 2.0 - 1.0;\n vec3 tnormalY = texture2D( normalMap, (uvTransform * vec3(uvY, 1)).xy ).xyz * 2.0 - 1.0;\n vec3 tnormalZ = texture2D( normalMap, (uvTransform * vec3(uvZ, 1)).xy ).xyz * 2.0 - 1.0;\n tnormalX.xy *= normalMapScale;\n tnormalY.xy *= normalMapScale;\n tnormalZ.xy *= normalMapScale;\n \n tnormalX = vec3(\n tnormalX.xy + normal.zy,\n abs(tnormalX.z) * normal.x\n );\n tnormalY = vec3(\n tnormalY.xy + normal.xz,\n abs(tnormalY.z) * normal.y\n );\n tnormalZ = vec3(\n tnormalZ.xy + normal.xy,\n abs(tnormalZ.z) * normal.z\n );\n \n return normalize(\n tnormalX.zyx * weights.x +\n tnormalY.xzy * weights.y +\n tnormalZ.xyz * weights.z\n );\n }\n#endif\n#if defined( USE_MAP_CYLINDRICAL ) || \\\n defined( USE_ALPHAMAP_CYLINDRICAL ) || \\\n defined( USE_NORMALMAP_CYLINDRICAL ) || \\\n defined( USE_ROUGHNESSMAP_CYLINDRICAL ) || \\\n defined( USE_AOMAP_CYLINDRICAL ) || \\\n defined( USE_METALNESSMAP_CYLINDRICAL ) || \\\n defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL )\n #define USE_CYLINDRICAL\n#endif";
|
|
59022
59293
|
|
|
59023
59294
|
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";
|
|
59024
59295
|
|
|
@@ -59038,7 +59309,7 @@ var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n\tre
|
|
|
59038
59309
|
|
|
59039
59310
|
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";
|
|
59040
59311
|
|
|
59041
|
-
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
|
|
59312
|
+
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";
|
|
59042
59313
|
|
|
59043
59314
|
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";
|
|
59044
59315
|
|
|
@@ -59064,7 +59335,7 @@ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertM
|
|
|
59064
59335
|
|
|
59065
59336
|
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";
|
|
59066
59337
|
|
|
59067
|
-
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
|
|
59338
|
+
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";
|
|
59068
59339
|
|
|
59069
59340
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
59070
59341
|
|
|
@@ -59076,7 +59347,7 @@ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhong
|
|
|
59076
59347
|
|
|
59077
59348
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = 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";
|
|
59078
59349
|
|
|
59079
|
-
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}";
|
|
59350
|
+
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
59080
59351
|
|
|
59081
59352
|
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.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";
|
|
59082
59353
|
|
|
@@ -59084,13 +59355,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
|
|
|
59084
59355
|
|
|
59085
59356
|
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";
|
|
59086
59357
|
|
|
59087
|
-
var logdepthbuf_fragment = "#if defined(
|
|
59358
|
+
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";
|
|
59088
59359
|
|
|
59089
|
-
var logdepthbuf_pars_fragment = "#if defined(
|
|
59360
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
59090
59361
|
|
|
59091
|
-
var logdepthbuf_pars_vertex = "#ifdef
|
|
59362
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
59092
59363
|
|
|
59093
|
-
var logdepthbuf_vertex = "#ifdef
|
|
59364
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
59094
59365
|
|
|
59095
59366
|
var map_fragment = "#ifdef USE_MAP\n\t#ifdef USE_MAP_TRIPLANAR\n\t\tvec4 sampledDiffuseColor = texture2DTriplanar( map, mapTransform, triplanarCoords, triplanarWeights );\n\t#else\n #if defined( USE_MAP_CYLINDRICAL )\n vec2 vMapUv = ( mapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
59096
59367
|
|
|
@@ -59152,7 +59423,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
59152
59423
|
|
|
59153
59424
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
59154
59425
|
|
|
59155
|
-
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
|
|
59426
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform 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";
|
|
59156
59427
|
|
|
59157
59428
|
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";
|
|
59158
59429
|
|
|
@@ -59202,7 +59473,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
59202
59473
|
|
|
59203
59474
|
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 <batching_vertex>\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
59204
59475
|
|
|
59205
|
-
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 <triplanar_fragment>\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
|
|
59476
|
+
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 <triplanar_fragment>\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}";
|
|
59206
59477
|
|
|
59207
59478
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
59208
59479
|
|
|
@@ -59438,6 +59709,7 @@ const UniformsLib = {
|
|
|
59438
59709
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
59439
59710
|
ior: { value: 1.5 }, // physical
|
|
59440
59711
|
refractionRatio: { value: 0.98 }, // basic, lambert, phong
|
|
59712
|
+
dfgLUT: { value: null } // DFG LUT for physically-based rendering
|
|
59441
59713
|
|
|
59442
59714
|
},
|
|
59443
59715
|
|
|
@@ -61034,7 +61306,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
61034
61306
|
|
|
61035
61307
|
if ( maxPrecision !== precision ) {
|
|
61036
61308
|
|
|
61037
|
-
|
|
61309
|
+
warn( 'WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );
|
|
61038
61310
|
precision = maxPrecision;
|
|
61039
61311
|
|
|
61040
61312
|
}
|
|
@@ -61351,16 +61623,18 @@ function WebGLCubeMaps( renderer ) {
|
|
|
61351
61623
|
|
|
61352
61624
|
const LOD_MIN = 4;
|
|
61353
61625
|
|
|
61354
|
-
// The standard deviations (radians) associated with the extra mips.
|
|
61355
|
-
//
|
|
61356
|
-
// geometric shadowing function. These sigma values squared must match the
|
|
61357
|
-
// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
61626
|
+
// The standard deviations (radians) associated with the extra mips.
|
|
61627
|
+
// Used for scene blur in fromScene() method.
|
|
61358
61628
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
61359
61629
|
|
|
61360
61630
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
61361
61631
|
// samples and exit early, but not recompile the shader.
|
|
61632
|
+
// Used for scene blur in fromScene() method.
|
|
61362
61633
|
const MAX_SAMPLES = 20;
|
|
61363
61634
|
|
|
61635
|
+
// GGX VNDF importance sampling configuration
|
|
61636
|
+
const GGX_SAMPLES = 256;
|
|
61637
|
+
|
|
61364
61638
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
61365
61639
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
61366
61640
|
let _oldTarget = null;
|
|
@@ -61368,24 +61642,6 @@ let _oldActiveCubeFace = 0;
|
|
|
61368
61642
|
let _oldActiveMipmapLevel = 0;
|
|
61369
61643
|
let _oldXrEnabled = false;
|
|
61370
61644
|
|
|
61371
|
-
// Golden Ratio
|
|
61372
|
-
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
61373
|
-
const INV_PHI = 1 / PHI;
|
|
61374
|
-
|
|
61375
|
-
// Vertices of a dodecahedron (except the opposites, which represent the
|
|
61376
|
-
// same axis), used as axis directions evenly spread on a sphere.
|
|
61377
|
-
const _axisDirections = [
|
|
61378
|
-
/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
61379
|
-
/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
61380
|
-
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
61381
|
-
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
61382
|
-
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
61383
|
-
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
61384
|
-
/*@__PURE__*/ new Vector3( -1, 1, -1 ),
|
|
61385
|
-
/*@__PURE__*/ new Vector3( 1, 1, -1 ),
|
|
61386
|
-
/*@__PURE__*/ new Vector3( -1, 1, 1 ),
|
|
61387
|
-
/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
61388
|
-
|
|
61389
61645
|
const _origin = /*@__PURE__*/ new Vector3();
|
|
61390
61646
|
|
|
61391
61647
|
/**
|
|
@@ -61399,9 +61655,11 @@ const _origin = /*@__PURE__*/ new Vector3();
|
|
|
61399
61655
|
* higher roughness levels. In this way we maintain resolution to smoothly
|
|
61400
61656
|
* interpolate diffuse lighting while limiting sampling computation.
|
|
61401
61657
|
*
|
|
61402
|
-
*
|
|
61403
|
-
*
|
|
61404
|
-
|
|
61658
|
+
* The prefiltering uses GGX VNDF (Visible Normal Distribution Function)
|
|
61659
|
+
* importance sampling based on "Sampling the GGX Distribution of Visible Normals"
|
|
61660
|
+
* (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF
|
|
61661
|
+
* used in material rendering for physically-based image-based lighting.
|
|
61662
|
+
*/
|
|
61405
61663
|
class PMREMGenerator {
|
|
61406
61664
|
|
|
61407
61665
|
/**
|
|
@@ -61416,15 +61674,17 @@ class PMREMGenerator {
|
|
|
61416
61674
|
|
|
61417
61675
|
this._lodMax = 0;
|
|
61418
61676
|
this._cubeSize = 0;
|
|
61419
|
-
this._lodPlanes = [];
|
|
61420
61677
|
this._sizeLods = [];
|
|
61421
61678
|
this._sigmas = [];
|
|
61679
|
+
this._lodMeshes = [];
|
|
61680
|
+
|
|
61681
|
+
this._backgroundBox = null;
|
|
61422
61682
|
|
|
61423
|
-
this._blurMaterial = null;
|
|
61424
61683
|
this._cubemapMaterial = null;
|
|
61425
61684
|
this._equirectMaterial = null;
|
|
61426
61685
|
|
|
61427
|
-
this.
|
|
61686
|
+
this._blurMaterial = null;
|
|
61687
|
+
this._ggxMaterial = null;
|
|
61428
61688
|
|
|
61429
61689
|
}
|
|
61430
61690
|
|
|
@@ -61549,6 +61809,13 @@ class PMREMGenerator {
|
|
|
61549
61809
|
if ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();
|
|
61550
61810
|
if ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();
|
|
61551
61811
|
|
|
61812
|
+
if ( this._backgroundBox !== null ) {
|
|
61813
|
+
|
|
61814
|
+
this._backgroundBox.geometry.dispose();
|
|
61815
|
+
this._backgroundBox.material.dispose();
|
|
61816
|
+
|
|
61817
|
+
}
|
|
61818
|
+
|
|
61552
61819
|
}
|
|
61553
61820
|
|
|
61554
61821
|
// private interface
|
|
@@ -61563,12 +61830,13 @@ class PMREMGenerator {
|
|
|
61563
61830
|
_dispose() {
|
|
61564
61831
|
|
|
61565
61832
|
if ( this._blurMaterial !== null ) this._blurMaterial.dispose();
|
|
61833
|
+
if ( this._ggxMaterial !== null ) this._ggxMaterial.dispose();
|
|
61566
61834
|
|
|
61567
61835
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
61568
61836
|
|
|
61569
|
-
for ( let i = 0; i < this.
|
|
61837
|
+
for ( let i = 0; i < this._lodMeshes.length; i ++ ) {
|
|
61570
61838
|
|
|
61571
|
-
this.
|
|
61839
|
+
this._lodMeshes[ i ].geometry.dispose();
|
|
61572
61840
|
|
|
61573
61841
|
}
|
|
61574
61842
|
|
|
@@ -61640,7 +61908,7 @@ class PMREMGenerator {
|
|
|
61640
61908
|
this._pingPongRenderTarget = _createRenderTarget( width, height, params );
|
|
61641
61909
|
|
|
61642
61910
|
const { _lodMax } = this;
|
|
61643
|
-
( {
|
|
61911
|
+
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
61644
61912
|
|
|
61645
61913
|
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
61646
61914
|
|
|
@@ -61652,8 +61920,8 @@ class PMREMGenerator {
|
|
|
61652
61920
|
|
|
61653
61921
|
_compileMaterial( material ) {
|
|
61654
61922
|
|
|
61655
|
-
const
|
|
61656
|
-
this._renderer.compile(
|
|
61923
|
+
const mesh = new Mesh( new BufferGeometry(), material );
|
|
61924
|
+
this._renderer.compile( mesh, _flatCamera );
|
|
61657
61925
|
|
|
61658
61926
|
}
|
|
61659
61927
|
|
|
@@ -61684,16 +61952,25 @@ class PMREMGenerator {
|
|
|
61684
61952
|
|
|
61685
61953
|
}
|
|
61686
61954
|
|
|
61687
|
-
|
|
61688
|
-
name: 'PMREM.Background',
|
|
61689
|
-
side: BackSide,
|
|
61690
|
-
depthWrite: false,
|
|
61691
|
-
depthTest: false,
|
|
61692
|
-
} );
|
|
61955
|
+
if ( this._backgroundBox === null ) {
|
|
61693
61956
|
|
|
61694
|
-
|
|
61957
|
+
this._backgroundBox = new Mesh(
|
|
61958
|
+
new BoxGeometry(),
|
|
61959
|
+
new MeshBasicMaterial( {
|
|
61960
|
+
name: 'PMREM.Background',
|
|
61961
|
+
side: BackSide,
|
|
61962
|
+
depthWrite: false,
|
|
61963
|
+
depthTest: false,
|
|
61964
|
+
} )
|
|
61965
|
+
);
|
|
61966
|
+
|
|
61967
|
+
}
|
|
61968
|
+
|
|
61969
|
+
const backgroundBox = this._backgroundBox;
|
|
61970
|
+
const backgroundMaterial = backgroundBox.material;
|
|
61695
61971
|
|
|
61696
61972
|
let useSolidColor = false;
|
|
61973
|
+
|
|
61697
61974
|
const background = scene.background;
|
|
61698
61975
|
|
|
61699
61976
|
if ( background ) {
|
|
@@ -61754,9 +62031,6 @@ class PMREMGenerator {
|
|
|
61754
62031
|
|
|
61755
62032
|
}
|
|
61756
62033
|
|
|
61757
|
-
backgroundBox.geometry.dispose();
|
|
61758
|
-
backgroundBox.material.dispose();
|
|
61759
|
-
|
|
61760
62034
|
renderer.toneMapping = toneMapping;
|
|
61761
62035
|
renderer.autoClear = originalAutoClear;
|
|
61762
62036
|
scene.background = background;
|
|
@@ -61790,7 +62064,9 @@ class PMREMGenerator {
|
|
|
61790
62064
|
}
|
|
61791
62065
|
|
|
61792
62066
|
const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;
|
|
61793
|
-
|
|
62067
|
+
|
|
62068
|
+
const mesh = this._lodMeshes[ 0 ];
|
|
62069
|
+
mesh.material = material;
|
|
61794
62070
|
|
|
61795
62071
|
const uniforms = material.uniforms;
|
|
61796
62072
|
|
|
@@ -61810,19 +62086,82 @@ class PMREMGenerator {
|
|
|
61810
62086
|
const renderer = this._renderer;
|
|
61811
62087
|
const autoClear = renderer.autoClear;
|
|
61812
62088
|
renderer.autoClear = false;
|
|
61813
|
-
const n = this._lodPlanes.length;
|
|
61814
62089
|
|
|
62090
|
+
const n = this._lodMeshes.length;
|
|
62091
|
+
|
|
62092
|
+
// Use GGX VNDF importance sampling
|
|
61815
62093
|
for ( let i = 1; i < n; i ++ ) {
|
|
61816
62094
|
|
|
61817
|
-
|
|
62095
|
+
this._applyGGXFilter( cubeUVRenderTarget, i - 1, i );
|
|
61818
62096
|
|
|
61819
|
-
|
|
62097
|
+
}
|
|
62098
|
+
|
|
62099
|
+
renderer.autoClear = autoClear;
|
|
62100
|
+
|
|
62101
|
+
}
|
|
61820
62102
|
|
|
61821
|
-
|
|
62103
|
+
/**
|
|
62104
|
+
* Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.
|
|
62105
|
+
* Uses Monte Carlo integration with VNDF importance sampling to accurately represent the
|
|
62106
|
+
* GGX BRDF for physically-based rendering. Reads from the previous LOD level and
|
|
62107
|
+
* applies incremental roughness filtering to avoid over-blurring.
|
|
62108
|
+
*
|
|
62109
|
+
* @private
|
|
62110
|
+
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
62111
|
+
* @param {number} lodIn - Source LOD level to read from
|
|
62112
|
+
* @param {number} lodOut - Target LOD level to write to
|
|
62113
|
+
*/
|
|
62114
|
+
_applyGGXFilter( cubeUVRenderTarget, lodIn, lodOut ) {
|
|
62115
|
+
|
|
62116
|
+
const renderer = this._renderer;
|
|
62117
|
+
const pingPongRenderTarget = this._pingPongRenderTarget;
|
|
62118
|
+
|
|
62119
|
+
if ( this._ggxMaterial === null ) {
|
|
62120
|
+
|
|
62121
|
+
const width = 3 * Math.max( this._cubeSize, 16 );
|
|
62122
|
+
const height = 4 * this._cubeSize;
|
|
62123
|
+
this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
|
|
61822
62124
|
|
|
61823
62125
|
}
|
|
61824
62126
|
|
|
61825
|
-
|
|
62127
|
+
const ggxMaterial = this._ggxMaterial;
|
|
62128
|
+
const ggxMesh = this._lodMeshes[ lodOut ];
|
|
62129
|
+
ggxMesh.material = ggxMaterial;
|
|
62130
|
+
|
|
62131
|
+
const ggxUniforms = ggxMaterial.uniforms;
|
|
62132
|
+
|
|
62133
|
+
// Calculate incremental roughness between LOD levels
|
|
62134
|
+
const targetRoughness = lodOut / ( this._lodMeshes.length - 1 );
|
|
62135
|
+
const sourceRoughness = lodIn / ( this._lodMeshes.length - 1 );
|
|
62136
|
+
const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
|
|
62137
|
+
|
|
62138
|
+
// Apply blur strength mapping for better quality across the roughness range
|
|
62139
|
+
const blurStrength = 0.05 + targetRoughness * 0.95;
|
|
62140
|
+
const adjustedRoughness = incrementalRoughness * blurStrength;
|
|
62141
|
+
|
|
62142
|
+
// Calculate viewport position based on output LOD level
|
|
62143
|
+
const { _lodMax } = this;
|
|
62144
|
+
const outputSize = this._sizeLods[ lodOut ];
|
|
62145
|
+
const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
62146
|
+
const y = 4 * ( this._cubeSize - outputSize );
|
|
62147
|
+
|
|
62148
|
+
// Read from previous LOD with incremental roughness
|
|
62149
|
+
ggxUniforms[ 'envMap' ].value = cubeUVRenderTarget.texture;
|
|
62150
|
+
ggxUniforms[ 'roughness' ].value = adjustedRoughness;
|
|
62151
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodIn; // Sample from input LOD
|
|
62152
|
+
|
|
62153
|
+
_setViewport( pingPongRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
62154
|
+
renderer.setRenderTarget( pingPongRenderTarget );
|
|
62155
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
62156
|
+
|
|
62157
|
+
// Copy from pingPong back to cubeUV (simple direct copy)
|
|
62158
|
+
ggxUniforms[ 'envMap' ].value = pingPongRenderTarget.texture;
|
|
62159
|
+
ggxUniforms[ 'roughness' ].value = 0.0; // Direct copy
|
|
62160
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodOut; // Read from the level we just wrote
|
|
62161
|
+
|
|
62162
|
+
_setViewport( cubeUVRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
62163
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
62164
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
61826
62165
|
|
|
61827
62166
|
}
|
|
61828
62167
|
|
|
@@ -61833,6 +62172,8 @@ class PMREMGenerator {
|
|
|
61833
62172
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
61834
62173
|
* accurate at the poles, but still does a decent job.
|
|
61835
62174
|
*
|
|
62175
|
+
* Used for initial scene blur in fromScene() method when sigma > 0.
|
|
62176
|
+
*
|
|
61836
62177
|
* @private
|
|
61837
62178
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
61838
62179
|
* @param {number} lodIn
|
|
@@ -61871,7 +62212,7 @@ class PMREMGenerator {
|
|
|
61871
62212
|
|
|
61872
62213
|
if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {
|
|
61873
62214
|
|
|
61874
|
-
|
|
62215
|
+
error(
|
|
61875
62216
|
'blur direction must be either latitudinal or longitudinal!' );
|
|
61876
62217
|
|
|
61877
62218
|
}
|
|
@@ -61879,7 +62220,9 @@ class PMREMGenerator {
|
|
|
61879
62220
|
// Number of standard deviations at which to cut off the discrete approximation.
|
|
61880
62221
|
const STANDARD_DEVIATIONS = 3;
|
|
61881
62222
|
|
|
61882
|
-
const blurMesh =
|
|
62223
|
+
const blurMesh = this._lodMeshes[ lodOut ];
|
|
62224
|
+
blurMesh.material = blurMaterial;
|
|
62225
|
+
|
|
61883
62226
|
const blurUniforms = blurMaterial.uniforms;
|
|
61884
62227
|
|
|
61885
62228
|
const pixels = this._sizeLods[ lodIn ] - 1;
|
|
@@ -61889,7 +62232,7 @@ class PMREMGenerator {
|
|
|
61889
62232
|
|
|
61890
62233
|
if ( samples > MAX_SAMPLES ) {
|
|
61891
62234
|
|
|
61892
|
-
|
|
62235
|
+
warn( `sigmaRadians, ${
|
|
61893
62236
|
sigmaRadians}, is too large and will clip, as it requested ${
|
|
61894
62237
|
samples} samples when the maximum is set to ${MAX_SAMPLES}` );
|
|
61895
62238
|
|
|
@@ -61953,9 +62296,9 @@ class PMREMGenerator {
|
|
|
61953
62296
|
|
|
61954
62297
|
function _createPlanes( lodMax ) {
|
|
61955
62298
|
|
|
61956
|
-
const lodPlanes = [];
|
|
61957
62299
|
const sizeLods = [];
|
|
61958
62300
|
const sigmas = [];
|
|
62301
|
+
const lodMeshes = [];
|
|
61959
62302
|
|
|
61960
62303
|
let lod = lodMax;
|
|
61961
62304
|
|
|
@@ -62017,7 +62360,7 @@ function _createPlanes( lodMax ) {
|
|
|
62017
62360
|
planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );
|
|
62018
62361
|
planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );
|
|
62019
62362
|
planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );
|
|
62020
|
-
|
|
62363
|
+
lodMeshes.push( new Mesh( planes, null ) );
|
|
62021
62364
|
|
|
62022
62365
|
if ( lod > LOD_MIN ) {
|
|
62023
62366
|
|
|
@@ -62027,7 +62370,7 @@ function _createPlanes( lodMax ) {
|
|
|
62027
62370
|
|
|
62028
62371
|
}
|
|
62029
62372
|
|
|
62030
|
-
return {
|
|
62373
|
+
return { lodMeshes, sizeLods, sigmas };
|
|
62031
62374
|
|
|
62032
62375
|
}
|
|
62033
62376
|
|
|
@@ -62048,6 +62391,147 @@ function _setViewport( target, x, y, width, height ) {
|
|
|
62048
62391
|
|
|
62049
62392
|
}
|
|
62050
62393
|
|
|
62394
|
+
function _getGGXShader( lodMax, width, height ) {
|
|
62395
|
+
|
|
62396
|
+
const shaderMaterial = new ShaderMaterial( {
|
|
62397
|
+
|
|
62398
|
+
name: 'PMREMGGXConvolution',
|
|
62399
|
+
|
|
62400
|
+
defines: {
|
|
62401
|
+
'GGX_SAMPLES': GGX_SAMPLES,
|
|
62402
|
+
'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
62403
|
+
'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
62404
|
+
'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
62405
|
+
},
|
|
62406
|
+
|
|
62407
|
+
uniforms: {
|
|
62408
|
+
'envMap': { value: null },
|
|
62409
|
+
'roughness': { value: 0.0 },
|
|
62410
|
+
'mipInt': { value: 0 }
|
|
62411
|
+
},
|
|
62412
|
+
|
|
62413
|
+
vertexShader: _getCommonVertexShader(),
|
|
62414
|
+
|
|
62415
|
+
fragmentShader: /* glsl */`
|
|
62416
|
+
|
|
62417
|
+
precision highp float;
|
|
62418
|
+
precision highp int;
|
|
62419
|
+
|
|
62420
|
+
varying vec3 vOutputDirection;
|
|
62421
|
+
|
|
62422
|
+
uniform sampler2D envMap;
|
|
62423
|
+
uniform float roughness;
|
|
62424
|
+
uniform float mipInt;
|
|
62425
|
+
|
|
62426
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
62427
|
+
#include <cube_uv_reflection_fragment>
|
|
62428
|
+
|
|
62429
|
+
#define PI 3.14159265359
|
|
62430
|
+
|
|
62431
|
+
// Van der Corput radical inverse
|
|
62432
|
+
float radicalInverse_VdC(uint bits) {
|
|
62433
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
62434
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
62435
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
62436
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
62437
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
62438
|
+
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
62439
|
+
}
|
|
62440
|
+
|
|
62441
|
+
// Hammersley sequence
|
|
62442
|
+
vec2 hammersley(uint i, uint N) {
|
|
62443
|
+
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
62444
|
+
}
|
|
62445
|
+
|
|
62446
|
+
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
62447
|
+
// "Sampling the GGX Distribution of Visible Normals"
|
|
62448
|
+
// https://jcgt.org/published/0007/04/01/
|
|
62449
|
+
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
62450
|
+
float alpha = roughness * roughness;
|
|
62451
|
+
|
|
62452
|
+
// Section 3.2: Transform view direction to hemisphere configuration
|
|
62453
|
+
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
62454
|
+
|
|
62455
|
+
// Section 4.1: Orthonormal basis
|
|
62456
|
+
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
62457
|
+
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
62458
|
+
vec3 T2 = cross(Vh, T1);
|
|
62459
|
+
|
|
62460
|
+
// Section 4.2: Parameterization of projected area
|
|
62461
|
+
float r = sqrt(Xi.x);
|
|
62462
|
+
float phi = 2.0 * PI * Xi.y;
|
|
62463
|
+
float t1 = r * cos(phi);
|
|
62464
|
+
float t2 = r * sin(phi);
|
|
62465
|
+
float s = 0.5 * (1.0 + Vh.z);
|
|
62466
|
+
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
62467
|
+
|
|
62468
|
+
// Section 4.3: Reprojection onto hemisphere
|
|
62469
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
62470
|
+
|
|
62471
|
+
// Section 3.4: Transform back to ellipsoid configuration
|
|
62472
|
+
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
62473
|
+
}
|
|
62474
|
+
|
|
62475
|
+
void main() {
|
|
62476
|
+
vec3 N = normalize(vOutputDirection);
|
|
62477
|
+
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
62478
|
+
|
|
62479
|
+
vec3 prefilteredColor = vec3(0.0);
|
|
62480
|
+
float totalWeight = 0.0;
|
|
62481
|
+
|
|
62482
|
+
// For very low roughness, just sample the environment directly
|
|
62483
|
+
if (roughness < 0.001) {
|
|
62484
|
+
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
62485
|
+
return;
|
|
62486
|
+
}
|
|
62487
|
+
|
|
62488
|
+
// Tangent space basis for VNDF sampling
|
|
62489
|
+
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
62490
|
+
vec3 tangent = normalize(cross(up, N));
|
|
62491
|
+
vec3 bitangent = cross(N, tangent);
|
|
62492
|
+
|
|
62493
|
+
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
62494
|
+
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
62495
|
+
|
|
62496
|
+
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
62497
|
+
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
62498
|
+
|
|
62499
|
+
// Transform H back to world space
|
|
62500
|
+
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
62501
|
+
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
62502
|
+
|
|
62503
|
+
float NdotL = max(dot(N, L), 0.0);
|
|
62504
|
+
|
|
62505
|
+
if(NdotL > 0.0) {
|
|
62506
|
+
// Sample environment at fixed mip level
|
|
62507
|
+
// VNDF importance sampling handles the distribution filtering
|
|
62508
|
+
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
62509
|
+
|
|
62510
|
+
// Weight by NdotL for the split-sum approximation
|
|
62511
|
+
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
62512
|
+
prefilteredColor += sampleColor * NdotL;
|
|
62513
|
+
totalWeight += NdotL;
|
|
62514
|
+
}
|
|
62515
|
+
}
|
|
62516
|
+
|
|
62517
|
+
if (totalWeight > 0.0) {
|
|
62518
|
+
prefilteredColor = prefilteredColor / totalWeight;
|
|
62519
|
+
}
|
|
62520
|
+
|
|
62521
|
+
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
62522
|
+
}
|
|
62523
|
+
`,
|
|
62524
|
+
|
|
62525
|
+
blending: NoBlending,
|
|
62526
|
+
depthTest: false,
|
|
62527
|
+
depthWrite: false
|
|
62528
|
+
|
|
62529
|
+
} );
|
|
62530
|
+
|
|
62531
|
+
return shaderMaterial;
|
|
62532
|
+
|
|
62533
|
+
}
|
|
62534
|
+
|
|
62051
62535
|
function _getBlurShader( lodMax, width, height ) {
|
|
62052
62536
|
|
|
62053
62537
|
const weights = new Float32Array( MAX_SAMPLES );
|
|
@@ -62430,30 +62914,7 @@ function WebGLExtensions( gl ) {
|
|
|
62430
62914
|
|
|
62431
62915
|
}
|
|
62432
62916
|
|
|
62433
|
-
|
|
62434
|
-
|
|
62435
|
-
switch ( name ) {
|
|
62436
|
-
|
|
62437
|
-
case 'WEBGL_depth_texture':
|
|
62438
|
-
extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );
|
|
62439
|
-
break;
|
|
62440
|
-
|
|
62441
|
-
case 'EXT_texture_filter_anisotropic':
|
|
62442
|
-
extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
|
|
62443
|
-
break;
|
|
62444
|
-
|
|
62445
|
-
case 'WEBGL_compressed_texture_s3tc':
|
|
62446
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
|
|
62447
|
-
break;
|
|
62448
|
-
|
|
62449
|
-
case 'WEBGL_compressed_texture_pvrtc':
|
|
62450
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
|
|
62451
|
-
break;
|
|
62452
|
-
|
|
62453
|
-
default:
|
|
62454
|
-
extension = gl.getExtension( name );
|
|
62455
|
-
|
|
62456
|
-
}
|
|
62917
|
+
const extension = gl.getExtension( name );
|
|
62457
62918
|
|
|
62458
62919
|
extensions[ name ] = extension;
|
|
62459
62920
|
|
|
@@ -62486,7 +62947,7 @@ function WebGLExtensions( gl ) {
|
|
|
62486
62947
|
|
|
62487
62948
|
if ( extension === null ) {
|
|
62488
62949
|
|
|
62489
|
-
warnOnce( '
|
|
62950
|
+
warnOnce( 'WebGLRenderer: ' + name + ' extension not supported.' );
|
|
62490
62951
|
|
|
62491
62952
|
}
|
|
62492
62953
|
|
|
@@ -62816,7 +63277,7 @@ function WebGLInfo( gl ) {
|
|
|
62816
63277
|
break;
|
|
62817
63278
|
|
|
62818
63279
|
default:
|
|
62819
|
-
|
|
63280
|
+
error( 'WebGLInfo: Unknown draw mode:', mode );
|
|
62820
63281
|
break;
|
|
62821
63282
|
|
|
62822
63283
|
}
|
|
@@ -64305,7 +64766,7 @@ function getEncodingComponents( colorSpace ) {
|
|
|
64305
64766
|
return [ encodingMatrix, 'sRGBTransferOETF' ];
|
|
64306
64767
|
|
|
64307
64768
|
default:
|
|
64308
|
-
|
|
64769
|
+
warn( 'WebGLProgram: Unsupported color space: ', colorSpace );
|
|
64309
64770
|
return [ encodingMatrix, 'LinearTransferOETF' ];
|
|
64310
64771
|
|
|
64311
64772
|
}
|
|
@@ -64325,7 +64786,7 @@ function getShaderErrors( gl, shader, type ) {
|
|
|
64325
64786
|
if ( errorMatches ) {
|
|
64326
64787
|
|
|
64327
64788
|
// --enable-privileged-webgl-extension
|
|
64328
|
-
//
|
|
64789
|
+
// log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
|
|
64329
64790
|
|
|
64330
64791
|
const errorLine = parseInt( errorMatches[ 1 ] );
|
|
64331
64792
|
return type.toUpperCase() + '\n\n' + errors + '\n\n' + handleSource( gl.getShaderSource( shader ), errorLine );
|
|
@@ -64389,7 +64850,7 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
64389
64850
|
break;
|
|
64390
64851
|
|
|
64391
64852
|
default:
|
|
64392
|
-
|
|
64853
|
+
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
|
|
64393
64854
|
toneMappingName = 'Linear';
|
|
64394
64855
|
|
|
64395
64856
|
}
|
|
@@ -64467,7 +64928,7 @@ function fetchAttributeLocations( gl, program ) {
|
|
|
64467
64928
|
if ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;
|
|
64468
64929
|
if ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;
|
|
64469
64930
|
|
|
64470
|
-
//
|
|
64931
|
+
// log( 'WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
|
|
64471
64932
|
|
|
64472
64933
|
attributes[ name ] = {
|
|
64473
64934
|
type: info.type,
|
|
@@ -64537,7 +64998,7 @@ function includeReplacer( match, include ) {
|
|
|
64537
64998
|
if ( newInclude !== undefined ) {
|
|
64538
64999
|
|
|
64539
65000
|
string = ShaderChunk[ newInclude ];
|
|
64540
|
-
|
|
65001
|
+
warn( 'WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude );
|
|
64541
65002
|
|
|
64542
65003
|
} else {
|
|
64543
65004
|
|
|
@@ -64733,7 +65194,7 @@ function generateCubeUVSize( parameters ) {
|
|
|
64733
65194
|
function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
64734
65195
|
|
|
64735
65196
|
// TODO Send this event to Three.js DevTools
|
|
64736
|
-
//
|
|
65197
|
+
// log( 'WebGLProgram', cacheKey );
|
|
64737
65198
|
|
|
64738
65199
|
const gl = renderer.getContext();
|
|
64739
65200
|
|
|
@@ -64921,8 +65382,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
64921
65382
|
|
|
64922
65383
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
64923
65384
|
|
|
64924
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
64925
|
-
parameters.reversedDepthBuffer ? '#define
|
|
65385
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
65386
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
64926
65387
|
|
|
64927
65388
|
'uniform mat4 modelMatrix;',
|
|
64928
65389
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -65097,8 +65558,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65097
65558
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
65098
65559
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
65099
65560
|
|
|
65100
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
65101
|
-
parameters.reversedDepthBuffer ? '#define
|
|
65561
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
65562
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
65102
65563
|
|
|
65103
65564
|
'uniform mat4 modelViewMatrix;',
|
|
65104
65565
|
'uniform mat4 viewMatrix;',
|
|
@@ -65170,8 +65631,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65170
65631
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
65171
65632
|
const fragmentGlsl = versionString + prefixFragment + fragmentShader;
|
|
65172
65633
|
|
|
65173
|
-
//
|
|
65174
|
-
//
|
|
65634
|
+
// log( '*VERTEX*', vertexGlsl );
|
|
65635
|
+
// log( '*FRAGMENT*', fragmentGlsl );
|
|
65175
65636
|
|
|
65176
65637
|
const glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );
|
|
65177
65638
|
const glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );
|
|
@@ -65225,7 +65686,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65225
65686
|
const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
65226
65687
|
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
65227
65688
|
|
|
65228
|
-
|
|
65689
|
+
error(
|
|
65229
65690
|
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
65230
65691
|
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
65231
65692
|
'Material Name: ' + self.name + '\n' +
|
|
@@ -65239,7 +65700,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
65239
65700
|
|
|
65240
65701
|
} else if ( programLog !== '' ) {
|
|
65241
65702
|
|
|
65242
|
-
|
|
65703
|
+
warn( 'WebGLProgram: Program Info Log:', programLog );
|
|
65243
65704
|
|
|
65244
65705
|
} else if ( vertexLog === '' || fragmentLog === '' ) {
|
|
65245
65706
|
|
|
@@ -65549,7 +66010,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65549
66010
|
|
|
65550
66011
|
if ( precision !== material.precision ) {
|
|
65551
66012
|
|
|
65552
|
-
|
|
66013
|
+
warn( 'WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );
|
|
65553
66014
|
|
|
65554
66015
|
}
|
|
65555
66016
|
|
|
@@ -67197,7 +67658,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67197
67658
|
// Set GL state for depth map.
|
|
67198
67659
|
_state.setBlending( NoBlending );
|
|
67199
67660
|
|
|
67200
|
-
if ( _state.buffers.depth.getReversed() ) {
|
|
67661
|
+
if ( _state.buffers.depth.getReversed() === true ) {
|
|
67201
67662
|
|
|
67202
67663
|
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
67203
67664
|
|
|
@@ -67224,7 +67685,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
67224
67685
|
|
|
67225
67686
|
if ( shadow === undefined ) {
|
|
67226
67687
|
|
|
67227
|
-
|
|
67688
|
+
warn( 'WebGLShadowMap:', light, 'has no shadow.' );
|
|
67228
67689
|
continue;
|
|
67229
67690
|
|
|
67230
67691
|
}
|
|
@@ -68212,7 +68673,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68212
68673
|
break;
|
|
68213
68674
|
|
|
68214
68675
|
default:
|
|
68215
|
-
|
|
68676
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
68216
68677
|
break;
|
|
68217
68678
|
|
|
68218
68679
|
}
|
|
@@ -68230,15 +68691,15 @@ function WebGLState( gl, extensions ) {
|
|
|
68230
68691
|
break;
|
|
68231
68692
|
|
|
68232
68693
|
case SubtractiveBlending:
|
|
68233
|
-
|
|
68694
|
+
error( 'WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
68234
68695
|
break;
|
|
68235
68696
|
|
|
68236
68697
|
case MultiplyBlending:
|
|
68237
|
-
|
|
68698
|
+
error( 'WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
68238
68699
|
break;
|
|
68239
68700
|
|
|
68240
68701
|
default:
|
|
68241
|
-
|
|
68702
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
68242
68703
|
break;
|
|
68243
68704
|
|
|
68244
68705
|
}
|
|
@@ -68525,7 +68986,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68525
68986
|
|
|
68526
68987
|
} catch ( error ) {
|
|
68527
68988
|
|
|
68528
|
-
|
|
68989
|
+
error( 'WebGLState:', error );
|
|
68529
68990
|
|
|
68530
68991
|
}
|
|
68531
68992
|
|
|
@@ -68539,7 +69000,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68539
69000
|
|
|
68540
69001
|
} catch ( error ) {
|
|
68541
69002
|
|
|
68542
|
-
|
|
69003
|
+
error( 'WebGLState:', error );
|
|
68543
69004
|
|
|
68544
69005
|
}
|
|
68545
69006
|
|
|
@@ -68553,7 +69014,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68553
69014
|
|
|
68554
69015
|
} catch ( error ) {
|
|
68555
69016
|
|
|
68556
|
-
|
|
69017
|
+
error( 'WebGLState:', error );
|
|
68557
69018
|
|
|
68558
69019
|
}
|
|
68559
69020
|
|
|
@@ -68567,7 +69028,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68567
69028
|
|
|
68568
69029
|
} catch ( error ) {
|
|
68569
69030
|
|
|
68570
|
-
|
|
69031
|
+
error( 'WebGLState:', error );
|
|
68571
69032
|
|
|
68572
69033
|
}
|
|
68573
69034
|
|
|
@@ -68581,7 +69042,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68581
69042
|
|
|
68582
69043
|
} catch ( error ) {
|
|
68583
69044
|
|
|
68584
|
-
|
|
69045
|
+
error( 'WebGLState:', error );
|
|
68585
69046
|
|
|
68586
69047
|
}
|
|
68587
69048
|
|
|
@@ -68595,7 +69056,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68595
69056
|
|
|
68596
69057
|
} catch ( error ) {
|
|
68597
69058
|
|
|
68598
|
-
|
|
69059
|
+
error( 'WebGLState:', error );
|
|
68599
69060
|
|
|
68600
69061
|
}
|
|
68601
69062
|
|
|
@@ -68609,7 +69070,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68609
69070
|
|
|
68610
69071
|
} catch ( error ) {
|
|
68611
69072
|
|
|
68612
|
-
|
|
69073
|
+
error( 'WebGLState:', error );
|
|
68613
69074
|
|
|
68614
69075
|
}
|
|
68615
69076
|
|
|
@@ -68623,7 +69084,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68623
69084
|
|
|
68624
69085
|
} catch ( error ) {
|
|
68625
69086
|
|
|
68626
|
-
|
|
69087
|
+
error( 'WebGLState:', error );
|
|
68627
69088
|
|
|
68628
69089
|
}
|
|
68629
69090
|
|
|
@@ -68637,7 +69098,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68637
69098
|
|
|
68638
69099
|
} catch ( error ) {
|
|
68639
69100
|
|
|
68640
|
-
|
|
69101
|
+
error( 'WebGLState:', error );
|
|
68641
69102
|
|
|
68642
69103
|
}
|
|
68643
69104
|
|
|
@@ -68651,7 +69112,7 @@ function WebGLState( gl, extensions ) {
|
|
|
68651
69112
|
|
|
68652
69113
|
} catch ( error ) {
|
|
68653
69114
|
|
|
68654
|
-
|
|
69115
|
+
error( 'WebGLState:', error );
|
|
68655
69116
|
|
|
68656
69117
|
}
|
|
68657
69118
|
|
|
@@ -68948,7 +69409,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68948
69409
|
const context = canvas.getContext( '2d' );
|
|
68949
69410
|
context.drawImage( image, 0, 0, width, height );
|
|
68950
69411
|
|
|
68951
|
-
|
|
69412
|
+
warn( 'WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
|
|
68952
69413
|
|
|
68953
69414
|
return canvas;
|
|
68954
69415
|
|
|
@@ -68956,7 +69417,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68956
69417
|
|
|
68957
69418
|
if ( 'data' in image ) {
|
|
68958
69419
|
|
|
68959
|
-
|
|
69420
|
+
warn( 'WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
|
|
68960
69421
|
|
|
68961
69422
|
}
|
|
68962
69423
|
|
|
@@ -68997,7 +69458,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68997
69458
|
|
|
68998
69459
|
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
|
|
68999
69460
|
|
|
69000
|
-
|
|
69461
|
+
warn( 'WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'' );
|
|
69001
69462
|
|
|
69002
69463
|
}
|
|
69003
69464
|
|
|
@@ -69066,6 +69527,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69066
69527
|
if ( glFormat === _gl.RGB ) {
|
|
69067
69528
|
|
|
69068
69529
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
69530
|
+
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
69069
69531
|
|
|
69070
69532
|
}
|
|
69071
69533
|
|
|
@@ -69109,7 +69571,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69109
69571
|
} else if ( depthType === UnsignedShortType ) {
|
|
69110
69572
|
|
|
69111
69573
|
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
69112
|
-
|
|
69574
|
+
warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );
|
|
69113
69575
|
|
|
69114
69576
|
}
|
|
69115
69577
|
|
|
@@ -69339,7 +69801,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69339
69801
|
|
|
69340
69802
|
if ( textureUnit >= capabilities.maxTextures ) {
|
|
69341
69803
|
|
|
69342
|
-
|
|
69804
|
+
warn( 'WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
|
|
69343
69805
|
|
|
69344
69806
|
}
|
|
69345
69807
|
|
|
@@ -69386,11 +69848,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69386
69848
|
|
|
69387
69849
|
if ( image === null ) {
|
|
69388
69850
|
|
|
69389
|
-
|
|
69851
|
+
warn( 'WebGLRenderer: Texture marked for update but no image data found.' );
|
|
69390
69852
|
|
|
69391
69853
|
} else if ( image.complete === false ) {
|
|
69392
69854
|
|
|
69393
|
-
|
|
69855
|
+
warn( 'WebGLRenderer: Texture marked for update but image is incomplete' );
|
|
69394
69856
|
|
|
69395
69857
|
} else {
|
|
69396
69858
|
|
|
@@ -69418,6 +69880,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69418
69880
|
uploadTexture( textureProperties, texture, slot );
|
|
69419
69881
|
return;
|
|
69420
69882
|
|
|
69883
|
+
} else if ( texture.isExternalTexture ) {
|
|
69884
|
+
|
|
69885
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
69886
|
+
|
|
69421
69887
|
}
|
|
69422
69888
|
|
|
69423
69889
|
state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -69487,7 +69953,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69487
69953
|
( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
|
|
69488
69954
|
texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {
|
|
69489
69955
|
|
|
69490
|
-
|
|
69956
|
+
warn( 'WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );
|
|
69491
69957
|
|
|
69492
69958
|
}
|
|
69493
69959
|
|
|
@@ -69896,7 +70362,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69896
70362
|
|
|
69897
70363
|
} else {
|
|
69898
70364
|
|
|
69899
|
-
|
|
70365
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
69900
70366
|
|
|
69901
70367
|
}
|
|
69902
70368
|
|
|
@@ -69952,7 +70418,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
69952
70418
|
|
|
69953
70419
|
} else {
|
|
69954
70420
|
|
|
69955
|
-
|
|
70421
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
69956
70422
|
|
|
69957
70423
|
}
|
|
69958
70424
|
|
|
@@ -70246,7 +70712,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70246
70712
|
|
|
70247
70713
|
} else {
|
|
70248
70714
|
|
|
70249
|
-
|
|
70715
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
|
|
70250
70716
|
|
|
70251
70717
|
}
|
|
70252
70718
|
|
|
@@ -71139,13 +71605,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
71139
71605
|
|
|
71140
71606
|
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
71141
71607
|
|
|
71142
|
-
|
|
71608
|
+
warn( 'WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
71143
71609
|
|
|
71144
71610
|
}
|
|
71145
71611
|
|
|
71146
71612
|
} else {
|
|
71147
71613
|
|
|
71148
|
-
|
|
71614
|
+
error( 'WebGLTextures: Unsupported texture color space:', colorSpace );
|
|
71149
71615
|
|
|
71150
71616
|
}
|
|
71151
71617
|
|
|
@@ -71211,6 +71677,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71211
71677
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
71212
71678
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
71213
71679
|
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
71680
|
+
if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
|
|
71214
71681
|
|
|
71215
71682
|
if ( p === ByteType ) return gl.BYTE;
|
|
71216
71683
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -71379,7 +71846,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71379
71846
|
|
|
71380
71847
|
if ( extension !== null ) {
|
|
71381
71848
|
|
|
71382
|
-
if ( p ===
|
|
71849
|
+
if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
|
|
71383
71850
|
if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
71384
71851
|
if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
71385
71852
|
if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
|
|
@@ -71406,48 +71873,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
71406
71873
|
|
|
71407
71874
|
}
|
|
71408
71875
|
|
|
71409
|
-
/**
|
|
71410
|
-
* Represents a texture created externally from the renderer context.
|
|
71411
|
-
*
|
|
71412
|
-
* This may be a texture from a protected media stream, device camera feed,
|
|
71413
|
-
* or other data feeds like a depth sensor.
|
|
71414
|
-
*
|
|
71415
|
-
* Note that this class is only supported in {@link WebGLRenderer} right now.
|
|
71416
|
-
*
|
|
71417
|
-
* @augments Texture
|
|
71418
|
-
*/
|
|
71419
|
-
class ExternalTexture extends Texture {
|
|
71420
|
-
|
|
71421
|
-
/**
|
|
71422
|
-
* Creates a new raw texture.
|
|
71423
|
-
*
|
|
71424
|
-
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
|
|
71425
|
-
*/
|
|
71426
|
-
constructor( sourceTexture = null ) {
|
|
71427
|
-
|
|
71428
|
-
super();
|
|
71429
|
-
|
|
71430
|
-
/**
|
|
71431
|
-
* The external source texture.
|
|
71432
|
-
*
|
|
71433
|
-
* @type {?WebGLTexture}
|
|
71434
|
-
* @default null
|
|
71435
|
-
*/
|
|
71436
|
-
this.sourceTexture = sourceTexture;
|
|
71437
|
-
|
|
71438
|
-
/**
|
|
71439
|
-
* This flag can be used for type testing.
|
|
71440
|
-
*
|
|
71441
|
-
* @type {boolean}
|
|
71442
|
-
* @readonly
|
|
71443
|
-
* @default true
|
|
71444
|
-
*/
|
|
71445
|
-
this.isExternalTexture = true;
|
|
71446
|
-
|
|
71447
|
-
}
|
|
71448
|
-
|
|
71449
|
-
}
|
|
71450
|
-
|
|
71451
71876
|
const _occlusion_vertex = `
|
|
71452
71877
|
void main() {
|
|
71453
71878
|
|
|
@@ -71636,6 +72061,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
71636
72061
|
let glBaseLayer = null;
|
|
71637
72062
|
let xrFrame = null;
|
|
71638
72063
|
|
|
72064
|
+
const supportsGlBinding = typeof XRWebGLBinding !== 'undefined';
|
|
72065
|
+
|
|
71639
72066
|
const depthSensing = new WebXRDepthSensing();
|
|
71640
72067
|
const cameraAccessTextures = {};
|
|
71641
72068
|
const attributes = gl.getContextAttributes();
|
|
@@ -71860,7 +72287,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
71860
72287
|
|
|
71861
72288
|
if ( scope.isPresenting === true ) {
|
|
71862
72289
|
|
|
71863
|
-
|
|
72290
|
+
warn( 'WebXRManager: Cannot change framebuffer scale while presenting.' );
|
|
71864
72291
|
|
|
71865
72292
|
}
|
|
71866
72293
|
|
|
@@ -71882,7 +72309,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
71882
72309
|
|
|
71883
72310
|
if ( scope.isPresenting === true ) {
|
|
71884
72311
|
|
|
71885
|
-
|
|
72312
|
+
warn( 'WebXRManager: Cannot change reference space type while presenting.' );
|
|
71886
72313
|
|
|
71887
72314
|
}
|
|
71888
72315
|
|
|
@@ -71913,6 +72340,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
71913
72340
|
/**
|
|
71914
72341
|
* Returns the current base layer.
|
|
71915
72342
|
*
|
|
72343
|
+
* This is an `XRProjectionLayer` when the targeted XR device supports the
|
|
72344
|
+
* WebXR Layers API, or an `XRWebGLLayer` otherwise.
|
|
72345
|
+
*
|
|
71916
72346
|
* @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
|
|
71917
72347
|
*/
|
|
71918
72348
|
this.getBaseLayer = function () {
|
|
@@ -71924,10 +72354,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
71924
72354
|
/**
|
|
71925
72355
|
* Returns the current XR binding.
|
|
71926
72356
|
*
|
|
71927
|
-
*
|
|
72357
|
+
* Creates a new binding if needed and the browser is
|
|
72358
|
+
* capable of doing so.
|
|
72359
|
+
*
|
|
72360
|
+
* @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.
|
|
71928
72361
|
*/
|
|
71929
72362
|
this.getBinding = function () {
|
|
71930
72363
|
|
|
72364
|
+
if ( glBinding === null && supportsGlBinding ) {
|
|
72365
|
+
|
|
72366
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
72367
|
+
|
|
72368
|
+
}
|
|
72369
|
+
|
|
71931
72370
|
return glBinding;
|
|
71932
72371
|
|
|
71933
72372
|
};
|
|
@@ -71989,17 +72428,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
71989
72428
|
currentPixelRatio = renderer.getPixelRatio();
|
|
71990
72429
|
renderer.getSize( currentSize );
|
|
71991
72430
|
|
|
71992
|
-
if ( typeof XRWebGLBinding !== 'undefined' ) {
|
|
71993
|
-
|
|
71994
|
-
glBinding = new XRWebGLBinding( session, gl );
|
|
71995
|
-
|
|
71996
|
-
}
|
|
71997
72431
|
|
|
71998
72432
|
// Check that the browser implements the necessary APIs to use an
|
|
71999
72433
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
72000
|
-
const
|
|
72434
|
+
const supportsLayers = supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
72001
72435
|
|
|
72002
|
-
if ( !
|
|
72436
|
+
if ( ! supportsLayers ) {
|
|
72003
72437
|
|
|
72004
72438
|
const layerInit = {
|
|
72005
72439
|
antialias: attributes.antialias,
|
|
@@ -72050,6 +72484,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
72050
72484
|
scaleFactor: framebufferScaleFactor
|
|
72051
72485
|
};
|
|
72052
72486
|
|
|
72487
|
+
glBinding = this.getBinding();
|
|
72488
|
+
|
|
72053
72489
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
72054
72490
|
|
|
72055
72491
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
@@ -72109,6 +72545,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
72109
72545
|
/**
|
|
72110
72546
|
* Returns the current depth texture computed via depth sensing.
|
|
72111
72547
|
*
|
|
72548
|
+
* See {@link WebXRDepthSensing#getDepthTexture}.
|
|
72549
|
+
*
|
|
72112
72550
|
* @return {?Texture} The depth texture.
|
|
72113
72551
|
*/
|
|
72114
72552
|
this.getDepthTexture = function () {
|
|
@@ -72279,7 +72717,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72279
72717
|
|
|
72280
72718
|
/**
|
|
72281
72719
|
* Updates the state of the XR camera. Use this method on app level if you
|
|
72282
|
-
* set cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
72720
|
+
* set `cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
72283
72721
|
* camera of the scene as a parameter. The passed in camera's transformation
|
|
72284
72722
|
* is automatically adjusted to the position of the XR camera when calling
|
|
72285
72723
|
* this method.
|
|
@@ -72456,6 +72894,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
72456
72894
|
/**
|
|
72457
72895
|
* Returns the depth sensing mesh.
|
|
72458
72896
|
*
|
|
72897
|
+
* See {@link WebXRDepthSensing#getMesh}.
|
|
72898
|
+
*
|
|
72459
72899
|
* @return {Mesh} The depth sensing mesh.
|
|
72460
72900
|
*/
|
|
72461
72901
|
this.getDepthSensingMesh = function () {
|
|
@@ -72576,7 +73016,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
72576
73016
|
enabledFeatures.includes( 'depth-sensing' ) &&
|
|
72577
73017
|
session.depthUsage == 'gpu-optimized';
|
|
72578
73018
|
|
|
72579
|
-
if ( gpuDepthSensingEnabled &&
|
|
73019
|
+
if ( gpuDepthSensingEnabled && supportsGlBinding ) {
|
|
73020
|
+
|
|
73021
|
+
glBinding = scope.getBinding();
|
|
72580
73022
|
|
|
72581
73023
|
const depthData = glBinding.getDepthInformation( views[ 0 ] );
|
|
72582
73024
|
|
|
@@ -72591,32 +73033,30 @@ class WebXRManager extends EventDispatcher {
|
|
|
72591
73033
|
const cameraAccessEnabled = enabledFeatures &&
|
|
72592
73034
|
enabledFeatures.includes( 'camera-access' );
|
|
72593
73035
|
|
|
72594
|
-
if ( cameraAccessEnabled ) {
|
|
73036
|
+
if ( cameraAccessEnabled && supportsGlBinding ) {
|
|
72595
73037
|
|
|
72596
73038
|
renderer.state.unbindTexture();
|
|
72597
73039
|
|
|
72598
|
-
|
|
72599
|
-
|
|
72600
|
-
for ( let i = 0; i < views.length; i ++ ) {
|
|
72601
|
-
|
|
72602
|
-
const camera = views[ i ].camera;
|
|
73040
|
+
glBinding = scope.getBinding();
|
|
72603
73041
|
|
|
72604
|
-
|
|
73042
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
72605
73043
|
|
|
72606
|
-
|
|
73044
|
+
const camera = views[ i ].camera;
|
|
72607
73045
|
|
|
72608
|
-
|
|
73046
|
+
if ( camera ) {
|
|
72609
73047
|
|
|
72610
|
-
|
|
72611
|
-
cameraAccessTextures[ camera ] = cameraTex;
|
|
73048
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
72612
73049
|
|
|
72613
|
-
|
|
73050
|
+
if ( ! cameraTex ) {
|
|
72614
73051
|
|
|
72615
|
-
|
|
72616
|
-
|
|
73052
|
+
cameraTex = new ExternalTexture();
|
|
73053
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
72617
73054
|
|
|
72618
73055
|
}
|
|
72619
73056
|
|
|
73057
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
73058
|
+
cameraTex.sourceTexture = glTexture;
|
|
73059
|
+
|
|
72620
73060
|
}
|
|
72621
73061
|
|
|
72622
73062
|
}
|
|
@@ -73347,7 +73787,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
73347
73787
|
|
|
73348
73788
|
}
|
|
73349
73789
|
|
|
73350
|
-
|
|
73790
|
+
error( 'WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );
|
|
73351
73791
|
|
|
73352
73792
|
return 0;
|
|
73353
73793
|
|
|
@@ -73602,11 +74042,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
73602
74042
|
|
|
73603
74043
|
} else if ( value.isTexture ) {
|
|
73604
74044
|
|
|
73605
|
-
|
|
74045
|
+
warn( 'WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
|
|
73606
74046
|
|
|
73607
74047
|
} else {
|
|
73608
74048
|
|
|
73609
|
-
|
|
74049
|
+
warn( 'WebGLRenderer: Unsupported uniform value type.', value );
|
|
73610
74050
|
|
|
73611
74051
|
}
|
|
73612
74052
|
|
|
@@ -73655,6 +74095,69 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
73655
74095
|
|
|
73656
74096
|
}
|
|
73657
74097
|
|
|
74098
|
+
/**
|
|
74099
|
+
* Precomputed DFG LUT for Image-Based Lighting
|
|
74100
|
+
* Resolution: 32x32
|
|
74101
|
+
* Samples: 4096 per texel
|
|
74102
|
+
* Format: RG16F (2 half floats per texel: scale, bias)
|
|
74103
|
+
*/
|
|
74104
|
+
|
|
74105
|
+
|
|
74106
|
+
const DATA = new Uint16Array( [
|
|
74107
|
+
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,
|
|
74108
|
+
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,
|
|
74109
|
+
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,
|
|
74110
|
+
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,
|
|
74111
|
+
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,
|
|
74112
|
+
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,
|
|
74113
|
+
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,
|
|
74114
|
+
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,
|
|
74115
|
+
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,
|
|
74116
|
+
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,
|
|
74117
|
+
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,
|
|
74118
|
+
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,
|
|
74119
|
+
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,
|
|
74120
|
+
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,
|
|
74121
|
+
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,
|
|
74122
|
+
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,
|
|
74123
|
+
0x3bc9, 0x26d3, 0x3bc9, 0x26d4, 0x3bc9, 0x26d9, 0x3bc8, 0x26e3, 0x3bc6, 0x26ef, 0x3bc2, 0x2705, 0x3bbd, 0x271a, 0x3bb6, 0x2731, 0x3baa, 0x273c, 0x3b9a, 0x273d, 0x3b81, 0x2726, 0x3b65, 0x26f7, 0x3b46, 0x26af, 0x3b20, 0x2650, 0x3af7, 0x25e1, 0x3acd, 0x256a, 0x3aa1, 0x24eb, 0x3a75, 0x246f, 0x3a46, 0x23ee, 0x3a17, 0x230d, 0x39e9, 0x223e, 0x39b7, 0x2183, 0x3985, 0x20d8, 0x3953, 0x2043, 0x391e, 0x1f7a, 0x38e9, 0x1e8d, 0x38b3, 0x1dbf, 0x387c, 0x1d0b, 0x3845, 0x1c6c, 0x380e, 0x1bc4, 0x37b0, 0x1ad2, 0x3745, 0x19fd,
|
|
74124
|
+
0x3bd9, 0x24e4, 0x3bd9, 0x24e5, 0x3bd9, 0x24e8, 0x3bd8, 0x24f2, 0x3bd5, 0x24fe, 0x3bd2, 0x2512, 0x3bce, 0x252b, 0x3bc6, 0x2544, 0x3bbc, 0x255a, 0x3bac, 0x256b, 0x3b93, 0x2569, 0x3b7a, 0x2557, 0x3b5b, 0x252f, 0x3b34, 0x24f7, 0x3b0c, 0x24ad, 0x3adf, 0x2458, 0x3ab1, 0x23f8, 0x3a82, 0x233f, 0x3a4f, 0x2286, 0x3a1e, 0x21d5, 0x39eb, 0x2130, 0x39b6, 0x2098, 0x3982, 0x200e, 0x394b, 0x1f25, 0x3914, 0x1e45, 0x38dc, 0x1d83, 0x38a3, 0x1cd6, 0x386b, 0x1c3d, 0x3831, 0x1b71, 0x37f2, 0x1a87, 0x3782, 0x19bc, 0x3714, 0x1909,
|
|
74125
|
+
0x3be5, 0x22d8, 0x3be5, 0x22d9, 0x3be4, 0x22df, 0x3be4, 0x22ef, 0x3be1, 0x2305, 0x3bde, 0x232a, 0x3bda, 0x2358, 0x3bd4, 0x2392, 0x3bcb, 0x23ca, 0x3bbb, 0x23f4, 0x3ba3, 0x2405, 0x3b8c, 0x2405, 0x3b6c, 0x23ec, 0x3b47, 0x23ae, 0x3b1d, 0x2353, 0x3af0, 0x22e2, 0x3ac0, 0x2261, 0x3a8e, 0x21d9, 0x3a5a, 0x214e, 0x3a26, 0x20c7, 0x39ee, 0x2045, 0x39b7, 0x1f97, 0x397f, 0x1eba, 0x3945, 0x1df0, 0x390b, 0x1d3a, 0x38d0, 0x1c9a, 0x3895, 0x1c0a, 0x385a, 0x1b18, 0x381f, 0x1a39, 0x37c9, 0x1975, 0x3756, 0x18cc, 0x36e6, 0x1836,
|
|
74126
|
+
0x3bed, 0x20a8, 0x3bed, 0x20a9, 0x3bed, 0x20ae, 0x3bed, 0x20bb, 0x3beb, 0x20cf, 0x3be8, 0x20ef, 0x3be4, 0x2119, 0x3bde, 0x214f, 0x3bd6, 0x2189, 0x3bc6, 0x21b8, 0x3bb1, 0x21de, 0x3b9a, 0x21f2, 0x3b7b, 0x21f2, 0x3b57, 0x21d8, 0x3b2d, 0x21a4, 0x3b00, 0x215f, 0x3acf, 0x2108, 0x3a99, 0x20a8, 0x3a64, 0x2043, 0x3a2c, 0x1fba, 0x39f2, 0x1ef3, 0x39b8, 0x1e36, 0x397c, 0x1d86, 0x3940, 0x1ce5, 0x3903, 0x1c52, 0x38c6, 0x1b9e, 0x3888, 0x1ab3, 0x384a, 0x19e4, 0x380e, 0x192b, 0x37a3, 0x188b, 0x372d, 0x17f7, 0x36ba, 0x1701,
|
|
74127
|
+
0x3bf4, 0x1e23, 0x3bf4, 0x1e25, 0x3bf4, 0x1e2d, 0x3bf3, 0x1e41, 0x3bf1, 0x1e64, 0x3bef, 0x1e9c, 0x3beb, 0x1ee1, 0x3be6, 0x1f40, 0x3bde, 0x1fa7, 0x3bce, 0x2001, 0x3bbd, 0x202f, 0x3ba6, 0x204e, 0x3b88, 0x205f, 0x3b64, 0x205b, 0x3b3b, 0x2044, 0x3b0e, 0x201f, 0x3adb, 0x1fcf, 0x3aa6, 0x1f4e, 0x3a6e, 0x1ec1, 0x3a33, 0x1e2b, 0x39f7, 0x1d95, 0x39ba, 0x1d06, 0x397b, 0x1c7d, 0x393c, 0x1bfc, 0x38fc, 0x1b13, 0x38bc, 0x1a40, 0x387c, 0x1983, 0x383c, 0x18da, 0x37fa, 0x1842, 0x377f, 0x177f, 0x3706, 0x1695, 0x3691, 0x15c8,
|
|
74128
|
+
0x3bf8, 0x1bca, 0x3bf8, 0x1bcc, 0x3bf8, 0x1bd8, 0x3bf8, 0x1bf7, 0x3bf6, 0x1c1b, 0x3bf4, 0x1c45, 0x3bf1, 0x1c83, 0x3bec, 0x1cce, 0x3be4, 0x1d21, 0x3bd5, 0x1d78, 0x3bc5, 0x1dd1, 0x3bb0, 0x1e17, 0x3b93, 0x1e4a, 0x3b70, 0x1e5f, 0x3b48, 0x1e57, 0x3b1b, 0x1e35, 0x3ae7, 0x1df6, 0x3ab2, 0x1da4, 0x3a77, 0x1d44, 0x3a3a, 0x1cdb, 0x39fc, 0x1c6e, 0x39bb, 0x1c03, 0x397a, 0x1b35, 0x3938, 0x1a72, 0x38f5, 0x19bb, 0x38b3, 0x1914, 0x3870, 0x187d, 0x382e, 0x17eb, 0x37db, 0x16f9, 0x375c, 0x1621, 0x36e1, 0x1565, 0x3669, 0x14be,
|
|
74129
|
+
0x3bfb, 0x18b9, 0x3bfb, 0x18ba, 0x3bfb, 0x18c3, 0x3bfb, 0x18da, 0x3bf9, 0x190a, 0x3bf7, 0x1948, 0x3bf5, 0x19ac, 0x3bf0, 0x1a20, 0x3be9, 0x1ab3, 0x3bdb, 0x1b49, 0x3bcd, 0x1be6, 0x3bb7, 0x1c34, 0x3b9c, 0x1c6d, 0x3b7a, 0x1c8e, 0x3b54, 0x1c9e, 0x3b26, 0x1c96, 0x3af2, 0x1c75, 0x3abc, 0x1c47, 0x3a80, 0x1c09, 0x3a42, 0x1b85, 0x3a01, 0x1aec, 0x39be, 0x1a50, 0x397a, 0x19b5, 0x3935, 0x1921, 0x38f0, 0x1895, 0x38aa, 0x1814, 0x3866, 0x173a, 0x3821, 0x1665, 0x37be, 0x15a4, 0x373c, 0x14f9, 0x36be, 0x1460, 0x3644, 0x13b3,
|
|
74130
|
+
0x3bfd, 0x156b, 0x3bfd, 0x156c, 0x3bfd, 0x1578, 0x3bfd, 0x1598, 0x3bfc, 0x15dd, 0x3bfa, 0x163c, 0x3bf7, 0x16cb, 0x3bf3, 0x177b, 0x3beb, 0x1833, 0x3be0, 0x18ad, 0x3bd2, 0x192e, 0x3bbd, 0x19a6, 0x3ba4, 0x1a0c, 0x3b83, 0x1a5a, 0x3b5d, 0x1a8c, 0x3b30, 0x1a9b, 0x3afd, 0x1a86, 0x3ac6, 0x1a5c, 0x3a89, 0x1a11, 0x3a49, 0x19b7, 0x3a06, 0x194f, 0x39c1, 0x18e3, 0x397a, 0x1873, 0x3933, 0x1805, 0x38eb, 0x173a, 0x38a3, 0x1676, 0x385c, 0x15bf, 0x3816, 0x1519, 0x37a2, 0x1482, 0x371d, 0x13f7, 0x369c, 0x1306, 0x3620, 0x1231,
|
|
74131
|
+
0x3bff, 0x11cb, 0x3bff, 0x11cd, 0x3bfe, 0x11dd, 0x3bfe, 0x1219, 0x3bfd, 0x126b, 0x3bfb, 0x12e9, 0x3bf9, 0x13c5, 0x3bf5, 0x1460, 0x3bee, 0x150f, 0x3be3, 0x15c9, 0x3bd6, 0x168a, 0x3bc3, 0x174f, 0x3baa, 0x1806, 0x3b8b, 0x184f, 0x3b66, 0x1888, 0x3b39, 0x18a6, 0x3b07, 0x18ad, 0x3acf, 0x189c, 0x3a92, 0x1876, 0x3a50, 0x1840, 0x3a0c, 0x17fd, 0x39c4, 0x176a, 0x397b, 0x16ce, 0x3931, 0x1634, 0x38e6, 0x1599, 0x389c, 0x1508, 0x3852, 0x147f, 0x380a, 0x1401, 0x3788, 0x131c, 0x36ff, 0x124a, 0x367c, 0x1190, 0x35fe, 0x10ea,
|
|
74132
|
+
0x3bff, 0x0daa, 0x3bff, 0x0dad, 0x3bff, 0x0dc0, 0x3bff, 0x0e0e, 0x3bfe, 0x0e87, 0x3bfc, 0x0f14, 0x3bfb, 0x1029, 0x3bf7, 0x10d1, 0x3bf0, 0x11d3, 0x3be6, 0x12c9, 0x3bd9, 0x13fc, 0x3bc7, 0x1499, 0x3bb0, 0x152a, 0x3b92, 0x15ab, 0x3b6e, 0x1615, 0x3b42, 0x165a, 0x3b10, 0x1681, 0x3ad8, 0x1683, 0x3a9a, 0x1665, 0x3a57, 0x1629, 0x3a11, 0x15dd, 0x39c8, 0x1580, 0x397c, 0x1518, 0x3930, 0x14ae, 0x38e3, 0x1441, 0x3896, 0x13b1, 0x384a, 0x12e9, 0x37ff, 0x122f, 0x376f, 0x1182, 0x36e3, 0x10e5, 0x365e, 0x1057, 0x35de, 0x0fac,
|
|
74133
|
+
0x3c00, 0x08ea, 0x3c00, 0x08ed, 0x3c00, 0x0902, 0x3c00, 0x0961, 0x3bff, 0x09f3, 0x3bfd, 0x0abc, 0x3bfb, 0x0c1f, 0x3bf8, 0x0d15, 0x3bf1, 0x0e5b, 0x3be8, 0x0fb4, 0x3bdc, 0x10b0, 0x3bcb, 0x1190, 0x3bb5, 0x126c, 0x3b97, 0x132c, 0x3b74, 0x13de, 0x3b4a, 0x1432, 0x3b18, 0x145e, 0x3ae0, 0x1472, 0x3aa2, 0x146f, 0x3a5f, 0x1456, 0x3a17, 0x142e, 0x39cc, 0x13ee, 0x397e, 0x136b, 0x392f, 0x12e1, 0x38df, 0x124f, 0x3890, 0x11bd, 0x3842, 0x1131, 0x37eb, 0x10ac, 0x3757, 0x102e, 0x36c9, 0x0f76, 0x3640, 0x0ea3, 0x35bf, 0x0de4,
|
|
74134
|
+
0x3c00, 0x039b, 0x3c00, 0x039d, 0x3c00, 0x03b2, 0x3c00, 0x041c, 0x3bff, 0x04be, 0x3bfd, 0x05d6, 0x3bfc, 0x0764, 0x3bf8, 0x08e2, 0x3bf2, 0x0a67, 0x3bea, 0x0c1b, 0x3bde, 0x0d41, 0x3bcd, 0x0e5f, 0x3bb8, 0x0f8c, 0x3b9c, 0x1057, 0x3b7a, 0x10e5, 0x3b51, 0x1155, 0x3b20, 0x11a5, 0x3ae8, 0x11da, 0x3aaa, 0x11ef, 0x3a66, 0x11e5, 0x3a1d, 0x11c1, 0x39d0, 0x1185, 0x3980, 0x113b, 0x392e, 0x10e5, 0x38dc, 0x1087, 0x388b, 0x1028, 0x383b, 0x0f94, 0x37d9, 0x0edb, 0x3741, 0x0e2c, 0x36af, 0x0d89, 0x3625, 0x0cf2, 0x35a1, 0x0c69,
|
|
74135
|
+
0x3c00, 0x0107, 0x3c00, 0x0108, 0x3c00, 0x0110, 0x3c00, 0x0145, 0x3bff, 0x0197, 0x3bfe, 0x0224, 0x3bfc, 0x030c, 0x3bf8, 0x0478, 0x3bf3, 0x062c, 0x3beb, 0x0833, 0x3be0, 0x0979, 0x3bd0, 0x0aeb, 0x3bbc, 0x0c3d, 0x3ba0, 0x0d01, 0x3b80, 0x0dbd, 0x3b57, 0x0e69, 0x3b27, 0x0eeb, 0x3af0, 0x0f53, 0x3ab1, 0x0f8a, 0x3a6c, 0x0f9f, 0x3a22, 0x0f8b, 0x39d4, 0x0f5b, 0x3982, 0x0f0f, 0x392f, 0x0eac, 0x38da, 0x0e3d, 0x3886, 0x0dc9, 0x3834, 0x0d51, 0x37c7, 0x0cd9, 0x372c, 0x0c65, 0x3697, 0x0bef, 0x360a, 0x0b20, 0x3585, 0x0a62,
|
|
74136
|
+
0x3c00, 0x0031, 0x3c00, 0x0031, 0x3c00, 0x0034, 0x3c00, 0x004b, 0x3bff, 0x006f, 0x3bfe, 0x00c9, 0x3bfc, 0x011b, 0x3bf9, 0x0207, 0x3bf4, 0x02d6, 0x3bec, 0x0415, 0x3be1, 0x0587, 0x3bd2, 0x0703, 0x3bbf, 0x087d, 0x3ba5, 0x096a, 0x3b85, 0x0a59, 0x3b5d, 0x0b32, 0x3b2e, 0x0bee, 0x3af7, 0x0c44, 0x3ab8, 0x0c7c, 0x3a73, 0x0c9c, 0x3a28, 0x0ca4, 0x39d8, 0x0c98, 0x3985, 0x0c77, 0x392f, 0x0c4a, 0x38d9, 0x0c10, 0x3882, 0x0ba0, 0x382e, 0x0b14, 0x37b6, 0x0a84, 0x3717, 0x09f5, 0x3680, 0x0969, 0x35f0, 0x08e6, 0x356a, 0x086a,
|
|
74137
|
+
0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x000d, 0x3bff, 0x0021, 0x3bfe, 0x003b, 0x3bfd, 0x0070, 0x3bf9, 0x00c7, 0x3bf4, 0x012e, 0x3bed, 0x01c8, 0x3be3, 0x0274, 0x3bd4, 0x033b, 0x3bc1, 0x043a, 0x3ba8, 0x0534, 0x3b89, 0x0641, 0x3b62, 0x073b, 0x3b34, 0x0815, 0x3afd, 0x087c, 0x3abf, 0x08d0, 0x3a7a, 0x090a, 0x3a2e, 0x092c, 0x39dd, 0x0936, 0x3988, 0x0928, 0x3930, 0x0907, 0x38d7, 0x08d7, 0x387f, 0x089b, 0x3828, 0x0855, 0x37a7, 0x080b, 0x3704, 0x077b, 0x366a, 0x06e1, 0x35d8, 0x0649, 0x3550, 0x05b8,
|
|
74138
|
+
0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0003, 0x3bff, 0x0012, 0x3bfe, 0x001a, 0x3bfd, 0x0035, 0x3bfa, 0x0050, 0x3bf4, 0x0061, 0x3bed, 0x00a5, 0x3be4, 0x00ee, 0x3bd6, 0x0146, 0x3bc3, 0x01ab, 0x3bab, 0x0211, 0x3b8d, 0x028e, 0x3b67, 0x0303, 0x3b39, 0x0375, 0x3b04, 0x03e2, 0x3ac6, 0x0441, 0x3a80, 0x0492, 0x3a34, 0x04cd, 0x39e1, 0x04f2, 0x398b, 0x0504, 0x3931, 0x0502, 0x38d6, 0x04ec, 0x387c, 0x04c7, 0x3822, 0x0496, 0x3798, 0x045c, 0x36f2, 0x041a, 0x3655, 0x03d5, 0x35c1, 0x038e, 0x3537, 0x0347
|
|
74139
|
+
] );
|
|
74140
|
+
|
|
74141
|
+
let lut = null;
|
|
74142
|
+
|
|
74143
|
+
function getDFGLUT() {
|
|
74144
|
+
|
|
74145
|
+
if ( lut === null ) {
|
|
74146
|
+
|
|
74147
|
+
lut = new DataTexture( DATA, 32, 32, RGFormat, HalfFloatType );
|
|
74148
|
+
lut.minFilter = LinearFilter;
|
|
74149
|
+
lut.magFilter = LinearFilter;
|
|
74150
|
+
lut.wrapS = ClampToEdgeWrapping;
|
|
74151
|
+
lut.wrapT = ClampToEdgeWrapping;
|
|
74152
|
+
lut.generateMipmaps = false;
|
|
74153
|
+
lut.needsUpdate = true;
|
|
74154
|
+
|
|
74155
|
+
}
|
|
74156
|
+
|
|
74157
|
+
return lut;
|
|
74158
|
+
|
|
74159
|
+
}
|
|
74160
|
+
|
|
73658
74161
|
/**
|
|
73659
74162
|
* This renderer uses WebGL 2 to display scenes.
|
|
73660
74163
|
*
|
|
@@ -73710,6 +74213,21 @@ class WebGLRenderer {
|
|
|
73710
74213
|
|
|
73711
74214
|
}
|
|
73712
74215
|
|
|
74216
|
+
const INTEGER_FORMATS = new Set( [
|
|
74217
|
+
RGBAIntegerFormat,
|
|
74218
|
+
RGIntegerFormat,
|
|
74219
|
+
RedIntegerFormat
|
|
74220
|
+
] );
|
|
74221
|
+
|
|
74222
|
+
const UNSIGNED_TYPES = new Set( [
|
|
74223
|
+
UnsignedByteType,
|
|
74224
|
+
UnsignedIntType,
|
|
74225
|
+
UnsignedShortType,
|
|
74226
|
+
UnsignedInt248Type,
|
|
74227
|
+
UnsignedShort4444Type,
|
|
74228
|
+
UnsignedShort5551Type
|
|
74229
|
+
] );
|
|
74230
|
+
|
|
73713
74231
|
const uintClearColor = new Uint32Array( 4 );
|
|
73714
74232
|
const intClearColor = new Int32Array( 4 );
|
|
73715
74233
|
|
|
@@ -73731,7 +74249,7 @@ class WebGLRenderer {
|
|
|
73731
74249
|
* document.body.appendChild( renderer.domElement );
|
|
73732
74250
|
* ```
|
|
73733
74251
|
*
|
|
73734
|
-
* @type {
|
|
74252
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
73735
74253
|
*/
|
|
73736
74254
|
this.domElement = canvas;
|
|
73737
74255
|
|
|
@@ -73984,7 +74502,7 @@ class WebGLRenderer {
|
|
|
73984
74502
|
|
|
73985
74503
|
} catch ( error ) {
|
|
73986
74504
|
|
|
73987
|
-
|
|
74505
|
+
error( 'WebGLRenderer: ' + error.message );
|
|
73988
74506
|
throw error;
|
|
73989
74507
|
|
|
73990
74508
|
}
|
|
@@ -74221,7 +74739,7 @@ class WebGLRenderer {
|
|
|
74221
74739
|
|
|
74222
74740
|
if ( xr.isPresenting ) {
|
|
74223
74741
|
|
|
74224
|
-
|
|
74742
|
+
warn( 'WebGLRenderer: Can\'t change size while VR device is presenting.' );
|
|
74225
74743
|
return;
|
|
74226
74744
|
|
|
74227
74745
|
}
|
|
@@ -74483,9 +75001,7 @@ class WebGLRenderer {
|
|
|
74483
75001
|
if ( _currentRenderTarget !== null ) {
|
|
74484
75002
|
|
|
74485
75003
|
const targetFormat = _currentRenderTarget.texture.format;
|
|
74486
|
-
isIntegerFormat = targetFormat
|
|
74487
|
-
targetFormat === RGIntegerFormat ||
|
|
74488
|
-
targetFormat === RedIntegerFormat;
|
|
75004
|
+
isIntegerFormat = INTEGER_FORMATS.has( targetFormat );
|
|
74489
75005
|
|
|
74490
75006
|
}
|
|
74491
75007
|
|
|
@@ -74494,12 +75010,7 @@ class WebGLRenderer {
|
|
|
74494
75010
|
if ( isIntegerFormat ) {
|
|
74495
75011
|
|
|
74496
75012
|
const targetType = _currentRenderTarget.texture.type;
|
|
74497
|
-
const isUnsignedType = targetType
|
|
74498
|
-
targetType === UnsignedIntType ||
|
|
74499
|
-
targetType === UnsignedShortType ||
|
|
74500
|
-
targetType === UnsignedInt248Type ||
|
|
74501
|
-
targetType === UnsignedShort4444Type ||
|
|
74502
|
-
targetType === UnsignedShort5551Type;
|
|
75013
|
+
const isUnsignedType = UNSIGNED_TYPES.has( targetType );
|
|
74503
75014
|
|
|
74504
75015
|
const clearColor = background.getClearColor();
|
|
74505
75016
|
const a = background.getClearAlpha();
|
|
@@ -74613,7 +75124,7 @@ class WebGLRenderer {
|
|
|
74613
75124
|
|
|
74614
75125
|
event.preventDefault();
|
|
74615
75126
|
|
|
74616
|
-
|
|
75127
|
+
log( 'WebGLRenderer: Context Lost.' );
|
|
74617
75128
|
|
|
74618
75129
|
_isContextLost = true;
|
|
74619
75130
|
|
|
@@ -74621,7 +75132,7 @@ class WebGLRenderer {
|
|
|
74621
75132
|
|
|
74622
75133
|
function onContextRestore( /* event */ ) {
|
|
74623
75134
|
|
|
74624
|
-
|
|
75135
|
+
log( 'WebGLRenderer: Context Restored.' );
|
|
74625
75136
|
|
|
74626
75137
|
_isContextLost = false;
|
|
74627
75138
|
|
|
@@ -74643,7 +75154,7 @@ class WebGLRenderer {
|
|
|
74643
75154
|
|
|
74644
75155
|
function onContextCreationError( event ) {
|
|
74645
75156
|
|
|
74646
|
-
|
|
75157
|
+
error( 'WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );
|
|
74647
75158
|
|
|
74648
75159
|
}
|
|
74649
75160
|
|
|
@@ -74816,7 +75327,7 @@ class WebGLRenderer {
|
|
|
74816
75327
|
if ( object._multiDrawInstances !== null ) {
|
|
74817
75328
|
|
|
74818
75329
|
// @deprecated, r174
|
|
74819
|
-
warnOnce( '
|
|
75330
|
+
warnOnce( 'WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
|
|
74820
75331
|
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
74821
75332
|
|
|
74822
75333
|
} else {
|
|
@@ -75092,6 +75603,13 @@ class WebGLRenderer {
|
|
|
75092
75603
|
|
|
75093
75604
|
if ( typeof self !== 'undefined' ) animation.setContext( self );
|
|
75094
75605
|
|
|
75606
|
+
/**
|
|
75607
|
+
* Applications are advised to always define the animation loop
|
|
75608
|
+
* with this method and not manually with `requestAnimationFrame()`
|
|
75609
|
+
* for best compatibility.
|
|
75610
|
+
*
|
|
75611
|
+
* @param {?onAnimationCallback} callback - The application's animation loop.
|
|
75612
|
+
*/
|
|
75095
75613
|
this.setAnimationLoop = function ( callback ) {
|
|
75096
75614
|
|
|
75097
75615
|
onAnimationFrameCallback = callback;
|
|
@@ -75124,7 +75642,7 @@ class WebGLRenderer {
|
|
|
75124
75642
|
|
|
75125
75643
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
75126
75644
|
|
|
75127
|
-
|
|
75645
|
+
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
75128
75646
|
return;
|
|
75129
75647
|
|
|
75130
75648
|
}
|
|
@@ -75422,9 +75940,7 @@ class WebGLRenderer {
|
|
|
75422
75940
|
|
|
75423
75941
|
function renderScene( currentRenderList, scene, camera, viewport ) {
|
|
75424
75942
|
|
|
75425
|
-
const opaqueObjects = currentRenderList
|
|
75426
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
75427
|
-
const transparentObjects = currentRenderList.transparent;
|
|
75943
|
+
const { opaque: opaqueObjects, transmissive: transmissiveObjects, transparent: transparentObjects } = currentRenderList;
|
|
75428
75944
|
|
|
75429
75945
|
currentRenderState.setupLightsView( camera );
|
|
75430
75946
|
|
|
@@ -75529,10 +76045,7 @@ class WebGLRenderer {
|
|
|
75529
76045
|
|
|
75530
76046
|
const renderItem = transmissiveObjects[ i ];
|
|
75531
76047
|
|
|
75532
|
-
const object = renderItem
|
|
75533
|
-
const geometry = renderItem.geometry;
|
|
75534
|
-
const material = renderItem.material;
|
|
75535
|
-
const group = renderItem.group;
|
|
76048
|
+
const { object, geometry, material, group } = renderItem;
|
|
75536
76049
|
|
|
75537
76050
|
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
75538
76051
|
|
|
@@ -75579,9 +76092,7 @@ class WebGLRenderer {
|
|
|
75579
76092
|
|
|
75580
76093
|
const renderItem = renderList[ i ];
|
|
75581
76094
|
|
|
75582
|
-
const object = renderItem
|
|
75583
|
-
const geometry = renderItem.geometry;
|
|
75584
|
-
const group = renderItem.group;
|
|
76095
|
+
const { object, geometry, group } = renderItem;
|
|
75585
76096
|
let material = renderItem.material;
|
|
75586
76097
|
|
|
75587
76098
|
if ( material.allowOverride === true && overrideMaterial !== null ) {
|
|
@@ -76120,6 +76631,13 @@ class WebGLRenderer {
|
|
|
76120
76631
|
|
|
76121
76632
|
}
|
|
76122
76633
|
|
|
76634
|
+
// Set DFG LUT for physically-based materials
|
|
76635
|
+
if ( m_uniforms.dfgLUT !== undefined ) {
|
|
76636
|
+
|
|
76637
|
+
m_uniforms.dfgLUT.value = getDFGLUT();
|
|
76638
|
+
|
|
76639
|
+
}
|
|
76640
|
+
|
|
76123
76641
|
if ( refreshMaterial ) {
|
|
76124
76642
|
|
|
76125
76643
|
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
|
@@ -76466,7 +76984,7 @@ class WebGLRenderer {
|
|
|
76466
76984
|
|
|
76467
76985
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
76468
76986
|
|
|
76469
|
-
|
|
76987
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
76470
76988
|
return;
|
|
76471
76989
|
|
|
76472
76990
|
}
|
|
@@ -76491,14 +77009,14 @@ class WebGLRenderer {
|
|
|
76491
77009
|
|
|
76492
77010
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
76493
77011
|
|
|
76494
|
-
|
|
77012
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
76495
77013
|
return;
|
|
76496
77014
|
|
|
76497
77015
|
}
|
|
76498
77016
|
|
|
76499
77017
|
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
76500
77018
|
|
|
76501
|
-
|
|
77019
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
76502
77020
|
return;
|
|
76503
77021
|
|
|
76504
77022
|
}
|
|
@@ -76914,15 +77432,6 @@ class WebGLRenderer {
|
|
|
76914
77432
|
|
|
76915
77433
|
};
|
|
76916
77434
|
|
|
76917
|
-
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
76918
|
-
|
|
76919
|
-
// @deprecated, r170
|
|
76920
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
76921
|
-
|
|
76922
|
-
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
76923
|
-
|
|
76924
|
-
};
|
|
76925
|
-
|
|
76926
77435
|
/**
|
|
76927
77436
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
76928
77437
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
@@ -77147,6 +77656,7 @@ exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
|
|
|
77147
77656
|
exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
|
|
77148
77657
|
exports.Euler = Euler;
|
|
77149
77658
|
exports.EventDispatcher = EventDispatcher;
|
|
77659
|
+
exports.ExternalTexture = ExternalTexture;
|
|
77150
77660
|
exports.ExtrudeGeometry = ExtrudeGeometry;
|
|
77151
77661
|
exports.FileLoader = FileLoader;
|
|
77152
77662
|
exports.Float16BufferAttribute = Float16BufferAttribute;
|
|
@@ -77426,6 +77936,7 @@ exports.UniformsGroup = UniformsGroup;
|
|
|
77426
77936
|
exports.UniformsLib = UniformsLib;
|
|
77427
77937
|
exports.UniformsUtils = UniformsUtils;
|
|
77428
77938
|
exports.UnsignedByteType = UnsignedByteType;
|
|
77939
|
+
exports.UnsignedInt101111Type = UnsignedInt101111Type;
|
|
77429
77940
|
exports.UnsignedInt248Type = UnsignedInt248Type;
|
|
77430
77941
|
exports.UnsignedInt5999Type = UnsignedInt5999Type;
|
|
77431
77942
|
exports.UnsignedIntType = UnsignedIntType;
|
|
@@ -77455,3 +77966,9 @@ exports.ZeroFactor = ZeroFactor;
|
|
|
77455
77966
|
exports.ZeroSlopeEnding = ZeroSlopeEnding;
|
|
77456
77967
|
exports.ZeroStencilOp = ZeroStencilOp;
|
|
77457
77968
|
exports.createCanvasElement = createCanvasElement;
|
|
77969
|
+
exports.error = error;
|
|
77970
|
+
exports.getConsoleFunction = getConsoleFunction;
|
|
77971
|
+
exports.log = log;
|
|
77972
|
+
exports.setConsoleFunction = setConsoleFunction;
|
|
77973
|
+
exports.warn = warn;
|
|
77974
|
+
exports.warnOnce = warnOnce;
|