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,8 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferGeometry,
|
|
3
3
|
FileLoader,
|
|
4
|
+
BufferAttribute,
|
|
4
5
|
Float32BufferAttribute,
|
|
6
|
+
Int8BufferAttribute,
|
|
7
|
+
Int16BufferAttribute,
|
|
8
|
+
Int32BufferAttribute,
|
|
5
9
|
Loader,
|
|
10
|
+
Uint8BufferAttribute,
|
|
11
|
+
Uint16BufferAttribute,
|
|
12
|
+
Uint32BufferAttribute,
|
|
6
13
|
Color,
|
|
7
14
|
SRGBColorSpace
|
|
8
15
|
} from 'three';
|
|
@@ -317,7 +324,8 @@ class PLYLoader extends Loader {
|
|
|
317
324
|
uvs: [],
|
|
318
325
|
faceVertexUvs: [],
|
|
319
326
|
colors: [],
|
|
320
|
-
faceVertexColors: []
|
|
327
|
+
faceVertexColors: [],
|
|
328
|
+
descriptors: {}
|
|
321
329
|
};
|
|
322
330
|
|
|
323
331
|
for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {
|
|
@@ -330,21 +338,52 @@ class PLYLoader extends Loader {
|
|
|
330
338
|
|
|
331
339
|
}
|
|
332
340
|
|
|
333
|
-
function mapElementAttributes( properties ) {
|
|
334
341
|
|
|
335
|
-
|
|
342
|
+
function getBufferAttributeClass( type ) {
|
|
336
343
|
|
|
337
|
-
|
|
344
|
+
switch ( type ) {
|
|
345
|
+
|
|
346
|
+
case 'int8': case 'char': return Int8BufferAttribute;
|
|
347
|
+
case 'uint8': case 'uchar': return Uint8BufferAttribute;
|
|
348
|
+
case 'int16': case 'short': return Int16BufferAttribute;
|
|
349
|
+
case 'uint16': case 'ushort': return Uint16BufferAttribute;
|
|
350
|
+
case 'int32': case 'int': return Int32BufferAttribute;
|
|
351
|
+
case 'uint32': case 'uint': return Uint32BufferAttribute;
|
|
352
|
+
case 'float32': case 'float': return Float32BufferAttribute;
|
|
353
|
+
case 'float64': case 'double': return Float64BufferAttribute;
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function getColorScale( type ) {
|
|
360
|
+
|
|
361
|
+
switch ( type ) {
|
|
362
|
+
|
|
363
|
+
case 'uchar': case 'uint8': return 1 / 255;
|
|
364
|
+
case 'ushort': case 'uint16': return 1 / 65535;
|
|
365
|
+
case 'float': case 'float32':
|
|
366
|
+
case 'double': case 'float64': return 1;
|
|
367
|
+
default: return 1 / 255;
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function isFloatType( type ) {
|
|
374
|
+
|
|
375
|
+
return type === 'float' || type === 'float32' || type === 'double' || type === 'float64';
|
|
338
376
|
|
|
339
|
-
|
|
377
|
+
}
|
|
340
378
|
|
|
341
|
-
|
|
379
|
+
function getAttributeDescriptor( properties ) {
|
|
342
380
|
|
|
343
|
-
|
|
381
|
+
function findProperty( names ) {
|
|
344
382
|
|
|
345
|
-
|
|
383
|
+
for ( const name of names ) {
|
|
346
384
|
|
|
347
|
-
|
|
385
|
+
const property = properties.find( p => p.name === name );
|
|
386
|
+
if ( property ) return property;
|
|
348
387
|
|
|
349
388
|
}
|
|
350
389
|
|
|
@@ -352,18 +391,67 @@ class PLYLoader extends Loader {
|
|
|
352
391
|
|
|
353
392
|
}
|
|
354
393
|
|
|
394
|
+
// property lookup
|
|
395
|
+
|
|
396
|
+
const x = findProperty( [ 'x', 'px', 'posx' ] );
|
|
397
|
+
const y = findProperty( [ 'y', 'py', 'posy' ] );
|
|
398
|
+
const z = findProperty( [ 'z', 'pz', 'posz' ] );
|
|
399
|
+
const nx = findProperty( [ 'nx', 'normalx' ] );
|
|
400
|
+
const ny = findProperty( [ 'ny', 'normaly' ] );
|
|
401
|
+
const nz = findProperty( [ 'nz', 'normalz' ] );
|
|
402
|
+
const s = findProperty( [ 's', 'u', 'texture_u', 'tx' ] );
|
|
403
|
+
const t = findProperty( [ 't', 'v', 'texture_v', 'ty' ] );
|
|
404
|
+
const r = findProperty( [ 'red', 'diffuse_red', 'r', 'diffuse_r' ] );
|
|
405
|
+
const g = findProperty( [ 'green', 'diffuse_green', 'g', 'diffuse_g' ] );
|
|
406
|
+
const b = findProperty( [ 'blue', 'diffuse_blue', 'b', 'diffuse_b' ] );
|
|
407
|
+
const texcoord = findProperty( [ 'texcoord' ] );
|
|
408
|
+
|
|
409
|
+
// custom property lookup
|
|
410
|
+
|
|
411
|
+
const custom = {};
|
|
412
|
+
|
|
413
|
+
for ( const customAttr of Object.keys( scope.customPropertyMapping ) ) {
|
|
414
|
+
|
|
415
|
+
const propNames = scope.customPropertyMapping[ customAttr ];
|
|
416
|
+
const matched = propNames.map( name => properties.find( p => p.name === name ) );
|
|
417
|
+
const types = matched.filter( p => p ).map( p => p.type );
|
|
418
|
+
const uniform = types.length > 0 && types.every( type => type === types[ 0 ] );
|
|
419
|
+
|
|
420
|
+
custom[ customAttr ] = {
|
|
421
|
+
type: uniform ? types[ 0 ] : 'float32',
|
|
422
|
+
usage: matched.every( p => p !== undefined ),
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// build descriptor
|
|
428
|
+
|
|
355
429
|
return {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
430
|
+
position: {
|
|
431
|
+
names: [ x ? x.name : 'x', y ? y.name : 'y', z ? z.name : 'z' ],
|
|
432
|
+
type: x ? x.type : 'float32',
|
|
433
|
+
usage: !! ( x && y && z ),
|
|
434
|
+
},
|
|
435
|
+
normal: {
|
|
436
|
+
names: [ nx ? nx.name : 'nx', ny ? ny.name : 'ny', nz ? nz.name : 'nz' ],
|
|
437
|
+
type: nx ? nx.type : 'float32',
|
|
438
|
+
usage: !! ( nx && ny && nz ),
|
|
439
|
+
},
|
|
440
|
+
uv: {
|
|
441
|
+
names: [ s ? s.name : 's', t ? t.name : 't' ],
|
|
442
|
+
type: s ? s.type : 'float32',
|
|
443
|
+
usage: !! ( s && t ),
|
|
444
|
+
},
|
|
445
|
+
texcoord: {
|
|
446
|
+
type: texcoord ? texcoord.itemType : 'float32',
|
|
447
|
+
usage: !! texcoord,
|
|
448
|
+
},
|
|
449
|
+
color: {
|
|
450
|
+
names: [ r ? r.name : 'red', g ? g.name : 'green', b ? b.name : 'blue' ],
|
|
451
|
+
type: r ? r.type : 'uchar',
|
|
452
|
+
usage: !! ( r && g && b ),
|
|
453
|
+
},
|
|
454
|
+
custom: custom,
|
|
367
455
|
};
|
|
368
456
|
|
|
369
457
|
}
|
|
@@ -392,7 +480,8 @@ class PLYLoader extends Loader {
|
|
|
392
480
|
loop: for ( let i = 0; i < header.elements.length; i ++ ) {
|
|
393
481
|
|
|
394
482
|
const elementDesc = header.elements[ i ];
|
|
395
|
-
const
|
|
483
|
+
const attributeDescriptor = getAttributeDescriptor( elementDesc.properties );
|
|
484
|
+
buffer.descriptors[ elementDesc.name ] = attributeDescriptor;
|
|
396
485
|
|
|
397
486
|
for ( let j = 0; j < elementDesc.count; j ++ ) {
|
|
398
487
|
|
|
@@ -400,7 +489,7 @@ class PLYLoader extends Loader {
|
|
|
400
489
|
|
|
401
490
|
if ( ! element ) break loop;
|
|
402
491
|
|
|
403
|
-
handleElement( buffer, elementDesc.name, element,
|
|
492
|
+
handleElement( buffer, elementDesc.name, element, attributeDescriptor );
|
|
404
493
|
|
|
405
494
|
}
|
|
406
495
|
|
|
@@ -414,6 +503,8 @@ class PLYLoader extends Loader {
|
|
|
414
503
|
|
|
415
504
|
let geometry = new BufferGeometry();
|
|
416
505
|
|
|
506
|
+
const vertexDescriptor = buffer.descriptors.vertex;
|
|
507
|
+
|
|
417
508
|
// mandatory buffer data
|
|
418
509
|
|
|
419
510
|
if ( buffer.indices.length > 0 ) {
|
|
@@ -422,25 +513,32 @@ class PLYLoader extends Loader {
|
|
|
422
513
|
|
|
423
514
|
}
|
|
424
515
|
|
|
425
|
-
|
|
516
|
+
const PositionClass = getBufferAttributeClass( vertexDescriptor ? vertexDescriptor.position.type : 'float32' );
|
|
517
|
+
geometry.setAttribute( 'position', new PositionClass( buffer.vertices, 3 ) );
|
|
426
518
|
|
|
427
519
|
// optional buffer data
|
|
428
520
|
|
|
429
521
|
if ( buffer.normals.length > 0 ) {
|
|
430
522
|
|
|
431
|
-
|
|
523
|
+
const NormalClass = getBufferAttributeClass( vertexDescriptor.normal.type );
|
|
524
|
+
geometry.setAttribute( 'normal', new NormalClass( buffer.normals, 3 ) );
|
|
432
525
|
|
|
433
526
|
}
|
|
434
527
|
|
|
435
528
|
if ( buffer.uvs.length > 0 ) {
|
|
436
529
|
|
|
437
|
-
|
|
530
|
+
const UvClass = getBufferAttributeClass( vertexDescriptor.uv.type );
|
|
531
|
+
geometry.setAttribute( 'uv', new UvClass( buffer.uvs, 2 ) );
|
|
438
532
|
|
|
439
533
|
}
|
|
440
534
|
|
|
441
535
|
if ( buffer.colors.length > 0 ) {
|
|
442
536
|
|
|
443
|
-
|
|
537
|
+
const colorType = vertexDescriptor.color.type;
|
|
538
|
+
const normalized = ! isFloatType( colorType );
|
|
539
|
+
|
|
540
|
+
const ColorClass = getBufferAttributeClass( colorType );
|
|
541
|
+
geometry.setAttribute( 'color', new ColorClass( buffer.colors, 3, normalized ) );
|
|
444
542
|
|
|
445
543
|
}
|
|
446
544
|
|
|
@@ -448,8 +546,22 @@ class PLYLoader extends Loader {
|
|
|
448
546
|
|
|
449
547
|
geometry = geometry.toNonIndexed();
|
|
450
548
|
|
|
451
|
-
if ( buffer.faceVertexUvs.length > 0 )
|
|
452
|
-
|
|
549
|
+
if ( buffer.faceVertexUvs.length > 0 ) {
|
|
550
|
+
|
|
551
|
+
const UvClass = getBufferAttributeClass( buffer.descriptors.face.texcoord.type );
|
|
552
|
+
geometry.setAttribute( 'uv', new UvClass( buffer.faceVertexUvs, 2 ) );
|
|
553
|
+
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if ( buffer.faceVertexColors.length > 0 ) {
|
|
557
|
+
|
|
558
|
+
const colorType = buffer.descriptors.face.color.type;
|
|
559
|
+
const normalized = ! isFloatType( colorType );
|
|
560
|
+
|
|
561
|
+
const ColorClass = getBufferAttributeClass( colorType );
|
|
562
|
+
geometry.setAttribute( 'color', new ColorClass( buffer.faceVertexColors, 3, normalized ) );
|
|
563
|
+
|
|
564
|
+
}
|
|
453
565
|
|
|
454
566
|
}
|
|
455
567
|
|
|
@@ -459,13 +571,8 @@ class PLYLoader extends Loader {
|
|
|
459
571
|
|
|
460
572
|
if ( buffer[ customProperty ].length > 0 ) {
|
|
461
573
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
new Float32BufferAttribute(
|
|
465
|
-
buffer[ customProperty ],
|
|
466
|
-
scope.customPropertyMapping[ customProperty ].length
|
|
467
|
-
)
|
|
468
|
-
);
|
|
574
|
+
const CustomClass = getBufferAttributeClass( vertexDescriptor.custom[ customProperty ].type );
|
|
575
|
+
geometry.setAttribute( customProperty, new CustomClass( buffer[ customProperty ], scope.customPropertyMapping[ customProperty ].length ) );
|
|
469
576
|
|
|
470
577
|
}
|
|
471
578
|
|
|
@@ -477,34 +584,64 @@ class PLYLoader extends Loader {
|
|
|
477
584
|
|
|
478
585
|
}
|
|
479
586
|
|
|
480
|
-
function handleElement( buffer, elementName, element,
|
|
587
|
+
function handleElement( buffer, elementName, element, attributeDescriptor ) {
|
|
481
588
|
|
|
482
589
|
if ( elementName === 'vertex' ) {
|
|
483
590
|
|
|
484
|
-
|
|
591
|
+
const { position, normal, uv, color } = attributeDescriptor;
|
|
592
|
+
|
|
593
|
+
if ( position.usage ) {
|
|
594
|
+
|
|
595
|
+
buffer.vertices.push(
|
|
596
|
+
element[ position.names[ 0 ] ],
|
|
597
|
+
element[ position.names[ 1 ] ],
|
|
598
|
+
element[ position.names[ 2 ] ]
|
|
599
|
+
);
|
|
600
|
+
|
|
601
|
+
}
|
|
485
602
|
|
|
486
|
-
if (
|
|
603
|
+
if ( normal.usage ) {
|
|
487
604
|
|
|
488
|
-
buffer.normals.push(
|
|
605
|
+
buffer.normals.push(
|
|
606
|
+
element[ normal.names[ 0 ] ],
|
|
607
|
+
element[ normal.names[ 1 ] ],
|
|
608
|
+
element[ normal.names[ 2 ] ]
|
|
609
|
+
);
|
|
489
610
|
|
|
490
611
|
}
|
|
491
612
|
|
|
492
|
-
if (
|
|
613
|
+
if ( uv.usage ) {
|
|
493
614
|
|
|
494
|
-
buffer.uvs.push(
|
|
615
|
+
buffer.uvs.push(
|
|
616
|
+
element[ uv.names[ 0 ] ],
|
|
617
|
+
element[ uv.names[ 1 ] ]
|
|
618
|
+
);
|
|
495
619
|
|
|
496
620
|
}
|
|
497
621
|
|
|
498
|
-
if (
|
|
622
|
+
if ( color.usage ) {
|
|
623
|
+
|
|
624
|
+
const scale = getColorScale( color.type );
|
|
625
|
+
const isFloat = isFloatType( color.type );
|
|
626
|
+
|
|
627
|
+
// convert to float for color space conversion
|
|
499
628
|
|
|
500
629
|
_color.setRGB(
|
|
501
|
-
element[
|
|
502
|
-
element[
|
|
503
|
-
element[
|
|
630
|
+
element[ color.names[ 0 ] ] * scale,
|
|
631
|
+
element[ color.names[ 1 ] ] * scale,
|
|
632
|
+
element[ color.names[ 2 ] ] * scale,
|
|
504
633
|
SRGBColorSpace
|
|
505
634
|
);
|
|
506
635
|
|
|
507
|
-
|
|
636
|
+
// convert back to original type
|
|
637
|
+
|
|
638
|
+
const invScale = 1 / scale;
|
|
639
|
+
|
|
640
|
+
buffer.colors.push(
|
|
641
|
+
isFloat ? _color.r : Math.round( _color.r * invScale ),
|
|
642
|
+
isFloat ? _color.g : Math.round( _color.g * invScale ),
|
|
643
|
+
isFloat ? _color.b : Math.round( _color.b * invScale )
|
|
644
|
+
);
|
|
508
645
|
|
|
509
646
|
}
|
|
510
647
|
|
|
@@ -544,17 +681,32 @@ class PLYLoader extends Loader {
|
|
|
544
681
|
|
|
545
682
|
// face colors
|
|
546
683
|
|
|
547
|
-
|
|
684
|
+
const { color } = attributeDescriptor;
|
|
685
|
+
|
|
686
|
+
if ( color.usage ) {
|
|
687
|
+
|
|
688
|
+
// convert to float for color space conversion
|
|
689
|
+
|
|
690
|
+
const scale = getColorScale( color.type );
|
|
548
691
|
|
|
549
692
|
_color.setRGB(
|
|
550
|
-
element[
|
|
551
|
-
element[
|
|
552
|
-
element[
|
|
693
|
+
element[ color.names[ 0 ] ] * scale,
|
|
694
|
+
element[ color.names[ 1 ] ] * scale,
|
|
695
|
+
element[ color.names[ 2 ] ] * scale,
|
|
553
696
|
SRGBColorSpace
|
|
554
697
|
);
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
698
|
+
|
|
699
|
+
// convert back to original type
|
|
700
|
+
|
|
701
|
+
const invScale = 1 / scale;
|
|
702
|
+
|
|
703
|
+
const r = _color.r * invScale;
|
|
704
|
+
const g = _color.g * invScale;
|
|
705
|
+
const b = _color.b * invScale;
|
|
706
|
+
|
|
707
|
+
buffer.faceVertexColors.push( r, g, b );
|
|
708
|
+
buffer.faceVertexColors.push( r, g, b );
|
|
709
|
+
buffer.faceVertexColors.push( r, g, b );
|
|
558
710
|
|
|
559
711
|
}
|
|
560
712
|
|
|
@@ -684,7 +836,8 @@ class PLYLoader extends Loader {
|
|
|
684
836
|
|
|
685
837
|
const elementDesc = header.elements[ currentElement ];
|
|
686
838
|
const properties = elementDesc.properties;
|
|
687
|
-
const
|
|
839
|
+
const attributeDescriptor = getAttributeDescriptor( properties );
|
|
840
|
+
buffer.descriptors[ elementDesc.name ] = attributeDescriptor;
|
|
688
841
|
|
|
689
842
|
setPropertyBinaryReaders( properties, body, little_endian );
|
|
690
843
|
|
|
@@ -694,7 +847,7 @@ class PLYLoader extends Loader {
|
|
|
694
847
|
loc += result[ 1 ];
|
|
695
848
|
const element = result[ 0 ];
|
|
696
849
|
|
|
697
|
-
handleElement( buffer, elementDesc.name, element,
|
|
850
|
+
handleElement( buffer, elementDesc.name, element, attributeDescriptor );
|
|
698
851
|
|
|
699
852
|
}
|
|
700
853
|
|
|
@@ -779,6 +932,16 @@ class PLYLoader extends Loader {
|
|
|
779
932
|
|
|
780
933
|
}
|
|
781
934
|
|
|
935
|
+
class Float64BufferAttribute extends BufferAttribute {
|
|
936
|
+
|
|
937
|
+
constructor( array, itemSize, normalized ) {
|
|
938
|
+
|
|
939
|
+
super( new Float64Array( array ), itemSize, normalized );
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
}
|
|
944
|
+
|
|
782
945
|
class ArrayStream {
|
|
783
946
|
|
|
784
947
|
constructor( arr ) {
|