super-three 0.184.0 → 0.185.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/build/three.cjs +1260 -927
- package/build/three.core.js +1104 -829
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +156 -98
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +11 -4
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +7538 -3367
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7538 -3366
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -0
- package/examples/jsm/controls/ArcballControls.js +6 -2
- package/examples/jsm/controls/FirstPersonControls.js +79 -42
- package/examples/jsm/controls/TransformControls.js +68 -15
- package/examples/jsm/csm/CSMFrustum.js +31 -6
- package/examples/jsm/csm/CSMShadowNode.js +4 -1
- package/examples/jsm/effects/AsciiEffect.js +14 -1
- package/examples/jsm/exporters/DRACOExporter.js +27 -6
- package/examples/jsm/exporters/GLTFExporter.js +114 -12
- package/examples/jsm/exporters/PLYExporter.js +286 -73
- package/examples/jsm/exporters/USDZExporter.js +347 -112
- package/examples/jsm/generators/CityGenerator.js +346 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.js +504 -0
- package/examples/jsm/generators/TreeGenerator.js +377 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +5 -4
- package/examples/jsm/helpers/ViewHelper.js +16 -6
- package/examples/jsm/inspector/Inspector.js +53 -15
- package/examples/jsm/inspector/RendererInspector.js +152 -36
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
- package/examples/jsm/inspector/tabs/Console.js +200 -18
- package/examples/jsm/inspector/tabs/Memory.js +8 -0
- package/examples/jsm/inspector/tabs/Parameters.js +64 -4
- package/examples/jsm/inspector/tabs/Performance.js +21 -6
- package/examples/jsm/inspector/tabs/Settings.js +51 -9
- package/examples/jsm/inspector/tabs/Timeline.js +178 -93
- package/examples/jsm/inspector/tabs/Viewer.js +628 -16
- package/examples/jsm/inspector/ui/Graph.js +162 -25
- package/examples/jsm/inspector/ui/Item.js +92 -13
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +90 -45
- package/examples/jsm/inspector/ui/Style.js +1788 -1401
- package/examples/jsm/inspector/ui/Tab.js +5 -3
- package/examples/jsm/inspector/ui/Values.js +71 -6
- package/examples/jsm/inspector/ui/utils.js +130 -10
- package/examples/jsm/libs/basis/README.md +0 -1
- package/examples/jsm/libs/demuxer_mp4.js +3 -3
- package/examples/jsm/libs/draco/README.md +0 -1
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.module.js +34 -9
- package/examples/jsm/lighting/ClusteredLighting.js +55 -0
- package/examples/jsm/lighting/LightProbeGrid.js +106 -76
- package/examples/jsm/lines/LineMaterial.js +38 -15
- package/examples/jsm/lines/LineSegments2.js +8 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +46 -13
- package/examples/jsm/loaders/EXRLoader.js +27 -55
- package/examples/jsm/loaders/HDRLoader.js +6 -28
- package/examples/jsm/loaders/KTX2Loader.js +31 -12
- package/examples/jsm/loaders/LDrawLoader.js +8 -8
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
- package/examples/jsm/loaders/LWOLoader.js +4 -0
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MaterialXLoader.js +31 -9
- package/examples/jsm/loaders/NRRDLoader.js +3 -3
- package/examples/jsm/loaders/PCDLoader.js +7 -7
- package/examples/jsm/loaders/PLYLoader.js +218 -55
- package/examples/jsm/loaders/SVGLoader.js +547 -495
- package/examples/jsm/loaders/TTFLoader.js +1 -1
- package/examples/jsm/loaders/USDLoader.js +33 -9
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +93 -20
- package/examples/jsm/loaders/usd/USDCParser.js +1 -1
- package/examples/jsm/loaders/usd/USDComposer.js +52 -19
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/Volume.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +1 -1
- package/examples/jsm/objects/Reflector.js +2 -3
- package/examples/jsm/objects/Water2Mesh.js +1 -1
- package/examples/jsm/physics/AmmoPhysics.js +15 -8
- package/examples/jsm/physics/RapierPhysics.js +27 -2
- package/examples/jsm/shaders/VolumeShader.js +31 -44
- package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
- package/examples/jsm/transpiler/Linker.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +59 -19
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +11 -12
- package/examples/jsm/tsl/display/GTAONode.js +34 -13
- package/examples/jsm/tsl/display/GodraysNode.js +1 -1
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
- package/examples/jsm/tsl/display/SSGINode.js +89 -39
- package/examples/jsm/tsl/display/SSRNode.js +829 -132
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
- package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
- package/examples/jsm/utils/SceneOptimizer.js +1 -1
- package/examples/jsm/webxr/ARButton.js +1 -1
- package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
- package/package.json +7 -7
- package/src/Three.TSL.js +10 -3
- package/src/Three.WebGPU.js +4 -0
- package/src/animation/AnimationAction.js +15 -11
- package/src/animation/AnimationClip.js +0 -139
- package/src/animation/KeyframeTrack.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/Camera.js +2 -2
- package/src/cameras/StereoCamera.js +5 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +29 -7
- package/src/core/Object3D.js +17 -7
- package/src/core/Raycaster.js +1 -1
- package/src/core/RenderTarget.js +15 -2
- package/src/extras/PMREMGenerator.js +6 -4
- package/src/extras/TextureUtils.js +1 -1
- package/src/extras/core/ShapePath.js +149 -160
- package/src/geometries/SphereGeometry.js +8 -3
- package/src/helpers/DirectionalLightHelper.js +2 -0
- package/src/helpers/HemisphereLightHelper.js +2 -0
- package/src/helpers/PointLightHelper.js +2 -0
- package/src/helpers/SpotLightHelper.js +1 -1
- package/src/loaders/DataTextureLoader.js +69 -38
- package/src/loaders/LoadingManager.js +5 -0
- package/src/loaders/MaterialLoader.js +36 -266
- package/src/loaders/ObjectLoader.js +3 -1
- package/src/materials/LineBasicMaterial.js +4 -0
- package/src/materials/Material.js +196 -1
- package/src/materials/MeshBasicMaterial.js +24 -0
- package/src/materials/MeshDepthMaterial.js +10 -0
- package/src/materials/MeshDistanceMaterial.js +10 -0
- package/src/materials/MeshLambertMaterial.js +40 -1
- package/src/materials/MeshMatcapMaterial.js +25 -1
- package/src/materials/MeshNormalMaterial.js +9 -1
- package/src/materials/MeshPhongMaterial.js +40 -1
- package/src/materials/MeshPhysicalMaterial.js +38 -0
- package/src/materials/MeshStandardMaterial.js +42 -1
- package/src/materials/MeshToonMaterial.js +34 -1
- package/src/materials/PointsMaterial.js +7 -0
- package/src/materials/ShaderMaterial.js +86 -0
- package/src/materials/SpriteMaterial.js +7 -0
- package/src/materials/nodes/Line2NodeMaterial.js +378 -322
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
- package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
- package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
- package/src/materials/nodes/NodeMaterial.js +115 -71
- package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
- package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
- package/src/math/Box3.js +5 -0
- package/src/math/FrustumArray.js +103 -133
- package/src/math/Interpolant.js +1 -1
- package/src/math/MathUtils.js +2 -2
- package/src/math/Matrix3.js +11 -0
- package/src/math/Matrix4.js +28 -3
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +2 -2
- package/src/math/Vector4.js +2 -2
- package/src/math/interpolants/BezierInterpolant.js +4 -6
- package/src/nodes/Nodes.js +2 -5
- package/src/nodes/TSL.js +8 -6
- package/src/nodes/accessors/Arrays.js +4 -4
- package/src/nodes/accessors/Batch.js +108 -0
- package/src/nodes/accessors/Bitangent.js +2 -2
- package/src/nodes/accessors/BufferAttributeNode.js +13 -2
- package/src/nodes/accessors/Camera.js +7 -7
- package/src/nodes/accessors/ClippingNode.js +1 -1
- package/src/nodes/accessors/Instance.js +264 -0
- package/src/nodes/accessors/MaterialNode.js +18 -2
- package/src/nodes/accessors/MaterialProperties.js +4 -3
- package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
- package/src/nodes/accessors/Normal.js +13 -13
- package/src/nodes/accessors/Position.js +5 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -0
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneProperties.js +1 -1
- package/src/nodes/accessors/Skinning.js +263 -0
- package/src/nodes/accessors/StorageBufferNode.js +2 -2
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.js +39 -7
- package/src/nodes/accessors/Tangent.js +4 -4
- package/src/nodes/accessors/TextureNode.js +60 -5
- package/src/nodes/code/FunctionNode.js +2 -16
- package/src/nodes/core/MRTNode.js +7 -2
- package/src/nodes/core/Node.js +39 -2
- package/src/nodes/core/NodeBuilder.js +201 -41
- package/src/nodes/core/NodeUtils.js +13 -13
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/OverrideContextNode.js +153 -0
- package/src/nodes/core/PropertyNode.js +51 -5
- package/src/nodes/core/StackNode.js +56 -34
- package/src/nodes/core/StructNode.js +4 -6
- package/src/nodes/core/StructTypeNode.js +6 -6
- package/src/nodes/core/VarNode.js +8 -0
- package/src/nodes/core/VaryingNode.js +12 -2
- package/src/nodes/display/BlendModes.js +1 -41
- package/src/nodes/display/BumpMapNode.js +6 -1
- package/src/nodes/display/ColorAdjustment.js +10 -9
- package/src/nodes/display/FrontFacingNode.js +38 -9
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +35 -43
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.js +12 -3
- package/src/nodes/functions/VolumetricLightingModel.js +40 -7
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/EnvironmentNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +40 -2
- package/src/nodes/lighting/LightingContextNode.js +10 -2
- package/src/nodes/lighting/LightsNode.js +90 -37
- package/src/nodes/lighting/PointShadowNode.js +6 -1
- package/src/nodes/lighting/ShadowFilterNode.js +21 -52
- package/src/nodes/lighting/ShadowNode.js +34 -14
- package/src/nodes/materialx/lib/mx_noise.js +2 -2
- package/src/nodes/math/ConditionalNode.js +3 -3
- package/src/nodes/math/MathNode.js +39 -11
- package/src/nodes/math/OperatorNode.js +23 -23
- package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
- package/src/nodes/pmrem/PMREMNode.js +33 -2
- package/src/nodes/tsl/TSLCore.js +63 -18
- package/src/nodes/utils/EquirectUV.js +30 -5
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/Packing.js +35 -4
- package/src/nodes/utils/RTTNode.js +40 -24
- package/src/nodes/utils/ReflectorNode.js +1 -0
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/objects/BatchedMesh.js +22 -14
- package/src/objects/InstancedMesh.js +0 -11
- package/src/objects/Skeleton.js +0 -9
- package/src/renderers/WebGLRenderer.js +19 -15
- package/src/renderers/common/Backend.js +49 -5
- package/src/renderers/common/Bindings.js +114 -45
- package/src/renderers/common/Buffer.js +9 -0
- package/src/renderers/common/ClippingContext.js +10 -2
- package/src/renderers/common/Info.js +63 -22
- package/src/renderers/common/Lighting.js +53 -5
- package/src/renderers/common/RenderList.js +41 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +281 -108
- package/src/renderers/common/Sampler.js +16 -48
- package/src/renderers/common/Textures.js +32 -5
- package/src/renderers/common/TimestampQueryPool.js +1 -1
- package/src/renderers/common/UniformsGroup.js +31 -9
- package/src/renderers/common/XRManager.js +340 -22
- package/src/renderers/common/extras/PMREMGenerator.js +15 -38
- package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
- package/src/renderers/common/nodes/NodeLibrary.js +4 -4
- package/src/renderers/common/nodes/NodeManager.js +63 -14
- package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
- package/src/renderers/webgl/WebGLOutput.js +2 -1
- package/src/renderers/webgl/WebGLProgram.js +5 -4
- package/src/renderers/webgl/WebGLPrograms.js +12 -5
- package/src/renderers/webgl/WebGLRenderLists.js +9 -1
- package/src/renderers/webgl/WebGLShaderCache.js +5 -11
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
- package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
- package/src/renderers/webgpu/WebGPUBackend.js +480 -169
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
- package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
- package/src/textures/DepthTexture.js +1 -1
- package/src/textures/ExternalTexture.js +0 -3
- package/examples/fonts/LICENSE +0 -13
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
- package/examples/fonts/README.md +0 -11
- package/examples/fonts/droid/NOTICE +0 -190
- package/examples/fonts/droid/README.txt +0 -18
- package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
- package/examples/fonts/gentilis_bold.typeface.json +0 -1
- package/examples/fonts/gentilis_regular.typeface.json +0 -1
- package/examples/fonts/helvetiker_bold.typeface.json +0 -1
- package/examples/fonts/helvetiker_regular.typeface.json +0 -1
- package/examples/fonts/optimer_bold.typeface.json +0 -1
- package/examples/fonts/optimer_regular.typeface.json +0 -1
- package/examples/fonts/ttf/README.md +0 -9
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/inspector/extensions/extensions.json +0 -6
- package/examples/jsm/libs/ammo.wasm.js +0 -822
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
- package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
- package/examples/jsm/libs/opentype.module.js +0 -14506
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lighting/TiledLighting.js +0 -42
- package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
- package/src/nodes/accessors/BatchNode.js +0 -163
- package/src/nodes/accessors/InstanceNode.js +0 -349
- package/src/nodes/accessors/InstancedMeshNode.js +0 -50
- package/src/nodes/accessors/SkinningNode.js +0 -328
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FileLoader,
|
|
3
|
-
Loader
|
|
3
|
+
Loader,
|
|
4
|
+
LoaderUtils
|
|
4
5
|
} from 'three';
|
|
5
6
|
|
|
6
7
|
import { unzipSync } from '../libs/fflate.module.js';
|
|
@@ -49,6 +50,8 @@ class USDLoader extends Loader {
|
|
|
49
50
|
|
|
50
51
|
const scope = this;
|
|
51
52
|
|
|
53
|
+
const path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
|
|
54
|
+
|
|
52
55
|
const loader = new FileLoader( scope.manager );
|
|
53
56
|
loader.setPath( scope.path );
|
|
54
57
|
loader.setResponseType( 'arraybuffer' );
|
|
@@ -58,7 +61,7 @@ class USDLoader extends Loader {
|
|
|
58
61
|
|
|
59
62
|
try {
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
scope.parse( text, path, onLoad, onError );
|
|
62
65
|
|
|
63
66
|
} catch ( e ) {
|
|
64
67
|
|
|
@@ -83,10 +86,17 @@ class USDLoader extends Loader {
|
|
|
83
86
|
/**
|
|
84
87
|
* Parses the given USDZ data and returns the resulting group.
|
|
85
88
|
*
|
|
89
|
+
* The returned group is created synchronously, but any referenced textures
|
|
90
|
+
* are loaded asynchronously. Provide `onLoad` to be notified once all
|
|
91
|
+
* textures have finished loading.
|
|
92
|
+
*
|
|
86
93
|
* @param {ArrayBuffer|string} buffer - The raw USDZ data as an array buffer.
|
|
94
|
+
* @param {string} [path=''] - The URL base path.
|
|
95
|
+
* @param {function(Group)} [onLoad] - Executed once the group and all of its textures are ready.
|
|
96
|
+
* @param {onErrorCallback} [onError] - Executed when errors occur.
|
|
87
97
|
* @return {Group} The parsed asset as a group.
|
|
88
98
|
*/
|
|
89
|
-
parse( buffer ) {
|
|
99
|
+
parse( buffer, path = '', onLoad, onError ) {
|
|
90
100
|
|
|
91
101
|
const usda = new USDAParser();
|
|
92
102
|
const usdc = new USDCParser();
|
|
@@ -217,13 +227,27 @@ class USDLoader extends Loader {
|
|
|
217
227
|
|
|
218
228
|
const scope = this;
|
|
219
229
|
|
|
230
|
+
const finalize = ( composer, group ) => {
|
|
231
|
+
|
|
232
|
+
if ( onLoad ) {
|
|
233
|
+
|
|
234
|
+
Promise.all( composer.texturePromises )
|
|
235
|
+
.then( () => onLoad( group ) )
|
|
236
|
+
.catch( ( err ) => onError ? onError( err ) : console.error( err ) );
|
|
237
|
+
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return group;
|
|
241
|
+
|
|
242
|
+
};
|
|
243
|
+
|
|
220
244
|
// USDA (standalone)
|
|
221
245
|
|
|
222
246
|
if ( typeof buffer === 'string' ) {
|
|
223
247
|
|
|
224
248
|
const composer = new USDComposer( scope.manager );
|
|
225
249
|
const data = usda.parseData( buffer );
|
|
226
|
-
return composer.compose( data, {} );
|
|
250
|
+
return finalize( composer, composer.compose( data, {}, {}, path ) );
|
|
227
251
|
|
|
228
252
|
}
|
|
229
253
|
|
|
@@ -233,7 +257,7 @@ class USDLoader extends Loader {
|
|
|
233
257
|
|
|
234
258
|
const composer = new USDComposer( scope.manager );
|
|
235
259
|
const data = usdc.parseData( toArrayBuffer( buffer ) );
|
|
236
|
-
return composer.compose( data, {} );
|
|
260
|
+
return finalize( composer, composer.compose( data, {}, {}, path ) );
|
|
237
261
|
|
|
238
262
|
}
|
|
239
263
|
|
|
@@ -249,7 +273,7 @@ class USDLoader extends Loader {
|
|
|
249
273
|
|
|
250
274
|
if ( ! file ) {
|
|
251
275
|
|
|
252
|
-
throw new Error( 'USDLoader: Invalid USDZ package. The first ZIP entry must be a USD layer (.usd/.usda/.usdc).' );
|
|
276
|
+
throw new Error( 'THREE.USDLoader: Invalid USDZ package. The first ZIP entry must be a USD layer (.usd/.usda/.usdc).' );
|
|
253
277
|
|
|
254
278
|
}
|
|
255
279
|
|
|
@@ -257,11 +281,11 @@ class USDLoader extends Loader {
|
|
|
257
281
|
const data = assets[ filename ];
|
|
258
282
|
if ( ! data ) {
|
|
259
283
|
|
|
260
|
-
throw new Error( 'USDLoader: Failed to parse root layer "' + filename + '".' );
|
|
284
|
+
throw new Error( 'THREE.USDLoader: Failed to parse root layer "' + filename + '".' );
|
|
261
285
|
|
|
262
286
|
}
|
|
263
287
|
|
|
264
|
-
return composer.compose( data, assets, {}, basePath );
|
|
288
|
+
return finalize( composer, composer.compose( data, assets, {}, basePath ) );
|
|
265
289
|
|
|
266
290
|
}
|
|
267
291
|
|
|
@@ -270,7 +294,7 @@ class USDLoader extends Loader {
|
|
|
270
294
|
const composer = new USDComposer( scope.manager );
|
|
271
295
|
const text = textDecoder.decode( bytes );
|
|
272
296
|
const data = usda.parseData( text );
|
|
273
|
-
return composer.compose( data, {} );
|
|
297
|
+
return finalize( composer, composer.compose( data, {}, {}, path ) );
|
|
274
298
|
|
|
275
299
|
}
|
|
276
300
|
|
|
@@ -220,7 +220,7 @@ class VRMLLoader extends Loader {
|
|
|
220
220
|
|
|
221
221
|
//
|
|
222
222
|
|
|
223
|
-
const StringLiteral = createToken( { name: 'StringLiteral', pattern: /"(?:[^\\"
|
|
223
|
+
const StringLiteral = createToken( { name: 'StringLiteral', pattern: /"(?:[^\\"]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/ } );
|
|
224
224
|
const HexLiteral = createToken( { name: 'HexLiteral', pattern: /0[xX][0-9a-fA-F]+/ } );
|
|
225
225
|
const NumberLiteral = createToken( { name: 'NumberLiteral', pattern: /[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/ } );
|
|
226
226
|
const TrueLiteral = createToken( { name: 'TrueLiteral', pattern: /TRUE/ } );
|
|
@@ -3,6 +3,13 @@ const DEF_MATCH_REGEX = /^def\s+(?:(\w+)\s+)?"?([^"]+)"?$/;
|
|
|
3
3
|
const VARIANT_STRING_REGEX = /^string\s+(\w+)$/;
|
|
4
4
|
const ATTR_MATCH_REGEX = /^(?:uniform\s+)?(\w+(?:\[\])?)\s+(.+)$/;
|
|
5
5
|
|
|
6
|
+
// Spec types (must match USDCParser/USDComposer)
|
|
7
|
+
const SpecType = {
|
|
8
|
+
Attribute: 1,
|
|
9
|
+
Prim: 6,
|
|
10
|
+
Relationship: 8
|
|
11
|
+
};
|
|
12
|
+
|
|
6
13
|
class USDAParser {
|
|
7
14
|
|
|
8
15
|
parseText( text ) {
|
|
@@ -78,6 +85,8 @@ class USDAParser {
|
|
|
78
85
|
|
|
79
86
|
} else if ( line.endsWith( '{' ) ) {
|
|
80
87
|
|
|
88
|
+
string = line.slice( 0, - 1 ).trim() || string;
|
|
89
|
+
|
|
81
90
|
const group = target[ string ] || {};
|
|
82
91
|
stack.push( group );
|
|
83
92
|
|
|
@@ -429,13 +438,6 @@ class USDAParser {
|
|
|
429
438
|
const root = this.parseText( text );
|
|
430
439
|
const specsByPath = {};
|
|
431
440
|
|
|
432
|
-
// Spec types (must match USDCParser/USDComposer)
|
|
433
|
-
const SpecType = {
|
|
434
|
-
Attribute: 1,
|
|
435
|
-
Prim: 6,
|
|
436
|
-
Relationship: 8
|
|
437
|
-
};
|
|
438
|
-
|
|
439
441
|
// Parse root metadata
|
|
440
442
|
const rootFields = {};
|
|
441
443
|
if ( '#usda 1.0' in root ) {
|
|
@@ -460,6 +462,18 @@ class USDAParser {
|
|
|
460
462
|
|
|
461
463
|
}
|
|
462
464
|
|
|
465
|
+
if ( header.framesPerSecond !== undefined ) {
|
|
466
|
+
|
|
467
|
+
rootFields.framesPerSecond = parseFloat( header.framesPerSecond );
|
|
468
|
+
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if ( header.timeCodesPerSecond !== undefined ) {
|
|
472
|
+
|
|
473
|
+
rootFields.timeCodesPerSecond = parseFloat( header.timeCodesPerSecond );
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
|
|
463
477
|
}
|
|
464
478
|
|
|
465
479
|
specsByPath[ '/' ] = { specType: SpecType.Prim, fields: rootFields };
|
|
@@ -512,10 +526,45 @@ class USDAParser {
|
|
|
512
526
|
|
|
513
527
|
walkTree( root, '/' );
|
|
514
528
|
|
|
529
|
+
// Fallback: infer elementSize for primvars:skel:jointIndices/jointWeights
|
|
530
|
+
// when not explicitly declared in the USDA text
|
|
531
|
+
this._inferSkelElementSize( specsByPath );
|
|
532
|
+
|
|
515
533
|
return { specsByPath };
|
|
516
534
|
|
|
517
535
|
}
|
|
518
536
|
|
|
537
|
+
_inferSkelElementSize( specsByPath ) {
|
|
538
|
+
|
|
539
|
+
// For each mesh prim with primvars:skel:jointIndices/jointWeights but no
|
|
540
|
+
// elementSize, infer it from the data: elementSize = array.length / numVertices.
|
|
541
|
+
for ( const path in specsByPath ) {
|
|
542
|
+
|
|
543
|
+
const spec = specsByPath[ path ];
|
|
544
|
+
if ( spec.specType !== SpecType.Prim || spec.fields.typeName !== 'Mesh' ) continue;
|
|
545
|
+
|
|
546
|
+
const pointsSpec = specsByPath[ path + '.points' ];
|
|
547
|
+
if ( ! pointsSpec || ! pointsSpec.fields.default ) continue;
|
|
548
|
+
|
|
549
|
+
const numVertices = pointsSpec.fields.default.length / 3;
|
|
550
|
+
if ( numVertices === 0 ) continue;
|
|
551
|
+
|
|
552
|
+
this._inferElementSize( specsByPath[ path + '.primvars:skel:jointIndices' ], numVertices );
|
|
553
|
+
this._inferElementSize( specsByPath[ path + '.primvars:skel:jointWeights' ], numVertices );
|
|
554
|
+
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
_inferElementSize( attrSpec, numVertices ) {
|
|
560
|
+
|
|
561
|
+
if ( ! attrSpec || attrSpec.fields.elementSize !== undefined || ! attrSpec.fields.default ) return;
|
|
562
|
+
|
|
563
|
+
const len = attrSpec.fields.default.length;
|
|
564
|
+
if ( len > 0 && len % numVertices === 0 ) attrSpec.fields.elementSize = len / numVertices;
|
|
565
|
+
|
|
566
|
+
}
|
|
567
|
+
|
|
519
568
|
_extractPrimData( data, path, primFields, specsByPath, SpecType ) {
|
|
520
569
|
|
|
521
570
|
if ( ! data || typeof data !== 'object' ) return;
|
|
@@ -663,12 +712,23 @@ class USDAParser {
|
|
|
663
712
|
// Parse value based on type
|
|
664
713
|
const parsedValue = this._parseAttributeValue( valueType, rawValue );
|
|
665
714
|
|
|
666
|
-
// Store as attribute spec
|
|
715
|
+
// Store as attribute spec, preserving any existing fields
|
|
716
|
+
// (e.g. connectionPaths set by an earlier `.connect` form)
|
|
667
717
|
const attrPath = path + '.' + attrName;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
718
|
+
|
|
719
|
+
if ( specsByPath[ attrPath ] ) {
|
|
720
|
+
|
|
721
|
+
specsByPath[ attrPath ].fields.default = parsedValue;
|
|
722
|
+
specsByPath[ attrPath ].fields.typeName = valueType;
|
|
723
|
+
|
|
724
|
+
} else {
|
|
725
|
+
|
|
726
|
+
specsByPath[ attrPath ] = {
|
|
727
|
+
specType: SpecType.Attribute,
|
|
728
|
+
fields: { default: parsedValue, typeName: valueType }
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
}
|
|
672
732
|
|
|
673
733
|
}
|
|
674
734
|
|
|
@@ -687,6 +747,8 @@ class USDAParser {
|
|
|
687
747
|
// Array types
|
|
688
748
|
if ( valueType.endsWith( '[]' ) ) {
|
|
689
749
|
|
|
750
|
+
let result;
|
|
751
|
+
|
|
690
752
|
// Parse JSON-like arrays
|
|
691
753
|
try {
|
|
692
754
|
|
|
@@ -697,19 +759,13 @@ class USDAParser {
|
|
|
697
759
|
const parsed = JSON.parse( cleaned );
|
|
698
760
|
|
|
699
761
|
// Flatten nested arrays for types like point3f[]
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return parsed.flat();
|
|
703
|
-
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
return parsed;
|
|
762
|
+
result = Array.isArray( parsed ) && Array.isArray( parsed[ 0 ] ) ? parsed.flat() : parsed;
|
|
707
763
|
|
|
708
764
|
} catch ( e ) {
|
|
709
765
|
|
|
710
766
|
// Try simple array parsing
|
|
711
767
|
const cleaned = str.replace( /[\[\]]/g, '' );
|
|
712
|
-
|
|
768
|
+
result = cleaned.split( ',' ).map( s => {
|
|
713
769
|
|
|
714
770
|
const trimmed = s.trim();
|
|
715
771
|
const num = parseFloat( trimmed );
|
|
@@ -719,6 +775,23 @@ class USDAParser {
|
|
|
719
775
|
|
|
720
776
|
}
|
|
721
777
|
|
|
778
|
+
//reorder (w, x, y, z) to (x, y, z, w)
|
|
779
|
+
if ( valueType.startsWith( 'quat' ) ) {
|
|
780
|
+
|
|
781
|
+
for ( let i = 0; i < result.length; i += 4 ) {
|
|
782
|
+
|
|
783
|
+
const w = result[ i ];
|
|
784
|
+
result[ i ] = result[ i + 1 ];
|
|
785
|
+
result[ i + 1 ] = result[ i + 2 ];
|
|
786
|
+
result[ i + 2 ] = result[ i + 3 ];
|
|
787
|
+
result[ i + 3 ] = w;
|
|
788
|
+
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return result;
|
|
794
|
+
|
|
722
795
|
}
|
|
723
796
|
|
|
724
797
|
// Vector types (double3, float3, point3f, etc.)
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
DirectionalLight,
|
|
12
12
|
Euler,
|
|
13
13
|
Group,
|
|
14
|
+
LoaderUtils,
|
|
14
15
|
Matrix4,
|
|
15
16
|
Mesh,
|
|
16
17
|
MeshPhysicalMaterial,
|
|
@@ -83,6 +84,7 @@ class USDComposer {
|
|
|
83
84
|
this.textureCache = {};
|
|
84
85
|
this.skinnedMeshes = [];
|
|
85
86
|
this.manager = manager;
|
|
87
|
+
this.texturePromises = [];
|
|
86
88
|
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -102,6 +104,7 @@ class USDComposer {
|
|
|
102
104
|
this.basePath = basePath;
|
|
103
105
|
this.skinnedMeshes = [];
|
|
104
106
|
this.skeletons = {};
|
|
107
|
+
this.texturePromises = [];
|
|
105
108
|
|
|
106
109
|
// Build indexes for O(1) lookups
|
|
107
110
|
this._buildIndexes();
|
|
@@ -109,7 +112,7 @@ class USDComposer {
|
|
|
109
112
|
// Get FPS from root spec
|
|
110
113
|
const rootSpec = this.specsByPath[ '/' ];
|
|
111
114
|
const rootFields = rootSpec ? rootSpec.fields : {};
|
|
112
|
-
this.fps = rootFields.
|
|
115
|
+
this.fps = rootFields.timeCodesPerSecond || rootFields.framesPerSecond || 24;
|
|
113
116
|
|
|
114
117
|
const group = new Group();
|
|
115
118
|
this._buildHierarchy( group, '/' );
|
|
@@ -852,14 +855,13 @@ class USDComposer {
|
|
|
852
855
|
|
|
853
856
|
}
|
|
854
857
|
|
|
855
|
-
|
|
856
|
-
if ( this.basePath ) {
|
|
858
|
+
if ( ! this.basePath ) return cleanPath;
|
|
857
859
|
|
|
858
|
-
|
|
860
|
+
// LoaderUtils.resolveURL expects basePath to end with a separator;
|
|
861
|
+
// the USDZ flow passes the zip-internal directory name without one.
|
|
862
|
+
const base = this.basePath.endsWith( '/' ) ? this.basePath : this.basePath + '/';
|
|
859
863
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return cleanPath;
|
|
864
|
+
return LoaderUtils.resolveURL( cleanPath, base );
|
|
863
865
|
|
|
864
866
|
}
|
|
865
867
|
|
|
@@ -3817,6 +3819,16 @@ class USDComposer {
|
|
|
3817
3819
|
|
|
3818
3820
|
}
|
|
3819
3821
|
|
|
3822
|
+
// Standalone .usd/.usda/.usdc files don't pre-load assets; treat the
|
|
3823
|
+
// resolved path as a URL relative to basePath so the browser fetches
|
|
3824
|
+
// the texture from disk next to the layer.
|
|
3825
|
+
|
|
3826
|
+
if ( this.basePath ) {
|
|
3827
|
+
|
|
3828
|
+
return this._createTextureFromData( resolvedPath, textureAttrs, transformAttrs );
|
|
3829
|
+
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3820
3832
|
// Try loading via LoadingManager if available
|
|
3821
3833
|
if ( this.manager ) {
|
|
3822
3834
|
|
|
@@ -3864,27 +3876,48 @@ class USDComposer {
|
|
|
3864
3876
|
}
|
|
3865
3877
|
|
|
3866
3878
|
const image = new Image();
|
|
3867
|
-
image.onload = function () {
|
|
3868
3879
|
|
|
3869
|
-
|
|
3880
|
+
this.texturePromises.push( new Promise( ( resolve ) => {
|
|
3870
3881
|
|
|
3871
|
-
|
|
3882
|
+
image.onload = function () {
|
|
3872
3883
|
|
|
3873
|
-
texture.
|
|
3874
|
-
texture.wrapT = scope._getWrapMode( textureAttrs[ 'inputs:wrapT' ] );
|
|
3884
|
+
texture.image = image;
|
|
3875
3885
|
|
|
3876
|
-
|
|
3886
|
+
if ( textureAttrs ) {
|
|
3877
3887
|
|
|
3878
|
-
|
|
3879
|
-
|
|
3888
|
+
texture.wrapS = scope._getWrapMode( textureAttrs[ 'inputs:wrapS' ] );
|
|
3889
|
+
texture.wrapT = scope._getWrapMode( textureAttrs[ 'inputs:wrapT' ] );
|
|
3880
3890
|
|
|
3881
|
-
|
|
3891
|
+
}
|
|
3882
3892
|
|
|
3883
|
-
|
|
3893
|
+
scope._applyTextureTransforms( texture, transformAttrs );
|
|
3894
|
+
texture.needsUpdate = true;
|
|
3884
3895
|
|
|
3885
|
-
|
|
3896
|
+
if ( typeof data !== 'string' ) {
|
|
3886
3897
|
|
|
3887
|
-
|
|
3898
|
+
URL.revokeObjectURL( url );
|
|
3899
|
+
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
resolve();
|
|
3903
|
+
|
|
3904
|
+
};
|
|
3905
|
+
|
|
3906
|
+
image.onerror = function () {
|
|
3907
|
+
|
|
3908
|
+
console.warn( 'USDLoader: Failed to load texture:', url );
|
|
3909
|
+
|
|
3910
|
+
if ( typeof data !== 'string' ) {
|
|
3911
|
+
|
|
3912
|
+
URL.revokeObjectURL( url );
|
|
3913
|
+
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
resolve();
|
|
3917
|
+
|
|
3918
|
+
};
|
|
3919
|
+
|
|
3920
|
+
} ) );
|
|
3888
3921
|
|
|
3889
3922
|
image.src = url;
|
|
3890
3923
|
|