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
|
@@ -155,6 +155,7 @@ class PassMultipleTextureNode extends PassTextureNode {
|
|
|
155
155
|
newNode.depthNode = this.depthNode;
|
|
156
156
|
newNode.compareNode = this.compareNode;
|
|
157
157
|
newNode.gradNode = this.gradNode;
|
|
158
|
+
newNode.gatherNode = this.gatherNode;
|
|
158
159
|
newNode.offsetNode = this.offsetNode;
|
|
159
160
|
|
|
160
161
|
return newNode;
|
|
@@ -226,15 +227,6 @@ class PassNode extends TempNode {
|
|
|
226
227
|
*/
|
|
227
228
|
this.options = options;
|
|
228
229
|
|
|
229
|
-
/**
|
|
230
|
-
* The pass's pixel ratio. Will be kept automatically kept in sync with the renderer's pixel ratio.
|
|
231
|
-
*
|
|
232
|
-
* @private
|
|
233
|
-
* @type {number}
|
|
234
|
-
* @default 1
|
|
235
|
-
*/
|
|
236
|
-
this._pixelRatio = 1;
|
|
237
|
-
|
|
238
230
|
/**
|
|
239
231
|
* The pass's pixel width. Will be kept automatically kept in sync with the renderer's width.
|
|
240
232
|
* @private
|
|
@@ -251,14 +243,21 @@ class PassNode extends TempNode {
|
|
|
251
243
|
*/
|
|
252
244
|
this._height = 1;
|
|
253
245
|
|
|
254
|
-
const
|
|
255
|
-
depthTexture.isRenderTargetTexture = true;
|
|
256
|
-
//depthTexture.type = FloatType;
|
|
257
|
-
depthTexture.name = 'depth';
|
|
258
|
-
|
|
259
|
-
const renderTarget = new RenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: HalfFloatType, ...options, } );
|
|
246
|
+
const renderTarget = new RenderTarget( this._width, this._height, { type: HalfFloatType, ...options, } );
|
|
260
247
|
renderTarget.texture.name = 'output';
|
|
261
|
-
|
|
248
|
+
|
|
249
|
+
let depthTexture = null;
|
|
250
|
+
|
|
251
|
+
if ( this.scope === PassNode.DEPTH || options.depthBuffer !== false ) {
|
|
252
|
+
|
|
253
|
+
depthTexture = new DepthTexture();
|
|
254
|
+
depthTexture.isRenderTargetTexture = true;
|
|
255
|
+
//depthTexture.type = FloatType;
|
|
256
|
+
depthTexture.name = 'depth';
|
|
257
|
+
|
|
258
|
+
renderTarget.depthTexture = depthTexture;
|
|
259
|
+
|
|
260
|
+
}
|
|
262
261
|
|
|
263
262
|
/**
|
|
264
263
|
* The pass's render target.
|
|
@@ -310,13 +309,18 @@ class PassNode extends TempNode {
|
|
|
310
309
|
* A dictionary holding the internal result textures.
|
|
311
310
|
*
|
|
312
311
|
* @private
|
|
313
|
-
* @type {
|
|
312
|
+
* @type {{ output: Texture, depth: ?DepthTexture }}
|
|
314
313
|
*/
|
|
315
314
|
this._textures = {
|
|
316
|
-
output: renderTarget.texture
|
|
317
|
-
depth: depthTexture
|
|
315
|
+
output: renderTarget.texture
|
|
318
316
|
};
|
|
319
317
|
|
|
318
|
+
if ( depthTexture !== null ) {
|
|
319
|
+
|
|
320
|
+
this._textures.depth = depthTexture;
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
320
324
|
/**
|
|
321
325
|
* A dictionary holding the internal texture nodes.
|
|
322
326
|
*
|
|
@@ -567,6 +571,12 @@ class PassNode extends TempNode {
|
|
|
567
571
|
|
|
568
572
|
if ( texture === undefined ) {
|
|
569
573
|
|
|
574
|
+
if ( name === 'depth' ) {
|
|
575
|
+
|
|
576
|
+
throw new Error( 'THREE.PassNode: Depth texture is not available for this pass.' );
|
|
577
|
+
|
|
578
|
+
}
|
|
579
|
+
|
|
570
580
|
const refTexture = this.renderTarget.texture;
|
|
571
581
|
|
|
572
582
|
texture = refTexture.clone();
|
|
@@ -757,7 +767,7 @@ class PassNode extends TempNode {
|
|
|
757
767
|
|
|
758
768
|
this.renderTarget.texture.type = renderer.getOutputBufferType();
|
|
759
769
|
|
|
760
|
-
if ( renderer.reversedDepthBuffer === true ) {
|
|
770
|
+
if ( renderer.reversedDepthBuffer === true && this.renderTarget.depthTexture !== null ) {
|
|
761
771
|
|
|
762
772
|
this.renderTarget.depthTexture.type = FloatType;
|
|
763
773
|
|
|
@@ -773,13 +783,11 @@ class PassNode extends TempNode {
|
|
|
773
783
|
const { scene } = this;
|
|
774
784
|
|
|
775
785
|
let camera;
|
|
776
|
-
let pixelRatio;
|
|
777
786
|
|
|
778
787
|
const outputRenderTarget = renderer.getOutputRenderTarget();
|
|
779
788
|
|
|
780
789
|
if ( outputRenderTarget && outputRenderTarget.isXRRenderTarget === true ) {
|
|
781
790
|
|
|
782
|
-
pixelRatio = 1;
|
|
783
791
|
camera = renderer.xr.getCamera();
|
|
784
792
|
|
|
785
793
|
renderer.xr.updateCamera( camera );
|
|
@@ -789,14 +797,11 @@ class PassNode extends TempNode {
|
|
|
789
797
|
} else {
|
|
790
798
|
|
|
791
799
|
camera = this.camera;
|
|
792
|
-
pixelRatio = renderer.getPixelRatio();
|
|
793
800
|
|
|
794
|
-
renderer.
|
|
801
|
+
renderer.getDrawingBufferSize( _size );
|
|
795
802
|
|
|
796
803
|
}
|
|
797
804
|
|
|
798
|
-
this._pixelRatio = pixelRatio;
|
|
799
|
-
|
|
800
805
|
this.setSize( _size.width, _size.height );
|
|
801
806
|
|
|
802
807
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
@@ -881,8 +886,8 @@ class PassNode extends TempNode {
|
|
|
881
886
|
this._width = width;
|
|
882
887
|
this._height = height;
|
|
883
888
|
|
|
884
|
-
const effectiveWidth = Math.floor( this._width * this.
|
|
885
|
-
const effectiveHeight = Math.floor( this._height * this.
|
|
889
|
+
const effectiveWidth = Math.floor( this._width * this._resolutionScale );
|
|
890
|
+
const effectiveHeight = Math.floor( this._height * this._resolutionScale );
|
|
886
891
|
|
|
887
892
|
this.renderTarget.setSize( effectiveWidth, effectiveHeight );
|
|
888
893
|
|
|
@@ -890,7 +895,7 @@ class PassNode extends TempNode {
|
|
|
890
895
|
|
|
891
896
|
if ( this._scissor !== null ) {
|
|
892
897
|
|
|
893
|
-
this.renderTarget.scissor.copy( this._scissor ).multiplyScalar( this.
|
|
898
|
+
this.renderTarget.scissor.copy( this._scissor ).multiplyScalar( this._resolutionScale ).floor();
|
|
894
899
|
this.renderTarget.scissorTest = true;
|
|
895
900
|
|
|
896
901
|
} else {
|
|
@@ -903,7 +908,7 @@ class PassNode extends TempNode {
|
|
|
903
908
|
|
|
904
909
|
if ( this._viewport !== null ) {
|
|
905
910
|
|
|
906
|
-
this.renderTarget.viewport.copy( this._viewport ).multiplyScalar( this.
|
|
911
|
+
this.renderTarget.viewport.copy( this._viewport ).multiplyScalar( this._resolutionScale ).floor();
|
|
907
912
|
|
|
908
913
|
}
|
|
909
914
|
|
|
@@ -978,19 +983,6 @@ class PassNode extends TempNode {
|
|
|
978
983
|
|
|
979
984
|
}
|
|
980
985
|
|
|
981
|
-
/**
|
|
982
|
-
* Sets the pixel ratio the pass's render target and updates the size.
|
|
983
|
-
*
|
|
984
|
-
* @param {number} pixelRatio - The pixel ratio to set.
|
|
985
|
-
*/
|
|
986
|
-
setPixelRatio( pixelRatio ) {
|
|
987
|
-
|
|
988
|
-
this._pixelRatio = pixelRatio;
|
|
989
|
-
|
|
990
|
-
this.setSize( this._width, this._height );
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
986
|
/**
|
|
995
987
|
* Frees internal resources. Should be called when the node is no longer in use.
|
|
996
988
|
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Fn, vec4 } from '../tsl/TSLCore.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Premultiplies the RGB channels of a color by its alpha channel.
|
|
5
|
+
*
|
|
6
|
+
* This function is useful for converting a non-premultiplied alpha color
|
|
7
|
+
* into a premultiplied alpha format, where the RGB values are scaled
|
|
8
|
+
* by the alpha value. Premultiplied alpha is often used in graphics
|
|
9
|
+
* rendering for certain operations, such as compositing and image processing.
|
|
10
|
+
*
|
|
11
|
+
* @tsl
|
|
12
|
+
* @function
|
|
13
|
+
* @param {Node<vec4>} color - The input color with non-premultiplied alpha.
|
|
14
|
+
* @return {Node<vec4>} The color with premultiplied alpha.
|
|
15
|
+
*/
|
|
16
|
+
export const premultiplyAlpha = /*@__PURE__*/ Fn( ( [ color ] ) => {
|
|
17
|
+
|
|
18
|
+
return vec4( color.rgb.mul( color.a ), color.a );
|
|
19
|
+
|
|
20
|
+
}, { color: 'vec4', return: 'vec4' } );
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Unpremultiplies the RGB channels of a color by its alpha channel.
|
|
24
|
+
*
|
|
25
|
+
* This function is useful for converting a premultiplied alpha color
|
|
26
|
+
* back into a non-premultiplied alpha format, where the RGB values are
|
|
27
|
+
* divided by the alpha value. Unpremultiplied alpha is often used in graphics
|
|
28
|
+
* rendering for certain operations, such as compositing and image processing.
|
|
29
|
+
*
|
|
30
|
+
* @tsl
|
|
31
|
+
* @function
|
|
32
|
+
* @param {Node<vec4>} color - The input color with premultiplied alpha.
|
|
33
|
+
* @return {Node<vec4>} The color with non-premultiplied alpha.
|
|
34
|
+
*/
|
|
35
|
+
export const unpremultiplyAlpha = /*@__PURE__*/ Fn( ( [ color ] ) => {
|
|
36
|
+
|
|
37
|
+
return color.a.equal( 0 ).select( vec4( 0 ), vec4( color.rgb.div( color.a ), color.a ) );
|
|
38
|
+
|
|
39
|
+
}, { color: 'vec4', return: 'vec4' } );
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js';
|
|
2
|
+
import { addMethodChaining, nodeObject, vec4 } from '../tsl/TSLCore.js';
|
|
3
|
+
import { premultiplyAlpha, unpremultiplyAlpha } from './PremultiplyAlphaFunctions.js';
|
|
3
4
|
|
|
4
5
|
import { NoColorSpace, NoToneMapping } from '../../constants.js';
|
|
5
6
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
@@ -108,9 +109,15 @@ class RenderOutputNode extends TempNode {
|
|
|
108
109
|
|
|
109
110
|
let outputNode = this.colorNode || context.color;
|
|
110
111
|
|
|
111
|
-
//
|
|
112
|
+
// clamp alpha
|
|
113
|
+
outputNode = vec4( outputNode.rgb, outputNode.a.clamp( 0.0, 1.0 ) );
|
|
114
|
+
|
|
115
|
+
// unpremultiply
|
|
116
|
+
outputNode = unpremultiplyAlpha( outputNode );
|
|
112
117
|
|
|
118
|
+
// tone mapping
|
|
113
119
|
const toneMapping = ( this._toneMapping !== null ? this._toneMapping : context.toneMapping ) || NoToneMapping;
|
|
120
|
+
|
|
114
121
|
const outputColorSpace = ( this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace ) || NoColorSpace;
|
|
115
122
|
|
|
116
123
|
if ( toneMapping !== NoToneMapping ) {
|
|
@@ -120,13 +127,15 @@ class RenderOutputNode extends TempNode {
|
|
|
120
127
|
}
|
|
121
128
|
|
|
122
129
|
// working to output color space
|
|
123
|
-
|
|
124
130
|
if ( outputColorSpace !== NoColorSpace && outputColorSpace !== ColorManagement.workingColorSpace ) {
|
|
125
131
|
|
|
126
132
|
outputNode = outputNode.workingToColorSpace( outputColorSpace );
|
|
127
133
|
|
|
128
134
|
}
|
|
129
135
|
|
|
136
|
+
// premultiply in output color space
|
|
137
|
+
outputNode = premultiplyAlpha( outputNode );
|
|
138
|
+
|
|
130
139
|
return outputNode;
|
|
131
140
|
|
|
132
141
|
}
|
|
@@ -38,15 +38,19 @@ class VolumetricLightingModel extends LightingModel {
|
|
|
38
38
|
// This approach dynamically changes the direction of the ray,
|
|
39
39
|
// prioritizing the ray from the camera to the object if it is inside the mesh, and from the object to the camera if it is far away.
|
|
40
40
|
|
|
41
|
+
const isFrontToBack = property( 'bool' );
|
|
42
|
+
|
|
41
43
|
If( cameraPosition.sub( positionWorld ).length().greaterThan( modelRadius.mul( 2 ) ), () => {
|
|
42
44
|
|
|
43
45
|
startPos.assign( cameraPosition );
|
|
44
46
|
endPos.assign( positionWorld );
|
|
47
|
+
isFrontToBack.assign( true );
|
|
45
48
|
|
|
46
49
|
} ).Else( () => {
|
|
47
50
|
|
|
48
51
|
startPos.assign( positionWorld );
|
|
49
52
|
endPos.assign( cameraPosition );
|
|
53
|
+
isFrontToBack.assign( false );
|
|
50
54
|
|
|
51
55
|
} );
|
|
52
56
|
|
|
@@ -90,12 +94,17 @@ class VolumetricLightingModel extends LightingModel {
|
|
|
90
94
|
scatteringDensity.assign( 0 );
|
|
91
95
|
|
|
92
96
|
let scatteringNode;
|
|
97
|
+
let scatteringEmissiveNode;
|
|
93
98
|
|
|
94
99
|
if ( material.scatteringNode ) {
|
|
95
100
|
|
|
96
|
-
scatteringNode = material.scatteringNode( {
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
scatteringNode = material.scatteringNode( { positionRay } );
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ( material.scatteringEmissiveNode ) {
|
|
106
|
+
|
|
107
|
+
scatteringEmissiveNode = material.scatteringEmissiveNode( { positionRay } );
|
|
99
108
|
|
|
100
109
|
}
|
|
101
110
|
|
|
@@ -107,9 +116,28 @@ class VolumetricLightingModel extends LightingModel {
|
|
|
107
116
|
|
|
108
117
|
}
|
|
109
118
|
|
|
119
|
+
const stepLight = scatteringDensity.mul( 0.01 ).toVar();
|
|
120
|
+
|
|
121
|
+
if ( scatteringEmissiveNode ) {
|
|
122
|
+
|
|
123
|
+
stepLight.addAssign( scatteringEmissiveNode.mul( 0.01 ) );
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
110
127
|
// beer's law
|
|
111
128
|
|
|
112
129
|
const falloff = scatteringDensity.mul( .01 ).negate().mul( stepSize ).exp();
|
|
130
|
+
|
|
131
|
+
If( isFrontToBack, () => {
|
|
132
|
+
|
|
133
|
+
outgoingRayLight.addAssign( stepLight.mul( transmittance ).mul( stepSize ) );
|
|
134
|
+
|
|
135
|
+
} ).Else( () => {
|
|
136
|
+
|
|
137
|
+
outgoingRayLight.assign( outgoingRayLight.mul( falloff ).add( stepLight.mul( stepSize ) ) );
|
|
138
|
+
|
|
139
|
+
} );
|
|
140
|
+
|
|
113
141
|
transmittance.mulAssign( falloff );
|
|
114
142
|
|
|
115
143
|
// move along the ray
|
|
@@ -118,7 +146,7 @@ class VolumetricLightingModel extends LightingModel {
|
|
|
118
146
|
|
|
119
147
|
} );
|
|
120
148
|
|
|
121
|
-
|
|
149
|
+
|
|
122
150
|
|
|
123
151
|
}
|
|
124
152
|
|
|
@@ -144,14 +172,19 @@ class VolumetricLightingModel extends LightingModel {
|
|
|
144
172
|
|
|
145
173
|
direct( { lightNode, lightColor }, builder ) {
|
|
146
174
|
|
|
147
|
-
// Ignore lights with infinite distance
|
|
175
|
+
// Ignore non-analytical lights and lights with infinite distance
|
|
148
176
|
|
|
149
|
-
if ( lightNode.light.distance === undefined ) return;
|
|
177
|
+
if ( lightNode.isAnalyticLightNode !== true || lightNode.light.distance === undefined ) return;
|
|
150
178
|
|
|
151
179
|
// TODO: We need a viewportOpaque*() ( output, depth ) to fit with modern rendering approaches
|
|
152
180
|
|
|
153
181
|
const directLight = lightColor.xyz.toVar();
|
|
154
|
-
|
|
182
|
+
|
|
183
|
+
if ( lightNode.shadowNode !== null ) {
|
|
184
|
+
|
|
185
|
+
directLight.mulAssign( lightNode.shadowNode ); // it no should be necessary if used in the same render pass
|
|
186
|
+
|
|
187
|
+
}
|
|
155
188
|
|
|
156
189
|
this.scatteringLight( directLight, builder );
|
|
157
190
|
|
|
@@ -35,7 +35,7 @@ class WorkgroupInfoElementNode extends ArrayElementNode {
|
|
|
35
35
|
|
|
36
36
|
let snippet;
|
|
37
37
|
|
|
38
|
-
const isAssignContext = builder.
|
|
38
|
+
const isAssignContext = builder.isContextAssign();
|
|
39
39
|
snippet = super.generate( builder );
|
|
40
40
|
|
|
41
41
|
if ( isAssignContext !== true ) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import LightingNode from './LightingNode.js';
|
|
2
2
|
import { isolate } from '../core/IsolateNode.js';
|
|
3
3
|
import { roughness, clearcoatRoughness } from '../core/PropertyNode.js';
|
|
4
|
-
import {
|
|
4
|
+
import { cameraWorldMatrix } from '../accessors/Camera.js';
|
|
5
5
|
import { normalView, clearcoatNormalView, normalWorld } from '../accessors/Normal.js';
|
|
6
6
|
import { positionViewDirection } from '../accessors/Position.js';
|
|
7
7
|
import { float, pow4 } from '../tsl/TSLBase.js';
|
|
@@ -144,7 +144,7 @@ const createRadianceContext = ( roughnessNode, normalViewNode ) => {
|
|
|
144
144
|
// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
|
|
145
145
|
reflectVec = pow4( roughnessNode ).mix( reflectVec, normalViewNode ).normalize();
|
|
146
146
|
|
|
147
|
-
reflectVec = reflectVec.transformDirection(
|
|
147
|
+
reflectVec = reflectVec.transformDirection( cameraWorldMatrix );
|
|
148
148
|
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -15,6 +15,25 @@ class IESSpotLightNode extends SpotLightNode {
|
|
|
15
15
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a new IES spot light node.
|
|
20
|
+
*
|
|
21
|
+
* @param {?SpotLight} [light=null] - The spot light source.
|
|
22
|
+
*/
|
|
23
|
+
constructor( light = null ) {
|
|
24
|
+
|
|
25
|
+
super( light );
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The texture node representing the IES texture.
|
|
29
|
+
*
|
|
30
|
+
* @type {?TextureNode}
|
|
31
|
+
* @default null
|
|
32
|
+
*/
|
|
33
|
+
this._iesTextureNode = null;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
/**
|
|
19
38
|
* Overwrites the default implementation to compute an IES conform spot attenuation.
|
|
20
39
|
*
|
|
@@ -32,11 +51,13 @@ class IESSpotLightNode extends SpotLightNode {
|
|
|
32
51
|
|
|
33
52
|
const angle = angleCosine.acos().mul( 1.0 / Math.PI );
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
this._iesTextureNode = texture( iesMap, vec2( angle, 0 ), 0 );
|
|
55
|
+
|
|
56
|
+
spotAttenuation = this._iesTextureNode.r;
|
|
36
57
|
|
|
37
58
|
} else {
|
|
38
59
|
|
|
39
|
-
spotAttenuation = super.getSpotAttenuation( angleCosine );
|
|
60
|
+
spotAttenuation = super.getSpotAttenuation( builder, angleCosine );
|
|
40
61
|
|
|
41
62
|
}
|
|
42
63
|
|
|
@@ -44,6 +65,23 @@ class IESSpotLightNode extends SpotLightNode {
|
|
|
44
65
|
|
|
45
66
|
}
|
|
46
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Overwritten to update the IES spot light texture.
|
|
70
|
+
*
|
|
71
|
+
* @param {NodeFrame} frame - A reference to the current node frame.
|
|
72
|
+
*/
|
|
73
|
+
update( frame ) {
|
|
74
|
+
|
|
75
|
+
super.update( frame );
|
|
76
|
+
|
|
77
|
+
if ( this._iesTextureNode !== null && this.light.iesMap ) {
|
|
78
|
+
|
|
79
|
+
this._iesTextureNode.value = this.light.iesMap;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
47
85
|
}
|
|
48
86
|
|
|
49
87
|
export default IESSpotLightNode;
|
|
@@ -21,10 +21,11 @@ class LightingContextNode extends ContextNode {
|
|
|
21
21
|
*
|
|
22
22
|
* @param {LightsNode} lightsNode - The lights node.
|
|
23
23
|
* @param {?LightingModel} [lightingModel=null] - The current lighting model.
|
|
24
|
+
* @param {?Array<LightingNode>} materialLightings - The material lightings nodes.
|
|
24
25
|
* @param {?Node<vec3>} [backdropNode=null] - A backdrop node.
|
|
25
26
|
* @param {?Node<float>} [backdropAlphaNode=null] - A backdrop alpha node.
|
|
26
27
|
*/
|
|
27
|
-
constructor( lightsNode, lightingModel = null, backdropNode = null, backdropAlphaNode = null ) {
|
|
28
|
+
constructor( lightsNode, lightingModel = null, materialLightings = [], backdropNode = null, backdropAlphaNode = null ) {
|
|
28
29
|
|
|
29
30
|
super( lightsNode );
|
|
30
31
|
|
|
@@ -36,6 +37,12 @@ class LightingContextNode extends ContextNode {
|
|
|
36
37
|
*/
|
|
37
38
|
this.lightingModel = lightingModel;
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @type {?Array<LightingNode>}
|
|
42
|
+
* @default []
|
|
43
|
+
*/
|
|
44
|
+
this.materialLightings = materialLightings;
|
|
45
|
+
|
|
39
46
|
/**
|
|
40
47
|
* A backdrop node.
|
|
41
48
|
*
|
|
@@ -71,7 +78,7 @@ class LightingContextNode extends ContextNode {
|
|
|
71
78
|
*/
|
|
72
79
|
getContext() {
|
|
73
80
|
|
|
74
|
-
const { backdropNode, backdropAlphaNode } = this;
|
|
81
|
+
const { materialLightings, backdropNode, backdropAlphaNode } = this;
|
|
75
82
|
|
|
76
83
|
const directDiffuse = vec3().toVar( 'directDiffuse' ),
|
|
77
84
|
directSpecular = vec3().toVar( 'directSpecular' ),
|
|
@@ -91,6 +98,7 @@ class LightingContextNode extends ContextNode {
|
|
|
91
98
|
iblIrradiance: vec3().toVar( 'iblIrradiance' ),
|
|
92
99
|
ambientOcclusion: float( 1 ).toVar( 'ambientOcclusion' ),
|
|
93
100
|
reflectedLight,
|
|
101
|
+
materialLightings,
|
|
94
102
|
backdrop: backdropNode,
|
|
95
103
|
backdropAlpha: backdropAlphaNode
|
|
96
104
|
};
|