@onerjs/core 8.32.0 → 8.32.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/Audio/Interfaces/ISoundOptions.d.ts +1 -1
- package/Audio/Interfaces/ISoundOptions.js.map +1 -1
- package/Audio/audioEngine.d.ts +3 -4
- package/Audio/audioEngine.js +9 -6
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/sound.d.ts +33 -54
- package/Audio/sound.js +450 -718
- package/Audio/sound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +2 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
- package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
- package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
- package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
- package/AudioV2/abstractAudio/audioBus.js +24 -1
- package/AudioV2/abstractAudio/audioBus.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
- package/AudioV2/abstractAudio/staticSound.js +2 -2
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
- package/AudioV2/abstractAudio/streamingSound.js +2 -2
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
- package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
- package/AudioV2/webAudio/webAudioBus.js +4 -24
- package/AudioV2/webAudio/webAudioBus.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +1 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
- package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/arcRotateCamera.js +4 -5
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Compute/computeEffect.js +5 -1
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.d.ts +4 -0
- package/Compute/computeShader.js +9 -3
- package/Compute/computeShader.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.js +1 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +8 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +43 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +93 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
- package/FrameGraph/Passes/renderPass.js +2 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +2 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +6 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js +3 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +3 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +32 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +63 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +2 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js +6 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +3 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +31 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +60 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +93 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +183 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +4 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +4 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +3 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +21 -4
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
- package/FrameGraph/frameGraphRenderContext.js +14 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +5 -0
- package/FrameGraph/frameGraphTask.js +11 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +8 -0
- package/Inputs/scene.inputManager.js +33 -2
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/lightingVolume.d.ts +12 -6
- package/Lights/lightingVolume.js +218 -108
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +2 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +6 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -1
- package/Meshes/mesh.js +4 -3
- package/Meshes/mesh.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +9 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +8 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +102 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +9 -5
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +31 -13
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +39 -21
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +2 -2
- package/Particles/particle.js +4 -2
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +1 -1
- package/Particles/thinParticleSystem.function.js +2 -2
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/characterController.d.ts +42 -2
- package/Physics/v2/characterController.js +140 -46
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +10 -4
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/States/IStencilState.d.ts +48 -2
- package/States/IStencilState.js.map +1 -1
- package/States/alphaCullingState.d.ts +1 -0
- package/States/alphaCullingState.js +3 -0
- package/States/alphaCullingState.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
2
1
|
import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
|
|
3
2
|
import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
4
|
/**
|
|
5
5
|
* Block used to update particle position based on a flow map
|
|
6
6
|
*/
|
|
@@ -36,6 +36,14 @@ export declare class UpdateFlowMapBlock extends NodeParticleBlock {
|
|
|
36
36
|
* @param state defines the current build state
|
|
37
37
|
*/
|
|
38
38
|
_build(state: NodeParticleBuildState): void;
|
|
39
|
+
/**
|
|
40
|
+
* Serializes the block into a json object
|
|
41
|
+
* @returns The serialized object
|
|
42
|
+
*/
|
|
39
43
|
serialize(): any;
|
|
44
|
+
/**
|
|
45
|
+
* Deserializes the block from a json object
|
|
46
|
+
* @param serializationObject The object to deserialize from
|
|
47
|
+
*/
|
|
40
48
|
_deserialize(serializationObject: any): void;
|
|
41
49
|
}
|
|
@@ -85,11 +85,19 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
|
|
|
85
85
|
}
|
|
86
86
|
this.output._storedValue = system;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Serializes the block into a json object
|
|
90
|
+
* @returns The serialized object
|
|
91
|
+
*/
|
|
88
92
|
serialize() {
|
|
89
93
|
const serializationObject = super.serialize();
|
|
90
94
|
serializationObject.strength = this.strength;
|
|
91
95
|
return serializationObject;
|
|
92
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Deserializes the block from a json object
|
|
99
|
+
* @param serializationObject The object to deserialize from
|
|
100
|
+
*/
|
|
93
101
|
_deserialize(serializationObject) {
|
|
94
102
|
super._deserialize(serializationObject);
|
|
95
103
|
this.strength = serializationObject.strength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AACvE,OAAO,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UAAU,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;oDACnH;AA6GxB,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"../particleSourceTextureBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\nimport { FlowMap } from \"core/Particles/flowMap\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to update particle position based on a flow map\r\n */\r\nexport class UpdateFlowMapBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the strenght of the flow map effect\r\n */\r\n @editableInPropertyPage(\"strength\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public strength = 1;\r\n /**\r\n * Create a new UpdateFlowMapBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"flowMap\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the flowMap input component\r\n */\r\n public get flowMap(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateFlowMapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n const scene = state.scene;\r\n\r\n const flowMapTexture = this.flowMap.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n let flowMap: FlowMap;\r\n\r\n // eslint-disable-next-line github/no-then\r\n void flowMapTexture.extractTextureContentAsync().then((textureContent: Nullable<INodeParticleTextureData>) => {\r\n if (!textureContent) {\r\n return;\r\n }\r\n flowMap = new FlowMap(textureContent.width, textureContent.height, textureContent.data as Uint8ClampedArray);\r\n });\r\n\r\n const processFlowMap = (particle: Particle) => {\r\n const matrix = scene.getTransformMatrix();\r\n if (!flowMap) {\r\n // If the flow map is not ready, we skip processing\r\n return;\r\n }\r\n\r\n flowMap._processParticle(particle, this.strength * system._tempScaledUpdateSpeed, matrix);\r\n };\r\n\r\n const flowMapProcessing = {\r\n process: processFlowMap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(flowMapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = flowMapProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n /**\r\n * Serializes the block into a json object\r\n * @returns The serialized object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.strength = this.strength;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a json object\r\n * @param serializationObject The object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.strength = serializationObject.strength;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateFlowMapBlock\", UpdateFlowMapBlock);\r\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
|
|
2
|
+
import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to update particle position based on a noise texture
|
|
6
|
+
*/
|
|
7
|
+
export declare class UpdateNoiseBlock extends NodeParticleBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new UpdateNoiseBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
/**
|
|
14
|
+
* Gets the particle component
|
|
15
|
+
*/
|
|
16
|
+
get particle(): NodeParticleConnectionPoint;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the noiseTexture input component
|
|
19
|
+
*/
|
|
20
|
+
get noiseTexture(): NodeParticleConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the strength input component
|
|
23
|
+
*/
|
|
24
|
+
get strength(): NodeParticleConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeParticleConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current class name
|
|
31
|
+
* @returns the class name
|
|
32
|
+
*/
|
|
33
|
+
getClassName(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Builds the block
|
|
36
|
+
* @param state defines the current build state
|
|
37
|
+
*/
|
|
38
|
+
_build(state: NodeParticleBuildState): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { TmpVectors, Vector3 } from "../../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
5
|
+
import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block used to update particle position based on a noise texture
|
|
8
|
+
*/
|
|
9
|
+
export class UpdateNoiseBlock extends NodeParticleBlock {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new UpdateNoiseBlock
|
|
12
|
+
* @param name defines the block name
|
|
13
|
+
*/
|
|
14
|
+
constructor(name) {
|
|
15
|
+
super(name);
|
|
16
|
+
this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
|
|
17
|
+
this.registerInput("noiseTexture", NodeParticleBlockConnectionPointTypes.Texture);
|
|
18
|
+
this.registerInput("strength", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(100, 100, 100));
|
|
19
|
+
this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the particle component
|
|
23
|
+
*/
|
|
24
|
+
get particle() {
|
|
25
|
+
return this._inputs[0];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the noiseTexture input component
|
|
29
|
+
*/
|
|
30
|
+
get noiseTexture() {
|
|
31
|
+
return this._inputs[1];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets the strength input component
|
|
35
|
+
*/
|
|
36
|
+
get strength() {
|
|
37
|
+
return this._inputs[2];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the output component
|
|
41
|
+
*/
|
|
42
|
+
get output() {
|
|
43
|
+
return this._outputs[0];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current class name
|
|
47
|
+
* @returns the class name
|
|
48
|
+
*/
|
|
49
|
+
getClassName() {
|
|
50
|
+
return "UpdateNoiseBlock";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Builds the block
|
|
54
|
+
* @param state defines the current build state
|
|
55
|
+
*/
|
|
56
|
+
_build(state) {
|
|
57
|
+
const system = this.particle.getConnectedValue(state);
|
|
58
|
+
const strength = this.strength.getConnectedValue(state);
|
|
59
|
+
if (!strength) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const noiseTexture = this.noiseTexture.connectedPoint?.ownerBlock;
|
|
63
|
+
if (!noiseTexture) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const processNoiseAsync = async (particle) => {
|
|
67
|
+
// eslint-disable-next-line github/no-then
|
|
68
|
+
const textureContent = await noiseTexture.extractTextureContentAsync();
|
|
69
|
+
if (!textureContent) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!particle._randomNoiseCoordinates1) {
|
|
73
|
+
particle._randomNoiseCoordinates1 = new Vector3(Math.random(), Math.random(), Math.random());
|
|
74
|
+
}
|
|
75
|
+
if (!particle._randomNoiseCoordinates2) {
|
|
76
|
+
particle._randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());
|
|
77
|
+
}
|
|
78
|
+
const fetchedColorR = system._fetchR(particle._randomNoiseCoordinates1.x, particle._randomNoiseCoordinates1.y, textureContent.width, textureContent.height, textureContent.data);
|
|
79
|
+
const fetchedColorG = system._fetchR(particle._randomNoiseCoordinates1.z, particle._randomNoiseCoordinates2.x, textureContent.width, textureContent.height, textureContent.data);
|
|
80
|
+
const fetchedColorB = system._fetchR(particle._randomNoiseCoordinates2.y, particle._randomNoiseCoordinates2.z, textureContent.width, textureContent.height, textureContent.data);
|
|
81
|
+
const force = TmpVectors.Vector3[0];
|
|
82
|
+
const scaledForce = TmpVectors.Vector3[1];
|
|
83
|
+
force.copyFromFloats((2 * fetchedColorR - 1) * strength.x, (2 * fetchedColorG - 1) * strength.y, (2 * fetchedColorB - 1) * strength.z);
|
|
84
|
+
force.scaleToRef(system._tempScaledUpdateSpeed, scaledForce);
|
|
85
|
+
particle.direction.addInPlace(scaledForce);
|
|
86
|
+
};
|
|
87
|
+
const noiseProcessing = {
|
|
88
|
+
process: processNoiseAsync,
|
|
89
|
+
previousItem: null,
|
|
90
|
+
nextItem: null,
|
|
91
|
+
};
|
|
92
|
+
if (system._updateQueueStart) {
|
|
93
|
+
_ConnectAtTheEnd(noiseProcessing, system._updateQueueStart);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
system._updateQueueStart = noiseProcessing;
|
|
97
|
+
}
|
|
98
|
+
this.output._storedValue = system;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
RegisterClass("BABYLON.UpdateNoiseBlock", UpdateNoiseBlock);
|
|
102
|
+
//# sourceMappingURL=updateNoiseBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateNoiseBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateNoiseBlock.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAC7D,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,qCAAqC,CAAC,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;YAE1C,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEvI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;YAC7D,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,MAAM,eAAe,GAAG;YACpB,OAAO,EAAE,iBAAiB;YAC1B,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,eAAe,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"core/Particles/Node/Blocks/particleSourceTextureBlock\";\r\n\r\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update particle position based on a noise texture\r\n */\r\nexport class UpdateNoiseBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateNoiseBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"noiseTexture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"strength\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(100, 100, 100));\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the noiseTexture input component\r\n */\r\n public get noiseTexture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the strength input component\r\n */\r\n public get strength(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateNoiseBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const strength = this.strength.getConnectedValue(state) as Vector3;\r\n if (!strength) {\r\n return;\r\n }\r\n\r\n const noiseTexture = this.noiseTexture.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n if (!noiseTexture) {\r\n return;\r\n }\r\n\r\n const processNoiseAsync = async (particle: Particle) => {\r\n // eslint-disable-next-line github/no-then\r\n const textureContent: Nullable<INodeParticleTextureData> = await noiseTexture.extractTextureContentAsync();\r\n if (!textureContent) {\r\n return;\r\n }\r\n\r\n if (!particle._randomNoiseCoordinates1) {\r\n particle._randomNoiseCoordinates1 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n if (!particle._randomNoiseCoordinates2) {\r\n particle._randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n const fetchedColorR = system._fetchR(\r\n particle._randomNoiseCoordinates1.x,\r\n particle._randomNoiseCoordinates1.y,\r\n textureContent.width,\r\n textureContent.height,\r\n textureContent.data\r\n );\r\n const fetchedColorG = system._fetchR(\r\n particle._randomNoiseCoordinates1.z,\r\n particle._randomNoiseCoordinates2.x,\r\n textureContent.width,\r\n textureContent.height,\r\n textureContent.data\r\n );\r\n const fetchedColorB = system._fetchR(\r\n particle._randomNoiseCoordinates2.y,\r\n particle._randomNoiseCoordinates2.z,\r\n textureContent.width,\r\n textureContent.height,\r\n textureContent.data\r\n );\r\n\r\n const force = TmpVectors.Vector3[0];\r\n const scaledForce = TmpVectors.Vector3[1];\r\n\r\n force.copyFromFloats((2 * fetchedColorR - 1) * strength.x, (2 * fetchedColorG - 1) * strength.y, (2 * fetchedColorB - 1) * strength.z);\r\n\r\n force.scaleToRef(system._tempScaledUpdateSpeed, scaledForce);\r\n particle.direction.addInPlace(scaledForce);\r\n };\r\n\r\n const noiseProcessing = {\r\n process: processNoiseAsync,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(noiseProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = noiseProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateNoiseBlock\", UpdateNoiseBlock);\r\n"]}
|
|
@@ -16,6 +16,7 @@ export * from "./Update/basicSpriteUpdateBlock.js";
|
|
|
16
16
|
export * from "./Update/basicColorUpdateBlock.js";
|
|
17
17
|
export * from "./Update/updateSpriteCellIndexBlock.js";
|
|
18
18
|
export * from "./Update/updateFlowMapBlock.js";
|
|
19
|
+
export * from "./Update/updateNoiseBlock.js";
|
|
19
20
|
export * from "./Update/updateAttractorBlock.js";
|
|
20
21
|
export * from "./Update/alignAngleBlock.js";
|
|
21
22
|
export * from "./Emitters/index.js";
|
|
@@ -17,6 +17,7 @@ export * from "./Update/basicSpriteUpdateBlock.js";
|
|
|
17
17
|
export * from "./Update/basicColorUpdateBlock.js";
|
|
18
18
|
export * from "./Update/updateSpriteCellIndexBlock.js";
|
|
19
19
|
export * from "./Update/updateFlowMapBlock.js";
|
|
20
|
+
export * from "./Update/updateNoiseBlock.js";
|
|
20
21
|
export * from "./Update/updateAttractorBlock.js";
|
|
21
22
|
export * from "./Update/alignAngleBlock.js";
|
|
22
23
|
export * from "./Emitters/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
|
|
@@ -3,6 +3,14 @@ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnection
|
|
|
3
3
|
import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
|
|
4
4
|
import type { Nullable } from "../../../types.js";
|
|
5
5
|
import type { BaseTexture } from "../../../Materials/Textures/baseTexture.js";
|
|
6
|
+
/**
|
|
7
|
+
* Interface used to define texture data
|
|
8
|
+
*/
|
|
9
|
+
export interface INodeParticleTextureData {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
data: Uint8ClampedArray;
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* Block used to provide a texture for particles in a particle system
|
|
8
16
|
*/
|
|
@@ -49,11 +57,7 @@ export declare class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
49
57
|
* Gets the texture content as a promise
|
|
50
58
|
* @returns a promise that resolves to the texture content, including width, height, and pixel data
|
|
51
59
|
*/
|
|
52
|
-
extractTextureContentAsync(): Promise<
|
|
53
|
-
width: number;
|
|
54
|
-
height: number;
|
|
55
|
-
data: Uint8ClampedArray;
|
|
56
|
-
} | null>;
|
|
60
|
+
extractTextureContentAsync(): Promise<INodeParticleTextureData | null>;
|
|
57
61
|
/**
|
|
58
62
|
* Builds the block
|
|
59
63
|
* @param state defines the current build state
|
|
@@ -108,19 +108,37 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
const size = texture.getSize();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
if (texture.getContent) {
|
|
112
|
+
const proceduralTexture = texture;
|
|
113
|
+
proceduralTexture
|
|
114
|
+
.getContent()
|
|
115
|
+
// eslint-disable-next-line github/no-then
|
|
116
|
+
?.then((data) => {
|
|
117
|
+
this._cachedData = {
|
|
118
|
+
width: size.width,
|
|
119
|
+
height: size.height,
|
|
120
|
+
data: data,
|
|
121
|
+
};
|
|
122
|
+
resolve(this._cachedData);
|
|
123
|
+
})
|
|
124
|
+
// eslint-disable-next-line github/no-then
|
|
125
|
+
.catch(reject);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
TextureTools.GetTextureDataAsync(texture, size.width, size.height)
|
|
129
|
+
// eslint-disable-next-line github/no-then
|
|
130
|
+
.then((data) => {
|
|
131
|
+
this._cachedData = {
|
|
132
|
+
width: size.width,
|
|
133
|
+
height: size.height,
|
|
134
|
+
data: new Uint8ClampedArray(data),
|
|
135
|
+
};
|
|
136
|
+
texture.dispose();
|
|
137
|
+
resolve(this._cachedData);
|
|
138
|
+
})
|
|
139
|
+
// eslint-disable-next-line github/no-then
|
|
140
|
+
.catch(reject);
|
|
141
|
+
}
|
|
124
142
|
});
|
|
125
143
|
}
|
|
126
144
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AAGtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CA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CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC;QACnC,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC7D,CAAC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\nimport type { BaseTexture } from \"../../../Materials/Textures/baseTexture\";\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<BaseTexture> = null;\r\n private _cachedData: Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }> = null;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<BaseTexture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = (value as Texture).url || \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue && !this._sourceTexture) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue || this._sourceTexture;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);\r\n return;\r\n }\r\n\r\n this.texture._storedValue = new Texture(this._url, state.scene);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n if (!this._sourceTexture) {\r\n if (this.texture._storedValue) {\r\n this.texture._storedValue.dispose();\r\n this.texture._storedValue = null;\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AAatD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAW7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,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AmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACnC,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAErE,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,mBAAmB,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC7D,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC;QACnC,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC7D,CAAC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\nimport type { BaseTexture } from \"../../../Materials/Textures/baseTexture\";\r\nimport type { ProceduralTexture } from \"../../../Materials\";\r\n\r\n/**\r\n * Interface used to define texture data\r\n */\r\nexport interface INodeParticleTextureData {\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n}\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<BaseTexture> = null;\r\n private _cachedData: Nullable<INodeParticleTextureData> = null;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<BaseTexture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = (value as Texture).url || \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue && !this._sourceTexture) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue || this._sourceTexture;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n if (texture.getContent) {\r\n const proceduralTexture = texture as ProceduralTexture;\r\n proceduralTexture\r\n .getContent()\r\n // eslint-disable-next-line github/no-then\r\n ?.then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: data as Uint8ClampedArray,\r\n };\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n } else {\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);\r\n return;\r\n }\r\n\r\n this.texture._storedValue = new Texture(this._url, state.scene);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n if (!this._sourceTexture) {\r\n if (this.texture._storedValue) {\r\n this.texture._storedValue.dispose();\r\n this.texture._storedValue = null;\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
|
|
@@ -24,6 +24,7 @@ import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
|
24
24
|
import { UpdateAngleBlock } from "./Blocks/Update/updateAngleBlock.js";
|
|
25
25
|
import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
|
|
26
26
|
import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
|
|
27
|
+
import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
|
|
27
28
|
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
28
29
|
import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
|
|
29
30
|
/**
|
|
@@ -336,26 +337,29 @@ function _EmitterShapeBlock(oldSystem) {
|
|
|
336
337
|
* @returns The output connection point after all updates have been applied
|
|
337
338
|
*/
|
|
338
339
|
function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
339
|
-
let
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
let updatedParticle = inputParticle;
|
|
341
|
+
updatedParticle = _UpdateParticleColorBlockGroup(updatedParticle, oldSystem._colorGradients, context);
|
|
342
|
+
updatedParticle = _UpdateParticleAngleBlockGroup(updatedParticle, oldSystem, context);
|
|
342
343
|
if (oldSystem._velocityGradients && oldSystem._velocityGradients.length > 0) {
|
|
343
344
|
context.scaledDirection = _UpdateParticleVelocityGradientBlockGroup(oldSystem._velocityGradients, context);
|
|
344
345
|
}
|
|
345
346
|
if (oldSystem._dragGradients && oldSystem._dragGradients.length > 0) {
|
|
346
347
|
context.scaledDirection = _UpdateParticleDragGradientBlockGroup(oldSystem._dragGradients, context);
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
+
updatedParticle = _UpdateParticlePositionBlockGroup(updatedParticle, oldSystem.isLocal, context);
|
|
349
350
|
if (oldSystem._limitVelocityGradients && oldSystem._limitVelocityGradients.length > 0 && oldSystem.limitVelocityDamping !== 0) {
|
|
350
|
-
|
|
351
|
+
updatedParticle = _UpdateParticleVelocityLimitGradientBlockGroup(updatedParticle, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
|
|
352
|
+
}
|
|
353
|
+
if (oldSystem.noiseTexture && oldSystem.noiseStrength) {
|
|
354
|
+
updatedParticle = _UpdateParticleNoiseBlockGroup(updatedParticle, oldSystem.noiseTexture, oldSystem.noiseStrength);
|
|
351
355
|
}
|
|
352
356
|
if (oldSystem._sizeGradients && oldSystem._sizeGradients.length > 0) {
|
|
353
|
-
|
|
357
|
+
updatedParticle = _UpdateParticleSizeGradientBlockGroup(updatedParticle, oldSystem._sizeGradients, context);
|
|
354
358
|
}
|
|
355
359
|
if (oldSystem.gravity.equalsToFloats(0, 0, 0) === false) {
|
|
356
|
-
|
|
360
|
+
updatedParticle = _UpdateParticleGravityBlockGroup(updatedParticle, oldSystem.gravity);
|
|
357
361
|
}
|
|
358
|
-
return
|
|
362
|
+
return updatedParticle;
|
|
359
363
|
}
|
|
360
364
|
/**
|
|
361
365
|
* Creates the group of blocks that represent the particle color update
|
|
@@ -477,6 +481,20 @@ function _UpdateParticleVelocityLimitGradientBlockGroup(inputParticle, velocityL
|
|
|
477
481
|
compareSpeed.output.connectTo(updateDirection.direction);
|
|
478
482
|
return updateDirection.output;
|
|
479
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Creates the group of blocks that represent the particle noise update
|
|
486
|
+
* @param inputParticle The particle to update
|
|
487
|
+
* @param noiseTexture The noise texture
|
|
488
|
+
* @param noiseStrength The strength of the noise
|
|
489
|
+
* @returns The output of the group of blocks that represent the particle noise update
|
|
490
|
+
*/
|
|
491
|
+
function _UpdateParticleNoiseBlockGroup(inputParticle, noiseTexture, noiseStrength) {
|
|
492
|
+
const noiseUpdate = new UpdateNoiseBlock("Noise Update");
|
|
493
|
+
inputParticle.connectTo(noiseUpdate.particle);
|
|
494
|
+
_CreateTextureBlock(noiseTexture).connectTo(noiseUpdate.noiseTexture);
|
|
495
|
+
_CreateAndConnectInput("Noise Strength", noiseStrength, noiseUpdate.strength);
|
|
496
|
+
return noiseUpdate.output;
|
|
497
|
+
}
|
|
480
498
|
/**
|
|
481
499
|
* Creates the group of blocks that represent the particle drag update
|
|
482
500
|
* @param dragGradients The drag gradients
|
|
@@ -629,7 +647,7 @@ function _SystemBlockGroup(oldSystem, context) {
|
|
|
629
647
|
newSystem.isLocal = oldSystem.isLocal;
|
|
630
648
|
newSystem.disposeOnStop = oldSystem.disposeOnStop;
|
|
631
649
|
_SystemEmitRateValue(oldSystem, newSystem, context);
|
|
632
|
-
|
|
650
|
+
_CreateTextureBlock(oldSystem.particleTexture).connectTo(newSystem.texture);
|
|
633
651
|
_SystemTargetStopDuration(oldSystem, newSystem, context);
|
|
634
652
|
return newSystem;
|
|
635
653
|
}
|
|
@@ -649,18 +667,6 @@ function _SystemEmitRateValue(oldSystem, newSystem, context) {
|
|
|
649
667
|
newSystem.emitRate.value = oldSystem.emitRate;
|
|
650
668
|
}
|
|
651
669
|
}
|
|
652
|
-
function _SystemTextureBlock(oldSystem) {
|
|
653
|
-
// Texture
|
|
654
|
-
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
655
|
-
const url = oldSystem.particleTexture.url || "";
|
|
656
|
-
if (url) {
|
|
657
|
-
textureBlock.url = url;
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
textureBlock.sourceTexture = oldSystem.particleTexture;
|
|
661
|
-
}
|
|
662
|
-
return textureBlock.texture;
|
|
663
|
-
}
|
|
664
670
|
function _SystemTargetStopDuration(oldSystem, newSystem, context) {
|
|
665
671
|
// If something else uses the target stop duration (like a gradient),
|
|
666
672
|
// then the block is already created and stored in the context
|
|
@@ -823,4 +829,16 @@ function _CreateGradientValueBlockGroup(gradientStep, randomLockMode, prefix, in
|
|
|
823
829
|
}
|
|
824
830
|
return gradientValueBlock.output;
|
|
825
831
|
}
|
|
832
|
+
function _CreateTextureBlock(texture) {
|
|
833
|
+
// Texture
|
|
834
|
+
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
835
|
+
const url = texture.url || "";
|
|
836
|
+
if (url) {
|
|
837
|
+
textureBlock.url = url;
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
textureBlock.sourceTexture = texture;
|
|
841
|
+
}
|
|
842
|
+
return textureBlock.texture;
|
|
843
|
+
}
|
|
826
844
|
//# sourceMappingURL=nodeParticleSystemSet.helper.js.map
|