@gnsx/three 0.184.19 → 0.185.2
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 +1667 -1189
- package/build/three.core.js +1289 -871
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +157 -97
- 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 +7542 -3371
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7542 -3370
- 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 +57 -64
- 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 +124 -91
- 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 -74
- 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 +92 -37
- package/src/nodes/lighting/PointShadowNode.js +7 -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/profiler/ProfilerService.js +185 -42
- package/src/renderers/WebGLRenderer.js +21 -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 +42 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +282 -109
- 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 +11 -4
- 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,17 +1,53 @@
|
|
|
1
1
|
import Node from '../core/Node.js';
|
|
2
|
-
import {
|
|
2
|
+
import { property, vec3 } from '../tsl/TSLBase.js';
|
|
3
3
|
import { hashArray } from '../core/NodeUtils.js';
|
|
4
4
|
import { warn } from '../../utils.js';
|
|
5
5
|
// WITH_GENESYS
|
|
6
6
|
import LightProbeGridNode from './LightProbeGridNode.js';
|
|
7
7
|
// !WITH_GENESYS
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A node representing the total diffuse light.
|
|
11
|
+
*
|
|
12
|
+
* @type {Node<vec3>}
|
|
13
|
+
*/
|
|
14
|
+
const totalDiffuse = property( 'vec3', 'totalDiffuse' );
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A node representing the total specular light.
|
|
18
|
+
*
|
|
19
|
+
* @type {Node<vec3>}
|
|
20
|
+
*/
|
|
21
|
+
const totalSpecular = property( 'vec3', 'totalSpecular' );
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A node representing the outgoing light.
|
|
25
|
+
*
|
|
26
|
+
* @type {Node<vec3>}
|
|
27
|
+
*/
|
|
28
|
+
const outgoingLight = property( 'vec3', 'outgoingLight' );
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Sorts an array of lights in ascending order by their IDs.
|
|
32
|
+
*
|
|
33
|
+
* @private
|
|
34
|
+
* @param {Array<Light>} lights - The array of lights to sort.
|
|
35
|
+
* @return {Array<Light>} The sorted array of lights.
|
|
36
|
+
*/
|
|
9
37
|
const sortLights = ( lights ) => {
|
|
10
38
|
|
|
11
39
|
return lights.sort( ( a, b ) => a.id - b.id );
|
|
12
40
|
|
|
13
41
|
};
|
|
14
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Finds and returns a lighting node associated with a specific light ID.
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
* @param {number} id - The ID of the light to search for.
|
|
48
|
+
* @param {Array<LightingNode>} lightNodes - The array of lighting nodes to search within.
|
|
49
|
+
* @return {?LightingNode} The matching lighting node, or null if not found.
|
|
50
|
+
*/
|
|
15
51
|
const getLightNodeById = ( id, lightNodes ) => {
|
|
16
52
|
|
|
17
53
|
for ( const lightNode of lightNodes ) {
|
|
@@ -28,7 +64,20 @@ const getLightNodeById = ( id, lightNodes ) => {
|
|
|
28
64
|
|
|
29
65
|
};
|
|
30
66
|
|
|
67
|
+
/**
|
|
68
|
+
* WeakMap cache mapping light objects to their corresponding lighting node instances.
|
|
69
|
+
*
|
|
70
|
+
* @private
|
|
71
|
+
* @type {WeakMap<Light, LightingNode>}
|
|
72
|
+
*/
|
|
31
73
|
const _lightsNodeRef = /*@__PURE__*/ new WeakMap();
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Array used to temporarily store light IDs and shadow casting states for hashing.
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @type {Array<number>}
|
|
80
|
+
*/
|
|
32
81
|
const _hashData = [];
|
|
33
82
|
|
|
34
83
|
/**
|
|
@@ -58,21 +107,21 @@ class LightsNode extends Node {
|
|
|
58
107
|
*
|
|
59
108
|
* @type {Node<vec3>}
|
|
60
109
|
*/
|
|
61
|
-
this.totalDiffuseNode =
|
|
110
|
+
this.totalDiffuseNode = totalDiffuse;
|
|
62
111
|
|
|
63
112
|
/**
|
|
64
113
|
* A node representing the total specular light.
|
|
65
114
|
*
|
|
66
115
|
* @type {Node<vec3>}
|
|
67
116
|
*/
|
|
68
|
-
this.totalSpecularNode =
|
|
117
|
+
this.totalSpecularNode = totalSpecular;
|
|
69
118
|
|
|
70
119
|
/**
|
|
71
120
|
* A node representing the outgoing light.
|
|
72
121
|
*
|
|
73
122
|
* @type {Node<vec3>}
|
|
74
123
|
*/
|
|
75
|
-
this.outgoingLightNode =
|
|
124
|
+
this.outgoingLightNode = outgoingLight;
|
|
76
125
|
|
|
77
126
|
/**
|
|
78
127
|
* An array representing the lights in the scene.
|
|
@@ -91,6 +140,7 @@ class LightsNode extends Node {
|
|
|
91
140
|
*/
|
|
92
141
|
this._lightProbeGrids = [];
|
|
93
142
|
|
|
143
|
+
|
|
94
144
|
/**
|
|
95
145
|
* Cached light probe grid node reused across {@link LightsNode#setupLightsNode} calls.
|
|
96
146
|
*
|
|
@@ -101,25 +151,6 @@ class LightsNode extends Node {
|
|
|
101
151
|
this._lightProbeGridNode = null;
|
|
102
152
|
// !WITH_GENESYS
|
|
103
153
|
|
|
104
|
-
/**
|
|
105
|
-
* For each light in the scene, this node will create a
|
|
106
|
-
* corresponding light node.
|
|
107
|
-
*
|
|
108
|
-
* @private
|
|
109
|
-
* @type {?Array<LightingNode>}
|
|
110
|
-
* @default null
|
|
111
|
-
*/
|
|
112
|
-
this._lightNodes = null;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* A hash for identifying the current light nodes setup.
|
|
116
|
-
*
|
|
117
|
-
* @private
|
|
118
|
-
* @type {?string}
|
|
119
|
-
* @default null
|
|
120
|
-
*/
|
|
121
|
-
this._lightNodesHash = null;
|
|
122
|
-
|
|
123
154
|
/**
|
|
124
155
|
* `LightsNode` sets this property to `true` by default.
|
|
125
156
|
*
|
|
@@ -186,26 +217,36 @@ class LightsNode extends Node {
|
|
|
186
217
|
*/
|
|
187
218
|
getHash( builder ) {
|
|
188
219
|
|
|
189
|
-
|
|
220
|
+
const nodeData = builder.getDataFromNode( this );
|
|
221
|
+
|
|
222
|
+
if ( nodeData.lightNodesHash === undefined ) {
|
|
223
|
+
|
|
224
|
+
const lightNodes = this.setupLightsNode( builder );
|
|
190
225
|
|
|
191
|
-
|
|
226
|
+
nodeData.lightNodes = lightNodes;
|
|
192
227
|
|
|
193
228
|
const hash = [];
|
|
194
229
|
|
|
195
|
-
for ( const lightNode of
|
|
230
|
+
for ( const lightNode of lightNodes ) {
|
|
196
231
|
|
|
197
232
|
hash.push( lightNode.getHash() );
|
|
198
233
|
|
|
199
234
|
}
|
|
200
235
|
|
|
201
|
-
|
|
236
|
+
nodeData.lightNodesHash = 'lights-' + hash.join( ',' );
|
|
202
237
|
|
|
203
238
|
}
|
|
204
239
|
|
|
205
|
-
return
|
|
240
|
+
return nodeData.lightNodesHash;
|
|
206
241
|
|
|
207
242
|
}
|
|
208
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Analyzes the node's dependencies by building all nested light nodes
|
|
246
|
+
* and the output node.
|
|
247
|
+
*
|
|
248
|
+
* @param {NodeBuilder} builder - A reference to the current node builder.
|
|
249
|
+
*/
|
|
209
250
|
analyze( builder ) {
|
|
210
251
|
|
|
211
252
|
const properties = builder.getNodeProperties( this );
|
|
@@ -225,21 +266,24 @@ class LightsNode extends Node {
|
|
|
225
266
|
* process lights in the node system.
|
|
226
267
|
*
|
|
227
268
|
* @param {NodeBuilder} builder - A reference to the current node builder.
|
|
269
|
+
* @return {Array<LightingNode>} The array of lighting nodes.
|
|
228
270
|
*/
|
|
229
271
|
setupLightsNode( builder ) {
|
|
230
272
|
|
|
273
|
+
const nodeData = builder.getDataFromNode( this );
|
|
231
274
|
const lightNodes = [];
|
|
232
275
|
|
|
233
|
-
const previousLightNodes =
|
|
276
|
+
const previousLightNodes = nodeData.lightNodes || null;
|
|
277
|
+
const materialLightings = builder.context.materialLightings;
|
|
234
278
|
|
|
235
|
-
const lights = sortLights( this._lights );
|
|
279
|
+
const lights = sortLights( [ ...materialLightings, ...this._lights ] );
|
|
236
280
|
const nodeLibrary = builder.renderer.library;
|
|
237
281
|
|
|
238
282
|
for ( const light of lights ) {
|
|
239
283
|
|
|
240
284
|
if ( light.isNode ) {
|
|
241
285
|
|
|
242
|
-
lightNodes.push(
|
|
286
|
+
lightNodes.push( light );
|
|
243
287
|
|
|
244
288
|
} else {
|
|
245
289
|
|
|
@@ -278,11 +322,12 @@ class LightsNode extends Node {
|
|
|
278
322
|
|
|
279
323
|
}
|
|
280
324
|
|
|
325
|
+
|
|
281
326
|
// WITH_GENESYS
|
|
282
327
|
this._appendLightProbeGridNode( lightNodes );
|
|
283
328
|
// !WITH_GENESYS
|
|
284
329
|
|
|
285
|
-
|
|
330
|
+
return lightNodes;
|
|
286
331
|
|
|
287
332
|
}
|
|
288
333
|
|
|
@@ -335,6 +380,13 @@ class LightsNode extends Node {
|
|
|
335
380
|
|
|
336
381
|
}
|
|
337
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Sets up a direct rect area light in the lighting model.
|
|
385
|
+
*
|
|
386
|
+
* @param {Object} builder - The builder object containing the context and stack.
|
|
387
|
+
* @param {Object} lightNode - The light node.
|
|
388
|
+
* @param {Object} lightData - The light object containing color and area light properties.
|
|
389
|
+
*/
|
|
338
390
|
setupDirectRectAreaLight( builder, lightNode, lightData ) {
|
|
339
391
|
|
|
340
392
|
const { lightingModel, reflectedLight } = builder.context;
|
|
@@ -366,9 +418,15 @@ class LightsNode extends Node {
|
|
|
366
418
|
|
|
367
419
|
getLightNodes( builder ) {
|
|
368
420
|
|
|
369
|
-
|
|
421
|
+
const nodeData = builder.getDataFromNode( this );
|
|
370
422
|
|
|
371
|
-
|
|
423
|
+
if ( nodeData.lightNodes === undefined ) {
|
|
424
|
+
|
|
425
|
+
nodeData.lightNodes = this.setupLightsNode( builder );
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return nodeData.lightNodes;
|
|
372
430
|
|
|
373
431
|
}
|
|
374
432
|
|
|
@@ -455,9 +513,6 @@ class LightsNode extends Node {
|
|
|
455
513
|
|
|
456
514
|
this._lights = lights;
|
|
457
515
|
|
|
458
|
-
this._lightNodes = null;
|
|
459
|
-
this._lightNodesHash = null;
|
|
460
|
-
|
|
461
516
|
return this;
|
|
462
517
|
|
|
463
518
|
}
|
|
@@ -12,7 +12,8 @@ import { CubeDepthTexture } from '../../textures/CubeDepthTexture.js';
|
|
|
12
12
|
import { screenCoordinate } from '../display/ScreenNode.js';
|
|
13
13
|
import { interleavedGradientNoise, vogelDiskSample } from '../utils/PostProcessingUtils.js';
|
|
14
14
|
import { abs, normalize, cross } from '../math/MathNode.js';
|
|
15
|
-
import { viewZToPerspectiveDepth, viewZToReversedPerspectiveDepth } from '../display/ViewportDepthNode.js';
|
|
15
|
+
import { viewZToLogarithmicDepth, viewZToPerspectiveDepth, viewZToReversedPerspectiveDepth } from '../display/ViewportDepthNode.js';
|
|
16
|
+
|
|
16
17
|
// WITH_GENESYS
|
|
17
18
|
import { ProfilerService } from '../../profiler/ProfilerService.js';
|
|
18
19
|
// !WITH_GENESYS
|
|
@@ -120,6 +121,11 @@ const pointShadowFilter = /*@__PURE__*/ Fn( ( { filterFn, depthTexture, shadowCo
|
|
|
120
121
|
dp = viewZToReversedPerspectiveDepth( viewZ.negate(), shadowCameraNear, shadowCameraFar );
|
|
121
122
|
dp.subAssign( bias );
|
|
122
123
|
|
|
124
|
+
} else if ( builder.renderer.logarithmicDepthBuffer ) {
|
|
125
|
+
|
|
126
|
+
dp = viewZToLogarithmicDepth( viewZ.negate(), shadowCameraNear, shadowCameraFar );
|
|
127
|
+
dp.addAssign( bias );
|
|
128
|
+
|
|
123
129
|
} else {
|
|
124
130
|
|
|
125
131
|
dp = viewZToPerspectiveDepth( viewZ.negate(), shadowCameraNear, shadowCameraFar );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { float, vec2, vec4, If, Fn } from '../tsl/TSLBase.js';
|
|
1
|
+
import { float, vec2, vec4, If, Fn, ivec2 } from '../tsl/TSLBase.js';
|
|
2
2
|
import { reference } from '../accessors/ReferenceNode.js';
|
|
3
3
|
import { texture } from '../accessors/TextureNode.js';
|
|
4
4
|
import { mix, fract, step, max, clamp } from '../math/MathNode.js';
|
|
@@ -97,69 +97,38 @@ export const PCFShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord,
|
|
|
97
97
|
*/
|
|
98
98
|
export const PCFSoftShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord, shadow, depthLayer } ) => {
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
const texelSize = vec2( 1 ).div( mapSize );
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
const uv = shadowCoord.xy;
|
|
105
|
+
const f = fract( uv.mul( mapSize ).add( 0.5 ) ).toConst();
|
|
106
|
+
uv.subAssign( f.sub( 0.5 ).mul( texelSize ) );
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
const gatherCompare = ( offset ) => {
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
let t = texture( depthTexture, uv ).offset( offset ).gather();
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
if ( depthTexture.isArrayTexture ) {
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
t = t.depth( depthLayer );
|
|
113
115
|
|
|
116
|
+
}
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
return t.compare( shadowCoord.z );
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
const dx = texelSize.x;
|
|
119
|
-
const dy = texelSize.y;
|
|
120
|
+
};
|
|
120
121
|
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
122
|
+
const c1 = gatherCompare( ivec2( - 1, 1 ) ).toConst();
|
|
123
|
+
const c2 = gatherCompare( ivec2( 1, 1 ) ).toConst();
|
|
124
|
+
const c3 = gatherCompare( ivec2( - 1, - 1 ) ).toConst();
|
|
125
|
+
const c4 = gatherCompare( ivec2( 1, - 1 ) ).toConst();
|
|
124
126
|
|
|
125
127
|
return add(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
mix(
|
|
131
|
-
depthCompare( uv.add( vec2( dx.negate(), 0 ) ), shadowCoord.z ),
|
|
132
|
-
depthCompare( uv.add( vec2( dx.mul( 2 ), 0 ) ), shadowCoord.z ),
|
|
133
|
-
f.x
|
|
134
|
-
),
|
|
135
|
-
mix(
|
|
136
|
-
depthCompare( uv.add( vec2( dx.negate(), dy ) ), shadowCoord.z ),
|
|
137
|
-
depthCompare( uv.add( vec2( dx.mul( 2 ), dy ) ), shadowCoord.z ),
|
|
138
|
-
f.x
|
|
139
|
-
),
|
|
140
|
-
mix(
|
|
141
|
-
depthCompare( uv.add( vec2( 0, dy.negate() ) ), shadowCoord.z ),
|
|
142
|
-
depthCompare( uv.add( vec2( 0, dy.mul( 2 ) ) ), shadowCoord.z ),
|
|
143
|
-
f.y
|
|
144
|
-
),
|
|
145
|
-
mix(
|
|
146
|
-
depthCompare( uv.add( vec2( dx, dy.negate() ) ), shadowCoord.z ),
|
|
147
|
-
depthCompare( uv.add( vec2( dx, dy.mul( 2 ) ) ), shadowCoord.z ),
|
|
148
|
-
f.y
|
|
149
|
-
),
|
|
150
|
-
mix(
|
|
151
|
-
mix(
|
|
152
|
-
depthCompare( uv.add( vec2( dx.negate(), dy.negate() ) ), shadowCoord.z ),
|
|
153
|
-
depthCompare( uv.add( vec2( dx.mul( 2 ), dy.negate() ) ), shadowCoord.z ),
|
|
154
|
-
f.x
|
|
155
|
-
),
|
|
156
|
-
mix(
|
|
157
|
-
depthCompare( uv.add( vec2( dx.negate(), dy.mul( 2 ) ) ), shadowCoord.z ),
|
|
158
|
-
depthCompare( uv.add( vec2( dx.mul( 2 ), dy.mul( 2 ) ) ), shadowCoord.z ),
|
|
159
|
-
f.x
|
|
160
|
-
),
|
|
161
|
-
f.y
|
|
162
|
-
)
|
|
128
|
+
mix( c1.x, c2.y, f.x ).add( c1.y ).add( c2.x ).mul( f.y ),
|
|
129
|
+
mix( c1.w, c2.z, f.x ).add( c1.z ).add( c2.w ),
|
|
130
|
+
mix( c3.x, c4.y, f.x ).add( c3.y ).add( c4.x ),
|
|
131
|
+
mix( c3.w, c4.z, f.x ).add( c3.z ).add( c4.w ).mul( f.y.oneMinus() )
|
|
163
132
|
).mul( 1 / 9 );
|
|
164
133
|
|
|
165
134
|
} );
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
2
|
+
import QuadMesh from '../../renderers/common/QuadMesh.js';
|
|
3
|
+
import ChainMap from '../../renderers/common/ChainMap.js';
|
|
1
4
|
import ShadowBaseNode, { shadowPositionWorld } from './ShadowBaseNode.js';
|
|
2
|
-
import { float, vec2, vec3, vec4, int, Fn } from '../tsl/
|
|
5
|
+
import { float, vec2, vec3, vec4, int, Fn } from '../tsl/TSLCore.js';
|
|
3
6
|
import { reference } from '../accessors/ReferenceNode.js';
|
|
4
|
-
import { texture
|
|
7
|
+
import { texture } from '../accessors/TextureNode.js';
|
|
5
8
|
import { cubeTexture } from '../accessors/CubeTextureNode.js';
|
|
6
9
|
import { normalWorld } from '../accessors/Normal.js';
|
|
7
10
|
import { mix, sqrt } from '../math/MathNode.js';
|
|
8
11
|
import { add } from '../math/OperatorNode.js';
|
|
9
12
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
10
|
-
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
11
|
-
import QuadMesh from '../../renderers/common/QuadMesh.js';
|
|
12
13
|
import { Loop } from '../utils/LoopNode.js';
|
|
13
14
|
import { screenCoordinate } from '../display/ScreenNode.js';
|
|
14
15
|
import { Compatibility, GreaterEqualCompare, HalfFloatType, LessEqualCompare, LinearFilter, NearestFilter, PCFShadowMap, PCFSoftShadowMap, RGFormat, VSMShadowMap } from '../../constants.js';
|
|
15
16
|
import { renderGroup } from '../core/UniformGroupNode.js';
|
|
16
|
-
import { viewZToLogarithmicDepth } from '../display/ViewportDepthNode.js';
|
|
17
|
+
import { viewZToLogarithmicDepth, perspectiveDepthToViewZ, orthographicDepthToViewZ, viewZToOrthographicDepth } from '../display/ViewportDepthNode.js';
|
|
17
18
|
import { lightShadowMatrix } from '../accessors/Lights.js';
|
|
18
19
|
import { resetRendererAndSceneState, restoreRendererAndSceneState } from '../../renderers/common/RendererUtils.js';
|
|
19
20
|
import { getDataFromObject } from '../core/NodeUtils.js';
|
|
20
21
|
import { getShadowMaterial, disposeShadowMaterial, BasicShadowFilter, PCFShadowFilter, PCFSoftShadowFilter, VSMShadowFilter } from './ShadowFilterNode.js';
|
|
21
|
-
import ChainMap from '../../renderers/common/ChainMap.js';
|
|
22
|
-
import { textureSize } from '../accessors/TextureSizeNode.js';
|
|
23
|
-
import { uv } from '../accessors/UV.js';
|
|
24
22
|
import { positionLocal } from '../accessors/Position.js';
|
|
25
23
|
import { uniform } from '../core/UniformNode.js';
|
|
24
|
+
import { equirectDirection } from '../utils/EquirectUV.js';
|
|
26
25
|
|
|
27
26
|
// WITH_GENESYS
|
|
28
27
|
import { ProfilerService } from '../../profiler/ProfilerService.js';
|
|
@@ -53,7 +52,7 @@ export const getShadowRenderObjectFunction = ( renderer, shadow, shadowType, use
|
|
|
53
52
|
|
|
54
53
|
if ( renderObjectFunction === undefined || ( renderObjectFunction.shadowType !== shadowType || renderObjectFunction.useVelocity !== useVelocity ) ) {
|
|
55
54
|
|
|
56
|
-
renderObjectFunction = ( object, scene, _camera, geometry, material, group,
|
|
55
|
+
renderObjectFunction = ( object, scene, _camera, geometry, material, group, lightsNode, clippingContext, passId ) => {
|
|
57
56
|
|
|
58
57
|
if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) {
|
|
59
58
|
|
|
@@ -65,7 +64,7 @@ export const getShadowRenderObjectFunction = ( renderer, shadow, shadowType, use
|
|
|
65
64
|
|
|
66
65
|
object.onBeforeShadow( renderer, object, _camera, shadow.camera, geometry, scene.overrideMaterial, group );
|
|
67
66
|
|
|
68
|
-
renderer.renderObject( object, scene, _camera, geometry, material, group,
|
|
67
|
+
renderer.renderObject( object, scene, _camera, geometry, material, group, lightsNode, clippingContext, passId );
|
|
69
68
|
|
|
70
69
|
object.onAfterShadow( renderer, object, _camera, shadow.camera, geometry, scene.overrideMaterial, group );
|
|
71
70
|
|
|
@@ -599,7 +598,7 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
599
598
|
|
|
600
599
|
if ( this.shadowMap.texture.isCubeTexture ) {
|
|
601
600
|
|
|
602
|
-
return cubeTexture( this.shadowMap.texture );
|
|
601
|
+
return cubeTexture( this.shadowMap.texture, equirectDirection() );
|
|
603
602
|
|
|
604
603
|
}
|
|
605
604
|
|
|
@@ -611,15 +610,36 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
611
610
|
|
|
612
611
|
return shadowOutput.toInspector( `${ inspectName } / Depth`, () => {
|
|
613
612
|
|
|
614
|
-
|
|
613
|
+
const shadowCameraNear = reference( 'near', 'float', this.shadow.camera );
|
|
614
|
+
const shadowCameraFar = reference( 'far', 'float', this.shadow.camera );
|
|
615
|
+
|
|
616
|
+
let depthNode;
|
|
615
617
|
|
|
616
618
|
if ( this.shadowMap.texture.isCubeTexture ) {
|
|
617
619
|
|
|
618
|
-
|
|
620
|
+
depthNode = cubeTexture( this.shadowMap.depthTexture, equirectDirection() ).r;
|
|
621
|
+
|
|
622
|
+
} else {
|
|
623
|
+
|
|
624
|
+
depthNode = texture( this.shadowMap.depthTexture ).r;
|
|
619
625
|
|
|
620
626
|
}
|
|
621
627
|
|
|
622
|
-
|
|
628
|
+
let linearDepth;
|
|
629
|
+
|
|
630
|
+
if ( this.shadow.camera.isPerspectiveCamera ) {
|
|
631
|
+
|
|
632
|
+
linearDepth = perspectiveDepthToViewZ( depthNode, shadowCameraNear, shadowCameraFar );
|
|
633
|
+
|
|
634
|
+
} else {
|
|
635
|
+
|
|
636
|
+
linearDepth = orthographicDepthToViewZ( depthNode, shadowCameraNear, shadowCameraFar );
|
|
637
|
+
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
linearDepth = viewZToOrthographicDepth( linearDepth, shadowCameraNear, shadowCameraFar );
|
|
641
|
+
|
|
642
|
+
return linearDepth.oneMinus();
|
|
623
643
|
|
|
624
644
|
} );
|
|
625
645
|
|
|
@@ -15,7 +15,7 @@ export const mx_select = /*@__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immut
|
|
|
15
15
|
const t = float( t_immutable ).toVar();
|
|
16
16
|
const b = bool( b_immutable ).toVar();
|
|
17
17
|
|
|
18
|
-
return select( b, t, f );
|
|
18
|
+
return select( b, t, f ).uniformFlow();
|
|
19
19
|
|
|
20
20
|
} ).setLayout( {
|
|
21
21
|
name: 'mx_select',
|
|
@@ -32,7 +32,7 @@ export const mx_negate_if = /*@__PURE__*/ Fn( ( [ val_immutable, b_immutable ] )
|
|
|
32
32
|
const b = bool( b_immutable ).toVar();
|
|
33
33
|
const val = float( val_immutable ).toVar();
|
|
34
34
|
|
|
35
|
-
return select( b, val.negate(), val );
|
|
35
|
+
return select( b, val.negate(), val ).uniformFlow();
|
|
36
36
|
|
|
37
37
|
} ).setLayout( {
|
|
38
38
|
name: 'mx_negate_if',
|
|
@@ -7,12 +7,12 @@ import { warn } from '../../utils.js';
|
|
|
7
7
|
* Represents a logical `if/else` statement. Can be used as an alternative
|
|
8
8
|
* to the `If()`/`Else()` syntax.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
10
|
+
* The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()`
|
|
11
|
+
* determine the outcome of the entire statement.
|
|
12
|
+
*
|
|
11
13
|
* ```js
|
|
12
14
|
* velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity );
|
|
13
15
|
* ```
|
|
14
|
-
* The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()`
|
|
15
|
-
* determine the outcome of the entire statement.
|
|
16
16
|
*
|
|
17
17
|
* @augments Node
|
|
18
18
|
*/
|
|
@@ -40,7 +40,7 @@ class MathNode extends TempNode {
|
|
|
40
40
|
|
|
41
41
|
let finalOp = new MathNode( method, aNode, bNode );
|
|
42
42
|
|
|
43
|
-
for ( let i =
|
|
43
|
+
for ( let i = 3; i < arguments.length - 1; i ++ ) {
|
|
44
44
|
|
|
45
45
|
finalOp = new MathNode( method, finalOp, arguments[ i ] );
|
|
46
46
|
|
|
@@ -181,25 +181,23 @@ class MathNode extends TempNode {
|
|
|
181
181
|
|
|
182
182
|
} else if ( method === MathNode.TRANSFORM_DIRECTION ) {
|
|
183
183
|
|
|
184
|
-
//
|
|
185
|
-
// upper-left 3x3 of matrix is assumed to be orthogonal
|
|
184
|
+
// pre-multiplies the direction by the matrix and normalizes the result
|
|
186
185
|
|
|
187
|
-
let
|
|
188
|
-
let tB = bNode;
|
|
186
|
+
let matrixNode, directionNode;
|
|
189
187
|
|
|
190
|
-
if ( builder.isMatrix(
|
|
188
|
+
if ( builder.isMatrix( aNode.getNodeType( builder ) ) ) {
|
|
191
189
|
|
|
192
|
-
|
|
190
|
+
matrixNode = aNode;
|
|
191
|
+
directionNode = bNode;
|
|
193
192
|
|
|
194
193
|
} else {
|
|
195
194
|
|
|
196
|
-
|
|
195
|
+
matrixNode = bNode;
|
|
196
|
+
directionNode = aNode;
|
|
197
197
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
outputNode = normalize( mulNode );
|
|
200
|
+
outputNode = normalize( mul( matrixNode, vec4( vec3( directionNode ), 0.0 ) ).xyz );
|
|
203
201
|
|
|
204
202
|
}
|
|
205
203
|
|
|
@@ -988,6 +986,34 @@ export const pow4 = ( x ) => mul( x, x, x, x );
|
|
|
988
986
|
*/
|
|
989
987
|
export const transformDirection = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.TRANSFORM_DIRECTION ).setParameterLength( 2 );
|
|
990
988
|
|
|
989
|
+
/**
|
|
990
|
+
* Transforms a normal vector by the view matrix and then normalizes the result.
|
|
991
|
+
*
|
|
992
|
+
* The upper-left 3x3 of the view matrix is assumed to be orthonormal, so the
|
|
993
|
+
* normal can be transformed directly without involving the normal matrix.
|
|
994
|
+
*
|
|
995
|
+
* @tsl
|
|
996
|
+
* @function
|
|
997
|
+
* @param {Node<vec3>} normal - The normal vector, given in world space.
|
|
998
|
+
* @param {Node<mat3|mat4>} viewMatrix - The view matrix.
|
|
999
|
+
* @returns {Node<vec3>} The normal vector in view space.
|
|
1000
|
+
*/
|
|
1001
|
+
export const transformNormalByViewMatrix = ( normal, viewMatrix ) => normalize( mul( viewMatrix, vec4( vec3( normal ), 0.0 ) ).xyz );
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Transforms a normal vector by the inverse of the view matrix and then normalizes the result.
|
|
1005
|
+
*
|
|
1006
|
+
* The upper-left 3x3 of the view matrix is assumed to be orthonormal, so post-multiplying
|
|
1007
|
+
* by the view matrix is equivalent to pre-multiplying by its inverse.
|
|
1008
|
+
*
|
|
1009
|
+
* @tsl
|
|
1010
|
+
* @function
|
|
1011
|
+
* @param {Node<vec3>} normal - The normal vector, given in view space.
|
|
1012
|
+
* @param {Node<mat3|mat4>} viewMatrix - The view matrix.
|
|
1013
|
+
* @returns {Node<vec3>} The normal vector in world space.
|
|
1014
|
+
*/
|
|
1015
|
+
export const transformNormalByInverseViewMatrix = ( normal, viewMatrix ) => normalize( vec4( vec3( normal ), 0.0 ).mul( viewMatrix ).xyz );
|
|
1016
|
+
|
|
991
1017
|
/**
|
|
992
1018
|
* Returns the cube root of a number.
|
|
993
1019
|
*
|
|
@@ -1188,6 +1214,8 @@ addMethodChaining( 'pow2', pow2 );
|
|
|
1188
1214
|
addMethodChaining( 'pow3', pow3 );
|
|
1189
1215
|
addMethodChaining( 'pow4', pow4 );
|
|
1190
1216
|
addMethodChaining( 'transformDirection', transformDirection );
|
|
1217
|
+
addMethodChaining( 'transformNormalByViewMatrix', transformNormalByViewMatrix );
|
|
1218
|
+
addMethodChaining( 'transformNormalByInverseViewMatrix', transformNormalByInverseViewMatrix );
|
|
1191
1219
|
addMethodChaining( 'mix', mixElement );
|
|
1192
1220
|
addMethodChaining( 'clamp', clamp );
|
|
1193
1221
|
addMethodChaining( 'refract', refract );
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { WebGLCoordinateSystem } from '../../constants.js';
|
|
2
2
|
import TempNode from '../core/TempNode.js';
|
|
3
|
-
import StackTrace from '../core/StackTrace.js';
|
|
4
3
|
import { addMethodChaining, Fn, int, nodeProxyIntent } from '../tsl/TSLCore.js';
|
|
5
|
-
import { warn } from '../../utils.js';
|
|
6
4
|
|
|
7
5
|
const _vectorOperators = {
|
|
8
6
|
'==': 'equal',
|
|
@@ -130,10 +128,16 @@ class OperatorNode extends TempNode {
|
|
|
130
128
|
|
|
131
129
|
return builder.getIntegerType( typeA );
|
|
132
130
|
|
|
133
|
-
} else if ( op === '
|
|
131
|
+
} else if ( op === '&&' || op === '||' || op === '^^' ) {
|
|
134
132
|
|
|
135
133
|
return 'bool';
|
|
136
134
|
|
|
135
|
+
} else if ( op === '!' ) {
|
|
136
|
+
|
|
137
|
+
const typeLength = builder.getTypeLength( typeA );
|
|
138
|
+
|
|
139
|
+
return typeLength > 1 ? `bvec${ typeLength }` : 'bool';
|
|
140
|
+
|
|
137
141
|
} else if ( op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=' ) {
|
|
138
142
|
|
|
139
143
|
const typeLength = Math.max( builder.getTypeLength( typeA ), builder.getTypeLength( typeB ) );
|
|
@@ -332,9 +336,23 @@ class OperatorNode extends TempNode {
|
|
|
332
336
|
|
|
333
337
|
}
|
|
334
338
|
|
|
335
|
-
} else if ( op === '!'
|
|
339
|
+
} else if ( op === '!' ) {
|
|
340
|
+
|
|
341
|
+
if ( isGLSL && builder.isVector( typeA ) ) {
|
|
342
|
+
|
|
343
|
+
return builder.format( `not( ${a} )`, output );
|
|
344
|
+
|
|
345
|
+
} else {
|
|
346
|
+
|
|
347
|
+
// WGSL and scalars on GLSL
|
|
348
|
+
|
|
349
|
+
return builder.format( `( ${op} ${a} )`, typeA, output );
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
} else if ( op === '~' ) {
|
|
336
354
|
|
|
337
|
-
return builder.format( `(${op}${a})`, typeA, output );
|
|
355
|
+
return builder.format( `( ${op} ${a} )`, typeA, output );
|
|
338
356
|
|
|
339
357
|
} else if ( fnOpSnippet ) {
|
|
340
358
|
|
|
@@ -732,21 +750,3 @@ addMethodChaining( 'incrementBefore', incrementBefore );
|
|
|
732
750
|
addMethodChaining( 'decrementBefore', decrementBefore );
|
|
733
751
|
addMethodChaining( 'increment', increment );
|
|
734
752
|
addMethodChaining( 'decrement', decrement );
|
|
735
|
-
|
|
736
|
-
/**
|
|
737
|
-
* @tsl
|
|
738
|
-
* @function
|
|
739
|
-
* @deprecated since r175. Use {@link mod} instead.
|
|
740
|
-
*
|
|
741
|
-
* @param {Node} a - The first input.
|
|
742
|
-
* @param {Node} b - The second input.
|
|
743
|
-
* @returns {OperatorNode}
|
|
744
|
-
*/
|
|
745
|
-
export const modInt = ( a, b ) => { // @deprecated, r175
|
|
746
|
-
|
|
747
|
-
warn( 'TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.', new StackTrace() );
|
|
748
|
-
return mod( int( a ), int( b ) );
|
|
749
|
-
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
addMethodChaining( 'modInt', modInt );
|