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,22 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { float, Fn, ivec2, int, If, uniform } from '../tsl/TSLBase.js';
|
|
3
|
+
import { Loop } from '../utils/LoopNode.js';
|
|
4
|
+
import { OnObjectUpdate } from '../utils/EventNode.js';
|
|
5
|
+
import { textureLoad } from './TextureNode.js';
|
|
6
6
|
import { positionLocal } from './Position.js';
|
|
7
7
|
import { normalLocal } from './Normal.js';
|
|
8
|
-
import { textureLoad } from './TextureNode.js';
|
|
9
8
|
import { instanceIndex, vertexIndex } from '../core/IndexNode.js';
|
|
10
|
-
import { Loop } from '../utils/LoopNode.js';
|
|
11
9
|
|
|
12
10
|
import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
|
|
13
11
|
import { Vector2 } from '../../math/Vector2.js';
|
|
14
12
|
import { Vector4 } from '../../math/Vector4.js';
|
|
15
13
|
import { FloatType } from '../../constants.js';
|
|
14
|
+
import { uniformArray } from './UniformArrayNode.js';
|
|
16
15
|
|
|
17
16
|
const _morphTextures = /*@__PURE__*/ new WeakMap();
|
|
18
17
|
const _morphVec4 = /*@__PURE__*/ new Vector4();
|
|
18
|
+
const _morphInfluencesData = /*@__PURE__*/ new WeakMap();
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* TSL function that retrieves and scales the morphed attribute (position or normal) texel value.
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} params - The parameter object.
|
|
24
|
+
* @param {Node<texture>} params.bufferMap - The morph target data array texture.
|
|
25
|
+
* @param {Node<float>} params.influence - The target's animation influence weight.
|
|
26
|
+
* @param {number} params.stride - The vertex data stride (e.g. 1 or 2).
|
|
27
|
+
* @param {Node<int>} params.width - The texture width limit.
|
|
28
|
+
* @param {Node<int>} params.depth - The target layer index (morph target index).
|
|
29
|
+
* @param {Node<int>} params.offset - The texture offset (e.g. 0 for position, 1 for normal).
|
|
30
|
+
* @returns {Node<vec3>} The scaled morph target translation value.
|
|
31
|
+
*/
|
|
20
32
|
const getMorph = /*@__PURE__*/ Fn( ( { bufferMap, influence, stride, width, depth, offset } ) => {
|
|
21
33
|
|
|
22
34
|
const texelIndex = int( vertexIndex ).mul( stride ).add( offset );
|
|
@@ -30,6 +42,12 @@ const getMorph = /*@__PURE__*/ Fn( ( { bufferMap, influence, stride, width, dept
|
|
|
30
42
|
|
|
31
43
|
} );
|
|
32
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Resolves or creates a compiled DataArrayTexture containing encoded vertex morph targets data for WebGL2/WebGPU.
|
|
47
|
+
*
|
|
48
|
+
* @param {BufferGeometry} geometry - The geometry to parse.
|
|
49
|
+
* @returns {Object} The resolved morph targets texture data mapping entry.
|
|
50
|
+
*/
|
|
33
51
|
function getEntry( geometry ) {
|
|
34
52
|
|
|
35
53
|
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
@@ -157,154 +175,123 @@ function getEntry( geometry ) {
|
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
178
|
+
* TSL function representing the vertex shader morph targets blend setup.
|
|
179
|
+
* Dynamically computes morph targets weights and updates positionLocal and normalLocal in-place.
|
|
162
180
|
*
|
|
163
|
-
* @
|
|
181
|
+
* @tsl
|
|
182
|
+
* @function
|
|
183
|
+
* @param {Mesh} mesh - The mesh.
|
|
164
184
|
*/
|
|
165
|
-
|
|
185
|
+
export const morphReference = /*@__PURE__*/ Fn( ( [ mesh ] ) => {
|
|
166
186
|
|
|
167
|
-
|
|
187
|
+
const { geometry } = mesh;
|
|
168
188
|
|
|
169
|
-
|
|
189
|
+
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
190
|
+
const hasMorphNormals = geometry.hasAttribute( 'normal' ) && geometry.morphAttributes.normal !== undefined;
|
|
170
191
|
|
|
171
|
-
|
|
192
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
193
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
172
194
|
|
|
173
|
-
|
|
174
|
-
* Constructs a new morph node.
|
|
175
|
-
*
|
|
176
|
-
* @param {Mesh} mesh - The mesh holding the morph targets.
|
|
177
|
-
*/
|
|
178
|
-
constructor( mesh ) {
|
|
179
|
-
|
|
180
|
-
super( 'void' );
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* The mesh holding the morph targets.
|
|
184
|
-
*
|
|
185
|
-
* @type {Mesh}
|
|
186
|
-
*/
|
|
187
|
-
this.mesh = mesh;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* A uniform node which represents the morph base influence value.
|
|
191
|
-
*
|
|
192
|
-
* @type {UniformNode<float>}
|
|
193
|
-
*/
|
|
194
|
-
this.morphBaseInfluence = uniform( 1 );
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* The update type overwritten since morph nodes are updated per object.
|
|
198
|
-
*
|
|
199
|
-
* @type {string}
|
|
200
|
-
*/
|
|
201
|
-
this.updateType = NodeUpdateType.OBJECT;
|
|
195
|
+
if ( morphTargetsCount === 0 ) return;
|
|
202
196
|
|
|
203
|
-
|
|
197
|
+
// Init
|
|
204
198
|
|
|
205
|
-
|
|
206
|
-
* Setups the morph node by assigning the transformed vertex data to predefined node variables.
|
|
207
|
-
*
|
|
208
|
-
* @param {NodeBuilder} builder - The current node builder.
|
|
209
|
-
*/
|
|
210
|
-
setup( builder ) {
|
|
199
|
+
let morphInfluenceData = _morphInfluencesData.get( mesh );
|
|
211
200
|
|
|
212
|
-
|
|
201
|
+
if ( morphInfluenceData === undefined || morphInfluenceData.count !== morphTargetsCount ) {
|
|
213
202
|
|
|
214
|
-
|
|
215
|
-
|
|
203
|
+
morphInfluenceData = {
|
|
204
|
+
base: uniform( 1 ),
|
|
205
|
+
influences: mesh.morphTargetInfluences ? uniformArray( mesh.morphTargetInfluences, 'float' ) : null,
|
|
206
|
+
count: morphTargetsCount
|
|
207
|
+
};
|
|
216
208
|
|
|
217
|
-
|
|
218
|
-
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
209
|
+
_morphInfluencesData.set( mesh, morphInfluenceData );
|
|
219
210
|
|
|
220
|
-
|
|
211
|
+
}
|
|
221
212
|
|
|
222
|
-
|
|
213
|
+
const { base, influences } = morphInfluenceData;
|
|
223
214
|
|
|
224
|
-
|
|
225
|
-
if ( hasMorphNormals === true ) normalLocal.mulAssign( this.morphBaseInfluence );
|
|
215
|
+
// Shader
|
|
226
216
|
|
|
227
|
-
|
|
217
|
+
const { texture: bufferMap, stride, size } = getEntry( geometry );
|
|
228
218
|
|
|
229
|
-
|
|
219
|
+
if ( hasMorphPosition === true ) positionLocal.mulAssign( base );
|
|
220
|
+
if ( hasMorphNormals === true ) normalLocal.mulAssign( base );
|
|
230
221
|
|
|
231
|
-
|
|
222
|
+
const width = int( size.width );
|
|
232
223
|
|
|
233
|
-
|
|
224
|
+
Loop( morphTargetsCount, ( { i } ) => {
|
|
234
225
|
|
|
235
|
-
|
|
226
|
+
const influence = float( 0 ).toVar();
|
|
236
227
|
|
|
237
|
-
|
|
228
|
+
if ( mesh.count > 1 && ( mesh.morphTexture !== null && mesh.morphTexture !== undefined ) ) {
|
|
238
229
|
|
|
239
|
-
|
|
230
|
+
influence.assign( textureLoad( mesh.morphTexture, ivec2( int( i ).add( 1 ), int( instanceIndex ) ) ).r );
|
|
240
231
|
|
|
241
|
-
|
|
232
|
+
} else {
|
|
242
233
|
|
|
243
|
-
|
|
234
|
+
influence.assign( influences.element( i ).toVar() );
|
|
244
235
|
|
|
245
|
-
|
|
236
|
+
}
|
|
246
237
|
|
|
247
|
-
|
|
248
|
-
bufferMap,
|
|
249
|
-
influence,
|
|
250
|
-
stride,
|
|
251
|
-
width,
|
|
252
|
-
depth: i,
|
|
253
|
-
offset: int( 0 )
|
|
254
|
-
} ) );
|
|
238
|
+
If( influence.notEqual( 0 ), () => {
|
|
255
239
|
|
|
256
|
-
|
|
240
|
+
if ( hasMorphPosition === true ) {
|
|
257
241
|
|
|
258
|
-
|
|
242
|
+
positionLocal.addAssign( getMorph( {
|
|
243
|
+
bufferMap,
|
|
244
|
+
influence,
|
|
245
|
+
stride,
|
|
246
|
+
width,
|
|
247
|
+
depth: i,
|
|
248
|
+
offset: int( 0 )
|
|
249
|
+
} ) );
|
|
259
250
|
|
|
260
|
-
|
|
261
|
-
bufferMap,
|
|
262
|
-
influence,
|
|
263
|
-
stride,
|
|
264
|
-
width,
|
|
265
|
-
depth: i,
|
|
266
|
-
offset: int( 1 )
|
|
267
|
-
} ) );
|
|
251
|
+
}
|
|
268
252
|
|
|
269
|
-
|
|
253
|
+
if ( hasMorphNormals === true ) {
|
|
270
254
|
|
|
271
|
-
|
|
255
|
+
normalLocal.addAssign( getMorph( {
|
|
256
|
+
bufferMap,
|
|
257
|
+
influence,
|
|
258
|
+
stride,
|
|
259
|
+
width,
|
|
260
|
+
depth: i,
|
|
261
|
+
offset: int( 1 )
|
|
262
|
+
} ) );
|
|
263
|
+
|
|
264
|
+
}
|
|
272
265
|
|
|
273
266
|
} );
|
|
274
267
|
|
|
275
|
-
}
|
|
268
|
+
} );
|
|
276
269
|
|
|
277
|
-
|
|
278
|
-
* Updates the state of the morphed mesh by updating the base influence.
|
|
279
|
-
*
|
|
280
|
-
* @param {NodeFrame} frame - The current node frame.
|
|
281
|
-
*/
|
|
282
|
-
update( /*frame*/ ) {
|
|
270
|
+
// Update
|
|
283
271
|
|
|
284
|
-
|
|
272
|
+
OnObjectUpdate( ( { object } ) => {
|
|
285
273
|
|
|
286
|
-
|
|
274
|
+
const { base, influences } = morphInfluenceData;
|
|
287
275
|
|
|
288
|
-
|
|
276
|
+
if ( object.geometry.morphTargetsRelative ) {
|
|
277
|
+
|
|
278
|
+
base.value = 1;
|
|
289
279
|
|
|
290
280
|
} else {
|
|
291
281
|
|
|
292
|
-
|
|
282
|
+
base.value = 1 - object.morphTargetInfluences.reduce( ( a, b ) => a + b, 0 );
|
|
293
283
|
|
|
294
284
|
}
|
|
295
285
|
|
|
296
|
-
|
|
286
|
+
if ( influences ) {
|
|
297
287
|
|
|
298
|
-
|
|
288
|
+
influences.array = object.morphTargetInfluences;
|
|
289
|
+
influences.update();
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
} );
|
|
294
|
+
|
|
295
|
+
}, 'void' );
|
|
299
296
|
|
|
300
|
-
export default MorphNode;
|
|
301
297
|
|
|
302
|
-
/**
|
|
303
|
-
* TSL function for creating a morph node.
|
|
304
|
-
*
|
|
305
|
-
* @tsl
|
|
306
|
-
* @function
|
|
307
|
-
* @param {Mesh} mesh - The mesh holding the morph targets.
|
|
308
|
-
* @returns {MorphNode}
|
|
309
|
-
*/
|
|
310
|
-
export const morphReference = /*@__PURE__*/ nodeProxy( MorphNode ).setParameterLength( 1 );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { attribute } from '../core/AttributeNode.js';
|
|
2
2
|
import { cameraViewMatrix } from './Camera.js';
|
|
3
3
|
import { modelNormalMatrix, modelWorldMatrix } from './ModelNode.js';
|
|
4
|
-
import { mat3, vec3, Fn } from '../tsl/TSLBase.js';
|
|
4
|
+
import { mat3, vec3, Fn, addMethodChaining } from '../tsl/TSLBase.js';
|
|
5
5
|
import { positionView } from './Position.js';
|
|
6
|
-
import {
|
|
6
|
+
import { negateOnBackSide } from '../display/FrontFacingNode.js';
|
|
7
7
|
import { warn } from '../../utils.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -74,7 +74,7 @@ export const normalViewGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
74
74
|
*/
|
|
75
75
|
export const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
76
76
|
|
|
77
|
-
let normal = normalViewGeometry.
|
|
77
|
+
let normal = normalViewGeometry.transformNormalByInverseViewMatrix( cameraViewMatrix );
|
|
78
78
|
|
|
79
79
|
if ( builder.isFlatShading() !== true ) {
|
|
80
80
|
|
|
@@ -102,7 +102,7 @@ export const normalView = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
102
102
|
|
|
103
103
|
if ( builder.isFlatShading() !== true ) {
|
|
104
104
|
|
|
105
|
-
node =
|
|
105
|
+
node = negateOnBackSide( node );
|
|
106
106
|
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -124,7 +124,7 @@ export const normalView = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
124
124
|
* @tsl
|
|
125
125
|
* @type {Node<vec3>}
|
|
126
126
|
*/
|
|
127
|
-
export const normalWorld = /*@__PURE__*/ normalView.
|
|
127
|
+
export const normalWorld = /*@__PURE__*/ normalView.transformNormalByInverseViewMatrix( cameraViewMatrix ).toVar( 'normalWorld' );
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* TSL object that represents the clearcoat vertex normal of the current rendered object in view space.
|
|
@@ -153,24 +153,24 @@ export const clearcoatNormalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, context }
|
|
|
153
153
|
}, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'clearcoatNormalView' );
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* Transforms the normal
|
|
156
|
+
* Transforms the normal by the normal matrix of the given matrix and then normalizes the result.
|
|
157
157
|
*
|
|
158
158
|
* @tsl
|
|
159
159
|
* @function
|
|
160
160
|
* @param {Node<vec3>} normal - The normal.
|
|
161
|
-
* @param {Node<mat3>} [matrix=modelWorldMatrix] - The matrix.
|
|
161
|
+
* @param {Node<mat3|mat4>} [matrix=modelWorldMatrix] - The matrix.
|
|
162
162
|
* @return {Node<vec3>} The transformed normal.
|
|
163
163
|
*/
|
|
164
164
|
export const transformNormal = /*@__PURE__*/ Fn( ( [ normal, matrix = modelWorldMatrix ] ) => {
|
|
165
165
|
|
|
166
|
-
const
|
|
166
|
+
const normalMatrix = mat3( matrix ).inverse().transpose();
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return m.mul( transformedNormal ).xyz;
|
|
168
|
+
return normalMatrix.mul( normal ).normalize();
|
|
171
169
|
|
|
172
170
|
} );
|
|
173
171
|
|
|
172
|
+
addMethodChaining( 'transformNormal', transformNormal );
|
|
173
|
+
|
|
174
174
|
/**
|
|
175
175
|
* Transforms the given normal from local to view space.
|
|
176
176
|
*
|
|
@@ -186,7 +186,7 @@ export const transformNormalToView = /*@__PURE__*/ Fn( ( [ normal ], builder ) =
|
|
|
186
186
|
|
|
187
187
|
if ( modelNormalViewMatrix ) {
|
|
188
188
|
|
|
189
|
-
return
|
|
189
|
+
return normal.transformNormalByViewMatrix( modelNormalViewMatrix );
|
|
190
190
|
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -194,7 +194,7 @@ export const transformNormalToView = /*@__PURE__*/ Fn( ( [ normal ], builder ) =
|
|
|
194
194
|
|
|
195
195
|
const transformedNormal = modelNormalMatrix.mul( normal );
|
|
196
196
|
|
|
197
|
-
return
|
|
197
|
+
return transformedNormal.transformNormalByViewMatrix( cameraViewMatrix );
|
|
198
198
|
|
|
199
199
|
} );
|
|
200
200
|
|
|
@@ -33,7 +33,11 @@ export const clipSpace = /*@__PURE__*/ ( Fn( ( builder ) => {
|
|
|
33
33
|
export const positionGeometry = /*@__PURE__*/ attribute( 'position', 'vec3' );
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* TSL object that represents the vertex position in local space of the current rendered object.
|
|
36
|
+
* TSL object that represents the transformed vertex position in local space of the current rendered object.
|
|
37
|
+
*
|
|
38
|
+
* The term "transformed" indicates that an object or material's properties, such as skinning, batch,
|
|
39
|
+
* instancing, or displacement mapping, will change the vertex position of the node when present.
|
|
40
|
+
* To use the pre-transformed local space position of the object, use {@link positionGeometry}.
|
|
37
41
|
*
|
|
38
42
|
* @tsl
|
|
39
43
|
* @type {AttributeNode<vec3>}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cameraWorldMatrix } from './Camera.js';
|
|
2
2
|
import { normalView } from './Normal.js';
|
|
3
3
|
import { positionViewDirection } from './Position.js';
|
|
4
4
|
import { materialRefractionRatio } from './MaterialProperties.js';
|
|
@@ -25,7 +25,7 @@ export const refractView = /*@__PURE__*/ positionViewDirection.negate().refract(
|
|
|
25
25
|
* @tsl
|
|
26
26
|
* @type {Node<vec3>}
|
|
27
27
|
*/
|
|
28
|
-
export const reflectVector = /*@__PURE__*/ reflectView.transformDirection(
|
|
28
|
+
export const reflectVector = /*@__PURE__*/ reflectView.transformDirection( cameraWorldMatrix ).toVar( 'reflectVector' );
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Used for sampling cube maps when using cube refraction mapping.
|
|
@@ -33,4 +33,4 @@ export const reflectVector = /*@__PURE__*/ reflectView.transformDirection( camer
|
|
|
33
33
|
* @tsl
|
|
34
34
|
* @type {Node<vec3>}
|
|
35
35
|
*/
|
|
36
|
-
export const refractVector = /*@__PURE__*/ refractView.transformDirection(
|
|
36
|
+
export const refractVector = /*@__PURE__*/ refractView.transformDirection( cameraWorldMatrix ).toVar( 'refractVector' );
|
|
@@ -31,7 +31,7 @@ export const backgroundRotation = /*@__PURE__*/ uniform( new Matrix4() ).setGrou
|
|
|
31
31
|
|
|
32
32
|
const background = scene.background;
|
|
33
33
|
|
|
34
|
-
if ( background !== null && background.isTexture && background.mapping !== UVMapping ) {
|
|
34
|
+
if ( ( background !== null && background.isTexture && background.mapping !== UVMapping ) || ( scene.backgroundNode && scene.backgroundNode.isNode ) ) {
|
|
35
35
|
|
|
36
36
|
// note: since the matrix is orthonormal, we can use the more-efficient transpose() in lieu of invert()
|
|
37
37
|
_m1.makeRotationFromEuler( scene.backgroundRotation ).transpose();
|