@gnsx/three 0.184.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 +21 -0
- package/README.md +85 -0
- package/build/three.cjs +79695 -0
- package/build/three.core.js +59732 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +19552 -0
- package/build/three.module.min.js +6 -0
- package/build/three.tsl.js +654 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +83969 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +83702 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/Addons.js +293 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.js +595 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.js +3539 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.js +451 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.js +1963 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.js +1001 -0
- package/examples/jsm/controls/TransformControls.js +1950 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.js +209 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.js +307 -0
- package/examples/jsm/csm/CSMShadowNode.js +603 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.js +155 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.js +310 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.js +311 -0
- package/examples/jsm/exporters/EXRExporter.js +618 -0
- package/examples/jsm/exporters/GLTFExporter.js +3738 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.js +308 -0
- package/examples/jsm/exporters/PLYExporter.js +562 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.js +1254 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.js +165 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.js +519 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -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 +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +601 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2672 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14506 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.js +703 -0
- package/examples/jsm/lines/LineSegments2.js +426 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +411 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +1836 -0
- package/examples/jsm/loaders/3MFLoader.js +1621 -0
- package/examples/jsm/loaders/AMFLoader.js +541 -0
- package/examples/jsm/loaders/BVHLoader.js +484 -0
- package/examples/jsm/loaders/ColladaLoader.js +153 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.js +739 -0
- package/examples/jsm/loaders/EXRLoader.js +3423 -0
- package/examples/jsm/loaders/FBXLoader.js +4580 -0
- package/examples/jsm/loaders/FontLoader.js +260 -0
- package/examples/jsm/loaders/GCodeLoader.js +318 -0
- package/examples/jsm/loaders/GLTFLoader.js +4860 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +379 -0
- package/examples/jsm/loaders/KMZLoader.js +163 -0
- package/examples/jsm/loaders/KTX2Loader.js +1257 -0
- package/examples/jsm/loaders/KTXLoader.js +197 -0
- package/examples/jsm/loaders/LDrawLoader.js +2510 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
- package/examples/jsm/loaders/LUTImageLoader.js +190 -0
- package/examples/jsm/loaders/LWOLoader.js +1047 -0
- package/examples/jsm/loaders/LottieLoader.js +130 -0
- package/examples/jsm/loaders/MD2Loader.js +435 -0
- package/examples/jsm/loaders/MDDLoader.js +147 -0
- package/examples/jsm/loaders/MTLLoader.js +593 -0
- package/examples/jsm/loaders/MaterialXLoader.js +1104 -0
- package/examples/jsm/loaders/NRRDLoader.js +718 -0
- package/examples/jsm/loaders/OBJLoader.js +955 -0
- package/examples/jsm/loaders/PCDLoader.js +620 -0
- package/examples/jsm/loaders/PDBLoader.js +272 -0
- package/examples/jsm/loaders/PLYLoader.js +805 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/STLLoader.js +421 -0
- package/examples/jsm/loaders/SVGLoader.js +3267 -0
- package/examples/jsm/loaders/TDSLoader.js +1142 -0
- package/examples/jsm/loaders/TGALoader.js +538 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.js +261 -0
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
- package/examples/jsm/loaders/VOXLoader.js +919 -0
- package/examples/jsm/loaders/VRMLLoader.js +3646 -0
- package/examples/jsm/loaders/VTKLoader.js +1293 -0
- package/examples/jsm/loaders/XYZLoader.js +143 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/usd/USDAParser.js +828 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1878 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -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 +159 -0
- package/examples/jsm/math/ColorConverter.js +58 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.js +822 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/TubePainter.js +599 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +632 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.js +386 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.js +321 -0
- package/examples/jsm/objects/SkyMesh.js +377 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +359 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.js +436 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +185 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.js +727 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.js +856 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +524 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +328 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.js +799 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +180 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.js +72 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.js +434 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.js +298 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.js +675 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1228 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +983 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +254 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +293 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- 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 +174 -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/FSR1Node.js +477 -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 +572 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +399 -0
- package/examples/jsm/tsl/display/GodraysNode.js +615 -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 +812 -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/examples/jsm/tsl/display/SSAAPassNode.js +358 -0
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +119 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +767 -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/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -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 +1434 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +403 -0
- package/examples/jsm/webxr/XREstimatedLight.js +254 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/package.json +123 -0
- package/src/Three.Core.js +187 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.js +647 -0
- package/src/Three.WebGPU.Nodes.js +31 -0
- package/src/Three.WebGPU.js +37 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.js +942 -0
- package/src/animation/AnimationClip.js +628 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.js +411 -0
- package/src/animation/AnimationUtils.js +495 -0
- package/src/animation/KeyframeTrack.js +636 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.js +54 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.js +146 -0
- package/src/constants.js +1760 -0
- package/src/core/BufferAttribute.js +1056 -0
- package/src/core/BufferGeometry.js +1458 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.js +291 -0
- package/src/core/InterleavedBufferAttribute.js +549 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.js +1667 -0
- package/src/core/Raycaster.js +262 -0
- package/src/core/RenderTarget.js +392 -0
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.js +180 -0
- package/src/extras/Controls.js +120 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.js +1167 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.js +517 -0
- package/src/extras/core/CurvePath.js +296 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.js +367 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.js +180 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.js +230 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.js +175 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.js +171 -0
- package/src/helpers/AxesHelper.js +96 -0
- package/src/helpers/Box3Helper.js +83 -0
- package/src/helpers/BoxHelper.js +149 -0
- package/src/helpers/CameraHelper.js +345 -0
- package/src/helpers/DirectionalLightHelper.js +148 -0
- package/src/helpers/GridHelper.js +82 -0
- package/src/helpers/HemisphereLightHelper.js +130 -0
- package/src/helpers/PlaneHelper.js +96 -0
- package/src/helpers/PointLightHelper.js +111 -0
- package/src/helpers/PolarGridHelper.js +126 -0
- package/src/helpers/SkeletonHelper.js +194 -0
- package/src/helpers/SpotLightHelper.js +154 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.js +85 -0
- package/src/lights/LightProbe.js +75 -0
- package/src/lights/LightShadow.js +347 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.js +80 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +98 -0
- package/src/loaders/AudioLoader.js +108 -0
- package/src/loaders/BufferGeometryLoader.js +242 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.js +167 -0
- package/src/loaders/CubeTextureLoader.js +103 -0
- package/src/loaders/DataTextureLoader.js +174 -0
- package/src/loaders/FileLoader.js +367 -0
- package/src/loaders/ImageBitmapLoader.js +223 -0
- package/src/loaders/ImageLoader.js +168 -0
- package/src/loaders/Loader.js +222 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.js +329 -0
- package/src/loaders/MaterialLoader.js +439 -0
- package/src/loaders/ObjectLoader.js +1304 -0
- package/src/loaders/TextureLoader.js +74 -0
- package/src/loaders/nodes/NodeLoader.js +194 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.js +122 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.js +1017 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +250 -0
- package/src/materials/MeshDepthMaterial.js +148 -0
- package/src/materials/MeshDistanceMaterial.js +119 -0
- package/src/materials/MeshLambertMaterial.js +402 -0
- package/src/materials/MeshMatcapMaterial.js +245 -0
- package/src/materials/MeshNormalMaterial.js +175 -0
- package/src/materials/MeshPhongMaterial.js +421 -0
- package/src/materials/MeshPhysicalMaterial.js +536 -0
- package/src/materials/MeshStandardMaterial.js +425 -0
- package/src/materials/MeshToonMaterial.js +321 -0
- package/src/materials/PointsMaterial.js +139 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.js +413 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.js +136 -0
- package/src/materials/nodes/Line2NodeMaterial.js +569 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +141 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +521 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +175 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +187 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
- package/src/materials/nodes/NodeMaterial.js +1330 -0
- package/src/materials/nodes/NodeMaterials.js +21 -0
- package/src/materials/nodes/PointsNodeMaterial.js +211 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +186 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +718 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.js +805 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.js +215 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.js +285 -0
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.js +337 -0
- package/src/math/MathUtils.js +751 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.js +617 -0
- package/src/math/Matrix4.js +1314 -0
- package/src/math/Plane.js +368 -0
- package/src/math/Quaternion.js +918 -0
- package/src/math/Ray.js +655 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.js +539 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.js +1067 -0
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.js +173 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +163 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.js +432 -0
- package/src/nodes/accessors/BufferNode.js +128 -0
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +403 -0
- package/src/nodes/accessors/ClippingNode.js +255 -0
- package/src/nodes/accessors/CubeTextureNode.js +215 -0
- package/src/nodes/accessors/InstanceNode.js +349 -0
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +139 -0
- package/src/nodes/accessors/MaterialNode.js +783 -0
- package/src/nodes/accessors/MaterialProperties.js +56 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.js +184 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/MorphNode.js +310 -0
- package/src/nodes/accessors/Normal.js +243 -0
- package/src/nodes/accessors/Object3DNode.js +268 -0
- package/src/nodes/accessors/PointUVNode.js +55 -0
- package/src/nodes/accessors/Position.js +122 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +357 -0
- package/src/nodes/accessors/ReferenceNode.js +424 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +328 -0
- package/src/nodes/accessors/StorageBufferNode.js +405 -0
- package/src/nodes/accessors/StorageTextureNode.js +295 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.js +92 -0
- package/src/nodes/accessors/TextureNode.js +971 -0
- package/src/nodes/accessors/TextureSizeNode.js +77 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.js +350 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.js +224 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.js +181 -0
- package/src/nodes/code/ExpressionNode.js +68 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.js +182 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +202 -0
- package/src/nodes/core/AttributeNode.js +168 -0
- package/src/nodes/core/BypassNode.js +93 -0
- package/src/nodes/core/ConstNode.js +67 -0
- package/src/nodes/core/ContextNode.js +283 -0
- package/src/nodes/core/IndexNode.js +165 -0
- package/src/nodes/core/InputNode.js +136 -0
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.js +196 -0
- package/src/nodes/core/Node.js +1180 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.js +3299 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +314 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.js +408 -0
- package/src/nodes/core/NodeVar.js +60 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.js +105 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.js +367 -0
- package/src/nodes/core/StackNode.js +426 -0
- 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 +148 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +88 -0
- package/src/nodes/core/UniformGroupNode.js +167 -0
- package/src/nodes/core/UniformNode.js +259 -0
- package/src/nodes/core/VarNode.js +367 -0
- package/src/nodes/core/VaryingNode.js +210 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +117 -0
- package/src/nodes/display/ColorAdjustment.js +158 -0
- package/src/nodes/display/ColorSpaceFunctions.js +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.js +102 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.js +1055 -0
- package/src/nodes/display/RenderOutputNode.js +150 -0
- package/src/nodes/display/ScreenNode.js +292 -0
- package/src/nodes/display/ToneMappingFunctions.js +242 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.js +191 -0
- package/src/nodes/display/ViewportDepthNode.js +342 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/D_GGX.js +23 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.js +175 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.js +878 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +210 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +274 -0
- package/src/nodes/gpgpu/BarrierNode.js +98 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
- package/src/nodes/gpgpu/ComputeNode.js +310 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +234 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.js +309 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.js +178 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.js +49 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.js +73 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.js +115 -0
- package/src/nodes/lighting/LightingNode.js +36 -0
- package/src/nodes/lighting/LightsNode.js +432 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +133 -0
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +889 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +197 -0
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/src/nodes/materialx/lib/mx_noise.js +1491 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +245 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.js +1202 -0
- package/src/nodes/math/MathUtils.js +54 -0
- package/src/nodes/math/OperatorNode.js +752 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.js +397 -0
- package/src/nodes/pmrem/PMREMUtils.js +397 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.js +1250 -0
- package/src/nodes/utils/ArrayElementNode.js +90 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +148 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.js +349 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +33 -0
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +289 -0
- package/src/nodes/utils/ReflectorNode.js +629 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +103 -0
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.js +179 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +63 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.js +1682 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.js +422 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.js +329 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.js +496 -0
- package/src/objects/Points.js +228 -0
- package/src/objects/Skeleton.js +392 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.js +245 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.js +3699 -0
- package/src/renderers/common/Animation.js +159 -0
- package/src/renderers/common/Attributes.js +132 -0
- package/src/renderers/common/Backend.js +769 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +46 -0
- package/src/renderers/common/Binding.js +71 -0
- package/src/renderers/common/Bindings.js +394 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +127 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.js +83 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.js +262 -0
- package/src/renderers/common/Color4.js +77 -0
- package/src/renderers/common/ComputePipeline.js +41 -0
- package/src/renderers/common/Constants.js +15 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/Geometries.js +396 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +501 -0
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +498 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +78 -0
- package/src/renderers/common/QuadMesh.js +112 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +281 -0
- package/src/renderers/common/RenderContexts.js +100 -0
- package/src/renderers/common/RenderList.js +404 -0
- package/src/renderers/common/RenderLists.js +78 -0
- package/src/renderers/common/RenderObject.js +915 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +218 -0
- package/src/renderers/common/RenderPipeline.js +255 -0
- package/src/renderers/common/Renderer.js +3654 -0
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +165 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.js +86 -0
- package/src/renderers/common/Textures.js +629 -0
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +548 -0
- package/src/renderers/common/XRManager.js +1684 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +1042 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +152 -0
- package/src/renderers/common/nodes/NodeLibrary.js +196 -0
- package/src/renderers/common/nodes/NodeManager.js +983 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
- package/src/renderers/common/nodes/NodeSampler.js +62 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +72 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +105 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +125 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +213 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +44 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +216 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +161 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +656 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +376 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.js +272 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.js +362 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.js +666 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.js +150 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.js +186 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.js +584 -0
- package/src/renderers/webgl/WebGLMaterials.js +602 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +1031 -0
- package/src/renderers/webgl/WebGLPrograms.js +679 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +253 -0
- package/src/renderers/webgl/WebGLRenderStates.js +124 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +600 -0
- package/src/renderers/webgl/WebGLState.js +1370 -0
- package/src/renderers/webgl/WebGLTextures.js +2506 -0
- package/src/renderers/webgl/WebGLUniforms.js +1203 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +413 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2783 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1676 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +89 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1361 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1324 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +317 -0
- package/src/renderers/webgpu/WebGPUBackend.js +2602 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +100 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2523 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +187 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +522 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +642 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +846 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +389 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1673 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +269 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.js +1103 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.js +89 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.js +112 -0
- package/src/textures/DataArrayTexture.js +134 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +85 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +230 -0
- package/src/textures/Texture.js +812 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,1667 @@
|
|
|
1
|
+
import { Quaternion } from '../math/Quaternion.js';
|
|
2
|
+
import { Vector3 } from '../math/Vector3.js';
|
|
3
|
+
import { Matrix4 } from '../math/Matrix4.js';
|
|
4
|
+
import { EventDispatcher } from './EventDispatcher.js';
|
|
5
|
+
import { Euler } from '../math/Euler.js';
|
|
6
|
+
import { Layers } from './Layers.js';
|
|
7
|
+
import { Matrix3 } from '../math/Matrix3.js';
|
|
8
|
+
import { generateUUID } from '../math/MathUtils.js';
|
|
9
|
+
import { error } from '../utils.js';
|
|
10
|
+
|
|
11
|
+
let _object3DId = 0;
|
|
12
|
+
|
|
13
|
+
const _v1 = /*@__PURE__*/ new Vector3();
|
|
14
|
+
const _q1 = /*@__PURE__*/ new Quaternion();
|
|
15
|
+
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
16
|
+
const _target = /*@__PURE__*/ new Vector3();
|
|
17
|
+
|
|
18
|
+
const _position = /*@__PURE__*/ new Vector3();
|
|
19
|
+
const _scale = /*@__PURE__*/ new Vector3();
|
|
20
|
+
const _quaternion = /*@__PURE__*/ new Quaternion();
|
|
21
|
+
|
|
22
|
+
const _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );
|
|
23
|
+
const _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
24
|
+
const _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Fires when the object has been added to its parent object.
|
|
28
|
+
*
|
|
29
|
+
* @event Object3D#added
|
|
30
|
+
* @type {Object}
|
|
31
|
+
*/
|
|
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
|
+
*/
|
|
40
|
+
const _removedEvent = { type: 'removed' };
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Fires when a new child object has been added.
|
|
44
|
+
*
|
|
45
|
+
* @event Object3D#childadded
|
|
46
|
+
* @type {Object}
|
|
47
|
+
*/
|
|
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
|
+
*/
|
|
56
|
+
const _childremovedEvent = { type: 'childremoved', child: null };
|
|
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
|
+
*/
|
|
64
|
+
class Object3D extends EventDispatcher {
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Constructs a new 3D object.
|
|
68
|
+
*/
|
|
69
|
+
constructor() {
|
|
70
|
+
|
|
71
|
+
super();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* This flag can be used for type testing.
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
* @readonly
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
this.isObject3D = true;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The ID of the 3D object.
|
|
84
|
+
*
|
|
85
|
+
* @name Object3D#id
|
|
86
|
+
* @type {number}
|
|
87
|
+
* @readonly
|
|
88
|
+
*/
|
|
89
|
+
Object.defineProperty( this, 'id', { value: _object3DId ++ } );
|
|
90
|
+
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
113
|
+
this.type = 'Object3D';
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A reference to the parent object.
|
|
117
|
+
*
|
|
118
|
+
* @type {?Object3D}
|
|
119
|
+
* @default null
|
|
120
|
+
*/
|
|
121
|
+
this.parent = null;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* An array holding the child 3D objects of this instance.
|
|
125
|
+
*
|
|
126
|
+
* @type {Array<Object3D>}
|
|
127
|
+
*/
|
|
128
|
+
this.children = [];
|
|
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
|
+
*/
|
|
138
|
+
this.up = Object3D.DEFAULT_UP.clone();
|
|
139
|
+
|
|
140
|
+
const position = new Vector3();
|
|
141
|
+
const rotation = new Euler();
|
|
142
|
+
const quaternion = new Quaternion();
|
|
143
|
+
const scale = new Vector3( 1, 1, 1 );
|
|
144
|
+
|
|
145
|
+
function onRotationChange() {
|
|
146
|
+
|
|
147
|
+
quaternion.setFromEuler( rotation, false );
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function onQuaternionChange() {
|
|
152
|
+
|
|
153
|
+
rotation.setFromQuaternion( quaternion, undefined, false );
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
rotation._onChange( onRotationChange );
|
|
158
|
+
quaternion._onChange( onQuaternionChange );
|
|
159
|
+
|
|
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
|
+
*/
|
|
168
|
+
position: {
|
|
169
|
+
configurable: true,
|
|
170
|
+
enumerable: true,
|
|
171
|
+
value: position
|
|
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
|
+
*/
|
|
180
|
+
rotation: {
|
|
181
|
+
configurable: true,
|
|
182
|
+
enumerable: true,
|
|
183
|
+
value: rotation
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Represents the object's local rotation as Quaternions.
|
|
187
|
+
*
|
|
188
|
+
* @name Object3D#quaternion
|
|
189
|
+
* @type {Quaternion}
|
|
190
|
+
*/
|
|
191
|
+
quaternion: {
|
|
192
|
+
configurable: true,
|
|
193
|
+
enumerable: true,
|
|
194
|
+
value: quaternion
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Represents the object's local scale.
|
|
198
|
+
*
|
|
199
|
+
* @name Object3D#scale
|
|
200
|
+
* @type {Vector3}
|
|
201
|
+
* @default (1,1,1)
|
|
202
|
+
*/
|
|
203
|
+
scale: {
|
|
204
|
+
configurable: true,
|
|
205
|
+
enumerable: true,
|
|
206
|
+
value: scale
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* Represents the object's model-view matrix.
|
|
210
|
+
*
|
|
211
|
+
* @name Object3D#modelViewMatrix
|
|
212
|
+
* @type {Matrix4}
|
|
213
|
+
*/
|
|
214
|
+
modelViewMatrix: {
|
|
215
|
+
value: new Matrix4()
|
|
216
|
+
},
|
|
217
|
+
/**
|
|
218
|
+
* Represents the object's normal matrix.
|
|
219
|
+
*
|
|
220
|
+
* @name Object3D#normalMatrix
|
|
221
|
+
* @type {Matrix3}
|
|
222
|
+
*/
|
|
223
|
+
normalMatrix: {
|
|
224
|
+
value: new Matrix3()
|
|
225
|
+
}
|
|
226
|
+
} );
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Represents the object's transformation matrix in local space.
|
|
230
|
+
*
|
|
231
|
+
* @type {Matrix4}
|
|
232
|
+
*/
|
|
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
|
+
*/
|
|
241
|
+
this.matrixWorld = new Matrix4();
|
|
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
|
+
*/
|
|
253
|
+
this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
274
|
+
this.matrixWorldNeedsUpdate = false;
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
291
|
+
this.visible = true;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* When set to `true`, the 3D object gets rendered into shadow maps.
|
|
295
|
+
*
|
|
296
|
+
* @type {boolean}
|
|
297
|
+
* @default false
|
|
298
|
+
*/
|
|
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
|
+
*/
|
|
307
|
+
this.receiveShadow = false;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* When set to `true`, the 3D object is honored by view frustum culling.
|
|
311
|
+
*
|
|
312
|
+
* @type {boolean}
|
|
313
|
+
* @default true
|
|
314
|
+
*/
|
|
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
|
+
*/
|
|
327
|
+
this.renderOrder = 0;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* An array holding the animation clips of the 3D object.
|
|
331
|
+
*
|
|
332
|
+
* @type {Array<AnimationClip>}
|
|
333
|
+
*/
|
|
334
|
+
this.animations = [];
|
|
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
|
+
*/
|
|
378
|
+
this.userData = {};
|
|
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
|
+
|
|
390
|
+
}
|
|
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
|
+
*/
|
|
403
|
+
onBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
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
|
+
*/
|
|
416
|
+
onAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
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
|
+
*/
|
|
428
|
+
onBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
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
|
+
*/
|
|
440
|
+
onAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
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
|
+
*/
|
|
448
|
+
applyMatrix4( matrix ) {
|
|
449
|
+
|
|
450
|
+
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
451
|
+
|
|
452
|
+
this.matrix.premultiply( matrix );
|
|
453
|
+
|
|
454
|
+
this.matrix.decompose( this.position, this.quaternion, this.scale );
|
|
455
|
+
|
|
456
|
+
}
|
|
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
|
+
*/
|
|
464
|
+
applyQuaternion( q ) {
|
|
465
|
+
|
|
466
|
+
this.quaternion.premultiply( q );
|
|
467
|
+
|
|
468
|
+
return this;
|
|
469
|
+
|
|
470
|
+
}
|
|
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
|
+
*/
|
|
478
|
+
setRotationFromAxisAngle( axis, angle ) {
|
|
479
|
+
|
|
480
|
+
// assumes axis is normalized
|
|
481
|
+
|
|
482
|
+
this.quaternion.setFromAxisAngle( axis, angle );
|
|
483
|
+
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Sets the given rotation represented as Euler angles to the 3D object.
|
|
488
|
+
*
|
|
489
|
+
* @param {Euler} euler - The Euler angles.
|
|
490
|
+
*/
|
|
491
|
+
setRotationFromEuler( euler ) {
|
|
492
|
+
|
|
493
|
+
this.quaternion.setFromEuler( euler, true );
|
|
494
|
+
|
|
495
|
+
}
|
|
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
|
+
*/
|
|
503
|
+
setRotationFromMatrix( m ) {
|
|
504
|
+
|
|
505
|
+
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
506
|
+
|
|
507
|
+
this.quaternion.setFromRotationMatrix( m );
|
|
508
|
+
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Sets the given rotation represented as a Quaternion to the 3D object.
|
|
513
|
+
*
|
|
514
|
+
* @param {Quaternion} q - The Quaternion
|
|
515
|
+
*/
|
|
516
|
+
setRotationFromQuaternion( q ) {
|
|
517
|
+
|
|
518
|
+
// assumes q is normalized
|
|
519
|
+
|
|
520
|
+
this.quaternion.copy( q );
|
|
521
|
+
|
|
522
|
+
}
|
|
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
|
+
*/
|
|
531
|
+
rotateOnAxis( axis, angle ) {
|
|
532
|
+
|
|
533
|
+
// rotate object on axis in object space
|
|
534
|
+
// axis is assumed to be normalized
|
|
535
|
+
|
|
536
|
+
_q1.setFromAxisAngle( axis, angle );
|
|
537
|
+
|
|
538
|
+
this.quaternion.multiply( _q1 );
|
|
539
|
+
|
|
540
|
+
return this;
|
|
541
|
+
|
|
542
|
+
}
|
|
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
|
+
*/
|
|
551
|
+
rotateOnWorldAxis( axis, angle ) {
|
|
552
|
+
|
|
553
|
+
// rotate object on axis in world space
|
|
554
|
+
// axis is assumed to be normalized
|
|
555
|
+
// method assumes no rotated parent
|
|
556
|
+
|
|
557
|
+
_q1.setFromAxisAngle( axis, angle );
|
|
558
|
+
|
|
559
|
+
this.quaternion.premultiply( _q1 );
|
|
560
|
+
|
|
561
|
+
return this;
|
|
562
|
+
|
|
563
|
+
}
|
|
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
|
+
*/
|
|
571
|
+
rotateX( angle ) {
|
|
572
|
+
|
|
573
|
+
return this.rotateOnAxis( _xAxis, angle );
|
|
574
|
+
|
|
575
|
+
}
|
|
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
|
+
*/
|
|
583
|
+
rotateY( angle ) {
|
|
584
|
+
|
|
585
|
+
return this.rotateOnAxis( _yAxis, angle );
|
|
586
|
+
|
|
587
|
+
}
|
|
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
|
+
*/
|
|
595
|
+
rotateZ( angle ) {
|
|
596
|
+
|
|
597
|
+
return this.rotateOnAxis( _zAxis, angle );
|
|
598
|
+
|
|
599
|
+
}
|
|
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
|
+
*/
|
|
608
|
+
translateOnAxis( axis, distance ) {
|
|
609
|
+
|
|
610
|
+
// translate object by distance along axis in object space
|
|
611
|
+
// axis is assumed to be normalized
|
|
612
|
+
|
|
613
|
+
_v1.copy( axis ).applyQuaternion( this.quaternion );
|
|
614
|
+
|
|
615
|
+
this.position.add( _v1.multiplyScalar( distance ) );
|
|
616
|
+
|
|
617
|
+
return this;
|
|
618
|
+
|
|
619
|
+
}
|
|
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
|
+
*/
|
|
627
|
+
translateX( distance ) {
|
|
628
|
+
|
|
629
|
+
return this.translateOnAxis( _xAxis, distance );
|
|
630
|
+
|
|
631
|
+
}
|
|
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
|
+
*/
|
|
639
|
+
translateY( distance ) {
|
|
640
|
+
|
|
641
|
+
return this.translateOnAxis( _yAxis, distance );
|
|
642
|
+
|
|
643
|
+
}
|
|
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
|
+
*/
|
|
651
|
+
translateZ( distance ) {
|
|
652
|
+
|
|
653
|
+
return this.translateOnAxis( _zAxis, distance );
|
|
654
|
+
|
|
655
|
+
}
|
|
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
|
+
*/
|
|
663
|
+
localToWorld( vector ) {
|
|
664
|
+
|
|
665
|
+
this.updateWorldMatrix( true, false );
|
|
666
|
+
|
|
667
|
+
return vector.applyMatrix4( this.matrixWorld );
|
|
668
|
+
|
|
669
|
+
}
|
|
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
|
+
*/
|
|
677
|
+
worldToLocal( vector ) {
|
|
678
|
+
|
|
679
|
+
this.updateWorldMatrix( true, false );
|
|
680
|
+
|
|
681
|
+
return vector.applyMatrix4( _m1.copy( this.matrixWorld ).invert() );
|
|
682
|
+
|
|
683
|
+
}
|
|
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
|
+
*/
|
|
694
|
+
lookAt( x, y, z ) {
|
|
695
|
+
|
|
696
|
+
// This method does not support objects having non-uniformly-scaled parent(s)
|
|
697
|
+
|
|
698
|
+
if ( x.isVector3 ) {
|
|
699
|
+
|
|
700
|
+
_target.copy( x );
|
|
701
|
+
|
|
702
|
+
} else {
|
|
703
|
+
|
|
704
|
+
_target.set( x, y, z );
|
|
705
|
+
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
const parent = this.parent;
|
|
709
|
+
|
|
710
|
+
this.updateWorldMatrix( true, false );
|
|
711
|
+
|
|
712
|
+
_position.setFromMatrixPosition( this.matrixWorld );
|
|
713
|
+
|
|
714
|
+
if ( this.isCamera || this.isLight ) {
|
|
715
|
+
|
|
716
|
+
_m1.lookAt( _position, _target, this.up );
|
|
717
|
+
|
|
718
|
+
} else {
|
|
719
|
+
|
|
720
|
+
_m1.lookAt( _target, _position, this.up );
|
|
721
|
+
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
this.quaternion.setFromRotationMatrix( _m1 );
|
|
725
|
+
|
|
726
|
+
if ( parent ) {
|
|
727
|
+
|
|
728
|
+
_m1.extractRotation( parent.matrixWorld );
|
|
729
|
+
_q1.setFromRotationMatrix( _m1 );
|
|
730
|
+
this.quaternion.premultiply( _q1.invert() );
|
|
731
|
+
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
}
|
|
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
|
+
*/
|
|
746
|
+
add( object ) {
|
|
747
|
+
|
|
748
|
+
if ( arguments.length > 1 ) {
|
|
749
|
+
|
|
750
|
+
for ( let i = 0; i < arguments.length; i ++ ) {
|
|
751
|
+
|
|
752
|
+
this.add( arguments[ i ] );
|
|
753
|
+
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return this;
|
|
757
|
+
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if ( object === this ) {
|
|
761
|
+
|
|
762
|
+
error( 'Object3D.add: object can\'t be added as a child of itself.', object );
|
|
763
|
+
return this;
|
|
764
|
+
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if ( object && object.isObject3D ) {
|
|
768
|
+
|
|
769
|
+
object.removeFromParent();
|
|
770
|
+
object.parent = this;
|
|
771
|
+
this.children.push( object );
|
|
772
|
+
|
|
773
|
+
object.dispatchEvent( _addedEvent );
|
|
774
|
+
|
|
775
|
+
_childaddedEvent.child = object;
|
|
776
|
+
this.dispatchEvent( _childaddedEvent );
|
|
777
|
+
_childaddedEvent.child = null;
|
|
778
|
+
|
|
779
|
+
} else {
|
|
780
|
+
|
|
781
|
+
error( 'Object3D.add: object not an instance of THREE.Object3D.', object );
|
|
782
|
+
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
return this;
|
|
786
|
+
|
|
787
|
+
}
|
|
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
|
+
*/
|
|
798
|
+
remove( object ) {
|
|
799
|
+
|
|
800
|
+
if ( arguments.length > 1 ) {
|
|
801
|
+
|
|
802
|
+
for ( let i = 0; i < arguments.length; i ++ ) {
|
|
803
|
+
|
|
804
|
+
this.remove( arguments[ i ] );
|
|
805
|
+
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
return this;
|
|
809
|
+
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
const index = this.children.indexOf( object );
|
|
813
|
+
|
|
814
|
+
if ( index !== - 1 ) {
|
|
815
|
+
|
|
816
|
+
object.parent = null;
|
|
817
|
+
this.children.splice( index, 1 );
|
|
818
|
+
|
|
819
|
+
object.dispatchEvent( _removedEvent );
|
|
820
|
+
|
|
821
|
+
_childremovedEvent.child = object;
|
|
822
|
+
this.dispatchEvent( _childremovedEvent );
|
|
823
|
+
_childremovedEvent.child = null;
|
|
824
|
+
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return this;
|
|
828
|
+
|
|
829
|
+
}
|
|
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
|
+
*/
|
|
838
|
+
removeFromParent() {
|
|
839
|
+
|
|
840
|
+
const parent = this.parent;
|
|
841
|
+
|
|
842
|
+
if ( parent !== null ) {
|
|
843
|
+
|
|
844
|
+
parent.remove( this );
|
|
845
|
+
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
return this;
|
|
849
|
+
|
|
850
|
+
}
|
|
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
|
+
*/
|
|
859
|
+
clear() {
|
|
860
|
+
|
|
861
|
+
return this.remove( ... this.children );
|
|
862
|
+
|
|
863
|
+
}
|
|
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
|
+
*/
|
|
874
|
+
attach( object ) {
|
|
875
|
+
|
|
876
|
+
// adds object as a child of this, while maintaining the object's world transform
|
|
877
|
+
|
|
878
|
+
// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)
|
|
879
|
+
|
|
880
|
+
this.updateWorldMatrix( true, false );
|
|
881
|
+
|
|
882
|
+
_m1.copy( this.matrixWorld ).invert();
|
|
883
|
+
|
|
884
|
+
if ( object.parent !== null ) {
|
|
885
|
+
|
|
886
|
+
object.parent.updateWorldMatrix( true, false );
|
|
887
|
+
|
|
888
|
+
_m1.multiply( object.parent.matrixWorld );
|
|
889
|
+
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
object.applyMatrix4( _m1 );
|
|
893
|
+
|
|
894
|
+
object.removeFromParent();
|
|
895
|
+
object.parent = this;
|
|
896
|
+
this.children.push( object );
|
|
897
|
+
|
|
898
|
+
object.updateWorldMatrix( false, true );
|
|
899
|
+
|
|
900
|
+
object.dispatchEvent( _addedEvent );
|
|
901
|
+
|
|
902
|
+
_childaddedEvent.child = object;
|
|
903
|
+
this.dispatchEvent( _childaddedEvent );
|
|
904
|
+
_childaddedEvent.child = null;
|
|
905
|
+
|
|
906
|
+
return this;
|
|
907
|
+
|
|
908
|
+
}
|
|
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
|
+
*/
|
|
917
|
+
getObjectById( id ) {
|
|
918
|
+
|
|
919
|
+
return this.getObjectByProperty( 'id', id );
|
|
920
|
+
|
|
921
|
+
}
|
|
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
|
+
*/
|
|
930
|
+
getObjectByName( name ) {
|
|
931
|
+
|
|
932
|
+
return this.getObjectByProperty( 'name', name );
|
|
933
|
+
|
|
934
|
+
}
|
|
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
|
+
*/
|
|
944
|
+
getObjectByProperty( name, value ) {
|
|
945
|
+
|
|
946
|
+
if ( this[ name ] === value ) return this;
|
|
947
|
+
|
|
948
|
+
for ( let i = 0, l = this.children.length; i < l; i ++ ) {
|
|
949
|
+
|
|
950
|
+
const child = this.children[ i ];
|
|
951
|
+
const object = child.getObjectByProperty( name, value );
|
|
952
|
+
|
|
953
|
+
if ( object !== undefined ) {
|
|
954
|
+
|
|
955
|
+
return object;
|
|
956
|
+
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
return undefined;
|
|
962
|
+
|
|
963
|
+
}
|
|
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
|
+
*/
|
|
974
|
+
getObjectsByProperty( name, value, result = [] ) {
|
|
975
|
+
|
|
976
|
+
if ( this[ name ] === value ) result.push( this );
|
|
977
|
+
|
|
978
|
+
const children = this.children;
|
|
979
|
+
|
|
980
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
981
|
+
|
|
982
|
+
children[ i ].getObjectsByProperty( name, value, result );
|
|
983
|
+
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
return result;
|
|
987
|
+
|
|
988
|
+
}
|
|
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
|
+
*/
|
|
996
|
+
getWorldPosition( target ) {
|
|
997
|
+
|
|
998
|
+
this.updateWorldMatrix( true, false );
|
|
999
|
+
|
|
1000
|
+
return target.setFromMatrixPosition( this.matrixWorld );
|
|
1001
|
+
|
|
1002
|
+
}
|
|
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
|
+
*/
|
|
1010
|
+
getWorldQuaternion( target ) {
|
|
1011
|
+
|
|
1012
|
+
this.updateWorldMatrix( true, false );
|
|
1013
|
+
|
|
1014
|
+
this.matrixWorld.decompose( _position, target, _scale );
|
|
1015
|
+
|
|
1016
|
+
return target;
|
|
1017
|
+
|
|
1018
|
+
}
|
|
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
|
+
*/
|
|
1026
|
+
getWorldScale( target ) {
|
|
1027
|
+
|
|
1028
|
+
this.updateWorldMatrix( true, false );
|
|
1029
|
+
|
|
1030
|
+
this.matrixWorld.decompose( _position, _quaternion, target );
|
|
1031
|
+
|
|
1032
|
+
return target;
|
|
1033
|
+
|
|
1034
|
+
}
|
|
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
|
+
*/
|
|
1042
|
+
getWorldDirection( target ) {
|
|
1043
|
+
|
|
1044
|
+
this.updateWorldMatrix( true, false );
|
|
1045
|
+
|
|
1046
|
+
const e = this.matrixWorld.elements;
|
|
1047
|
+
|
|
1048
|
+
return target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();
|
|
1049
|
+
|
|
1050
|
+
}
|
|
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
|
+
*/
|
|
1061
|
+
raycast( /* raycaster, intersects */ ) {}
|
|
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
|
+
*/
|
|
1070
|
+
traverse( callback ) {
|
|
1071
|
+
|
|
1072
|
+
callback( this );
|
|
1073
|
+
|
|
1074
|
+
const children = this.children;
|
|
1075
|
+
|
|
1076
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
1077
|
+
|
|
1078
|
+
children[ i ].traverse( callback );
|
|
1079
|
+
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
}
|
|
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
|
+
*/
|
|
1092
|
+
traverseVisible( callback ) {
|
|
1093
|
+
|
|
1094
|
+
if ( this.visible === false ) return;
|
|
1095
|
+
|
|
1096
|
+
callback( this );
|
|
1097
|
+
|
|
1098
|
+
const children = this.children;
|
|
1099
|
+
|
|
1100
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
1101
|
+
|
|
1102
|
+
children[ i ].traverseVisible( callback );
|
|
1103
|
+
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
}
|
|
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
|
+
*/
|
|
1115
|
+
traverseAncestors( callback ) {
|
|
1116
|
+
|
|
1117
|
+
const parent = this.parent;
|
|
1118
|
+
|
|
1119
|
+
if ( parent !== null ) {
|
|
1120
|
+
|
|
1121
|
+
callback( parent );
|
|
1122
|
+
|
|
1123
|
+
parent.traverseAncestors( callback );
|
|
1124
|
+
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Updates the transformation matrix in local space by computing it from the current
|
|
1131
|
+
* position, rotation and scale values.
|
|
1132
|
+
*/
|
|
1133
|
+
updateMatrix() {
|
|
1134
|
+
|
|
1135
|
+
this.matrix.compose( this.position, this.quaternion, this.scale );
|
|
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
|
+
|
|
1150
|
+
this.matrixWorldNeedsUpdate = true;
|
|
1151
|
+
|
|
1152
|
+
}
|
|
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
|
+
*/
|
|
1165
|
+
updateMatrixWorld( force ) {
|
|
1166
|
+
|
|
1167
|
+
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
1168
|
+
|
|
1169
|
+
if ( this.matrixWorldNeedsUpdate || force ) {
|
|
1170
|
+
|
|
1171
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
1172
|
+
|
|
1173
|
+
if ( this.parent === null ) {
|
|
1174
|
+
|
|
1175
|
+
this.matrixWorld.copy( this.matrix );
|
|
1176
|
+
|
|
1177
|
+
} else {
|
|
1178
|
+
|
|
1179
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
1180
|
+
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
this.matrixWorldNeedsUpdate = false;
|
|
1186
|
+
|
|
1187
|
+
force = true;
|
|
1188
|
+
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// make sure descendants are updated if required
|
|
1192
|
+
|
|
1193
|
+
const children = this.children;
|
|
1194
|
+
|
|
1195
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
1196
|
+
|
|
1197
|
+
const child = children[ i ];
|
|
1198
|
+
|
|
1199
|
+
child.updateMatrixWorld( force );
|
|
1200
|
+
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
}
|
|
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
|
+
*/
|
|
1212
|
+
updateWorldMatrix( updateParents, updateChildren ) {
|
|
1213
|
+
|
|
1214
|
+
const parent = this.parent;
|
|
1215
|
+
|
|
1216
|
+
if ( updateParents === true && parent !== null ) {
|
|
1217
|
+
|
|
1218
|
+
parent.updateWorldMatrix( true, false );
|
|
1219
|
+
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
1223
|
+
|
|
1224
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
1225
|
+
|
|
1226
|
+
if ( this.parent === null ) {
|
|
1227
|
+
|
|
1228
|
+
this.matrixWorld.copy( this.matrix );
|
|
1229
|
+
|
|
1230
|
+
} else {
|
|
1231
|
+
|
|
1232
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
1233
|
+
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// make sure descendants are updated
|
|
1239
|
+
|
|
1240
|
+
if ( updateChildren === true ) {
|
|
1241
|
+
|
|
1242
|
+
const children = this.children;
|
|
1243
|
+
|
|
1244
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
1245
|
+
|
|
1246
|
+
const child = children[ i ];
|
|
1247
|
+
|
|
1248
|
+
child.updateWorldMatrix( false, true );
|
|
1249
|
+
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
}
|
|
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
|
+
*/
|
|
1263
|
+
toJSON( meta ) {
|
|
1264
|
+
|
|
1265
|
+
// meta is a string when called from JSON.stringify
|
|
1266
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
1267
|
+
|
|
1268
|
+
const output = {};
|
|
1269
|
+
|
|
1270
|
+
// meta is a hash used to collect geometries, materials.
|
|
1271
|
+
// not providing it implies that this is the root object
|
|
1272
|
+
// being serialized.
|
|
1273
|
+
if ( isRootObject ) {
|
|
1274
|
+
|
|
1275
|
+
// initialize meta obj
|
|
1276
|
+
meta = {
|
|
1277
|
+
geometries: {},
|
|
1278
|
+
materials: {},
|
|
1279
|
+
textures: {},
|
|
1280
|
+
images: {},
|
|
1281
|
+
shapes: {},
|
|
1282
|
+
skeletons: {},
|
|
1283
|
+
animations: {},
|
|
1284
|
+
nodes: {}
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
output.metadata = {
|
|
1288
|
+
version: 4.7,
|
|
1289
|
+
type: 'Object',
|
|
1290
|
+
generator: 'Object3D.toJSON'
|
|
1291
|
+
};
|
|
1292
|
+
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
// standard Object3D serialization
|
|
1296
|
+
|
|
1297
|
+
const object = {};
|
|
1298
|
+
|
|
1299
|
+
object.uuid = this.uuid;
|
|
1300
|
+
object.type = this.type;
|
|
1301
|
+
|
|
1302
|
+
if ( this.name !== '' ) object.name = this.name;
|
|
1303
|
+
if ( this.castShadow === true ) object.castShadow = true;
|
|
1304
|
+
if ( this.receiveShadow === true ) object.receiveShadow = true;
|
|
1305
|
+
if ( this.visible === false ) object.visible = false;
|
|
1306
|
+
if ( this.frustumCulled === false ) object.frustumCulled = false;
|
|
1307
|
+
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
|
|
1308
|
+
if ( this.static !== false ) object.static = this.static;
|
|
1309
|
+
if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
|
|
1310
|
+
|
|
1311
|
+
object.layers = this.layers.mask;
|
|
1312
|
+
object.matrix = this.matrix.toArray();
|
|
1313
|
+
object.up = this.up.toArray();
|
|
1314
|
+
|
|
1315
|
+
if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
|
|
1316
|
+
|
|
1317
|
+
if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
|
|
1318
|
+
|
|
1319
|
+
if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
|
|
1320
|
+
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();
|
|
1321
|
+
|
|
1322
|
+
// object specific properties
|
|
1323
|
+
|
|
1324
|
+
if ( this.isInstancedMesh ) {
|
|
1325
|
+
|
|
1326
|
+
object.type = 'InstancedMesh';
|
|
1327
|
+
object.count = this.count;
|
|
1328
|
+
object.instanceMatrix = this.instanceMatrix.toJSON();
|
|
1329
|
+
if ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();
|
|
1330
|
+
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
if ( this.isBatchedMesh ) {
|
|
1334
|
+
|
|
1335
|
+
object.type = 'BatchedMesh';
|
|
1336
|
+
object.perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
1337
|
+
object.sortObjects = this.sortObjects;
|
|
1338
|
+
|
|
1339
|
+
object.drawRanges = this._drawRanges;
|
|
1340
|
+
object.reservedRanges = this._reservedRanges;
|
|
1341
|
+
|
|
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
|
|
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;
|
|
1355
|
+
|
|
1356
|
+
object.maxInstanceCount = this._maxInstanceCount;
|
|
1357
|
+
object.maxVertexCount = this._maxVertexCount;
|
|
1358
|
+
object.maxIndexCount = this._maxIndexCount;
|
|
1359
|
+
|
|
1360
|
+
object.geometryInitialized = this._geometryInitialized;
|
|
1361
|
+
|
|
1362
|
+
object.matricesTexture = this._matricesTexture.toJSON( meta );
|
|
1363
|
+
|
|
1364
|
+
object.indirectTexture = this._indirectTexture.toJSON( meta );
|
|
1365
|
+
|
|
1366
|
+
if ( this._colorsTexture !== null ) {
|
|
1367
|
+
|
|
1368
|
+
object.colorsTexture = this._colorsTexture.toJSON( meta );
|
|
1369
|
+
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
if ( this.boundingSphere !== null ) {
|
|
1373
|
+
|
|
1374
|
+
object.boundingSphere = this.boundingSphere.toJSON();
|
|
1375
|
+
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
if ( this.boundingBox !== null ) {
|
|
1379
|
+
|
|
1380
|
+
object.boundingBox = this.boundingBox.toJSON();
|
|
1381
|
+
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
//
|
|
1387
|
+
|
|
1388
|
+
function serialize( library, element ) {
|
|
1389
|
+
|
|
1390
|
+
if ( library[ element.uuid ] === undefined ) {
|
|
1391
|
+
|
|
1392
|
+
library[ element.uuid ] = element.toJSON( meta );
|
|
1393
|
+
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
return element.uuid;
|
|
1397
|
+
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
if ( this.isScene ) {
|
|
1401
|
+
|
|
1402
|
+
if ( this.background ) {
|
|
1403
|
+
|
|
1404
|
+
if ( this.background.isColor ) {
|
|
1405
|
+
|
|
1406
|
+
object.background = this.background.toJSON();
|
|
1407
|
+
|
|
1408
|
+
} else if ( this.background.isTexture ) {
|
|
1409
|
+
|
|
1410
|
+
object.background = this.background.toJSON( meta ).uuid;
|
|
1411
|
+
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
if ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {
|
|
1417
|
+
|
|
1418
|
+
object.environment = this.environment.toJSON( meta ).uuid;
|
|
1419
|
+
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
} else if ( this.isMesh || this.isLine || this.isPoints ) {
|
|
1423
|
+
|
|
1424
|
+
object.geometry = serialize( meta.geometries, this.geometry );
|
|
1425
|
+
|
|
1426
|
+
const parameters = this.geometry.parameters;
|
|
1427
|
+
|
|
1428
|
+
if ( parameters !== undefined && parameters.shapes !== undefined ) {
|
|
1429
|
+
|
|
1430
|
+
const shapes = parameters.shapes;
|
|
1431
|
+
|
|
1432
|
+
if ( Array.isArray( shapes ) ) {
|
|
1433
|
+
|
|
1434
|
+
for ( let i = 0, l = shapes.length; i < l; i ++ ) {
|
|
1435
|
+
|
|
1436
|
+
const shape = shapes[ i ];
|
|
1437
|
+
|
|
1438
|
+
serialize( meta.shapes, shape );
|
|
1439
|
+
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
} else {
|
|
1443
|
+
|
|
1444
|
+
serialize( meta.shapes, shapes );
|
|
1445
|
+
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
if ( this.isSkinnedMesh ) {
|
|
1453
|
+
|
|
1454
|
+
object.bindMode = this.bindMode;
|
|
1455
|
+
object.bindMatrix = this.bindMatrix.toArray();
|
|
1456
|
+
|
|
1457
|
+
if ( this.skeleton !== undefined ) {
|
|
1458
|
+
|
|
1459
|
+
serialize( meta.skeletons, this.skeleton );
|
|
1460
|
+
|
|
1461
|
+
object.skeleton = this.skeleton.uuid;
|
|
1462
|
+
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
if ( this.material !== undefined ) {
|
|
1468
|
+
|
|
1469
|
+
if ( Array.isArray( this.material ) ) {
|
|
1470
|
+
|
|
1471
|
+
const uuids = [];
|
|
1472
|
+
|
|
1473
|
+
for ( let i = 0, l = this.material.length; i < l; i ++ ) {
|
|
1474
|
+
|
|
1475
|
+
uuids.push( serialize( meta.materials, this.material[ i ] ) );
|
|
1476
|
+
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
object.material = uuids;
|
|
1480
|
+
|
|
1481
|
+
} else {
|
|
1482
|
+
|
|
1483
|
+
object.material = serialize( meta.materials, this.material );
|
|
1484
|
+
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
//
|
|
1490
|
+
|
|
1491
|
+
if ( this.children.length > 0 ) {
|
|
1492
|
+
|
|
1493
|
+
object.children = [];
|
|
1494
|
+
|
|
1495
|
+
for ( let i = 0; i < this.children.length; i ++ ) {
|
|
1496
|
+
|
|
1497
|
+
object.children.push( this.children[ i ].toJSON( meta ).object );
|
|
1498
|
+
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
//
|
|
1504
|
+
|
|
1505
|
+
if ( this.animations.length > 0 ) {
|
|
1506
|
+
|
|
1507
|
+
object.animations = [];
|
|
1508
|
+
|
|
1509
|
+
for ( let i = 0; i < this.animations.length; i ++ ) {
|
|
1510
|
+
|
|
1511
|
+
const animation = this.animations[ i ];
|
|
1512
|
+
|
|
1513
|
+
object.animations.push( serialize( meta.animations, animation ) );
|
|
1514
|
+
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
if ( isRootObject ) {
|
|
1520
|
+
|
|
1521
|
+
const geometries = extractFromCache( meta.geometries );
|
|
1522
|
+
const materials = extractFromCache( meta.materials );
|
|
1523
|
+
const textures = extractFromCache( meta.textures );
|
|
1524
|
+
const images = extractFromCache( meta.images );
|
|
1525
|
+
const shapes = extractFromCache( meta.shapes );
|
|
1526
|
+
const skeletons = extractFromCache( meta.skeletons );
|
|
1527
|
+
const animations = extractFromCache( meta.animations );
|
|
1528
|
+
const nodes = extractFromCache( meta.nodes );
|
|
1529
|
+
|
|
1530
|
+
if ( geometries.length > 0 ) output.geometries = geometries;
|
|
1531
|
+
if ( materials.length > 0 ) output.materials = materials;
|
|
1532
|
+
if ( textures.length > 0 ) output.textures = textures;
|
|
1533
|
+
if ( images.length > 0 ) output.images = images;
|
|
1534
|
+
if ( shapes.length > 0 ) output.shapes = shapes;
|
|
1535
|
+
if ( skeletons.length > 0 ) output.skeletons = skeletons;
|
|
1536
|
+
if ( animations.length > 0 ) output.animations = animations;
|
|
1537
|
+
if ( nodes.length > 0 ) output.nodes = nodes;
|
|
1538
|
+
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
output.object = object;
|
|
1542
|
+
|
|
1543
|
+
return output;
|
|
1544
|
+
|
|
1545
|
+
// extract data from the cache hash
|
|
1546
|
+
// remove metadata on each item
|
|
1547
|
+
// and return as array
|
|
1548
|
+
function extractFromCache( cache ) {
|
|
1549
|
+
|
|
1550
|
+
const values = [];
|
|
1551
|
+
for ( const key in cache ) {
|
|
1552
|
+
|
|
1553
|
+
const data = cache[ key ];
|
|
1554
|
+
delete data.metadata;
|
|
1555
|
+
values.push( data );
|
|
1556
|
+
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
return values;
|
|
1560
|
+
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
}
|
|
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
|
+
*/
|
|
1571
|
+
clone( recursive ) {
|
|
1572
|
+
|
|
1573
|
+
return new this.constructor().copy( this, recursive );
|
|
1574
|
+
|
|
1575
|
+
}
|
|
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
|
+
*/
|
|
1584
|
+
copy( source, recursive = true ) {
|
|
1585
|
+
|
|
1586
|
+
this.name = source.name;
|
|
1587
|
+
|
|
1588
|
+
this.up.copy( source.up );
|
|
1589
|
+
|
|
1590
|
+
this.position.copy( source.position );
|
|
1591
|
+
this.rotation.order = source.rotation.order;
|
|
1592
|
+
this.quaternion.copy( source.quaternion );
|
|
1593
|
+
this.scale.copy( source.scale );
|
|
1594
|
+
|
|
1595
|
+
this.pivot = ( source.pivot !== null ) ? source.pivot.clone() : null;
|
|
1596
|
+
|
|
1597
|
+
this.matrix.copy( source.matrix );
|
|
1598
|
+
this.matrixWorld.copy( source.matrixWorld );
|
|
1599
|
+
|
|
1600
|
+
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
1601
|
+
|
|
1602
|
+
this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
|
|
1603
|
+
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
1604
|
+
|
|
1605
|
+
this.layers.mask = source.layers.mask;
|
|
1606
|
+
this.visible = source.visible;
|
|
1607
|
+
|
|
1608
|
+
this.castShadow = source.castShadow;
|
|
1609
|
+
this.receiveShadow = source.receiveShadow;
|
|
1610
|
+
|
|
1611
|
+
this.frustumCulled = source.frustumCulled;
|
|
1612
|
+
this.renderOrder = source.renderOrder;
|
|
1613
|
+
|
|
1614
|
+
this.static = source.static;
|
|
1615
|
+
|
|
1616
|
+
this.animations = source.animations.slice();
|
|
1617
|
+
|
|
1618
|
+
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
1619
|
+
|
|
1620
|
+
if ( recursive === true ) {
|
|
1621
|
+
|
|
1622
|
+
for ( let i = 0; i < source.children.length; i ++ ) {
|
|
1623
|
+
|
|
1624
|
+
const child = source.children[ i ];
|
|
1625
|
+
this.add( child.clone() );
|
|
1626
|
+
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
return this;
|
|
1632
|
+
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* The default up direction for objects, also used as the default
|
|
1639
|
+
* position for {@link DirectionalLight} and {@link HemisphereLight}.
|
|
1640
|
+
*
|
|
1641
|
+
* @static
|
|
1642
|
+
* @type {Vector3}
|
|
1643
|
+
* @default (0,1,0)
|
|
1644
|
+
*/
|
|
1645
|
+
Object3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* The default setting for {@link Object3D#matrixAutoUpdate} for
|
|
1649
|
+
* newly created 3D objects.
|
|
1650
|
+
*
|
|
1651
|
+
* @static
|
|
1652
|
+
* @type {boolean}
|
|
1653
|
+
* @default true
|
|
1654
|
+
*/
|
|
1655
|
+
Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* The default setting for {@link Object3D#matrixWorldAutoUpdate} for
|
|
1659
|
+
* newly created 3D objects.
|
|
1660
|
+
*
|
|
1661
|
+
* @static
|
|
1662
|
+
* @type {boolean}
|
|
1663
|
+
* @default true
|
|
1664
|
+
*/
|
|
1665
|
+
Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
|
|
1666
|
+
|
|
1667
|
+
export { Object3D };
|