super-three 0.144.0 → 0.147.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/README.md +1 -1
- package/build/three.cjs +737 -388
- package/build/three.js +737 -388
- package/build/three.min.js +1 -1
- package/build/three.module.js +911 -409
- package/examples/js/animation/AnimationClipCreator.js +0 -8
- package/examples/js/animation/CCDIKSolver.js +50 -67
- package/examples/js/animation/MMDAnimationHelper.js +66 -137
- package/examples/js/animation/MMDPhysics.js +70 -134
- package/examples/js/cameras/CinematicCamera.js +33 -22
- package/examples/js/controls/ArcballControls.js +138 -405
- package/examples/js/controls/DragControls.js +8 -33
- package/examples/js/controls/FirstPersonControls.js +32 -54
- package/examples/js/controls/FlyControls.js +29 -55
- package/examples/js/controls/OrbitControls.js +125 -99
- package/examples/js/controls/PointerLockControls.js +5 -14
- package/examples/js/controls/TrackballControls.js +33 -86
- package/examples/js/controls/TransformControls.js +85 -170
- package/examples/js/csm/CSM.js +4 -39
- package/examples/js/csm/CSMFrustum.js +3 -9
- package/examples/js/csm/CSMHelper.js +24 -4
- package/examples/js/csm/CSMShader.js +2 -6
- package/examples/js/curves/CurveExtras.js +27 -27
- package/examples/js/curves/NURBSCurve.js +4 -16
- package/examples/js/curves/NURBSSurface.js +3 -9
- package/examples/js/curves/NURBSUtils.js +8 -45
- package/examples/js/effects/AnaglyphEffect.js +4 -18
- package/examples/js/effects/AsciiEffect.js +32 -31
- package/examples/js/effects/OutlineEffect.js +26 -30
- package/examples/js/effects/ParallaxBarrierEffect.js +0 -13
- package/examples/js/effects/PeppersGhostEffect.js +12 -39
- package/examples/js/effects/StereoEffect.js +0 -4
- package/examples/js/environments/RoomEnvironment.js +12 -10
- package/examples/js/exporters/ColladaExporter.js +48 -65
- package/examples/js/exporters/DRACOExporter.js +22 -22
- package/examples/js/exporters/EXRExporter.js +15 -18
- package/examples/js/exporters/GLTFExporter.js +141 -317
- package/examples/js/exporters/MMDExporter.js +5 -12
- package/examples/js/exporters/OBJExporter.js +42 -33
- package/examples/js/exporters/PLYExporter.js +38 -33
- package/examples/js/exporters/STLExporter.js +5 -7
- package/examples/js/exporters/USDZExporter.js +113 -27
- package/examples/js/geometries/BoxLineGeometry.js +0 -1
- package/examples/js/geometries/ConvexGeometry.js +11 -6
- package/examples/js/geometries/DecalGeometry.js +53 -20
- package/examples/js/geometries/LightningStrike.js +54 -67
- package/examples/js/geometries/ParametricGeometries.js +8 -7
- package/examples/js/geometries/ParametricGeometry.js +25 -12
- package/examples/js/geometries/RoundedBoxGeometry.js +21 -19
- package/examples/js/geometries/TeapotGeometry.js +54 -50
- package/examples/js/geometries/TextGeometry.js +6 -4
- package/examples/js/helpers/LightProbeHelper.js +1 -2
- package/examples/js/helpers/OctreeHelper.js +22 -20
- package/examples/js/helpers/PositionalAudioHelper.js +8 -6
- package/examples/js/helpers/RectAreaLightHelper.js +6 -7
- package/examples/js/helpers/VertexNormalsHelper.js +15 -13
- package/examples/js/helpers/VertexTangentsHelper.js +15 -9
- package/examples/js/helpers/ViewHelper.js +31 -16
- package/examples/js/interactive/HTMLMesh.js +25 -39
- package/examples/js/interactive/InteractiveGroup.js +9 -14
- package/examples/js/interactive/SelectionBox.js +3 -70
- package/examples/js/interactive/SelectionHelper.js +0 -8
- package/examples/js/lights/LightProbeGenerator.js +32 -39
- package/examples/js/lights/RectAreaLightUniformsLib.js +5 -1
- package/examples/js/lines/LineGeometry.js +3 -5
- package/examples/js/lines/LineMaterial.js +4 -11
- package/examples/js/lines/LineSegments2.js +40 -89
- package/examples/js/lines/LineSegmentsGeometry.js +7 -28
- package/examples/js/lines/Wireframe.js +2 -7
- package/examples/js/lines/WireframeGeometry2.js +3 -1
- package/examples/js/loaders/3DMLoader.js +58 -155
- package/examples/js/loaders/3MFLoader.js +72 -106
- package/examples/js/loaders/AMFLoader.js +0 -25
- package/examples/js/loaders/BVHLoader.js +44 -43
- package/examples/js/loaders/BasisTextureLoader.js +16 -46
- package/examples/js/loaders/ColladaLoader.js +228 -359
- package/examples/js/loaders/DDSLoader.js +24 -25
- package/examples/js/loaders/DRACOLoader.js +29 -66
- package/examples/js/loaders/EXRLoader.js +67 -164
- package/examples/js/loaders/FBXLoader.js +287 -441
- package/examples/js/loaders/FontLoader.js +6 -15
- package/examples/js/loaders/GCodeLoader.js +15 -16
- package/examples/js/loaders/GLTFLoader.js +409 -706
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -6
- package/examples/js/loaders/KMZLoader.js +3 -7
- package/examples/js/loaders/KTXLoader.js +12 -30
- package/examples/js/loaders/LDrawLoader.js +178 -289
- package/examples/js/loaders/LUT3dlLoader.js +7 -11
- package/examples/js/loaders/LUTCubeLoader.js +0 -8
- package/examples/js/loaders/LWOLoader.js +59 -124
- package/examples/js/loaders/LogLuvLoader.js +27 -77
- package/examples/js/loaders/LottieLoader.js +4 -4
- package/examples/js/loaders/MD2Loader.js +26 -27
- package/examples/js/loaders/MDDLoader.js +6 -10
- package/examples/js/loaders/MMDLoader.js +180 -189
- package/examples/js/loaders/MTLLoader.js +18 -47
- package/examples/js/loaders/NRRDLoader.js +44 -84
- package/examples/js/loaders/OBJLoader.js +50 -65
- package/examples/js/loaders/PCDLoader.js +34 -29
- package/examples/js/loaders/PDBLoader.js +17 -13
- package/examples/js/loaders/PLYLoader.js +62 -48
- package/examples/js/loaders/PRWMLoader.js +11 -22
- package/examples/js/loaders/PVRLoader.js +7 -16
- package/examples/js/loaders/RGBELoader.js +36 -61
- package/examples/js/loaders/RGBMLoader.js +26 -87
- package/examples/js/loaders/STLLoader.js +20 -27
- package/examples/js/loaders/SVGLoader.js +361 -233
- package/examples/js/loaders/TDSLoader.js +81 -118
- package/examples/js/loaders/TGALoader.js +39 -41
- package/examples/js/loaders/TIFFLoader.js +0 -1
- package/examples/js/loaders/TTFLoader.js +0 -8
- package/examples/js/loaders/TiltLoader.js +14 -15
- package/examples/js/loaders/VOXLoader.js +8 -16
- package/examples/js/loaders/VRMLLoader.js +243 -340
- package/examples/js/loaders/VTKLoader.js +101 -118
- package/examples/js/loaders/XYZLoader.js +2 -4
- package/examples/js/loaders/lwo/IFFParser.js +55 -136
- package/examples/js/loaders/lwo/LWO2Parser.js +32 -83
- package/examples/js/loaders/lwo/LWO3Parser.js +31 -73
- package/examples/js/materials/MeshGouraudMaterial.js +15 -13
- package/examples/js/math/Capsule.js +0 -17
- package/examples/js/math/ColorConverter.js +3 -3
- package/examples/js/math/ConvexHull.js +185 -141
- package/examples/js/math/ImprovedNoise.js +1 -1
- package/examples/js/math/Lut.js +8 -15
- package/examples/js/math/MeshSurfaceSampler.js +6 -28
- package/examples/js/math/OBB.js +90 -49
- package/examples/js/math/Octree.js +2 -57
- package/examples/js/math/SimplexNoise.js +74 -88
- package/examples/js/misc/ConvexObjectBreaker.js +37 -48
- package/examples/js/misc/GPUComputationRenderer.js +26 -16
- package/examples/js/misc/Gyroscope.js +5 -9
- package/examples/js/misc/MD2Character.js +14 -23
- package/examples/js/misc/MD2CharacterComplex.js +73 -54
- package/examples/js/misc/MorphAnimMesh.js +0 -6
- package/examples/js/misc/MorphBlendMesh.js +3 -30
- package/examples/js/misc/ProgressiveLightMap.js +47 -43
- package/examples/js/misc/RollerCoaster.js +17 -24
- package/examples/js/misc/TubePainter.js +18 -12
- package/examples/js/misc/Volume.js +16 -45
- package/examples/js/misc/VolumeSlice.js +14 -24
- package/examples/js/modifiers/CurveModifier.js +19 -21
- package/examples/js/modifiers/EdgeSplitModifier.js +0 -30
- package/examples/js/modifiers/SimplifyModifier.js +56 -59
- package/examples/js/modifiers/TessellateModifier.js +2 -9
- package/examples/js/objects/GroundProjectedEnv.js +2 -14
- package/examples/js/objects/Lensflare.js +47 -38
- package/examples/js/objects/LightningStorm.js +10 -13
- package/examples/js/objects/MarchingCubes.js +80 -59
- package/examples/js/objects/Reflector.js +22 -20
- package/examples/js/objects/ReflectorForSSRPass.js +19 -23
- package/examples/js/objects/Refractor.js +52 -30
- package/examples/js/objects/ShadowMesh.js +1 -2
- package/examples/js/objects/Sky.js +2 -7
- package/examples/js/objects/Water.js +23 -18
- package/examples/js/objects/Water2.js +20 -19
- package/examples/js/physics/AmmoPhysics.js +23 -20
- package/examples/js/physics/OimoPhysics.js +19 -17
- package/examples/js/postprocessing/AdaptiveToneMappingPass.js +13 -20
- package/examples/js/postprocessing/AfterimagePass.js +19 -12
- package/examples/js/postprocessing/BloomPass.js +38 -17
- package/examples/js/postprocessing/BokehPass.js +29 -12
- package/examples/js/postprocessing/ClearPass.js +1 -6
- package/examples/js/postprocessing/CubeTexturePass.js +12 -9
- package/examples/js/postprocessing/DotScreenPass.js +7 -5
- package/examples/js/postprocessing/EffectComposer.js +25 -32
- package/examples/js/postprocessing/FilmPass.js +7 -5
- package/examples/js/postprocessing/GlitchPass.js +10 -11
- package/examples/js/postprocessing/HalftonePass.js +9 -9
- package/examples/js/postprocessing/LUTPass.js +2 -15
- package/examples/js/postprocessing/MaskPass.js +20 -17
- package/examples/js/postprocessing/OutlinePass.js +45 -36
- package/examples/js/postprocessing/Pass.js +11 -14
- package/examples/js/postprocessing/RenderPass.js +3 -7
- package/examples/js/postprocessing/RenderPixelatedPass.js +215 -0
- package/examples/js/postprocessing/SAOPass.js +40 -32
- package/examples/js/postprocessing/SMAAPass.js +34 -17
- package/examples/js/postprocessing/SSAARenderPass.js +14 -14
- package/examples/js/postprocessing/SSAOPass.js +56 -42
- package/examples/js/postprocessing/SSRPass.js +78 -61
- package/examples/js/postprocessing/SavePass.js +14 -6
- package/examples/js/postprocessing/ShaderPass.js +9 -8
- package/examples/js/postprocessing/TAARenderPass.js +11 -9
- package/examples/js/postprocessing/TexturePass.js +7 -4
- package/examples/js/postprocessing/UnrealBloomPass.js +43 -25
- package/examples/js/renderers/CSS2DRenderer.js +2 -21
- package/examples/js/renderers/CSS3DRenderer.js +3 -24
- package/examples/js/renderers/Projector.js +29 -85
- package/examples/js/renderers/SVGRenderer.js +4 -50
- package/examples/js/shaders/ACESFilmicToneMappingShader.js +3 -6
- package/examples/js/shaders/AfterimageShader.js +3 -6
- package/examples/js/shaders/BasicShader.js +3 -6
- package/examples/js/shaders/BleachBypassShader.js +3 -6
- package/examples/js/shaders/BlendShader.js +3 -6
- package/examples/js/shaders/BokehShader.js +3 -6
- package/examples/js/shaders/BokehShader2.js +4 -13
- package/examples/js/shaders/BrightnessContrastShader.js +3 -6
- package/examples/js/shaders/ColorCorrectionShader.js +2 -6
- package/examples/js/shaders/ColorifyShader.js +2 -6
- package/examples/js/shaders/ConvolutionShader.js +5 -10
- package/examples/js/shaders/CopyShader.js +3 -6
- package/examples/js/shaders/DOFMipMapShader.js +3 -6
- package/examples/js/shaders/DepthLimitedBlurShader.js +2 -9
- package/examples/js/shaders/DigitalGlitch.js +3 -6
- package/examples/js/shaders/DotScreenShader.js +2 -6
- package/examples/js/shaders/FXAAShader.js +1 -3
- package/examples/js/shaders/FilmShader.js +3 -6
- package/examples/js/shaders/FocusShader.js +3 -6
- package/examples/js/shaders/FreiChenShader.js +2 -6
- package/examples/js/shaders/GammaCorrectionShader.js +3 -6
- package/examples/js/shaders/GodRaysShader.js +11 -24
- package/examples/js/shaders/HalftoneShader.js +3 -6
- package/examples/js/shaders/HorizontalBlurShader.js +3 -6
- package/examples/js/shaders/HorizontalTiltShiftShader.js +3 -6
- package/examples/js/shaders/HueSaturationShader.js +3 -6
- package/examples/js/shaders/KaleidoShader.js +3 -6
- package/examples/js/shaders/LuminosityHighPassShader.js +2 -6
- package/examples/js/shaders/LuminosityShader.js +3 -6
- package/examples/js/shaders/MMDToonShader.js +2 -8
- package/examples/js/shaders/MirrorShader.js +3 -6
- package/examples/js/shaders/NormalMapShader.js +2 -6
- package/examples/js/shaders/RGBShiftShader.js +3 -6
- package/examples/js/shaders/SAOShader.js +2 -6
- package/examples/js/shaders/SMAAShader.js +6 -18
- package/examples/js/shaders/SSAOShader.js +2 -6
- package/examples/js/shaders/SSRShader.js +6 -18
- package/examples/js/shaders/SepiaShader.js +3 -6
- package/examples/js/shaders/SobelOperatorShader.js +2 -6
- package/examples/js/shaders/TechnicolorShader.js +3 -6
- package/examples/js/shaders/ToneMapShader.js +3 -6
- package/examples/js/shaders/ToonShader.js +8 -24
- package/examples/js/shaders/TriangleBlurShader.js +2 -6
- package/examples/js/shaders/UnpackDepthRGBAShader.js +3 -6
- package/examples/js/shaders/VelocityShader.js +126 -0
- package/examples/js/shaders/VerticalBlurShader.js +3 -6
- package/examples/js/shaders/VerticalTiltShiftShader.js +3 -6
- package/examples/js/shaders/VignetteShader.js +3 -6
- package/examples/js/shaders/VolumeShader.js +2 -6
- package/examples/js/shaders/WaterRefractionShader.js +2 -6
- package/examples/js/textures/FlakesTexture.js +0 -1
- package/examples/js/utils/BufferGeometryUtils.js +236 -170
- package/examples/js/utils/CameraUtils.js +5 -20
- package/examples/js/utils/GPUStatsPanel.js +3 -12
- package/examples/js/utils/GeometryCompressionUtils.js +19 -44
- package/examples/js/utils/GeometryUtils.js +13 -18
- package/examples/js/utils/LDrawUtils.js +8 -11
- package/examples/js/utils/PackedPhongMaterial.js +6 -4
- package/examples/js/utils/SceneUtils.js +117 -6
- package/examples/js/utils/ShadowMapViewer.js +17 -14
- package/examples/js/utils/SkeletonUtils.js +13 -27
- package/examples/js/utils/UVsDebug.js +20 -12
- package/examples/js/utils/WorkerPool.js +1 -11
- package/examples/jsm/animation/CCDIKSolver.js +27 -3
- package/examples/jsm/animation/MMDPhysics.js +25 -0
- package/examples/jsm/capabilities/WebGPU.js +3 -1
- package/examples/jsm/controls/FirstPersonControls.js +20 -20
- package/examples/jsm/controls/FlyControls.js +16 -17
- package/examples/jsm/controls/OrbitControls.js +44 -4
- package/examples/jsm/controls/TrackballControls.js +14 -2
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/csm/CSM.js +1 -0
- package/examples/jsm/csm/CSMHelper.js +30 -0
- package/examples/jsm/exporters/GLTFExporter.js +0 -79
- package/examples/jsm/exporters/USDZExporter.js +93 -1
- package/examples/jsm/helpers/OctreeHelper.js +22 -8
- package/examples/jsm/helpers/VertexNormalsHelper.js +7 -1
- package/examples/jsm/helpers/VertexTangentsHelper.js +7 -0
- package/examples/jsm/helpers/ViewHelper.js +24 -0
- package/examples/jsm/interactive/HTMLMesh.js +5 -6
- package/examples/jsm/interactive/InteractiveGroup.js +4 -2
- package/examples/jsm/libs/flow.module.js +610 -160
- package/examples/jsm/libs/lottie_canvas.module.js +14844 -0
- package/examples/jsm/lines/LineSegments2.js +4 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -2
- package/examples/jsm/loaders/ColladaLoader.js +28 -0
- package/examples/jsm/loaders/FBXLoader.js +18 -2
- package/examples/jsm/loaders/GLTFLoader.js +269 -428
- package/examples/jsm/loaders/KTX2Loader.js +68 -29
- package/examples/jsm/loaders/LDrawLoader.js +14 -13
- package/examples/jsm/loaders/LottieLoader.js +4 -2
- package/examples/jsm/loaders/MaterialXLoader.js +728 -0
- package/examples/jsm/loaders/PCDLoader.js +1 -1
- package/examples/jsm/loaders/PLYLoader.js +68 -16
- package/examples/jsm/loaders/SVGLoader.js +227 -14
- package/examples/jsm/loaders/USDZLoader.js +351 -111
- package/examples/jsm/loaders/VRMLLoader.js +13 -1
- package/examples/jsm/math/ConvexHull.js +4 -4
- package/examples/jsm/math/Octree.js +1 -1
- package/examples/jsm/node-editor/NodeEditor.js +91 -12
- package/examples/jsm/node-editor/core/BaseNode.js +10 -3
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +6 -9
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +6 -9
- package/examples/jsm/node-editor/math/AngleEditor.js +3 -3
- package/examples/jsm/node-editor/math/InvertEditor.js +2 -2
- package/examples/jsm/node-editor/scene/MeshEditor.js +11 -8
- package/examples/jsm/node-editor/utils/PreviewEditor.js +4 -0
- package/examples/jsm/nodes/Nodes.js +30 -3
- package/examples/jsm/nodes/accessors/BitangentNode.js +62 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +6 -6
- package/examples/jsm/nodes/accessors/Object3DNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +6 -0
- package/examples/jsm/nodes/accessors/ReferenceNode.js +1 -1
- package/examples/jsm/nodes/accessors/SkinningNode.js +8 -1
- package/examples/jsm/nodes/accessors/TangentNode.js +95 -0
- package/examples/jsm/nodes/core/AttributeNode.js +31 -8
- package/examples/jsm/nodes/core/Node.js +1 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +55 -6
- package/examples/jsm/nodes/core/NodeFrame.js +2 -2
- package/examples/jsm/nodes/core/NodeVarying.js +7 -4
- package/examples/jsm/nodes/core/VaryingNode.js +6 -4
- package/examples/jsm/nodes/core/constants.js +13 -13
- package/examples/jsm/nodes/display/BlendModeNode.js +85 -0
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -12
- package/examples/jsm/nodes/display/NormalMapNode.js +19 -12
- package/examples/jsm/nodes/display/PosterizeNode.js +25 -0
- package/examples/jsm/nodes/display/ViewportNode.js +106 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +5 -5
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +3 -3
- package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +1 -1
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +3 -1
- package/examples/jsm/nodes/materials/Materials.js +9 -7
- package/examples/jsm/nodes/materials/NodeMaterial.js +9 -1
- package/examples/jsm/nodes/materialx/{Disclaimer.md → DISCLAIMER.md} +1 -1
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +59 -0
- package/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_hsv.js +1 -1
- package/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_noise.js +13 -3
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +18 -0
- package/examples/jsm/nodes/math/MathNode.js +5 -5
- package/examples/jsm/nodes/math/OperatorNode.js +16 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +35 -20
- package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +87 -63
- package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +29 -0
- package/examples/jsm/nodes/utils/ConvertNode.js +15 -14
- package/examples/jsm/nodes/utils/EquirectUVNode.js +27 -0
- package/examples/jsm/nodes/utils/JoinNode.js +8 -2
- package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -4
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
- package/examples/jsm/nodes/utils/OscNode.js +2 -2
- package/examples/jsm/nodes/utils/RemapNode.js +34 -0
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +8 -10
- package/examples/jsm/nodes/utils/TimerNode.js +21 -1
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +51 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +17 -4
- package/examples/jsm/postprocessing/BloomPass.js +22 -3
- package/examples/jsm/postprocessing/BokehPass.js +18 -4
- package/examples/jsm/postprocessing/CubeTexturePass.js +12 -5
- package/examples/jsm/postprocessing/DotScreenPass.js +8 -0
- package/examples/jsm/postprocessing/EffectComposer.js +9 -0
- package/examples/jsm/postprocessing/FilmPass.js +8 -0
- package/examples/jsm/postprocessing/GlitchPass.js +13 -1
- package/examples/jsm/postprocessing/HalftonePass.js +8 -0
- package/examples/jsm/postprocessing/OutlinePass.js +21 -1
- package/examples/jsm/postprocessing/Pass.js +2 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +234 -0
- package/examples/jsm/postprocessing/SAOPass.js +20 -0
- package/examples/jsm/postprocessing/SMAAPass.js +16 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +4 -0
- package/examples/jsm/postprocessing/SavePass.js +17 -1
- package/examples/jsm/postprocessing/ShaderPass.js +8 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +9 -0
- package/examples/jsm/postprocessing/TexturePass.js +8 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +16 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +56 -35
- package/examples/jsm/renderers/webgpu/WebGPUAnimation.js +58 -0
- package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +63 -5
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +36 -7
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +47 -12
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +41 -9
- package/examples/jsm/shaders/MMDToonShader.js +0 -2
- package/examples/jsm/shaders/VelocityShader.js +128 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +174 -42
- package/examples/jsm/utils/SceneUtils.js +129 -4
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandMeshModel.js +8 -3
- package/package.json +13 -13
- package/src/Three.js +1 -0
- package/src/animation/PropertyBinding.js +7 -0
- package/src/audio/AudioContext.js +5 -5
- package/src/cameras/CubeCamera.js +14 -14
- package/src/constants.js +1 -1
- package/src/core/InstancedBufferGeometry.js +1 -7
- package/src/core/InterleavedBufferAttribute.js +4 -4
- package/src/extras/Earcut.js +67 -67
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/ShapeGeometry.js +1 -1
- package/src/helpers/ArrowHelper.js +9 -0
- package/src/helpers/Box3Helper.js +7 -0
- package/src/helpers/BoxHelper.js +7 -1
- package/src/helpers/DirectionalLightHelper.js +5 -1
- package/src/helpers/GridHelper.js +7 -0
- package/src/helpers/HemisphereLightHelper.js +4 -1
- package/src/helpers/PlaneHelper.js +9 -0
- package/src/helpers/PointLightHelper.js +2 -1
- package/src/helpers/PolarGridHelper.js +7 -0
- package/src/helpers/SkeletonHelper.js +7 -0
- package/src/helpers/SpotLightHelper.js +4 -2
- package/src/lights/LightShadow.js +1 -2
- package/src/lights/PointLight.js +2 -2
- package/src/lights/SpotLight.js +2 -2
- package/src/loaders/FileLoader.js +4 -1
- package/src/loaders/ObjectLoader.js +5 -1
- package/src/materials/Material.js +1 -1
- package/src/materials/MeshPhysicalMaterial.js +1 -1
- package/src/math/Color.js +5 -5
- package/src/math/Matrix3.js +53 -18
- package/src/math/Ray.js +2 -5
- package/src/math/Sphere.js +36 -21
- package/src/objects/InstancedMesh.js +7 -0
- package/src/objects/LOD.js +25 -6
- package/src/renderers/WebGL3DRenderTarget.js +1 -1
- package/src/renderers/WebGLArrayRenderTarget.js +1 -1
- package/src/renderers/WebGLCubeRenderTarget.js +1 -1
- package/src/renderers/WebGLMultipleRenderTargets.js +1 -1
- package/src/renderers/WebGLRenderTarget.js +1 -1
- package/src/renderers/WebGLRenderer.js +36 -62
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -4
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +0 -2
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +0 -2
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +0 -2
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -4
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk.js +3 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +7 -2
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +0 -3
- package/src/renderers/shaders/ShaderLib.js +20 -6
- package/src/renderers/shaders/UniformsLib.js +1 -1
- package/src/renderers/shaders/UniformsUtils.js +15 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -0
- package/src/renderers/webgl/WebGLBackground.js +15 -7
- package/src/renderers/webgl/WebGLLights.js +0 -4
- package/src/renderers/webgl/WebGLMaterials.js +2 -1
- package/src/renderers/webgl/WebGLShadowMap.js +3 -1
- package/src/renderers/webgl/WebGLState.js +78 -41
- package/src/renderers/webgl/WebGLTextures.js +94 -39
- package/src/renderers/webgl/WebGLUniforms.js +152 -24
- package/src/renderers/webgl/WebGLUtils.js +1 -1
- package/src/renderers/webxr/WebXRController.js +46 -13
- package/src/renderers/webxr/WebXRManager.js +71 -3
- package/src/scenes/Scene.js +8 -0
- package/src/textures/CompressedArrayTexture.js +18 -0
- package/src/textures/Texture.js +2 -1
- package/examples/js/libs/lottie_canvas.js +0 -12751
- package/examples/js/shaders/PixelShader.js +0 -51
- package/examples/jsm/shaders/PixelShader.js +0 -44
package/build/three.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
|
|
10
10
|
})(this, (function (exports) { 'use strict';
|
|
11
11
|
|
|
12
|
-
const REVISION = '
|
|
12
|
+
const REVISION = '147';
|
|
13
13
|
const MOUSE = {
|
|
14
14
|
LEFT: 0,
|
|
15
15
|
MIDDLE: 1,
|
|
@@ -998,49 +998,44 @@
|
|
|
998
998
|
const s = Math.sin(rotation);
|
|
999
999
|
this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
|
|
1000
1000
|
return this;
|
|
1001
|
-
}
|
|
1001
|
+
} //
|
|
1002
|
+
|
|
1002
1003
|
|
|
1003
1004
|
scale(sx, sy) {
|
|
1004
|
-
|
|
1005
|
-
te[0] *= sx;
|
|
1006
|
-
te[3] *= sx;
|
|
1007
|
-
te[6] *= sx;
|
|
1008
|
-
te[1] *= sy;
|
|
1009
|
-
te[4] *= sy;
|
|
1010
|
-
te[7] *= sy;
|
|
1005
|
+
this.premultiply(_m3.makeScale(sx, sy));
|
|
1011
1006
|
return this;
|
|
1012
1007
|
}
|
|
1013
1008
|
|
|
1014
1009
|
rotate(theta) {
|
|
1015
|
-
|
|
1016
|
-
const s = Math.sin(theta);
|
|
1017
|
-
const te = this.elements;
|
|
1018
|
-
const a11 = te[0],
|
|
1019
|
-
a12 = te[3],
|
|
1020
|
-
a13 = te[6];
|
|
1021
|
-
const a21 = te[1],
|
|
1022
|
-
a22 = te[4],
|
|
1023
|
-
a23 = te[7];
|
|
1024
|
-
te[0] = c * a11 + s * a21;
|
|
1025
|
-
te[3] = c * a12 + s * a22;
|
|
1026
|
-
te[6] = c * a13 + s * a23;
|
|
1027
|
-
te[1] = -s * a11 + c * a21;
|
|
1028
|
-
te[4] = -s * a12 + c * a22;
|
|
1029
|
-
te[7] = -s * a13 + c * a23;
|
|
1010
|
+
this.premultiply(_m3.makeRotation(-theta));
|
|
1030
1011
|
return this;
|
|
1031
1012
|
}
|
|
1032
1013
|
|
|
1033
1014
|
translate(tx, ty) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1015
|
+
this.premultiply(_m3.makeTranslation(tx, ty));
|
|
1016
|
+
return this;
|
|
1017
|
+
} // for 2D Transforms
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
makeTranslation(x, y) {
|
|
1021
|
+
this.set(1, 0, x, 0, 1, y, 0, 0, 1);
|
|
1041
1022
|
return this;
|
|
1042
1023
|
}
|
|
1043
1024
|
|
|
1025
|
+
makeRotation(theta) {
|
|
1026
|
+
// counterclockwise
|
|
1027
|
+
const c = Math.cos(theta);
|
|
1028
|
+
const s = Math.sin(theta);
|
|
1029
|
+
this.set(c, -s, 0, s, c, 0, 0, 0, 1);
|
|
1030
|
+
return this;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
makeScale(x, y) {
|
|
1034
|
+
this.set(x, 0, 0, 0, y, 0, 0, 0, 1);
|
|
1035
|
+
return this;
|
|
1036
|
+
} //
|
|
1037
|
+
|
|
1038
|
+
|
|
1044
1039
|
equals(matrix) {
|
|
1045
1040
|
const te = this.elements;
|
|
1046
1041
|
const me = matrix.elements;
|
|
@@ -1080,6 +1075,8 @@
|
|
|
1080
1075
|
|
|
1081
1076
|
}
|
|
1082
1077
|
|
|
1078
|
+
const _m3 = /*@__PURE__*/new Matrix3();
|
|
1079
|
+
|
|
1083
1080
|
function arrayNeedsUint32(array) {
|
|
1084
1081
|
// assumes larger values usually on last
|
|
1085
1082
|
for (let i = array.length - 1; i >= 0; --i) {
|
|
@@ -1309,7 +1306,7 @@
|
|
|
1309
1306
|
'yellow': 0xFFFF00,
|
|
1310
1307
|
'yellowgreen': 0x9ACD32
|
|
1311
1308
|
};
|
|
1312
|
-
const _rgb = {
|
|
1309
|
+
const _rgb$1 = {
|
|
1313
1310
|
r: 0,
|
|
1314
1311
|
g: 0,
|
|
1315
1312
|
b: 0
|
|
@@ -1384,7 +1381,7 @@
|
|
|
1384
1381
|
return this;
|
|
1385
1382
|
}
|
|
1386
1383
|
|
|
1387
|
-
setRGB(r, g, b, colorSpace =
|
|
1384
|
+
setRGB(r, g, b, colorSpace = ColorManagement.workingColorSpace) {
|
|
1388
1385
|
this.r = r;
|
|
1389
1386
|
this.g = g;
|
|
1390
1387
|
this.b = b;
|
|
@@ -1392,7 +1389,7 @@
|
|
|
1392
1389
|
return this;
|
|
1393
1390
|
}
|
|
1394
1391
|
|
|
1395
|
-
setHSL(h, s, l, colorSpace =
|
|
1392
|
+
setHSL(h, s, l, colorSpace = ColorManagement.workingColorSpace) {
|
|
1396
1393
|
// h,s,l ranges are in 0.0 - 1.0
|
|
1397
1394
|
h = euclideanModulo(h, 1);
|
|
1398
1395
|
s = clamp(s, 0, 1);
|
|
@@ -1547,20 +1544,20 @@
|
|
|
1547
1544
|
}
|
|
1548
1545
|
|
|
1549
1546
|
getHex(colorSpace = SRGBColorSpace) {
|
|
1550
|
-
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
|
|
1551
|
-
return clamp(_rgb.r * 255, 0, 255) << 16 ^ clamp(_rgb.g * 255, 0, 255) << 8 ^ clamp(_rgb.b * 255, 0, 255) << 0;
|
|
1547
|
+
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
|
|
1548
|
+
return clamp(_rgb$1.r * 255, 0, 255) << 16 ^ clamp(_rgb$1.g * 255, 0, 255) << 8 ^ clamp(_rgb$1.b * 255, 0, 255) << 0;
|
|
1552
1549
|
}
|
|
1553
1550
|
|
|
1554
1551
|
getHexString(colorSpace = SRGBColorSpace) {
|
|
1555
1552
|
return ('000000' + this.getHex(colorSpace).toString(16)).slice(-6);
|
|
1556
1553
|
}
|
|
1557
1554
|
|
|
1558
|
-
getHSL(target, colorSpace =
|
|
1555
|
+
getHSL(target, colorSpace = ColorManagement.workingColorSpace) {
|
|
1559
1556
|
// h,s,l ranges are in 0.0 - 1.0
|
|
1560
|
-
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
|
|
1561
|
-
const r = _rgb.r,
|
|
1562
|
-
g = _rgb.g,
|
|
1563
|
-
b = _rgb.b;
|
|
1557
|
+
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
|
|
1558
|
+
const r = _rgb$1.r,
|
|
1559
|
+
g = _rgb$1.g,
|
|
1560
|
+
b = _rgb$1.b;
|
|
1564
1561
|
const max = Math.max(r, g, b);
|
|
1565
1562
|
const min = Math.min(r, g, b);
|
|
1566
1563
|
let hue, saturation;
|
|
@@ -1596,23 +1593,23 @@
|
|
|
1596
1593
|
return target;
|
|
1597
1594
|
}
|
|
1598
1595
|
|
|
1599
|
-
getRGB(target, colorSpace =
|
|
1600
|
-
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
|
|
1601
|
-
target.r = _rgb.r;
|
|
1602
|
-
target.g = _rgb.g;
|
|
1603
|
-
target.b = _rgb.b;
|
|
1596
|
+
getRGB(target, colorSpace = ColorManagement.workingColorSpace) {
|
|
1597
|
+
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
|
|
1598
|
+
target.r = _rgb$1.r;
|
|
1599
|
+
target.g = _rgb$1.g;
|
|
1600
|
+
target.b = _rgb$1.b;
|
|
1604
1601
|
return target;
|
|
1605
1602
|
}
|
|
1606
1603
|
|
|
1607
1604
|
getStyle(colorSpace = SRGBColorSpace) {
|
|
1608
|
-
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
|
|
1605
|
+
ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
|
|
1609
1606
|
|
|
1610
1607
|
if (colorSpace !== SRGBColorSpace) {
|
|
1611
1608
|
// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
|
|
1612
|
-
return `color(${colorSpace} ${_rgb.r} ${_rgb.g} ${_rgb.b})`;
|
|
1609
|
+
return `color(${colorSpace} ${_rgb$1.r} ${_rgb$1.g} ${_rgb$1.b})`;
|
|
1613
1610
|
}
|
|
1614
1611
|
|
|
1615
|
-
return `rgb(${_rgb.r * 255 | 0},${_rgb.g * 255 | 0},${_rgb.b * 255 | 0})`;
|
|
1612
|
+
return `rgb(${_rgb$1.r * 255 | 0},${_rgb$1.g * 255 | 0},${_rgb$1.b * 255 | 0})`;
|
|
1616
1613
|
}
|
|
1617
1614
|
|
|
1618
1615
|
offsetHSL(h, s, l) {
|
|
@@ -1889,7 +1886,7 @@
|
|
|
1889
1886
|
let textureId = 0;
|
|
1890
1887
|
|
|
1891
1888
|
class Texture extends EventDispatcher {
|
|
1892
|
-
constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy =
|
|
1889
|
+
constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, encoding = LinearEncoding) {
|
|
1893
1890
|
super();
|
|
1894
1891
|
this.isTexture = true;
|
|
1895
1892
|
Object.defineProperty(this, 'id', {
|
|
@@ -2088,6 +2085,7 @@
|
|
|
2088
2085
|
|
|
2089
2086
|
Texture.DEFAULT_IMAGE = null;
|
|
2090
2087
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
2088
|
+
Texture.DEFAULT_ANISOTROPY = 1;
|
|
2091
2089
|
|
|
2092
2090
|
class Vector4 {
|
|
2093
2091
|
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
@@ -2575,7 +2573,7 @@
|
|
|
2575
2573
|
*/
|
|
2576
2574
|
|
|
2577
2575
|
class WebGLRenderTarget extends EventDispatcher {
|
|
2578
|
-
constructor(width, height, options = {}) {
|
|
2576
|
+
constructor(width = 1, height = 1, options = {}) {
|
|
2579
2577
|
super();
|
|
2580
2578
|
this.isWebGLRenderTarget = true;
|
|
2581
2579
|
this.width = width;
|
|
@@ -2666,7 +2664,7 @@
|
|
|
2666
2664
|
}
|
|
2667
2665
|
|
|
2668
2666
|
class WebGLArrayRenderTarget extends WebGLRenderTarget {
|
|
2669
|
-
constructor(width, height, depth) {
|
|
2667
|
+
constructor(width = 1, height = 1, depth = 1) {
|
|
2670
2668
|
super(width, height);
|
|
2671
2669
|
this.isWebGLArrayRenderTarget = true;
|
|
2672
2670
|
this.depth = depth;
|
|
@@ -2704,7 +2702,7 @@
|
|
|
2704
2702
|
}
|
|
2705
2703
|
|
|
2706
2704
|
class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
2707
|
-
constructor(width, height, depth) {
|
|
2705
|
+
constructor(width = 1, height = 1, depth = 1) {
|
|
2708
2706
|
super(width, height);
|
|
2709
2707
|
this.isWebGL3DRenderTarget = true;
|
|
2710
2708
|
this.depth = depth;
|
|
@@ -2715,7 +2713,7 @@
|
|
|
2715
2713
|
}
|
|
2716
2714
|
|
|
2717
2715
|
class WebGLMultipleRenderTargets extends WebGLRenderTarget {
|
|
2718
|
-
constructor(width, height, count, options = {}) {
|
|
2716
|
+
constructor(width = 1, height = 1, count = 1, options = {}) {
|
|
2719
2717
|
super(width, height, options);
|
|
2720
2718
|
this.isWebGLMultipleRenderTargets = true;
|
|
2721
2719
|
const texture = this.texture;
|
|
@@ -4057,28 +4055,28 @@
|
|
|
4057
4055
|
|
|
4058
4056
|
_v1$7.subVectors(triangle.b, _center);
|
|
4059
4057
|
|
|
4060
|
-
_v2$
|
|
4058
|
+
_v2$4.subVectors(triangle.c, _center); // compute edge vectors for triangle
|
|
4061
4059
|
|
|
4062
4060
|
|
|
4063
4061
|
_f0.subVectors(_v1$7, _v0$2);
|
|
4064
4062
|
|
|
4065
|
-
_f1.subVectors(_v2$
|
|
4063
|
+
_f1.subVectors(_v2$4, _v1$7);
|
|
4066
4064
|
|
|
4067
|
-
_f2.subVectors(_v0$2, _v2$
|
|
4065
|
+
_f2.subVectors(_v0$2, _v2$4); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
|
|
4068
4066
|
// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
|
|
4069
4067
|
// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
|
|
4070
4068
|
|
|
4071
4069
|
|
|
4072
4070
|
let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
|
|
4073
4071
|
|
|
4074
|
-
if (!satForAxes(axes, _v0$2, _v1$7, _v2$
|
|
4072
|
+
if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
|
|
4075
4073
|
return false;
|
|
4076
4074
|
} // test 3 face normals from the aabb
|
|
4077
4075
|
|
|
4078
4076
|
|
|
4079
4077
|
axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4080
4078
|
|
|
4081
|
-
if (!satForAxes(axes, _v0$2, _v1$7, _v2$
|
|
4079
|
+
if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
|
|
4082
4080
|
return false;
|
|
4083
4081
|
} // finally testing the face normal of the triangle
|
|
4084
4082
|
// use already existing triangle edge vectors here
|
|
@@ -4087,7 +4085,7 @@
|
|
|
4087
4085
|
_triangleNormal.crossVectors(_f0, _f1);
|
|
4088
4086
|
|
|
4089
4087
|
axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
|
|
4090
|
-
return satForAxes(axes, _v0$2, _v1$7, _v2$
|
|
4088
|
+
return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents);
|
|
4091
4089
|
}
|
|
4092
4090
|
|
|
4093
4091
|
clampPoint(point, target) {
|
|
@@ -4175,7 +4173,7 @@
|
|
|
4175
4173
|
|
|
4176
4174
|
const _v1$7 = /*@__PURE__*/new Vector3();
|
|
4177
4175
|
|
|
4178
|
-
const _v2$
|
|
4176
|
+
const _v2$4 = /*@__PURE__*/new Vector3(); // triangle edge vectors
|
|
4179
4177
|
|
|
4180
4178
|
|
|
4181
4179
|
const _f0 = /*@__PURE__*/new Vector3();
|
|
@@ -4217,9 +4215,7 @@
|
|
|
4217
4215
|
|
|
4218
4216
|
const _v1$6 = /*@__PURE__*/new Vector3();
|
|
4219
4217
|
|
|
4220
|
-
const
|
|
4221
|
-
|
|
4222
|
-
const _toPoint = /*@__PURE__*/new Vector3();
|
|
4218
|
+
const _v2$3 = /*@__PURE__*/new Vector3();
|
|
4223
4219
|
|
|
4224
4220
|
class Sphere {
|
|
4225
4221
|
constructor(center = new Vector3(), radius = -1) {
|
|
@@ -4325,37 +4321,46 @@
|
|
|
4325
4321
|
}
|
|
4326
4322
|
|
|
4327
4323
|
expandByPoint(point) {
|
|
4328
|
-
|
|
4329
|
-
|
|
4324
|
+
if (this.isEmpty()) {
|
|
4325
|
+
this.center.copy(point);
|
|
4326
|
+
this.radius = 0;
|
|
4327
|
+
return this;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
_v1$6.subVectors(point, this.center);
|
|
4330
4331
|
|
|
4331
|
-
const lengthSq =
|
|
4332
|
+
const lengthSq = _v1$6.lengthSq();
|
|
4332
4333
|
|
|
4333
4334
|
if (lengthSq > this.radius * this.radius) {
|
|
4335
|
+
// calculate the minimal sphere
|
|
4334
4336
|
const length = Math.sqrt(lengthSq);
|
|
4335
|
-
const
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
|
|
4340
|
-
this.radius += missingRadiusHalf;
|
|
4337
|
+
const delta = (length - this.radius) * 0.5;
|
|
4338
|
+
this.center.addScaledVector(_v1$6, delta / length);
|
|
4339
|
+
this.radius += delta;
|
|
4341
4340
|
}
|
|
4342
4341
|
|
|
4343
4342
|
return this;
|
|
4344
4343
|
}
|
|
4345
4344
|
|
|
4346
4345
|
union(sphere) {
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4346
|
+
if (sphere.isEmpty()) {
|
|
4347
|
+
return this;
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
if (this.isEmpty()) {
|
|
4351
|
+
this.copy(sphere);
|
|
4352
|
+
return this;
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4351
4355
|
if (this.center.equals(sphere.center) === true) {
|
|
4352
|
-
|
|
4356
|
+
this.radius = Math.max(this.radius, sphere.radius);
|
|
4353
4357
|
} else {
|
|
4354
|
-
|
|
4358
|
+
_v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);
|
|
4359
|
+
|
|
4360
|
+
this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));
|
|
4361
|
+
this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));
|
|
4355
4362
|
}
|
|
4356
4363
|
|
|
4357
|
-
this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
|
|
4358
|
-
this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
|
|
4359
4364
|
return this;
|
|
4360
4365
|
}
|
|
4361
4366
|
|
|
@@ -4627,11 +4632,9 @@
|
|
|
4627
4632
|
tymax = (box.min.y - origin.y) * invdiry;
|
|
4628
4633
|
}
|
|
4629
4634
|
|
|
4630
|
-
if (tmin > tymax || tymin > tmax) return null;
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
if (tymin > tmin || tmin !== tmin) tmin = tymin;
|
|
4634
|
-
if (tymax < tmax || tmax !== tmax) tmax = tymax;
|
|
4635
|
+
if (tmin > tymax || tymin > tmax) return null;
|
|
4636
|
+
if (tymin > tmin || isNaN(tmin)) tmin = tymin;
|
|
4637
|
+
if (tymax < tmax || isNaN(tmax)) tmax = tymax;
|
|
4635
4638
|
|
|
4636
4639
|
if (invdirz >= 0) {
|
|
4637
4640
|
tzmin = (box.min.z - origin.z) * invdirz;
|
|
@@ -6876,7 +6879,7 @@
|
|
|
6876
6879
|
if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
|
|
6877
6880
|
if (this.thickness !== undefined) data.thickness = this.thickness;
|
|
6878
6881
|
if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
|
|
6879
|
-
if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
|
|
6882
|
+
if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
|
|
6880
6883
|
if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();
|
|
6881
6884
|
if (this.size !== undefined) data.size = this.size;
|
|
6882
6885
|
if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
|
|
@@ -8592,6 +8595,7 @@
|
|
|
8592
8595
|
/**
|
|
8593
8596
|
* Uniform Utilities
|
|
8594
8597
|
*/
|
|
8598
|
+
|
|
8595
8599
|
function cloneUniforms(src) {
|
|
8596
8600
|
const dst = {};
|
|
8597
8601
|
|
|
@@ -8634,6 +8638,14 @@
|
|
|
8634
8638
|
}
|
|
8635
8639
|
|
|
8636
8640
|
return dst;
|
|
8641
|
+
}
|
|
8642
|
+
function getUnlitUniformColorSpace(renderer) {
|
|
8643
|
+
if (renderer.getRenderTarget() === null) {
|
|
8644
|
+
// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
|
|
8645
|
+
return renderer.outputEncoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
8646
|
+
}
|
|
8647
|
+
|
|
8648
|
+
return LinearSRGBColorSpace;
|
|
8637
8649
|
} // Legacy
|
|
8638
8650
|
|
|
8639
8651
|
const UniformsUtils = {
|
|
@@ -8993,8 +9005,9 @@
|
|
|
8993
9005
|
|
|
8994
9006
|
}
|
|
8995
9007
|
|
|
8996
|
-
const fov = 90
|
|
8997
|
-
|
|
9008
|
+
const fov = -90; // negative fov is not an error
|
|
9009
|
+
|
|
9010
|
+
const aspect = 1;
|
|
8998
9011
|
|
|
8999
9012
|
class CubeCamera extends Object3D {
|
|
9000
9013
|
constructor(near, far, renderTarget) {
|
|
@@ -9003,33 +9016,33 @@
|
|
|
9003
9016
|
this.renderTarget = renderTarget;
|
|
9004
9017
|
const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
|
|
9005
9018
|
cameraPX.layers = this.layers;
|
|
9006
|
-
cameraPX.up.set(0,
|
|
9007
|
-
cameraPX.lookAt(
|
|
9019
|
+
cameraPX.up.set(0, 1, 0);
|
|
9020
|
+
cameraPX.lookAt(1, 0, 0);
|
|
9008
9021
|
this.add(cameraPX);
|
|
9009
9022
|
const cameraNX = new PerspectiveCamera(fov, aspect, near, far);
|
|
9010
9023
|
cameraNX.layers = this.layers;
|
|
9011
|
-
cameraNX.up.set(0,
|
|
9012
|
-
cameraNX.lookAt(
|
|
9024
|
+
cameraNX.up.set(0, 1, 0);
|
|
9025
|
+
cameraNX.lookAt(-1, 0, 0);
|
|
9013
9026
|
this.add(cameraNX);
|
|
9014
9027
|
const cameraPY = new PerspectiveCamera(fov, aspect, near, far);
|
|
9015
9028
|
cameraPY.layers = this.layers;
|
|
9016
|
-
cameraPY.up.set(0, 0, 1);
|
|
9017
|
-
cameraPY.lookAt(
|
|
9029
|
+
cameraPY.up.set(0, 0, -1);
|
|
9030
|
+
cameraPY.lookAt(0, 1, 0);
|
|
9018
9031
|
this.add(cameraPY);
|
|
9019
9032
|
const cameraNY = new PerspectiveCamera(fov, aspect, near, far);
|
|
9020
9033
|
cameraNY.layers = this.layers;
|
|
9021
|
-
cameraNY.up.set(0, 0,
|
|
9022
|
-
cameraNY.lookAt(
|
|
9034
|
+
cameraNY.up.set(0, 0, 1);
|
|
9035
|
+
cameraNY.lookAt(0, -1, 0);
|
|
9023
9036
|
this.add(cameraNY);
|
|
9024
9037
|
const cameraPZ = new PerspectiveCamera(fov, aspect, near, far);
|
|
9025
9038
|
cameraPZ.layers = this.layers;
|
|
9026
|
-
cameraPZ.up.set(0,
|
|
9027
|
-
cameraPZ.lookAt(
|
|
9039
|
+
cameraPZ.up.set(0, 1, 0);
|
|
9040
|
+
cameraPZ.lookAt(0, 0, 1);
|
|
9028
9041
|
this.add(cameraPZ);
|
|
9029
9042
|
const cameraNZ = new PerspectiveCamera(fov, aspect, near, far);
|
|
9030
9043
|
cameraNZ.layers = this.layers;
|
|
9031
|
-
cameraNZ.up.set(0,
|
|
9032
|
-
cameraNZ.lookAt(
|
|
9044
|
+
cameraNZ.up.set(0, 1, 0);
|
|
9045
|
+
cameraNZ.lookAt(0, 0, -1);
|
|
9033
9046
|
this.add(cameraNZ);
|
|
9034
9047
|
}
|
|
9035
9048
|
|
|
@@ -9085,7 +9098,7 @@
|
|
|
9085
9098
|
}
|
|
9086
9099
|
|
|
9087
9100
|
class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
9088
|
-
constructor(size, options = {}) {
|
|
9101
|
+
constructor(size = 1, options = {}) {
|
|
9089
9102
|
super(size, size, options);
|
|
9090
9103
|
this.isWebGLCubeRenderTarget = true;
|
|
9091
9104
|
const image = {
|
|
@@ -9559,6 +9572,8 @@
|
|
|
9559
9572
|
|
|
9560
9573
|
updateRange.count = -1; // reset range
|
|
9561
9574
|
}
|
|
9575
|
+
|
|
9576
|
+
attribute.onUploadCallback();
|
|
9562
9577
|
} //
|
|
9563
9578
|
|
|
9564
9579
|
|
|
@@ -9726,7 +9741,7 @@
|
|
|
9726
9741
|
|
|
9727
9742
|
var encodings_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
9728
9743
|
|
|
9729
|
-
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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#
|
|
9744
|
+
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, 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";
|
|
9730
9745
|
|
|
9731
9746
|
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
|
|
9732
9747
|
|
|
@@ -9752,7 +9767,7 @@
|
|
|
9752
9767
|
|
|
9753
9768
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
9754
9769
|
|
|
9755
|
-
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert
|
|
9770
|
+
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
|
|
9756
9771
|
|
|
9757
9772
|
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\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\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\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";
|
|
9758
9773
|
|
|
@@ -9760,11 +9775,11 @@
|
|
|
9760
9775
|
|
|
9761
9776
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
9762
9777
|
|
|
9763
|
-
var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon
|
|
9778
|
+
var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
|
|
9764
9779
|
|
|
9765
9780
|
var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
9766
9781
|
|
|
9767
|
-
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong
|
|
9782
|
+
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
|
|
9768
9783
|
|
|
9769
9784
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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 SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).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_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
|
|
9770
9785
|
|
|
@@ -9804,7 +9819,7 @@
|
|
|
9804
9819
|
|
|
9805
9820
|
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
|
|
9806
9821
|
|
|
9807
|
-
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx =
|
|
9822
|
+
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
|
|
9808
9823
|
|
|
9809
9824
|
var normal_fragment_maps = "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
9810
9825
|
|
|
@@ -9826,7 +9841,7 @@
|
|
|
9826
9841
|
|
|
9827
9842
|
var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
|
|
9828
9843
|
|
|
9829
|
-
var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
|
|
9844
|
+
var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
|
|
9830
9845
|
|
|
9831
9846
|
var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
|
|
9832
9847
|
|
|
@@ -9866,7 +9881,7 @@
|
|
|
9866
9881
|
|
|
9867
9882
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
|
|
9868
9883
|
|
|
9869
|
-
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance
|
|
9884
|
+
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
|
|
9870
9885
|
|
|
9871
9886
|
var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
|
|
9872
9887
|
|
|
@@ -9882,11 +9897,14 @@
|
|
|
9882
9897
|
|
|
9883
9898
|
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
|
|
9884
9899
|
|
|
9885
|
-
const vertex$
|
|
9886
|
-
const fragment$
|
|
9900
|
+
const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
9901
|
+
const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
9902
|
+
|
|
9903
|
+
const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
|
|
9904
|
+
const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
9887
9905
|
|
|
9888
9906
|
const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
|
|
9889
|
-
const fragment$f = "
|
|
9907
|
+
const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
9890
9908
|
|
|
9891
9909
|
const vertex$e = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_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}";
|
|
9892
9910
|
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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\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#endif\n}";
|
|
@@ -10037,8 +10055,10 @@
|
|
|
10037
10055
|
uv2_pars_vertex: uv2_pars_vertex,
|
|
10038
10056
|
uv2_vertex: uv2_vertex,
|
|
10039
10057
|
worldpos_vertex: worldpos_vertex,
|
|
10040
|
-
background_vert: vertex$
|
|
10041
|
-
background_frag: fragment$
|
|
10058
|
+
background_vert: vertex$h,
|
|
10059
|
+
background_frag: fragment$h,
|
|
10060
|
+
backgroundCube_vert: vertex$g,
|
|
10061
|
+
backgroundCube_frag: fragment$g,
|
|
10042
10062
|
cube_vert: vertex$f,
|
|
10043
10063
|
cube_frag: fragment$f,
|
|
10044
10064
|
depth_vert: vertex$e,
|
|
@@ -10478,17 +10498,44 @@
|
|
|
10478
10498
|
},
|
|
10479
10499
|
t2D: {
|
|
10480
10500
|
value: null
|
|
10501
|
+
},
|
|
10502
|
+
backgroundIntensity: {
|
|
10503
|
+
value: 1
|
|
10481
10504
|
}
|
|
10482
10505
|
},
|
|
10483
10506
|
vertexShader: ShaderChunk.background_vert,
|
|
10484
10507
|
fragmentShader: ShaderChunk.background_frag
|
|
10485
10508
|
},
|
|
10509
|
+
backgroundCube: {
|
|
10510
|
+
uniforms: {
|
|
10511
|
+
envMap: {
|
|
10512
|
+
value: null
|
|
10513
|
+
},
|
|
10514
|
+
flipEnvMap: {
|
|
10515
|
+
value: -1
|
|
10516
|
+
},
|
|
10517
|
+
backgroundBlurriness: {
|
|
10518
|
+
value: 0
|
|
10519
|
+
},
|
|
10520
|
+
backgroundIntensity: {
|
|
10521
|
+
value: 1
|
|
10522
|
+
}
|
|
10523
|
+
},
|
|
10524
|
+
vertexShader: ShaderChunk.backgroundCube_vert,
|
|
10525
|
+
fragmentShader: ShaderChunk.backgroundCube_frag
|
|
10526
|
+
},
|
|
10486
10527
|
cube: {
|
|
10487
|
-
uniforms:
|
|
10528
|
+
uniforms: {
|
|
10529
|
+
tCube: {
|
|
10530
|
+
value: null
|
|
10531
|
+
},
|
|
10532
|
+
tFlip: {
|
|
10533
|
+
value: -1
|
|
10534
|
+
},
|
|
10488
10535
|
opacity: {
|
|
10489
10536
|
value: 1.0
|
|
10490
10537
|
}
|
|
10491
|
-
}
|
|
10538
|
+
},
|
|
10492
10539
|
vertexShader: ShaderChunk.cube_vert,
|
|
10493
10540
|
fragmentShader: ShaderChunk.cube_frag
|
|
10494
10541
|
},
|
|
@@ -10623,7 +10670,13 @@
|
|
|
10623
10670
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
10624
10671
|
};
|
|
10625
10672
|
|
|
10626
|
-
|
|
10673
|
+
const _rgb = {
|
|
10674
|
+
r: 0,
|
|
10675
|
+
b: 0,
|
|
10676
|
+
g: 0
|
|
10677
|
+
};
|
|
10678
|
+
|
|
10679
|
+
function WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) {
|
|
10627
10680
|
const clearColor = new Color(0x000000);
|
|
10628
10681
|
let clearAlpha = alpha === true ? 0 : 1;
|
|
10629
10682
|
let planeMesh;
|
|
@@ -10637,7 +10690,9 @@
|
|
|
10637
10690
|
let background = scene.isScene === true ? scene.background : null;
|
|
10638
10691
|
|
|
10639
10692
|
if (background && background.isTexture) {
|
|
10640
|
-
|
|
10693
|
+
const usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background
|
|
10694
|
+
|
|
10695
|
+
background = (usePMREM ? cubeuvmaps : cubemaps).get(background);
|
|
10641
10696
|
} // Ignore background in AR
|
|
10642
10697
|
// TODO: Reconsider this.
|
|
10643
10698
|
|
|
@@ -10664,9 +10719,9 @@
|
|
|
10664
10719
|
if (boxMesh === undefined) {
|
|
10665
10720
|
boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({
|
|
10666
10721
|
name: 'BackgroundCubeMaterial',
|
|
10667
|
-
uniforms: cloneUniforms(ShaderLib.
|
|
10668
|
-
vertexShader: ShaderLib.
|
|
10669
|
-
fragmentShader: ShaderLib.
|
|
10722
|
+
uniforms: cloneUniforms(ShaderLib.backgroundCube.uniforms),
|
|
10723
|
+
vertexShader: ShaderLib.backgroundCube.vertexShader,
|
|
10724
|
+
fragmentShader: ShaderLib.backgroundCube.fragmentShader,
|
|
10670
10725
|
side: BackSide,
|
|
10671
10726
|
depthTest: false,
|
|
10672
10727
|
depthWrite: false,
|
|
@@ -10690,6 +10745,8 @@
|
|
|
10690
10745
|
|
|
10691
10746
|
boxMesh.material.uniforms.envMap.value = background;
|
|
10692
10747
|
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
|
|
10748
|
+
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
10749
|
+
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
10693
10750
|
|
|
10694
10751
|
if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
|
|
10695
10752
|
boxMesh.material.needsUpdate = true;
|
|
@@ -10724,6 +10781,7 @@
|
|
|
10724
10781
|
}
|
|
10725
10782
|
|
|
10726
10783
|
planeMesh.material.uniforms.t2D.value = background;
|
|
10784
|
+
planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
10727
10785
|
|
|
10728
10786
|
if (background.matrixAutoUpdate === true) {
|
|
10729
10787
|
background.updateMatrix();
|
|
@@ -10745,7 +10803,8 @@
|
|
|
10745
10803
|
}
|
|
10746
10804
|
|
|
10747
10805
|
function setClear(color, alpha) {
|
|
10748
|
-
|
|
10806
|
+
color.getRGB(_rgb, getUnlitUniformColorSpace(renderer));
|
|
10807
|
+
state.buffers.color.setClear(_rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha);
|
|
10749
10808
|
}
|
|
10750
10809
|
|
|
10751
10810
|
return {
|
|
@@ -13170,28 +13229,58 @@
|
|
|
13170
13229
|
if (cache[0] === v) return;
|
|
13171
13230
|
gl.uniform1i(this.addr, v);
|
|
13172
13231
|
cache[0] = v;
|
|
13173
|
-
} // Single integer / boolean vector (from flat array)
|
|
13232
|
+
} // Single integer / boolean vector (from flat array or THREE.VectorN)
|
|
13174
13233
|
|
|
13175
13234
|
|
|
13176
13235
|
function setValueV2i(gl, v) {
|
|
13177
13236
|
const cache = this.cache;
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13237
|
+
|
|
13238
|
+
if (v.x !== undefined) {
|
|
13239
|
+
if (cache[0] !== v.x || cache[1] !== v.y) {
|
|
13240
|
+
gl.uniform2i(this.addr, v.x, v.y);
|
|
13241
|
+
cache[0] = v.x;
|
|
13242
|
+
cache[1] = v.y;
|
|
13243
|
+
}
|
|
13244
|
+
} else {
|
|
13245
|
+
if (arraysEqual(cache, v)) return;
|
|
13246
|
+
gl.uniform2iv(this.addr, v);
|
|
13247
|
+
copyArray(cache, v);
|
|
13248
|
+
}
|
|
13181
13249
|
}
|
|
13182
13250
|
|
|
13183
13251
|
function setValueV3i(gl, v) {
|
|
13184
13252
|
const cache = this.cache;
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13253
|
+
|
|
13254
|
+
if (v.x !== undefined) {
|
|
13255
|
+
if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
|
|
13256
|
+
gl.uniform3i(this.addr, v.x, v.y, v.z);
|
|
13257
|
+
cache[0] = v.x;
|
|
13258
|
+
cache[1] = v.y;
|
|
13259
|
+
cache[2] = v.z;
|
|
13260
|
+
}
|
|
13261
|
+
} else {
|
|
13262
|
+
if (arraysEqual(cache, v)) return;
|
|
13263
|
+
gl.uniform3iv(this.addr, v);
|
|
13264
|
+
copyArray(cache, v);
|
|
13265
|
+
}
|
|
13188
13266
|
}
|
|
13189
13267
|
|
|
13190
13268
|
function setValueV4i(gl, v) {
|
|
13191
13269
|
const cache = this.cache;
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13270
|
+
|
|
13271
|
+
if (v.x !== undefined) {
|
|
13272
|
+
if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
|
|
13273
|
+
gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);
|
|
13274
|
+
cache[0] = v.x;
|
|
13275
|
+
cache[1] = v.y;
|
|
13276
|
+
cache[2] = v.z;
|
|
13277
|
+
cache[3] = v.w;
|
|
13278
|
+
}
|
|
13279
|
+
} else {
|
|
13280
|
+
if (arraysEqual(cache, v)) return;
|
|
13281
|
+
gl.uniform4iv(this.addr, v);
|
|
13282
|
+
copyArray(cache, v);
|
|
13283
|
+
}
|
|
13195
13284
|
} // Single unsigned integer
|
|
13196
13285
|
|
|
13197
13286
|
|
|
@@ -13200,28 +13289,58 @@
|
|
|
13200
13289
|
if (cache[0] === v) return;
|
|
13201
13290
|
gl.uniform1ui(this.addr, v);
|
|
13202
13291
|
cache[0] = v;
|
|
13203
|
-
} // Single unsigned integer vector (from flat array)
|
|
13292
|
+
} // Single unsigned integer vector (from flat array or THREE.VectorN)
|
|
13204
13293
|
|
|
13205
13294
|
|
|
13206
13295
|
function setValueV2ui(gl, v) {
|
|
13207
13296
|
const cache = this.cache;
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13297
|
+
|
|
13298
|
+
if (v.x !== undefined) {
|
|
13299
|
+
if (cache[0] !== v.x || cache[1] !== v.y) {
|
|
13300
|
+
gl.uniform2ui(this.addr, v.x, v.y);
|
|
13301
|
+
cache[0] = v.x;
|
|
13302
|
+
cache[1] = v.y;
|
|
13303
|
+
}
|
|
13304
|
+
} else {
|
|
13305
|
+
if (arraysEqual(cache, v)) return;
|
|
13306
|
+
gl.uniform2uiv(this.addr, v);
|
|
13307
|
+
copyArray(cache, v);
|
|
13308
|
+
}
|
|
13211
13309
|
}
|
|
13212
13310
|
|
|
13213
13311
|
function setValueV3ui(gl, v) {
|
|
13214
13312
|
const cache = this.cache;
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13313
|
+
|
|
13314
|
+
if (v.x !== undefined) {
|
|
13315
|
+
if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
|
|
13316
|
+
gl.uniform3ui(this.addr, v.x, v.y, v.z);
|
|
13317
|
+
cache[0] = v.x;
|
|
13318
|
+
cache[1] = v.y;
|
|
13319
|
+
cache[2] = v.z;
|
|
13320
|
+
}
|
|
13321
|
+
} else {
|
|
13322
|
+
if (arraysEqual(cache, v)) return;
|
|
13323
|
+
gl.uniform3uiv(this.addr, v);
|
|
13324
|
+
copyArray(cache, v);
|
|
13325
|
+
}
|
|
13218
13326
|
}
|
|
13219
13327
|
|
|
13220
13328
|
function setValueV4ui(gl, v) {
|
|
13221
13329
|
const cache = this.cache;
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13330
|
+
|
|
13331
|
+
if (v.x !== undefined) {
|
|
13332
|
+
if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
|
|
13333
|
+
gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);
|
|
13334
|
+
cache[0] = v.x;
|
|
13335
|
+
cache[1] = v.y;
|
|
13336
|
+
cache[2] = v.z;
|
|
13337
|
+
cache[3] = v.w;
|
|
13338
|
+
}
|
|
13339
|
+
} else {
|
|
13340
|
+
if (arraysEqual(cache, v)) return;
|
|
13341
|
+
gl.uniform4uiv(this.addr, v);
|
|
13342
|
+
copyArray(cache, v);
|
|
13343
|
+
}
|
|
13225
13344
|
} // Single texture (2D / Cube)
|
|
13226
13345
|
|
|
13227
13346
|
|
|
@@ -13457,9 +13576,14 @@
|
|
|
13457
13576
|
|
|
13458
13577
|
|
|
13459
13578
|
function setValueT1Array(gl, v, textures) {
|
|
13579
|
+
const cache = this.cache;
|
|
13460
13580
|
const n = v.length;
|
|
13461
13581
|
const units = allocTexUnits(textures, n);
|
|
13462
|
-
|
|
13582
|
+
|
|
13583
|
+
if (!arraysEqual(cache, units)) {
|
|
13584
|
+
gl.uniform1iv(this.addr, units);
|
|
13585
|
+
copyArray(cache, units);
|
|
13586
|
+
}
|
|
13463
13587
|
|
|
13464
13588
|
for (let i = 0; i !== n; ++i) {
|
|
13465
13589
|
textures.setTexture2D(v[i] || emptyTexture, units[i]);
|
|
@@ -13467,9 +13591,14 @@
|
|
|
13467
13591
|
}
|
|
13468
13592
|
|
|
13469
13593
|
function setValueT3DArray(gl, v, textures) {
|
|
13594
|
+
const cache = this.cache;
|
|
13470
13595
|
const n = v.length;
|
|
13471
13596
|
const units = allocTexUnits(textures, n);
|
|
13472
|
-
|
|
13597
|
+
|
|
13598
|
+
if (!arraysEqual(cache, units)) {
|
|
13599
|
+
gl.uniform1iv(this.addr, units);
|
|
13600
|
+
copyArray(cache, units);
|
|
13601
|
+
}
|
|
13473
13602
|
|
|
13474
13603
|
for (let i = 0; i !== n; ++i) {
|
|
13475
13604
|
textures.setTexture3D(v[i] || empty3dTexture, units[i]);
|
|
@@ -13477,9 +13606,14 @@
|
|
|
13477
13606
|
}
|
|
13478
13607
|
|
|
13479
13608
|
function setValueT6Array(gl, v, textures) {
|
|
13609
|
+
const cache = this.cache;
|
|
13480
13610
|
const n = v.length;
|
|
13481
13611
|
const units = allocTexUnits(textures, n);
|
|
13482
|
-
|
|
13612
|
+
|
|
13613
|
+
if (!arraysEqual(cache, units)) {
|
|
13614
|
+
gl.uniform1iv(this.addr, units);
|
|
13615
|
+
copyArray(cache, units);
|
|
13616
|
+
}
|
|
13483
13617
|
|
|
13484
13618
|
for (let i = 0; i !== n; ++i) {
|
|
13485
13619
|
textures.setTextureCube(v[i] || emptyCubeTexture, units[i]);
|
|
@@ -13487,9 +13621,14 @@
|
|
|
13487
13621
|
}
|
|
13488
13622
|
|
|
13489
13623
|
function setValueT2DArrayArray(gl, v, textures) {
|
|
13624
|
+
const cache = this.cache;
|
|
13490
13625
|
const n = v.length;
|
|
13491
13626
|
const units = allocTexUnits(textures, n);
|
|
13492
|
-
|
|
13627
|
+
|
|
13628
|
+
if (!arraysEqual(cache, units)) {
|
|
13629
|
+
gl.uniform1iv(this.addr, units);
|
|
13630
|
+
copyArray(cache, units);
|
|
13631
|
+
}
|
|
13493
13632
|
|
|
13494
13633
|
for (let i = 0; i !== n; ++i) {
|
|
13495
13634
|
textures.setTexture2DArray(v[i] || emptyArrayTexture, units[i]);
|
|
@@ -15070,10 +15209,7 @@
|
|
|
15070
15209
|
|
|
15071
15210
|
spotLength++;
|
|
15072
15211
|
} else if (light.isRectAreaLight) {
|
|
15073
|
-
const uniforms = cache.get(light);
|
|
15074
|
-
//uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
|
|
15075
|
-
// (b) intensity is the brightness of the light
|
|
15076
|
-
|
|
15212
|
+
const uniforms = cache.get(light);
|
|
15077
15213
|
uniforms.color.copy(color).multiplyScalar(intensity);
|
|
15078
15214
|
uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
|
|
15079
15215
|
uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
|
|
@@ -15555,7 +15691,7 @@
|
|
|
15555
15691
|
result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
|
|
15556
15692
|
}
|
|
15557
15693
|
|
|
15558
|
-
if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
|
|
15694
|
+
if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {
|
|
15559
15695
|
// in this case we need a unique material instance reflecting the
|
|
15560
15696
|
// appropriate state
|
|
15561
15697
|
const keyA = result.uuid,
|
|
@@ -15588,6 +15724,7 @@
|
|
|
15588
15724
|
|
|
15589
15725
|
result.alphaMap = material.alphaMap;
|
|
15590
15726
|
result.alphaTest = material.alphaTest;
|
|
15727
|
+
result.map = material.map;
|
|
15591
15728
|
result.clipShadows = material.clipShadows;
|
|
15592
15729
|
result.clippingPlanes = material.clippingPlanes;
|
|
15593
15730
|
result.clipIntersection = material.clipIntersection;
|
|
@@ -15708,45 +15845,41 @@
|
|
|
15708
15845
|
},
|
|
15709
15846
|
setFunc: function (depthFunc) {
|
|
15710
15847
|
if (currentDepthFunc !== depthFunc) {
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
break;
|
|
15848
|
+
switch (depthFunc) {
|
|
15849
|
+
case NeverDepth:
|
|
15850
|
+
gl.depthFunc(gl.NEVER);
|
|
15851
|
+
break;
|
|
15716
15852
|
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15853
|
+
case AlwaysDepth:
|
|
15854
|
+
gl.depthFunc(gl.ALWAYS);
|
|
15855
|
+
break;
|
|
15720
15856
|
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15857
|
+
case LessDepth:
|
|
15858
|
+
gl.depthFunc(gl.LESS);
|
|
15859
|
+
break;
|
|
15724
15860
|
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15861
|
+
case LessEqualDepth:
|
|
15862
|
+
gl.depthFunc(gl.LEQUAL);
|
|
15863
|
+
break;
|
|
15728
15864
|
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15865
|
+
case EqualDepth:
|
|
15866
|
+
gl.depthFunc(gl.EQUAL);
|
|
15867
|
+
break;
|
|
15732
15868
|
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15869
|
+
case GreaterEqualDepth:
|
|
15870
|
+
gl.depthFunc(gl.GEQUAL);
|
|
15871
|
+
break;
|
|
15736
15872
|
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15873
|
+
case GreaterDepth:
|
|
15874
|
+
gl.depthFunc(gl.GREATER);
|
|
15875
|
+
break;
|
|
15740
15876
|
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15877
|
+
case NotEqualDepth:
|
|
15878
|
+
gl.depthFunc(gl.NOTEQUAL);
|
|
15879
|
+
break;
|
|
15744
15880
|
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
}
|
|
15748
|
-
} else {
|
|
15749
|
-
gl.depthFunc(gl.LEQUAL);
|
|
15881
|
+
default:
|
|
15882
|
+
gl.depthFunc(gl.LEQUAL);
|
|
15750
15883
|
}
|
|
15751
15884
|
|
|
15752
15885
|
currentDepthFunc = depthFunc;
|
|
@@ -16132,7 +16265,7 @@
|
|
|
16132
16265
|
}
|
|
16133
16266
|
|
|
16134
16267
|
currentBlending = blending;
|
|
16135
|
-
currentPremultipledAlpha =
|
|
16268
|
+
currentPremultipledAlpha = false;
|
|
16136
16269
|
}
|
|
16137
16270
|
|
|
16138
16271
|
function setMaterial(material, frontFaceCW) {
|
|
@@ -16230,22 +16363,31 @@
|
|
|
16230
16363
|
}
|
|
16231
16364
|
}
|
|
16232
16365
|
|
|
16233
|
-
function bindTexture(webglType, webglTexture) {
|
|
16234
|
-
if (
|
|
16235
|
-
|
|
16366
|
+
function bindTexture(webglType, webglTexture, webglSlot) {
|
|
16367
|
+
if (webglSlot === undefined) {
|
|
16368
|
+
if (currentTextureSlot === null) {
|
|
16369
|
+
webglSlot = gl.TEXTURE0 + maxTextures - 1;
|
|
16370
|
+
} else {
|
|
16371
|
+
webglSlot = currentTextureSlot;
|
|
16372
|
+
}
|
|
16236
16373
|
}
|
|
16237
16374
|
|
|
16238
|
-
let boundTexture = currentBoundTextures[
|
|
16375
|
+
let boundTexture = currentBoundTextures[webglSlot];
|
|
16239
16376
|
|
|
16240
16377
|
if (boundTexture === undefined) {
|
|
16241
16378
|
boundTexture = {
|
|
16242
16379
|
type: undefined,
|
|
16243
16380
|
texture: undefined
|
|
16244
16381
|
};
|
|
16245
|
-
currentBoundTextures[
|
|
16382
|
+
currentBoundTextures[webglSlot] = boundTexture;
|
|
16246
16383
|
}
|
|
16247
16384
|
|
|
16248
16385
|
if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
|
|
16386
|
+
if (currentTextureSlot !== webglSlot) {
|
|
16387
|
+
gl.activeTexture(webglSlot);
|
|
16388
|
+
currentTextureSlot = webglSlot;
|
|
16389
|
+
}
|
|
16390
|
+
|
|
16249
16391
|
gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
|
|
16250
16392
|
boundTexture.type = webglType;
|
|
16251
16393
|
boundTexture.texture = webglTexture;
|
|
@@ -16270,6 +16412,14 @@
|
|
|
16270
16412
|
}
|
|
16271
16413
|
}
|
|
16272
16414
|
|
|
16415
|
+
function compressedTexImage3D() {
|
|
16416
|
+
try {
|
|
16417
|
+
gl.compressedTexImage3D.apply(gl, arguments);
|
|
16418
|
+
} catch (error) {
|
|
16419
|
+
console.error('THREE.WebGLState:', error);
|
|
16420
|
+
}
|
|
16421
|
+
}
|
|
16422
|
+
|
|
16273
16423
|
function texSubImage2D() {
|
|
16274
16424
|
try {
|
|
16275
16425
|
gl.texSubImage2D.apply(gl, arguments);
|
|
@@ -16294,6 +16444,14 @@
|
|
|
16294
16444
|
}
|
|
16295
16445
|
}
|
|
16296
16446
|
|
|
16447
|
+
function compressedTexSubImage3D() {
|
|
16448
|
+
try {
|
|
16449
|
+
gl.compressedTexSubImage3D.apply(gl, arguments);
|
|
16450
|
+
} catch (error) {
|
|
16451
|
+
console.error('THREE.WebGLState:', error);
|
|
16452
|
+
}
|
|
16453
|
+
}
|
|
16454
|
+
|
|
16297
16455
|
function texStorage2D() {
|
|
16298
16456
|
try {
|
|
16299
16457
|
gl.texStorage2D.apply(gl, arguments);
|
|
@@ -16456,6 +16614,7 @@
|
|
|
16456
16614
|
bindTexture: bindTexture,
|
|
16457
16615
|
unbindTexture: unbindTexture,
|
|
16458
16616
|
compressedTexImage2D: compressedTexImage2D,
|
|
16617
|
+
compressedTexImage3D: compressedTexImage3D,
|
|
16459
16618
|
texImage2D: texImage2D,
|
|
16460
16619
|
texImage3D: texImage3D,
|
|
16461
16620
|
updateUBOMapping: updateUBOMapping,
|
|
@@ -16465,6 +16624,7 @@
|
|
|
16465
16624
|
texSubImage2D: texSubImage2D,
|
|
16466
16625
|
texSubImage3D: texSubImage3D,
|
|
16467
16626
|
compressedTexSubImage2D: compressedTexSubImage2D,
|
|
16627
|
+
compressedTexSubImage3D: compressedTexSubImage3D,
|
|
16468
16628
|
scissor: scissor,
|
|
16469
16629
|
viewport: viewport,
|
|
16470
16630
|
reset: reset
|
|
@@ -16478,7 +16638,7 @@
|
|
|
16478
16638
|
const maxTextureSize = capabilities.maxTextureSize;
|
|
16479
16639
|
const maxSamples = capabilities.maxSamples;
|
|
16480
16640
|
const multisampledRTTExt = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null;
|
|
16481
|
-
const supportsInvalidateFramebuffer = /OculusBrowser/g.test(navigator.userAgent);
|
|
16641
|
+
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test(navigator.userAgent);
|
|
16482
16642
|
|
|
16483
16643
|
const _videoTextures = new WeakMap();
|
|
16484
16644
|
|
|
@@ -16556,7 +16716,7 @@
|
|
|
16556
16716
|
_gl.generateMipmap(target);
|
|
16557
16717
|
}
|
|
16558
16718
|
|
|
16559
|
-
function getInternalFormat(internalFormatName, glFormat, glType, encoding,
|
|
16719
|
+
function getInternalFormat(internalFormatName, glFormat, glType, encoding, forceLinearEncoding = false) {
|
|
16560
16720
|
if (isWebGL2 === false) return glFormat;
|
|
16561
16721
|
|
|
16562
16722
|
if (internalFormatName !== null) {
|
|
@@ -16581,7 +16741,7 @@
|
|
|
16581
16741
|
if (glFormat === _gl.RGBA) {
|
|
16582
16742
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
16583
16743
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
16584
|
-
if (glType === _gl.UNSIGNED_BYTE) internalFormat = encoding === sRGBEncoding &&
|
|
16744
|
+
if (glType === _gl.UNSIGNED_BYTE) internalFormat = encoding === sRGBEncoding && forceLinearEncoding === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
16585
16745
|
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
16586
16746
|
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
16587
16747
|
}
|
|
@@ -16748,6 +16908,7 @@
|
|
|
16748
16908
|
const array = [];
|
|
16749
16909
|
array.push(texture.wrapS);
|
|
16750
16910
|
array.push(texture.wrapT);
|
|
16911
|
+
array.push(texture.wrapR || 0);
|
|
16751
16912
|
array.push(texture.magFilter);
|
|
16752
16913
|
array.push(texture.minFilter);
|
|
16753
16914
|
array.push(texture.anisotropy);
|
|
@@ -16780,8 +16941,7 @@
|
|
|
16780
16941
|
}
|
|
16781
16942
|
}
|
|
16782
16943
|
|
|
16783
|
-
state.
|
|
16784
|
-
state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
|
|
16944
|
+
state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
16785
16945
|
}
|
|
16786
16946
|
|
|
16787
16947
|
function setTexture2DArray(texture, slot) {
|
|
@@ -16792,8 +16952,7 @@
|
|
|
16792
16952
|
return;
|
|
16793
16953
|
}
|
|
16794
16954
|
|
|
16795
|
-
state.
|
|
16796
|
-
state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
|
|
16955
|
+
state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
16797
16956
|
}
|
|
16798
16957
|
|
|
16799
16958
|
function setTexture3D(texture, slot) {
|
|
@@ -16804,8 +16963,7 @@
|
|
|
16804
16963
|
return;
|
|
16805
16964
|
}
|
|
16806
16965
|
|
|
16807
|
-
state.
|
|
16808
|
-
state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
|
|
16966
|
+
state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
16809
16967
|
}
|
|
16810
16968
|
|
|
16811
16969
|
function setTextureCube(texture, slot) {
|
|
@@ -16816,8 +16974,7 @@
|
|
|
16816
16974
|
return;
|
|
16817
16975
|
}
|
|
16818
16976
|
|
|
16819
|
-
state.
|
|
16820
|
-
state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
|
|
16977
|
+
state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
16821
16978
|
}
|
|
16822
16979
|
|
|
16823
16980
|
const wrappingToGL = {
|
|
@@ -16942,14 +17099,16 @@
|
|
|
16942
17099
|
|
|
16943
17100
|
function uploadTexture(textureProperties, texture, slot) {
|
|
16944
17101
|
let textureType = _gl.TEXTURE_2D;
|
|
16945
|
-
if (texture.isDataArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
17102
|
+
if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
16946
17103
|
if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
|
|
16947
17104
|
const forceUpload = initTexture(textureProperties, texture);
|
|
16948
17105
|
const source = texture.source;
|
|
16949
|
-
state.
|
|
16950
|
-
|
|
17106
|
+
state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
17107
|
+
const sourceProperties = properties.get(source);
|
|
17108
|
+
|
|
17109
|
+
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
17110
|
+
state.activeTexture(_gl.TEXTURE0 + slot);
|
|
16951
17111
|
|
|
16952
|
-
if (source.version !== source.__currentVersion || forceUpload === true) {
|
|
16953
17112
|
_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
16954
17113
|
|
|
16955
17114
|
_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
@@ -16969,7 +17128,7 @@
|
|
|
16969
17128
|
let mipmap;
|
|
16970
17129
|
const mipmaps = texture.mipmaps;
|
|
16971
17130
|
const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
|
|
16972
|
-
const allocateMemory =
|
|
17131
|
+
const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;
|
|
16973
17132
|
const levels = getMipLevels(texture, image, supportsMips);
|
|
16974
17133
|
|
|
16975
17134
|
if (texture.isDepthTexture) {
|
|
@@ -17058,28 +17217,56 @@
|
|
|
17058
17217
|
}
|
|
17059
17218
|
}
|
|
17060
17219
|
} else if (texture.isCompressedTexture) {
|
|
17061
|
-
if (
|
|
17062
|
-
|
|
17063
|
-
|
|
17220
|
+
if (texture.isCompressedArrayTexture) {
|
|
17221
|
+
if (useTexStorage && allocateMemory) {
|
|
17222
|
+
state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
|
|
17223
|
+
}
|
|
17064
17224
|
|
|
17065
|
-
|
|
17066
|
-
|
|
17225
|
+
for (let i = 0, il = mipmaps.length; i < il; i++) {
|
|
17226
|
+
mipmap = mipmaps[i];
|
|
17067
17227
|
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17228
|
+
if (texture.format !== RGBAFormat) {
|
|
17229
|
+
if (glFormat !== null) {
|
|
17230
|
+
if (useTexStorage) {
|
|
17231
|
+
state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);
|
|
17232
|
+
} else {
|
|
17233
|
+
state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);
|
|
17234
|
+
}
|
|
17072
17235
|
} else {
|
|
17073
|
-
|
|
17236
|
+
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
|
|
17074
17237
|
}
|
|
17075
17238
|
} else {
|
|
17076
|
-
|
|
17239
|
+
if (useTexStorage) {
|
|
17240
|
+
state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
|
|
17241
|
+
} else {
|
|
17242
|
+
state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
|
|
17243
|
+
}
|
|
17077
17244
|
}
|
|
17078
|
-
}
|
|
17079
|
-
|
|
17080
|
-
|
|
17245
|
+
}
|
|
17246
|
+
} else {
|
|
17247
|
+
if (useTexStorage && allocateMemory) {
|
|
17248
|
+
state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
|
|
17249
|
+
}
|
|
17250
|
+
|
|
17251
|
+
for (let i = 0, il = mipmaps.length; i < il; i++) {
|
|
17252
|
+
mipmap = mipmaps[i];
|
|
17253
|
+
|
|
17254
|
+
if (texture.format !== RGBAFormat) {
|
|
17255
|
+
if (glFormat !== null) {
|
|
17256
|
+
if (useTexStorage) {
|
|
17257
|
+
state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
|
|
17258
|
+
} else {
|
|
17259
|
+
state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
|
|
17260
|
+
}
|
|
17261
|
+
} else {
|
|
17262
|
+
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
|
|
17263
|
+
}
|
|
17081
17264
|
} else {
|
|
17082
|
-
|
|
17265
|
+
if (useTexStorage) {
|
|
17266
|
+
state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
|
|
17267
|
+
} else {
|
|
17268
|
+
state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
|
|
17269
|
+
}
|
|
17083
17270
|
}
|
|
17084
17271
|
}
|
|
17085
17272
|
}
|
|
@@ -17156,7 +17343,7 @@
|
|
|
17156
17343
|
generateMipmap(textureType);
|
|
17157
17344
|
}
|
|
17158
17345
|
|
|
17159
|
-
|
|
17346
|
+
sourceProperties.__version = source.version;
|
|
17160
17347
|
if (texture.onUpdate) texture.onUpdate(texture);
|
|
17161
17348
|
}
|
|
17162
17349
|
|
|
@@ -17167,10 +17354,12 @@
|
|
|
17167
17354
|
if (texture.image.length !== 6) return;
|
|
17168
17355
|
const forceUpload = initTexture(textureProperties, texture);
|
|
17169
17356
|
const source = texture.source;
|
|
17170
|
-
state.
|
|
17171
|
-
|
|
17357
|
+
state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
|
|
17358
|
+
const sourceProperties = properties.get(source);
|
|
17359
|
+
|
|
17360
|
+
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
17361
|
+
state.activeTexture(_gl.TEXTURE0 + slot);
|
|
17172
17362
|
|
|
17173
|
-
if (source.version !== source.__currentVersion || forceUpload === true) {
|
|
17174
17363
|
_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
17175
17364
|
|
|
17176
17365
|
_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
@@ -17199,7 +17388,7 @@
|
|
|
17199
17388
|
glType = utils.convert(texture.type),
|
|
17200
17389
|
glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
|
|
17201
17390
|
const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
|
|
17202
|
-
const allocateMemory =
|
|
17391
|
+
const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;
|
|
17203
17392
|
let levels = getMipLevels(texture, image, supportsMips);
|
|
17204
17393
|
setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
|
|
17205
17394
|
let mipmaps;
|
|
@@ -17288,7 +17477,7 @@
|
|
|
17288
17477
|
generateMipmap(_gl.TEXTURE_CUBE_MAP);
|
|
17289
17478
|
}
|
|
17290
17479
|
|
|
17291
|
-
|
|
17480
|
+
sourceProperties.__version = source.version;
|
|
17292
17481
|
if (texture.onUpdate) texture.onUpdate(texture);
|
|
17293
17482
|
}
|
|
17294
17483
|
|
|
@@ -17315,7 +17504,8 @@
|
|
|
17315
17504
|
|
|
17316
17505
|
if (useMultisampledRTT(renderTarget)) {
|
|
17317
17506
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget));
|
|
17318
|
-
} else {
|
|
17507
|
+
} else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) {
|
|
17508
|
+
// see #24753
|
|
17319
17509
|
_gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0);
|
|
17320
17510
|
}
|
|
17321
17511
|
|
|
@@ -17527,7 +17717,7 @@
|
|
|
17527
17717
|
|
|
17528
17718
|
const glFormat = utils.convert(texture.format, texture.encoding);
|
|
17529
17719
|
const glType = utils.convert(texture.type);
|
|
17530
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
|
|
17720
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, renderTarget.isXRRenderTarget === true);
|
|
17531
17721
|
const samples = getRenderTargetSamples(renderTarget);
|
|
17532
17722
|
|
|
17533
17723
|
_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
|
|
@@ -17807,8 +17997,7 @@
|
|
|
17807
17997
|
if (p === LuminanceFormat) return gl.LUMINANCE;
|
|
17808
17998
|
if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
|
|
17809
17999
|
if (p === DepthFormat) return gl.DEPTH_COMPONENT;
|
|
17810
|
-
if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
|
|
17811
|
-
if (p === RedFormat) return gl.RED; // @deprecated since r137
|
|
18000
|
+
if (p === DepthStencilFormat) return gl.DEPTH_STENCIL; // @deprecated since r137
|
|
17812
18001
|
|
|
17813
18002
|
if (p === RGBFormat) {
|
|
17814
18003
|
console.warn('THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228');
|
|
@@ -17827,6 +18016,7 @@
|
|
|
17827
18016
|
} // WebGL2 formats.
|
|
17828
18017
|
|
|
17829
18018
|
|
|
18019
|
+
if (p === RedFormat) return gl.RED;
|
|
17830
18020
|
if (p === RedIntegerFormat) return gl.RED_INTEGER;
|
|
17831
18021
|
if (p === RGFormat) return gl.RG;
|
|
17832
18022
|
if (p === RGIntegerFormat) return gl.RG_INTEGER;
|
|
@@ -18419,6 +18609,25 @@
|
|
|
18419
18609
|
return this;
|
|
18420
18610
|
}
|
|
18421
18611
|
|
|
18612
|
+
connect(inputSource) {
|
|
18613
|
+
if (inputSource && inputSource.hand) {
|
|
18614
|
+
const hand = this._hand;
|
|
18615
|
+
|
|
18616
|
+
if (hand) {
|
|
18617
|
+
for (const inputjoint of inputSource.hand.values()) {
|
|
18618
|
+
// Initialize hand with joints when connected
|
|
18619
|
+
this._getHandJoint(hand, inputjoint);
|
|
18620
|
+
}
|
|
18621
|
+
}
|
|
18622
|
+
}
|
|
18623
|
+
|
|
18624
|
+
this.dispatchEvent({
|
|
18625
|
+
type: 'connected',
|
|
18626
|
+
data: inputSource
|
|
18627
|
+
});
|
|
18628
|
+
return this;
|
|
18629
|
+
}
|
|
18630
|
+
|
|
18422
18631
|
disconnect(inputSource) {
|
|
18423
18632
|
this.dispatchEvent({
|
|
18424
18633
|
type: 'disconnected',
|
|
@@ -18454,19 +18663,9 @@
|
|
|
18454
18663
|
|
|
18455
18664
|
for (const inputjoint of inputSource.hand.values()) {
|
|
18456
18665
|
// Update the joints groups with the XRJoint poses
|
|
18457
|
-
const jointPose = frame.getJointPose(inputjoint, referenceSpace);
|
|
18666
|
+
const jointPose = frame.getJointPose(inputjoint, referenceSpace); // The transform of this joint will be updated with the joint pose on each frame
|
|
18458
18667
|
|
|
18459
|
-
|
|
18460
|
-
// The transform of this joint will be updated with the joint pose on each frame
|
|
18461
|
-
const joint = new Group();
|
|
18462
|
-
joint.matrixAutoUpdate = false;
|
|
18463
|
-
joint.visible = false;
|
|
18464
|
-
hand.joints[inputjoint.jointName] = joint; // ??
|
|
18465
|
-
|
|
18466
|
-
hand.add(joint);
|
|
18467
|
-
}
|
|
18468
|
-
|
|
18469
|
-
const joint = hand.joints[inputjoint.jointName];
|
|
18668
|
+
const joint = this._getHandJoint(hand, inputjoint);
|
|
18470
18669
|
|
|
18471
18670
|
if (jointPose !== null) {
|
|
18472
18671
|
joint.matrix.fromArray(jointPose.transform.matrix);
|
|
@@ -18568,6 +18767,19 @@
|
|
|
18568
18767
|
}
|
|
18569
18768
|
|
|
18570
18769
|
return this;
|
|
18770
|
+
} // private method
|
|
18771
|
+
|
|
18772
|
+
|
|
18773
|
+
_getHandJoint(hand, inputjoint) {
|
|
18774
|
+
if (hand.joints[inputjoint.jointName] === undefined) {
|
|
18775
|
+
const joint = new Group();
|
|
18776
|
+
joint.matrixAutoUpdate = false;
|
|
18777
|
+
joint.visible = false;
|
|
18778
|
+
hand.joints[inputjoint.jointName] = joint;
|
|
18779
|
+
hand.add(joint);
|
|
18780
|
+
}
|
|
18781
|
+
|
|
18782
|
+
return hand.joints[inputjoint.jointName];
|
|
18571
18783
|
}
|
|
18572
18784
|
|
|
18573
18785
|
}
|
|
@@ -18616,7 +18828,9 @@
|
|
|
18616
18828
|
let initialRenderTarget = null;
|
|
18617
18829
|
let newRenderTarget = null;
|
|
18618
18830
|
const controllers = [];
|
|
18619
|
-
const controllerInputSources = [];
|
|
18831
|
+
const controllerInputSources = [];
|
|
18832
|
+
const planes = new Set();
|
|
18833
|
+
const planesLastChangedTimes = new Map(); //
|
|
18620
18834
|
|
|
18621
18835
|
const cameraL = new PerspectiveCamera();
|
|
18622
18836
|
cameraL.layers.enable(1);
|
|
@@ -18859,11 +19073,12 @@
|
|
|
18859
19073
|
};
|
|
18860
19074
|
|
|
18861
19075
|
this.removeLayer = function (layer) {
|
|
19076
|
+
layers.splice(layers.indexOf(layer), 1);
|
|
19077
|
+
|
|
18862
19078
|
if (!window.XRWebGLBinding || !this.layersEnabled || !session) {
|
|
18863
19079
|
return;
|
|
18864
19080
|
}
|
|
18865
19081
|
|
|
18866
|
-
layers.splice(layers.indexOf(layer), 1);
|
|
18867
19082
|
this.updateLayers();
|
|
18868
19083
|
};
|
|
18869
19084
|
|
|
@@ -18885,10 +19100,7 @@
|
|
|
18885
19100
|
|
|
18886
19101
|
if (index >= 0) {
|
|
18887
19102
|
controllerInputSources[index] = null;
|
|
18888
|
-
controllers[index].
|
|
18889
|
-
type: 'disconnected',
|
|
18890
|
-
data: inputSource
|
|
18891
|
-
});
|
|
19103
|
+
controllers[index].disconnect(inputSource);
|
|
18892
19104
|
}
|
|
18893
19105
|
} // Notify connected
|
|
18894
19106
|
|
|
@@ -18918,10 +19130,7 @@
|
|
|
18918
19130
|
const controller = controllers[controllerIndex];
|
|
18919
19131
|
|
|
18920
19132
|
if (controller) {
|
|
18921
|
-
controller.
|
|
18922
|
-
type: 'connected',
|
|
18923
|
-
data: inputSource
|
|
18924
|
-
});
|
|
19133
|
+
controller.connect(inputSource);
|
|
18925
19134
|
}
|
|
18926
19135
|
}
|
|
18927
19136
|
} //
|
|
@@ -19059,6 +19268,10 @@
|
|
|
19059
19268
|
if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) {
|
|
19060
19269
|
glBaseLayer.fixedFoveation = foveation;
|
|
19061
19270
|
}
|
|
19271
|
+
};
|
|
19272
|
+
|
|
19273
|
+
this.getPlanes = function () {
|
|
19274
|
+
return planes;
|
|
19062
19275
|
}; // Animation Loop
|
|
19063
19276
|
|
|
19064
19277
|
|
|
@@ -19133,6 +19346,57 @@
|
|
|
19133
19346
|
}
|
|
19134
19347
|
|
|
19135
19348
|
if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);
|
|
19349
|
+
|
|
19350
|
+
if (frame.detectedPlanes) {
|
|
19351
|
+
scope.dispatchEvent({
|
|
19352
|
+
type: 'planesdetected',
|
|
19353
|
+
data: frame.detectedPlanes
|
|
19354
|
+
});
|
|
19355
|
+
let planesToRemove = null;
|
|
19356
|
+
|
|
19357
|
+
for (const plane of planes) {
|
|
19358
|
+
if (!frame.detectedPlanes.has(plane)) {
|
|
19359
|
+
if (planesToRemove === null) {
|
|
19360
|
+
planesToRemove = [];
|
|
19361
|
+
}
|
|
19362
|
+
|
|
19363
|
+
planesToRemove.push(plane);
|
|
19364
|
+
}
|
|
19365
|
+
}
|
|
19366
|
+
|
|
19367
|
+
if (planesToRemove !== null) {
|
|
19368
|
+
for (const plane of planesToRemove) {
|
|
19369
|
+
planes.delete(plane);
|
|
19370
|
+
planesLastChangedTimes.delete(plane);
|
|
19371
|
+
scope.dispatchEvent({
|
|
19372
|
+
type: 'planeremoved',
|
|
19373
|
+
data: plane
|
|
19374
|
+
});
|
|
19375
|
+
}
|
|
19376
|
+
}
|
|
19377
|
+
|
|
19378
|
+
for (const plane of frame.detectedPlanes) {
|
|
19379
|
+
if (!planes.has(plane)) {
|
|
19380
|
+
planes.add(plane);
|
|
19381
|
+
planesLastChangedTimes.set(plane, frame.lastChangedTime);
|
|
19382
|
+
scope.dispatchEvent({
|
|
19383
|
+
type: 'planeadded',
|
|
19384
|
+
data: plane
|
|
19385
|
+
});
|
|
19386
|
+
} else {
|
|
19387
|
+
const lastKnownTime = planesLastChangedTimes.get(plane);
|
|
19388
|
+
|
|
19389
|
+
if (plane.lastChangedTime > lastKnownTime) {
|
|
19390
|
+
planesLastChangedTimes.set(plane, plane.lastChangedTime);
|
|
19391
|
+
scope.dispatchEvent({
|
|
19392
|
+
type: 'planechanged',
|
|
19393
|
+
data: plane
|
|
19394
|
+
});
|
|
19395
|
+
}
|
|
19396
|
+
}
|
|
19397
|
+
}
|
|
19398
|
+
}
|
|
19399
|
+
|
|
19136
19400
|
xrFrame = null;
|
|
19137
19401
|
}
|
|
19138
19402
|
|
|
@@ -19150,7 +19414,7 @@
|
|
|
19150
19414
|
|
|
19151
19415
|
function WebGLMaterials(renderer, properties) {
|
|
19152
19416
|
function refreshFogUniforms(uniforms, fog) {
|
|
19153
|
-
uniforms.fogColor.value
|
|
19417
|
+
fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer));
|
|
19154
19418
|
|
|
19155
19419
|
if (fog.isFog) {
|
|
19156
19420
|
uniforms.fogNear.value = fog.near;
|
|
@@ -19899,20 +20163,7 @@
|
|
|
19899
20163
|
this.physicallyCorrectLights = false; // tone mapping
|
|
19900
20164
|
|
|
19901
20165
|
this.toneMapping = NoToneMapping;
|
|
19902
|
-
this.toneMappingExposure = 1.0; //
|
|
19903
|
-
|
|
19904
|
-
Object.defineProperties(this, {
|
|
19905
|
-
// @deprecated since r136, 0e21088102b4de7e0a0a33140620b7a3424b9e6d
|
|
19906
|
-
gammaFactor: {
|
|
19907
|
-
get: function () {
|
|
19908
|
-
console.warn('THREE.WebGLRenderer: .gammaFactor has been removed.');
|
|
19909
|
-
return 2;
|
|
19910
|
-
},
|
|
19911
|
-
set: function () {
|
|
19912
|
-
console.warn('THREE.WebGLRenderer: .gammaFactor has been removed.');
|
|
19913
|
-
}
|
|
19914
|
-
}
|
|
19915
|
-
}); // internal properties
|
|
20166
|
+
this.toneMappingExposure = 1.0; // internal properties
|
|
19916
20167
|
|
|
19917
20168
|
const _this = this;
|
|
19918
20169
|
|
|
@@ -20065,7 +20316,7 @@
|
|
|
20065
20316
|
materials = new WebGLMaterials(_this, properties);
|
|
20066
20317
|
renderLists = new WebGLRenderLists();
|
|
20067
20318
|
renderStates = new WebGLRenderStates(extensions, capabilities);
|
|
20068
|
-
background = new WebGLBackground(_this, cubemaps, state, objects, _alpha, _premultipliedAlpha);
|
|
20319
|
+
background = new WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, _premultipliedAlpha);
|
|
20069
20320
|
shadowMap = new WebGLShadowMap(_this, objects, capabilities);
|
|
20070
20321
|
uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state);
|
|
20071
20322
|
bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
|
|
@@ -20328,22 +20579,35 @@
|
|
|
20328
20579
|
state.setMaterial(material, frontFaceCW); //
|
|
20329
20580
|
|
|
20330
20581
|
let index = geometry.index;
|
|
20331
|
-
const position = geometry.attributes.position; //
|
|
20332
|
-
|
|
20333
|
-
if (index === null) {
|
|
20334
|
-
if (position === undefined || position.count === 0) return;
|
|
20335
|
-
} else if (index.count === 0) {
|
|
20336
|
-
return;
|
|
20337
|
-
} //
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
20582
|
let rangeFactor = 1;
|
|
20341
20583
|
|
|
20342
20584
|
if (material.wireframe === true) {
|
|
20343
20585
|
index = geometries.getWireframeAttribute(geometry);
|
|
20344
20586
|
rangeFactor = 2;
|
|
20587
|
+
} //
|
|
20588
|
+
|
|
20589
|
+
|
|
20590
|
+
const drawRange = geometry.drawRange;
|
|
20591
|
+
const position = geometry.attributes.position;
|
|
20592
|
+
let drawStart = drawRange.start * rangeFactor;
|
|
20593
|
+
let drawEnd = (drawRange.start + drawRange.count) * rangeFactor;
|
|
20594
|
+
|
|
20595
|
+
if (group !== null) {
|
|
20596
|
+
drawStart = Math.max(drawStart, group.start * rangeFactor);
|
|
20597
|
+
drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor);
|
|
20345
20598
|
}
|
|
20346
20599
|
|
|
20600
|
+
if (index !== null) {
|
|
20601
|
+
drawStart = Math.max(drawStart, 0);
|
|
20602
|
+
drawEnd = Math.min(drawEnd, index.count);
|
|
20603
|
+
} else if (position !== undefined && position !== null) {
|
|
20604
|
+
drawStart = Math.max(drawStart, 0);
|
|
20605
|
+
drawEnd = Math.min(drawEnd, position.count);
|
|
20606
|
+
}
|
|
20607
|
+
|
|
20608
|
+
const drawCount = drawEnd - drawStart;
|
|
20609
|
+
if (drawCount < 0 || drawCount === Infinity) return; //
|
|
20610
|
+
|
|
20347
20611
|
bindingStates.setup(object, material, program, geometry, index);
|
|
20348
20612
|
let attribute;
|
|
20349
20613
|
let renderer = bufferRenderer;
|
|
@@ -20355,16 +20619,6 @@
|
|
|
20355
20619
|
} //
|
|
20356
20620
|
|
|
20357
20621
|
|
|
20358
|
-
const dataCount = index !== null ? index.count : position.count;
|
|
20359
|
-
const rangeStart = geometry.drawRange.start * rangeFactor;
|
|
20360
|
-
const rangeCount = geometry.drawRange.count * rangeFactor;
|
|
20361
|
-
const groupStart = group !== null ? group.start * rangeFactor : 0;
|
|
20362
|
-
const groupCount = group !== null ? group.count * rangeFactor : Infinity;
|
|
20363
|
-
const drawStart = Math.max(rangeStart, groupStart);
|
|
20364
|
-
const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1;
|
|
20365
|
-
const drawCount = Math.max(0, drawEnd - drawStart + 1);
|
|
20366
|
-
if (drawCount === 0) return; //
|
|
20367
|
-
|
|
20368
20622
|
if (object.isMesh) {
|
|
20369
20623
|
if (material.wireframe === true) {
|
|
20370
20624
|
state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());
|
|
@@ -20394,7 +20648,8 @@
|
|
|
20394
20648
|
if (object.isInstancedMesh) {
|
|
20395
20649
|
renderer.renderInstances(drawStart, drawCount, object.count);
|
|
20396
20650
|
} else if (geometry.isInstancedBufferGeometry) {
|
|
20397
|
-
const
|
|
20651
|
+
const maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;
|
|
20652
|
+
const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount);
|
|
20398
20653
|
renderer.renderInstances(drawStart, drawCount, instanceCount);
|
|
20399
20654
|
} else {
|
|
20400
20655
|
renderer.render(drawStart, drawCount);
|
|
@@ -21136,6 +21391,9 @@
|
|
|
21136
21391
|
_currentActiveCubeFace = activeCubeFace;
|
|
21137
21392
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
21138
21393
|
let useDefaultFramebuffer = true;
|
|
21394
|
+
let framebuffer = null;
|
|
21395
|
+
let isCube = false;
|
|
21396
|
+
let isRenderTarget3D = false;
|
|
21139
21397
|
|
|
21140
21398
|
if (renderTarget) {
|
|
21141
21399
|
const renderTargetProperties = properties.get(renderTarget);
|
|
@@ -21150,16 +21408,10 @@
|
|
|
21150
21408
|
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
21151
21409
|
textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture);
|
|
21152
21410
|
}
|
|
21153
|
-
}
|
|
21154
21411
|
|
|
21155
|
-
let framebuffer = null;
|
|
21156
|
-
let isCube = false;
|
|
21157
|
-
let isRenderTarget3D = false;
|
|
21158
|
-
|
|
21159
|
-
if (renderTarget) {
|
|
21160
21412
|
const texture = renderTarget.texture;
|
|
21161
21413
|
|
|
21162
|
-
if (texture.isData3DTexture || texture.isDataArrayTexture) {
|
|
21414
|
+
if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
|
|
21163
21415
|
isRenderTarget3D = true;
|
|
21164
21416
|
}
|
|
21165
21417
|
|
|
@@ -21352,7 +21604,7 @@
|
|
|
21352
21604
|
if (srcTexture.isDataTexture || srcTexture.isData3DTexture) {
|
|
21353
21605
|
_gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
|
|
21354
21606
|
} else {
|
|
21355
|
-
if (srcTexture.
|
|
21607
|
+
if (srcTexture.isCompressedArrayTexture) {
|
|
21356
21608
|
console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
|
|
21357
21609
|
|
|
21358
21610
|
_gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
|
|
@@ -21381,7 +21633,7 @@
|
|
|
21381
21633
|
textures.setTextureCube(texture, 0);
|
|
21382
21634
|
} else if (texture.isData3DTexture) {
|
|
21383
21635
|
textures.setTexture3D(texture, 0);
|
|
21384
|
-
} else if (texture.isDataArrayTexture) {
|
|
21636
|
+
} else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
|
|
21385
21637
|
textures.setTexture2DArray(texture, 0);
|
|
21386
21638
|
} else {
|
|
21387
21639
|
textures.setTexture2D(texture, 0);
|
|
@@ -21463,6 +21715,8 @@
|
|
|
21463
21715
|
this.background = null;
|
|
21464
21716
|
this.environment = null;
|
|
21465
21717
|
this.fog = null;
|
|
21718
|
+
this.backgroundBlurriness = 0;
|
|
21719
|
+
this.backgroundIntensity = 1;
|
|
21466
21720
|
this.overrideMaterial = null;
|
|
21467
21721
|
|
|
21468
21722
|
if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
|
|
@@ -21477,6 +21731,8 @@
|
|
|
21477
21731
|
if (source.background !== null) this.background = source.background.clone();
|
|
21478
21732
|
if (source.environment !== null) this.environment = source.environment.clone();
|
|
21479
21733
|
if (source.fog !== null) this.fog = source.fog.clone();
|
|
21734
|
+
this.backgroundBlurriness = source.backgroundBlurriness;
|
|
21735
|
+
this.backgroundIntensity = source.backgroundIntensity;
|
|
21480
21736
|
if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
|
|
21481
21737
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
21482
21738
|
return this;
|
|
@@ -21485,6 +21741,8 @@
|
|
|
21485
21741
|
toJSON(meta) {
|
|
21486
21742
|
const data = super.toJSON(meta);
|
|
21487
21743
|
if (this.fog !== null) data.object.fog = this.fog.toJSON();
|
|
21744
|
+
if (this.backgroundBlurriness > 0) data.backgroundBlurriness = this.backgroundBlurriness;
|
|
21745
|
+
if (this.backgroundIntensity !== 1) data.backgroundIntensity = this.backgroundIntensity;
|
|
21488
21746
|
return data;
|
|
21489
21747
|
} // @deprecated
|
|
21490
21748
|
|
|
@@ -21755,7 +22013,7 @@
|
|
|
21755
22013
|
|
|
21756
22014
|
clone(data) {
|
|
21757
22015
|
if (data === undefined) {
|
|
21758
|
-
console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will
|
|
22016
|
+
console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.');
|
|
21759
22017
|
const array = [];
|
|
21760
22018
|
|
|
21761
22019
|
for (let i = 0; i < this.count; i++) {
|
|
@@ -21782,7 +22040,7 @@
|
|
|
21782
22040
|
|
|
21783
22041
|
toJSON(data) {
|
|
21784
22042
|
if (data === undefined) {
|
|
21785
|
-
console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will
|
|
22043
|
+
console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.');
|
|
21786
22044
|
const array = [];
|
|
21787
22045
|
|
|
21788
22046
|
for (let i = 0; i < this.count; i++) {
|
|
@@ -21791,7 +22049,7 @@
|
|
|
21791
22049
|
for (let j = 0; j < this.itemSize; j++) {
|
|
21792
22050
|
array.push(this.data.array[index + j]);
|
|
21793
22051
|
}
|
|
21794
|
-
} //
|
|
22052
|
+
} // de-interleave data and save it as an ordinary buffer attribute for now
|
|
21795
22053
|
|
|
21796
22054
|
|
|
21797
22055
|
return {
|
|
@@ -21801,7 +22059,7 @@
|
|
|
21801
22059
|
normalized: this.normalized
|
|
21802
22060
|
};
|
|
21803
22061
|
} else {
|
|
21804
|
-
// save as true interleaved
|
|
22062
|
+
// save as true interleaved attribute
|
|
21805
22063
|
if (data.interleavedBuffers === undefined) {
|
|
21806
22064
|
data.interleavedBuffers = {};
|
|
21807
22065
|
}
|
|
@@ -22017,14 +22275,14 @@
|
|
|
22017
22275
|
|
|
22018
22276
|
for (let i = 0, l = levels.length; i < l; i++) {
|
|
22019
22277
|
const level = levels[i];
|
|
22020
|
-
this.addLevel(level.object.clone(), level.distance);
|
|
22278
|
+
this.addLevel(level.object.clone(), level.distance, level.hysteresis);
|
|
22021
22279
|
}
|
|
22022
22280
|
|
|
22023
22281
|
this.autoUpdate = source.autoUpdate;
|
|
22024
22282
|
return this;
|
|
22025
22283
|
}
|
|
22026
22284
|
|
|
22027
|
-
addLevel(object, distance = 0) {
|
|
22285
|
+
addLevel(object, distance = 0, hysteresis = 0) {
|
|
22028
22286
|
distance = Math.abs(distance);
|
|
22029
22287
|
const levels = this.levels;
|
|
22030
22288
|
let l;
|
|
@@ -22037,6 +22295,7 @@
|
|
|
22037
22295
|
|
|
22038
22296
|
levels.splice(l, 0, {
|
|
22039
22297
|
distance: distance,
|
|
22298
|
+
hysteresis: hysteresis,
|
|
22040
22299
|
object: object
|
|
22041
22300
|
});
|
|
22042
22301
|
this.add(object);
|
|
@@ -22054,7 +22313,13 @@
|
|
|
22054
22313
|
let i, l;
|
|
22055
22314
|
|
|
22056
22315
|
for (i = 1, l = levels.length; i < l; i++) {
|
|
22057
|
-
|
|
22316
|
+
let levelDistance = levels[i].distance;
|
|
22317
|
+
|
|
22318
|
+
if (levels[i].object.visible) {
|
|
22319
|
+
levelDistance -= levelDistance * levels[i].hysteresis;
|
|
22320
|
+
}
|
|
22321
|
+
|
|
22322
|
+
if (distance < levelDistance) {
|
|
22058
22323
|
break;
|
|
22059
22324
|
}
|
|
22060
22325
|
}
|
|
@@ -22089,7 +22354,13 @@
|
|
|
22089
22354
|
let i, l;
|
|
22090
22355
|
|
|
22091
22356
|
for (i = 1, l = levels.length; i < l; i++) {
|
|
22092
|
-
|
|
22357
|
+
let levelDistance = levels[i].distance;
|
|
22358
|
+
|
|
22359
|
+
if (levels[i].object.visible) {
|
|
22360
|
+
levelDistance -= levelDistance * levels[i].hysteresis;
|
|
22361
|
+
}
|
|
22362
|
+
|
|
22363
|
+
if (distance >= levelDistance) {
|
|
22093
22364
|
levels[i - 1].object.visible = false;
|
|
22094
22365
|
levels[i].object.visible = true;
|
|
22095
22366
|
} else {
|
|
@@ -22115,7 +22386,8 @@
|
|
|
22115
22386
|
const level = levels[i];
|
|
22116
22387
|
data.object.levels.push({
|
|
22117
22388
|
object: level.object.uuid,
|
|
22118
|
-
distance: level.distance
|
|
22389
|
+
distance: level.distance,
|
|
22390
|
+
hysteresis: level.hysteresis
|
|
22119
22391
|
});
|
|
22120
22392
|
}
|
|
22121
22393
|
|
|
@@ -22471,6 +22743,8 @@
|
|
|
22471
22743
|
|
|
22472
22744
|
const _instanceIntersects = [];
|
|
22473
22745
|
|
|
22746
|
+
const _identity = /*@__PURE__*/new Matrix4();
|
|
22747
|
+
|
|
22474
22748
|
const _mesh = /*@__PURE__*/new Mesh();
|
|
22475
22749
|
|
|
22476
22750
|
class InstancedMesh extends Mesh {
|
|
@@ -22481,6 +22755,10 @@
|
|
|
22481
22755
|
this.instanceColor = null;
|
|
22482
22756
|
this.count = count;
|
|
22483
22757
|
this.frustumCulled = false;
|
|
22758
|
+
|
|
22759
|
+
for (let i = 0; i < count; i++) {
|
|
22760
|
+
this.setMatrixAt(i, _identity);
|
|
22761
|
+
}
|
|
22484
22762
|
}
|
|
22485
22763
|
|
|
22486
22764
|
copy(source, recursive) {
|
|
@@ -22997,6 +23275,16 @@
|
|
|
22997
23275
|
|
|
22998
23276
|
}
|
|
22999
23277
|
|
|
23278
|
+
class CompressedArrayTexture extends CompressedTexture {
|
|
23279
|
+
constructor(mipmaps, width, height, depth, format, type) {
|
|
23280
|
+
super(mipmaps, width, height, format, type);
|
|
23281
|
+
this.isCompressedArrayTexture = true;
|
|
23282
|
+
this.image.depth = depth;
|
|
23283
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
23284
|
+
}
|
|
23285
|
+
|
|
23286
|
+
}
|
|
23287
|
+
|
|
23000
23288
|
class CanvasTexture extends Texture {
|
|
23001
23289
|
constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
|
|
23002
23290
|
super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
|
|
@@ -24716,7 +25004,7 @@
|
|
|
24716
25004
|
function subdivide(detail) {
|
|
24717
25005
|
const a = new Vector3();
|
|
24718
25006
|
const b = new Vector3();
|
|
24719
|
-
const c = new Vector3(); // iterate over all faces and apply a
|
|
25007
|
+
const c = new Vector3(); // iterate over all faces and apply a subdivision with the given detail value
|
|
24720
25008
|
|
|
24721
25009
|
for (let i = 0; i < indices.length; i += 3) {
|
|
24722
25010
|
// get the vertices of the face
|
|
@@ -25082,7 +25370,7 @@
|
|
|
25082
25370
|
}
|
|
25083
25371
|
|
|
25084
25372
|
/**
|
|
25085
|
-
* Port from https://github.com/mapbox/earcut (v2.2.
|
|
25373
|
+
* Port from https://github.com/mapbox/earcut (v2.2.4)
|
|
25086
25374
|
*/
|
|
25087
25375
|
const Earcut = {
|
|
25088
25376
|
triangulate: function (data, holeIndices, dim = 2) {
|
|
@@ -25109,10 +25397,10 @@
|
|
|
25109
25397
|
|
|
25110
25398
|
|
|
25111
25399
|
invSize = Math.max(maxX - minX, maxY - minY);
|
|
25112
|
-
invSize = invSize !== 0 ?
|
|
25400
|
+
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
25113
25401
|
}
|
|
25114
25402
|
|
|
25115
|
-
earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
|
|
25403
|
+
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
25116
25404
|
return triangles;
|
|
25117
25405
|
}
|
|
25118
25406
|
}; // create a circular doubly linked list from polygon points in the specified winding order
|
|
@@ -25172,9 +25460,9 @@
|
|
|
25172
25460
|
|
|
25173
25461
|
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
25174
25462
|
// cut off the triangle
|
|
25175
|
-
triangles.push(prev.i / dim);
|
|
25176
|
-
triangles.push(ear.i / dim);
|
|
25177
|
-
triangles.push(next.i / dim);
|
|
25463
|
+
triangles.push(prev.i / dim | 0);
|
|
25464
|
+
triangles.push(ear.i / dim | 0);
|
|
25465
|
+
triangles.push(next.i / dim | 0);
|
|
25178
25466
|
removeNode(ear); // skipping the next vertex leads to less sliver triangles
|
|
25179
25467
|
|
|
25180
25468
|
ear = next.next;
|
|
@@ -25208,10 +25496,21 @@
|
|
|
25208
25496
|
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
25209
25497
|
// now make sure we don't have other points inside the potential ear
|
|
25210
25498
|
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25499
|
+
const ax = a.x,
|
|
25500
|
+
bx = b.x,
|
|
25501
|
+
cx = c.x,
|
|
25502
|
+
ay = a.y,
|
|
25503
|
+
by = b.y,
|
|
25504
|
+
cy = c.y; // triangle bbox; min & max are calculated like this for speed
|
|
25505
|
+
|
|
25506
|
+
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
|
|
25507
|
+
y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
|
|
25508
|
+
x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
|
|
25509
|
+
y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
25510
|
+
let p = c.next;
|
|
25511
|
+
|
|
25512
|
+
while (p !== a) {
|
|
25513
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
25215
25514
|
p = p.next;
|
|
25216
25515
|
}
|
|
25217
25516
|
|
|
@@ -25223,34 +25522,40 @@
|
|
|
25223
25522
|
b = ear,
|
|
25224
25523
|
c = ear.next;
|
|
25225
25524
|
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
25226
|
-
// triangle bbox; min & max are calculated like this for speed
|
|
25227
25525
|
|
|
25228
|
-
const
|
|
25229
|
-
|
|
25230
|
-
|
|
25231
|
-
|
|
25526
|
+
const ax = a.x,
|
|
25527
|
+
bx = b.x,
|
|
25528
|
+
cx = c.x,
|
|
25529
|
+
ay = a.y,
|
|
25530
|
+
by = b.y,
|
|
25531
|
+
cy = c.y; // triangle bbox; min & max are calculated like this for speed
|
|
25232
25532
|
|
|
25233
|
-
const
|
|
25234
|
-
|
|
25533
|
+
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
|
|
25534
|
+
y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
|
|
25535
|
+
x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
|
|
25536
|
+
y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; // z-order range for the current triangle bbox;
|
|
25537
|
+
|
|
25538
|
+
const minZ = zOrder(x0, y0, minX, minY, invSize),
|
|
25539
|
+
maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
25235
25540
|
let p = ear.prevZ,
|
|
25236
25541
|
n = ear.nextZ; // look for points inside the triangle in both directions
|
|
25237
25542
|
|
|
25238
25543
|
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
25239
|
-
if (p
|
|
25544
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
25240
25545
|
p = p.prevZ;
|
|
25241
|
-
if (n
|
|
25546
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
25242
25547
|
n = n.nextZ;
|
|
25243
25548
|
} // look for remaining points in decreasing z-order
|
|
25244
25549
|
|
|
25245
25550
|
|
|
25246
25551
|
while (p && p.z >= minZ) {
|
|
25247
|
-
if (p
|
|
25552
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
25248
25553
|
p = p.prevZ;
|
|
25249
25554
|
} // look for remaining points in increasing z-order
|
|
25250
25555
|
|
|
25251
25556
|
|
|
25252
25557
|
while (n && n.z <= maxZ) {
|
|
25253
|
-
if (n
|
|
25558
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
25254
25559
|
n = n.nextZ;
|
|
25255
25560
|
}
|
|
25256
25561
|
|
|
@@ -25266,9 +25571,9 @@
|
|
|
25266
25571
|
b = p.next.next;
|
|
25267
25572
|
|
|
25268
25573
|
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
25269
|
-
triangles.push(a.i / dim);
|
|
25270
|
-
triangles.push(p.i / dim);
|
|
25271
|
-
triangles.push(b.i / dim); // remove two nodes involved
|
|
25574
|
+
triangles.push(a.i / dim | 0);
|
|
25575
|
+
triangles.push(p.i / dim | 0);
|
|
25576
|
+
triangles.push(b.i / dim | 0); // remove two nodes involved
|
|
25272
25577
|
|
|
25273
25578
|
removeNode(p);
|
|
25274
25579
|
removeNode(p.next);
|
|
@@ -25297,8 +25602,8 @@
|
|
|
25297
25602
|
a = filterPoints(a, a.next);
|
|
25298
25603
|
c = filterPoints(c, c.next); // run earcut on each half
|
|
25299
25604
|
|
|
25300
|
-
earcutLinked(a, triangles, dim, minX, minY, invSize);
|
|
25301
|
-
earcutLinked(c, triangles, dim, minX, minY, invSize);
|
|
25605
|
+
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
25606
|
+
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
25302
25607
|
return;
|
|
25303
25608
|
}
|
|
25304
25609
|
|
|
@@ -25325,8 +25630,7 @@
|
|
|
25325
25630
|
queue.sort(compareX); // process holes from left to right
|
|
25326
25631
|
|
|
25327
25632
|
for (i = 0; i < queue.length; i++) {
|
|
25328
|
-
eliminateHole(queue[i], outerNode);
|
|
25329
|
-
outerNode = filterPoints(outerNode, outerNode.next);
|
|
25633
|
+
outerNode = eliminateHole(queue[i], outerNode);
|
|
25330
25634
|
}
|
|
25331
25635
|
|
|
25332
25636
|
return outerNode;
|
|
@@ -25338,23 +25642,25 @@
|
|
|
25338
25642
|
|
|
25339
25643
|
|
|
25340
25644
|
function eliminateHole(hole, outerNode) {
|
|
25341
|
-
|
|
25342
|
-
|
|
25343
|
-
if (outerNode) {
|
|
25344
|
-
const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts
|
|
25645
|
+
const bridge = findHoleBridge(hole, outerNode);
|
|
25345
25646
|
|
|
25346
|
-
|
|
25347
|
-
|
|
25647
|
+
if (!bridge) {
|
|
25648
|
+
return outerNode;
|
|
25348
25649
|
}
|
|
25650
|
+
|
|
25651
|
+
const bridgeReverse = splitPolygon(bridge, hole); // filter collinear points around the cuts
|
|
25652
|
+
|
|
25653
|
+
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
25654
|
+
return filterPoints(bridge, bridge.next);
|
|
25349
25655
|
} // David Eberly's algorithm for finding a bridge between hole and outer polygon
|
|
25350
25656
|
|
|
25351
25657
|
|
|
25352
25658
|
function findHoleBridge(hole, outerNode) {
|
|
25353
|
-
let p = outerNode
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25659
|
+
let p = outerNode,
|
|
25660
|
+
qx = -Infinity,
|
|
25661
|
+
m;
|
|
25662
|
+
const hx = hole.x,
|
|
25663
|
+
hy = hole.y; // find a segment intersected by a ray from the hole's leftmost point to the left;
|
|
25358
25664
|
// segment's endpoint with lesser x will be potential connection point
|
|
25359
25665
|
|
|
25360
25666
|
do {
|
|
@@ -25363,22 +25669,15 @@
|
|
|
25363
25669
|
|
|
25364
25670
|
if (x <= hx && x > qx) {
|
|
25365
25671
|
qx = x;
|
|
25366
|
-
|
|
25367
|
-
if (x === hx) {
|
|
25368
|
-
if (hy === p.y) return p;
|
|
25369
|
-
if (hy === p.next.y) return p.next;
|
|
25370
|
-
}
|
|
25371
|
-
|
|
25372
25672
|
m = p.x < p.next.x ? p : p.next;
|
|
25673
|
+
if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
|
|
25373
25674
|
}
|
|
25374
25675
|
}
|
|
25375
25676
|
|
|
25376
25677
|
p = p.next;
|
|
25377
25678
|
} while (p !== outerNode);
|
|
25378
25679
|
|
|
25379
|
-
if (!m) return null;
|
|
25380
|
-
if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
|
|
25381
|
-
// look for points inside the triangle of hole point, segment intersection and endpoint;
|
|
25680
|
+
if (!m) return null; // look for points inside the triangle of hole point, segment intersection and endpoint;
|
|
25382
25681
|
// if there are no points found, we have a valid connection;
|
|
25383
25682
|
// otherwise choose the point of the minimum angle with the ray as connection point
|
|
25384
25683
|
|
|
@@ -25415,7 +25714,7 @@
|
|
|
25415
25714
|
let p = start;
|
|
25416
25715
|
|
|
25417
25716
|
do {
|
|
25418
|
-
if (p.z ===
|
|
25717
|
+
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
25419
25718
|
p.prevZ = p.prev;
|
|
25420
25719
|
p.nextZ = p.next;
|
|
25421
25720
|
p = p.next;
|
|
@@ -25487,8 +25786,8 @@
|
|
|
25487
25786
|
|
|
25488
25787
|
function zOrder(x, y, minX, minY, invSize) {
|
|
25489
25788
|
// coords are transformed into non-negative 15-bit integer range
|
|
25490
|
-
x =
|
|
25491
|
-
y =
|
|
25789
|
+
x = (x - minX) * invSize | 0;
|
|
25790
|
+
y = (y - minY) * invSize | 0;
|
|
25492
25791
|
x = (x | x << 8) & 0x00FF00FF;
|
|
25493
25792
|
x = (x | x << 4) & 0x0F0F0F0F;
|
|
25494
25793
|
x = (x | x << 2) & 0x33333333;
|
|
@@ -25515,12 +25814,12 @@
|
|
|
25515
25814
|
|
|
25516
25815
|
|
|
25517
25816
|
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
25518
|
-
return (cx - px) * (ay - py)
|
|
25817
|
+
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
25519
25818
|
} // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
25520
25819
|
|
|
25521
25820
|
|
|
25522
25821
|
function isValidDiagonal(a, b) {
|
|
25523
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( //
|
|
25822
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( // dones't intersect other edges
|
|
25524
25823
|
locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( // locally visible
|
|
25525
25824
|
area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
25526
25825
|
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
@@ -25648,7 +25947,7 @@
|
|
|
25648
25947
|
this.prev = null;
|
|
25649
25948
|
this.next = null; // z-order curve value
|
|
25650
25949
|
|
|
25651
|
-
this.z =
|
|
25950
|
+
this.z = 0; // previous and next nodes in z-order
|
|
25652
25951
|
|
|
25653
25952
|
this.prevZ = null;
|
|
25654
25953
|
this.nextZ = null; // indicates whether this is a steiner point
|
|
@@ -26426,7 +26725,7 @@
|
|
|
26426
26725
|
vertices.push(vertex.x, vertex.y, 0);
|
|
26427
26726
|
normals.push(0, 0, 1);
|
|
26428
26727
|
uvs.push(vertex.x, vertex.y); // world uvs
|
|
26429
|
-
} //
|
|
26728
|
+
} // indices
|
|
26430
26729
|
|
|
26431
26730
|
|
|
26432
26731
|
for (let i = 0, l = faces.length; i < l; i++) {
|
|
@@ -27121,7 +27420,7 @@
|
|
|
27121
27420
|
this.transmissionMap = null;
|
|
27122
27421
|
this.thickness = 0;
|
|
27123
27422
|
this.thicknessMap = null;
|
|
27124
|
-
this.attenuationDistance =
|
|
27423
|
+
this.attenuationDistance = Infinity;
|
|
27125
27424
|
this.attenuationColor = new Color(1, 1, 1);
|
|
27126
27425
|
this.specularIntensity = 1.0;
|
|
27127
27426
|
this.specularIntensityMap = null;
|
|
@@ -29063,8 +29362,10 @@
|
|
|
29063
29362
|
}
|
|
29064
29363
|
|
|
29065
29364
|
const callbacks = loading[url];
|
|
29066
|
-
const reader = response.body.getReader();
|
|
29067
|
-
|
|
29365
|
+
const reader = response.body.getReader(); // Nginx needs X-File-Size check
|
|
29366
|
+
// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
|
|
29367
|
+
|
|
29368
|
+
const contentLength = response.headers.get('Content-Length') || response.headers.get('X-File-Size');
|
|
29068
29369
|
const total = contentLength ? parseInt(contentLength) : 0;
|
|
29069
29370
|
const lengthComputable = total !== 0;
|
|
29070
29371
|
let loaded = 0; // periodically read data into the new stream tracking while download progress
|
|
@@ -29599,8 +29900,7 @@
|
|
|
29599
29900
|
this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);
|
|
29600
29901
|
|
|
29601
29902
|
shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
|
|
29602
|
-
shadowMatrix.multiply(
|
|
29603
|
-
shadowMatrix.multiply(shadowCamera.matrixWorldInverse);
|
|
29903
|
+
shadowMatrix.multiply(_projScreenMatrix$1);
|
|
29604
29904
|
}
|
|
29605
29905
|
|
|
29606
29906
|
getViewport(viewportIndex) {
|
|
@@ -29678,7 +29978,7 @@
|
|
|
29678
29978
|
}
|
|
29679
29979
|
|
|
29680
29980
|
class SpotLight extends Light {
|
|
29681
|
-
constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay =
|
|
29981
|
+
constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2) {
|
|
29682
29982
|
super(color, intensity);
|
|
29683
29983
|
this.isSpotLight = true;
|
|
29684
29984
|
this.type = 'SpotLight';
|
|
@@ -29688,8 +29988,7 @@
|
|
|
29688
29988
|
this.distance = distance;
|
|
29689
29989
|
this.angle = angle;
|
|
29690
29990
|
this.penumbra = penumbra;
|
|
29691
|
-
this.decay = decay;
|
|
29692
|
-
|
|
29991
|
+
this.decay = decay;
|
|
29693
29992
|
this.map = null;
|
|
29694
29993
|
this.shadow = new SpotLightShadow();
|
|
29695
29994
|
}
|
|
@@ -29788,13 +30087,12 @@
|
|
|
29788
30087
|
}
|
|
29789
30088
|
|
|
29790
30089
|
class PointLight extends Light {
|
|
29791
|
-
constructor(color, intensity, distance = 0, decay =
|
|
30090
|
+
constructor(color, intensity, distance = 0, decay = 2) {
|
|
29792
30091
|
super(color, intensity);
|
|
29793
30092
|
this.isPointLight = true;
|
|
29794
30093
|
this.type = 'PointLight';
|
|
29795
30094
|
this.distance = distance;
|
|
29796
|
-
this.decay = decay;
|
|
29797
|
-
|
|
30095
|
+
this.decay = decay;
|
|
29798
30096
|
this.shadow = new PointLightShadow();
|
|
29799
30097
|
}
|
|
29800
30098
|
|
|
@@ -30417,12 +30715,8 @@
|
|
|
30417
30715
|
return this;
|
|
30418
30716
|
}
|
|
30419
30717
|
|
|
30420
|
-
clone() {
|
|
30421
|
-
return new this.constructor().copy(this);
|
|
30422
|
-
}
|
|
30423
|
-
|
|
30424
30718
|
toJSON() {
|
|
30425
|
-
const data = super.toJSON(
|
|
30719
|
+
const data = super.toJSON();
|
|
30426
30720
|
data.instanceCount = this.instanceCount;
|
|
30427
30721
|
data.isInstancedBufferGeometry = true;
|
|
30428
30722
|
return data;
|
|
@@ -30603,6 +30897,7 @@
|
|
|
30603
30897
|
const metadata = json.metadata;
|
|
30604
30898
|
|
|
30605
30899
|
if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
|
|
30900
|
+
if (onError !== undefined) onError(new Error('THREE.ObjectLoader: Can\'t load ' + url));
|
|
30606
30901
|
console.error('THREE.ObjectLoader: Can\'t load ' + url);
|
|
30607
30902
|
return;
|
|
30608
30903
|
}
|
|
@@ -31058,6 +31353,7 @@
|
|
|
31058
31353
|
}
|
|
31059
31354
|
}
|
|
31060
31355
|
|
|
31356
|
+
if (data.backgroundBlurriness !== undefined) object.backgroundBlurriness = data.backgroundBlurriness;
|
|
31061
31357
|
break;
|
|
31062
31358
|
|
|
31063
31359
|
case 'PerspectiveCamera':
|
|
@@ -31223,7 +31519,7 @@
|
|
|
31223
31519
|
const child = object.getObjectByProperty('uuid', level.object);
|
|
31224
31520
|
|
|
31225
31521
|
if (child !== undefined) {
|
|
31226
|
-
object.addLevel(child, level.distance);
|
|
31522
|
+
object.addLevel(child, level.distance, level.hysteresis);
|
|
31227
31523
|
}
|
|
31228
31524
|
}
|
|
31229
31525
|
}
|
|
@@ -31334,18 +31630,20 @@
|
|
|
31334
31630
|
|
|
31335
31631
|
let _context;
|
|
31336
31632
|
|
|
31337
|
-
|
|
31338
|
-
getContext
|
|
31633
|
+
class AudioContext {
|
|
31634
|
+
static getContext() {
|
|
31339
31635
|
if (_context === undefined) {
|
|
31340
31636
|
_context = new (window.AudioContext || window.webkitAudioContext)();
|
|
31341
31637
|
}
|
|
31342
31638
|
|
|
31343
31639
|
return _context;
|
|
31344
|
-
}
|
|
31345
|
-
|
|
31640
|
+
}
|
|
31641
|
+
|
|
31642
|
+
static setContext(value) {
|
|
31346
31643
|
_context = value;
|
|
31347
31644
|
}
|
|
31348
|
-
|
|
31645
|
+
|
|
31646
|
+
}
|
|
31349
31647
|
|
|
31350
31648
|
class AudioLoader extends Loader {
|
|
31351
31649
|
constructor(manager) {
|
|
@@ -32589,6 +32887,11 @@
|
|
|
32589
32887
|
break;
|
|
32590
32888
|
|
|
32591
32889
|
case 'map':
|
|
32890
|
+
if ('map' in targetObject) {
|
|
32891
|
+
targetObject = targetObject.map;
|
|
32892
|
+
break;
|
|
32893
|
+
}
|
|
32894
|
+
|
|
32592
32895
|
if (!targetObject.material) {
|
|
32593
32896
|
console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
|
|
32594
32897
|
return;
|
|
@@ -34577,10 +34880,10 @@
|
|
|
34577
34880
|
constructor(light, color) {
|
|
34578
34881
|
super();
|
|
34579
34882
|
this.light = light;
|
|
34580
|
-
this.light.updateMatrixWorld();
|
|
34581
34883
|
this.matrix = light.matrixWorld;
|
|
34582
34884
|
this.matrixAutoUpdate = false;
|
|
34583
34885
|
this.color = color;
|
|
34886
|
+
this.type = 'SpotLightHelper';
|
|
34584
34887
|
const geometry = new BufferGeometry();
|
|
34585
34888
|
const positions = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1];
|
|
34586
34889
|
|
|
@@ -34606,7 +34909,8 @@
|
|
|
34606
34909
|
}
|
|
34607
34910
|
|
|
34608
34911
|
update() {
|
|
34609
|
-
this.light.
|
|
34912
|
+
this.light.updateWorldMatrix(true, false);
|
|
34913
|
+
this.light.target.updateWorldMatrix(true, false);
|
|
34610
34914
|
const coneLength = this.light.distance ? this.light.distance : 1000;
|
|
34611
34915
|
const coneWidth = coneLength * Math.tan(this.light.angle);
|
|
34612
34916
|
this.cone.scale.set(coneWidth, coneWidth, coneLength);
|
|
@@ -34698,6 +35002,11 @@
|
|
|
34698
35002
|
super.updateMatrixWorld(force);
|
|
34699
35003
|
}
|
|
34700
35004
|
|
|
35005
|
+
dispose() {
|
|
35006
|
+
this.geometry.dispose();
|
|
35007
|
+
this.material.dispose();
|
|
35008
|
+
}
|
|
35009
|
+
|
|
34701
35010
|
}
|
|
34702
35011
|
|
|
34703
35012
|
function getBoneList(object) {
|
|
@@ -34724,7 +35033,6 @@
|
|
|
34724
35033
|
});
|
|
34725
35034
|
super(geometry, material);
|
|
34726
35035
|
this.light = light;
|
|
34727
|
-
this.light.updateMatrixWorld();
|
|
34728
35036
|
this.color = color;
|
|
34729
35037
|
this.type = 'PointLightHelper';
|
|
34730
35038
|
this.matrix = this.light.matrixWorld;
|
|
@@ -34752,6 +35060,8 @@
|
|
|
34752
35060
|
}
|
|
34753
35061
|
|
|
34754
35062
|
update() {
|
|
35063
|
+
this.light.updateWorldMatrix(true, false);
|
|
35064
|
+
|
|
34755
35065
|
if (this.color !== undefined) {
|
|
34756
35066
|
this.material.color.set(this.color);
|
|
34757
35067
|
} else {
|
|
@@ -34781,10 +35091,10 @@
|
|
|
34781
35091
|
constructor(light, size, color) {
|
|
34782
35092
|
super();
|
|
34783
35093
|
this.light = light;
|
|
34784
|
-
this.light.updateMatrixWorld();
|
|
34785
35094
|
this.matrix = light.matrixWorld;
|
|
34786
35095
|
this.matrixAutoUpdate = false;
|
|
34787
35096
|
this.color = color;
|
|
35097
|
+
this.type = 'HemisphereLightHelper';
|
|
34788
35098
|
const geometry = new OctahedronGeometry(size);
|
|
34789
35099
|
geometry.rotateY(Math.PI * 0.5);
|
|
34790
35100
|
this.material = new MeshBasicMaterial({
|
|
@@ -34825,6 +35135,7 @@
|
|
|
34825
35135
|
colors.needsUpdate = true;
|
|
34826
35136
|
}
|
|
34827
35137
|
|
|
35138
|
+
this.light.updateWorldMatrix(true, false);
|
|
34828
35139
|
mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());
|
|
34829
35140
|
}
|
|
34830
35141
|
|
|
@@ -34865,6 +35176,11 @@
|
|
|
34865
35176
|
this.type = 'GridHelper';
|
|
34866
35177
|
}
|
|
34867
35178
|
|
|
35179
|
+
dispose() {
|
|
35180
|
+
this.geometry.dispose();
|
|
35181
|
+
this.material.dispose();
|
|
35182
|
+
}
|
|
35183
|
+
|
|
34868
35184
|
}
|
|
34869
35185
|
|
|
34870
35186
|
class PolarGridHelper extends LineSegments {
|
|
@@ -34919,6 +35235,11 @@
|
|
|
34919
35235
|
this.type = 'PolarGridHelper';
|
|
34920
35236
|
}
|
|
34921
35237
|
|
|
35238
|
+
dispose() {
|
|
35239
|
+
this.geometry.dispose();
|
|
35240
|
+
this.material.dispose();
|
|
35241
|
+
}
|
|
35242
|
+
|
|
34922
35243
|
}
|
|
34923
35244
|
|
|
34924
35245
|
const _v1 = /*@__PURE__*/new Vector3();
|
|
@@ -34931,10 +35252,10 @@
|
|
|
34931
35252
|
constructor(light, size, color) {
|
|
34932
35253
|
super();
|
|
34933
35254
|
this.light = light;
|
|
34934
|
-
this.light.updateMatrixWorld();
|
|
34935
35255
|
this.matrix = light.matrixWorld;
|
|
34936
35256
|
this.matrixAutoUpdate = false;
|
|
34937
35257
|
this.color = color;
|
|
35258
|
+
this.type = 'DirectionalLightHelper';
|
|
34938
35259
|
if (size === undefined) size = 1;
|
|
34939
35260
|
let geometry = new BufferGeometry();
|
|
34940
35261
|
geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3));
|
|
@@ -34959,6 +35280,9 @@
|
|
|
34959
35280
|
}
|
|
34960
35281
|
|
|
34961
35282
|
update() {
|
|
35283
|
+
this.light.updateWorldMatrix(true, false);
|
|
35284
|
+
this.light.target.updateWorldMatrix(true, false);
|
|
35285
|
+
|
|
34962
35286
|
_v1.setFromMatrixPosition(this.light.matrixWorld);
|
|
34963
35287
|
|
|
34964
35288
|
_v2.setFromMatrixPosition(this.light.target.matrixWorld);
|
|
@@ -35306,6 +35630,11 @@
|
|
|
35306
35630
|
return this;
|
|
35307
35631
|
}
|
|
35308
35632
|
|
|
35633
|
+
dispose() {
|
|
35634
|
+
this.geometry.dispose();
|
|
35635
|
+
this.material.dispose();
|
|
35636
|
+
}
|
|
35637
|
+
|
|
35309
35638
|
}
|
|
35310
35639
|
|
|
35311
35640
|
class Box3Helper extends LineSegments {
|
|
@@ -35333,6 +35662,11 @@
|
|
|
35333
35662
|
super.updateMatrixWorld(force);
|
|
35334
35663
|
}
|
|
35335
35664
|
|
|
35665
|
+
dispose() {
|
|
35666
|
+
this.geometry.dispose();
|
|
35667
|
+
this.material.dispose();
|
|
35668
|
+
}
|
|
35669
|
+
|
|
35336
35670
|
}
|
|
35337
35671
|
|
|
35338
35672
|
class PlaneHelper extends Line {
|
|
@@ -35370,6 +35704,13 @@
|
|
|
35370
35704
|
super.updateMatrixWorld(force);
|
|
35371
35705
|
}
|
|
35372
35706
|
|
|
35707
|
+
dispose() {
|
|
35708
|
+
this.geometry.dispose();
|
|
35709
|
+
this.material.dispose();
|
|
35710
|
+
this.children[0].geometry.dispose();
|
|
35711
|
+
this.children[0].material.dispose();
|
|
35712
|
+
}
|
|
35713
|
+
|
|
35373
35714
|
}
|
|
35374
35715
|
|
|
35375
35716
|
const _axis = /*@__PURE__*/new Vector3();
|
|
@@ -35444,6 +35785,13 @@
|
|
|
35444
35785
|
return this;
|
|
35445
35786
|
}
|
|
35446
35787
|
|
|
35788
|
+
dispose() {
|
|
35789
|
+
this.line.geometry.dispose();
|
|
35790
|
+
this.line.material.dispose();
|
|
35791
|
+
this.cone.geometry.dispose();
|
|
35792
|
+
this.cone.material.dispose();
|
|
35793
|
+
}
|
|
35794
|
+
|
|
35447
35795
|
}
|
|
35448
35796
|
|
|
35449
35797
|
class AxesHelper extends LineSegments {
|
|
@@ -36061,6 +36409,7 @@
|
|
|
36061
36409
|
exports.Color = Color;
|
|
36062
36410
|
exports.ColorKeyframeTrack = ColorKeyframeTrack;
|
|
36063
36411
|
exports.ColorManagement = ColorManagement;
|
|
36412
|
+
exports.CompressedArrayTexture = CompressedArrayTexture;
|
|
36064
36413
|
exports.CompressedTexture = CompressedTexture;
|
|
36065
36414
|
exports.CompressedTextureLoader = CompressedTextureLoader;
|
|
36066
36415
|
exports.ConeBufferGeometry = ConeBufferGeometry;
|