@gnsx/three 0.185.16 → 0.186.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +10 -82600
- package/build/three.core.js +1303 -728
- package/build/three.module.js +439 -338
- package/build/three.tsl.js +74 -44
- package/build/three.webgpu.js +6036 -2184
- package/build/three.webgpu.nodes.js +6020 -2184
- package/examples/jsm/Addons.js +6 -6
- package/examples/jsm/controls/ArcballControls.js +1 -1
- package/examples/jsm/controls/FirstPersonControls.js +44 -20
- package/examples/jsm/controls/OrbitControls.js +9 -0
- package/examples/jsm/controls/TrackballControls.js +109 -4
- package/examples/jsm/csm/CSMShadowNode.js +13 -0
- package/examples/jsm/exporters/GLTFExporter.js +23 -7
- package/examples/jsm/exporters/USDZExporter.js +2 -2
- package/examples/jsm/generators/CityGenerator.js +377 -45
- package/examples/jsm/generators/ForestGenerator.js +12 -12
- package/examples/jsm/generators/TerrainGenerator.js +49 -37
- package/examples/jsm/generators/TreeGenerator.js +70 -76
- package/examples/jsm/generators/city/BenchGenerator.js +127 -0
- package/examples/jsm/generators/city/CarGenerator.js +479 -0
- package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
- package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
- package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
- package/examples/jsm/generators/city/PersonGenerator.js +447 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +33 -38
- package/examples/jsm/generators/city/SkyscraperGenerator.js +448 -48
- package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
- package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
- package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
- package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +1 -1
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/RoundedBoxGeometry.js +1 -1
- package/examples/jsm/gpgpu/CountingSort.js +271 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +60 -239
- package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
- package/examples/jsm/inspector/Extension.js +94 -0
- package/examples/jsm/inspector/Inspector.js +145 -41
- package/examples/jsm/inspector/RendererInspector.js +100 -52
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2609 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
- package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
- package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
- package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +26 -31
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -0
- package/examples/jsm/inspector/tabs/Memory.js +0 -2
- package/examples/jsm/inspector/tabs/Settings.js +4 -0
- package/examples/jsm/inspector/tabs/Timeline.js +223 -171
- package/examples/jsm/inspector/tabs/Viewer.js +515 -21
- package/examples/jsm/inspector/ui/List.js +15 -9
- package/examples/jsm/inspector/ui/Profiler.js +170 -14
- package/examples/jsm/inspector/ui/Style.js +269 -23
- package/examples/jsm/inspector/ui/Tab.js +2 -0
- package/examples/jsm/inspector/ui/Values.js +14 -2
- package/examples/jsm/interactive/HTMLMesh.js +19 -3
- package/examples/jsm/lighting/LightProbeGrid.js +484 -889
- package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
- package/examples/jsm/lighting/LightProbeGridWebGL.js +841 -0
- package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +194 -0
- package/examples/jsm/lighting/vxgi/VXGINode.js +660 -0
- package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +478 -0
- package/examples/jsm/lighting/vxgi/VXGIVolume.js +1430 -0
- package/examples/jsm/lights/SunLight.js +95 -0
- package/examples/jsm/lights/SunLightNode.js +56 -0
- package/examples/jsm/lights/SunLightShadow.js +319 -0
- package/examples/jsm/lights/SunShadowNode.js +312 -0
- package/examples/jsm/loaders/3DMLoader.js +150 -49
- package/examples/jsm/loaders/3MFLoader.js +202 -1
- package/examples/jsm/loaders/FBXLoader.js +81 -5
- package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
- package/examples/jsm/loaders/GLTFLoader.js +79 -14
- package/examples/jsm/loaders/GaussianSplatPLYLoader.js +386 -0
- package/examples/jsm/loaders/KSPLATLoader.js +463 -0
- package/examples/jsm/loaders/MaterialXLoader.js +111 -1010
- package/examples/jsm/loaders/PCDLoader.js +1 -1
- package/examples/jsm/loaders/SPLATLoader.js +139 -0
- package/examples/jsm/loaders/SPZLoader.js +561 -0
- package/examples/jsm/loaders/materialx/MaterialXArchive.js +108 -0
- package/examples/jsm/loaders/materialx/MaterialXDocument.js +878 -0
- package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +376 -0
- package/examples/jsm/loaders/materialx/MaterialXLog.js +75 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +4 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +1021 -0
- package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +661 -0
- package/examples/jsm/loaders/materialx/MaterialXUtils.js +57 -0
- package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +997 -0
- package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
- package/examples/jsm/loaders/usd/USDAParser.js +15 -2
- package/examples/jsm/loaders/usd/USDCParser.js +1 -4
- package/examples/jsm/loaders/usd/USDComposer.js +80 -42
- package/examples/jsm/materials/WoodNodeMaterial.js +6 -108
- package/examples/jsm/misc/RollerCoaster.js +2 -2
- package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
- package/examples/jsm/misc/Sculptor.js +1679 -0
- package/examples/jsm/misc/SculptorMesh.js +1504 -0
- package/examples/jsm/misc/SculptorTools.js +1180 -0
- package/examples/jsm/misc/SculptorUtils.js +345 -0
- package/examples/jsm/misc/TubePainter.js +28 -16
- package/examples/jsm/misc/VolumeSlice.js +24 -24
- package/examples/jsm/modifiers/SimplifyModifier.js +63 -556
- package/examples/jsm/objects/GaussianSplat.js +1039 -0
- package/examples/jsm/objects/Sky.js +66 -45
- package/examples/jsm/objects/SkyMesh.js +70 -51
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +4 -2
- package/examples/jsm/postprocessing/BloomPass.js +2 -2
- package/examples/jsm/postprocessing/GTAOPass.js +1 -1
- package/examples/jsm/postprocessing/OutlinePass.js +5 -5
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +4 -2
- package/examples/jsm/postprocessing/SavePass.js +1 -1
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +30 -13
- package/examples/jsm/renderers/CSS2DRenderer.js +29 -5
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
- package/examples/jsm/shaders/ExposureShader.js +1 -1
- package/examples/jsm/shaders/FilmShader.js +2 -1
- package/examples/jsm/transpiler/AST.js +21 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +498 -8
- package/examples/jsm/transpiler/TSLEncoder.js +82 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +33 -4
- package/examples/jsm/tsl/WebGLNodesHandler.js +29 -39
- package/examples/jsm/tsl/display/AfterImageNode.js +2 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +3 -2
- package/examples/jsm/tsl/display/BilateralBlurNode.js +5 -2
- package/examples/jsm/tsl/display/BloomNode.js +55 -30
- package/examples/jsm/tsl/display/DenoiseNode.js +21 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +24 -6
- package/examples/jsm/tsl/display/DotScreenNode.js +11 -11
- package/examples/jsm/tsl/display/FSR1Node.js +8 -4
- package/examples/jsm/tsl/display/GTAONode.js +199 -86
- package/examples/jsm/tsl/display/GaussianBlurNode.js +65 -52
- package/examples/jsm/tsl/display/GodraysNode.js +5 -2
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +2 -2
- package/examples/jsm/tsl/display/LensflareNode.js +5 -2
- package/examples/jsm/tsl/display/OITPassNode.js +352 -0
- package/examples/jsm/tsl/display/OutlineNode.js +2 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +3 -2
- package/examples/jsm/tsl/display/RGBShiftNode.js +9 -9
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +7 -4
- package/examples/jsm/tsl/display/RetroPassNode.js +1 -1
- package/examples/jsm/tsl/display/SMAANode.js +22 -61
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -4
- package/examples/jsm/tsl/display/SSAONode.js +436 -0
- package/examples/jsm/tsl/display/SSGINode.js +5 -2
- package/examples/jsm/tsl/display/SSRNode.js +7 -2
- package/examples/jsm/tsl/display/SSSNode.js +5 -2
- package/examples/jsm/tsl/display/SharpenNode.js +5 -4
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -3
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -3
- package/examples/jsm/tsl/display/TAAUNode.js +22 -125
- package/examples/jsm/tsl/display/TRAANode.js +16 -142
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +21 -15
- package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
- package/examples/jsm/tsl/display/hashBlur.js +3 -2
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +38 -27
- package/examples/jsm/tsl/lighting/LightProbeGridNode.js +136 -0
- package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +4 -6
- package/examples/jsm/tsl/utils/Raymarching.js +5 -5
- package/examples/jsm/tsl/utils/SoftParticles.js +60 -0
- package/examples/jsm/tsl/utils/TAAUtils.js +195 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +14 -14
- package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +1 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
- package/examples/jsm/webxr/WebGLXRFallback.js +2 -16
- package/examples/jsm/webxr/XRControllerModelFactory.js +16 -4
- package/package.json +9 -16
- package/src/Three.Core.js +2 -1
- package/src/Three.TSL.js +73 -43
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +1 -0
- package/src/animation/AnimationClip.js +15 -2
- package/src/animation/AnimationObjectGroup.js +18 -6
- package/src/animation/AnimationUtils.js +26 -0
- package/src/animation/KeyframeTrack.js +37 -0
- package/src/constants.js +23 -1
- package/src/core/BufferAttribute.js +3 -2
- package/src/core/BufferGeometry.js +1 -1
- package/src/core/InterleavedBuffer.js +5 -1
- package/src/core/Object3D.js +40 -12
- package/src/core/Raycaster.js +4 -0
- package/src/core/RenderTarget.js +99 -9
- package/src/core/RenderTarget3D.js +12 -8
- package/src/extras/Controls.js +0 -8
- package/src/extras/PMREMGenerator.js +99 -205
- package/src/geometries/TorusGeometry.js +1 -1
- package/src/helpers/ArrowHelper.js +2 -0
- package/src/helpers/AxesHelper.js +2 -0
- package/src/helpers/Box3Helper.js +2 -0
- package/src/helpers/BoxHelper.js +2 -0
- package/src/helpers/CameraHelper.js +2 -0
- package/src/helpers/DirectionalLightHelper.js +2 -0
- package/src/helpers/GridHelper.js +2 -0
- package/src/helpers/HemisphereLightHelper.js +2 -0
- package/src/helpers/PlaneHelper.js +2 -0
- package/src/helpers/PointLightHelper.js +2 -0
- package/src/helpers/PolarGridHelper.js +2 -0
- package/src/helpers/SkeletonHelper.js +2 -0
- package/src/helpers/SpotLightHelper.js +2 -0
- package/src/lights/Light.js +0 -10
- package/src/lights/LightShadow.js +43 -12
- package/src/lights/SpotLightShadow.js +18 -0
- package/src/loaders/BufferGeometryLoader.js +5 -0
- package/src/loaders/ImageBitmapLoader.js +3 -1
- package/src/loaders/ObjectLoader.js +8 -5
- package/src/materials/Material.js +80 -57
- package/src/materials/MeshPhysicalMaterial.js +32 -0
- package/src/materials/nodes/Line2NodeMaterial.js +17 -8
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +42 -5
- package/src/materials/nodes/NodeMaterial.js +19 -13
- package/src/materials/nodes/PointsNodeMaterial.js +2 -1
- package/src/materials/nodes/manager/NodeMaterialObserver.js +282 -55
- package/src/math/Frustum.js +9 -0
- package/src/math/FrustumArray.js +1 -1
- package/src/math/MathUtils.js +5 -3
- package/src/math/Matrix4.js +2 -9
- package/src/math/Plane.js +30 -1
- package/src/math/Quaternion.js +0 -10
- package/src/math/Ray.js +95 -45
- package/src/math/Triangle.js +0 -2
- package/src/math/Vector3.js +2 -2
- package/src/math/Vector4.js +0 -4
- package/src/math/interpolants/BezierInterpolant.js +36 -23
- package/src/nodes/Nodes.js +2 -0
- package/src/nodes/TSL.js +11 -3
- package/src/nodes/accessors/Batch.js +85 -13
- package/src/nodes/accessors/BufferAttributeNode.js +1 -1
- package/src/nodes/accessors/BuiltinNode.js +1 -1
- package/src/nodes/accessors/Instance.js +19 -18
- package/src/nodes/accessors/MaterialNode.js +9 -0
- package/src/nodes/accessors/ModelNode.js +85 -9
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -70
- package/src/nodes/accessors/ReferenceElementNode.js +72 -0
- package/src/nodes/accessors/ReferenceNode.js +1 -70
- package/src/nodes/accessors/Skinning.js +124 -12
- package/src/nodes/accessors/StorageTextureNode.js +7 -3
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +51 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -2
- package/src/nodes/accessors/UniformArrayNode.js +30 -5
- package/src/nodes/code/CodeNode.js +1 -1
- package/src/nodes/code/FunctionNode.js +12 -2
- package/src/nodes/core/ArrayNode.js +2 -2
- package/src/nodes/core/ContextNode.js +57 -4
- package/src/nodes/core/IndexNode.js +69 -4
- package/src/nodes/core/InspectorNode.js +2 -2
- package/src/nodes/core/MRTNode.js +44 -2
- package/src/nodes/core/Node.js +6 -3
- package/src/nodes/core/NodeBuilder.js +65 -50
- package/src/nodes/core/NodeFrame.js +11 -3
- package/src/nodes/core/NodeUtils.js +88 -0
- package/src/nodes/core/PropertyNode.js +8 -0
- package/src/nodes/core/StackNode.js +0 -1
- package/src/nodes/core/StructNode.js +4 -3
- package/src/nodes/core/UniformGroupNode.js +3 -2
- package/src/nodes/core/UniformNode.js +26 -12
- package/src/nodes/core/VarNode.js +0 -1
- package/src/nodes/display/BumpMapNode.js +2 -2
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/PassNode.js +76 -15
- package/src/nodes/display/ScreenNode.js +22 -65
- package/src/nodes/fog/Fog.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_GGX.js +6 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +1 -1
- package/src/nodes/functions/BSDF/DFGLUT.js +2 -1
- package/src/nodes/functions/BSDF/LTC.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +1 -1
- package/src/nodes/functions/PhysicalLightingModel.js +83 -25
- package/src/nodes/functions/ToonLightingModel.js +2 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +3 -3
- package/src/nodes/gpgpu/AtomicFunctionNode.js +64 -13
- package/src/nodes/gpgpu/BarrierNode.js +13 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +20 -17
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +165 -37
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +44 -6
- package/src/nodes/lighting/EnvironmentNode.js +40 -4
- package/src/nodes/lighting/LightsNode.js +20 -4
- package/src/nodes/lighting/ShadowBaseNode.js +158 -1
- package/src/nodes/lighting/ShadowFilterNode.js +2 -106
- package/src/nodes/lighting/ShadowNode.js +22 -91
- package/src/nodes/materialx/{lib/mx_hsv.js → MaterialXColor.js} +3 -6
- package/src/nodes/materialx/{lib/mx_transform_color.js → MaterialXColorTransform.js} +3 -6
- package/src/nodes/materialx/MaterialXCore.js +37 -0
- package/src/nodes/materialx/MaterialXNodes.js +64 -72
- package/src/nodes/materialx/{lib/mx_noise.js → MaterialXNoise.js} +426 -197
- package/src/nodes/math/BitcountNode.js +24 -4
- package/src/nodes/math/MathNode.js +4 -4
- package/src/nodes/math/MathUtils.js +15 -4
- package/src/nodes/math/OperatorNode.js +2 -2
- package/src/nodes/math/PackFloatNode.js +29 -1
- package/src/nodes/math/Packed4x8IntegerNode.js +433 -0
- package/src/nodes/math/UnpackFloatNode.js +30 -2
- package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
- package/src/nodes/pmrem/PMREMNode.js +1 -1
- package/src/nodes/pmrem/PMREMUtils.js +31 -74
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLCore.js +1 -31
- package/src/nodes/utils/EventNode.js +75 -0
- package/src/nodes/utils/LoopNode.js +54 -13
- package/src/nodes/utils/PostProcessingUtils.js +23 -2
- package/src/nodes/utils/RTTNode.js +97 -32
- package/src/nodes/utils/ReflectorNode.js +8 -4
- package/src/nodes/utils/RotateNode.js +85 -8
- package/src/nodes/utils/SpriteUtils.js +58 -23
- package/src/objects/BatchedMesh.js +6 -0
- package/src/objects/InstancedMesh.js +1 -1
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +12 -0
- package/src/objects/Mesh.js +12 -0
- package/src/objects/Points.js +12 -0
- package/src/objects/Sprite.js +12 -0
- package/src/renderers/WebGLRenderer.js +93 -27
- package/src/renderers/common/Animation.js +12 -2
- package/src/renderers/common/Backend.js +38 -10
- package/src/renderers/common/BindGroup.js +0 -1
- package/src/renderers/common/Bindings.js +50 -4
- package/src/renderers/common/BundleGroup.js +4 -0
- package/src/renderers/common/ClippingContext.js +11 -1
- package/src/renderers/common/Color4.js +9 -0
- package/src/renderers/common/Constants.js +0 -5
- package/src/renderers/common/DirectRenderPipeline.js +233 -0
- package/src/renderers/common/Geometries.js +24 -3
- package/src/renderers/common/Info.js +3 -3
- package/src/renderers/common/InspectorBase.js +37 -8
- package/src/renderers/common/Lighting.js +11 -4
- package/src/renderers/common/Pipelines.js +6 -4
- package/src/renderers/common/QuadMesh.js +16 -2
- package/src/renderers/common/RenderContext.js +8 -0
- package/src/renderers/common/RenderList.js +53 -19
- package/src/renderers/common/RenderLists.js +58 -11
- package/src/renderers/common/RenderObject.js +14 -0
- package/src/renderers/common/RenderObjects.js +14 -9
- package/src/renderers/common/RenderPipeline.js +52 -44
- package/src/renderers/common/Renderer.js +226 -55
- package/src/renderers/common/Storage3DTexture.js +16 -0
- package/src/renderers/common/Textures.js +3 -3
- package/src/renderers/common/XRManager.js +79 -72
- package/src/renderers/common/extras/PMREMGenerator.js +76 -144
- package/src/renderers/common/nodes/NodeManager.js +144 -6
- package/src/renderers/common/nodes/NodeStorageBuffer.js +3 -1
- package/src/renderers/common/nodes/NodeUniformBuffer.js +3 -1
- package/src/renderers/shaders/DFGLUTData.js +2 -1
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +4 -2
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +48 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +53 -4
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +20 -2
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +61 -57
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +82 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +8 -1
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +1 -0
- package/src/renderers/shaders/UniformsLib.js +16 -0
- package/src/renderers/webgl/WebGLAnimation.js +2 -2
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLLights.js +74 -4
- package/src/renderers/webgl/WebGLMaterials.js +6 -0
- package/src/renderers/webgl/WebGLOutput.js +36 -24
- package/src/renderers/webgl/WebGLProgram.js +3 -0
- package/src/renderers/webgl/WebGLPrograms.js +8 -0
- package/src/renderers/webgl/WebGLRenderLists.js +6 -10
- package/src/renderers/webgl/WebGLShadowMap.js +47 -44
- package/src/renderers/webgl/WebGLTextures.js +7 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +153 -45
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +83 -29
- package/src/renderers/webgl-fallback/utils/WebGLState.js +163 -17
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +32 -5
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +11 -4
- package/src/renderers/webgpu/WebGPUBackend.js +513 -145
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -20
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +3 -12
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +24 -14
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +80 -14
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +62 -7
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +9 -3
- package/src/renderers/webgpu/utils/WebGPUUtils.js +16 -4
- package/src/renderers/webxr/WebXRManager.js +25 -2
- package/src/scenes/Scene.js +3 -3
- package/src/textures/CompressedArrayTexture.js +16 -0
- package/src/textures/Data3DTexture.js +16 -0
- package/src/textures/DataArrayTexture.js +16 -0
- package/src/textures/DepthTexture.js +3 -3
- package/src/textures/Texture.js +3 -3
- package/src/textures/{Source.js → TextureSource.js} +39 -8
- package/build/three.core.min.js +0 -6
- package/build/three.module.min.js +0 -6
- package/build/three.tsl.min.js +0 -6
- package/build/three.webgpu.min.js +0 -6
- package/build/three.webgpu.nodes.min.js +0 -6
- package/examples/jsm/libs/ecsy.module.js +0 -1792
- package/examples/jsm/loaders/LottieLoader.js +0 -130
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +0 -52
package/build/three.core.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2010-2026 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
const REVISION = '
|
|
6
|
+
const REVISION = '186';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -75,6 +75,7 @@ const PCFShadowMap = 1;
|
|
|
75
75
|
*
|
|
76
76
|
* @type {number}
|
|
77
77
|
* @constant
|
|
78
|
+
* @deprecated since r186. Use `PCFShadowMap` instead.
|
|
78
79
|
*/
|
|
79
80
|
const PCFSoftShadowMap = 2;
|
|
80
81
|
|
|
@@ -1714,6 +1715,18 @@ const Compatibility = {
|
|
|
1714
1715
|
TEXTURE_COMPARE: 'depthTextureCompare'
|
|
1715
1716
|
};
|
|
1716
1717
|
|
|
1718
|
+
/**
|
|
1719
|
+
* Represents the refresh types of render objects.
|
|
1720
|
+
*
|
|
1721
|
+
* @type {ConstantsRenderObjectRefreshType}
|
|
1722
|
+
* @constant
|
|
1723
|
+
*/
|
|
1724
|
+
const RenderObjectRefreshType = {
|
|
1725
|
+
NONE: 0,
|
|
1726
|
+
SHARED: 1,
|
|
1727
|
+
FULL: 2
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1717
1730
|
/**
|
|
1718
1731
|
* This type represents mouse buttons and interaction types in context of controls.
|
|
1719
1732
|
*
|
|
@@ -1764,6 +1777,15 @@ const Compatibility = {
|
|
|
1764
1777
|
* @property {string} EITHER - Flat interpolation using either vertex.
|
|
1765
1778
|
*/
|
|
1766
1779
|
|
|
1780
|
+
/**
|
|
1781
|
+
* Represents the refresh types of render objects.
|
|
1782
|
+
*
|
|
1783
|
+
* @typedef {Object} ConstantsRenderObjectRefreshType
|
|
1784
|
+
* @property {number} NONE - No refresh required.
|
|
1785
|
+
* @property {number} SHARED - Only shared uniform buffers require an update.
|
|
1786
|
+
* @property {number} FULL - The render object requires a full refresh.
|
|
1787
|
+
*/
|
|
1788
|
+
|
|
1767
1789
|
/**
|
|
1768
1790
|
* Checks if an array contains values that require Uint32 representation.
|
|
1769
1791
|
*
|
|
@@ -2631,14 +2653,14 @@ function radToDeg( radians ) {
|
|
|
2631
2653
|
}
|
|
2632
2654
|
|
|
2633
2655
|
/**
|
|
2634
|
-
* Returns `true` if the given
|
|
2656
|
+
* Returns `true` if the given integer is a power of two.
|
|
2635
2657
|
*
|
|
2636
2658
|
* @param {number} value - The value to check.
|
|
2637
|
-
* @return {boolean} Whether the given
|
|
2659
|
+
* @return {boolean} Whether the given integer is a power of two or not.
|
|
2638
2660
|
*/
|
|
2639
2661
|
function isPowerOfTwo( value ) {
|
|
2640
2662
|
|
|
2641
|
-
return ( value
|
|
2663
|
+
return value > 0 && Number.isInteger( value ) && 2 ** Math.round( Math.log2( value ) ) === value;
|
|
2642
2664
|
|
|
2643
2665
|
}
|
|
2644
2666
|
|
|
@@ -2753,6 +2775,7 @@ function denormalize( value, array ) {
|
|
|
2753
2775
|
return value / 65535.0;
|
|
2754
2776
|
|
|
2755
2777
|
case Uint8Array:
|
|
2778
|
+
case Uint8ClampedArray:
|
|
2756
2779
|
|
|
2757
2780
|
return value / 255.0;
|
|
2758
2781
|
|
|
@@ -2800,6 +2823,7 @@ function normalize( value, array ) {
|
|
|
2800
2823
|
return Math.round( value * 65535.0 );
|
|
2801
2824
|
|
|
2802
2825
|
case Uint8Array:
|
|
2826
|
+
case Uint8ClampedArray:
|
|
2803
2827
|
|
|
2804
2828
|
return Math.round( value * 255.0 );
|
|
2805
2829
|
|
|
@@ -4241,10 +4265,6 @@ class Quaternion {
|
|
|
4241
4265
|
|
|
4242
4266
|
const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
|
|
4243
4267
|
|
|
4244
|
-
// http://www.mathworks.com/matlabcentral/fileexchange/
|
|
4245
|
-
// 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
|
|
4246
|
-
// content/SpinCalc.m
|
|
4247
|
-
|
|
4248
4268
|
const cos = Math.cos;
|
|
4249
4269
|
const sin = Math.sin;
|
|
4250
4270
|
|
|
@@ -4320,8 +4340,6 @@ class Quaternion {
|
|
|
4320
4340
|
*/
|
|
4321
4341
|
setFromAxisAngle( axis, angle ) {
|
|
4322
4342
|
|
|
4323
|
-
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
|
|
4324
|
-
|
|
4325
4343
|
const halfAngle = angle / 2, s = Math.sin( halfAngle );
|
|
4326
4344
|
|
|
4327
4345
|
this._x = axis.x * s;
|
|
@@ -4343,8 +4361,6 @@ class Quaternion {
|
|
|
4343
4361
|
*/
|
|
4344
4362
|
setFromRotationMatrix( m ) {
|
|
4345
4363
|
|
|
4346
|
-
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
|
|
4347
|
-
|
|
4348
4364
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
4349
4365
|
|
|
4350
4366
|
const te = m.elements,
|
|
@@ -4632,8 +4648,6 @@ class Quaternion {
|
|
|
4632
4648
|
*/
|
|
4633
4649
|
multiplyQuaternions( a, b ) {
|
|
4634
4650
|
|
|
4635
|
-
// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
|
|
4636
|
-
|
|
4637
4651
|
const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;
|
|
4638
4652
|
const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;
|
|
4639
4653
|
|
|
@@ -5369,8 +5383,8 @@ class Vector3 {
|
|
|
5369
5383
|
}
|
|
5370
5384
|
|
|
5371
5385
|
/**
|
|
5372
|
-
* Transforms
|
|
5373
|
-
*
|
|
5386
|
+
* Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix,
|
|
5387
|
+
* and normalizes the result.
|
|
5374
5388
|
*
|
|
5375
5389
|
* @param {Matrix4} m - The matrix.
|
|
5376
5390
|
* @return {Vector3} A reference to this vector.
|
|
@@ -7091,10 +7105,10 @@ let _sourceId = 0;
|
|
|
7091
7105
|
* The main purpose of this class is to decouple the data definition from the texture
|
|
7092
7106
|
* definition so the same data can be used with multiple texture instances.
|
|
7093
7107
|
*/
|
|
7094
|
-
class
|
|
7108
|
+
class TextureSource {
|
|
7095
7109
|
|
|
7096
7110
|
/**
|
|
7097
|
-
* Constructs a new
|
|
7111
|
+
* Constructs a new texture source.
|
|
7098
7112
|
*
|
|
7099
7113
|
* @param {any} [data=null] - The data definition of a texture.
|
|
7100
7114
|
*/
|
|
@@ -7107,12 +7121,12 @@ class Source {
|
|
|
7107
7121
|
* @readonly
|
|
7108
7122
|
* @default true
|
|
7109
7123
|
*/
|
|
7110
|
-
this.
|
|
7124
|
+
this.isTextureSource = true;
|
|
7111
7125
|
|
|
7112
7126
|
/**
|
|
7113
7127
|
* The ID of the source.
|
|
7114
7128
|
*
|
|
7115
|
-
* @name
|
|
7129
|
+
* @name TextureSource#id
|
|
7116
7130
|
* @type {number}
|
|
7117
7131
|
* @readonly
|
|
7118
7132
|
*/
|
|
@@ -7134,7 +7148,7 @@ class Source {
|
|
|
7134
7148
|
this.data = data;
|
|
7135
7149
|
|
|
7136
7150
|
/**
|
|
7137
|
-
* This property is only relevant when {@link
|
|
7151
|
+
* This property is only relevant when {@link TextureSource#needsUpdate} is set to `true` and
|
|
7138
7152
|
* provides more control on how texture data should be processed. When `dataReady` is set
|
|
7139
7153
|
* to `false`, the engine performs the memory allocation (if necessary) but does not transfer
|
|
7140
7154
|
* the data into the GPU memory.
|
|
@@ -7145,7 +7159,7 @@ class Source {
|
|
|
7145
7159
|
this.dataReady = true;
|
|
7146
7160
|
|
|
7147
7161
|
/**
|
|
7148
|
-
* This starts at `0` and counts how many times {@link
|
|
7162
|
+
* This starts at `0` and counts how many times {@link TextureSource#needsUpdate} is set to `true`.
|
|
7149
7163
|
*
|
|
7150
7164
|
* @type {number}
|
|
7151
7165
|
* @readonly
|
|
@@ -7308,6 +7322,37 @@ function serializeImage( image ) {
|
|
|
7308
7322
|
|
|
7309
7323
|
}
|
|
7310
7324
|
|
|
7325
|
+
/**
|
|
7326
|
+
* @deprecated since r186. Use {@link TextureSource} instead. `Source` has been renamed to `TextureSource`.
|
|
7327
|
+
*/
|
|
7328
|
+
class Source extends TextureSource {
|
|
7329
|
+
|
|
7330
|
+
/**
|
|
7331
|
+
* Constructs a new texture source.
|
|
7332
|
+
*
|
|
7333
|
+
* @param {any} [data=null] - The data definition of a texture.
|
|
7334
|
+
* @deprecated since r186. Use {@link TextureSource} instead.
|
|
7335
|
+
*/
|
|
7336
|
+
constructor( data = null ) {
|
|
7337
|
+
|
|
7338
|
+
warnOnce( 'Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.' ); // @deprecated, r186
|
|
7339
|
+
|
|
7340
|
+
super( data );
|
|
7341
|
+
|
|
7342
|
+
/**
|
|
7343
|
+
* This flag can be used for type testing.
|
|
7344
|
+
*
|
|
7345
|
+
* @deprecated since r186. Use {@link TextureSource#isTextureSource} instead.
|
|
7346
|
+
* @type {boolean}
|
|
7347
|
+
* @readonly
|
|
7348
|
+
* @default true
|
|
7349
|
+
*/
|
|
7350
|
+
this.isSource = true;
|
|
7351
|
+
|
|
7352
|
+
}
|
|
7353
|
+
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7311
7356
|
let _textureId = 0;
|
|
7312
7357
|
|
|
7313
7358
|
const _tempVec3 = /*@__PURE__*/ new Vector3();
|
|
@@ -7379,9 +7424,9 @@ class Texture extends EventDispatcher {
|
|
|
7379
7424
|
* where multiple textures render the same data but with different texture
|
|
7380
7425
|
* transformations.
|
|
7381
7426
|
*
|
|
7382
|
-
* @type {
|
|
7427
|
+
* @type {TextureSource}
|
|
7383
7428
|
*/
|
|
7384
|
-
this.source = new
|
|
7429
|
+
this.source = new TextureSource( image );
|
|
7385
7430
|
|
|
7386
7431
|
/**
|
|
7387
7432
|
* An array holding user-defined mipmaps.
|
|
@@ -8593,8 +8638,6 @@ class Vector4 {
|
|
|
8593
8638
|
*/
|
|
8594
8639
|
setAxisAngleFromQuaternion( q ) {
|
|
8595
8640
|
|
|
8596
|
-
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
|
|
8597
|
-
|
|
8598
8641
|
// q is assumed to be normalized
|
|
8599
8642
|
|
|
8600
8643
|
this.w = 2 * Math.acos( q.w );
|
|
@@ -8628,8 +8671,6 @@ class Vector4 {
|
|
|
8628
8671
|
*/
|
|
8629
8672
|
setAxisAngleFromRotationMatrix( m ) {
|
|
8630
8673
|
|
|
8631
|
-
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
|
|
8632
|
-
|
|
8633
8674
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
8634
8675
|
|
|
8635
8676
|
let angle, x, y, z; // variables for result
|
|
@@ -9190,8 +9231,12 @@ class RenderTarget extends EventDispatcher {
|
|
|
9190
9231
|
* @property {string} [colorSpace=NoColorSpace] - The texture's color space.
|
|
9191
9232
|
* @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not.
|
|
9192
9233
|
* @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not.
|
|
9193
|
-
* @property {boolean} [
|
|
9194
|
-
* @property {boolean} [
|
|
9234
|
+
* @property {boolean} [resolveColorBuffer=true] - Whether to resolve the color buffer or not. Only relevant for multisampled render targets.
|
|
9235
|
+
* @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not. Only relevant for multisampled render targets.
|
|
9236
|
+
* @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not. Only relevant for multisampled render targets.
|
|
9237
|
+
* @property {boolean} [storeMultisampledColorBuffer=true] - Whether to store the multisampled color buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
|
|
9238
|
+
* @property {boolean} [storeMultisampledDepthBuffer=true] - Whether to store the multisampled depth buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
|
|
9239
|
+
* @property {boolean} [storeMultisampledStencilBuffer=true] - Whether to store the multisampled stencil buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
|
|
9195
9240
|
* @property {?Texture} [depthTexture=null] - Reference to a depth texture.
|
|
9196
9241
|
* @property {number} [samples=0] - The MSAA samples count.
|
|
9197
9242
|
* @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.
|
|
@@ -9217,8 +9262,12 @@ class RenderTarget extends EventDispatcher {
|
|
|
9217
9262
|
minFilter: LinearFilter,
|
|
9218
9263
|
depthBuffer: true,
|
|
9219
9264
|
stencilBuffer: false,
|
|
9265
|
+
resolveColorBuffer: true,
|
|
9220
9266
|
resolveDepthBuffer: true,
|
|
9221
9267
|
resolveStencilBuffer: true,
|
|
9268
|
+
storeMultisampledColorBuffer: true,
|
|
9269
|
+
storeMultisampledDepthBuffer: true,
|
|
9270
|
+
storeMultisampledStencilBuffer: true,
|
|
9222
9271
|
depthTexture: null,
|
|
9223
9272
|
samples: 0,
|
|
9224
9273
|
count: 1,
|
|
@@ -9325,7 +9374,28 @@ class RenderTarget extends EventDispatcher {
|
|
|
9325
9374
|
this.stencilBuffer = options.stencilBuffer;
|
|
9326
9375
|
|
|
9327
9376
|
/**
|
|
9328
|
-
* Whether to resolve the
|
|
9377
|
+
* Whether to resolve the color buffer or not. When set to `false`, the color
|
|
9378
|
+
* attachments do not receive the resolved (single-sampled) output of a render
|
|
9379
|
+
* pass and the render target's textures are left untouched. The rendered
|
|
9380
|
+
* content is then only accessible within the render pass itself.
|
|
9381
|
+
*
|
|
9382
|
+
* Only relevant for multisampled render targets.
|
|
9383
|
+
*
|
|
9384
|
+
* @type {boolean}
|
|
9385
|
+
* @default true
|
|
9386
|
+
*/
|
|
9387
|
+
this.resolveColorBuffer = options.resolveColorBuffer;
|
|
9388
|
+
|
|
9389
|
+
/**
|
|
9390
|
+
* Whether to resolve the depth buffer or not. When set to `false`, the depth
|
|
9391
|
+
* texture does not receive the resolved depth output of a render pass which
|
|
9392
|
+
* saves memory bandwidth. Use this setting when the depth data of a render
|
|
9393
|
+
* pass are not required afterwards.
|
|
9394
|
+
*
|
|
9395
|
+
* Only relevant for multisampled render targets in WebGL. WebGPU does not
|
|
9396
|
+
* support depth resolves; sampling the depth texture of a multisampled render
|
|
9397
|
+
* target accesses the multisampled data directly, see
|
|
9398
|
+
* {@link RenderTarget#storeMultisampledDepthBuffer}.
|
|
9329
9399
|
*
|
|
9330
9400
|
* @type {boolean}
|
|
9331
9401
|
* @default true
|
|
@@ -9333,13 +9403,54 @@ class RenderTarget extends EventDispatcher {
|
|
|
9333
9403
|
this.resolveDepthBuffer = options.resolveDepthBuffer;
|
|
9334
9404
|
|
|
9335
9405
|
/**
|
|
9336
|
-
* Whether to resolve the stencil buffer or not.
|
|
9406
|
+
* Whether to resolve the stencil buffer or not. Analogous to
|
|
9407
|
+
* {@link RenderTarget#resolveDepthBuffer} but for the stencil aspect.
|
|
9337
9408
|
*
|
|
9338
9409
|
* @type {boolean}
|
|
9339
9410
|
* @default true
|
|
9340
9411
|
*/
|
|
9341
9412
|
this.resolveStencilBuffer = options.resolveStencilBuffer;
|
|
9342
9413
|
|
|
9414
|
+
/**
|
|
9415
|
+
* Whether to store the multisampled color buffer or not. When set to `false`,
|
|
9416
|
+
* the multisampled data are discarded at the end of a render pass, right after
|
|
9417
|
+
* they have been resolved. This saves memory bandwidth, especially on tile-based
|
|
9418
|
+
* GPUs, and is the recommended setting for render targets that are fully redrawn
|
|
9419
|
+
* each frame and whose output is only accessed via the resolved textures (e.g.
|
|
9420
|
+
* scene passes in post-processing chains).
|
|
9421
|
+
*
|
|
9422
|
+
* Must be kept `true` when the multisampled data are needed after the render
|
|
9423
|
+
* pass ends, e.g. when rendering into the target without clearing or when the
|
|
9424
|
+
* scene contains transmissive objects which require a mid-pass framebuffer copy.
|
|
9425
|
+
*
|
|
9426
|
+
* @type {boolean}
|
|
9427
|
+
* @default true
|
|
9428
|
+
*/
|
|
9429
|
+
this.storeMultisampledColorBuffer = options.storeMultisampledColorBuffer;
|
|
9430
|
+
|
|
9431
|
+
/**
|
|
9432
|
+
* Whether to store the multisampled depth buffer or not. When set to `false`,
|
|
9433
|
+
* the multisampled depth data are discarded at the end of a render pass which
|
|
9434
|
+
* saves memory bandwidth.
|
|
9435
|
+
*
|
|
9436
|
+
* Must be kept `true` in WebGPU when the depth texture of a multisampled render
|
|
9437
|
+
* target is sampled (e.g. by depth-based post-processing effects) since depth
|
|
9438
|
+
* is read directly from the multisampled data.
|
|
9439
|
+
*
|
|
9440
|
+
* @type {boolean}
|
|
9441
|
+
* @default true
|
|
9442
|
+
*/
|
|
9443
|
+
this.storeMultisampledDepthBuffer = options.storeMultisampledDepthBuffer;
|
|
9444
|
+
|
|
9445
|
+
/**
|
|
9446
|
+
* Whether to store the multisampled stencil buffer or not. Analogous to
|
|
9447
|
+
* {@link RenderTarget#storeMultisampledDepthBuffer} but for the stencil aspect.
|
|
9448
|
+
*
|
|
9449
|
+
* @type {boolean}
|
|
9450
|
+
* @default true
|
|
9451
|
+
*/
|
|
9452
|
+
this.storeMultisampledStencilBuffer = options.storeMultisampledStencilBuffer;
|
|
9453
|
+
|
|
9343
9454
|
this._depthTexture = null;
|
|
9344
9455
|
this.depthTexture = options.depthTexture;
|
|
9345
9456
|
|
|
@@ -9424,8 +9535,8 @@ class RenderTarget extends EventDispatcher {
|
|
|
9424
9535
|
|
|
9425
9536
|
set depthTexture( current ) {
|
|
9426
9537
|
|
|
9427
|
-
if ( this._depthTexture !== null ) this._depthTexture.renderTarget = null;
|
|
9428
|
-
if ( current !== null ) current.renderTarget = this;
|
|
9538
|
+
if ( this._depthTexture !== null && this._depthTexture.renderTarget === this ) this._depthTexture.renderTarget = null;
|
|
9539
|
+
if ( current !== null && current.renderTarget === null ) current.renderTarget = this;
|
|
9429
9540
|
|
|
9430
9541
|
this._depthTexture = current;
|
|
9431
9542
|
|
|
@@ -9528,17 +9639,37 @@ class RenderTarget extends EventDispatcher {
|
|
|
9528
9639
|
// ensure image object is not shared, see #20328
|
|
9529
9640
|
|
|
9530
9641
|
const image = Object.assign( {}, source.textures[ i ].image );
|
|
9531
|
-
this.textures[ i ].source = new
|
|
9642
|
+
this.textures[ i ].source = new TextureSource( image );
|
|
9532
9643
|
|
|
9533
9644
|
}
|
|
9534
9645
|
|
|
9535
9646
|
this.depthBuffer = source.depthBuffer;
|
|
9536
9647
|
this.stencilBuffer = source.stencilBuffer;
|
|
9537
9648
|
|
|
9649
|
+
this.resolveColorBuffer = source.resolveColorBuffer;
|
|
9538
9650
|
this.resolveDepthBuffer = source.resolveDepthBuffer;
|
|
9539
9651
|
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
9540
9652
|
|
|
9541
|
-
|
|
9653
|
+
this.storeMultisampledColorBuffer = source.storeMultisampledColorBuffer;
|
|
9654
|
+
this.storeMultisampledDepthBuffer = source.storeMultisampledDepthBuffer;
|
|
9655
|
+
this.storeMultisampledStencilBuffer = source.storeMultisampledStencilBuffer;
|
|
9656
|
+
|
|
9657
|
+
if ( source.depthTexture !== null ) {
|
|
9658
|
+
|
|
9659
|
+
if ( source.depthTexture.renderTarget === source ) {
|
|
9660
|
+
|
|
9661
|
+
const depthTexture = source.depthTexture.clone();
|
|
9662
|
+
depthTexture.renderTarget = null;
|
|
9663
|
+
|
|
9664
|
+
this.depthTexture = depthTexture;
|
|
9665
|
+
|
|
9666
|
+
} else {
|
|
9667
|
+
|
|
9668
|
+
this.depthTexture = source.depthTexture;
|
|
9669
|
+
|
|
9670
|
+
}
|
|
9671
|
+
|
|
9672
|
+
}
|
|
9542
9673
|
|
|
9543
9674
|
this.samples = source.samples;
|
|
9544
9675
|
this.multiview = source.multiview;
|
|
@@ -9697,6 +9828,22 @@ class DataArrayTexture extends Texture {
|
|
|
9697
9828
|
|
|
9698
9829
|
}
|
|
9699
9830
|
|
|
9831
|
+
/**
|
|
9832
|
+
* Copies the values of the given texture to this instance.
|
|
9833
|
+
*
|
|
9834
|
+
* @param {DataArrayTexture} source - The texture to copy.
|
|
9835
|
+
* @return {DataArrayTexture} A reference to this instance.
|
|
9836
|
+
*/
|
|
9837
|
+
copy( source ) {
|
|
9838
|
+
|
|
9839
|
+
super.copy( source );
|
|
9840
|
+
|
|
9841
|
+
this.wrapR = source.wrapR;
|
|
9842
|
+
|
|
9843
|
+
return this;
|
|
9844
|
+
|
|
9845
|
+
}
|
|
9846
|
+
|
|
9700
9847
|
/**
|
|
9701
9848
|
* Describes that a specific layer of the texture needs to be updated.
|
|
9702
9849
|
* Normally when {@link Texture#needsUpdate} is set to `true`, the
|
|
@@ -9873,6 +10020,22 @@ class Data3DTexture extends Texture {
|
|
|
9873
10020
|
|
|
9874
10021
|
}
|
|
9875
10022
|
|
|
10023
|
+
/**
|
|
10024
|
+
* Copies the values of the given texture to this instance.
|
|
10025
|
+
*
|
|
10026
|
+
* @param {Data3DTexture} source - The texture to copy.
|
|
10027
|
+
* @return {Data3DTexture} A reference to this instance.
|
|
10028
|
+
*/
|
|
10029
|
+
copy( source ) {
|
|
10030
|
+
|
|
10031
|
+
super.copy( source );
|
|
10032
|
+
|
|
10033
|
+
this.wrapR = source.wrapR;
|
|
10034
|
+
|
|
10035
|
+
return this;
|
|
10036
|
+
|
|
10037
|
+
}
|
|
10038
|
+
|
|
9876
10039
|
}
|
|
9877
10040
|
|
|
9878
10041
|
/**
|
|
@@ -10147,7 +10310,7 @@ class Matrix4 {
|
|
|
10147
10310
|
}
|
|
10148
10311
|
|
|
10149
10312
|
/**
|
|
10150
|
-
* Extracts the basis of this matrix into the three
|
|
10313
|
+
* Extracts the basis vectors of this matrix into the three vectors provided.
|
|
10151
10314
|
*
|
|
10152
10315
|
* @param {Vector3} xAxis - The basis's x axis.
|
|
10153
10316
|
* @param {Vector3} yAxis - The basis's y axis.
|
|
@@ -10539,8 +10702,6 @@ class Matrix4 {
|
|
|
10539
10702
|
/**
|
|
10540
10703
|
* Computes and returns the determinant of this matrix.
|
|
10541
10704
|
*
|
|
10542
|
-
* Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
|
|
10543
|
-
*
|
|
10544
10705
|
* @return {number} The determinant.
|
|
10545
10706
|
*/
|
|
10546
10707
|
determinant() {
|
|
@@ -10706,7 +10867,7 @@ class Matrix4 {
|
|
|
10706
10867
|
}
|
|
10707
10868
|
|
|
10708
10869
|
/**
|
|
10709
|
-
*
|
|
10870
|
+
* Scales each of the first three columns of this matrix by the corresponding component of the given vector.
|
|
10710
10871
|
*
|
|
10711
10872
|
* @param {Vector3} v - The scale vector.
|
|
10712
10873
|
* @return {Matrix4} A reference to this matrix.
|
|
@@ -10856,17 +11017,12 @@ class Matrix4 {
|
|
|
10856
11017
|
* Sets this matrix as a rotational transformation around the given axis by
|
|
10857
11018
|
* the given angle.
|
|
10858
11019
|
*
|
|
10859
|
-
* This is a somewhat controversial but mathematically sound alternative to
|
|
10860
|
-
* rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
|
|
10861
|
-
*
|
|
10862
11020
|
* @param {Vector3} axis - The normalized rotation axis.
|
|
10863
11021
|
* @param {number} angle - The rotation in radians.
|
|
10864
11022
|
* @return {Matrix4} A reference to this matrix.
|
|
10865
11023
|
*/
|
|
10866
11024
|
makeRotationAxis( axis, angle ) {
|
|
10867
11025
|
|
|
10868
|
-
// Based on http://www.gamedev.net/reference/articles/article1199.asp
|
|
10869
|
-
|
|
10870
11026
|
const c = Math.cos( angle );
|
|
10871
11027
|
const s = Math.sin( angle );
|
|
10872
11028
|
const t = 1 - c;
|
|
@@ -13537,6 +13693,17 @@ class Object3D extends EventDispatcher {
|
|
|
13537
13693
|
*/
|
|
13538
13694
|
raycast( /* raycaster, intersects */ ) {}
|
|
13539
13695
|
|
|
13696
|
+
/**
|
|
13697
|
+
* Abstract method to test whether this 3D object intersects the given frustum.
|
|
13698
|
+
* Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}
|
|
13699
|
+
* implement this method in order to use frustum culling.
|
|
13700
|
+
*
|
|
13701
|
+
* @abstract
|
|
13702
|
+
* @param {Frustum|FrustumArray} frustum - The frustum to test.
|
|
13703
|
+
* @return {boolean|undefined} Whether this 3D object intersects the given frustum or not.
|
|
13704
|
+
*/
|
|
13705
|
+
intersectsFrustum( /* frustum */ ) {}
|
|
13706
|
+
|
|
13540
13707
|
/**
|
|
13541
13708
|
* Executes the callback on this 3D object and all descendants.
|
|
13542
13709
|
*
|
|
@@ -13786,20 +13953,18 @@ class Object3D extends EventDispatcher {
|
|
|
13786
13953
|
object.uuid = this.uuid;
|
|
13787
13954
|
object.type = this.type;
|
|
13788
13955
|
|
|
13956
|
+
object.name = this.name;
|
|
13957
|
+
object.castShadow = this.castShadow;
|
|
13958
|
+
object.receiveShadow = this.receiveShadow;
|
|
13959
|
+
object.visible = this.visible;
|
|
13960
|
+
object.frustumCulled = this.frustumCulled;
|
|
13961
|
+
object.renderOrder = this.renderOrder;
|
|
13962
|
+
object.static = this.static;
|
|
13963
|
+
object.matrixAutoUpdate = this.matrixAutoUpdate;
|
|
13789
13964
|
// WITH_GENESYS
|
|
13790
13965
|
object.nodeId = this.nodeId;
|
|
13791
|
-
// !WITH_GENESYS
|
|
13792
|
-
|
|
13793
|
-
if ( this.name !== '' ) object.name = this.name;
|
|
13794
|
-
if ( this.castShadow === true ) object.castShadow = true;
|
|
13795
|
-
if ( this.receiveShadow === true ) object.receiveShadow = true;
|
|
13796
|
-
if ( this.visible === false ) object.visible = false;
|
|
13797
|
-
// WITH_GENESYS
|
|
13798
13966
|
if ( this.selfHidden === true ) object.selfHidden = true;
|
|
13799
13967
|
// !WITH_GENESYS
|
|
13800
|
-
if ( this.frustumCulled === false ) object.frustumCulled = false;
|
|
13801
|
-
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
|
|
13802
|
-
if ( this.static !== false ) object.static = this.static;
|
|
13803
13968
|
if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
|
|
13804
13969
|
|
|
13805
13970
|
object.layers = this.layers.mask;
|
|
@@ -13808,8 +13973,6 @@ class Object3D extends EventDispatcher {
|
|
|
13808
13973
|
|
|
13809
13974
|
if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
|
|
13810
13975
|
|
|
13811
|
-
if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
|
|
13812
|
-
|
|
13813
13976
|
if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
|
|
13814
13977
|
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();
|
|
13815
13978
|
|
|
@@ -14131,6 +14294,27 @@ class Object3D extends EventDispatcher {
|
|
|
14131
14294
|
|
|
14132
14295
|
}
|
|
14133
14296
|
|
|
14297
|
+
/**
|
|
14298
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
14299
|
+
* method whenever this instance is no longer used in your app.
|
|
14300
|
+
*
|
|
14301
|
+
* Geometries, materials and textures are potentially shared with other
|
|
14302
|
+
* 3D objects and must be disposed of separately.
|
|
14303
|
+
*
|
|
14304
|
+
* @fires Object3D#dispose
|
|
14305
|
+
*/
|
|
14306
|
+
dispose() {
|
|
14307
|
+
|
|
14308
|
+
/**
|
|
14309
|
+
* Fires when the 3D object has been disposed of.
|
|
14310
|
+
*
|
|
14311
|
+
* @event Object3D#dispose
|
|
14312
|
+
* @type {Object}
|
|
14313
|
+
*/
|
|
14314
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
14315
|
+
|
|
14316
|
+
}
|
|
14317
|
+
|
|
14134
14318
|
}
|
|
14135
14319
|
|
|
14136
14320
|
/**
|
|
@@ -15923,11 +16107,11 @@ class Scene extends Object3D {
|
|
|
15923
16107
|
|
|
15924
16108
|
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
|
|
15925
16109
|
|
|
15926
|
-
|
|
15927
|
-
|
|
16110
|
+
data.object.backgroundBlurriness = this.backgroundBlurriness;
|
|
16111
|
+
data.object.backgroundIntensity = this.backgroundIntensity;
|
|
15928
16112
|
data.object.backgroundRotation = this.backgroundRotation.toArray();
|
|
15929
16113
|
|
|
15930
|
-
|
|
16114
|
+
data.object.environmentIntensity = this.environmentIntensity;
|
|
15931
16115
|
data.object.environmentRotation = this.environmentRotation.toArray();
|
|
15932
16116
|
|
|
15933
16117
|
return data;
|
|
@@ -16028,8 +16212,6 @@ class Triangle {
|
|
|
16028
16212
|
*/
|
|
16029
16213
|
static getBarycoord( point, a, b, c, target ) {
|
|
16030
16214
|
|
|
16031
|
-
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
|
|
16032
|
-
|
|
16033
16215
|
_v0$2.subVectors( c, a );
|
|
16034
16216
|
_v1$5.subVectors( b, a );
|
|
16035
16217
|
_v2$4.subVectors( point, a );
|
|
@@ -18152,8 +18334,9 @@ class BufferAttribute extends EventDispatcher {
|
|
|
18152
18334
|
normalized: this.normalized
|
|
18153
18335
|
};
|
|
18154
18336
|
|
|
18155
|
-
|
|
18156
|
-
|
|
18337
|
+
data.name = this.name;
|
|
18338
|
+
data.usage = this.usage;
|
|
18339
|
+
data.gpuType = this.gpuType;
|
|
18157
18340
|
|
|
18158
18341
|
return data;
|
|
18159
18342
|
|
|
@@ -20169,7 +20352,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
20169
20352
|
|
|
20170
20353
|
data.uuid = this.uuid;
|
|
20171
20354
|
data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
|
|
20172
|
-
|
|
20355
|
+
data.name = this.name;
|
|
20173
20356
|
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
|
|
20174
20357
|
|
|
20175
20358
|
if ( this.parameters !== undefined && this._transformed !== true ) {
|
|
@@ -20681,13 +20864,17 @@ class InterleavedBuffer {
|
|
|
20681
20864
|
|
|
20682
20865
|
//
|
|
20683
20866
|
|
|
20684
|
-
|
|
20867
|
+
const json = {
|
|
20685
20868
|
uuid: this.uuid,
|
|
20686
20869
|
buffer: this.array.buffer._uuid,
|
|
20687
20870
|
type: this.array.constructor.name,
|
|
20688
20871
|
stride: this.stride
|
|
20689
20872
|
};
|
|
20690
20873
|
|
|
20874
|
+
json.usage = this.usage;
|
|
20875
|
+
|
|
20876
|
+
return json;
|
|
20877
|
+
|
|
20691
20878
|
}
|
|
20692
20879
|
|
|
20693
20880
|
}
|
|
@@ -21234,6 +21421,399 @@ class InterleavedBufferAttribute {
|
|
|
21234
21421
|
|
|
21235
21422
|
}
|
|
21236
21423
|
|
|
21424
|
+
const _vector1 = /*@__PURE__*/ new Vector3();
|
|
21425
|
+
const _vector2 = /*@__PURE__*/ new Vector3();
|
|
21426
|
+
const _normalMatrix = /*@__PURE__*/ new Matrix3();
|
|
21427
|
+
|
|
21428
|
+
/**
|
|
21429
|
+
* A two dimensional surface that extends infinitely in 3D space, represented
|
|
21430
|
+
* in [Hessian normal form](https://mathworld.wolfram.com/HessianNormalForm.html)
|
|
21431
|
+
* by a unit length normal vector and a constant.
|
|
21432
|
+
*/
|
|
21433
|
+
class Plane {
|
|
21434
|
+
|
|
21435
|
+
/**
|
|
21436
|
+
* Constructs a new plane.
|
|
21437
|
+
*
|
|
21438
|
+
* @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
|
|
21439
|
+
* @param {number} [constant=0] - The signed distance from the origin to the plane.
|
|
21440
|
+
*/
|
|
21441
|
+
constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
|
|
21442
|
+
|
|
21443
|
+
/**
|
|
21444
|
+
* This flag can be used for type testing.
|
|
21445
|
+
*
|
|
21446
|
+
* @type {boolean}
|
|
21447
|
+
* @readonly
|
|
21448
|
+
* @default true
|
|
21449
|
+
*/
|
|
21450
|
+
this.isPlane = true;
|
|
21451
|
+
|
|
21452
|
+
/**
|
|
21453
|
+
* A unit length vector defining the normal of the plane.
|
|
21454
|
+
*
|
|
21455
|
+
* @type {Vector3}
|
|
21456
|
+
*/
|
|
21457
|
+
this.normal = normal;
|
|
21458
|
+
|
|
21459
|
+
/**
|
|
21460
|
+
* The signed distance from the origin to the plane.
|
|
21461
|
+
*
|
|
21462
|
+
* @type {number}
|
|
21463
|
+
* @default 0
|
|
21464
|
+
*/
|
|
21465
|
+
this.constant = constant;
|
|
21466
|
+
|
|
21467
|
+
}
|
|
21468
|
+
|
|
21469
|
+
/**
|
|
21470
|
+
* Sets the plane components by copying the given values.
|
|
21471
|
+
*
|
|
21472
|
+
* @param {Vector3} normal - The normal.
|
|
21473
|
+
* @param {number} constant - The constant.
|
|
21474
|
+
* @return {Plane} A reference to this plane.
|
|
21475
|
+
*/
|
|
21476
|
+
set( normal, constant ) {
|
|
21477
|
+
|
|
21478
|
+
this.normal.copy( normal );
|
|
21479
|
+
this.constant = constant;
|
|
21480
|
+
|
|
21481
|
+
return this;
|
|
21482
|
+
|
|
21483
|
+
}
|
|
21484
|
+
|
|
21485
|
+
/**
|
|
21486
|
+
* Sets the plane components by defining `x`, `y`, `z` as the
|
|
21487
|
+
* plane normal and `w` as the constant.
|
|
21488
|
+
*
|
|
21489
|
+
* @param {number} x - The value for the normal's x component.
|
|
21490
|
+
* @param {number} y - The value for the normal's y component.
|
|
21491
|
+
* @param {number} z - The value for the normal's z component.
|
|
21492
|
+
* @param {number} w - The constant value.
|
|
21493
|
+
* @return {Plane} A reference to this plane.
|
|
21494
|
+
*/
|
|
21495
|
+
setComponents( x, y, z, w ) {
|
|
21496
|
+
|
|
21497
|
+
this.normal.set( x, y, z );
|
|
21498
|
+
this.constant = w;
|
|
21499
|
+
|
|
21500
|
+
return this;
|
|
21501
|
+
|
|
21502
|
+
}
|
|
21503
|
+
|
|
21504
|
+
/**
|
|
21505
|
+
* Sets the plane from the given normal and coplanar point (that is a point
|
|
21506
|
+
* that lies onto the plane).
|
|
21507
|
+
*
|
|
21508
|
+
* @param {Vector3} normal - The normal.
|
|
21509
|
+
* @param {Vector3} point - A coplanar point.
|
|
21510
|
+
* @return {Plane} A reference to this plane.
|
|
21511
|
+
*/
|
|
21512
|
+
setFromNormalAndCoplanarPoint( normal, point ) {
|
|
21513
|
+
|
|
21514
|
+
this.normal.copy( normal );
|
|
21515
|
+
this.constant = - point.dot( this.normal );
|
|
21516
|
+
|
|
21517
|
+
return this;
|
|
21518
|
+
|
|
21519
|
+
}
|
|
21520
|
+
|
|
21521
|
+
/**
|
|
21522
|
+
* Sets the plane from three coplanar points. The winding order is
|
|
21523
|
+
* assumed to be counter-clockwise, and determines the direction of
|
|
21524
|
+
* the plane normal.
|
|
21525
|
+
*
|
|
21526
|
+
* @param {Vector3} a - The first coplanar point.
|
|
21527
|
+
* @param {Vector3} b - The second coplanar point.
|
|
21528
|
+
* @param {Vector3} c - The third coplanar point.
|
|
21529
|
+
* @return {Plane} A reference to this plane.
|
|
21530
|
+
*/
|
|
21531
|
+
setFromCoplanarPoints( a, b, c ) {
|
|
21532
|
+
|
|
21533
|
+
const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
|
|
21534
|
+
|
|
21535
|
+
// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
|
|
21536
|
+
|
|
21537
|
+
this.setFromNormalAndCoplanarPoint( normal, a );
|
|
21538
|
+
|
|
21539
|
+
return this;
|
|
21540
|
+
|
|
21541
|
+
}
|
|
21542
|
+
|
|
21543
|
+
/**
|
|
21544
|
+
* Copies the values of the given plane to this instance.
|
|
21545
|
+
*
|
|
21546
|
+
* @param {Plane} plane - The plane to copy.
|
|
21547
|
+
* @return {Plane} A reference to this plane.
|
|
21548
|
+
*/
|
|
21549
|
+
copy( plane ) {
|
|
21550
|
+
|
|
21551
|
+
this.normal.copy( plane.normal );
|
|
21552
|
+
this.constant = plane.constant;
|
|
21553
|
+
|
|
21554
|
+
return this;
|
|
21555
|
+
|
|
21556
|
+
}
|
|
21557
|
+
|
|
21558
|
+
/**
|
|
21559
|
+
* Normalizes the plane normal and adjusts the constant accordingly.
|
|
21560
|
+
*
|
|
21561
|
+
* @return {Plane} A reference to this plane.
|
|
21562
|
+
*/
|
|
21563
|
+
normalize() {
|
|
21564
|
+
|
|
21565
|
+
// Note: will lead to a divide by zero if the plane is invalid.
|
|
21566
|
+
|
|
21567
|
+
const inverseNormalLength = 1.0 / this.normal.length();
|
|
21568
|
+
this.normal.multiplyScalar( inverseNormalLength );
|
|
21569
|
+
this.constant *= inverseNormalLength;
|
|
21570
|
+
|
|
21571
|
+
return this;
|
|
21572
|
+
|
|
21573
|
+
}
|
|
21574
|
+
|
|
21575
|
+
/**
|
|
21576
|
+
* Negates both the plane normal and the constant.
|
|
21577
|
+
*
|
|
21578
|
+
* @return {Plane} A reference to this plane.
|
|
21579
|
+
*/
|
|
21580
|
+
negate() {
|
|
21581
|
+
|
|
21582
|
+
this.constant *= -1;
|
|
21583
|
+
this.normal.negate();
|
|
21584
|
+
|
|
21585
|
+
return this;
|
|
21586
|
+
|
|
21587
|
+
}
|
|
21588
|
+
|
|
21589
|
+
/**
|
|
21590
|
+
* Returns the signed distance from the given point to this plane.
|
|
21591
|
+
*
|
|
21592
|
+
* @param {Vector3} point - The point to compute the distance for.
|
|
21593
|
+
* @return {number} The signed distance.
|
|
21594
|
+
*/
|
|
21595
|
+
distanceToPoint( point ) {
|
|
21596
|
+
|
|
21597
|
+
return this.normal.dot( point ) + this.constant;
|
|
21598
|
+
|
|
21599
|
+
}
|
|
21600
|
+
|
|
21601
|
+
/**
|
|
21602
|
+
* Returns the signed distance from the given sphere to this plane.
|
|
21603
|
+
*
|
|
21604
|
+
* @param {Sphere} sphere - The sphere to compute the distance for.
|
|
21605
|
+
* @return {number} The signed distance.
|
|
21606
|
+
*/
|
|
21607
|
+
distanceToSphere( sphere ) {
|
|
21608
|
+
|
|
21609
|
+
return this.distanceToPoint( sphere.center ) - sphere.radius;
|
|
21610
|
+
|
|
21611
|
+
}
|
|
21612
|
+
|
|
21613
|
+
/**
|
|
21614
|
+
* Projects a the given point onto the plane.
|
|
21615
|
+
*
|
|
21616
|
+
* @param {Vector3} point - The point to project.
|
|
21617
|
+
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
21618
|
+
* @return {Vector3} The projected point on the plane.
|
|
21619
|
+
*/
|
|
21620
|
+
projectPoint( point, target ) {
|
|
21621
|
+
|
|
21622
|
+
return target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );
|
|
21623
|
+
|
|
21624
|
+
}
|
|
21625
|
+
|
|
21626
|
+
/**
|
|
21627
|
+
* Returns the intersection point of the passed line and the plane. Returns
|
|
21628
|
+
* `null` if the line does not intersect. Returns the line's starting point if
|
|
21629
|
+
* the line is coplanar with the plane.
|
|
21630
|
+
*
|
|
21631
|
+
* @param {Line3} line - The line to compute the intersection for.
|
|
21632
|
+
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
21633
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
21634
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
21635
|
+
*/
|
|
21636
|
+
intersectLine( line, target, clampToLine = true ) {
|
|
21637
|
+
|
|
21638
|
+
const direction = line.delta( _vector1 );
|
|
21639
|
+
|
|
21640
|
+
const denominator = this.normal.dot( direction );
|
|
21641
|
+
|
|
21642
|
+
if ( denominator === 0 ) {
|
|
21643
|
+
|
|
21644
|
+
// line is coplanar, return origin
|
|
21645
|
+
if ( this.distanceToPoint( line.start ) === 0 ) {
|
|
21646
|
+
|
|
21647
|
+
return target.copy( line.start );
|
|
21648
|
+
|
|
21649
|
+
}
|
|
21650
|
+
|
|
21651
|
+
// Unsure if this is the correct method to handle this case.
|
|
21652
|
+
return null;
|
|
21653
|
+
|
|
21654
|
+
}
|
|
21655
|
+
|
|
21656
|
+
const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
|
|
21657
|
+
|
|
21658
|
+
if ( ( clampToLine === true ) && ( t < 0 || t > 1 ) ) {
|
|
21659
|
+
|
|
21660
|
+
return null;
|
|
21661
|
+
|
|
21662
|
+
}
|
|
21663
|
+
|
|
21664
|
+
return target.copy( line.start ).addScaledVector( direction, t );
|
|
21665
|
+
|
|
21666
|
+
}
|
|
21667
|
+
|
|
21668
|
+
/**
|
|
21669
|
+
* Returns `true` if the given line segment intersects with (passes through) the plane.
|
|
21670
|
+
*
|
|
21671
|
+
* @param {Line3} line - The line to test.
|
|
21672
|
+
* @return {boolean} Whether the given line segment intersects with the plane or not.
|
|
21673
|
+
*/
|
|
21674
|
+
intersectsLine( line ) {
|
|
21675
|
+
|
|
21676
|
+
// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
|
|
21677
|
+
|
|
21678
|
+
const startSign = this.distanceToPoint( line.start );
|
|
21679
|
+
const endSign = this.distanceToPoint( line.end );
|
|
21680
|
+
|
|
21681
|
+
return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
|
|
21682
|
+
|
|
21683
|
+
}
|
|
21684
|
+
|
|
21685
|
+
/**
|
|
21686
|
+
* Returns `true` if the given bounding box intersects with the plane.
|
|
21687
|
+
*
|
|
21688
|
+
* @param {Box3} box - The bounding box to test.
|
|
21689
|
+
* @return {boolean} Whether the given bounding box intersects with the plane or not.
|
|
21690
|
+
*/
|
|
21691
|
+
intersectsBox( box ) {
|
|
21692
|
+
|
|
21693
|
+
return box.intersectsPlane( this );
|
|
21694
|
+
|
|
21695
|
+
}
|
|
21696
|
+
|
|
21697
|
+
/**
|
|
21698
|
+
* Returns `true` if the given bounding sphere intersects with the plane.
|
|
21699
|
+
*
|
|
21700
|
+
* @param {Sphere} sphere - The bounding sphere to test.
|
|
21701
|
+
* @return {boolean} Whether the given bounding sphere intersects with the plane or not.
|
|
21702
|
+
*/
|
|
21703
|
+
intersectsSphere( sphere ) {
|
|
21704
|
+
|
|
21705
|
+
return sphere.intersectsPlane( this );
|
|
21706
|
+
|
|
21707
|
+
}
|
|
21708
|
+
|
|
21709
|
+
/**
|
|
21710
|
+
* Returns a coplanar vector to the plane, by calculating the
|
|
21711
|
+
* projection of the normal at the origin onto the plane.
|
|
21712
|
+
*
|
|
21713
|
+
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
21714
|
+
* @return {Vector3} The coplanar point.
|
|
21715
|
+
*/
|
|
21716
|
+
coplanarPoint( target ) {
|
|
21717
|
+
|
|
21718
|
+
return target.copy( this.normal ).multiplyScalar( - this.constant );
|
|
21719
|
+
|
|
21720
|
+
}
|
|
21721
|
+
|
|
21722
|
+
/**
|
|
21723
|
+
* Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
|
|
21724
|
+
*
|
|
21725
|
+
* The optional normal matrix can be pre-computed like so:
|
|
21726
|
+
* ```js
|
|
21727
|
+
* const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
|
|
21728
|
+
* ```
|
|
21729
|
+
*
|
|
21730
|
+
* @param {Matrix4} matrix - The transformation matrix.
|
|
21731
|
+
* @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
|
|
21732
|
+
* @return {Plane} A reference to this plane.
|
|
21733
|
+
*/
|
|
21734
|
+
applyMatrix4( matrix, optionalNormalMatrix ) {
|
|
21735
|
+
|
|
21736
|
+
const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
|
|
21737
|
+
|
|
21738
|
+
const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
|
|
21739
|
+
|
|
21740
|
+
const normal = this.normal.applyMatrix3( normalMatrix ).normalize();
|
|
21741
|
+
|
|
21742
|
+
this.constant = - referencePoint.dot( normal );
|
|
21743
|
+
|
|
21744
|
+
return this;
|
|
21745
|
+
|
|
21746
|
+
}
|
|
21747
|
+
|
|
21748
|
+
/**
|
|
21749
|
+
* Translates the plane by the distance defined by the given offset vector.
|
|
21750
|
+
* Note that this only affects the plane constant and will not affect the normal vector.
|
|
21751
|
+
*
|
|
21752
|
+
* @param {Vector3} offset - The offset vector.
|
|
21753
|
+
* @return {Plane} A reference to this plane.
|
|
21754
|
+
*/
|
|
21755
|
+
translate( offset ) {
|
|
21756
|
+
|
|
21757
|
+
this.constant -= offset.dot( this.normal );
|
|
21758
|
+
|
|
21759
|
+
return this;
|
|
21760
|
+
|
|
21761
|
+
}
|
|
21762
|
+
|
|
21763
|
+
/**
|
|
21764
|
+
* Returns `true` if this plane is equal with the given one.
|
|
21765
|
+
*
|
|
21766
|
+
* @param {Plane} plane - The plane to test for equality.
|
|
21767
|
+
* @return {boolean} Whether this plane is equal with the given one.
|
|
21768
|
+
*/
|
|
21769
|
+
equals( plane ) {
|
|
21770
|
+
|
|
21771
|
+
return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
|
|
21772
|
+
|
|
21773
|
+
}
|
|
21774
|
+
|
|
21775
|
+
/**
|
|
21776
|
+
* Returns a new plane with copied values from this instance.
|
|
21777
|
+
*
|
|
21778
|
+
* @return {Plane} A clone of this instance.
|
|
21779
|
+
*/
|
|
21780
|
+
clone() {
|
|
21781
|
+
|
|
21782
|
+
return new this.constructor().copy( this );
|
|
21783
|
+
|
|
21784
|
+
}
|
|
21785
|
+
|
|
21786
|
+
/**
|
|
21787
|
+
* Returns a serialized structure of the plane.
|
|
21788
|
+
*
|
|
21789
|
+
* @return {Object} Serialized structure with fields representing the object state.
|
|
21790
|
+
*/
|
|
21791
|
+
toJSON() {
|
|
21792
|
+
|
|
21793
|
+
return {
|
|
21794
|
+
normal: this.normal.toArray(),
|
|
21795
|
+
constant: this.constant
|
|
21796
|
+
};
|
|
21797
|
+
|
|
21798
|
+
}
|
|
21799
|
+
|
|
21800
|
+
/**
|
|
21801
|
+
* Sets the plane properties from the given JSON.
|
|
21802
|
+
*
|
|
21803
|
+
* @param {Object} json - The serialized json to set the plane from.
|
|
21804
|
+
* @return {Plane} A reference to this plane.
|
|
21805
|
+
*/
|
|
21806
|
+
fromJSON( json ) {
|
|
21807
|
+
|
|
21808
|
+
this.normal.fromArray( json.normal );
|
|
21809
|
+
this.constant = json.constant;
|
|
21810
|
+
|
|
21811
|
+
return this;
|
|
21812
|
+
|
|
21813
|
+
}
|
|
21814
|
+
|
|
21815
|
+
}
|
|
21816
|
+
|
|
21237
21817
|
let _materialId = 0;
|
|
21238
21818
|
|
|
21239
21819
|
/**
|
|
@@ -21857,10 +22437,61 @@ class Material extends EventDispatcher {
|
|
|
21857
22437
|
};
|
|
21858
22438
|
|
|
21859
22439
|
// standard Material serialization
|
|
22440
|
+
|
|
21860
22441
|
data.uuid = this.uuid;
|
|
21861
22442
|
data.type = this.type;
|
|
21862
22443
|
|
|
21863
|
-
|
|
22444
|
+
data.blending = this.blending;
|
|
22445
|
+
data.side = this.side;
|
|
22446
|
+
data.shadowSide = this.shadowSide;
|
|
22447
|
+
data.vertexColors = this.vertexColors;
|
|
22448
|
+
|
|
22449
|
+
data.opacity = this.opacity;
|
|
22450
|
+
data.transparent = this.transparent;
|
|
22451
|
+
|
|
22452
|
+
data.blendSrc = this.blendSrc;
|
|
22453
|
+
data.blendDst = this.blendDst;
|
|
22454
|
+
data.blendEquation = this.blendEquation;
|
|
22455
|
+
data.blendSrcAlpha = this.blendSrcAlpha;
|
|
22456
|
+
data.blendDstAlpha = this.blendDstAlpha;
|
|
22457
|
+
data.blendEquationAlpha = this.blendEquationAlpha;
|
|
22458
|
+
data.blendColor = this.blendColor.getHex();
|
|
22459
|
+
data.blendAlpha = this.blendAlpha;
|
|
22460
|
+
|
|
22461
|
+
data.depthFunc = this.depthFunc;
|
|
22462
|
+
data.depthTest = this.depthTest;
|
|
22463
|
+
data.depthWrite = this.depthWrite;
|
|
22464
|
+
data.colorWrite = this.colorWrite;
|
|
22465
|
+
|
|
22466
|
+
data.clipIntersection = this.clipIntersection;
|
|
22467
|
+
data.clipShadows = this.clipShadows;
|
|
22468
|
+
|
|
22469
|
+
data.stencilWriteMask = this.stencilWriteMask;
|
|
22470
|
+
data.stencilFunc = this.stencilFunc;
|
|
22471
|
+
data.stencilRef = this.stencilRef;
|
|
22472
|
+
data.stencilFuncMask = this.stencilFuncMask;
|
|
22473
|
+
data.stencilFail = this.stencilFail;
|
|
22474
|
+
data.stencilZFail = this.stencilZFail;
|
|
22475
|
+
data.stencilZPass = this.stencilZPass;
|
|
22476
|
+
data.stencilWrite = this.stencilWrite;
|
|
22477
|
+
|
|
22478
|
+
data.polygonOffset = this.polygonOffset;
|
|
22479
|
+
data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
22480
|
+
data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
22481
|
+
|
|
22482
|
+
data.dithering = this.dithering;
|
|
22483
|
+
|
|
22484
|
+
data.alphaTest = this.alphaTest;
|
|
22485
|
+
data.alphaHash = this.alphaHash;
|
|
22486
|
+
data.alphaToCoverage = this.alphaToCoverage;
|
|
22487
|
+
data.premultipliedAlpha = this.premultipliedAlpha;
|
|
22488
|
+
data.forceSinglePass = this.forceSinglePass;
|
|
22489
|
+
data.allowOverride = this.allowOverride;
|
|
22490
|
+
|
|
22491
|
+
data.visible = this.visible;
|
|
22492
|
+
data.toneMapped = this.toneMapped;
|
|
22493
|
+
|
|
22494
|
+
data.name = this.name;
|
|
21864
22495
|
|
|
21865
22496
|
if ( this.color && this.color.isColor ) data.color = this.color.getHex();
|
|
21866
22497
|
|
|
@@ -21871,7 +22502,7 @@ class Material extends EventDispatcher {
|
|
|
21871
22502
|
if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
|
|
21872
22503
|
if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
|
|
21873
22504
|
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
|
|
21874
|
-
if ( this.emissiveIntensity !== undefined
|
|
22505
|
+
if ( this.emissiveIntensity !== undefined ) data.emissiveIntensity = this.emissiveIntensity;
|
|
21875
22506
|
|
|
21876
22507
|
if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
|
|
21877
22508
|
if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
|
|
@@ -21912,6 +22543,7 @@ class Material extends EventDispatcher {
|
|
|
21912
22543
|
}
|
|
21913
22544
|
|
|
21914
22545
|
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
22546
|
+
if ( this.retroreflectivity !== undefined ) data.retroreflectivity = this.retroreflectivity;
|
|
21915
22547
|
|
|
21916
22548
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
21917
22549
|
if ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;
|
|
@@ -22010,76 +22642,39 @@ class Material extends EventDispatcher {
|
|
|
22010
22642
|
if ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;
|
|
22011
22643
|
if ( this.thickness !== undefined ) data.thickness = this.thickness;
|
|
22012
22644
|
if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
|
|
22013
|
-
if ( this.attenuationDistance !== undefined
|
|
22645
|
+
if ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;
|
|
22014
22646
|
if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
|
|
22015
22647
|
|
|
22016
22648
|
if ( this.size !== undefined ) data.size = this.size;
|
|
22017
|
-
if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
|
|
22018
22649
|
if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;
|
|
22019
22650
|
|
|
22020
|
-
if ( this.
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
22025
|
-
if ( this.transparent === true ) data.transparent = true;
|
|
22026
|
-
|
|
22027
|
-
if ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;
|
|
22028
|
-
if ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;
|
|
22029
|
-
if ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;
|
|
22030
|
-
if ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;
|
|
22031
|
-
if ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;
|
|
22032
|
-
if ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;
|
|
22033
|
-
if ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();
|
|
22034
|
-
if ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;
|
|
22035
|
-
|
|
22036
|
-
if ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;
|
|
22037
|
-
if ( this.depthTest === false ) data.depthTest = this.depthTest;
|
|
22038
|
-
if ( this.depthWrite === false ) data.depthWrite = this.depthWrite;
|
|
22039
|
-
if ( this.colorWrite === false ) data.colorWrite = this.colorWrite;
|
|
22040
|
-
|
|
22041
|
-
if ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;
|
|
22042
|
-
if ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;
|
|
22043
|
-
if ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;
|
|
22044
|
-
if ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;
|
|
22045
|
-
if ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;
|
|
22046
|
-
if ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;
|
|
22047
|
-
if ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;
|
|
22048
|
-
if ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;
|
|
22651
|
+
if ( Array.isArray( this.clippingPlanes ) && this.clippingPlanes.length > 0 ) {
|
|
22652
|
+
|
|
22653
|
+
data.clippingPlanes = this.clippingPlanes.map( plane => plane.toJSON() );
|
|
22654
|
+
|
|
22655
|
+
}
|
|
22049
22656
|
|
|
22050
22657
|
// rotation (SpriteMaterial)
|
|
22051
|
-
if ( this.rotation !== undefined
|
|
22658
|
+
if ( this.rotation !== undefined ) data.rotation = this.rotation;
|
|
22052
22659
|
|
|
22053
|
-
|
|
22054
|
-
if ( this.
|
|
22055
|
-
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
22660
|
+
// depthPacking (MeshDepthMaterial)
|
|
22661
|
+
if ( this.depthPacking !== undefined ) data.depthPacking = this.depthPacking;
|
|
22056
22662
|
|
|
22057
|
-
if ( this.linewidth !== undefined
|
|
22663
|
+
if ( this.linewidth !== undefined ) data.linewidth = this.linewidth;
|
|
22664
|
+
if ( this.linecap !== undefined ) data.linecap = this.linecap;
|
|
22665
|
+
if ( this.linejoin !== undefined ) data.linejoin = this.linejoin;
|
|
22058
22666
|
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
|
|
22059
22667
|
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
|
|
22060
22668
|
if ( this.scale !== undefined ) data.scale = this.scale;
|
|
22061
22669
|
|
|
22062
|
-
if ( this.
|
|
22063
|
-
|
|
22064
|
-
if ( this.
|
|
22065
|
-
if ( this.
|
|
22066
|
-
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
|
|
22067
|
-
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
|
|
22068
|
-
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
|
|
22069
|
-
if ( this.allowOverride === false ) data.allowOverride = false;
|
|
22670
|
+
if ( this.wireframe !== undefined ) data.wireframe = this.wireframe;
|
|
22671
|
+
if ( this.wireframeLinewidth !== undefined ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
22672
|
+
if ( this.wireframeLinecap !== undefined ) data.wireframeLinecap = this.wireframeLinecap;
|
|
22673
|
+
if ( this.wireframeLinejoin !== undefined ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
22070
22674
|
|
|
22071
|
-
if ( this.
|
|
22072
|
-
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
22073
|
-
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
|
|
22074
|
-
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
22675
|
+
if ( this.flatShading !== undefined ) data.flatShading = this.flatShading;
|
|
22075
22676
|
|
|
22076
|
-
if ( this.
|
|
22077
|
-
|
|
22078
|
-
if ( this.visible === false ) data.visible = false;
|
|
22079
|
-
|
|
22080
|
-
if ( this.toneMapped === false ) data.toneMapped = false;
|
|
22081
|
-
|
|
22082
|
-
if ( this.fog === false ) data.fog = false;
|
|
22677
|
+
if ( this.fog !== undefined ) data.fog = this.fog;
|
|
22083
22678
|
|
|
22084
22679
|
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
|
|
22085
22680
|
|
|
@@ -22140,6 +22735,7 @@ class Material extends EventDispatcher {
|
|
|
22140
22735
|
if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
|
|
22141
22736
|
if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
|
|
22142
22737
|
if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
|
|
22738
|
+
if ( json.retroreflectivity !== undefined ) this.retroreflectivity = json.retroreflectivity;
|
|
22143
22739
|
if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
|
|
22144
22740
|
if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
|
|
22145
22741
|
if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
|
|
@@ -22163,6 +22759,10 @@ class Material extends EventDispatcher {
|
|
|
22163
22759
|
if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
|
|
22164
22760
|
if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
|
|
22165
22761
|
if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
|
|
22762
|
+
if ( json.clippingPlanes !== undefined ) this.clippingPlanes = json.clippingPlanes.map( plane => new Plane().fromJSON( plane ) );
|
|
22763
|
+
if ( json.clipIntersection !== undefined ) this.clipIntersection = json.clipIntersection;
|
|
22764
|
+
if ( json.clipShadows !== undefined ) this.clipShadows = json.clipShadows;
|
|
22765
|
+
if ( json.depthPacking !== undefined ) this.depthPacking = json.depthPacking;
|
|
22166
22766
|
if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
|
|
22167
22767
|
if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
|
|
22168
22768
|
if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
|
|
@@ -22188,6 +22788,8 @@ class Material extends EventDispatcher {
|
|
|
22188
22788
|
if ( json.rotation !== undefined ) this.rotation = json.rotation;
|
|
22189
22789
|
|
|
22190
22790
|
if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
|
|
22791
|
+
if ( json.linecap !== undefined ) this.linecap = json.linecap;
|
|
22792
|
+
if ( json.linejoin !== undefined ) this.linejoin = json.linejoin;
|
|
22191
22793
|
if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
|
|
22192
22794
|
if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
|
|
22193
22795
|
if ( json.scale !== undefined ) this.scale = json.scale;
|
|
@@ -22688,6 +23290,18 @@ class Sprite extends Object3D {
|
|
|
22688
23290
|
|
|
22689
23291
|
}
|
|
22690
23292
|
|
|
23293
|
+
/**
|
|
23294
|
+
* Returns `true` if this sprite intersects the given frustum.
|
|
23295
|
+
*
|
|
23296
|
+
* @param {Frustum|FrustumArray} frustum - The frustum to test.
|
|
23297
|
+
* @return {boolean} Whether this sprite intersects the given frustum or not.
|
|
23298
|
+
*/
|
|
23299
|
+
intersectsFrustum( frustum ) {
|
|
23300
|
+
|
|
23301
|
+
return frustum.intersectsSprite( this );
|
|
23302
|
+
|
|
23303
|
+
}
|
|
23304
|
+
|
|
22691
23305
|
/**
|
|
22692
23306
|
* Computes intersection points between a casted ray and this sprite.
|
|
22693
23307
|
*
|
|
@@ -23110,7 +23724,7 @@ class LOD extends Object3D {
|
|
|
23110
23724
|
|
|
23111
23725
|
const data = super.toJSON( meta );
|
|
23112
23726
|
|
|
23113
|
-
|
|
23727
|
+
data.object.autoUpdate = this.autoUpdate;
|
|
23114
23728
|
|
|
23115
23729
|
data.object.levels = [];
|
|
23116
23730
|
|
|
@@ -23139,10 +23753,6 @@ const _segCenter = /*@__PURE__*/ new Vector3();
|
|
|
23139
23753
|
const _segDir = /*@__PURE__*/ new Vector3();
|
|
23140
23754
|
const _diff = /*@__PURE__*/ new Vector3();
|
|
23141
23755
|
|
|
23142
|
-
const _edge1 = /*@__PURE__*/ new Vector3();
|
|
23143
|
-
const _edge2 = /*@__PURE__*/ new Vector3();
|
|
23144
|
-
const _normal$1 = /*@__PURE__*/ new Vector3();
|
|
23145
|
-
|
|
23146
23756
|
/**
|
|
23147
23757
|
* A ray that emits from an origin in a certain direction. The class is used by
|
|
23148
23758
|
* {@link Raycaster} to assist with raycasting. Raycasting is used for
|
|
@@ -23444,6 +24054,8 @@ class Ray {
|
|
|
23444
24054
|
*/
|
|
23445
24055
|
intersectSphere( sphere, target ) {
|
|
23446
24056
|
|
|
24057
|
+
if ( sphere.radius < 0 ) return null; // handle empty spheres, see #31187
|
|
24058
|
+
|
|
23447
24059
|
_vector$7.subVectors( sphere.center, this.origin );
|
|
23448
24060
|
const tca = _vector$7.dot( this.direction );
|
|
23449
24061
|
const d2 = _vector$7.dot( _vector$7 ) - tca * tca;
|
|
@@ -23673,76 +24285,128 @@ class Ray {
|
|
|
23673
24285
|
*/
|
|
23674
24286
|
intersectTriangle( a, b, c, backfaceCulling, target ) {
|
|
23675
24287
|
|
|
23676
|
-
//
|
|
24288
|
+
// Watertight ray/triangle intersection. Reference: Woop, Benthin, Wald,
|
|
24289
|
+
// "Watertight Ray/Triangle Intersection", JCGT vol. 2 no. 1 (2013), Appendix A.
|
|
24290
|
+
// https://jcgt.org/published/0002/01/05/
|
|
24291
|
+
|
|
24292
|
+
const origin = this.origin;
|
|
24293
|
+
const direction = this.direction;
|
|
24294
|
+
|
|
24295
|
+
const dx = direction.x;
|
|
24296
|
+
const dy = direction.y;
|
|
24297
|
+
const dz = direction.z;
|
|
24298
|
+
|
|
24299
|
+
// triangle vertices relative to the ray origin
|
|
24300
|
+
|
|
24301
|
+
const aox = a.x - origin.x, aoy = a.y - origin.y, aoz = a.z - origin.z;
|
|
24302
|
+
const box = b.x - origin.x, boy = b.y - origin.y, boz = b.z - origin.z;
|
|
24303
|
+
const cox = c.x - origin.x, coy = c.y - origin.y, coz = c.z - origin.z;
|
|
24304
|
+
|
|
24305
|
+
// Use the dimension where the ray direction is maximal as the projection
|
|
24306
|
+
// axis (kz) and read every component already permuted into (kx, ky, kz).
|
|
24307
|
+
// kx and ky are swapped when the direction's kz component is negative, to
|
|
24308
|
+
// preserve the winding order of triangles.
|
|
23677
24309
|
|
|
23678
|
-
|
|
24310
|
+
const adx = Math.abs( dx ), ady = Math.abs( dy ), adz = Math.abs( dz );
|
|
23679
24311
|
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
_normal$1.crossVectors( _edge1, _edge2 );
|
|
24312
|
+
let dkx, dky, dkz;
|
|
24313
|
+
let akx, aky, akz, bkx, bky, bkz, ckx, cky, ckz;
|
|
23683
24314
|
|
|
23684
|
-
|
|
23685
|
-
// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
|
|
23686
|
-
// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
|
|
23687
|
-
// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
|
|
23688
|
-
// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
|
|
23689
|
-
let DdN = this.direction.dot( _normal$1 );
|
|
23690
|
-
let sign;
|
|
24315
|
+
if ( adx >= ady && adx >= adz ) {
|
|
23691
24316
|
|
|
23692
|
-
|
|
24317
|
+
dkz = dx; akz = aox; bkz = box; ckz = cox;
|
|
23693
24318
|
|
|
23694
|
-
if (
|
|
23695
|
-
sign = 1;
|
|
24319
|
+
if ( dx >= 0 ) {
|
|
23696
24320
|
|
|
23697
|
-
|
|
24321
|
+
dkx = dy; dky = dz;
|
|
24322
|
+
akx = aoy; aky = aoz; bkx = boy; bky = boz; ckx = coy; cky = coz;
|
|
23698
24323
|
|
|
23699
|
-
|
|
23700
|
-
|
|
24324
|
+
} else {
|
|
24325
|
+
|
|
24326
|
+
dkx = dz; dky = dy;
|
|
24327
|
+
akx = aoz; aky = aoy; bkx = boz; bky = boy; ckx = coz; cky = coy;
|
|
24328
|
+
|
|
24329
|
+
}
|
|
24330
|
+
|
|
24331
|
+
} else if ( ady >= adz ) {
|
|
24332
|
+
|
|
24333
|
+
dkz = dy; akz = aoy; bkz = boy; ckz = coy;
|
|
24334
|
+
|
|
24335
|
+
if ( dy >= 0 ) {
|
|
24336
|
+
|
|
24337
|
+
dkx = dz; dky = dx;
|
|
24338
|
+
akx = aoz; aky = aox; bkx = boz; bky = box; ckx = coz; cky = cox;
|
|
24339
|
+
|
|
24340
|
+
} else {
|
|
24341
|
+
|
|
24342
|
+
dkx = dx; dky = dz;
|
|
24343
|
+
akx = aox; aky = aoz; bkx = box; bky = boz; ckx = cox; cky = coz;
|
|
24344
|
+
|
|
24345
|
+
}
|
|
23701
24346
|
|
|
23702
24347
|
} else {
|
|
23703
24348
|
|
|
23704
|
-
|
|
24349
|
+
dkz = dz; akz = aoz; bkz = boz; ckz = coz;
|
|
23705
24350
|
|
|
23706
|
-
|
|
24351
|
+
if ( dz >= 0 ) {
|
|
23707
24352
|
|
|
23708
|
-
|
|
23709
|
-
|
|
24353
|
+
dkx = dx; dky = dy;
|
|
24354
|
+
akx = aox; aky = aoy; bkx = box; bky = boy; ckx = cox; cky = coy;
|
|
23710
24355
|
|
|
23711
|
-
|
|
23712
|
-
if ( DdQxE2 < 0 ) {
|
|
24356
|
+
} else {
|
|
23713
24357
|
|
|
23714
|
-
|
|
24358
|
+
dkx = dy; dky = dx;
|
|
24359
|
+
akx = aoy; aky = aox; bkx = boy; bky = box; ckx = coy; cky = cox;
|
|
24360
|
+
|
|
24361
|
+
}
|
|
23715
24362
|
|
|
23716
24363
|
}
|
|
23717
24364
|
|
|
23718
|
-
|
|
24365
|
+
// a zero direction has no maximal axis and cannot intersect
|
|
23719
24366
|
|
|
23720
|
-
|
|
23721
|
-
if ( DdE1xQ < 0 ) {
|
|
24367
|
+
if ( dkz === 0 ) return null;
|
|
23722
24368
|
|
|
23723
|
-
|
|
24369
|
+
// shear constants that align the ray with the +kz axis
|
|
23724
24370
|
|
|
23725
|
-
|
|
24371
|
+
const sx = dkx / dkz, sy = dky / dkz, sz = 1 / dkz;
|
|
23726
24372
|
|
|
23727
|
-
//
|
|
23728
|
-
if ( DdQxE2 + DdE1xQ > DdN ) {
|
|
24373
|
+
// sheared and scaled vertices
|
|
23729
24374
|
|
|
23730
|
-
|
|
24375
|
+
const ax = akx - sx * akz, ay = aky - sy * akz;
|
|
24376
|
+
const bx = bkx - sx * bkz, by = bky - sy * bkz;
|
|
24377
|
+
const cx = ckx - sx * ckz, cy = cky - sy * ckz;
|
|
23731
24378
|
|
|
23732
|
-
|
|
24379
|
+
// scaled barycentric coordinates (signed edge functions); the shear makes a
|
|
24380
|
+
// shared edge evaluate identically for both adjacent triangles, so the ray
|
|
24381
|
+
// can never fall between them
|
|
23733
24382
|
|
|
23734
|
-
|
|
23735
|
-
const
|
|
24383
|
+
const u = cx * by - cy * bx;
|
|
24384
|
+
const v = ax * cy - ay * cx;
|
|
24385
|
+
const w = bx * ay - by * ax;
|
|
23736
24386
|
|
|
23737
|
-
|
|
23738
|
-
if ( QdN < 0 ) {
|
|
24387
|
+
if ( backfaceCulling ) {
|
|
23739
24388
|
|
|
23740
|
-
return null;
|
|
24389
|
+
if ( u < 0 || v < 0 || w < 0 ) return null;
|
|
24390
|
+
|
|
24391
|
+
} else {
|
|
24392
|
+
|
|
24393
|
+
if ( ( u < 0 || v < 0 || w < 0 ) && ( u > 0 || v > 0 || w > 0 ) ) return null;
|
|
23741
24394
|
|
|
23742
24395
|
}
|
|
23743
24396
|
|
|
23744
|
-
|
|
23745
|
-
|
|
24397
|
+
const det = u + v + w;
|
|
24398
|
+
|
|
24399
|
+
// ray is co-planar with the triangle
|
|
24400
|
+
|
|
24401
|
+
if ( det === 0 ) return null;
|
|
24402
|
+
|
|
24403
|
+
// scaled hit distance; t = tScaled / det must lie in front of the origin
|
|
24404
|
+
|
|
24405
|
+
const tScaled = sz * ( u * akz + v * bkz + w * ckz );
|
|
24406
|
+
|
|
24407
|
+
if ( det > 0 ? tScaled < 0 : tScaled > 0 ) return null;
|
|
24408
|
+
|
|
24409
|
+
return this.at( tScaled / det, target );
|
|
23746
24410
|
|
|
23747
24411
|
}
|
|
23748
24412
|
|
|
@@ -24262,6 +24926,18 @@ class Mesh extends Object3D {
|
|
|
24262
24926
|
|
|
24263
24927
|
}
|
|
24264
24928
|
|
|
24929
|
+
/**
|
|
24930
|
+
* Returns `true` if this mesh intersects the given frustum.
|
|
24931
|
+
*
|
|
24932
|
+
* @param {Frustum|FrustumArray} frustum - The frustum to test.
|
|
24933
|
+
* @return {boolean} Whether this mesh intersects the given frustum or not.
|
|
24934
|
+
*/
|
|
24935
|
+
intersectsFrustum( frustum ) {
|
|
24936
|
+
|
|
24937
|
+
return frustum.intersectsObject( this );
|
|
24938
|
+
|
|
24939
|
+
}
|
|
24940
|
+
|
|
24265
24941
|
/**
|
|
24266
24942
|
* Computes intersection points between a casted ray and this line.
|
|
24267
24943
|
*
|
|
@@ -25628,594 +26304,230 @@ class InstancedMesh extends Mesh {
|
|
|
25628
26304
|
|
|
25629
26305
|
}
|
|
25630
26306
|
|
|
25631
|
-
copy( source, recursive ) {
|
|
25632
|
-
|
|
25633
|
-
super.copy( source, recursive );
|
|
25634
|
-
|
|
25635
|
-
this.instanceMatrix.copy( source.instanceMatrix );
|
|
25636
|
-
|
|
25637
|
-
if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
|
|
25638
|
-
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
|
|
25639
|
-
|
|
25640
|
-
this.count = source.count;
|
|
25641
|
-
|
|
25642
|
-
if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
|
|
25643
|
-
if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
|
|
25644
|
-
|
|
25645
|
-
return this;
|
|
25646
|
-
|
|
25647
|
-
}
|
|
25648
|
-
|
|
25649
|
-
/**
|
|
25650
|
-
* Gets the color of the defined instance.
|
|
25651
|
-
*
|
|
25652
|
-
* @param {number} index - The instance index.
|
|
25653
|
-
* @param {Color} color - The target object that is used to store the method's result.
|
|
25654
|
-
* @return {Color} A reference to the target color.
|
|
25655
|
-
*/
|
|
25656
|
-
getColorAt( index, color ) {
|
|
25657
|
-
|
|
25658
|
-
if ( this.instanceColor === null ) {
|
|
25659
|
-
|
|
25660
|
-
return color.setRGB( 1, 1, 1 );
|
|
25661
|
-
|
|
25662
|
-
} else {
|
|
25663
|
-
|
|
25664
|
-
return color.fromArray( this.instanceColor.array, index * 3 );
|
|
25665
|
-
|
|
25666
|
-
}
|
|
25667
|
-
|
|
25668
|
-
}
|
|
25669
|
-
|
|
25670
|
-
/**
|
|
25671
|
-
* Gets the local transformation matrix of the defined instance.
|
|
25672
|
-
*
|
|
25673
|
-
* @param {number} index - The instance index.
|
|
25674
|
-
* @param {Matrix4} matrix - The target object that is used to store the method's result.
|
|
25675
|
-
* @return {Matrix4} A reference to the target matrix.
|
|
25676
|
-
*/
|
|
25677
|
-
getMatrixAt( index, matrix ) {
|
|
25678
|
-
|
|
25679
|
-
return matrix.fromArray( this.instanceMatrix.array, index * 16 );
|
|
25680
|
-
|
|
25681
|
-
}
|
|
25682
|
-
|
|
25683
|
-
/**
|
|
25684
|
-
* Gets the morph target weights of the defined instance.
|
|
25685
|
-
*
|
|
25686
|
-
* @param {number} index - The instance index.
|
|
25687
|
-
* @param {Mesh} object - The target object that is used to store the method's result.
|
|
25688
|
-
*/
|
|
25689
|
-
getMorphAt( index, object ) {
|
|
25690
|
-
|
|
25691
|
-
const objectInfluences = object.morphTargetInfluences;
|
|
25692
|
-
|
|
25693
|
-
const array = this.morphTexture.source.data.data;
|
|
25694
|
-
|
|
25695
|
-
const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
|
|
25696
|
-
|
|
25697
|
-
const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
|
|
25698
|
-
|
|
25699
|
-
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
25700
|
-
|
|
25701
|
-
objectInfluences[ i ] = array[ dataIndex + i ];
|
|
25702
|
-
|
|
25703
|
-
}
|
|
25704
|
-
|
|
25705
|
-
}
|
|
25706
|
-
|
|
25707
|
-
raycast( raycaster, intersects ) {
|
|
25708
|
-
|
|
25709
|
-
const matrixWorld = this.matrixWorld;
|
|
25710
|
-
const raycastTimes = this.count;
|
|
25711
|
-
|
|
25712
|
-
_mesh$1.geometry = this.geometry;
|
|
25713
|
-
_mesh$1.material = this.material;
|
|
25714
|
-
|
|
25715
|
-
if ( _mesh$1.material === undefined ) return;
|
|
25716
|
-
|
|
25717
|
-
// test with bounding sphere first
|
|
25718
|
-
|
|
25719
|
-
if ( this.boundingSphere === null ) this.computeBoundingSphere();
|
|
25720
|
-
|
|
25721
|
-
_sphere$4.copy( this.boundingSphere );
|
|
25722
|
-
_sphere$4.applyMatrix4( matrixWorld );
|
|
25723
|
-
|
|
25724
|
-
if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
|
|
25725
|
-
|
|
25726
|
-
// now test each instance
|
|
25727
|
-
|
|
25728
|
-
for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
|
|
25729
|
-
|
|
25730
|
-
// calculate the world matrix for each instance
|
|
25731
|
-
|
|
25732
|
-
this.getMatrixAt( instanceId, _instanceLocalMatrix );
|
|
25733
|
-
|
|
25734
|
-
_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
|
|
25735
|
-
|
|
25736
|
-
// the mesh represents this single instance
|
|
25737
|
-
|
|
25738
|
-
_mesh$1.matrixWorld = _instanceWorldMatrix;
|
|
25739
|
-
|
|
25740
|
-
_mesh$1.raycast( raycaster, _instanceIntersects );
|
|
25741
|
-
|
|
25742
|
-
// process the result of raycast
|
|
25743
|
-
|
|
25744
|
-
for ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {
|
|
25745
|
-
|
|
25746
|
-
const intersect = _instanceIntersects[ i ];
|
|
25747
|
-
intersect.instanceId = instanceId;
|
|
25748
|
-
intersect.object = this;
|
|
25749
|
-
intersects.push( intersect );
|
|
25750
|
-
|
|
25751
|
-
}
|
|
25752
|
-
|
|
25753
|
-
_instanceIntersects.length = 0;
|
|
25754
|
-
|
|
25755
|
-
}
|
|
25756
|
-
|
|
25757
|
-
}
|
|
25758
|
-
|
|
25759
|
-
/**
|
|
25760
|
-
* Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
25761
|
-
* {@link InstancedMesh#instanceColor} to `true` after updating all the colors.
|
|
25762
|
-
*
|
|
25763
|
-
* @param {number} index - The instance index.
|
|
25764
|
-
* @param {Color} color - The instance color.
|
|
25765
|
-
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
25766
|
-
*/
|
|
25767
|
-
setColorAt( index, color ) {
|
|
25768
|
-
|
|
25769
|
-
if ( this.instanceColor === null ) {
|
|
25770
|
-
|
|
25771
|
-
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
|
|
25772
|
-
|
|
25773
|
-
}
|
|
25774
|
-
|
|
25775
|
-
color.toArray( this.instanceColor.array, index * 3 );
|
|
25776
|
-
return this;
|
|
25777
|
-
|
|
25778
|
-
}
|
|
25779
|
-
|
|
25780
|
-
/**
|
|
25781
|
-
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
25782
|
-
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
|
|
25783
|
-
*
|
|
25784
|
-
* @param {number} index - The instance index.
|
|
25785
|
-
* @param {Matrix4} matrix - The local transformation.
|
|
25786
|
-
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
25787
|
-
*/
|
|
25788
|
-
setMatrixAt( index, matrix ) {
|
|
25789
|
-
|
|
25790
|
-
matrix.toArray( this.instanceMatrix.array, index * 16 );
|
|
25791
|
-
return this;
|
|
25792
|
-
|
|
25793
|
-
}
|
|
25794
|
-
|
|
25795
|
-
/**
|
|
25796
|
-
* Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
25797
|
-
* {@link InstancedMesh#morphTexture} to `true` after updating all the influences.
|
|
25798
|
-
*
|
|
25799
|
-
* @param {number} index - The instance index.
|
|
25800
|
-
* @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
|
|
25801
|
-
* of a single instance.
|
|
25802
|
-
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
25803
|
-
*/
|
|
25804
|
-
setMorphAt( index, object ) {
|
|
25805
|
-
|
|
25806
|
-
const objectInfluences = object.morphTargetInfluences;
|
|
25807
|
-
|
|
25808
|
-
const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
|
|
25809
|
-
|
|
25810
|
-
if ( this.morphTexture === null ) {
|
|
25811
|
-
|
|
25812
|
-
this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
|
|
25813
|
-
|
|
25814
|
-
}
|
|
25815
|
-
|
|
25816
|
-
const array = this.morphTexture.source.data.data;
|
|
25817
|
-
|
|
25818
|
-
let morphInfluencesSum = 0;
|
|
25819
|
-
|
|
25820
|
-
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
25821
|
-
|
|
25822
|
-
morphInfluencesSum += objectInfluences[ i ];
|
|
25823
|
-
|
|
25824
|
-
}
|
|
25825
|
-
|
|
25826
|
-
const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
25827
|
-
|
|
25828
|
-
const dataIndex = len * index;
|
|
25829
|
-
|
|
25830
|
-
array[ dataIndex ] = morphBaseInfluence;
|
|
25831
|
-
|
|
25832
|
-
array.set( objectInfluences, dataIndex + 1 );
|
|
25833
|
-
return this;
|
|
25834
|
-
|
|
25835
|
-
}
|
|
25836
|
-
|
|
25837
|
-
updateMorphTargets() {
|
|
25838
|
-
|
|
25839
|
-
}
|
|
25840
|
-
|
|
25841
|
-
/**
|
|
25842
|
-
* Frees the GPU-related resources allocated by this instance. Call this
|
|
25843
|
-
* method whenever this instance is no longer used in your app.
|
|
25844
|
-
*/
|
|
25845
|
-
dispose() {
|
|
25846
|
-
|
|
25847
|
-
this.dispatchEvent( { type: 'dispose' } );
|
|
25848
|
-
|
|
25849
|
-
if ( this.morphTexture !== null ) {
|
|
25850
|
-
|
|
25851
|
-
this.morphTexture.dispose();
|
|
25852
|
-
this.morphTexture = null;
|
|
25853
|
-
|
|
25854
|
-
}
|
|
25855
|
-
|
|
25856
|
-
}
|
|
25857
|
-
|
|
25858
|
-
}
|
|
25859
|
-
|
|
25860
|
-
const _vector1 = /*@__PURE__*/ new Vector3();
|
|
25861
|
-
const _vector2 = /*@__PURE__*/ new Vector3();
|
|
25862
|
-
const _normalMatrix = /*@__PURE__*/ new Matrix3();
|
|
25863
|
-
|
|
25864
|
-
/**
|
|
25865
|
-
* A two dimensional surface that extends infinitely in 3D space, represented
|
|
25866
|
-
* in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)
|
|
25867
|
-
* by a unit length normal vector and a constant.
|
|
25868
|
-
*/
|
|
25869
|
-
class Plane {
|
|
25870
|
-
|
|
25871
|
-
/**
|
|
25872
|
-
* Constructs a new plane.
|
|
25873
|
-
*
|
|
25874
|
-
* @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
|
|
25875
|
-
* @param {number} [constant=0] - The signed distance from the origin to the plane.
|
|
25876
|
-
*/
|
|
25877
|
-
constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
|
|
25878
|
-
|
|
25879
|
-
/**
|
|
25880
|
-
* This flag can be used for type testing.
|
|
25881
|
-
*
|
|
25882
|
-
* @type {boolean}
|
|
25883
|
-
* @readonly
|
|
25884
|
-
* @default true
|
|
25885
|
-
*/
|
|
25886
|
-
this.isPlane = true;
|
|
25887
|
-
|
|
25888
|
-
/**
|
|
25889
|
-
* A unit length vector defining the normal of the plane.
|
|
25890
|
-
*
|
|
25891
|
-
* @type {Vector3}
|
|
25892
|
-
*/
|
|
25893
|
-
this.normal = normal;
|
|
25894
|
-
|
|
25895
|
-
/**
|
|
25896
|
-
* The signed distance from the origin to the plane.
|
|
25897
|
-
*
|
|
25898
|
-
* @type {number}
|
|
25899
|
-
* @default 0
|
|
25900
|
-
*/
|
|
25901
|
-
this.constant = constant;
|
|
25902
|
-
|
|
25903
|
-
}
|
|
25904
|
-
|
|
25905
|
-
/**
|
|
25906
|
-
* Sets the plane components by copying the given values.
|
|
25907
|
-
*
|
|
25908
|
-
* @param {Vector3} normal - The normal.
|
|
25909
|
-
* @param {number} constant - The constant.
|
|
25910
|
-
* @return {Plane} A reference to this plane.
|
|
25911
|
-
*/
|
|
25912
|
-
set( normal, constant ) {
|
|
25913
|
-
|
|
25914
|
-
this.normal.copy( normal );
|
|
25915
|
-
this.constant = constant;
|
|
25916
|
-
|
|
25917
|
-
return this;
|
|
25918
|
-
|
|
25919
|
-
}
|
|
25920
|
-
|
|
25921
|
-
/**
|
|
25922
|
-
* Sets the plane components by defining `x`, `y`, `z` as the
|
|
25923
|
-
* plane normal and `w` as the constant.
|
|
25924
|
-
*
|
|
25925
|
-
* @param {number} x - The value for the normal's x component.
|
|
25926
|
-
* @param {number} y - The value for the normal's y component.
|
|
25927
|
-
* @param {number} z - The value for the normal's z component.
|
|
25928
|
-
* @param {number} w - The constant value.
|
|
25929
|
-
* @return {Plane} A reference to this plane.
|
|
25930
|
-
*/
|
|
25931
|
-
setComponents( x, y, z, w ) {
|
|
25932
|
-
|
|
25933
|
-
this.normal.set( x, y, z );
|
|
25934
|
-
this.constant = w;
|
|
26307
|
+
copy( source, recursive ) {
|
|
25935
26308
|
|
|
25936
|
-
|
|
26309
|
+
super.copy( source, recursive );
|
|
25937
26310
|
|
|
25938
|
-
|
|
26311
|
+
this.instanceMatrix.copy( source.instanceMatrix );
|
|
25939
26312
|
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
* that lies onto the plane).
|
|
25943
|
-
*
|
|
25944
|
-
* @param {Vector3} normal - The normal.
|
|
25945
|
-
* @param {Vector3} point - A coplanar point.
|
|
25946
|
-
* @return {Plane} A reference to this plane.
|
|
25947
|
-
*/
|
|
25948
|
-
setFromNormalAndCoplanarPoint( normal, point ) {
|
|
26313
|
+
if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
|
|
26314
|
+
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
|
|
25949
26315
|
|
|
25950
|
-
this.
|
|
25951
|
-
|
|
26316
|
+
this.count = source.count;
|
|
26317
|
+
|
|
26318
|
+
if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
|
|
26319
|
+
if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
|
|
25952
26320
|
|
|
25953
26321
|
return this;
|
|
25954
26322
|
|
|
25955
26323
|
}
|
|
25956
26324
|
|
|
25957
26325
|
/**
|
|
25958
|
-
*
|
|
25959
|
-
* assumed to be counter-clockwise, and determines the direction of
|
|
25960
|
-
* the plane normal.
|
|
26326
|
+
* Gets the color of the defined instance.
|
|
25961
26327
|
*
|
|
25962
|
-
* @param {
|
|
25963
|
-
* @param {
|
|
25964
|
-
* @
|
|
25965
|
-
* @return {Plane} A reference to this plane.
|
|
26328
|
+
* @param {number} index - The instance index.
|
|
26329
|
+
* @param {Color} color - The target object that is used to store the method's result.
|
|
26330
|
+
* @return {Color} A reference to the target color.
|
|
25966
26331
|
*/
|
|
25967
|
-
|
|
26332
|
+
getColorAt( index, color ) {
|
|
25968
26333
|
|
|
25969
|
-
|
|
26334
|
+
if ( this.instanceColor === null ) {
|
|
25970
26335
|
|
|
25971
|
-
|
|
26336
|
+
return color.setRGB( 1, 1, 1 );
|
|
25972
26337
|
|
|
25973
|
-
|
|
26338
|
+
} else {
|
|
25974
26339
|
|
|
25975
|
-
|
|
26340
|
+
return color.fromArray( this.instanceColor.array, index * 3 );
|
|
26341
|
+
|
|
26342
|
+
}
|
|
25976
26343
|
|
|
25977
26344
|
}
|
|
25978
26345
|
|
|
25979
26346
|
/**
|
|
25980
|
-
*
|
|
26347
|
+
* Gets the local transformation matrix of the defined instance.
|
|
25981
26348
|
*
|
|
25982
|
-
* @param {
|
|
25983
|
-
* @
|
|
26349
|
+
* @param {number} index - The instance index.
|
|
26350
|
+
* @param {Matrix4} matrix - The target object that is used to store the method's result.
|
|
26351
|
+
* @return {Matrix4} A reference to the target matrix.
|
|
25984
26352
|
*/
|
|
25985
|
-
|
|
25986
|
-
|
|
25987
|
-
this.normal.copy( plane.normal );
|
|
25988
|
-
this.constant = plane.constant;
|
|
26353
|
+
getMatrixAt( index, matrix ) {
|
|
25989
26354
|
|
|
25990
|
-
return this;
|
|
26355
|
+
return matrix.fromArray( this.instanceMatrix.array, index * 16 );
|
|
25991
26356
|
|
|
25992
26357
|
}
|
|
25993
26358
|
|
|
25994
26359
|
/**
|
|
25995
|
-
*
|
|
26360
|
+
* Gets the morph target weights of the defined instance.
|
|
25996
26361
|
*
|
|
25997
|
-
* @
|
|
26362
|
+
* @param {number} index - The instance index.
|
|
26363
|
+
* @param {Mesh} object - The target object that is used to store the method's result.
|
|
25998
26364
|
*/
|
|
25999
|
-
|
|
26365
|
+
getMorphAt( index, object ) {
|
|
26000
26366
|
|
|
26001
|
-
|
|
26367
|
+
const objectInfluences = object.morphTargetInfluences;
|
|
26002
26368
|
|
|
26003
|
-
const
|
|
26004
|
-
this.normal.multiplyScalar( inverseNormalLength );
|
|
26005
|
-
this.constant *= inverseNormalLength;
|
|
26369
|
+
const array = this.morphTexture.source.data.data;
|
|
26006
26370
|
|
|
26007
|
-
|
|
26371
|
+
const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
|
|
26008
26372
|
|
|
26009
|
-
|
|
26373
|
+
const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
|
|
26010
26374
|
|
|
26011
|
-
|
|
26012
|
-
* Negates both the plane normal and the constant.
|
|
26013
|
-
*
|
|
26014
|
-
* @return {Plane} A reference to this plane.
|
|
26015
|
-
*/
|
|
26016
|
-
negate() {
|
|
26375
|
+
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
26017
26376
|
|
|
26018
|
-
|
|
26019
|
-
this.normal.negate();
|
|
26377
|
+
objectInfluences[ i ] = array[ dataIndex + i ];
|
|
26020
26378
|
|
|
26021
|
-
|
|
26379
|
+
}
|
|
26022
26380
|
|
|
26023
26381
|
}
|
|
26024
26382
|
|
|
26025
|
-
|
|
26026
|
-
* Returns the signed distance from the given point to this plane.
|
|
26027
|
-
*
|
|
26028
|
-
* @param {Vector3} point - The point to compute the distance for.
|
|
26029
|
-
* @return {number} The signed distance.
|
|
26030
|
-
*/
|
|
26031
|
-
distanceToPoint( point ) {
|
|
26383
|
+
raycast( raycaster, intersects ) {
|
|
26032
26384
|
|
|
26033
|
-
|
|
26385
|
+
const matrixWorld = this.matrixWorld;
|
|
26386
|
+
const raycastTimes = this.count;
|
|
26034
26387
|
|
|
26035
|
-
|
|
26388
|
+
_mesh$1.geometry = this.geometry;
|
|
26389
|
+
_mesh$1.material = this.material;
|
|
26036
26390
|
|
|
26037
|
-
|
|
26038
|
-
* Returns the signed distance from the given sphere to this plane.
|
|
26039
|
-
*
|
|
26040
|
-
* @param {Sphere} sphere - The sphere to compute the distance for.
|
|
26041
|
-
* @return {number} The signed distance.
|
|
26042
|
-
*/
|
|
26043
|
-
distanceToSphere( sphere ) {
|
|
26391
|
+
if ( _mesh$1.material === undefined ) return;
|
|
26044
26392
|
|
|
26045
|
-
|
|
26393
|
+
// test with bounding sphere first
|
|
26046
26394
|
|
|
26047
|
-
|
|
26395
|
+
if ( this.boundingSphere === null ) this.computeBoundingSphere();
|
|
26048
26396
|
|
|
26049
|
-
|
|
26050
|
-
|
|
26051
|
-
*
|
|
26052
|
-
* @param {Vector3} point - The point to project.
|
|
26053
|
-
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
26054
|
-
* @return {Vector3} The projected point on the plane.
|
|
26055
|
-
*/
|
|
26056
|
-
projectPoint( point, target ) {
|
|
26397
|
+
_sphere$4.copy( this.boundingSphere );
|
|
26398
|
+
_sphere$4.applyMatrix4( matrixWorld );
|
|
26057
26399
|
|
|
26058
|
-
|
|
26400
|
+
if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
|
|
26059
26401
|
|
|
26060
|
-
|
|
26402
|
+
// now test each instance
|
|
26061
26403
|
|
|
26062
|
-
|
|
26063
|
-
* Returns the intersection point of the passed line and the plane. Returns
|
|
26064
|
-
* `null` if the line does not intersect. Returns the line's starting point if
|
|
26065
|
-
* the line is coplanar with the plane.
|
|
26066
|
-
*
|
|
26067
|
-
* @param {Line3} line - The line to compute the intersection for.
|
|
26068
|
-
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
26069
|
-
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
26070
|
-
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
26071
|
-
*/
|
|
26072
|
-
intersectLine( line, target, clampToLine = true ) {
|
|
26404
|
+
for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
|
|
26073
26405
|
|
|
26074
|
-
|
|
26406
|
+
// calculate the world matrix for each instance
|
|
26075
26407
|
|
|
26076
|
-
|
|
26408
|
+
this.getMatrixAt( instanceId, _instanceLocalMatrix );
|
|
26077
26409
|
|
|
26078
|
-
|
|
26410
|
+
_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
|
|
26079
26411
|
|
|
26080
|
-
//
|
|
26081
|
-
if ( this.distanceToPoint( line.start ) === 0 ) {
|
|
26412
|
+
// the mesh represents this single instance
|
|
26082
26413
|
|
|
26083
|
-
|
|
26414
|
+
_mesh$1.matrixWorld = _instanceWorldMatrix;
|
|
26084
26415
|
|
|
26085
|
-
|
|
26416
|
+
_mesh$1.raycast( raycaster, _instanceIntersects );
|
|
26086
26417
|
|
|
26087
|
-
//
|
|
26088
|
-
return null;
|
|
26418
|
+
// process the result of raycast
|
|
26089
26419
|
|
|
26090
|
-
|
|
26420
|
+
for ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {
|
|
26091
26421
|
|
|
26092
|
-
|
|
26422
|
+
const intersect = _instanceIntersects[ i ];
|
|
26423
|
+
intersect.instanceId = instanceId;
|
|
26424
|
+
intersect.object = this;
|
|
26425
|
+
intersects.push( intersect );
|
|
26093
26426
|
|
|
26094
|
-
|
|
26427
|
+
}
|
|
26095
26428
|
|
|
26096
|
-
|
|
26429
|
+
_instanceIntersects.length = 0;
|
|
26097
26430
|
|
|
26098
26431
|
}
|
|
26099
26432
|
|
|
26100
|
-
return target.copy( line.start ).addScaledVector( direction, t );
|
|
26101
|
-
|
|
26102
26433
|
}
|
|
26103
26434
|
|
|
26104
26435
|
/**
|
|
26105
|
-
*
|
|
26436
|
+
* Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
26437
|
+
* {@link InstancedMesh#instanceColor} to `true` after updating all the colors.
|
|
26106
26438
|
*
|
|
26107
|
-
* @param {
|
|
26108
|
-
* @
|
|
26439
|
+
* @param {number} index - The instance index.
|
|
26440
|
+
* @param {Color} color - The instance color.
|
|
26441
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
26109
26442
|
*/
|
|
26110
|
-
|
|
26443
|
+
setColorAt( index, color ) {
|
|
26111
26444
|
|
|
26112
|
-
|
|
26445
|
+
if ( this.instanceColor === null ) {
|
|
26113
26446
|
|
|
26114
|
-
|
|
26115
|
-
const endSign = this.distanceToPoint( line.end );
|
|
26447
|
+
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
|
|
26116
26448
|
|
|
26117
|
-
|
|
26449
|
+
}
|
|
26450
|
+
|
|
26451
|
+
color.toArray( this.instanceColor.array, index * 3 );
|
|
26452
|
+
return this;
|
|
26118
26453
|
|
|
26119
26454
|
}
|
|
26120
26455
|
|
|
26121
26456
|
/**
|
|
26122
|
-
*
|
|
26457
|
+
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
26458
|
+
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
|
|
26123
26459
|
*
|
|
26124
|
-
* @param {
|
|
26125
|
-
* @
|
|
26460
|
+
* @param {number} index - The instance index.
|
|
26461
|
+
* @param {Matrix4} matrix - The local transformation.
|
|
26462
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
26126
26463
|
*/
|
|
26127
|
-
|
|
26464
|
+
setMatrixAt( index, matrix ) {
|
|
26128
26465
|
|
|
26129
|
-
|
|
26466
|
+
matrix.toArray( this.instanceMatrix.array, index * 16 );
|
|
26467
|
+
return this;
|
|
26130
26468
|
|
|
26131
26469
|
}
|
|
26132
26470
|
|
|
26133
26471
|
/**
|
|
26134
|
-
*
|
|
26472
|
+
* Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
26473
|
+
* {@link InstancedMesh#morphTexture} to `true` after updating all the influences.
|
|
26135
26474
|
*
|
|
26136
|
-
* @param {
|
|
26137
|
-
* @
|
|
26475
|
+
* @param {number} index - The instance index.
|
|
26476
|
+
* @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
|
|
26477
|
+
* of a single instance.
|
|
26478
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
26138
26479
|
*/
|
|
26139
|
-
|
|
26140
|
-
|
|
26141
|
-
return sphere.intersectsPlane( this );
|
|
26480
|
+
setMorphAt( index, object ) {
|
|
26142
26481
|
|
|
26143
|
-
|
|
26482
|
+
const objectInfluences = object.morphTargetInfluences;
|
|
26144
26483
|
|
|
26145
|
-
|
|
26146
|
-
* Returns a coplanar vector to the plane, by calculating the
|
|
26147
|
-
* projection of the normal at the origin onto the plane.
|
|
26148
|
-
*
|
|
26149
|
-
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
26150
|
-
* @return {Vector3} The coplanar point.
|
|
26151
|
-
*/
|
|
26152
|
-
coplanarPoint( target ) {
|
|
26484
|
+
const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
|
|
26153
26485
|
|
|
26154
|
-
|
|
26486
|
+
if ( this.morphTexture === null ) {
|
|
26155
26487
|
|
|
26156
|
-
|
|
26488
|
+
this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
|
|
26157
26489
|
|
|
26158
|
-
|
|
26159
|
-
* Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
|
|
26160
|
-
*
|
|
26161
|
-
* The optional normal matrix can be pre-computed like so:
|
|
26162
|
-
* ```js
|
|
26163
|
-
* const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
|
|
26164
|
-
* ```
|
|
26165
|
-
*
|
|
26166
|
-
* @param {Matrix4} matrix - The transformation matrix.
|
|
26167
|
-
* @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
|
|
26168
|
-
* @return {Plane} A reference to this plane.
|
|
26169
|
-
*/
|
|
26170
|
-
applyMatrix4( matrix, optionalNormalMatrix ) {
|
|
26490
|
+
}
|
|
26171
26491
|
|
|
26172
|
-
const
|
|
26492
|
+
const array = this.morphTexture.source.data.data;
|
|
26173
26493
|
|
|
26174
|
-
|
|
26494
|
+
let morphInfluencesSum = 0;
|
|
26175
26495
|
|
|
26176
|
-
|
|
26496
|
+
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
26177
26497
|
|
|
26178
|
-
|
|
26498
|
+
morphInfluencesSum += objectInfluences[ i ];
|
|
26179
26499
|
|
|
26180
|
-
|
|
26500
|
+
}
|
|
26181
26501
|
|
|
26182
|
-
|
|
26502
|
+
const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
26183
26503
|
|
|
26184
|
-
|
|
26185
|
-
* Translates the plane by the distance defined by the given offset vector.
|
|
26186
|
-
* Note that this only affects the plane constant and will not affect the normal vector.
|
|
26187
|
-
*
|
|
26188
|
-
* @param {Vector3} offset - The offset vector.
|
|
26189
|
-
* @return {Plane} A reference to this plane.
|
|
26190
|
-
*/
|
|
26191
|
-
translate( offset ) {
|
|
26504
|
+
const dataIndex = len * index;
|
|
26192
26505
|
|
|
26193
|
-
|
|
26506
|
+
array[ dataIndex ] = morphBaseInfluence;
|
|
26194
26507
|
|
|
26508
|
+
array.set( objectInfluences, dataIndex + 1 );
|
|
26195
26509
|
return this;
|
|
26196
26510
|
|
|
26197
26511
|
}
|
|
26198
26512
|
|
|
26199
|
-
|
|
26200
|
-
* Returns `true` if this plane is equal with the given one.
|
|
26201
|
-
*
|
|
26202
|
-
* @param {Plane} plane - The plane to test for equality.
|
|
26203
|
-
* @return {boolean} Whether this plane is equal with the given one.
|
|
26204
|
-
*/
|
|
26205
|
-
equals( plane ) {
|
|
26206
|
-
|
|
26207
|
-
return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
|
|
26513
|
+
updateMorphTargets() {
|
|
26208
26514
|
|
|
26209
26515
|
}
|
|
26210
26516
|
|
|
26211
26517
|
/**
|
|
26212
|
-
*
|
|
26213
|
-
*
|
|
26214
|
-
* @return {Plane} A clone of this instance.
|
|
26518
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
26519
|
+
* method whenever this instance is no longer used in your app.
|
|
26215
26520
|
*/
|
|
26216
|
-
|
|
26521
|
+
dispose() {
|
|
26217
26522
|
|
|
26218
|
-
|
|
26523
|
+
super.dispose();
|
|
26524
|
+
|
|
26525
|
+
if ( this.morphTexture !== null ) {
|
|
26526
|
+
|
|
26527
|
+
this.morphTexture.dispose();
|
|
26528
|
+
this.morphTexture = null;
|
|
26529
|
+
|
|
26530
|
+
}
|
|
26219
26531
|
|
|
26220
26532
|
}
|
|
26221
26533
|
|
|
@@ -26404,6 +26716,10 @@ class Frustum {
|
|
|
26404
26716
|
/**
|
|
26405
26717
|
* Returns `true` if the given bounding sphere is intersecting this frustum.
|
|
26406
26718
|
*
|
|
26719
|
+
* This is a fast, conservative test that favors performance over precision. It can
|
|
26720
|
+
* report false positives for spheres that lie outside the frustum but are not separated
|
|
26721
|
+
* by a single frustum plane. It never reports false negatives, so it is safe for culling.
|
|
26722
|
+
*
|
|
26407
26723
|
* @param {Sphere} sphere - The bounding sphere to test.
|
|
26408
26724
|
* @return {boolean} Whether the bounding sphere is intersecting this frustum or not.
|
|
26409
26725
|
*/
|
|
@@ -26432,6 +26748,11 @@ class Frustum {
|
|
|
26432
26748
|
/**
|
|
26433
26749
|
* Returns `true` if the given bounding box is intersecting this frustum.
|
|
26434
26750
|
*
|
|
26751
|
+
* This is a fast, conservative test that favors performance over precision. It can
|
|
26752
|
+
* report false positives for large boxes that lie outside the frustum but are not
|
|
26753
|
+
* separated by a single frustum plane. It never reports false negatives, so it is
|
|
26754
|
+
* safe for culling.
|
|
26755
|
+
*
|
|
26435
26756
|
* @param {Box3} box - The bounding box to test.
|
|
26436
26757
|
* @return {boolean} Whether the bounding box is intersecting this frustum or not.
|
|
26437
26758
|
*/
|
|
@@ -26684,7 +27005,7 @@ class FrustumArray {
|
|
|
26684
27005
|
/**
|
|
26685
27006
|
* Copies the values of the given frustum array to this instance.
|
|
26686
27007
|
*
|
|
26687
|
-
* @param {FrustumArray}
|
|
27008
|
+
* @param {FrustumArray} source - The frustum array to copy.
|
|
26688
27009
|
* @return {FrustumArray} A reference to this frustum array.
|
|
26689
27010
|
*/
|
|
26690
27011
|
copy( source ) {
|
|
@@ -26981,6 +27302,7 @@ class BatchedMesh extends Mesh {
|
|
|
26981
27302
|
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
26982
27303
|
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
26983
27304
|
this._multiDrawCount = 0;
|
|
27305
|
+
this._multiDrawBytesPerElement = 1;
|
|
26984
27306
|
|
|
26985
27307
|
// Local matrix per geometry by using data texture
|
|
26986
27308
|
this._matricesTexture = null;
|
|
@@ -27912,6 +28234,7 @@ class BatchedMesh extends Mesh {
|
|
|
27912
28234
|
this.validateGeometryId( geometryId );
|
|
27913
28235
|
|
|
27914
28236
|
this._instanceInfo[ instanceId ].geometryIndex = geometryId;
|
|
28237
|
+
this._visibilityChanged = true;
|
|
27915
28238
|
|
|
27916
28239
|
return this;
|
|
27917
28240
|
|
|
@@ -28182,6 +28505,7 @@ class BatchedMesh extends Mesh {
|
|
|
28182
28505
|
this._geometryInitialized = source._geometryInitialized;
|
|
28183
28506
|
this._multiDrawCounts = source._multiDrawCounts.slice();
|
|
28184
28507
|
this._multiDrawStarts = source._multiDrawStarts.slice();
|
|
28508
|
+
this._multiDrawBytesPerElement = source._multiDrawBytesPerElement;
|
|
28185
28509
|
|
|
28186
28510
|
this._indirectTexture = source._indirectTexture.clone();
|
|
28187
28511
|
this._indirectTexture.image.data = this._indirectTexture.image.data.slice();
|
|
@@ -28206,6 +28530,8 @@ class BatchedMesh extends Mesh {
|
|
|
28206
28530
|
*/
|
|
28207
28531
|
dispose() {
|
|
28208
28532
|
|
|
28533
|
+
super.dispose();
|
|
28534
|
+
|
|
28209
28535
|
// Assuming the geometry is not shared with other meshes
|
|
28210
28536
|
this.geometry.dispose();
|
|
28211
28537
|
|
|
@@ -28384,6 +28710,7 @@ class BatchedMesh extends Mesh {
|
|
|
28384
28710
|
|
|
28385
28711
|
indirectTexture.needsUpdate = true;
|
|
28386
28712
|
this._multiDrawCount = multiDrawCount;
|
|
28713
|
+
this._multiDrawBytesPerElement = bytesPerElement;
|
|
28387
28714
|
this._visibilityChanged = false;
|
|
28388
28715
|
|
|
28389
28716
|
}
|
|
@@ -28661,6 +28988,18 @@ class Line extends Object3D {
|
|
|
28661
28988
|
|
|
28662
28989
|
}
|
|
28663
28990
|
|
|
28991
|
+
/**
|
|
28992
|
+
* Returns `true` if this line intersects the given frustum.
|
|
28993
|
+
*
|
|
28994
|
+
* @param {Frustum|FrustumArray} frustum - The frustum to test.
|
|
28995
|
+
* @return {boolean} Whether this line intersects the given frustum or not.
|
|
28996
|
+
*/
|
|
28997
|
+
intersectsFrustum( frustum ) {
|
|
28998
|
+
|
|
28999
|
+
return frustum.intersectsObject( this );
|
|
29000
|
+
|
|
29001
|
+
}
|
|
29002
|
+
|
|
28664
29003
|
/**
|
|
28665
29004
|
* Computes intersection points between a casted ray and this line.
|
|
28666
29005
|
*
|
|
@@ -29163,6 +29502,18 @@ class Points extends Object3D {
|
|
|
29163
29502
|
|
|
29164
29503
|
}
|
|
29165
29504
|
|
|
29505
|
+
/**
|
|
29506
|
+
* Returns `true` if this point cloud intersects the given frustum.
|
|
29507
|
+
*
|
|
29508
|
+
* @param {Frustum|FrustumArray} frustum - The frustum to test.
|
|
29509
|
+
* @return {boolean} Whether this point cloud intersects the given frustum or not.
|
|
29510
|
+
*/
|
|
29511
|
+
intersectsFrustum( frustum ) {
|
|
29512
|
+
|
|
29513
|
+
return frustum.intersectsObject( this );
|
|
29514
|
+
|
|
29515
|
+
}
|
|
29516
|
+
|
|
29166
29517
|
/**
|
|
29167
29518
|
* Computes intersection points between a casted ray and this point cloud.
|
|
29168
29519
|
*
|
|
@@ -29714,6 +30065,22 @@ class CompressedArrayTexture extends CompressedTexture {
|
|
|
29714
30065
|
|
|
29715
30066
|
}
|
|
29716
30067
|
|
|
30068
|
+
/**
|
|
30069
|
+
* Copies the values of the given texture to this instance.
|
|
30070
|
+
*
|
|
30071
|
+
* @param {CompressedArrayTexture} source - The texture to copy.
|
|
30072
|
+
* @return {CompressedArrayTexture} A reference to this instance.
|
|
30073
|
+
*/
|
|
30074
|
+
copy( source ) {
|
|
30075
|
+
|
|
30076
|
+
super.copy( source );
|
|
30077
|
+
|
|
30078
|
+
this.wrapR = source.wrapR;
|
|
30079
|
+
|
|
30080
|
+
return this;
|
|
30081
|
+
|
|
30082
|
+
}
|
|
30083
|
+
|
|
29717
30084
|
/**
|
|
29718
30085
|
* Describes that a specific layer of the texture needs to be updated.
|
|
29719
30086
|
* Normally when {@link Texture#needsUpdate} is set to `true`, the
|
|
@@ -30054,7 +30421,7 @@ class DepthTexture extends Texture {
|
|
|
30054
30421
|
|
|
30055
30422
|
super.copy( source );
|
|
30056
30423
|
|
|
30057
|
-
this.source = new
|
|
30424
|
+
this.source = new TextureSource( Object.assign( {}, source.image ) ); // see #30540
|
|
30058
30425
|
this.compareFunction = source.compareFunction;
|
|
30059
30426
|
|
|
30060
30427
|
return this;
|
|
@@ -30065,7 +30432,7 @@ class DepthTexture extends Texture {
|
|
|
30065
30432
|
|
|
30066
30433
|
const data = super.toJSON( meta );
|
|
30067
30434
|
|
|
30068
|
-
|
|
30435
|
+
data.compareFunction = this.compareFunction;
|
|
30069
30436
|
|
|
30070
30437
|
return data;
|
|
30071
30438
|
|
|
@@ -37587,7 +37954,7 @@ class TorusGeometry extends BufferGeometry {
|
|
|
37587
37954
|
*/
|
|
37588
37955
|
static fromJSON( data ) {
|
|
37589
37956
|
|
|
37590
|
-
return new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );
|
|
37957
|
+
return new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc, data.thetaStart, data.thetaLength );
|
|
37591
37958
|
|
|
37592
37959
|
}
|
|
37593
37960
|
|
|
@@ -39467,6 +39834,8 @@ class MeshStandardMaterial extends Material {
|
|
|
39467
39834
|
* transparent materials are less reflective. Physically-based transmission provides a more
|
|
39468
39835
|
* realistic option for thin, transparent surfaces like glass.
|
|
39469
39836
|
* - Advanced reflectivity: More flexible reflectivity for non-metallic materials.
|
|
39837
|
+
* - Retroreflection: Redirects specular light back toward the light source for
|
|
39838
|
+
* safety materials like road markings and reflective tape.
|
|
39470
39839
|
* - Sheen: Can be used for representing cloth and fabric materials.
|
|
39471
39840
|
*
|
|
39472
39841
|
* As a result of these complex shading features, `MeshPhysicalMaterial` has a
|
|
@@ -39802,6 +40171,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
39802
40171
|
this._clearcoat = 0;
|
|
39803
40172
|
this._dispersion = 0;
|
|
39804
40173
|
this._iridescence = 0;
|
|
40174
|
+
this._retroreflectivity = 0;
|
|
39805
40175
|
this._sheen = 0.0;
|
|
39806
40176
|
this._transmission = 0;
|
|
39807
40177
|
|
|
@@ -39909,6 +40279,33 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
39909
40279
|
|
|
39910
40280
|
}
|
|
39911
40281
|
|
|
40282
|
+
/**
|
|
40283
|
+
* The strength of retroreflection, from `0.0` to `1.0`. A value of `1.0`
|
|
40284
|
+
* evaluates the material's microfacet reflection with the view direction
|
|
40285
|
+
* reflected about the surface normal, redirecting the specular lobe back
|
|
40286
|
+
* toward the light source.
|
|
40287
|
+
*
|
|
40288
|
+
* @type {number}
|
|
40289
|
+
* @default 0
|
|
40290
|
+
*/
|
|
40291
|
+
get retroreflectivity() {
|
|
40292
|
+
|
|
40293
|
+
return this._retroreflectivity;
|
|
40294
|
+
|
|
40295
|
+
}
|
|
40296
|
+
|
|
40297
|
+
set retroreflectivity( value ) {
|
|
40298
|
+
|
|
40299
|
+
if ( this._retroreflectivity > 0 !== value > 0 ) {
|
|
40300
|
+
|
|
40301
|
+
this.version ++;
|
|
40302
|
+
|
|
40303
|
+
}
|
|
40304
|
+
|
|
40305
|
+
this._retroreflectivity = value;
|
|
40306
|
+
|
|
40307
|
+
}
|
|
40308
|
+
|
|
39912
40309
|
/**
|
|
39913
40310
|
* The intensity of the sheen layer, from `0.0` to `1.0`.
|
|
39914
40311
|
*
|
|
@@ -39994,6 +40391,8 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
39994
40391
|
this.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];
|
|
39995
40392
|
this.iridescenceThicknessMap = source.iridescenceThicknessMap;
|
|
39996
40393
|
|
|
40394
|
+
this.retroreflectivity = source.retroreflectivity;
|
|
40395
|
+
|
|
39997
40396
|
this.sheen = source.sheen;
|
|
39998
40397
|
this.sheenColor.copy( source.sheenColor );
|
|
39999
40398
|
this.sheenColorMap = source.sheenColorMap;
|
|
@@ -42079,6 +42478,18 @@ function convertArray( array, type ) {
|
|
|
42079
42478
|
|
|
42080
42479
|
}
|
|
42081
42480
|
|
|
42481
|
+
/**
|
|
42482
|
+
* Returns `true` if the given keyframe track settings hold Bezier tangent data.
|
|
42483
|
+
*
|
|
42484
|
+
* @param {?Object} settings - The settings of a keyframe track.
|
|
42485
|
+
* @return {boolean} Whether both tangent arrays are defined or not.
|
|
42486
|
+
*/
|
|
42487
|
+
function hasTangents( settings ) {
|
|
42488
|
+
|
|
42489
|
+
return settings !== undefined && settings.inTangents !== undefined && settings.outTangents !== undefined;
|
|
42490
|
+
|
|
42491
|
+
}
|
|
42492
|
+
|
|
42082
42493
|
/**
|
|
42083
42494
|
* Returns an array by which times and values can be sorted.
|
|
42084
42495
|
*
|
|
@@ -42461,6 +42872,19 @@ class AnimationUtils {
|
|
|
42461
42872
|
|
|
42462
42873
|
}
|
|
42463
42874
|
|
|
42875
|
+
/**
|
|
42876
|
+
* Returns `true` if the given keyframe track settings hold Bezier tangent data.
|
|
42877
|
+
*
|
|
42878
|
+
* @static
|
|
42879
|
+
* @param {?Object} settings - The settings of a keyframe track.
|
|
42880
|
+
* @return {boolean} Whether both tangent arrays are defined or not.
|
|
42881
|
+
*/
|
|
42882
|
+
static hasTangents( settings ) {
|
|
42883
|
+
|
|
42884
|
+
return hasTangents( settings );
|
|
42885
|
+
|
|
42886
|
+
}
|
|
42887
|
+
|
|
42464
42888
|
/**
|
|
42465
42889
|
* Returns an array by which times and values can be sorted.
|
|
42466
42890
|
*
|
|
@@ -43155,42 +43579,55 @@ class BezierInterpolant extends Interpolant {
|
|
|
43155
43579
|
const c1x = inTangents[ inTangentOffset ];
|
|
43156
43580
|
const c1y = inTangents[ inTangentOffset + 1 ];
|
|
43157
43581
|
|
|
43158
|
-
//
|
|
43159
|
-
|
|
43160
|
-
let s2, s3, oneMinusS, oneMinusS2, oneMinusS3;
|
|
43582
|
+
// Find the curve parameter s where the Bezier X(s) matches t, then evaluate Y(s)
|
|
43583
|
+
const s = solveBezierParameter( t, t0, c0x, c1x, t1 );
|
|
43161
43584
|
|
|
43162
|
-
|
|
43585
|
+
result[ i ] = cubicBezier( s, v0, c0y, c1y, v1 );
|
|
43163
43586
|
|
|
43164
|
-
|
|
43165
|
-
s3 = s2 * s;
|
|
43166
|
-
oneMinusS = 1 - s;
|
|
43167
|
-
oneMinusS2 = oneMinusS * oneMinusS;
|
|
43168
|
-
oneMinusS3 = oneMinusS2 * oneMinusS;
|
|
43587
|
+
}
|
|
43169
43588
|
|
|
43170
|
-
|
|
43171
|
-
const bx = oneMinusS3 * t0 + 3 * oneMinusS2 * s * c0x + 3 * oneMinusS * s2 * c1x + s3 * t1;
|
|
43589
|
+
return result;
|
|
43172
43590
|
|
|
43173
|
-
|
|
43174
|
-
if ( Math.abs( error ) < 1e-10 ) break;
|
|
43591
|
+
}
|
|
43175
43592
|
|
|
43176
|
-
|
|
43177
|
-
const dbx = 3 * oneMinusS2 * ( c0x - t0 ) + 6 * oneMinusS * s * ( c1x - c0x ) + 3 * s2 * ( t1 - c1x );
|
|
43178
|
-
if ( Math.abs( dbx ) < 1e-10 ) break;
|
|
43593
|
+
}
|
|
43179
43594
|
|
|
43180
|
-
|
|
43181
|
-
s = Math.max( 0, Math.min( 1, s ) );
|
|
43595
|
+
function cubicBezier( s, p0, p1, p2, p3 ) {
|
|
43182
43596
|
|
|
43183
|
-
|
|
43597
|
+
const k = 1 - s;
|
|
43184
43598
|
|
|
43185
|
-
|
|
43186
|
-
result[ i ] = oneMinusS3 * v0 + 3 * oneMinusS2 * s * c0y + 3 * oneMinusS * s2 * c1y + s3 * v1;
|
|
43599
|
+
return k * k * k * p0 + 3 * k * k * s * p1 + 3 * k * s * s * p2 + s * s * s * p3;
|
|
43187
43600
|
|
|
43188
|
-
|
|
43601
|
+
}
|
|
43189
43602
|
|
|
43190
|
-
|
|
43603
|
+
function cubicBezierSlope( s, p0, p1, p2, p3 ) {
|
|
43604
|
+
|
|
43605
|
+
const k = 1 - s;
|
|
43606
|
+
|
|
43607
|
+
return 3 * k * k * ( p1 - p0 ) + 6 * k * s * ( p2 - p1 ) + 3 * s * s * ( p3 - p2 );
|
|
43608
|
+
|
|
43609
|
+
}
|
|
43610
|
+
|
|
43611
|
+
// Solves cubicBezier( s, x0, x1, x2, x3 ) = x for s in [0,1] using Newton-Raphson
|
|
43612
|
+
|
|
43613
|
+
function solveBezierParameter( x, x0, x1, x2, x3 ) {
|
|
43614
|
+
|
|
43615
|
+
let s = ( x - x0 ) / ( x3 - x0 );
|
|
43616
|
+
|
|
43617
|
+
for ( let i = 0; i < 8; i ++ ) {
|
|
43618
|
+
|
|
43619
|
+
const error = cubicBezier( s, x0, x1, x2, x3 ) - x;
|
|
43620
|
+
if ( Math.abs( error ) < 1e-10 ) break;
|
|
43621
|
+
|
|
43622
|
+
const slope = cubicBezierSlope( s, x0, x1, x2, x3 );
|
|
43623
|
+
if ( Math.abs( slope ) < 1e-10 ) break;
|
|
43624
|
+
|
|
43625
|
+
s = Math.max( 0, Math.min( 1, s - error / slope ) );
|
|
43191
43626
|
|
|
43192
43627
|
}
|
|
43193
43628
|
|
|
43629
|
+
return s;
|
|
43630
|
+
|
|
43194
43631
|
}
|
|
43195
43632
|
|
|
43196
43633
|
/**
|
|
@@ -43277,6 +43714,15 @@ class KeyframeTrack {
|
|
|
43277
43714
|
|
|
43278
43715
|
}
|
|
43279
43716
|
|
|
43717
|
+
if ( hasTangents( track.settings ) ) {
|
|
43718
|
+
|
|
43719
|
+
json.settings = {
|
|
43720
|
+
inTangents: convertArray( track.settings.inTangents, Array ),
|
|
43721
|
+
outTangents: convertArray( track.settings.outTangents, Array )
|
|
43722
|
+
};
|
|
43723
|
+
|
|
43724
|
+
}
|
|
43725
|
+
|
|
43280
43726
|
}
|
|
43281
43727
|
|
|
43282
43728
|
json.type = track.ValueTypeName; // mandatory
|
|
@@ -43502,6 +43948,13 @@ class KeyframeTrack {
|
|
|
43502
43948
|
|
|
43503
43949
|
}
|
|
43504
43950
|
|
|
43951
|
+
if ( hasTangents( this.settings ) ) {
|
|
43952
|
+
|
|
43953
|
+
scaleTangentTimes( this.settings.inTangents, timeScale );
|
|
43954
|
+
scaleTangentTimes( this.settings.outTangents, timeScale );
|
|
43955
|
+
|
|
43956
|
+
}
|
|
43957
|
+
|
|
43505
43958
|
}
|
|
43506
43959
|
|
|
43507
43960
|
return this;
|
|
@@ -43777,12 +44230,33 @@ class KeyframeTrack {
|
|
|
43777
44230
|
// Interpolant argument to constructor is not saved, so copy the factory method directly.
|
|
43778
44231
|
track.createInterpolant = this.createInterpolant;
|
|
43779
44232
|
|
|
44233
|
+
if ( hasTangents( this.settings ) ) {
|
|
44234
|
+
|
|
44235
|
+
track.settings = {
|
|
44236
|
+
inTangents: this.settings.inTangents.slice(),
|
|
44237
|
+
outTangents: this.settings.outTangents.slice()
|
|
44238
|
+
};
|
|
44239
|
+
|
|
44240
|
+
}
|
|
44241
|
+
|
|
43780
44242
|
return track;
|
|
43781
44243
|
|
|
43782
44244
|
}
|
|
43783
44245
|
|
|
43784
44246
|
}
|
|
43785
44247
|
|
|
44248
|
+
function scaleTangentTimes( tangents, timeScale ) {
|
|
44249
|
+
|
|
44250
|
+
// tangents are [ time, value ] pairs, so only every second entry is a time
|
|
44251
|
+
|
|
44252
|
+
for ( let i = 0, n = tangents.length; i !== n; i += 2 ) {
|
|
44253
|
+
|
|
44254
|
+
tangents[ i ] *= timeScale;
|
|
44255
|
+
|
|
44256
|
+
}
|
|
44257
|
+
|
|
44258
|
+
}
|
|
44259
|
+
|
|
43786
44260
|
/**
|
|
43787
44261
|
* The value type name.
|
|
43788
44262
|
*
|
|
@@ -44563,18 +45037,31 @@ function parseKeyframeTrack( json ) {
|
|
|
44563
45037
|
|
|
44564
45038
|
}
|
|
44565
45039
|
|
|
45040
|
+
let track;
|
|
45041
|
+
|
|
44566
45042
|
// derived classes can define a static parse method
|
|
44567
45043
|
if ( trackType.parse !== undefined ) {
|
|
44568
45044
|
|
|
44569
|
-
|
|
45045
|
+
track = trackType.parse( json );
|
|
44570
45046
|
|
|
44571
45047
|
} else {
|
|
44572
45048
|
|
|
44573
45049
|
// by default, we assume a constructor compatible with the base
|
|
44574
|
-
|
|
45050
|
+
track = new trackType( json.name, json.times, json.values, json.interpolation );
|
|
45051
|
+
|
|
45052
|
+
}
|
|
45053
|
+
|
|
45054
|
+
if ( hasTangents( json.settings ) ) {
|
|
45055
|
+
|
|
45056
|
+
track.settings = {
|
|
45057
|
+
inTangents: convertArray( json.settings.inTangents, Float32Array ),
|
|
45058
|
+
outTangents: convertArray( json.settings.outTangents, Float32Array )
|
|
45059
|
+
};
|
|
44575
45060
|
|
|
44576
45061
|
}
|
|
44577
45062
|
|
|
45063
|
+
return track;
|
|
45064
|
+
|
|
44578
45065
|
}
|
|
44579
45066
|
|
|
44580
45067
|
/**
|
|
@@ -46393,16 +46880,6 @@ class Light extends Object3D {
|
|
|
46393
46880
|
|
|
46394
46881
|
}
|
|
46395
46882
|
|
|
46396
|
-
/**
|
|
46397
|
-
* Frees the GPU-related resources allocated by this instance. Call this
|
|
46398
|
-
* method whenever this instance is no longer used in your app.
|
|
46399
|
-
*/
|
|
46400
|
-
dispose() {
|
|
46401
|
-
|
|
46402
|
-
this.dispatchEvent( { type: 'dispose' } );
|
|
46403
|
-
|
|
46404
|
-
}
|
|
46405
|
-
|
|
46406
46883
|
copy( source, recursive ) {
|
|
46407
46884
|
|
|
46408
46885
|
super.copy( source, recursive );
|
|
@@ -46675,6 +47152,18 @@ class LightShadow {
|
|
|
46675
47152
|
|
|
46676
47153
|
}
|
|
46677
47154
|
|
|
47155
|
+
/**
|
|
47156
|
+
* Used internally by the renderer to get the camera that renders the given viewport.
|
|
47157
|
+
*
|
|
47158
|
+
* @param {number} [viewportIndex=0] - The viewport index.
|
|
47159
|
+
* @return {Camera} The shadow camera.
|
|
47160
|
+
*/
|
|
47161
|
+
getCamera( /* viewportIndex */ ) {
|
|
47162
|
+
|
|
47163
|
+
return this.camera;
|
|
47164
|
+
|
|
47165
|
+
}
|
|
47166
|
+
|
|
46678
47167
|
/**
|
|
46679
47168
|
* Gets the shadow cameras frustum. Used internally by the renderer to cull objects.
|
|
46680
47169
|
*
|
|
@@ -46694,23 +47183,41 @@ class LightShadow {
|
|
|
46694
47183
|
updateMatrices( light ) {
|
|
46695
47184
|
|
|
46696
47185
|
const shadowCamera = this.camera;
|
|
46697
|
-
const shadowMatrix = this.matrix;
|
|
46698
|
-
|
|
46699
47186
|
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
|
|
46700
47187
|
shadowCamera.position.copy( _lightPositionWorld );
|
|
46701
47188
|
|
|
46702
47189
|
_lookTarget.setFromMatrixPosition( light.target.matrixWorld );
|
|
46703
47190
|
shadowCamera.lookAt( _lookTarget );
|
|
46704
47191
|
shadowCamera.updateMatrixWorld();
|
|
47192
|
+
this._updateMatrix( shadowCamera, this.matrix, this._frustum );
|
|
47193
|
+
|
|
47194
|
+
}
|
|
47195
|
+
|
|
47196
|
+
/**
|
|
47197
|
+
* Updates a shadow projection matrix and its corresponding frustum.
|
|
47198
|
+
*
|
|
47199
|
+
* @private
|
|
47200
|
+
* @param {Camera} shadowCamera - The shadow camera.
|
|
47201
|
+
* @param {Matrix4} shadowMatrix - The target shadow matrix.
|
|
47202
|
+
* @param {Frustum} frustum - The target frustum.
|
|
47203
|
+
* @param {Vector4} [viewport] - The viewport within the shadow atlas.
|
|
47204
|
+
*/
|
|
47205
|
+
_updateMatrix( shadowCamera, shadowMatrix, frustum, viewport ) {
|
|
46705
47206
|
|
|
46706
47207
|
_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
|
|
46707
|
-
|
|
47208
|
+
frustum.setFromProjectionMatrix( _projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );
|
|
47209
|
+
|
|
47210
|
+
const frameExtents = this._frameExtents;
|
|
47211
|
+
const scaleX = viewport ? viewport.z / frameExtents.x : 1;
|
|
47212
|
+
const scaleY = viewport ? viewport.w / frameExtents.y : 1;
|
|
47213
|
+
const offsetX = viewport ? viewport.x / frameExtents.x : 0;
|
|
47214
|
+
const offsetY = viewport ? viewport.y / frameExtents.y : 0;
|
|
46708
47215
|
|
|
46709
47216
|
if ( shadowCamera.coordinateSystem === WebGPUCoordinateSystem || shadowCamera.reversedDepth ) {
|
|
46710
47217
|
|
|
46711
47218
|
shadowMatrix.set(
|
|
46712
|
-
0.5, 0.0, 0.0, 0.5,
|
|
46713
|
-
0.0, 0.5, 0.0, 0.5,
|
|
47219
|
+
0.5 * scaleX, 0.0, 0.0, 0.5 * scaleX + offsetX,
|
|
47220
|
+
0.0, 0.5 * scaleY, 0.0, 0.5 * scaleY + offsetY,
|
|
46714
47221
|
0.0, 0.0, 1.0, 0.0, // Identity Z (preserving the correct [0, 1] range from the projection matrix)
|
|
46715
47222
|
0.0, 0.0, 0.0, 1.0
|
|
46716
47223
|
);
|
|
@@ -46718,8 +47225,8 @@ class LightShadow {
|
|
|
46718
47225
|
} else {
|
|
46719
47226
|
|
|
46720
47227
|
shadowMatrix.set(
|
|
46721
|
-
0.5, 0.0, 0.0, 0.5,
|
|
46722
|
-
0.0, 0.5, 0.0, 0.5,
|
|
47228
|
+
0.5 * scaleX, 0.0, 0.0, 0.5 * scaleX + offsetX,
|
|
47229
|
+
0.0, 0.5 * scaleY, 0.0, 0.5 * scaleY + offsetY,
|
|
46723
47230
|
0.0, 0.0, 0.5, 0.5,
|
|
46724
47231
|
0.0, 0.0, 0.0, 1.0
|
|
46725
47232
|
);
|
|
@@ -46822,11 +47329,12 @@ class LightShadow {
|
|
|
46822
47329
|
|
|
46823
47330
|
const object = {};
|
|
46824
47331
|
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
47332
|
+
object.intensity = this.intensity;
|
|
47333
|
+
object.bias = this.bias;
|
|
47334
|
+
object.normalBias = this.normalBias;
|
|
47335
|
+
object.radius = this.radius;
|
|
47336
|
+
object.blurSamples = this.blurSamples;
|
|
47337
|
+
object.mapSize = this.mapSize.toArray();
|
|
46830
47338
|
|
|
46831
47339
|
object.camera = this.camera.toJSON( false ).object;
|
|
46832
47340
|
delete object.camera.matrix;
|
|
@@ -47459,11 +47967,29 @@ class SpotLightShadow extends LightShadow {
|
|
|
47459
47967
|
super.copy( source );
|
|
47460
47968
|
|
|
47461
47969
|
this.focus = source.focus;
|
|
47970
|
+
this.aspect = source.aspect;
|
|
47462
47971
|
|
|
47463
47972
|
return this;
|
|
47464
47973
|
|
|
47465
47974
|
}
|
|
47466
47975
|
|
|
47976
|
+
/**
|
|
47977
|
+
* Serializes the light shadow into JSON.
|
|
47978
|
+
*
|
|
47979
|
+
* @return {Object} A JSON object representing the serialized light shadow.
|
|
47980
|
+
* @see {@link ObjectLoader#parse}
|
|
47981
|
+
*/
|
|
47982
|
+
toJSON() {
|
|
47983
|
+
|
|
47984
|
+
const object = super.toJSON();
|
|
47985
|
+
|
|
47986
|
+
object.focus = this.focus;
|
|
47987
|
+
object.aspect = this.aspect;
|
|
47988
|
+
|
|
47989
|
+
return object;
|
|
47990
|
+
|
|
47991
|
+
}
|
|
47992
|
+
|
|
47467
47993
|
}
|
|
47468
47994
|
|
|
47469
47995
|
/**
|
|
@@ -49139,6 +49665,8 @@ class BufferGeometryLoader extends Loader {
|
|
|
49139
49665
|
const ib = new InterleavedBuffer( array, interleavedBuffer.stride );
|
|
49140
49666
|
ib.uuid = interleavedBuffer.uuid;
|
|
49141
49667
|
|
|
49668
|
+
if ( interleavedBuffer.usage !== undefined ) ib.setUsage( interleavedBuffer.usage );
|
|
49669
|
+
|
|
49142
49670
|
interleavedBufferMap[ uuid ] = ib;
|
|
49143
49671
|
|
|
49144
49672
|
return ib;
|
|
@@ -49193,6 +49721,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
49193
49721
|
|
|
49194
49722
|
if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
|
|
49195
49723
|
if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
|
|
49724
|
+
if ( attribute.gpuType !== undefined ) bufferAttribute.gpuType = attribute.gpuType;
|
|
49196
49725
|
|
|
49197
49726
|
geometry.setAttribute( key, bufferAttribute );
|
|
49198
49727
|
|
|
@@ -49226,6 +49755,8 @@ class BufferGeometryLoader extends Loader {
|
|
|
49226
49755
|
}
|
|
49227
49756
|
|
|
49228
49757
|
if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
|
|
49758
|
+
if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
|
|
49759
|
+
if ( attribute.gpuType !== undefined ) bufferAttribute.gpuType = attribute.gpuType;
|
|
49229
49760
|
array.push( bufferAttribute );
|
|
49230
49761
|
|
|
49231
49762
|
}
|
|
@@ -49758,14 +50289,14 @@ class ObjectLoader extends Loader {
|
|
|
49758
50289
|
|
|
49759
50290
|
}
|
|
49760
50291
|
|
|
49761
|
-
images[ image.uuid ] = new
|
|
50292
|
+
images[ image.uuid ] = new TextureSource( imageArray );
|
|
49762
50293
|
|
|
49763
50294
|
} else {
|
|
49764
50295
|
|
|
49765
50296
|
// load single image
|
|
49766
50297
|
|
|
49767
50298
|
const deserializedImage = deserializeImage( image.url );
|
|
49768
|
-
images[ image.uuid ] = new
|
|
50299
|
+
images[ image.uuid ] = new TextureSource( deserializedImage );
|
|
49769
50300
|
|
|
49770
50301
|
|
|
49771
50302
|
}
|
|
@@ -49855,14 +50386,14 @@ class ObjectLoader extends Loader {
|
|
|
49855
50386
|
|
|
49856
50387
|
}
|
|
49857
50388
|
|
|
49858
|
-
images[ image.uuid ] = new
|
|
50389
|
+
images[ image.uuid ] = new TextureSource( imageArray );
|
|
49859
50390
|
|
|
49860
50391
|
} else {
|
|
49861
50392
|
|
|
49862
50393
|
// load single image
|
|
49863
50394
|
|
|
49864
50395
|
const deserializedImage = await deserializeImage( image.url );
|
|
49865
|
-
images[ image.uuid ] = new
|
|
50396
|
+
images[ image.uuid ] = new TextureSource( deserializedImage );
|
|
49866
50397
|
|
|
49867
50398
|
}
|
|
49868
50399
|
|
|
@@ -50376,6 +50907,9 @@ class ObjectLoader extends Loader {
|
|
|
50376
50907
|
if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
|
|
50377
50908
|
if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
|
|
50378
50909
|
if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
|
|
50910
|
+
if ( data.shadow.blurSamples !== undefined ) object.shadow.blurSamples = data.shadow.blurSamples;
|
|
50911
|
+
if ( data.shadow.focus !== undefined ) object.shadow.focus = data.shadow.focus;
|
|
50912
|
+
if ( data.shadow.aspect !== undefined ) object.shadow.aspect = data.shadow.aspect;
|
|
50379
50913
|
if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );
|
|
50380
50914
|
if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );
|
|
50381
50915
|
|
|
@@ -50694,7 +51228,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
50694
51228
|
|
|
50695
51229
|
} ).then( function ( blob ) {
|
|
50696
51230
|
|
|
50697
|
-
return createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );
|
|
51231
|
+
return createImageBitmap( blob, Object.assign( {}, scope.options, { colorSpaceConversion: 'none' } ) );
|
|
50698
51232
|
|
|
50699
51233
|
} ).then( function ( imageBitmap ) {
|
|
50700
51234
|
|
|
@@ -50704,6 +51238,8 @@ class ImageBitmapLoader extends Loader {
|
|
|
50704
51238
|
|
|
50705
51239
|
scope.manager.itemEnd( url );
|
|
50706
51240
|
|
|
51241
|
+
return imageBitmap; // see #34150
|
|
51242
|
+
|
|
50707
51243
|
} ).catch( function ( e ) {
|
|
50708
51244
|
|
|
50709
51245
|
if ( onError ) onError( e );
|
|
@@ -54284,12 +54820,24 @@ class AnimationObjectGroup {
|
|
|
54284
54820
|
lastIndex = -- nObjects,
|
|
54285
54821
|
lastObject = objects[ lastIndex ];
|
|
54286
54822
|
|
|
54287
|
-
|
|
54288
|
-
|
|
54823
|
+
if ( index !== firstActiveIndex ) {
|
|
54824
|
+
|
|
54825
|
+
// last cached object takes this object's place
|
|
54826
|
+
|
|
54827
|
+
indicesByUUID[ lastCachedObject.uuid ] = index;
|
|
54828
|
+
|
|
54829
|
+
}
|
|
54830
|
+
|
|
54289
54831
|
objects[ index ] = lastCachedObject;
|
|
54290
54832
|
|
|
54291
|
-
|
|
54292
|
-
|
|
54833
|
+
if ( firstActiveIndex !== lastIndex ) {
|
|
54834
|
+
|
|
54835
|
+
// last object goes to the activated slot and pop
|
|
54836
|
+
|
|
54837
|
+
indicesByUUID[ lastObject.uuid ] = firstActiveIndex;
|
|
54838
|
+
|
|
54839
|
+
}
|
|
54840
|
+
|
|
54293
54841
|
objects[ firstActiveIndex ] = lastObject;
|
|
54294
54842
|
objects.pop();
|
|
54295
54843
|
|
|
@@ -54314,7 +54862,7 @@ class AnimationObjectGroup {
|
|
|
54314
54862
|
const lastIndex = -- nObjects,
|
|
54315
54863
|
lastObject = objects[ lastIndex ];
|
|
54316
54864
|
|
|
54317
|
-
if (
|
|
54865
|
+
if ( index !== lastIndex ) {
|
|
54318
54866
|
|
|
54319
54867
|
indicesByUUID[ lastObject.uuid ] = index;
|
|
54320
54868
|
|
|
@@ -54398,7 +54946,7 @@ class AnimationObjectGroup {
|
|
|
54398
54946
|
bindings = this._bindings,
|
|
54399
54947
|
lastBindingsIndex = bindings.length - 1,
|
|
54400
54948
|
lastBindings = bindings[ lastBindingsIndex ],
|
|
54401
|
-
lastBindingsPath =
|
|
54949
|
+
lastBindingsPath = paths[ lastBindingsIndex ];
|
|
54402
54950
|
|
|
54403
54951
|
indicesByPath[ lastBindingsPath ] = index;
|
|
54404
54952
|
|
|
@@ -56240,15 +56788,19 @@ class RenderTarget3D extends RenderTarget {
|
|
|
56240
56788
|
|
|
56241
56789
|
this.depth = depth;
|
|
56242
56790
|
|
|
56243
|
-
|
|
56244
|
-
* Overwritten with a different texture type.
|
|
56245
|
-
*
|
|
56246
|
-
* @type {Data3DTexture}
|
|
56247
|
-
*/
|
|
56248
|
-
this.texture = new Data3DTexture( null, width, height, depth );
|
|
56249
|
-
this._setTextureOptions( options );
|
|
56791
|
+
// overwrite attachments with 3D textures
|
|
56250
56792
|
|
|
56251
|
-
this.
|
|
56793
|
+
for ( let i = 0; i < this.textures.length; i ++ ) {
|
|
56794
|
+
|
|
56795
|
+
const texture = new Data3DTexture( null, width, height, depth );
|
|
56796
|
+
texture.isRenderTargetTexture = true;
|
|
56797
|
+
texture.renderTarget = this;
|
|
56798
|
+
|
|
56799
|
+
this.textures[ i ] = texture;
|
|
56800
|
+
|
|
56801
|
+
}
|
|
56802
|
+
|
|
56803
|
+
this._setTextureOptions( options );
|
|
56252
56804
|
|
|
56253
56805
|
}
|
|
56254
56806
|
|
|
@@ -56898,6 +57450,10 @@ class Raycaster {
|
|
|
56898
57450
|
* be detected. To raycast against both faces of an object, you'll want to set {@link Material#side}
|
|
56899
57451
|
* to `THREE.DoubleSide`.
|
|
56900
57452
|
*
|
|
57453
|
+
* Note that a ray hitting a triangle mesh exactly along an edge shared by two faces may be
|
|
57454
|
+
* reported by both faces, resulting in two coincident intersections (identical point and
|
|
57455
|
+
* distance) in the returned array.
|
|
57456
|
+
*
|
|
56901
57457
|
* @param {Object3D} object - The 3D object to check for intersection with the ray.
|
|
56902
57458
|
* @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.
|
|
56903
57459
|
* Otherwise it only checks intersection with the object.
|
|
@@ -58297,6 +58853,8 @@ class SpotLightHelper extends Object3D {
|
|
|
58297
58853
|
*/
|
|
58298
58854
|
dispose() {
|
|
58299
58855
|
|
|
58856
|
+
super.dispose();
|
|
58857
|
+
|
|
58300
58858
|
this.cone.geometry.dispose();
|
|
58301
58859
|
this.cone.material.dispose();
|
|
58302
58860
|
|
|
@@ -58508,6 +59066,8 @@ class SkeletonHelper extends LineSegments {
|
|
|
58508
59066
|
*/
|
|
58509
59067
|
dispose() {
|
|
58510
59068
|
|
|
59069
|
+
super.dispose();
|
|
59070
|
+
|
|
58511
59071
|
this.geometry.dispose();
|
|
58512
59072
|
this.material.dispose();
|
|
58513
59073
|
|
|
@@ -58599,6 +59159,8 @@ class PointLightHelper extends Mesh {
|
|
|
58599
59159
|
*/
|
|
58600
59160
|
dispose() {
|
|
58601
59161
|
|
|
59162
|
+
super.dispose();
|
|
59163
|
+
|
|
58602
59164
|
this.geometry.dispose();
|
|
58603
59165
|
this.material.dispose();
|
|
58604
59166
|
|
|
@@ -58719,6 +59281,8 @@ class HemisphereLightHelper extends Object3D {
|
|
|
58719
59281
|
*/
|
|
58720
59282
|
dispose() {
|
|
58721
59283
|
|
|
59284
|
+
super.dispose();
|
|
59285
|
+
|
|
58722
59286
|
this.children[ 0 ].geometry.dispose();
|
|
58723
59287
|
this.children[ 0 ].material.dispose();
|
|
58724
59288
|
|
|
@@ -58832,6 +59396,8 @@ class GridHelper extends LineSegments {
|
|
|
58832
59396
|
*/
|
|
58833
59397
|
dispose() {
|
|
58834
59398
|
|
|
59399
|
+
super.dispose();
|
|
59400
|
+
|
|
58835
59401
|
this.geometry.dispose();
|
|
58836
59402
|
this.material.dispose();
|
|
58837
59403
|
|
|
@@ -58950,6 +59516,8 @@ class PolarGridHelper extends LineSegments {
|
|
|
58950
59516
|
*/
|
|
58951
59517
|
dispose() {
|
|
58952
59518
|
|
|
59519
|
+
super.dispose();
|
|
59520
|
+
|
|
58953
59521
|
this.geometry.dispose();
|
|
58954
59522
|
this.material.dispose();
|
|
58955
59523
|
|
|
@@ -59055,6 +59623,8 @@ class DirectionalLightHelper extends Object3D {
|
|
|
59055
59623
|
*/
|
|
59056
59624
|
dispose() {
|
|
59057
59625
|
|
|
59626
|
+
super.dispose();
|
|
59627
|
+
|
|
59058
59628
|
this.lightPlane.geometry.dispose();
|
|
59059
59629
|
this.lightPlane.material.dispose();
|
|
59060
59630
|
this.targetLine.geometry.dispose();
|
|
@@ -59405,6 +59975,8 @@ class CameraHelper extends LineSegments {
|
|
|
59405
59975
|
*/
|
|
59406
59976
|
dispose() {
|
|
59407
59977
|
|
|
59978
|
+
super.dispose();
|
|
59979
|
+
|
|
59408
59980
|
this.geometry.dispose();
|
|
59409
59981
|
this.material.dispose();
|
|
59410
59982
|
|
|
@@ -59567,6 +60139,8 @@ class BoxHelper extends LineSegments {
|
|
|
59567
60139
|
*/
|
|
59568
60140
|
dispose() {
|
|
59569
60141
|
|
|
60142
|
+
super.dispose();
|
|
60143
|
+
|
|
59570
60144
|
this.geometry.dispose();
|
|
59571
60145
|
this.material.dispose();
|
|
59572
60146
|
|
|
@@ -59644,6 +60218,8 @@ class Box3Helper extends LineSegments {
|
|
|
59644
60218
|
*/
|
|
59645
60219
|
dispose() {
|
|
59646
60220
|
|
|
60221
|
+
super.dispose();
|
|
60222
|
+
|
|
59647
60223
|
this.geometry.dispose();
|
|
59648
60224
|
this.material.dispose();
|
|
59649
60225
|
|
|
@@ -59730,6 +60306,8 @@ class PlaneHelper extends Line {
|
|
|
59730
60306
|
*/
|
|
59731
60307
|
dispose() {
|
|
59732
60308
|
|
|
60309
|
+
super.dispose();
|
|
60310
|
+
|
|
59733
60311
|
this.geometry.dispose();
|
|
59734
60312
|
this.material.dispose();
|
|
59735
60313
|
this.children[ 0 ].geometry.dispose();
|
|
@@ -59890,6 +60468,8 @@ class ArrowHelper extends Object3D {
|
|
|
59890
60468
|
*/
|
|
59891
60469
|
dispose() {
|
|
59892
60470
|
|
|
60471
|
+
super.dispose();
|
|
60472
|
+
|
|
59893
60473
|
this.line.geometry.dispose();
|
|
59894
60474
|
this.line.material.dispose();
|
|
59895
60475
|
this.cone.geometry.dispose();
|
|
@@ -59980,6 +60560,8 @@ class AxesHelper extends LineSegments {
|
|
|
59980
60560
|
*/
|
|
59981
60561
|
dispose() {
|
|
59982
60562
|
|
|
60563
|
+
super.dispose();
|
|
60564
|
+
|
|
59983
60565
|
this.geometry.dispose();
|
|
59984
60566
|
this.material.dispose();
|
|
59985
60567
|
|
|
@@ -60415,13 +60997,6 @@ class Controls extends EventDispatcher {
|
|
|
60415
60997
|
*/
|
|
60416
60998
|
connect( element ) {
|
|
60417
60999
|
|
|
60418
|
-
if ( element === undefined ) {
|
|
60419
|
-
|
|
60420
|
-
warn( 'Controls: connect() now requires an element.' ); // @deprecated, the warning can be removed with r185
|
|
60421
|
-
return;
|
|
60422
|
-
|
|
60423
|
-
}
|
|
60424
|
-
|
|
60425
61000
|
if ( this.domElement !== null ) this.disconnect();
|
|
60426
61001
|
|
|
60427
61002
|
this.domElement = element;
|
|
@@ -62472,4 +63047,4 @@ if ( typeof window !== 'undefined' ) {
|
|
|
62472
63047
|
|
|
62473
63048
|
}
|
|
62474
63049
|
|
|
62475
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NodePath, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, XorShift32, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, allocateNodeId, cloneUniforms, collectSiblingNodeIds, configureNodeIdSeed, createCanvasElement, createElementNS, ensureUniqueNodeIdAmongParentChildren, error, generateNodeId, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, hashStringToUint32, isTypedArray, isValidNodeId, log, mergeUniforms, nodeIdFromKey, nodeIdFromString, nodeIdToString, probeAsync, profile, profileClass, randomSeedUint32, setConsoleFunction, warn, warnOnce, xorshift32, yieldToMain };
|
|
63050
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, LightShadow, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NodePath, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureSource, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, XorShift32, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, allocateNodeId, cloneUniforms, collectSiblingNodeIds, configureNodeIdSeed, createCanvasElement, createElementNS, ensureUniqueNodeIdAmongParentChildren, error, generateNodeId, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, hashStringToUint32, isTypedArray, isValidNodeId, log, mergeUniforms, nodeIdFromKey, nodeIdFromString, nodeIdToString, probeAsync, profile, profileClass, randomSeedUint32, setConsoleFunction, warn, warnOnce, xorshift32, yieldToMain };
|