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
|
@@ -117,12 +117,37 @@ export let wasm;
|
|
|
117
117
|
|
|
118
118
|
export let isReady = false;
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
let readyPromise = null;
|
|
121
|
+
|
|
122
|
+
function initialize() {
|
|
123
|
+
|
|
124
|
+
return fetch( wasmDataURI )
|
|
125
|
+
.then( ( res ) => res.arrayBuffer() )
|
|
126
|
+
.then( ( buffer ) => WebAssembly.instantiate( buffer, {
|
|
127
|
+
'./mikktspace_module_bg.js': { __wbindgen_string_new, __wbindgen_rethrow }
|
|
128
|
+
} ) )
|
|
129
|
+
.then( ( result ) => {
|
|
130
|
+
|
|
131
|
+
wasm = result.instance.exports;
|
|
132
|
+
isReady = true;
|
|
133
|
+
|
|
134
|
+
} );
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const ready = {
|
|
139
|
+
then: function ( onFulfilled, onRejected ) {
|
|
140
|
+
|
|
141
|
+
if ( readyPromise === null ) readyPromise = initialize();
|
|
142
|
+
return readyPromise.then( onFulfilled, onRejected );
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export function dispose() {
|
|
148
|
+
|
|
149
|
+
wasm = null;
|
|
150
|
+
isReady = false;
|
|
151
|
+
readyPromise = null;
|
|
152
|
+
|
|
153
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Lighting } from 'three/webgpu';
|
|
2
|
+
import ClusteredLightsNode from '../tsl/lighting/ClusteredLightsNode.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom lighting implementation based on Forward+ Clustered Shading that
|
|
6
|
+
* overwrites the default lighting system in {@link WebGPURenderer}. Suitable
|
|
7
|
+
* for 3D scenes with many point lights and real depth complexity — the view
|
|
8
|
+
* frustum is partitioned into a 3D cluster grid so only the lights actually
|
|
9
|
+
* reaching each fragment are evaluated.
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* const lighting = new ClusteredLighting();
|
|
13
|
+
* renderer.lighting = lighting; // set lighting system
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @augments Lighting
|
|
17
|
+
* @three_import import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js';
|
|
18
|
+
*/
|
|
19
|
+
export class ClusteredLighting extends Lighting {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new clustered lighting system.
|
|
23
|
+
*
|
|
24
|
+
* @param {number} [maxLights=1024] - Maximum number of point lights.
|
|
25
|
+
* @param {number} [tileSize=32] - Screen tile size in pixels (cluster XY size).
|
|
26
|
+
* @param {number} [zSlices=24] - Number of exponential depth slices.
|
|
27
|
+
* @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity.
|
|
28
|
+
*/
|
|
29
|
+
constructor( maxLights = 1024, tileSize = 32, zSlices = 24, maxLightsPerCluster = 64 ) {
|
|
30
|
+
|
|
31
|
+
super();
|
|
32
|
+
|
|
33
|
+
this.maxLights = maxLights;
|
|
34
|
+
this.tileSize = tileSize;
|
|
35
|
+
this.zSlices = zSlices;
|
|
36
|
+
this.maxLightsPerCluster = maxLightsPerCluster;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new clustered lights node for the given array of lights.
|
|
42
|
+
*
|
|
43
|
+
* This method is called internally by the renderer and must be overwritten by
|
|
44
|
+
* all custom lighting implementations.
|
|
45
|
+
*
|
|
46
|
+
* @param {Array<Light>} lights - The lights.
|
|
47
|
+
* @return {ClusteredLightsNode} The clustered lights node.
|
|
48
|
+
*/
|
|
49
|
+
createNode( lights = [] ) {
|
|
50
|
+
|
|
51
|
+
return new ClusteredLightsNode( this.maxLights, this.tileSize, this.zSlices, this.maxLightsPerCluster ).setLights( lights );
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
@@ -45,8 +45,8 @@ let _batchTargetProbes = 0;
|
|
|
45
45
|
// Reusable temp objects
|
|
46
46
|
const _position = /*@__PURE__*/ new Vector3();
|
|
47
47
|
const _size = /*@__PURE__*/ new Vector3();
|
|
48
|
-
const
|
|
49
|
-
const
|
|
48
|
+
const _currentViewport = /*@__PURE__*/ new Vector4();
|
|
49
|
+
const _currentScissor = /*@__PURE__*/ new Vector4();
|
|
50
50
|
|
|
51
51
|
// Number of padding texels added at each boundary of every sub-volume in the atlas.
|
|
52
52
|
const ATLAS_PADDING = 1;
|
|
@@ -55,6 +55,9 @@ const ATLAS_PADDING = 1;
|
|
|
55
55
|
* A 3D grid of L2 Spherical Harmonic irradiance probes that provides
|
|
56
56
|
* position-dependent diffuse global illumination.
|
|
57
57
|
*
|
|
58
|
+
* Note that this class can only be used with {@link WebGLRenderer}.
|
|
59
|
+
* A version for {@link WebGPURenderer} will be added at a later point.
|
|
60
|
+
*
|
|
58
61
|
* All seven packed SH sub-volumes are stored in a **single** RGBA
|
|
59
62
|
* `WebGL3DRenderTarget` using a texture-atlas layout along the Z axis.
|
|
60
63
|
* Each sub-volume occupies `( nz + 2 )` atlas slices: one padding slice at
|
|
@@ -202,7 +205,10 @@ class LightProbeGrid extends Object3D {
|
|
|
202
205
|
|
|
203
206
|
/**
|
|
204
207
|
* Bakes all probes by rendering cubemaps at each probe position
|
|
205
|
-
* and projecting to L2 SH.
|
|
208
|
+
* and projecting to L2 SH. Optionally iterates additional passes to
|
|
209
|
+
* capture indirect bounces — each extra pass samples the previous pass's
|
|
210
|
+
* atlas as indirect light, so a grid added to the scene before baking
|
|
211
|
+
* accumulates one bounce per extra pass.
|
|
206
212
|
*
|
|
207
213
|
* @param {WebGLRenderer} renderer - The renderer.
|
|
208
214
|
* @param {Scene} scene - The scene to render.
|
|
@@ -210,17 +216,16 @@ class LightProbeGrid extends Object3D {
|
|
|
210
216
|
* @param {number} [options.cubemapSize=8] - Resolution of each cubemap face.
|
|
211
217
|
* @param {number} [options.near=0.1] - Near plane for the cube camera.
|
|
212
218
|
* @param {number} [options.far=100] - Far plane for the cube camera.
|
|
219
|
+
* @param {number} [options.bounces=0] - Additional bounce passes after the initial direct pass.
|
|
213
220
|
*/
|
|
214
221
|
bake( renderer, scene, options = {} ) {
|
|
215
222
|
|
|
223
|
+
const { bounces = 0 } = options;
|
|
216
224
|
const { cubeRenderTarget, cubeCamera } = _ensureBakeResources( options );
|
|
217
225
|
|
|
218
226
|
this._ensureTextures();
|
|
219
227
|
this.updateBoundingBox();
|
|
220
228
|
|
|
221
|
-
// Prevent feedback: temporarily hide the volume during baking
|
|
222
|
-
this.visible = false;
|
|
223
|
-
|
|
224
229
|
const res = this.resolution;
|
|
225
230
|
const totalProbes = res.x * res.y * res.z;
|
|
226
231
|
|
|
@@ -228,109 +233,134 @@ class LightProbeGrid extends Object3D {
|
|
|
228
233
|
const batchTarget = _ensureBatchTarget( totalProbes );
|
|
229
234
|
|
|
230
235
|
// Save renderer state
|
|
231
|
-
const
|
|
232
|
-
renderer.getViewport(
|
|
233
|
-
renderer.getScissor(
|
|
234
|
-
const
|
|
236
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
237
|
+
renderer.getViewport( _currentViewport );
|
|
238
|
+
renderer.getScissor( _currentScissor );
|
|
239
|
+
const currentScissorTest = renderer.getScissorTest();
|
|
235
240
|
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
renderer.setRenderTarget( batchTarget );
|
|
240
|
-
renderer.clear();
|
|
241
|
+
// Scene is static across the bake — update once and disable per-render auto updates.
|
|
242
|
+
const currentMatrixWorldAutoUpdate = scene.matrixWorldAutoUpdate;
|
|
243
|
+
if ( currentMatrixWorldAutoUpdate === true ) {
|
|
241
244
|
|
|
242
|
-
|
|
245
|
+
scene.updateMatrixWorld( true );
|
|
246
|
+
scene.matrixWorldAutoUpdate = false;
|
|
243
247
|
|
|
244
|
-
|
|
245
|
-
// Note: set viewport/scissor on the render target directly to avoid pixel ratio scaling
|
|
246
|
-
batchTarget.scissorTest = true;
|
|
248
|
+
}
|
|
247
249
|
|
|
248
|
-
// Disable shadow map auto-update
|
|
249
|
-
// Force
|
|
250
|
-
const
|
|
250
|
+
// Disable shadow map auto-update across all passes — lights don't move.
|
|
251
|
+
// Force a single shadow update on the first render so maps are initialized.
|
|
252
|
+
const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;
|
|
251
253
|
renderer.shadowMap.autoUpdate = false;
|
|
252
254
|
renderer.shadowMap.needsUpdate = true;
|
|
253
255
|
|
|
254
|
-
|
|
256
|
+
_ensureRepackResources();
|
|
255
257
|
|
|
256
|
-
|
|
258
|
+
const paddedSlices = res.z + 2 * ATLAS_PADDING;
|
|
259
|
+
const rt = this._renderTarget;
|
|
257
260
|
|
|
258
|
-
|
|
261
|
+
// const t0 = performance.now();
|
|
259
262
|
|
|
260
|
-
|
|
263
|
+
// Pass 0 captures direct light only (grid hidden, so probesSH is not sampled
|
|
264
|
+
// — the atlas at this point may be uninitialized or hold a prior bake).
|
|
265
|
+
// Each subsequent pass keeps the grid visible so the cube cameras read the
|
|
266
|
+
// previous pass's atlas as indirect light, accumulating one bounce per pass.
|
|
267
|
+
// Phase 1 writes to the batch target and Phase 2 only swaps it into the atlas
|
|
268
|
+
// at the very end of each pass, which gives an implicit ping-pong for free.
|
|
261
269
|
|
|
262
|
-
|
|
263
|
-
cubeCamera.position.copy( _position );
|
|
264
|
-
cubeCamera.update( renderer, scene );
|
|
270
|
+
for ( let pass = 0; pass <= bounces; pass ++ ) {
|
|
265
271
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
this.visible = pass > 0;
|
|
273
|
+
|
|
274
|
+
// Clear pooled batch target so skipped probes read as zero
|
|
275
|
+
batchTarget.scissorTest = false;
|
|
276
|
+
batchTarget.viewport.set( 0, 0, 9, totalProbes );
|
|
277
|
+
renderer.setRenderTarget( batchTarget );
|
|
278
|
+
renderer.clear();
|
|
279
|
+
|
|
280
|
+
// Phase 1: Render cubemaps and project to SH into batch target
|
|
281
|
+
// Note: set viewport/scissor on the render target directly to avoid pixel ratio scaling
|
|
282
|
+
batchTarget.scissorTest = true;
|
|
283
|
+
|
|
284
|
+
for ( let iz = 0; iz < res.z; iz ++ ) {
|
|
285
|
+
|
|
286
|
+
for ( let iy = 0; iy < res.y; iy ++ ) {
|
|
287
|
+
|
|
288
|
+
for ( let ix = 0; ix < res.x; ix ++ ) {
|
|
289
|
+
|
|
290
|
+
const probeIndex = ix + iy * res.x + iz * res.x * res.y;
|
|
291
|
+
|
|
292
|
+
this.getProbePosition( ix, iy, iz, _position );
|
|
293
|
+
cubeCamera.position.copy( _position );
|
|
294
|
+
cubeCamera.update( renderer, scene );
|
|
295
|
+
|
|
296
|
+
// SH projection
|
|
297
|
+
_shMaterial.uniforms.envMap.value = cubeRenderTarget.texture;
|
|
298
|
+
_mesh.material = _shMaterial;
|
|
299
|
+
batchTarget.viewport.set( 0, probeIndex, 9, 1 );
|
|
300
|
+
batchTarget.scissor.set( 0, probeIndex, 9, 1 );
|
|
301
|
+
renderer.setRenderTarget( batchTarget );
|
|
302
|
+
renderer.render( _scene, _camera );
|
|
303
|
+
|
|
304
|
+
}
|
|
273
305
|
|
|
274
306
|
}
|
|
275
307
|
|
|
276
308
|
}
|
|
277
309
|
|
|
278
|
-
|
|
310
|
+
// Phase 2: Repack SH data from batch target into the atlas 3D texture (GPU-to-GPU).
|
|
311
|
+
//
|
|
312
|
+
// For each of the 7 packed sub-volumes (texture index t) we write:
|
|
313
|
+
// - A leading padding slice (copy of data slice iz = 0)
|
|
314
|
+
// - All nz data slices (iz = 0 … nz-1)
|
|
315
|
+
// - A trailing padding slice (copy of data slice iz = nz-1)
|
|
316
|
+
//
|
|
317
|
+
// In the atlas the slices for sub-volume t occupy the range:
|
|
318
|
+
// [ t * paddedSlices, t * paddedSlices + paddedSlices - 1 ]
|
|
319
|
+
// where paddedSlices = nz + 2 * ATLAS_PADDING.
|
|
279
320
|
|
|
280
|
-
|
|
321
|
+
rt.scissorTest = false;
|
|
322
|
+
rt.viewport.set( 0, 0, res.x, res.y );
|
|
281
323
|
|
|
282
|
-
|
|
283
|
-
//
|
|
284
|
-
// For each of the 7 packed sub-volumes (texture index t) we write:
|
|
285
|
-
// - A leading padding slice (copy of data slice iz = 0)
|
|
286
|
-
// - All nz data slices (iz = 0 … nz-1)
|
|
287
|
-
// - A trailing padding slice (copy of data slice iz = nz-1)
|
|
288
|
-
//
|
|
289
|
-
// In the atlas the slices for sub-volume t occupy the range:
|
|
290
|
-
// [ t * paddedSlices, t * paddedSlices + paddedSlices - 1 ]
|
|
291
|
-
// where paddedSlices = nz + 2 * ATLAS_PADDING.
|
|
324
|
+
for ( let t = 0; t < 7; t ++ ) {
|
|
292
325
|
|
|
293
|
-
|
|
326
|
+
_repackMaterials[ t ].uniforms.batchTexture.value = batchTarget.texture;
|
|
327
|
+
_repackMaterials[ t ].uniforms.resolution.value.copy( res );
|
|
294
328
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
rt.scissorTest = false;
|
|
298
|
-
rt.viewport.set( 0, 0, res.x, res.y );
|
|
329
|
+
// Write data slices
|
|
330
|
+
for ( let iz = 0; iz < res.z; iz ++ ) {
|
|
299
331
|
|
|
300
|
-
|
|
332
|
+
_repackMaterials[ t ].uniforms.sliceZ.value = iz;
|
|
333
|
+
_mesh.material = _repackMaterials[ t ];
|
|
334
|
+
renderer.setRenderTarget( rt, t * paddedSlices + ATLAS_PADDING + iz );
|
|
335
|
+
renderer.render( _scene, _camera );
|
|
301
336
|
|
|
302
|
-
|
|
303
|
-
_repackMaterials[ t ].uniforms.resolution.value.copy( res );
|
|
337
|
+
}
|
|
304
338
|
|
|
305
|
-
|
|
306
|
-
|
|
339
|
+
// Leading padding: copy of data slice iz = 0
|
|
340
|
+
_repackMaterials[ t ].uniforms.sliceZ.value = 0;
|
|
341
|
+
_mesh.material = _repackMaterials[ t ];
|
|
342
|
+
renderer.setRenderTarget( rt, t * paddedSlices );
|
|
343
|
+
renderer.render( _scene, _camera );
|
|
307
344
|
|
|
308
|
-
|
|
345
|
+
// Trailing padding: copy of data slice iz = nz - 1
|
|
346
|
+
_repackMaterials[ t ].uniforms.sliceZ.value = res.z - 1;
|
|
309
347
|
_mesh.material = _repackMaterials[ t ];
|
|
310
|
-
renderer.setRenderTarget( rt, t * paddedSlices + ATLAS_PADDING +
|
|
348
|
+
renderer.setRenderTarget( rt, t * paddedSlices + ATLAS_PADDING + res.z );
|
|
311
349
|
renderer.render( _scene, _camera );
|
|
312
350
|
|
|
313
351
|
}
|
|
314
352
|
|
|
315
|
-
// Leading padding: copy of data slice iz = 0
|
|
316
|
-
_repackMaterials[ t ].uniforms.sliceZ.value = 0;
|
|
317
|
-
_mesh.material = _repackMaterials[ t ];
|
|
318
|
-
renderer.setRenderTarget( rt, t * paddedSlices );
|
|
319
|
-
renderer.render( _scene, _camera );
|
|
320
|
-
|
|
321
|
-
// Trailing padding: copy of data slice iz = nz - 1
|
|
322
|
-
_repackMaterials[ t ].uniforms.sliceZ.value = res.z - 1;
|
|
323
|
-
_mesh.material = _repackMaterials[ t ];
|
|
324
|
-
renderer.setRenderTarget( rt, t * paddedSlices + ATLAS_PADDING + res.z );
|
|
325
|
-
renderer.render( _scene, _camera );
|
|
326
|
-
|
|
327
353
|
}
|
|
328
354
|
|
|
355
|
+
renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;
|
|
356
|
+
|
|
329
357
|
// Restore renderer state
|
|
330
|
-
renderer.setRenderTarget(
|
|
331
|
-
renderer.setViewport(
|
|
332
|
-
renderer.setScissor(
|
|
333
|
-
renderer.setScissorTest(
|
|
358
|
+
renderer.setRenderTarget( currentRenderTarget );
|
|
359
|
+
renderer.setViewport( _currentViewport );
|
|
360
|
+
renderer.setScissor( _currentScissor );
|
|
361
|
+
renderer.setScissorTest( currentScissorTest );
|
|
362
|
+
|
|
363
|
+
scene.matrixWorldAutoUpdate = currentMatrixWorldAutoUpdate;
|
|
334
364
|
|
|
335
365
|
// console.log( `LightProbeGrid: bake complete ${ ( performance.now() - t0 ).toFixed( 1 ) }ms` );
|
|
336
366
|
|
|
@@ -10,7 +10,7 @@ UniformsLib.line = {
|
|
|
10
10
|
|
|
11
11
|
worldUnits: { value: 1 },
|
|
12
12
|
linewidth: { value: 1 },
|
|
13
|
-
resolution: { value: new Vector2(
|
|
13
|
+
resolution: { value: new Vector2() },
|
|
14
14
|
dashOffset: { value: 0 },
|
|
15
15
|
dashScale: { value: 1 },
|
|
16
16
|
dashSize: { value: 1 },
|
|
@@ -70,18 +70,20 @@ ShaderLib[ 'line' ] = {
|
|
|
70
70
|
|
|
71
71
|
#endif
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {
|
|
74
74
|
|
|
75
|
-
//
|
|
75
|
+
// compute the interpolation factor needed to trim the segment so it terminates
|
|
76
|
+
// between the camera plane and the near plane
|
|
76
77
|
|
|
77
78
|
// conservative estimate of the near plane
|
|
78
79
|
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
79
80
|
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
80
|
-
float nearEstimate = - 0.5 * b / a;
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
// we need different nearEstimate formula for reversed and default depth buffer
|
|
83
|
+
// a is positive with a reversed depth buffer so it can be used for controlling the code flow
|
|
84
|
+
float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
return ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
85
87
|
|
|
86
88
|
}
|
|
87
89
|
|
|
@@ -93,19 +95,19 @@ ShaderLib[ 'line' ] = {
|
|
|
93
95
|
|
|
94
96
|
#endif
|
|
95
97
|
|
|
96
|
-
#ifdef USE_DASH
|
|
97
|
-
|
|
98
|
-
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
99
|
-
vUv = uv;
|
|
100
|
-
|
|
101
|
-
#endif
|
|
102
|
-
|
|
103
98
|
float aspect = resolution.x / resolution.y;
|
|
104
99
|
|
|
105
100
|
// camera space
|
|
106
101
|
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
107
102
|
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
108
103
|
|
|
104
|
+
#ifdef USE_DASH
|
|
105
|
+
|
|
106
|
+
float lineDistanceStart = dashScale * instanceDistanceStart;
|
|
107
|
+
float lineDistanceEnd = dashScale * instanceDistanceEnd;
|
|
108
|
+
|
|
109
|
+
#endif
|
|
110
|
+
|
|
109
111
|
#ifdef WORLD_UNITS
|
|
110
112
|
|
|
111
113
|
worldStart = start.xyz;
|
|
@@ -128,16 +130,37 @@ ShaderLib[ 'line' ] = {
|
|
|
128
130
|
|
|
129
131
|
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
float alpha = trimSegmentAlpha( start, end );
|
|
134
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
135
|
+
|
|
136
|
+
#ifdef USE_DASH
|
|
137
|
+
|
|
138
|
+
lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );
|
|
139
|
+
|
|
140
|
+
#endif
|
|
132
141
|
|
|
133
142
|
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
134
143
|
|
|
135
|
-
|
|
144
|
+
float alpha = trimSegmentAlpha( end, start );
|
|
145
|
+
start.xyz = mix( end.xyz, start.xyz, alpha );
|
|
146
|
+
|
|
147
|
+
#ifdef USE_DASH
|
|
148
|
+
|
|
149
|
+
lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );
|
|
150
|
+
|
|
151
|
+
#endif
|
|
136
152
|
|
|
137
153
|
}
|
|
138
154
|
|
|
139
155
|
}
|
|
140
156
|
|
|
157
|
+
#ifdef USE_DASH
|
|
158
|
+
|
|
159
|
+
vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;
|
|
160
|
+
vUv = uv;
|
|
161
|
+
|
|
162
|
+
#endif
|
|
163
|
+
|
|
141
164
|
// clip space
|
|
142
165
|
vec4 clipStart = projectionMatrix * start;
|
|
143
166
|
vec4 clipEnd = projectionMatrix * end;
|
|
@@ -326,6 +326,14 @@ class LineSegments2 extends Mesh {
|
|
|
326
326
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
// early out if no resolution has been set (line was not rendered yet)
|
|
330
|
+
|
|
331
|
+
if ( worldUnits === false && ( this.material.resolution.x === 0 || this.material.resolution.y === 0 ) ) {
|
|
332
|
+
|
|
333
|
+
return;
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
|
|
329
337
|
const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
|
|
330
338
|
|
|
331
339
|
_ray = raycaster.ray;
|
|
@@ -324,6 +324,14 @@ class LineSegments2 extends Mesh {
|
|
|
324
324
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
// early out if no resolution has been set (line was not rendered yet)
|
|
328
|
+
|
|
329
|
+
if ( worldUnits === false && ( this._resolution.x === 0 || this._resolution.y === 0 ) ) {
|
|
330
|
+
|
|
331
|
+
return;
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
327
335
|
const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
|
|
328
336
|
|
|
329
337
|
_ray = raycaster.ray;
|
|
@@ -42,7 +42,7 @@ const _taskCache = new WeakMap();
|
|
|
42
42
|
*
|
|
43
43
|
* ```js
|
|
44
44
|
* const loader = new Rhino3dmLoader();
|
|
45
|
-
* loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0
|
|
45
|
+
* loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.17.0/' );
|
|
46
46
|
*
|
|
47
47
|
* const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' );
|
|
48
48
|
* scene.add( object );
|
|
@@ -8,11 +8,21 @@ import {
|
|
|
8
8
|
LinearSRGBColorSpace,
|
|
9
9
|
SRGBColorSpace,
|
|
10
10
|
InterleavedBuffer,
|
|
11
|
-
InterleavedBufferAttribute
|
|
11
|
+
InterleavedBufferAttribute,
|
|
12
|
+
LoaderUtils
|
|
12
13
|
} from 'three';
|
|
13
14
|
|
|
14
15
|
const _taskCache = new WeakMap();
|
|
15
16
|
|
|
17
|
+
const WASM_BIN_URL = new URL( '../libs/draco/draco_decoder.wasm', import.meta.url ).toString();
|
|
18
|
+
const WASM_JS_URL = new URL( '../libs/draco/draco_wasm_wrapper.js', import.meta.url ).toString();
|
|
19
|
+
const JS_URL = new URL( '../libs/draco/draco_decoder.js', import.meta.url ).toString();
|
|
20
|
+
|
|
21
|
+
const DRACO_GLTF_CONFIG = {
|
|
22
|
+
js: new URL( '../libs/draco/gltf/draco_wasm_wrapper.js', import.meta.url ).toString(),
|
|
23
|
+
wasm: new URL( '../libs/draco/gltf/draco_decoder.wasm', import.meta.url ).toString(),
|
|
24
|
+
};
|
|
25
|
+
|
|
16
26
|
/**
|
|
17
27
|
* A loader for the Draco format.
|
|
18
28
|
*
|
|
@@ -34,12 +44,10 @@ const _taskCache = new WeakMap();
|
|
|
34
44
|
*
|
|
35
45
|
* ```js
|
|
36
46
|
* const loader = new DRACOLoader();
|
|
37
|
-
* loader.
|
|
38
|
-
*
|
|
39
|
-
* const geometry = await dracoLoader.loadAsync( 'models/draco/bunny.drc' );
|
|
47
|
+
* const geometry = await loader.loadAsync( 'models/draco/bunny.drc' );
|
|
40
48
|
* geometry.computeVertexNormals(); // optional
|
|
41
49
|
*
|
|
42
|
-
*
|
|
50
|
+
* loader.dispose();
|
|
43
51
|
* ```
|
|
44
52
|
*
|
|
45
53
|
* @augments Loader
|
|
@@ -56,7 +64,11 @@ class DRACOLoader extends Loader {
|
|
|
56
64
|
|
|
57
65
|
super( manager );
|
|
58
66
|
|
|
59
|
-
this.
|
|
67
|
+
this.decoderPaths = {
|
|
68
|
+
js: WASM_JS_URL,
|
|
69
|
+
wasm: WASM_BIN_URL,
|
|
70
|
+
dep_js: JS_URL,
|
|
71
|
+
};
|
|
60
72
|
this.decoderConfig = {};
|
|
61
73
|
this.decoderBinary = null;
|
|
62
74
|
this.decoderPending = null;
|
|
@@ -84,12 +96,25 @@ class DRACOLoader extends Loader {
|
|
|
84
96
|
/**
|
|
85
97
|
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
86
98
|
*
|
|
87
|
-
* @param {string} path - The decoder path.
|
|
99
|
+
* @param {string|{js:string, wasm:string}} path - The decoder path, or a config object with explicit URLs for each decoder file.
|
|
88
100
|
* @return {DRACOLoader} A reference to this loader.
|
|
89
101
|
*/
|
|
90
102
|
setDecoderPath( path ) {
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
const { decoderPaths } = this;
|
|
105
|
+
if ( typeof path === 'object' ) {
|
|
106
|
+
|
|
107
|
+
decoderPaths.js = path.js;
|
|
108
|
+
decoderPaths.wasm = path.wasm;
|
|
109
|
+
decoderPaths.dep_js = null;
|
|
110
|
+
|
|
111
|
+
} else {
|
|
112
|
+
|
|
113
|
+
decoderPaths.js = LoaderUtils.resolveURL( 'draco_wasm_wrapper.js', path );
|
|
114
|
+
decoderPaths.wasm = LoaderUtils.resolveURL( 'draco_decoder.wasm', path );
|
|
115
|
+
decoderPaths.dep_js = LoaderUtils.resolveURL( 'draco_decoder.js', path );
|
|
116
|
+
|
|
117
|
+
}
|
|
93
118
|
|
|
94
119
|
return this;
|
|
95
120
|
|
|
@@ -98,11 +123,13 @@ class DRACOLoader extends Loader {
|
|
|
98
123
|
/**
|
|
99
124
|
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
|
|
100
125
|
*
|
|
126
|
+
* @deprecated
|
|
101
127
|
* @param {{type:('js'|'wasm')}} config - The decoder config.
|
|
102
128
|
* @return {DRACOLoader} A reference to this loader.
|
|
103
129
|
*/
|
|
104
130
|
setDecoderConfig( config ) {
|
|
105
131
|
|
|
132
|
+
console.warn( 'THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194.' );
|
|
106
133
|
this.decoderConfig = config;
|
|
107
134
|
|
|
108
135
|
return this;
|
|
@@ -331,7 +358,6 @@ class DRACOLoader extends Loader {
|
|
|
331
358
|
_loadLibrary( url, responseType ) {
|
|
332
359
|
|
|
333
360
|
const loader = new FileLoader( this.manager );
|
|
334
|
-
loader.setPath( this.decoderPath );
|
|
335
361
|
loader.setResponseType( responseType );
|
|
336
362
|
loader.setWithCredentials( this.withCredentials );
|
|
337
363
|
|
|
@@ -358,14 +384,21 @@ class DRACOLoader extends Loader {
|
|
|
358
384
|
const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js';
|
|
359
385
|
const librariesPending = [];
|
|
360
386
|
|
|
387
|
+
const { decoderPaths } = this;
|
|
361
388
|
if ( useJS ) {
|
|
362
389
|
|
|
363
|
-
|
|
390
|
+
if ( decoderPaths.dep_js === null ) {
|
|
391
|
+
|
|
392
|
+
throw new Error( 'THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.' );
|
|
393
|
+
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
librariesPending.push( this._loadLibrary( decoderPaths.dep_js, 'text' ) );
|
|
364
397
|
|
|
365
398
|
} else {
|
|
366
399
|
|
|
367
|
-
librariesPending.push( this._loadLibrary(
|
|
368
|
-
librariesPending.push( this._loadLibrary(
|
|
400
|
+
librariesPending.push( this._loadLibrary( decoderPaths.js, 'text' ) );
|
|
401
|
+
librariesPending.push( this._loadLibrary( decoderPaths.wasm, 'arraybuffer' ) );
|
|
369
402
|
|
|
370
403
|
}
|
|
371
404
|
|
|
@@ -736,4 +769,4 @@ function DRACOWorker() {
|
|
|
736
769
|
|
|
737
770
|
}
|
|
738
771
|
|
|
739
|
-
export { DRACOLoader };
|
|
772
|
+
export { DRACOLoader, DRACO_GLTF_CONFIG };
|