@needle-tools/three 0.169.20 → 0.183.2-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +5 -6
- package/build/three.cjs +54178 -56709
- package/build/three.core.js +59506 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +11645 -73012
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +648 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +53905 -51657
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +53884 -51814
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +5 -15
- package/examples/jsm/animation/AnimationClipCreator.js +58 -6
- package/examples/jsm/animation/CCDIKSolver.js +152 -45
- package/examples/jsm/capabilities/WebGL.js +28 -29
- package/examples/jsm/capabilities/WebGPU.js +19 -17
- package/examples/jsm/controls/ArcballControls.js +474 -178
- package/examples/jsm/controls/DragControls.js +100 -58
- package/examples/jsm/controls/FirstPersonControls.js +116 -6
- package/examples/jsm/controls/FlyControls.js +50 -2
- package/examples/jsm/controls/MapControls.js +96 -8
- package/examples/jsm/controls/OrbitControls.js +496 -57
- package/examples/jsm/controls/PointerLockControls.js +115 -22
- package/examples/jsm/controls/TrackballControls.js +166 -14
- package/examples/jsm/controls/TransformControls.js +336 -26
- package/examples/jsm/csm/CSM.js +232 -18
- package/examples/jsm/csm/CSMFrustum.js +61 -4
- package/examples/jsm/csm/CSMHelper.js +50 -0
- package/examples/jsm/csm/CSMShader.js +13 -1
- package/examples/jsm/csm/CSMShadowNode.js +599 -0
- package/examples/jsm/curves/CurveExtras.js +303 -31
- package/examples/jsm/curves/NURBSCurve.js +91 -16
- package/examples/jsm/curves/NURBSSurface.js +52 -6
- package/examples/jsm/curves/NURBSUtils.js +102 -112
- package/examples/jsm/curves/NURBSVolume.js +24 -4
- package/examples/jsm/effects/AnaglyphEffect.js +134 -7
- package/examples/jsm/effects/AsciiEffect.js +69 -22
- package/examples/jsm/effects/OutlineEffect.js +61 -111
- package/examples/jsm/effects/ParallaxBarrierEffect.js +30 -0
- package/examples/jsm/effects/StereoEffect.js +31 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +50 -0
- package/examples/jsm/environments/RoomEnvironment.js +83 -42
- package/examples/jsm/exporters/DRACOExporter.js +56 -14
- package/examples/jsm/exporters/EXRExporter.js +40 -9
- package/examples/jsm/exporters/GLTFExporter.js +502 -169
- package/examples/jsm/exporters/OBJExporter.js +21 -1
- package/examples/jsm/exporters/PLYExporter.js +44 -12
- package/examples/jsm/exporters/STLExporter.js +27 -5
- package/examples/jsm/exporters/USDZExporter.js +781 -291
- package/examples/jsm/geometries/BoxLineGeometry.js +23 -0
- package/examples/jsm/geometries/ConvexGeometry.js +19 -0
- package/examples/jsm/geometries/DecalGeometry.js +91 -30
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +38 -5
- package/examples/jsm/geometries/RoundedBoxGeometry.js +68 -7
- package/examples/jsm/geometries/TeapotGeometry.js +23 -38
- package/examples/jsm/geometries/TextGeometry.js +48 -29
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeHelper.js +36 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +38 -1
- package/examples/jsm/helpers/OctreeHelper.js +36 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +60 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +36 -3
- package/examples/jsm/helpers/TextureHelper.js +28 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +61 -2
- package/examples/jsm/helpers/VertexTangentsHelper.js +47 -2
- package/examples/jsm/helpers/ViewHelper.js +181 -9
- package/examples/jsm/inspector/Inspector.js +487 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Parameters.js +348 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +1975 -0
- package/examples/jsm/inspector/ui/Style.js +1613 -0
- package/examples/jsm/inspector/ui/Tab.js +233 -0
- package/examples/jsm/inspector/ui/Values.js +439 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +43 -12
- package/examples/jsm/interactive/InteractiveGroup.js +170 -52
- package/examples/jsm/interactive/SelectionBox.js +106 -9
- package/examples/jsm/interactive/SelectionHelper.js +76 -30
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +76 -58
- package/examples/jsm/libs/motion-controllers.module.js +1 -1
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +44 -7
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +50 -14
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +16 -0
- package/examples/jsm/lines/Line2.js +41 -4
- package/examples/jsm/lines/LineGeometry.js +80 -2
- package/examples/jsm/lines/LineMaterial.js +105 -5
- package/examples/jsm/lines/LineSegments2.js +54 -4
- package/examples/jsm/lines/LineSegmentsGeometry.js +65 -8
- package/examples/jsm/lines/Wireframe.js +41 -4
- package/examples/jsm/lines/WireframeGeometry2.js +27 -2
- package/examples/jsm/lines/webgpu/Line2.js +28 -2
- package/examples/jsm/lines/webgpu/LineSegments2.js +59 -24
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +78 -6
- package/examples/jsm/loaders/3MFLoader.js +148 -7
- package/examples/jsm/loaders/AMFLoader.js +34 -14
- package/examples/jsm/loaders/BVHLoader.js +59 -12
- package/examples/jsm/loaders/ColladaLoader.js +61 -4027
- package/examples/jsm/loaders/DDSLoader.js +68 -1
- package/examples/jsm/loaders/DRACOLoader.js +146 -22
- package/examples/jsm/loaders/EXRLoader.js +255 -34
- package/examples/jsm/loaders/FBXLoader.js +80 -42
- package/examples/jsm/loaders/FontLoader.js +83 -6
- package/examples/jsm/loaders/GCodeLoader.js +71 -14
- package/examples/jsm/loaders/GLTFLoader.js +381 -263
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +52 -3
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +42 -0
- package/examples/jsm/loaders/KMZLoader.js +39 -6
- package/examples/jsm/loaders/KTX2Loader.js +124 -48
- package/examples/jsm/loaders/KTXLoader.js +31 -10
- package/examples/jsm/loaders/LDrawLoader.js +192 -145
- package/examples/jsm/loaders/LUT3dlLoader.js +47 -10
- package/examples/jsm/loaders/LUTCubeLoader.js +46 -9
- package/examples/jsm/loaders/LUTImageLoader.js +79 -38
- package/examples/jsm/loaders/LWOLoader.js +54 -59
- package/examples/jsm/loaders/LottieLoader.js +54 -1
- package/examples/jsm/loaders/MD2Loader.js +37 -1
- package/examples/jsm/loaders/MDDLoader.js +57 -12
- package/examples/jsm/loaders/MTLLoader.js +60 -35
- package/examples/jsm/loaders/MaterialXLoader.js +268 -34
- package/examples/jsm/loaders/NRRDLoader.js +40 -8
- package/examples/jsm/loaders/OBJLoader.js +51 -2
- package/examples/jsm/loaders/PCDLoader.js +173 -21
- package/examples/jsm/loaders/PDBLoader.js +41 -2
- package/examples/jsm/loaders/PLYLoader.js +70 -39
- package/examples/jsm/loaders/PVRLoader.js +25 -6
- package/examples/jsm/loaders/RGBELoader.js +6 -438
- package/examples/jsm/loaders/STLLoader.js +48 -38
- package/examples/jsm/loaders/SVGLoader.js +119 -25
- package/examples/jsm/loaders/TDSLoader.js +92 -74
- package/examples/jsm/loaders/TGALoader.js +23 -2
- package/examples/jsm/loaders/TIFFLoader.js +23 -0
- package/examples/jsm/loaders/TTFLoader.js +50 -3
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -858
- package/examples/jsm/loaders/UltraHDRLoader.js +338 -166
- package/examples/jsm/loaders/VOXLoader.js +688 -87
- package/examples/jsm/loaders/VRMLLoader.js +121 -12
- package/examples/jsm/loaders/VTKLoader.js +77 -25
- package/examples/jsm/loaders/XYZLoader.js +36 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +2950 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1962 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +77 -77
- package/examples/jsm/loaders/usd/USDAParser.js +822 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1852 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4041 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/Capsule.js +91 -14
- package/examples/jsm/math/ColorConverter.js +22 -0
- package/examples/jsm/math/ColorSpaces.js +74 -2
- package/examples/jsm/math/ConvexHull.js +517 -93
- package/examples/jsm/math/ImprovedNoise.js +32 -15
- package/examples/jsm/math/Lut.js +113 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +78 -13
- package/examples/jsm/math/OBB.js +141 -29
- package/examples/jsm/math/Octree.js +283 -7
- package/examples/jsm/math/SimplexNoise.js +68 -42
- package/examples/jsm/misc/ConvexObjectBreaker.js +45 -25
- package/examples/jsm/misc/GPUComputationRenderer.js +96 -20
- package/examples/jsm/misc/Gyroscope.js +12 -0
- package/examples/jsm/misc/MD2Character.js +117 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +175 -11
- package/examples/jsm/misc/MorphAnimMesh.js +44 -0
- package/examples/jsm/misc/MorphBlendMesh.js +103 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +100 -54
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +57 -0
- package/examples/jsm/misc/TubePainter.js +437 -40
- package/examples/jsm/misc/Volume.js +123 -76
- package/examples/jsm/misc/VolumeSlice.js +95 -49
- package/examples/jsm/modifiers/CurveModifier.js +66 -38
- package/examples/jsm/modifiers/CurveModifierGPU.js +42 -19
- package/examples/jsm/modifiers/EdgeSplitModifier.js +20 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +24 -10
- package/examples/jsm/modifiers/TessellateModifier.js +35 -2
- package/examples/jsm/objects/GroundedSkybox.js +25 -6
- package/examples/jsm/objects/Lensflare.js +94 -2
- package/examples/jsm/objects/LensflareMesh.js +64 -10
- package/examples/jsm/objects/MarchingCubes.js +90 -5
- package/examples/jsm/objects/Reflector.js +76 -2
- package/examples/jsm/objects/ReflectorForSSRPass.js +41 -0
- package/examples/jsm/objects/Refractor.js +62 -0
- package/examples/jsm/objects/ShadowMesh.js +54 -4
- package/examples/jsm/objects/Sky.js +106 -16
- package/examples/jsm/objects/SkyMesh.js +211 -38
- package/examples/jsm/objects/Water.js +49 -8
- package/examples/jsm/objects/Water2.js +49 -7
- package/examples/jsm/objects/Water2Mesh.js +50 -9
- package/examples/jsm/objects/WaterMesh.js +136 -43
- package/examples/jsm/physics/AmmoPhysics.js +60 -7
- package/examples/jsm/physics/JoltPhysics.js +65 -12
- package/examples/jsm/physics/RapierPhysics.js +217 -21
- package/examples/jsm/postprocessing/AfterimagePass.js +110 -29
- package/examples/jsm/postprocessing/BloomPass.js +128 -26
- package/examples/jsm/postprocessing/BokehPass.js +99 -22
- package/examples/jsm/postprocessing/ClearPass.js +54 -3
- package/examples/jsm/postprocessing/CubeTexturePass.js +82 -21
- package/examples/jsm/postprocessing/DotScreenPass.js +59 -10
- package/examples/jsm/postprocessing/EffectComposer.js +140 -6
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +54 -5
- package/examples/jsm/postprocessing/GTAOPass.js +202 -57
- package/examples/jsm/postprocessing/GlitchPass.js +86 -34
- package/examples/jsm/postprocessing/HalftonePass.js +65 -10
- package/examples/jsm/postprocessing/LUTPass.js +38 -8
- package/examples/jsm/postprocessing/MaskPass.js +91 -0
- package/examples/jsm/postprocessing/OutlinePass.js +272 -135
- package/examples/jsm/postprocessing/OutputPass.js +65 -14
- package/examples/jsm/postprocessing/Pass.js +100 -4
- package/examples/jsm/postprocessing/RenderPass.js +94 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +124 -45
- package/examples/jsm/postprocessing/RenderTransitionPass.js +120 -21
- package/examples/jsm/postprocessing/SAOPass.js +128 -55
- package/examples/jsm/postprocessing/SMAAPass.js +106 -75
- package/examples/jsm/postprocessing/SSAARenderPass.js +118 -35
- package/examples/jsm/postprocessing/SSAOPass.js +173 -60
- package/examples/jsm/postprocessing/SSRPass.js +268 -53
- package/examples/jsm/postprocessing/SavePass.js +69 -16
- package/examples/jsm/postprocessing/ShaderPass.js +65 -7
- package/examples/jsm/postprocessing/TAARenderPass.js +79 -24
- package/examples/jsm/postprocessing/TexturePass.js +72 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +168 -59
- package/examples/jsm/renderers/CSS2DRenderer.js +98 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +111 -7
- package/examples/jsm/renderers/Projector.js +288 -32
- package/examples/jsm/renderers/SVGRenderer.js +323 -61
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +3 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +5 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +12 -5
- package/examples/jsm/shaders/AfterimageShader.js +8 -3
- package/examples/jsm/shaders/BasicShader.js +8 -1
- package/examples/jsm/shaders/BleachBypassShader.js +10 -3
- package/examples/jsm/shaders/BlendShader.js +8 -1
- package/examples/jsm/shaders/BokehShader.js +9 -3
- package/examples/jsm/shaders/BokehShader2.js +11 -4
- package/examples/jsm/shaders/BrightnessContrastShader.js +10 -4
- package/examples/jsm/shaders/ColorCorrectionShader.js +8 -1
- package/examples/jsm/shaders/ColorifyShader.js +8 -1
- package/examples/jsm/shaders/ConvolutionShader.js +9 -38
- package/examples/jsm/shaders/CopyShader.js +8 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +10 -3
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +10 -1
- package/examples/jsm/shaders/DigitalGlitch.js +10 -7
- package/examples/jsm/shaders/DotScreenShader.js +8 -3
- package/examples/jsm/shaders/ExposureShader.js +8 -1
- package/examples/jsm/shaders/FXAAShader.js +233 -221
- package/examples/jsm/shaders/FilmShader.js +13 -0
- package/examples/jsm/shaders/FocusShader.js +8 -3
- package/examples/jsm/shaders/FreiChenShader.js +10 -3
- package/examples/jsm/shaders/GTAOShader.js +55 -45
- package/examples/jsm/shaders/GammaCorrectionShader.js +11 -2
- package/examples/jsm/shaders/HalftoneShader.js +24 -4
- package/examples/jsm/shaders/HorizontalBlurShader.js +12 -3
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +9 -2
- package/examples/jsm/shaders/HueSaturationShader.js +10 -3
- package/examples/jsm/shaders/KaleidoShader.js +11 -4
- package/examples/jsm/shaders/LuminosityHighPassShader.js +8 -4
- package/examples/jsm/shaders/LuminosityShader.js +8 -2
- package/examples/jsm/shaders/MirrorShader.js +10 -4
- package/examples/jsm/shaders/NormalMapShader.js +7 -2
- package/examples/jsm/shaders/OutputShader.js +19 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +30 -17
- package/examples/jsm/shaders/RGBShiftShader.js +8 -1
- package/examples/jsm/shaders/SAOShader.js +27 -5
- package/examples/jsm/shaders/SMAAShader.js +24 -1
- package/examples/jsm/shaders/SSAOShader.js +37 -6
- package/examples/jsm/shaders/SSRShader.js +32 -6
- package/examples/jsm/shaders/SepiaShader.js +8 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +9 -3
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +13 -8
- package/examples/jsm/shaders/TechnicolorShader.js +10 -4
- package/examples/jsm/shaders/ToonShader.js +29 -6
- package/examples/jsm/shaders/TriangleBlurShader.js +9 -4
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +19 -6
- package/examples/jsm/shaders/VelocityShader.js +8 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +9 -2
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +8 -1
- package/examples/jsm/shaders/VignetteShader.js +8 -3
- package/examples/jsm/shaders/VolumeShader.js +11 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +11 -0
- package/examples/jsm/textures/FlakesTexture.js +14 -0
- package/examples/jsm/transpiler/AST.js +436 -31
- package/examples/jsm/transpiler/GLSLDecoder.js +380 -135
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +3 -1
- package/examples/jsm/transpiler/TSLEncoder.js +363 -97
- package/examples/jsm/transpiler/Transpiler.js +50 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +244 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +282 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +364 -0
- package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +11 -4
- package/examples/jsm/tsl/display/BloomNode.js +534 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +207 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FXAANode.js +365 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.js +571 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +389 -0
- package/examples/jsm/tsl/display/GodraysNode.js +624 -0
- package/examples/jsm/tsl/display/LensflareNode.js +279 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OutlineNode.js +762 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +768 -0
- package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +120 -49
- package/examples/jsm/tsl/display/SSGINode.js +642 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +9 -2
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +61 -19
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +48 -12
- package/examples/jsm/tsl/display/TRAANode.js +726 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +54 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/math/Bayer.js +73 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +91 -29
- package/examples/jsm/utils/CameraUtils.js +15 -6
- package/examples/jsm/utils/GeometryCompressionUtils.js +23 -30
- package/examples/jsm/utils/GeometryUtils.js +32 -27
- package/examples/jsm/utils/LDrawUtils.js +14 -5
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +53 -3
- package/examples/jsm/utils/ShadowMapViewer.js +72 -33
- package/examples/jsm/utils/ShadowMapViewerGPU.js +61 -29
- package/examples/jsm/utils/SkeletonUtils.js +48 -0
- package/examples/jsm/utils/SortUtils.js +17 -5
- package/examples/jsm/utils/UVsDebug.js +12 -4
- package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +16 -0
- package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +20 -2
- package/examples/jsm/utils/WorkerPool.js +67 -2
- package/examples/jsm/webxr/ARButton.js +19 -0
- package/examples/jsm/webxr/OculusHandModel.js +84 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +148 -22
- package/examples/jsm/webxr/Text2D.js +20 -6
- package/examples/jsm/webxr/VRButton.js +31 -0
- package/examples/jsm/webxr/XRButton.js +23 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +94 -3
- package/examples/jsm/webxr/XREstimatedLight.js +35 -4
- package/examples/jsm/webxr/XRHandMeshModel.js +37 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +96 -6
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +44 -0
- package/examples/jsm/webxr/XRPlanes.js +18 -0
- package/package.json +29 -34
- package/src/Three.Core.js +198 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +641 -0
- package/src/Three.WebGPU.Nodes.js +14 -186
- package/src/Three.WebGPU.js +16 -186
- package/src/Three.js +2 -197
- package/src/animation/AnimationAction.js +263 -31
- package/src/animation/AnimationClip.js +162 -7
- package/src/animation/AnimationMixer.js +99 -15
- package/src/animation/AnimationObjectGroup.js +45 -21
- package/src/animation/AnimationUtils.js +163 -24
- package/src/animation/KeyframeTrack.js +191 -17
- package/src/animation/PropertyBinding.js +91 -16
- package/src/animation/PropertyMixer.js +72 -5
- package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
- package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
- package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
- package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
- package/src/animation/tracks/StringKeyframeTrack.js +33 -2
- package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
- package/src/audio/Audio.js +386 -8
- package/src/audio/AudioAnalyser.js +58 -1
- package/src/audio/AudioContext.js +15 -0
- package/src/audio/AudioListener.js +94 -13
- package/src/audio/PositionalAudio.js +107 -0
- package/src/cameras/ArrayCamera.js +37 -0
- package/src/cameras/Camera.js +61 -0
- package/src/cameras/CubeCamera.js +86 -0
- package/src/cameras/OrthographicCamera.js +110 -1
- package/src/cameras/PerspectiveCamera.js +174 -35
- package/src/cameras/StereoCamera.js +48 -2
- package/src/constants.js +1546 -11
- package/src/core/BufferAttribute.js +417 -3
- package/src/core/BufferGeometry.js +407 -22
- package/src/core/Clock.js +69 -8
- package/src/core/EventDispatcher.js +52 -8
- package/src/core/GLBufferAttribute.js +113 -2
- package/src/core/InstancedBufferAttribute.js +29 -0
- package/src/core/InstancedBufferGeometry.js +20 -0
- package/src/core/InstancedInterleavedBuffer.js +26 -0
- package/src/core/InterleavedBuffer.js +141 -7
- package/src/core/InterleavedBufferAttribute.js +200 -2
- package/src/core/Layers.js +71 -10
- package/src/core/Object3D.js +673 -26
- package/src/core/Raycaster.js +136 -2
- package/src/core/RenderTarget.js +256 -27
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +29 -0
- package/src/core/UniformsGroup.js +84 -2
- package/src/extras/Controls.js +89 -1
- package/src/extras/DataUtils.js +50 -9
- package/src/extras/Earcut.js +18 -779
- package/src/extras/ImageUtils.js +22 -14
- package/src/extras/PMREMGenerator.js +316 -67
- package/src/extras/ShapeUtils.js +24 -2
- package/src/extras/TextureUtils.js +101 -15
- package/src/extras/core/Curve.js +156 -55
- package/src/extras/core/CurvePath.js +63 -22
- package/src/extras/core/Interpolations.js +34 -2
- package/src/extras/core/Path.js +134 -1
- package/src/extras/core/Shape.js +66 -3
- package/src/extras/core/ShapePath.js +80 -4
- package/src/extras/curves/ArcCurve.js +22 -0
- package/src/extras/curves/CatmullRomCurve3.js +89 -18
- package/src/extras/curves/CubicBezierCurve.js +67 -0
- package/src/extras/curves/CubicBezierCurve3.js +50 -0
- package/src/extras/curves/EllipseCurve.js +102 -0
- package/src/extras/curves/LineCurve.js +36 -0
- package/src/extras/curves/LineCurve3.js +36 -0
- package/src/extras/curves/QuadraticBezierCurve.js +59 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +43 -0
- package/src/extras/curves/SplineCurve.js +48 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +39 -0
- package/src/geometries/CapsuleGeometry.js +196 -11
- package/src/geometries/CircleGeometry.js +41 -0
- package/src/geometries/ConeGeometry.js +39 -0
- package/src/geometries/CylinderGeometry.js +42 -2
- package/src/geometries/DodecahedronGeometry.js +33 -0
- package/src/geometries/EdgesGeometry.js +30 -2
- package/src/geometries/ExtrudeGeometry.js +148 -52
- package/src/geometries/IcosahedronGeometry.js +33 -0
- package/src/geometries/LatheGeometry.js +44 -3
- package/src/geometries/OctahedronGeometry.js +33 -0
- package/src/geometries/PlaneGeometry.js +35 -0
- package/src/geometries/PolyhedronGeometry.js +30 -1
- package/src/geometries/RingGeometry.js +37 -0
- package/src/geometries/ShapeGeometry.js +38 -0
- package/src/geometries/SphereGeometry.js +38 -0
- package/src/geometries/TetrahedronGeometry.js +33 -0
- package/src/geometries/TorusGeometry.js +44 -3
- package/src/geometries/TorusKnotGeometry.js +39 -0
- package/src/geometries/TubeGeometry.js +50 -0
- package/src/geometries/WireframeGeometry.js +32 -0
- package/src/helpers/ArrowHelper.js +62 -5
- package/src/helpers/AxesHelper.js +28 -0
- package/src/helpers/Box3Helper.js +28 -0
- package/src/helpers/BoxHelper.js +43 -7
- package/src/helpers/CameraHelper.js +103 -27
- package/src/helpers/DirectionalLightHelper.js +55 -0
- package/src/helpers/GridHelper.js +26 -0
- package/src/helpers/HemisphereLightHelper.js +42 -0
- package/src/helpers/PlaneHelper.js +33 -0
- package/src/helpers/PointLightHelper.js +43 -24
- package/src/helpers/PolarGridHelper.js +30 -0
- package/src/helpers/SkeletonHelper.js +73 -7
- package/src/helpers/SpotLightHelper.js +43 -0
- package/src/lights/AmbientLight.js +25 -0
- package/src/lights/DirectionalLight.js +70 -0
- package/src/lights/DirectionalLightShadow.js +15 -0
- package/src/lights/HemisphereLight.js +42 -0
- package/src/lights/Light.js +37 -11
- package/src/lights/LightProbe.js +37 -9
- package/src/lights/LightShadow.js +202 -7
- package/src/lights/PointLight.js +74 -0
- package/src/lights/PointLightShadow.js +15 -80
- package/src/lights/RectAreaLight.js +59 -0
- package/src/lights/SpotLight.js +124 -1
- package/src/lights/SpotLightShadow.js +33 -3
- package/src/lights/webgpu/IESSpotLight.js +22 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +34 -2
- package/src/loaders/AudioLoader.js +34 -2
- package/src/loaders/BufferGeometryLoader.js +38 -13
- package/src/loaders/Cache.js +75 -2
- package/src/loaders/CompressedTextureLoader.js +36 -3
- package/src/loaders/CubeTextureLoader.js +45 -0
- package/src/loaders/DataTextureLoader.js +45 -4
- package/src/loaders/FileLoader.js +85 -5
- package/src/loaders/ImageBitmapLoader.js +113 -11
- package/src/loaders/ImageLoader.js +85 -8
- package/src/loaders/Loader.js +144 -0
- package/src/loaders/LoaderUtils.js +18 -36
- package/src/loaders/LoadingManager.js +187 -0
- package/src/loaders/MaterialLoader.js +62 -3
- package/src/loaders/ObjectLoader.js +131 -31
- package/src/loaders/TextureLoader.js +33 -0
- package/src/loaders/nodes/NodeLoader.js +68 -4
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/LineBasicMaterial.js +74 -1
- package/src/materials/LineDashedMaterial.js +52 -1
- package/src/materials/Material.js +502 -8
- package/src/materials/MeshBasicMaterial.js +168 -2
- package/src/materials/MeshDepthMaterial.js +94 -0
- package/src/materials/MeshDistanceMaterial.js +76 -0
- package/src/materials/MeshLambertMaterial.js +283 -0
- package/src/materials/MeshMatcapMaterial.js +164 -0
- package/src/materials/MeshNormalMaterial.js +114 -0
- package/src/materials/MeshPhongMaterial.js +298 -0
- package/src/materials/MeshPhysicalMaterial.js +296 -4
- package/src/materials/MeshStandardMaterial.js +300 -2
- package/src/materials/MeshToonMaterial.js +219 -0
- package/src/materials/PointsMaterial.js +89 -0
- package/src/materials/RawShaderMaterial.js +25 -0
- package/src/materials/ShaderMaterial.js +234 -6
- package/src/materials/ShadowMaterial.js +54 -0
- package/src/materials/SpriteMaterial.js +82 -0
- package/src/materials/nodes/Line2NodeMaterial.js +158 -53
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +81 -6
- package/src/materials/nodes/MeshBasicNodeMaterial.js +59 -2
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +23 -3
- package/src/materials/nodes/MeshNormalNodeMaterial.js +27 -4
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +276 -3
- package/src/materials/nodes/MeshSSSNodeMaterial.js +98 -10
- package/src/materials/nodes/MeshStandardNodeMaterial.js +83 -4
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +789 -74
- package/src/materials/nodes/NodeMaterials.js +0 -1
- package/src/materials/nodes/PointsNodeMaterial.js +180 -11
- package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +86 -23
- package/src/materials/nodes/VolumeNodeMaterial.js +57 -84
- package/src/materials/nodes/manager/NodeMaterialObserver.js +329 -12
- package/src/math/Box2.js +177 -0
- package/src/math/Box3.js +271 -0
- package/src/math/Color.js +355 -11
- package/src/math/ColorManagement.js +158 -92
- package/src/math/Cylindrical.js +65 -6
- package/src/math/Euler.js +139 -5
- package/src/math/Frustum.js +108 -9
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +87 -8
- package/src/math/Line3.js +221 -2
- package/src/math/MathUtils.js +408 -20
- package/src/math/Matrix2.js +70 -0
- package/src/math/Matrix3.js +229 -4
- package/src/math/Matrix4.js +489 -94
- package/src/math/Plane.js +164 -2
- package/src/math/Quaternion.js +322 -90
- package/src/math/Ray.js +162 -0
- package/src/math/Sphere.js +175 -0
- package/src/math/Spherical.js +73 -11
- package/src/math/SphericalHarmonics3.js +112 -14
- package/src/math/Triangle.js +206 -2
- package/src/math/Vector2.js +396 -10
- package/src/math/Vector3.js +550 -15
- package/src/math/Vector4.js +415 -9
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +10 -1
- package/src/math/interpolants/DiscreteInterpolant.js +10 -2
- package/src/math/interpolants/LinearInterpolant.js +13 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +10 -1
- package/src/nodes/Nodes.js +91 -88
- package/src/nodes/TSL.js +32 -38
- package/src/nodes/accessors/AccessorsUtils.js +37 -9
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +49 -14
- package/src/nodes/accessors/Bitangent.js +82 -13
- package/src/nodes/accessors/BufferAttributeNode.js +269 -8
- package/src/nodes/accessors/BufferNode.js +91 -2
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +400 -10
- package/src/nodes/accessors/ClippingNode.js +149 -45
- package/src/nodes/accessors/CubeTextureNode.js +137 -7
- package/src/nodes/accessors/InstanceNode.js +245 -40
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +88 -0
- package/src/nodes/accessors/MaterialNode.js +355 -13
- package/src/nodes/accessors/MaterialProperties.js +57 -1
- package/src/nodes/accessors/MaterialReferenceNode.js +52 -14
- package/src/nodes/accessors/ModelNode.js +117 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -39
- package/src/nodes/accessors/MorphNode.js +73 -26
- package/src/nodes/accessors/Normal.js +174 -19
- package/src/nodes/accessors/Object3DNode.js +146 -12
- package/src/nodes/accessors/PointUVNode.js +25 -0
- package/src/nodes/accessors/Position.js +119 -7
- package/src/nodes/accessors/ReferenceBaseNode.js +190 -4
- package/src/nodes/accessors/ReferenceNode.js +223 -8
- package/src/nodes/accessors/ReflectVector.js +29 -3
- package/src/nodes/accessors/RendererReferenceNode.js +45 -2
- package/src/nodes/accessors/SceneProperties.js +53 -0
- package/src/nodes/accessors/SkinningNode.js +180 -43
- package/src/nodes/accessors/StorageBufferNode.js +278 -26
- package/src/nodes/accessors/StorageTextureNode.js +205 -12
- package/src/nodes/accessors/Tangent.js +48 -10
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +104 -11
- package/src/nodes/accessors/TextureBicubic.js +31 -4
- package/src/nodes/accessors/TextureNode.js +564 -52
- package/src/nodes/accessors/TextureSizeNode.js +42 -1
- package/src/nodes/accessors/UV.js +9 -1
- package/src/nodes/accessors/UniformArrayNode.js +226 -34
- package/src/nodes/accessors/UserDataNode.js +46 -2
- package/src/nodes/accessors/VelocityNode.js +93 -3
- package/src/nodes/accessors/VertexColorNode.js +39 -4
- package/src/nodes/code/CodeNode.js +101 -8
- package/src/nodes/code/ExpressionNode.js +29 -2
- package/src/nodes/code/FunctionCallNode.js +98 -10
- package/src/nodes/code/FunctionNode.js +69 -2
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +80 -9
- package/src/nodes/core/AttributeNode.js +47 -4
- package/src/nodes/core/BypassNode.js +47 -3
- package/src/nodes/core/ConstNode.js +32 -0
- package/src/nodes/core/ContextNode.js +220 -14
- package/src/nodes/core/IndexNode.js +72 -7
- package/src/nodes/core/InputNode.js +50 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +65 -5
- package/src/nodes/core/MRTNode.js +113 -2
- package/src/nodes/core/Node.js +595 -36
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +1840 -121
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +153 -24
- package/src/nodes/core/NodeFunction.js +48 -1
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +13 -1
- package/src/nodes/core/NodeUniform.js +53 -1
- package/src/nodes/core/NodeUtils.js +201 -51
- package/src/nodes/core/NodeVar.js +47 -1
- package/src/nodes/core/NodeVarying.js +47 -1
- package/src/nodes/core/OutputStructNode.js +54 -12
- package/src/nodes/core/ParameterNode.js +60 -2
- package/src/nodes/core/PropertyNode.js +286 -7
- package/src/nodes/core/StackNode.js +337 -20
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +134 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +126 -6
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +31 -5
- package/src/nodes/core/UniformGroupNode.js +85 -7
- package/src/nodes/core/UniformNode.js +163 -16
- package/src/nodes/core/VarNode.js +317 -10
- package/src/nodes/core/VaryingNode.js +115 -13
- package/src/nodes/core/constants.js +40 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +38 -2
- package/src/nodes/display/ColorAdjustment.js +118 -6
- package/src/nodes/display/ColorSpaceFunctions.js +22 -6
- package/src/nodes/display/ColorSpaceNode.js +97 -47
- package/src/nodes/display/FrontFacingNode.js +64 -7
- package/src/nodes/display/NormalMapNode.js +101 -54
- package/src/nodes/display/PassNode.js +690 -33
- package/src/nodes/display/RenderOutputNode.js +94 -4
- package/src/nodes/display/ScreenNode.js +138 -27
- package/src/nodes/display/ToneMappingFunctions.js +62 -10
- package/src/nodes/display/ToneMappingNode.js +88 -8
- package/src/nodes/display/ToonOutlinePassNode.js +84 -4
- package/src/nodes/display/ViewportDepthNode.js +227 -10
- package/src/nodes/display/ViewportDepthTextureNode.js +39 -5
- package/src/nodes/display/ViewportSharedTextureNode.js +35 -1
- package/src/nodes/display/ViewportTextureNode.js +171 -7
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +45 -1
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
- package/src/nodes/functions/BasicLightingModel.js +28 -6
- package/src/nodes/functions/PhongLightingModel.js +36 -6
- package/src/nodes/functions/PhysicalLightingModel.js +336 -91
- package/src/nodes/functions/ShadowMaskModel.js +30 -3
- package/src/nodes/functions/ToonLightingModel.js +21 -2
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +10 -4
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/geometry/RangeNode.js +97 -8
- package/src/nodes/gpgpu/AtomicFunctionNode.js +198 -23
- package/src/nodes/gpgpu/BarrierNode.js +52 -3
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +135 -6
- package/src/nodes/gpgpu/ComputeNode.js +212 -16
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +143 -9
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +186 -399
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +12 -11
- package/src/nodes/lighting/EnvironmentNode.js +59 -19
- package/src/nodes/lighting/HemisphereLightNode.js +33 -2
- package/src/nodes/lighting/IESSpotLightNode.js +13 -1
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +11 -3
- package/src/nodes/lighting/LightingContextNode.js +52 -4
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +238 -35
- package/src/nodes/lighting/PointLightNode.js +60 -25
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +50 -14
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +867 -0
- package/src/nodes/lighting/SpotLightNode.js +99 -18
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +166 -2
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +110 -21
- package/src/nodes/math/Hash.js +8 -0
- package/src/nodes/math/MathNode.js +820 -97
- package/src/nodes/math/MathUtils.js +47 -1
- package/src/nodes/math/OperatorNode.js +517 -84
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +17 -7
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +180 -23
- package/src/nodes/pmrem/PMREMUtils.js +114 -5
- package/src/nodes/procedural/Checker.js +8 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +10 -4
- package/src/nodes/tsl/TSLCore.js +732 -160
- package/src/nodes/utils/ArrayElementNode.js +55 -4
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +79 -2
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +18 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +118 -0
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +91 -22
- package/src/nodes/utils/JoinNode.js +57 -4
- package/src/nodes/utils/LoopNode.js +193 -55
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -1
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +30 -1
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +165 -9
- package/src/nodes/utils/ReflectorNode.js +407 -21
- package/src/nodes/utils/RemapNode.js +81 -2
- package/src/nodes/utils/RotateNode.js +41 -1
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +66 -3
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +16 -0
- package/src/nodes/utils/StorageArrayElementNode.js +56 -3
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +48 -0
- package/src/nodes/utils/ViewportUtils.js +12 -0
- package/src/objects/BatchedMesh.js +798 -309
- package/src/objects/Bone.js +24 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +24 -0
- package/src/objects/InstancedMesh.js +131 -2
- package/src/objects/LOD.js +99 -5
- package/src/objects/Line.js +90 -7
- package/src/objects/LineLoop.js +20 -0
- package/src/objects/LineSegments.js +20 -1
- package/src/objects/Mesh.js +84 -0
- package/src/objects/Points.js +60 -0
- package/src/objects/Skeleton.js +120 -5
- package/src/objects/SkinnedMesh.js +102 -6
- package/src/objects/Sprite.js +65 -1
- package/src/renderers/WebGL3DRenderTarget.js +26 -0
- package/src/renderers/WebGLArrayRenderTarget.js +26 -0
- package/src/renderers/WebGLCubeRenderTarget.js +41 -5
- package/src/renderers/WebGLRenderTarget.js +19 -0
- package/src/renderers/WebGLRenderer.js +1016 -278
- package/src/renderers/common/Animation.js +123 -14
- package/src/renderers/common/Attributes.js +41 -1
- package/src/renderers/common/Backend.js +623 -44
- package/src/renderers/common/Background.js +99 -16
- package/src/renderers/common/BindGroup.js +37 -2
- package/src/renderers/common/Binding.js +46 -0
- package/src/renderers/common/Bindings.js +211 -20
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +89 -0
- package/src/renderers/common/BufferUtils.js +25 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +73 -10
- package/src/renderers/common/ClippingContext.js +172 -87
- package/src/renderers/common/Color4.js +40 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/Constants.js +2 -1
- package/src/renderers/common/CubeRenderTarget.js +77 -7
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +163 -14
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +81 -36
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +150 -7
- package/src/renderers/common/PostProcessing.js +22 -84
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +63 -6
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +40 -10
- package/src/renderers/common/RenderContext.js +219 -4
- package/src/renderers/common/RenderContexts.js +54 -17
- package/src/renderers/common/RenderList.js +233 -24
- package/src/renderers/common/RenderLists.js +46 -6
- package/src/renderers/common/RenderObject.js +548 -46
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +133 -15
- package/src/renderers/common/RenderPipeline.js +216 -6
- package/src/renderers/common/Renderer.js +2155 -332
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +99 -39
- package/src/renderers/common/Sampler.js +148 -1
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +38 -2
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +65 -0
- package/src/renderers/common/Textures.js +273 -57
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +233 -3
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +235 -26
- package/src/renderers/common/XRManager.js +1677 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +371 -108
- package/src/renderers/common/nodes/NodeBuilderState.js +100 -6
- package/src/renderers/common/nodes/NodeLibrary.js +95 -17
- package/src/renderers/common/nodes/NodeManager.js +852 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +84 -8
- package/src/renderers/common/nodes/NodeSampler.js +41 -1
- package/src/renderers/common/nodes/NodeStorageBuffer.js +48 -3
- package/src/renderers/common/nodes/NodeUniform.js +285 -2
- package/src/renderers/common/nodes/NodeUniformBuffer.js +81 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +7 -11
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +154 -59
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +230 -181
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/shaders/ShaderChunk.js +3 -3
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +14 -2
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +7 -5
- package/src/renderers/shaders/UniformsLib.js +2 -7
- package/src/renderers/shaders/UniformsUtils.js +21 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLBackground.js +30 -5
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +7 -14
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLGeometries.js +10 -35
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLMaterials.js +12 -0
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLOutput.js +267 -0
- package/src/renderers/webgl/WebGLProgram.js +87 -148
- package/src/renderers/webgl/WebGLPrograms.js +53 -51
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLShadowMap.js +204 -28
- package/src/renderers/webgl/WebGLState.js +88 -56
- package/src/renderers/webgl/WebGLTextures.js +293 -59
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl/WebGLUtils.js +7 -5
- package/src/renderers/webgl-fallback/WebGLBackend.js +1416 -293
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +5 -10
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +785 -92
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +62 -1
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +3 -3
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +584 -20
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +468 -80
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +72 -24
- package/src/renderers/webgpu/WebGPUBackend.js +1517 -428
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +31 -4
- package/src/renderers/webgpu/WebGPURenderer.js +55 -4
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +23 -16
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +37 -42
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +1335 -241
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +32 -4
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +144 -20
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +460 -116
- package/src/renderers/webgpu/utils/WebGPUConstants.js +17 -4
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +283 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +225 -178
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +583 -191
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +150 -28
- package/src/renderers/webxr/WebXRController.js +87 -2
- package/src/renderers/webxr/WebXRDepthSensing.js +52 -7
- package/src/renderers/webxr/WebXRManager.js +275 -15
- package/src/scenes/Fog.js +60 -0
- package/src/scenes/FogExp2.js +51 -0
- package/src/scenes/Scene.js +88 -0
- package/src/textures/CanvasTexture.js +28 -0
- package/src/textures/CompressedArrayTexture.js +57 -0
- package/src/textures/CompressedCubeTexture.js +29 -0
- package/src/textures/CompressedTexture.js +64 -6
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +52 -4
- package/src/textures/Data3DTexture.js +79 -2
- package/src/textures/DataArrayTexture.js +93 -0
- package/src/textures/DataTexture.js +65 -0
- package/src/textures/DepthTexture.js +59 -11
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +62 -0
- package/src/textures/Source.js +106 -4
- package/src/textures/Texture.js +488 -6
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +78 -6
- package/src/utils.js +322 -3
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1207
- package/examples/jsm/animation/MMDPhysics.js +0 -1406
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -153
- package/examples/jsm/exporters/MMDExporter.js +0 -217
- package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -174
- package/examples/jsm/geometries/ParametricGeometries.js +0 -254
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +0 -729
- package/examples/jsm/loaders/MMDLoader.js +0 -2295
- package/examples/jsm/loaders/RGBMLoader.js +0 -1081
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -432
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -144
- package/examples/jsm/misc/Timer.js +0 -128
- package/examples/jsm/objects/InstancedPoints.js +0 -21
- package/examples/jsm/shaders/GodRaysShader.js +0 -321
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -156
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -24
- package/src/nodes/accessors/SceneNode.js +0 -55
- package/src/nodes/code/ScriptableNode.js +0 -505
- package/src/nodes/code/ScriptableValueNode.js +0 -170
- package/src/nodes/core/CacheNode.js +0 -50
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/display/AfterImageNode.js +0 -158
- package/src/nodes/display/AnaglyphPassNode.js +0 -67
- package/src/nodes/display/AnamorphicNode.js +0 -151
- package/src/nodes/display/BlendMode.js +0 -54
- package/src/nodes/display/BloomNode.js +0 -341
- package/src/nodes/display/DenoiseNode.js +0 -204
- package/src/nodes/display/DepthOfFieldNode.js +0 -124
- package/src/nodes/display/DotScreenNode.js +0 -66
- package/src/nodes/display/FXAANode.js +0 -332
- package/src/nodes/display/FilmNode.js +0 -56
- package/src/nodes/display/GTAONode.js +0 -331
- package/src/nodes/display/GaussianBlurNode.js +0 -213
- package/src/nodes/display/Lut3DNode.js +0 -57
- package/src/nodes/display/MotionBlur.js +0 -25
- package/src/nodes/display/ParallaxBarrierPassNode.js +0 -58
- package/src/nodes/display/PixelationPassNode.js +0 -213
- package/src/nodes/display/PosterizeNode.js +0 -33
- package/src/nodes/display/RGBShiftNode.js +0 -53
- package/src/nodes/display/StereoCompositePassNode.js +0 -110
- package/src/nodes/display/TransitionNode.js +0 -80
- package/src/nodes/fog/FogExp2Node.js +0 -35
- package/src/nodes/fog/FogNode.js +0 -50
- package/src/nodes/fog/FogRangeNode.js +0 -36
- package/src/nodes/functions/BSDF/DFGApprox.js +0 -30
- package/src/nodes/utils/EquirectUVNode.js +0 -36
- package/src/nodes/utils/MatcapUVNode.js +0 -33
- package/src/nodes/utils/OscNode.js +0 -85
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -45
- package/src/nodes/utils/TimerNode.js +0 -97
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -64
- package/src/renderers/common/nodes/Nodes.js +0 -534
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -136
package/src/core/Object3D.js
CHANGED
|
@@ -5,7 +5,8 @@ import { EventDispatcher } from './EventDispatcher.js';
|
|
|
5
5
|
import { Euler } from '../math/Euler.js';
|
|
6
6
|
import { Layers } from './Layers.js';
|
|
7
7
|
import { Matrix3 } from '../math/Matrix3.js';
|
|
8
|
-
import
|
|
8
|
+
import { generateUUID } from '../math/MathUtils.js';
|
|
9
|
+
import { error } from '../utils.js';
|
|
9
10
|
|
|
10
11
|
let _object3DId = 0;
|
|
11
12
|
|
|
@@ -22,30 +23,118 @@ const _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );
|
|
|
22
23
|
const _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
23
24
|
const _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Fires when the object has been added to its parent object.
|
|
28
|
+
*
|
|
29
|
+
* @event Object3D#added
|
|
30
|
+
* @type {Object}
|
|
31
|
+
*/
|
|
25
32
|
const _addedEvent = { type: 'added' };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Fires when the object has been removed from its parent object.
|
|
36
|
+
*
|
|
37
|
+
* @event Object3D#removed
|
|
38
|
+
* @type {Object}
|
|
39
|
+
*/
|
|
26
40
|
const _removedEvent = { type: 'removed' };
|
|
27
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Fires when a new child object has been added.
|
|
44
|
+
*
|
|
45
|
+
* @event Object3D#childadded
|
|
46
|
+
* @type {Object}
|
|
47
|
+
*/
|
|
28
48
|
const _childaddedEvent = { type: 'childadded', child: null };
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Fires when a child object has been removed.
|
|
52
|
+
*
|
|
53
|
+
* @event Object3D#childremoved
|
|
54
|
+
* @type {Object}
|
|
55
|
+
*/
|
|
29
56
|
const _childremovedEvent = { type: 'childremoved', child: null };
|
|
30
57
|
|
|
58
|
+
/**
|
|
59
|
+
* This is the base class for most objects in three.js and provides a set of
|
|
60
|
+
* properties and methods for manipulating objects in 3D space.
|
|
61
|
+
*
|
|
62
|
+
* @augments EventDispatcher
|
|
63
|
+
*/
|
|
31
64
|
class Object3D extends EventDispatcher {
|
|
32
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Constructs a new 3D object.
|
|
68
|
+
*/
|
|
33
69
|
constructor() {
|
|
34
70
|
|
|
35
71
|
super();
|
|
36
72
|
|
|
73
|
+
/**
|
|
74
|
+
* This flag can be used for type testing.
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
* @readonly
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
37
80
|
this.isObject3D = true;
|
|
38
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The ID of the 3D object.
|
|
84
|
+
*
|
|
85
|
+
* @name Object3D#id
|
|
86
|
+
* @type {number}
|
|
87
|
+
* @readonly
|
|
88
|
+
*/
|
|
39
89
|
Object.defineProperty( this, 'id', { value: _object3DId ++ } );
|
|
40
90
|
|
|
41
|
-
|
|
42
|
-
|
|
91
|
+
/**
|
|
92
|
+
* The UUID of the 3D object.
|
|
93
|
+
*
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @readonly
|
|
96
|
+
*/
|
|
97
|
+
this.uuid = generateUUID();
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The name of the 3D object.
|
|
101
|
+
*
|
|
102
|
+
* @type {string}
|
|
103
|
+
*/
|
|
43
104
|
this.name = '';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The type property is used for detecting the object type
|
|
108
|
+
* in context of serialization/deserialization.
|
|
109
|
+
*
|
|
110
|
+
* @type {string}
|
|
111
|
+
* @readonly
|
|
112
|
+
*/
|
|
44
113
|
this.type = 'Object3D';
|
|
45
114
|
|
|
115
|
+
/**
|
|
116
|
+
* A reference to the parent object.
|
|
117
|
+
*
|
|
118
|
+
* @type {?Object3D}
|
|
119
|
+
* @default null
|
|
120
|
+
*/
|
|
46
121
|
this.parent = null;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* An array holding the child 3D objects of this instance.
|
|
125
|
+
*
|
|
126
|
+
* @type {Array<Object3D>}
|
|
127
|
+
*/
|
|
47
128
|
this.children = [];
|
|
48
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Defines the `up` direction of the 3D object which influences
|
|
132
|
+
* the orientation via methods like {@link Object3D#lookAt}.
|
|
133
|
+
*
|
|
134
|
+
* The default values for all 3D objects is defined by `Object3D.DEFAULT_UP`.
|
|
135
|
+
*
|
|
136
|
+
* @type {Vector3}
|
|
137
|
+
*/
|
|
49
138
|
this.up = Object3D.DEFAULT_UP.clone();
|
|
50
139
|
|
|
51
140
|
const position = new Vector3();
|
|
@@ -69,65 +158,293 @@ class Object3D extends EventDispatcher {
|
|
|
69
158
|
quaternion._onChange( onQuaternionChange );
|
|
70
159
|
|
|
71
160
|
Object.defineProperties( this, {
|
|
161
|
+
/**
|
|
162
|
+
* Represents the object's local position.
|
|
163
|
+
*
|
|
164
|
+
* @name Object3D#position
|
|
165
|
+
* @type {Vector3}
|
|
166
|
+
* @default (0,0,0)
|
|
167
|
+
*/
|
|
72
168
|
position: {
|
|
73
169
|
configurable: true,
|
|
74
170
|
enumerable: true,
|
|
75
171
|
value: position
|
|
76
172
|
},
|
|
173
|
+
/**
|
|
174
|
+
* Represents the object's local rotation as Euler angles, in radians.
|
|
175
|
+
*
|
|
176
|
+
* @name Object3D#rotation
|
|
177
|
+
* @type {Euler}
|
|
178
|
+
* @default (0,0,0)
|
|
179
|
+
*/
|
|
77
180
|
rotation: {
|
|
78
181
|
configurable: true,
|
|
79
182
|
enumerable: true,
|
|
80
183
|
value: rotation
|
|
81
184
|
},
|
|
185
|
+
/**
|
|
186
|
+
* Represents the object's local rotation as Quaternions.
|
|
187
|
+
*
|
|
188
|
+
* @name Object3D#quaternion
|
|
189
|
+
* @type {Quaternion}
|
|
190
|
+
*/
|
|
82
191
|
quaternion: {
|
|
83
192
|
configurable: true,
|
|
84
193
|
enumerable: true,
|
|
85
194
|
value: quaternion
|
|
86
195
|
},
|
|
196
|
+
/**
|
|
197
|
+
* Represents the object's local scale.
|
|
198
|
+
*
|
|
199
|
+
* @name Object3D#scale
|
|
200
|
+
* @type {Vector3}
|
|
201
|
+
* @default (1,1,1)
|
|
202
|
+
*/
|
|
87
203
|
scale: {
|
|
88
204
|
configurable: true,
|
|
89
205
|
enumerable: true,
|
|
90
206
|
value: scale
|
|
91
207
|
},
|
|
208
|
+
/**
|
|
209
|
+
* Represents the object's model-view matrix.
|
|
210
|
+
*
|
|
211
|
+
* @name Object3D#modelViewMatrix
|
|
212
|
+
* @type {Matrix4}
|
|
213
|
+
*/
|
|
92
214
|
modelViewMatrix: {
|
|
93
215
|
value: new Matrix4()
|
|
94
216
|
},
|
|
217
|
+
/**
|
|
218
|
+
* Represents the object's normal matrix.
|
|
219
|
+
*
|
|
220
|
+
* @name Object3D#normalMatrix
|
|
221
|
+
* @type {Matrix3}
|
|
222
|
+
*/
|
|
95
223
|
normalMatrix: {
|
|
96
224
|
value: new Matrix3()
|
|
97
225
|
}
|
|
98
226
|
} );
|
|
99
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Represents the object's transformation matrix in local space.
|
|
230
|
+
*
|
|
231
|
+
* @type {Matrix4}
|
|
232
|
+
*/
|
|
100
233
|
this.matrix = new Matrix4();
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Represents the object's transformation matrix in world space.
|
|
237
|
+
* If the 3D object has no parent, then it's identical to the local transformation matrix
|
|
238
|
+
*
|
|
239
|
+
* @type {Matrix4}
|
|
240
|
+
*/
|
|
101
241
|
this.matrixWorld = new Matrix4();
|
|
102
242
|
|
|
243
|
+
/**
|
|
244
|
+
* When set to `true`, the engine automatically computes the local matrix from position,
|
|
245
|
+
* rotation and scale every frame. If set to `false`, the app is responsible for recomputing
|
|
246
|
+
* the local matrix by calling `updateMatrix()`.
|
|
247
|
+
*
|
|
248
|
+
* The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`.
|
|
249
|
+
*
|
|
250
|
+
* @type {boolean}
|
|
251
|
+
* @default true
|
|
252
|
+
*/
|
|
103
253
|
this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
|
|
104
254
|
|
|
255
|
+
/**
|
|
256
|
+
* When set to `true`, the engine automatically computes the world matrix from the current local
|
|
257
|
+
* matrix and the object's transformation hierarchy. If set to `false`, the app is responsible for
|
|
258
|
+
* recomputing the world matrix by directly updating the `matrixWorld` property.
|
|
259
|
+
*
|
|
260
|
+
* The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`.
|
|
261
|
+
*
|
|
262
|
+
* @type {boolean}
|
|
263
|
+
* @default true
|
|
264
|
+
*/
|
|
105
265
|
this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* When set to `true`, it calculates the world matrix in that frame and resets this property
|
|
269
|
+
* to `false`.
|
|
270
|
+
*
|
|
271
|
+
* @type {boolean}
|
|
272
|
+
* @default false
|
|
273
|
+
*/
|
|
106
274
|
this.matrixWorldNeedsUpdate = false;
|
|
107
275
|
|
|
276
|
+
/**
|
|
277
|
+
* The layer membership of the 3D object. The 3D object is only visible if it has
|
|
278
|
+
* at least one layer in common with the camera in use. This property can also be
|
|
279
|
+
* used to filter out unwanted objects in ray-intersection tests when using {@link Raycaster}.
|
|
280
|
+
*
|
|
281
|
+
* @type {Layers}
|
|
282
|
+
*/
|
|
108
283
|
this.layers = new Layers();
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* When set to `true`, the 3D object gets rendered.
|
|
287
|
+
*
|
|
288
|
+
* @type {boolean}
|
|
289
|
+
* @default true
|
|
290
|
+
*/
|
|
109
291
|
this.visible = true;
|
|
110
292
|
|
|
293
|
+
/**
|
|
294
|
+
* When set to `true`, the 3D object gets rendered into shadow maps.
|
|
295
|
+
*
|
|
296
|
+
* @type {boolean}
|
|
297
|
+
* @default false
|
|
298
|
+
*/
|
|
111
299
|
this.castShadow = false;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* When set to `true`, the 3D object is affected by shadows in the scene.
|
|
303
|
+
*
|
|
304
|
+
* @type {boolean}
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
112
307
|
this.receiveShadow = false;
|
|
113
308
|
|
|
309
|
+
/**
|
|
310
|
+
* When set to `true`, the 3D object is honored by view frustum culling.
|
|
311
|
+
*
|
|
312
|
+
* @type {boolean}
|
|
313
|
+
* @default true
|
|
314
|
+
*/
|
|
114
315
|
this.frustumCulled = true;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* This value allows the default rendering order of scene graph objects to be
|
|
319
|
+
* overridden although opaque and transparent objects remain sorted independently.
|
|
320
|
+
* When this property is set for an instance of {@link Group},all descendants
|
|
321
|
+
* objects will be sorted and rendered together. Sorting is from lowest to highest
|
|
322
|
+
* render order.
|
|
323
|
+
*
|
|
324
|
+
* @type {number}
|
|
325
|
+
* @default 0
|
|
326
|
+
*/
|
|
115
327
|
this.renderOrder = 0;
|
|
116
328
|
|
|
329
|
+
/**
|
|
330
|
+
* An array holding the animation clips of the 3D object.
|
|
331
|
+
*
|
|
332
|
+
* @type {Array<AnimationClip>}
|
|
333
|
+
*/
|
|
117
334
|
this.animations = [];
|
|
118
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Custom depth material to be used when rendering to the depth map. Can only be used
|
|
338
|
+
* in context of meshes. When shadow-casting with a {@link DirectionalLight} or {@link SpotLight},
|
|
339
|
+
* if you are modifying vertex positions in the vertex shader you must specify a custom depth
|
|
340
|
+
* material for proper shadows.
|
|
341
|
+
*
|
|
342
|
+
* Only relevant in context of {@link WebGLRenderer}.
|
|
343
|
+
*
|
|
344
|
+
* @type {(Material|undefined)}
|
|
345
|
+
* @default undefined
|
|
346
|
+
*/
|
|
347
|
+
this.customDepthMaterial = undefined;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Same as {@link Object3D#customDepthMaterial}, but used with {@link PointLight}.
|
|
351
|
+
*
|
|
352
|
+
* Only relevant in context of {@link WebGLRenderer}.
|
|
353
|
+
*
|
|
354
|
+
* @type {(Material|undefined)}
|
|
355
|
+
* @default undefined
|
|
356
|
+
*/
|
|
357
|
+
this.customDistanceMaterial = undefined;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Whether the 3D object is supposed to be static or not. If set to `true`, it means
|
|
361
|
+
* the 3D object is not going to be changed after the initial renderer. This includes
|
|
362
|
+
* geometry and material settings. A static 3D object can be processed by the renderer
|
|
363
|
+
* slightly faster since certain state checks can be bypassed.
|
|
364
|
+
*
|
|
365
|
+
* Only relevant in context of {@link WebGPURenderer}.
|
|
366
|
+
*
|
|
367
|
+
* @type {boolean}
|
|
368
|
+
* @default false
|
|
369
|
+
*/
|
|
370
|
+
this.static = false;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* An object that can be used to store custom data about the 3D object. It
|
|
374
|
+
* should not hold references to functions as these will not be cloned.
|
|
375
|
+
*
|
|
376
|
+
* @type {Object}
|
|
377
|
+
*/
|
|
119
378
|
this.userData = {};
|
|
120
379
|
|
|
380
|
+
/**
|
|
381
|
+
* The pivot point for rotation and scale transformations.
|
|
382
|
+
* When set, rotation and scale are applied around this point
|
|
383
|
+
* instead of the object's origin.
|
|
384
|
+
*
|
|
385
|
+
* @type {?Vector3}
|
|
386
|
+
* @default null
|
|
387
|
+
*/
|
|
388
|
+
this.pivot = null;
|
|
389
|
+
|
|
121
390
|
}
|
|
122
391
|
|
|
392
|
+
/**
|
|
393
|
+
* A callback that is executed immediately before a 3D object is rendered to a shadow map.
|
|
394
|
+
*
|
|
395
|
+
* @param {Renderer|WebGLRenderer} renderer - The renderer.
|
|
396
|
+
* @param {Object3D} object - The 3D object.
|
|
397
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
398
|
+
* @param {Camera} shadowCamera - The shadow camera.
|
|
399
|
+
* @param {BufferGeometry} geometry - The 3D object's geometry.
|
|
400
|
+
* @param {Material} depthMaterial - The depth material.
|
|
401
|
+
* @param {Object} group - The geometry group data.
|
|
402
|
+
*/
|
|
123
403
|
onBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
124
404
|
|
|
405
|
+
/**
|
|
406
|
+
* A callback that is executed immediately after a 3D object is rendered to a shadow map.
|
|
407
|
+
*
|
|
408
|
+
* @param {Renderer|WebGLRenderer} renderer - The renderer.
|
|
409
|
+
* @param {Object3D} object - The 3D object.
|
|
410
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
411
|
+
* @param {Camera} shadowCamera - The shadow camera.
|
|
412
|
+
* @param {BufferGeometry} geometry - The 3D object's geometry.
|
|
413
|
+
* @param {Material} depthMaterial - The depth material.
|
|
414
|
+
* @param {Object} group - The geometry group data.
|
|
415
|
+
*/
|
|
125
416
|
onAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
126
417
|
|
|
418
|
+
/**
|
|
419
|
+
* A callback that is executed immediately before a 3D object is rendered.
|
|
420
|
+
*
|
|
421
|
+
* @param {Renderer|WebGLRenderer} renderer - The renderer.
|
|
422
|
+
* @param {Object3D} object - The 3D object.
|
|
423
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
424
|
+
* @param {BufferGeometry} geometry - The 3D object's geometry.
|
|
425
|
+
* @param {Material} material - The 3D object's material.
|
|
426
|
+
* @param {Object} group - The geometry group data.
|
|
427
|
+
*/
|
|
127
428
|
onBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
128
429
|
|
|
430
|
+
/**
|
|
431
|
+
* A callback that is executed immediately after a 3D object is rendered.
|
|
432
|
+
*
|
|
433
|
+
* @param {Renderer|WebGLRenderer} renderer - The renderer.
|
|
434
|
+
* @param {Object3D} object - The 3D object.
|
|
435
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
436
|
+
* @param {BufferGeometry} geometry - The 3D object's geometry.
|
|
437
|
+
* @param {Material} material - The 3D object's material.
|
|
438
|
+
* @param {Object} group - The geometry group data.
|
|
439
|
+
*/
|
|
129
440
|
onAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
130
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Applies the given transformation matrix to the object and updates the object's position,
|
|
444
|
+
* rotation and scale.
|
|
445
|
+
*
|
|
446
|
+
* @param {Matrix4} matrix - The transformation matrix.
|
|
447
|
+
*/
|
|
131
448
|
applyMatrix4( matrix ) {
|
|
132
449
|
|
|
133
450
|
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
@@ -138,6 +455,12 @@ class Object3D extends EventDispatcher {
|
|
|
138
455
|
|
|
139
456
|
}
|
|
140
457
|
|
|
458
|
+
/**
|
|
459
|
+
* Applies a rotation represented by given the quaternion to the 3D object.
|
|
460
|
+
*
|
|
461
|
+
* @param {Quaternion} q - The quaternion.
|
|
462
|
+
* @return {Object3D} A reference to this instance.
|
|
463
|
+
*/
|
|
141
464
|
applyQuaternion( q ) {
|
|
142
465
|
|
|
143
466
|
this.quaternion.premultiply( q );
|
|
@@ -146,6 +469,12 @@ class Object3D extends EventDispatcher {
|
|
|
146
469
|
|
|
147
470
|
}
|
|
148
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Sets the given rotation represented as an axis/angle couple to the 3D object.
|
|
474
|
+
*
|
|
475
|
+
* @param {Vector3} axis - The (normalized) axis vector.
|
|
476
|
+
* @param {number} angle - The angle in radians.
|
|
477
|
+
*/
|
|
149
478
|
setRotationFromAxisAngle( axis, angle ) {
|
|
150
479
|
|
|
151
480
|
// assumes axis is normalized
|
|
@@ -154,12 +483,23 @@ class Object3D extends EventDispatcher {
|
|
|
154
483
|
|
|
155
484
|
}
|
|
156
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Sets the given rotation represented as Euler angles to the 3D object.
|
|
488
|
+
*
|
|
489
|
+
* @param {Euler} euler - The Euler angles.
|
|
490
|
+
*/
|
|
157
491
|
setRotationFromEuler( euler ) {
|
|
158
492
|
|
|
159
493
|
this.quaternion.setFromEuler( euler, true );
|
|
160
494
|
|
|
161
495
|
}
|
|
162
496
|
|
|
497
|
+
/**
|
|
498
|
+
* Sets the given rotation represented as rotation matrix to the 3D object.
|
|
499
|
+
*
|
|
500
|
+
* @param {Matrix4} m - Although a 4x4 matrix is expected, the upper 3x3 portion must be
|
|
501
|
+
* a pure rotation matrix (i.e, unscaled).
|
|
502
|
+
*/
|
|
163
503
|
setRotationFromMatrix( m ) {
|
|
164
504
|
|
|
165
505
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
@@ -168,6 +508,11 @@ class Object3D extends EventDispatcher {
|
|
|
168
508
|
|
|
169
509
|
}
|
|
170
510
|
|
|
511
|
+
/**
|
|
512
|
+
* Sets the given rotation represented as a Quaternion to the 3D object.
|
|
513
|
+
*
|
|
514
|
+
* @param {Quaternion} q - The Quaternion
|
|
515
|
+
*/
|
|
171
516
|
setRotationFromQuaternion( q ) {
|
|
172
517
|
|
|
173
518
|
// assumes q is normalized
|
|
@@ -176,6 +521,13 @@ class Object3D extends EventDispatcher {
|
|
|
176
521
|
|
|
177
522
|
}
|
|
178
523
|
|
|
524
|
+
/**
|
|
525
|
+
* Rotates the 3D object along an axis in local space.
|
|
526
|
+
*
|
|
527
|
+
* @param {Vector3} axis - The (normalized) axis vector.
|
|
528
|
+
* @param {number} angle - The angle in radians.
|
|
529
|
+
* @return {Object3D} A reference to this instance.
|
|
530
|
+
*/
|
|
179
531
|
rotateOnAxis( axis, angle ) {
|
|
180
532
|
|
|
181
533
|
// rotate object on axis in object space
|
|
@@ -189,6 +541,13 @@ class Object3D extends EventDispatcher {
|
|
|
189
541
|
|
|
190
542
|
}
|
|
191
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Rotates the 3D object along an axis in world space.
|
|
546
|
+
*
|
|
547
|
+
* @param {Vector3} axis - The (normalized) axis vector.
|
|
548
|
+
* @param {number} angle - The angle in radians.
|
|
549
|
+
* @return {Object3D} A reference to this instance.
|
|
550
|
+
*/
|
|
192
551
|
rotateOnWorldAxis( axis, angle ) {
|
|
193
552
|
|
|
194
553
|
// rotate object on axis in world space
|
|
@@ -203,24 +562,49 @@ class Object3D extends EventDispatcher {
|
|
|
203
562
|
|
|
204
563
|
}
|
|
205
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Rotates the 3D object around its X axis in local space.
|
|
567
|
+
*
|
|
568
|
+
* @param {number} angle - The angle in radians.
|
|
569
|
+
* @return {Object3D} A reference to this instance.
|
|
570
|
+
*/
|
|
206
571
|
rotateX( angle ) {
|
|
207
572
|
|
|
208
573
|
return this.rotateOnAxis( _xAxis, angle );
|
|
209
574
|
|
|
210
575
|
}
|
|
211
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Rotates the 3D object around its Y axis in local space.
|
|
579
|
+
*
|
|
580
|
+
* @param {number} angle - The angle in radians.
|
|
581
|
+
* @return {Object3D} A reference to this instance.
|
|
582
|
+
*/
|
|
212
583
|
rotateY( angle ) {
|
|
213
584
|
|
|
214
585
|
return this.rotateOnAxis( _yAxis, angle );
|
|
215
586
|
|
|
216
587
|
}
|
|
217
588
|
|
|
589
|
+
/**
|
|
590
|
+
* Rotates the 3D object around its Z axis in local space.
|
|
591
|
+
*
|
|
592
|
+
* @param {number} angle - The angle in radians.
|
|
593
|
+
* @return {Object3D} A reference to this instance.
|
|
594
|
+
*/
|
|
218
595
|
rotateZ( angle ) {
|
|
219
596
|
|
|
220
597
|
return this.rotateOnAxis( _zAxis, angle );
|
|
221
598
|
|
|
222
599
|
}
|
|
223
600
|
|
|
601
|
+
/**
|
|
602
|
+
* Translate the 3D object by a distance along the given axis in local space.
|
|
603
|
+
*
|
|
604
|
+
* @param {Vector3} axis - The (normalized) axis vector.
|
|
605
|
+
* @param {number} distance - The distance in world units.
|
|
606
|
+
* @return {Object3D} A reference to this instance.
|
|
607
|
+
*/
|
|
224
608
|
translateOnAxis( axis, distance ) {
|
|
225
609
|
|
|
226
610
|
// translate object by distance along axis in object space
|
|
@@ -234,24 +618,48 @@ class Object3D extends EventDispatcher {
|
|
|
234
618
|
|
|
235
619
|
}
|
|
236
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Translate the 3D object by a distance along its X-axis in local space.
|
|
623
|
+
*
|
|
624
|
+
* @param {number} distance - The distance in world units.
|
|
625
|
+
* @return {Object3D} A reference to this instance.
|
|
626
|
+
*/
|
|
237
627
|
translateX( distance ) {
|
|
238
628
|
|
|
239
629
|
return this.translateOnAxis( _xAxis, distance );
|
|
240
630
|
|
|
241
631
|
}
|
|
242
632
|
|
|
633
|
+
/**
|
|
634
|
+
* Translate the 3D object by a distance along its Y-axis in local space.
|
|
635
|
+
*
|
|
636
|
+
* @param {number} distance - The distance in world units.
|
|
637
|
+
* @return {Object3D} A reference to this instance.
|
|
638
|
+
*/
|
|
243
639
|
translateY( distance ) {
|
|
244
640
|
|
|
245
641
|
return this.translateOnAxis( _yAxis, distance );
|
|
246
642
|
|
|
247
643
|
}
|
|
248
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Translate the 3D object by a distance along its Z-axis in local space.
|
|
647
|
+
*
|
|
648
|
+
* @param {number} distance - The distance in world units.
|
|
649
|
+
* @return {Object3D} A reference to this instance.
|
|
650
|
+
*/
|
|
249
651
|
translateZ( distance ) {
|
|
250
652
|
|
|
251
653
|
return this.translateOnAxis( _zAxis, distance );
|
|
252
654
|
|
|
253
655
|
}
|
|
254
656
|
|
|
657
|
+
/**
|
|
658
|
+
* Converts the given vector from this 3D object's local space to world space.
|
|
659
|
+
*
|
|
660
|
+
* @param {Vector3} vector - The vector to convert.
|
|
661
|
+
* @return {Vector3} The converted vector.
|
|
662
|
+
*/
|
|
255
663
|
localToWorld( vector ) {
|
|
256
664
|
|
|
257
665
|
this.updateWorldMatrix( true, false );
|
|
@@ -260,6 +668,12 @@ class Object3D extends EventDispatcher {
|
|
|
260
668
|
|
|
261
669
|
}
|
|
262
670
|
|
|
671
|
+
/**
|
|
672
|
+
* Converts the given vector from this 3D object's world space to local space.
|
|
673
|
+
*
|
|
674
|
+
* @param {Vector3} vector - The vector to convert.
|
|
675
|
+
* @return {Vector3} The converted vector.
|
|
676
|
+
*/
|
|
263
677
|
worldToLocal( vector ) {
|
|
264
678
|
|
|
265
679
|
this.updateWorldMatrix( true, false );
|
|
@@ -268,6 +682,15 @@ class Object3D extends EventDispatcher {
|
|
|
268
682
|
|
|
269
683
|
}
|
|
270
684
|
|
|
685
|
+
/**
|
|
686
|
+
* Rotates the object to face a point in world space.
|
|
687
|
+
*
|
|
688
|
+
* This method does not support objects having non-uniformly-scaled parent(s).
|
|
689
|
+
*
|
|
690
|
+
* @param {number|Vector3} x - The x coordinate in world space. Alternatively, a vector representing a position in world space
|
|
691
|
+
* @param {number} [y] - The y coordinate in world space.
|
|
692
|
+
* @param {number} [z] - The z coordinate in world space.
|
|
693
|
+
*/
|
|
271
694
|
lookAt( x, y, z ) {
|
|
272
695
|
|
|
273
696
|
// This method does not support objects having non-uniformly-scaled parent(s)
|
|
@@ -310,6 +733,16 @@ class Object3D extends EventDispatcher {
|
|
|
310
733
|
|
|
311
734
|
}
|
|
312
735
|
|
|
736
|
+
/**
|
|
737
|
+
* Adds the given 3D object as a child to this 3D object. An arbitrary number of
|
|
738
|
+
* objects may be added. Any current parent on an object passed in here will be
|
|
739
|
+
* removed, since an object can have at most one parent.
|
|
740
|
+
*
|
|
741
|
+
* @fires Object3D#added
|
|
742
|
+
* @fires Object3D#childadded
|
|
743
|
+
* @param {Object3D} object - The 3D object to add.
|
|
744
|
+
* @return {Object3D} A reference to this instance.
|
|
745
|
+
*/
|
|
313
746
|
add( object ) {
|
|
314
747
|
|
|
315
748
|
if ( arguments.length > 1 ) {
|
|
@@ -326,7 +759,7 @@ class Object3D extends EventDispatcher {
|
|
|
326
759
|
|
|
327
760
|
if ( object === this ) {
|
|
328
761
|
|
|
329
|
-
|
|
762
|
+
error( 'Object3D.add: object can\'t be added as a child of itself.', object );
|
|
330
763
|
return this;
|
|
331
764
|
|
|
332
765
|
}
|
|
@@ -345,7 +778,7 @@ class Object3D extends EventDispatcher {
|
|
|
345
778
|
|
|
346
779
|
} else {
|
|
347
780
|
|
|
348
|
-
|
|
781
|
+
error( 'Object3D.add: object not an instance of THREE.Object3D.', object );
|
|
349
782
|
|
|
350
783
|
}
|
|
351
784
|
|
|
@@ -353,6 +786,15 @@ class Object3D extends EventDispatcher {
|
|
|
353
786
|
|
|
354
787
|
}
|
|
355
788
|
|
|
789
|
+
/**
|
|
790
|
+
* Removes the given 3D object as child from this 3D object.
|
|
791
|
+
* An arbitrary number of objects may be removed.
|
|
792
|
+
*
|
|
793
|
+
* @fires Object3D#removed
|
|
794
|
+
* @fires Object3D#childremoved
|
|
795
|
+
* @param {Object3D} object - The 3D object to remove.
|
|
796
|
+
* @return {Object3D} A reference to this instance.
|
|
797
|
+
*/
|
|
356
798
|
remove( object ) {
|
|
357
799
|
|
|
358
800
|
if ( arguments.length > 1 ) {
|
|
@@ -386,6 +828,13 @@ class Object3D extends EventDispatcher {
|
|
|
386
828
|
|
|
387
829
|
}
|
|
388
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Removes this 3D object from its current parent.
|
|
833
|
+
*
|
|
834
|
+
* @fires Object3D#removed
|
|
835
|
+
* @fires Object3D#childremoved
|
|
836
|
+
* @return {Object3D} A reference to this instance.
|
|
837
|
+
*/
|
|
389
838
|
removeFromParent() {
|
|
390
839
|
|
|
391
840
|
const parent = this.parent;
|
|
@@ -400,12 +849,28 @@ class Object3D extends EventDispatcher {
|
|
|
400
849
|
|
|
401
850
|
}
|
|
402
851
|
|
|
852
|
+
/**
|
|
853
|
+
* Removes all child objects.
|
|
854
|
+
*
|
|
855
|
+
* @fires Object3D#removed
|
|
856
|
+
* @fires Object3D#childremoved
|
|
857
|
+
* @return {Object3D} A reference to this instance.
|
|
858
|
+
*/
|
|
403
859
|
clear() {
|
|
404
860
|
|
|
405
861
|
return this.remove( ... this.children );
|
|
406
862
|
|
|
407
863
|
}
|
|
408
864
|
|
|
865
|
+
/**
|
|
866
|
+
* Adds the given 3D object as a child of this 3D object, while maintaining the object's world
|
|
867
|
+
* transform. This method does not support scene graphs having non-uniformly-scaled nodes(s).
|
|
868
|
+
*
|
|
869
|
+
* @fires Object3D#added
|
|
870
|
+
* @fires Object3D#childadded
|
|
871
|
+
* @param {Object3D} object - The 3D object to attach.
|
|
872
|
+
* @return {Object3D} A reference to this instance.
|
|
873
|
+
*/
|
|
409
874
|
attach( object ) {
|
|
410
875
|
|
|
411
876
|
// adds object as a child of this, while maintaining the object's world transform
|
|
@@ -442,18 +907,40 @@ class Object3D extends EventDispatcher {
|
|
|
442
907
|
|
|
443
908
|
}
|
|
444
909
|
|
|
910
|
+
/**
|
|
911
|
+
* Searches through the 3D object and its children, starting with the 3D object
|
|
912
|
+
* itself, and returns the first with a matching ID.
|
|
913
|
+
*
|
|
914
|
+
* @param {number} id - The id.
|
|
915
|
+
* @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.
|
|
916
|
+
*/
|
|
445
917
|
getObjectById( id ) {
|
|
446
918
|
|
|
447
919
|
return this.getObjectByProperty( 'id', id );
|
|
448
920
|
|
|
449
921
|
}
|
|
450
922
|
|
|
923
|
+
/**
|
|
924
|
+
* Searches through the 3D object and its children, starting with the 3D object
|
|
925
|
+
* itself, and returns the first with a matching name.
|
|
926
|
+
*
|
|
927
|
+
* @param {string} name - The name.
|
|
928
|
+
* @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.
|
|
929
|
+
*/
|
|
451
930
|
getObjectByName( name ) {
|
|
452
931
|
|
|
453
932
|
return this.getObjectByProperty( 'name', name );
|
|
454
933
|
|
|
455
934
|
}
|
|
456
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Searches through the 3D object and its children, starting with the 3D object
|
|
938
|
+
* itself, and returns the first with a matching property value.
|
|
939
|
+
*
|
|
940
|
+
* @param {string} name - The name of the property.
|
|
941
|
+
* @param {any} value - The value.
|
|
942
|
+
* @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found.
|
|
943
|
+
*/
|
|
457
944
|
getObjectByProperty( name, value ) {
|
|
458
945
|
|
|
459
946
|
if ( this[ name ] === value ) return this;
|
|
@@ -475,6 +962,15 @@ class Object3D extends EventDispatcher {
|
|
|
475
962
|
|
|
476
963
|
}
|
|
477
964
|
|
|
965
|
+
/**
|
|
966
|
+
* Searches through the 3D object and its children, starting with the 3D object
|
|
967
|
+
* itself, and returns all 3D objects with a matching property value.
|
|
968
|
+
*
|
|
969
|
+
* @param {string} name - The name of the property.
|
|
970
|
+
* @param {any} value - The value.
|
|
971
|
+
* @param {Array<Object3D>} result - The method stores the result in this array.
|
|
972
|
+
* @return {Array<Object3D>} The found 3D objects.
|
|
973
|
+
*/
|
|
478
974
|
getObjectsByProperty( name, value, result = [] ) {
|
|
479
975
|
|
|
480
976
|
if ( this[ name ] === value ) result.push( this );
|
|
@@ -491,6 +987,12 @@ class Object3D extends EventDispatcher {
|
|
|
491
987
|
|
|
492
988
|
}
|
|
493
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Returns a vector representing the position of the 3D object in world space.
|
|
992
|
+
*
|
|
993
|
+
* @param {Vector3} target - The target vector the result is stored to.
|
|
994
|
+
* @return {Vector3} The 3D object's position in world space.
|
|
995
|
+
*/
|
|
494
996
|
getWorldPosition( target ) {
|
|
495
997
|
|
|
496
998
|
this.updateWorldMatrix( true, false );
|
|
@@ -499,6 +1001,12 @@ class Object3D extends EventDispatcher {
|
|
|
499
1001
|
|
|
500
1002
|
}
|
|
501
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* Returns a Quaternion representing the position of the 3D object in world space.
|
|
1006
|
+
*
|
|
1007
|
+
* @param {Quaternion} target - The target Quaternion the result is stored to.
|
|
1008
|
+
* @return {Quaternion} The 3D object's rotation in world space.
|
|
1009
|
+
*/
|
|
502
1010
|
getWorldQuaternion( target ) {
|
|
503
1011
|
|
|
504
1012
|
this.updateWorldMatrix( true, false );
|
|
@@ -509,6 +1017,12 @@ class Object3D extends EventDispatcher {
|
|
|
509
1017
|
|
|
510
1018
|
}
|
|
511
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* Returns a vector representing the scale of the 3D object in world space.
|
|
1022
|
+
*
|
|
1023
|
+
* @param {Vector3} target - The target vector the result is stored to.
|
|
1024
|
+
* @return {Vector3} The 3D object's scale in world space.
|
|
1025
|
+
*/
|
|
512
1026
|
getWorldScale( target ) {
|
|
513
1027
|
|
|
514
1028
|
this.updateWorldMatrix( true, false );
|
|
@@ -519,6 +1033,12 @@ class Object3D extends EventDispatcher {
|
|
|
519
1033
|
|
|
520
1034
|
}
|
|
521
1035
|
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns a vector representing the ("look") direction of the 3D object in world space.
|
|
1038
|
+
*
|
|
1039
|
+
* @param {Vector3} target - The target vector the result is stored to.
|
|
1040
|
+
* @return {Vector3} The 3D object's direction in world space.
|
|
1041
|
+
*/
|
|
522
1042
|
getWorldDirection( target ) {
|
|
523
1043
|
|
|
524
1044
|
this.updateWorldMatrix( true, false );
|
|
@@ -529,8 +1049,24 @@ class Object3D extends EventDispatcher {
|
|
|
529
1049
|
|
|
530
1050
|
}
|
|
531
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Abstract method to get intersections between a casted ray and this
|
|
1054
|
+
* 3D object. Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}
|
|
1055
|
+
* implement this method in order to use raycasting.
|
|
1056
|
+
*
|
|
1057
|
+
* @abstract
|
|
1058
|
+
* @param {Raycaster} raycaster - The raycaster.
|
|
1059
|
+
* @param {Array<Object>} intersects - An array holding the result of the method.
|
|
1060
|
+
*/
|
|
532
1061
|
raycast( /* raycaster, intersects */ ) {}
|
|
533
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* Executes the callback on this 3D object and all descendants.
|
|
1065
|
+
*
|
|
1066
|
+
* Note: Modifying the scene graph inside the callback is discouraged.
|
|
1067
|
+
*
|
|
1068
|
+
* @param {Function} callback - A callback function that allows to process the current 3D object.
|
|
1069
|
+
*/
|
|
534
1070
|
traverse( callback ) {
|
|
535
1071
|
|
|
536
1072
|
callback( this );
|
|
@@ -545,6 +1081,14 @@ class Object3D extends EventDispatcher {
|
|
|
545
1081
|
|
|
546
1082
|
}
|
|
547
1083
|
|
|
1084
|
+
/**
|
|
1085
|
+
* Like {@link Object3D#traverse}, but the callback will only be executed for visible 3D objects.
|
|
1086
|
+
* Descendants of invisible 3D objects are not traversed.
|
|
1087
|
+
*
|
|
1088
|
+
* Note: Modifying the scene graph inside the callback is discouraged.
|
|
1089
|
+
*
|
|
1090
|
+
* @param {Function} callback - A callback function that allows to process the current 3D object.
|
|
1091
|
+
*/
|
|
548
1092
|
traverseVisible( callback ) {
|
|
549
1093
|
|
|
550
1094
|
if ( this.visible === false ) return;
|
|
@@ -561,6 +1105,13 @@ class Object3D extends EventDispatcher {
|
|
|
561
1105
|
|
|
562
1106
|
}
|
|
563
1107
|
|
|
1108
|
+
/**
|
|
1109
|
+
* Like {@link Object3D#traverse}, but the callback will only be executed for all ancestors.
|
|
1110
|
+
*
|
|
1111
|
+
* Note: Modifying the scene graph inside the callback is discouraged.
|
|
1112
|
+
*
|
|
1113
|
+
* @param {Function} callback - A callback function that allows to process the current 3D object.
|
|
1114
|
+
*/
|
|
564
1115
|
traverseAncestors( callback ) {
|
|
565
1116
|
|
|
566
1117
|
const parent = this.parent;
|
|
@@ -575,14 +1126,42 @@ class Object3D extends EventDispatcher {
|
|
|
575
1126
|
|
|
576
1127
|
}
|
|
577
1128
|
|
|
1129
|
+
/**
|
|
1130
|
+
* Updates the transformation matrix in local space by computing it from the current
|
|
1131
|
+
* position, rotation and scale values.
|
|
1132
|
+
*/
|
|
578
1133
|
updateMatrix() {
|
|
579
1134
|
|
|
580
1135
|
this.matrix.compose( this.position, this.quaternion, this.scale );
|
|
581
1136
|
|
|
1137
|
+
const pivot = this.pivot;
|
|
1138
|
+
|
|
1139
|
+
if ( pivot !== null ) {
|
|
1140
|
+
|
|
1141
|
+
const px = pivot.x, py = pivot.y, pz = pivot.z;
|
|
1142
|
+
const te = this.matrix.elements;
|
|
1143
|
+
|
|
1144
|
+
te[ 12 ] += px - te[ 0 ] * px - te[ 4 ] * py - te[ 8 ] * pz;
|
|
1145
|
+
te[ 13 ] += py - te[ 1 ] * px - te[ 5 ] * py - te[ 9 ] * pz;
|
|
1146
|
+
te[ 14 ] += pz - te[ 2 ] * px - te[ 6 ] * py - te[ 10 ] * pz;
|
|
1147
|
+
|
|
1148
|
+
}
|
|
1149
|
+
|
|
582
1150
|
this.matrixWorldNeedsUpdate = true;
|
|
583
1151
|
|
|
584
1152
|
}
|
|
585
1153
|
|
|
1154
|
+
/**
|
|
1155
|
+
* Updates the transformation matrix in world space of this 3D objects and its descendants.
|
|
1156
|
+
*
|
|
1157
|
+
* To ensure correct results, this method also recomputes the 3D object's transformation matrix in
|
|
1158
|
+
* local space. The computation of the local and world matrix can be controlled with the
|
|
1159
|
+
* {@link Object3D#matrixAutoUpdate} and {@link Object3D#matrixWorldAutoUpdate} flags which are both
|
|
1160
|
+
* `true` by default. Set these flags to `false` if you need more control over the update matrix process.
|
|
1161
|
+
*
|
|
1162
|
+
* @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even
|
|
1163
|
+
* when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
|
|
1164
|
+
*/
|
|
586
1165
|
updateMatrixWorld( force ) {
|
|
587
1166
|
|
|
588
1167
|
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
@@ -623,6 +1202,13 @@ class Object3D extends EventDispatcher {
|
|
|
623
1202
|
|
|
624
1203
|
}
|
|
625
1204
|
|
|
1205
|
+
/**
|
|
1206
|
+
* An alternative version of {@link Object3D#updateMatrixWorld} with more control over the
|
|
1207
|
+
* update of ancestor and descendant nodes.
|
|
1208
|
+
*
|
|
1209
|
+
* @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.
|
|
1210
|
+
* @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.
|
|
1211
|
+
*/
|
|
626
1212
|
updateWorldMatrix( updateParents, updateChildren ) {
|
|
627
1213
|
|
|
628
1214
|
const parent = this.parent;
|
|
@@ -667,6 +1253,13 @@ class Object3D extends EventDispatcher {
|
|
|
667
1253
|
|
|
668
1254
|
}
|
|
669
1255
|
|
|
1256
|
+
/**
|
|
1257
|
+
* Serializes the 3D object into JSON.
|
|
1258
|
+
*
|
|
1259
|
+
* @param {?(Object|string)} meta - An optional value holding meta information about the serialization.
|
|
1260
|
+
* @return {Object} A JSON object representing the serialized 3D object.
|
|
1261
|
+
* @see {@link ObjectLoader#parse}
|
|
1262
|
+
*/
|
|
670
1263
|
toJSON( meta ) {
|
|
671
1264
|
|
|
672
1265
|
// meta is a string when called from JSON.stringify
|
|
@@ -692,7 +1285,7 @@ class Object3D extends EventDispatcher {
|
|
|
692
1285
|
};
|
|
693
1286
|
|
|
694
1287
|
output.metadata = {
|
|
695
|
-
version: 4.
|
|
1288
|
+
version: 4.7,
|
|
696
1289
|
type: 'Object',
|
|
697
1290
|
generator: 'Object3D.toJSON'
|
|
698
1291
|
};
|
|
@@ -712,14 +1305,20 @@ class Object3D extends EventDispatcher {
|
|
|
712
1305
|
if ( this.visible === false ) object.visible = false;
|
|
713
1306
|
if ( this.frustumCulled === false ) object.frustumCulled = false;
|
|
714
1307
|
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
|
|
1308
|
+
if ( this.static !== false ) object.static = this.static;
|
|
715
1309
|
if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
|
|
716
1310
|
|
|
717
1311
|
object.layers = this.layers.mask;
|
|
718
1312
|
object.matrix = this.matrix.toArray();
|
|
719
1313
|
object.up = this.up.toArray();
|
|
720
1314
|
|
|
1315
|
+
if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
|
|
1316
|
+
|
|
721
1317
|
if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
|
|
722
1318
|
|
|
1319
|
+
if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
|
|
1320
|
+
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();
|
|
1321
|
+
|
|
723
1322
|
// object specific properties
|
|
724
1323
|
|
|
725
1324
|
if ( this.isInstancedMesh ) {
|
|
@@ -740,44 +1339,45 @@ class Object3D extends EventDispatcher {
|
|
|
740
1339
|
object.drawRanges = this._drawRanges;
|
|
741
1340
|
object.reservedRanges = this._reservedRanges;
|
|
742
1341
|
|
|
743
|
-
object.
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
boxMin: bound.box.min.toArray(),
|
|
748
|
-
boxMax: bound.box.max.toArray(),
|
|
749
|
-
|
|
750
|
-
sphereInitialized: bound.sphereInitialized,
|
|
751
|
-
sphereRadius: bound.sphere.radius,
|
|
752
|
-
sphereCenter: bound.sphere.center.toArray()
|
|
1342
|
+
object.geometryInfo = this._geometryInfo.map( info => ( {
|
|
1343
|
+
...info,
|
|
1344
|
+
boundingBox: info.boundingBox ? info.boundingBox.toJSON() : undefined,
|
|
1345
|
+
boundingSphere: info.boundingSphere ? info.boundingSphere.toJSON() : undefined
|
|
753
1346
|
} ) );
|
|
1347
|
+
object.instanceInfo = this._instanceInfo.map( info => ( { ...info } ) );
|
|
1348
|
+
|
|
1349
|
+
object.availableInstanceIds = this._availableInstanceIds.slice();
|
|
1350
|
+
object.availableGeometryIds = this._availableGeometryIds.slice();
|
|
1351
|
+
|
|
1352
|
+
object.nextIndexStart = this._nextIndexStart;
|
|
1353
|
+
object.nextVertexStart = this._nextVertexStart;
|
|
1354
|
+
object.geometryCount = this._geometryCount;
|
|
754
1355
|
|
|
755
1356
|
object.maxInstanceCount = this._maxInstanceCount;
|
|
756
1357
|
object.maxVertexCount = this._maxVertexCount;
|
|
757
1358
|
object.maxIndexCount = this._maxIndexCount;
|
|
758
1359
|
|
|
759
1360
|
object.geometryInitialized = this._geometryInitialized;
|
|
760
|
-
object.geometryCount = this._geometryCount;
|
|
761
1361
|
|
|
762
1362
|
object.matricesTexture = this._matricesTexture.toJSON( meta );
|
|
763
1363
|
|
|
764
|
-
|
|
1364
|
+
object.indirectTexture = this._indirectTexture.toJSON( meta );
|
|
1365
|
+
|
|
1366
|
+
if ( this._colorsTexture !== null ) {
|
|
1367
|
+
|
|
1368
|
+
object.colorsTexture = this._colorsTexture.toJSON( meta );
|
|
1369
|
+
|
|
1370
|
+
}
|
|
765
1371
|
|
|
766
1372
|
if ( this.boundingSphere !== null ) {
|
|
767
1373
|
|
|
768
|
-
object.boundingSphere =
|
|
769
|
-
center: object.boundingSphere.center.toArray(),
|
|
770
|
-
radius: object.boundingSphere.radius
|
|
771
|
-
};
|
|
1374
|
+
object.boundingSphere = this.boundingSphere.toJSON();
|
|
772
1375
|
|
|
773
1376
|
}
|
|
774
1377
|
|
|
775
1378
|
if ( this.boundingBox !== null ) {
|
|
776
1379
|
|
|
777
|
-
object.boundingBox =
|
|
778
|
-
min: object.boundingBox.min.toArray(),
|
|
779
|
-
max: object.boundingBox.max.toArray()
|
|
780
|
-
};
|
|
1380
|
+
object.boundingBox = this.boundingBox.toJSON();
|
|
781
1381
|
|
|
782
1382
|
}
|
|
783
1383
|
|
|
@@ -962,12 +1562,25 @@ class Object3D extends EventDispatcher {
|
|
|
962
1562
|
|
|
963
1563
|
}
|
|
964
1564
|
|
|
1565
|
+
/**
|
|
1566
|
+
* Returns a new 3D object with copied values from this instance.
|
|
1567
|
+
*
|
|
1568
|
+
* @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are also cloned.
|
|
1569
|
+
* @return {Object3D} A clone of this instance.
|
|
1570
|
+
*/
|
|
965
1571
|
clone( recursive ) {
|
|
966
1572
|
|
|
967
1573
|
return new this.constructor().copy( this, recursive );
|
|
968
1574
|
|
|
969
1575
|
}
|
|
970
1576
|
|
|
1577
|
+
/**
|
|
1578
|
+
* Copies the values of the given 3D object to this instance.
|
|
1579
|
+
*
|
|
1580
|
+
* @param {Object3D} source - The 3D object to copy.
|
|
1581
|
+
* @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are cloned.
|
|
1582
|
+
* @return {Object3D} A reference to this instance.
|
|
1583
|
+
*/
|
|
971
1584
|
copy( source, recursive = true ) {
|
|
972
1585
|
|
|
973
1586
|
this.name = source.name;
|
|
@@ -979,6 +1592,12 @@ class Object3D extends EventDispatcher {
|
|
|
979
1592
|
this.quaternion.copy( source.quaternion );
|
|
980
1593
|
this.scale.copy( source.scale );
|
|
981
1594
|
|
|
1595
|
+
if ( source.pivot !== null ) {
|
|
1596
|
+
|
|
1597
|
+
this.pivot = source.pivot.clone();
|
|
1598
|
+
|
|
1599
|
+
}
|
|
1600
|
+
|
|
982
1601
|
this.matrix.copy( source.matrix );
|
|
983
1602
|
this.matrixWorld.copy( source.matrixWorld );
|
|
984
1603
|
|
|
@@ -996,6 +1615,8 @@ class Object3D extends EventDispatcher {
|
|
|
996
1615
|
this.frustumCulled = source.frustumCulled;
|
|
997
1616
|
this.renderOrder = source.renderOrder;
|
|
998
1617
|
|
|
1618
|
+
this.static = source.static;
|
|
1619
|
+
|
|
999
1620
|
this.animations = source.animations.slice();
|
|
1000
1621
|
|
|
1001
1622
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
@@ -1017,8 +1638,34 @@ class Object3D extends EventDispatcher {
|
|
|
1017
1638
|
|
|
1018
1639
|
}
|
|
1019
1640
|
|
|
1641
|
+
/**
|
|
1642
|
+
* The default up direction for objects, also used as the default
|
|
1643
|
+
* position for {@link DirectionalLight} and {@link HemisphereLight}.
|
|
1644
|
+
*
|
|
1645
|
+
* @static
|
|
1646
|
+
* @type {Vector3}
|
|
1647
|
+
* @default (0,1,0)
|
|
1648
|
+
*/
|
|
1020
1649
|
Object3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* The default setting for {@link Object3D#matrixAutoUpdate} for
|
|
1653
|
+
* newly created 3D objects.
|
|
1654
|
+
*
|
|
1655
|
+
* @static
|
|
1656
|
+
* @type {boolean}
|
|
1657
|
+
* @default true
|
|
1658
|
+
*/
|
|
1021
1659
|
Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* The default setting for {@link Object3D#matrixWorldAutoUpdate} for
|
|
1663
|
+
* newly created 3D objects.
|
|
1664
|
+
*
|
|
1665
|
+
* @static
|
|
1666
|
+
* @type {boolean}
|
|
1667
|
+
* @default true
|
|
1668
|
+
*/
|
|
1022
1669
|
Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
|
|
1023
1670
|
|
|
1024
1671
|
export { Object3D };
|