@babylonjs/core 7.2.2 → 7.3.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/Animations/runtimeAnimation.d.ts +1 -0
- package/Animations/runtimeAnimation.js +12 -3
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +2 -2
- package/Audio/audioEngine.js.map +1 -1
- package/Bones/boneLookController.js +3 -0
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/buffer.d.ts +5 -5
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/storageBuffer.d.ts +2 -2
- package/Buffers/storageBuffer.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Compute/computeEffect.d.ts +3 -3
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.d.ts +10 -2
- package/Compute/computeShader.js +53 -35
- package/Compute/computeShader.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.d.ts +2 -2
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.d.ts +4 -4
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.d.ts +2 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.alpha.d.ts +10 -0
- package/Engines/AbstractEngine/abstractEngine.alpha.js +29 -0
- package/Engines/AbstractEngine/abstractEngine.alpha.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.d.ts +17 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +138 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.dom.d.ts +61 -0
- package/Engines/AbstractEngine/abstractEngine.dom.js +27 -0
- package/Engines/AbstractEngine/abstractEngine.dom.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.d.ts +30 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.js +48 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.query.d.ts +122 -0
- package/Engines/AbstractEngine/abstractEngine.query.js +175 -0
- package/Engines/AbstractEngine/abstractEngine.query.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.d.ts +26 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js +29 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.states.d.ts +162 -0
- package/Engines/AbstractEngine/abstractEngine.states.js +105 -0
- package/Engines/AbstractEngine/abstractEngine.states.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.texture.d.ts +16 -0
- package/Engines/AbstractEngine/abstractEngine.texture.js +11 -0
- package/Engines/AbstractEngine/abstractEngine.texture.js.map +1 -0
- package/Engines/AbstractEngine/index.d.ts +8 -0
- package/Engines/AbstractEngine/index.js +10 -0
- package/Engines/AbstractEngine/index.js.map +1 -0
- package/Engines/Extensions/engine.alpha.d.ts +0 -24
- package/Engines/Extensions/engine.alpha.js +0 -35
- package/Engines/Extensions/engine.alpha.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +15 -2
- package/Engines/Extensions/engine.computeShader.js +5 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +0 -8
- package/Engines/Extensions/engine.cubeTexture.js +2 -135
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.debugging.d.ts +2 -2
- package/Engines/Extensions/engine.debugging.js +5 -5
- package/Engines/Extensions/engine.debugging.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.js +3 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +5 -120
- package/Engines/Extensions/engine.query.js +14 -150
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +0 -9
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.views.d.ts +3 -2
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Processors/iShaderProcessor.d.ts +2 -2
- package/Engines/Processors/iShaderProcessor.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +3 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +12 -9
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.d.ts +2 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.alpha.d.ts +35 -0
- package/Engines/WebGPU/Extensions/engine.alpha.js +4 -4
- package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.d.ts +9 -0
- package/Engines/WebGPU/Extensions/engine.computeShader.js +13 -2
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.d.ts +78 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.d.ts +27 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +3 -3
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +16 -0
- package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +55 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.d.ts +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +1 -0
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +185 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.readTexture.d.ts +10 -1
- package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.d.ts +38 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.d.ts +13 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +38 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +10 -0
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.d.ts +14 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +2 -2
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +2 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +2 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.d.ts +1695 -0
- package/Engines/abstractEngine.js +1362 -0
- package/Engines/abstractEngine.js.map +1 -0
- package/Engines/engine.common.d.ts +39 -0
- package/Engines/engine.common.js +226 -0
- package/Engines/engine.common.js.map +1 -0
- package/Engines/engine.d.ts +40 -447
- package/Engines/engine.js +64 -810
- package/Engines/engine.js.map +1 -1
- package/Engines/engineFactory.d.ts +2 -2
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/engineStore.d.ts +4 -4
- package/Engines/engineStore.js.map +1 -1
- package/Engines/index.d.ts +3 -0
- package/Engines/index.js +3 -0
- package/Engines/index.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -2
- package/Engines/nullEngine.js +2 -3
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +3 -3
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +34 -597
- package/Engines/thinEngine.js +85 -1143
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +147 -109
- package/Engines/webgpuEngine.js +249 -162
- package/Engines/webgpuEngine.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +5 -4
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Layers/effectLayer.d.ts +2 -2
- package/Layers/effectLayer.js +3 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/glowLayer.js +3 -3
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +3 -3
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layerSceneComponent.js.map +1 -1
- package/Loading/loadingScreen.js +2 -2
- package/Loading/loadingScreen.js.map +1 -1
- package/Loading/sceneLoader.d.ts +3 -3
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +6 -6
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +2 -3
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +5 -5
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +4 -4
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +4 -4
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +8 -7
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +9 -5
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +4 -2
- package/Materials/Node/Blocks/Dual/textureBlock.js +43 -21
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +3 -3
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +9 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +16 -8
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +3 -3
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/twirlBlock.js +9 -9
- package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +6 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +36 -12
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +9 -9
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -21
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +6 -6
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +5 -0
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +2 -2
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +3 -3
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +2 -2
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +5 -5
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +12 -12
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +7 -7
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +10 -3
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/addBlock.js +2 -1
- package/Materials/Node/Blocks/addBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +3 -1
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +1 -1
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +9 -7
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorSplitterBlock.js +5 -5
- package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.js +18 -12
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/crossBlock.js +1 -1
- package/Materials/Node/Blocks/crossBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +48 -53
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -1
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/desaturateBlock.js +5 -4
- package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
- package/Materials/Node/Blocks/distanceBlock.js +1 -1
- package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
- package/Materials/Node/Blocks/divideBlock.js +2 -1
- package/Materials/Node/Blocks/divideBlock.js.map +1 -1
- package/Materials/Node/Blocks/dotBlock.js +1 -1
- package/Materials/Node/Blocks/dotBlock.js.map +1 -1
- package/Materials/Node/Blocks/elbowBlock.js +1 -1
- package/Materials/Node/Blocks/elbowBlock.js.map +1 -1
- package/Materials/Node/Blocks/fresnelBlock.js +1 -1
- package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.js +8 -7
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/lengthBlock.js +1 -1
- package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
- package/Materials/Node/Blocks/lerpBlock.js +1 -1
- package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixDeterminantBlock.js +1 -1
- package/Materials/Node/Blocks/matrixDeterminantBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixTransposeBlock.js +1 -1
- package/Materials/Node/Blocks/matrixTransposeBlock.js.map +1 -1
- package/Materials/Node/Blocks/maxBlock.js +1 -1
- package/Materials/Node/Blocks/maxBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/minBlock.js +1 -1
- package/Materials/Node/Blocks/minBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -1
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js +2 -1
- package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/negateBlock.js +1 -1
- package/Materials/Node/Blocks/negateBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalBlendBlock.js +1 -1
- package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/powBlock.js +1 -1
- package/Materials/Node/Blocks/powBlock.js.map +1 -1
- package/Materials/Node/Blocks/randomNumberBlock.js +1 -1
- package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js +2 -2
- package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
- package/Materials/Node/Blocks/reflectBlock.js +1 -1
- package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
- package/Materials/Node/Blocks/refractBlock.js +1 -1
- package/Materials/Node/Blocks/refractBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +1 -1
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/replaceColorBlock.js +1 -1
- package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
- package/Materials/Node/Blocks/scaleBlock.js +1 -1
- package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/smoothStepBlock.js +3 -2
- package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
- package/Materials/Node/Blocks/stepBlock.js +1 -1
- package/Materials/Node/Blocks/stepBlock.js.map +1 -1
- package/Materials/Node/Blocks/subtractBlock.js +2 -1
- package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +18 -10
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +2 -2
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +30 -27
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorSplitterBlock.js +9 -8
- package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +19 -8
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.js +3 -3
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -3
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +9 -3
- package/Materials/Node/nodeMaterial.js +29 -4
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +0 -1
- package/Materials/Node/nodeMaterialBlock.js +6 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +4 -0
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -0
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +35 -3
- package/Materials/Node/nodeMaterialBuildState.js +169 -16
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +18 -4
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +60 -9
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.d.ts +2 -2
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Loaders/basisTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.d.ts +1 -0
- package/Materials/Textures/MultiviewRenderTarget.js +1 -0
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +3 -3
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +2 -2
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +3 -2
- package/Materials/Textures/cubeTexture.js +1 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.d.ts +2 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +2 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +3 -3
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.d.ts +10 -10
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +4 -4
- package/Materials/Textures/renderTargetTexture.js +4 -4
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinTexture.d.ts +3 -3
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/drawWrapper.d.ts +2 -3
- package/Materials/drawWrapper.functions.d.ts +8 -0
- package/Materials/drawWrapper.functions.js +9 -0
- package/Materials/drawWrapper.functions.js.map +1 -0
- package/Materials/drawWrapper.js +0 -3
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +4 -5
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.d.ts +4 -4
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/materialFlags.d.ts +6 -0
- package/Materials/materialFlags.js +15 -1
- package/Materials/materialFlags.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +4 -4
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +2 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +1 -1
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +2 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +6 -0
- package/Meshes/Builders/greasedLineBuilder.js +15 -8
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +4 -3
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -2
- package/Meshes/geometry.js +3 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +2 -2
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +2 -2
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/dds.d.ts +3 -2
- package/Misc/dds.js +2 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/dumpTools.d.ts +2 -2
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/fileTools.js +3 -3
- package/Misc/fileTools.js.map +1 -1
- package/Misc/filesInput.d.ts +2 -2
- package/Misc/filesInput.js.map +1 -1
- package/Misc/khronosTextureContainer2.d.ts +8 -2
- package/Misc/khronosTextureContainer2.js +3 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/minMaxReducer.d.ts +2 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +6 -6
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +7 -7
- package/Misc/tools.functions.d.ts +26 -0
- package/Misc/tools.functions.js +62 -0
- package/Misc/tools.functions.js.map +1 -1
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +3 -3
- package/Misc/videoRecorder.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +2 -2
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/computeShaderParticleSystem.d.ts +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +3 -3
- package/Particles/gpuParticleSystem.js +2 -2
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.js +1 -1
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +3 -3
- package/Particles/particleSystem.js +3 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +2 -2
- package/Particles/particleSystemComponent.js +2 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/subEmitter.d.ts +3 -3
- package/Particles/subEmitter.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +2 -2
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/physicsBody.js +3 -3
- package/Physics/v2/physicsBody.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +2 -2
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.d.ts +2 -2
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +2 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.d.ts +2 -2
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.d.ts +2 -2
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +2 -2
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.d.ts +2 -2
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -2
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +1 -1
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.d.ts +2 -2
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/displayPassPostProcess.d.ts +2 -2
- package/PostProcesses/displayPassPostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.d.ts +2 -2
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.d.ts +2 -2
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.d.ts +2 -2
- package/PostProcesses/fxaaPostProcess.js +2 -2
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.d.ts +2 -2
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.d.ts +2 -2
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.d.ts +2 -2
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +3 -3
- package/PostProcesses/passPostProcess.js +2 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +4 -5
- package/PostProcesses/postProcess.js +3 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +2 -2
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.d.ts +2 -2
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.d.ts +2 -2
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.d.ts +2 -2
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.d.ts +2 -2
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +2 -2
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +24 -18
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +19 -3
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +4 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/pbr.fragment.js +7 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +2 -0
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fresnelFunction.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fresnelFunction.js +13 -0
- package/ShadersWGSL/ShadersInclude/fresnelFunction.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/helperFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +68 -0
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -0
- package/Sprites/spriteRenderer.d.ts +2 -2
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.d.ts +2 -2
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.d.ts +1 -1
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js +1 -3
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +2 -2
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.js.map +1 -1
- package/node.d.ts +2 -2
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +3 -3
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/videoRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAgEhC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAOtB;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,MAAc,EAAE,MAA0B;QAChE,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3D,OAAO,CAAC,CAAC,YAAY,IAAI,OAAa,YAAa,CAAC,aAAa,KAAK,UAAU,CAAC;IACrF,CAAC;IAWD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,YAAY,MAAc,EAAE,UAAyC,EAAE;QACnE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;YACpD,4CAA4C;YAC5C,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AI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAEO,oBAAoB,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzC;IACL,CAAC;IAEO,YAAY,CAAC,KAAiB;QAClC,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC7B;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;SAC3B;IACL,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/C;IACL,CAAC;;AAxKuB,6BAAe,GAAG;IACtC,QAAQ,EAAE,YAAY;IACtB,GAAG,EAAE,EAAE;IACP,gBAAgB,EAAE,IAAI;CACzB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable no-var */\r\nimport type { Nullable } from \"../types\";\r\nimport { Tools } from \"./tools\";\r\nimport type { Engine } from \"../Engines/engine\";\r\n\r\ninterface MediaRecorder {\r\n /** Starts recording */\r\n start(timeSlice: number): void;\r\n /** Stops recording */\r\n stop(): void;\r\n\r\n /** Event raised when an error arised. */\r\n onerror: (event: ErrorEvent) => void;\r\n /** Event raised when the recording stops. */\r\n onstop: (event: Event) => void;\r\n /** Event raised when a new chunk of data is available and should be tracked. */\r\n ondataavailable: (event: Event) => void;\r\n}\r\n\r\ninterface MediaRecorderOptions {\r\n /** The mime type you want to use as the recording container for the new MediaRecorder. */\r\n mimeType?: string;\r\n /** The chosen bitrate for the audio component of the media. */\r\n audioBitsPerSecond?: number;\r\n /** The chosen bitrate for the video component of the media. */\r\n videoBitsPerSecond?: number;\r\n /** The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties.\r\n * If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. */\r\n bitsPerSecond?: number;\r\n}\r\n\r\ninterface MediaRecorderConstructor {\r\n /**\r\n * A reference to the prototype.\r\n */\r\n readonly prototype: MediaRecorder;\r\n\r\n /**\r\n * Creates a new MediaRecorder.\r\n * @param stream Defines the stream to record.\r\n * @param options Defines the options for the recorder available in the type MediaRecorderOptions.\r\n */\r\n new (stream: MediaStream, options?: MediaRecorderOptions): MediaRecorder;\r\n}\r\n\r\n/**\r\n * MediaRecorder object available in some browsers.\r\n */\r\ndeclare var MediaRecorder: MediaRecorderConstructor;\r\n\r\n/**\r\n * This represents the different options available for the video capture.\r\n */\r\nexport interface VideoRecorderOptions {\r\n /** The canvas you want to record */\r\n canvas?: HTMLCanvasElement;\r\n /** Defines the mime type of the video. */\r\n mimeType: string;\r\n /** Defines the FPS the video should be recorded at. */\r\n fps: number;\r\n /** Defines the chunk size for the recording data. */\r\n recordChunckSize: number;\r\n /** The audio tracks to attach to the recording. */\r\n audioTracks?: MediaStreamTrack[];\r\n}\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToVideo\r\n */\r\nexport class VideoRecorder {\r\n private static readonly _DefaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000,\r\n };\r\n\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @param canvas Defines the canvas to record. If not provided, the engine canvas will be used.\r\n * @returns true if supported otherwise false.\r\n */\r\n public static IsSupported(engine: Engine, canvas?: HTMLCanvasElement): boolean {\r\n const targetCanvas = canvas ?? engine.getRenderingCanvas();\r\n return !!targetCanvas && typeof (<any>targetCanvas).captureStream === \"function\";\r\n }\r\n\r\n private readonly _options: VideoRecorderOptions;\r\n private _canvas: Nullable<HTMLCanvasElement>;\r\n private _mediaRecorder: Nullable<MediaRecorder>;\r\n\r\n private _recordedChunks: any[];\r\n private _fileName: Nullable<string>;\r\n private _resolve: Nullable<(blob: Blob) => void>;\r\n private _reject: Nullable<(error: any) => void>;\r\n\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n public get isRecording(): boolean {\r\n return !!this._canvas && this._canvas.isRecording;\r\n }\r\n\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n constructor(engine: Engine, options: Partial<VideoRecorderOptions> = {}) {\r\n if (!VideoRecorder.IsSupported(engine, options.canvas)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n\r\n const canvas = options.canvas ?? engine.getRenderingCanvas();\r\n if (!canvas) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n\r\n this._options = {\r\n ...VideoRecorder._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n const stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (const track of this._options.audioTracks) {\r\n stream.addTrack(track);\r\n }\r\n }\r\n\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = (evt: Event) => this._handleDataAvailable(evt);\r\n this._mediaRecorder.onerror = (evt: ErrorEvent) => this._handleError(evt);\r\n this._mediaRecorder.onstop = () => this._handleStop();\r\n }\r\n\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n public stopRecording(): void {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n }\r\n\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @returns A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n public startRecording(fileName: Nullable<string> = \"babylonjs.webm\", maxDuration = 7): Promise<Blob> {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Recorder has already been disposed\";\r\n }\r\n\r\n if (this.isRecording) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Recording already in progress\";\r\n }\r\n\r\n if (maxDuration > 0) {\r\n setTimeout(() => {\r\n this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n\r\n return new Promise<Blob>((resolve, reject) => {\r\n this._resolve = resolve;\r\n this._reject = reject;\r\n });\r\n }\r\n\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n public dispose() {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n }\r\n\r\n private _handleDataAvailable(event: any): void {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n }\r\n\r\n private _handleError(event: ErrorEvent): void {\r\n this.stopRecording();\r\n\r\n if (this._reject) {\r\n this._reject(event.error);\r\n } else {\r\n throw new event.error();\r\n }\r\n }\r\n\r\n private _handleStop(): void {\r\n this.stopRecording();\r\n\r\n const superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n\r\n window.URL.createObjectURL(superBuffer);\r\n\r\n if (this._fileName) {\r\n Tools.Download(superBuffer, this._fileName);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"videoRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/videoRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAgEhC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAOtB;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,MAAsB,EAAE,MAA0B;QACxE,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3D,OAAO,CAAC,CAAC,YAAY,IAAI,OAAa,YAAa,CAAC,aAAa,KAAK,UAAU,CAAC;IACrF,CAAC;IAWD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,YAAY,MAAsB,EAAE,UAAyC,EAAE;QAC3E,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;YACpD,4CAA4C;YAC5C,MAAM,iDAA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AAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAEO,oBAAoB,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzC;IACL,CAAC;IAEO,YAAY,CAAC,KAAiB;QAClC,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC7B;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;SAC3B;IACL,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/C;IACL,CAAC;;AAxKuB,6BAAe,GAAG;IACtC,QAAQ,EAAE,YAAY;IACtB,GAAG,EAAE,EAAE;IACP,gBAAgB,EAAE,IAAI;CACzB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable no-var */\r\nimport type { Nullable } from \"../types\";\r\nimport { Tools } from \"./tools\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\ninterface MediaRecorder {\r\n /** Starts recording */\r\n start(timeSlice: number): void;\r\n /** Stops recording */\r\n stop(): void;\r\n\r\n /** Event raised when an error arised. */\r\n onerror: (event: ErrorEvent) => void;\r\n /** Event raised when the recording stops. */\r\n onstop: (event: Event) => void;\r\n /** Event raised when a new chunk of data is available and should be tracked. */\r\n ondataavailable: (event: Event) => void;\r\n}\r\n\r\ninterface MediaRecorderOptions {\r\n /** The mime type you want to use as the recording container for the new MediaRecorder. */\r\n mimeType?: string;\r\n /** The chosen bitrate for the audio component of the media. */\r\n audioBitsPerSecond?: number;\r\n /** The chosen bitrate for the video component of the media. */\r\n videoBitsPerSecond?: number;\r\n /** The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties.\r\n * If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. */\r\n bitsPerSecond?: number;\r\n}\r\n\r\ninterface MediaRecorderConstructor {\r\n /**\r\n * A reference to the prototype.\r\n */\r\n readonly prototype: MediaRecorder;\r\n\r\n /**\r\n * Creates a new MediaRecorder.\r\n * @param stream Defines the stream to record.\r\n * @param options Defines the options for the recorder available in the type MediaRecorderOptions.\r\n */\r\n new (stream: MediaStream, options?: MediaRecorderOptions): MediaRecorder;\r\n}\r\n\r\n/**\r\n * MediaRecorder object available in some browsers.\r\n */\r\ndeclare var MediaRecorder: MediaRecorderConstructor;\r\n\r\n/**\r\n * This represents the different options available for the video capture.\r\n */\r\nexport interface VideoRecorderOptions {\r\n /** The canvas you want to record */\r\n canvas?: HTMLCanvasElement;\r\n /** Defines the mime type of the video. */\r\n mimeType: string;\r\n /** Defines the FPS the video should be recorded at. */\r\n fps: number;\r\n /** Defines the chunk size for the recording data. */\r\n recordChunckSize: number;\r\n /** The audio tracks to attach to the recording. */\r\n audioTracks?: MediaStreamTrack[];\r\n}\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToVideo\r\n */\r\nexport class VideoRecorder {\r\n private static readonly _DefaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000,\r\n };\r\n\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @param canvas Defines the canvas to record. If not provided, the engine canvas will be used.\r\n * @returns true if supported otherwise false.\r\n */\r\n public static IsSupported(engine: AbstractEngine, canvas?: HTMLCanvasElement): boolean {\r\n const targetCanvas = canvas ?? engine.getRenderingCanvas();\r\n return !!targetCanvas && typeof (<any>targetCanvas).captureStream === \"function\";\r\n }\r\n\r\n private readonly _options: VideoRecorderOptions;\r\n private _canvas: Nullable<HTMLCanvasElement>;\r\n private _mediaRecorder: Nullable<MediaRecorder>;\r\n\r\n private _recordedChunks: any[];\r\n private _fileName: Nullable<string>;\r\n private _resolve: Nullable<(blob: Blob) => void>;\r\n private _reject: Nullable<(error: any) => void>;\r\n\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n public get isRecording(): boolean {\r\n return !!this._canvas && this._canvas.isRecording;\r\n }\r\n\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n constructor(engine: AbstractEngine, options: Partial<VideoRecorderOptions> = {}) {\r\n if (!VideoRecorder.IsSupported(engine, options.canvas)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n\r\n const canvas = options.canvas ?? engine.getRenderingCanvas();\r\n if (!canvas) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n\r\n this._options = {\r\n ...VideoRecorder._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n const stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (const track of this._options.audioTracks) {\r\n stream.addTrack(track);\r\n }\r\n }\r\n\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = (evt: Event) => this._handleDataAvailable(evt);\r\n this._mediaRecorder.onerror = (evt: ErrorEvent) => this._handleError(evt);\r\n this._mediaRecorder.onstop = () => this._handleStop();\r\n }\r\n\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n public stopRecording(): void {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n }\r\n\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @returns A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n public startRecording(fileName: Nullable<string> = \"babylonjs.webm\", maxDuration = 7): Promise<Blob> {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Recorder has already been disposed\";\r\n }\r\n\r\n if (this.isRecording) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Recording already in progress\";\r\n }\r\n\r\n if (maxDuration > 0) {\r\n setTimeout(() => {\r\n this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n\r\n return new Promise<Blob>((resolve, reject) => {\r\n this._resolve = resolve;\r\n this._reject = reject;\r\n });\r\n }\r\n\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n public dispose() {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n }\r\n\r\n private _handleDataAvailable(event: any): void {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n }\r\n\r\n private _handleError(event: ErrorEvent): void {\r\n this.stopRecording();\r\n\r\n if (this._reject) {\r\n this._reject(event.error);\r\n } else {\r\n throw new event.error();\r\n }\r\n }\r\n\r\n private _handleStop(): void {\r\n this.stopRecording();\r\n\r\n const superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n\r\n window.URL.createObjectURL(superBuffer);\r\n\r\n if (this._fileName) {\r\n Tools.Download(superBuffer, this._fileName);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -7,7 +7,7 @@ import type { ColorGradient, FactorGradient, Color3Gradient, IValueGradient } fr
|
|
|
7
7
|
import type { BoxParticleEmitter } from "../Particles/EmitterTypes/boxParticleEmitter";
|
|
8
8
|
import type { BaseTexture } from "../Materials/Textures/baseTexture";
|
|
9
9
|
import { Color4 } from "../Maths/math.color";
|
|
10
|
-
import type {
|
|
10
|
+
import type { AbstractEngine } from "../Engines/abstractEngine";
|
|
11
11
|
import "../Engines/Extensions/engine.dynamicBuffer";
|
|
12
12
|
import type { IClipPlanesHolder } from "../Misc/interfaces/iClipPlanesHolder";
|
|
13
13
|
import type { Plane } from "../Maths/math.plane";
|
|
@@ -452,7 +452,7 @@ export declare class BaseParticleSystem implements IClipPlanesHolder {
|
|
|
452
452
|
/**
|
|
453
453
|
* The engine the particle system belongs to.
|
|
454
454
|
*/
|
|
455
|
-
protected _engine:
|
|
455
|
+
protected _engine: AbstractEngine;
|
|
456
456
|
/**
|
|
457
457
|
* Local cache of defines for image processing.
|
|
458
458
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseParticleSystem.js","sourceRo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AChC,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,CAAC,EACV,WAAW,GAAG,CAAC,EACf,UAAU,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EACnC,UAAU,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACI,gBAAgB,CAAC,UAAmB,EAAE,UAAmB,EAAE,UAAmB,EAAE,UAAmB;QACtG,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;;AAtxBD;;GAEG;AACW,mCAAgB,GAAG,CAAC,AAAJ,CAAK;AACnC;;GAEG;AACW,qCAAkB,GAAG,CAAC,AAAJ,CAAK;AACrC;;GAEG;AACW,gCAAa,GAAG,CAAC,AAAJ,CAAK;AAChC;;GAEG;AACW,qCAAkB,GAAG,CAAC,AAAJ,CAAK;AAErC;;GAEG;AACW,wCAAqB,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { ImageProcessingConfigurationDefines } from \"../Materials/imageProcessingConfiguration.defines\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient, IValueGradient } from \"../Misc/gradients\";\r\nimport type { BoxParticleEmitter } from \"../Particles/EmitterTypes/boxParticleEmitter\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\n\r\nimport \"../Engines/Extensions/engine.dynamicBuffer\";\r\nimport type { IClipPlanesHolder } from \"../Misc/interfaces/iClipPlanesHolder\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport type { IParticleEmitterType } from \"./EmitterTypes/IParticleEmitterType\";\r\nimport type { PointParticleEmitter } from \"./EmitterTypes/pointParticleEmitter\";\r\nimport type { HemisphericParticleEmitter } from \"./EmitterTypes/hemisphericParticleEmitter\";\r\nimport type { SphereDirectedParticleEmitter, SphereParticleEmitter } from \"./EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderDirectedParticleEmitter, CylinderParticleEmitter } from \"./EmitterTypes/cylinderParticleEmitter\";\r\nimport type { ConeParticleEmitter } from \"./EmitterTypes/coneParticleEmitter\";\r\n\r\n/**\r\n * This represents the base class for particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\nexport class BaseParticleSystem implements IClipPlanesHolder {\r\n /**\r\n * Source color is added to the destination color without alpha affecting the result\r\n */\r\n public static BLENDMODE_ONEONE = 0;\r\n /**\r\n * Blend current color and particle color using particle’s alpha\r\n */\r\n public static BLENDMODE_STANDARD = 1;\r\n /**\r\n * Add current color and particle color multiplied by particle’s alpha\r\n */\r\n public static BLENDMODE_ADD = 2;\r\n /**\r\n * Multiply current color with particle color\r\n */\r\n public static BLENDMODE_MULTIPLY = 3;\r\n\r\n /**\r\n * Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha\r\n */\r\n public static BLENDMODE_MULTIPLYADD = 4;\r\n\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * Gets or sets the unique id of the particle system\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * The id of the Particle system.\r\n */\r\n public id: string;\r\n\r\n /**\r\n * The friendly name of the Particle system.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Snippet ID if the particle system was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n public renderingGroupId = 0;\r\n\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n public emitter: Nullable<AbstractMesh | Vector3> = Vector3.Zero();\r\n\r\n /**\r\n * The maximum number of particles to emit per frame\r\n */\r\n public emitRate = 10;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n public updateSpeed = 0.01;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n public minEmitPower = 1;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n public maxEmitPower = 1;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n public minLifeTime = 1;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n public maxLifeTime = 1;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n public minSize = 1;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n public maxSize = 1;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n public minScaleX = 1;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n public maxScaleX = 1;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n public minScaleY = 1;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n public maxScaleY = 1;\r\n\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n public minInitialRotation = 0;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n public maxInitialRotation = 0;\r\n\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n public minAngularSpeed = 0;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n public maxAngularSpeed = 0;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n public particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n public layerMask: number = 0x0fffffff;\r\n\r\n /**\r\n * This can help using your own shader to render the particle system.\r\n * The according effect will be created\r\n */\r\n public customShader: any = null;\r\n\r\n /**\r\n * By default particle system starts as soon as they are created. This prevents the\r\n * automatic start to happen and let you decide when to start emitting particles.\r\n */\r\n public preventAutoStart: boolean = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this particle system will allow fog to be rendered on it (false by default)\r\n */\r\n public applyFog = false;\r\n\r\n /** @internal */\r\n _wasDispatched = false;\r\n\r\n protected _rootUrl = \"\";\r\n private _noiseTexture: Nullable<ProceduralTexture>;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n public get noiseTexture(): Nullable<ProceduralTexture> {\r\n return this._noiseTexture;\r\n }\r\n\r\n public set noiseTexture(value: Nullable<ProceduralTexture>) {\r\n if (this._noiseTexture === value) {\r\n return;\r\n }\r\n\r\n this._noiseTexture = value;\r\n this._reset();\r\n }\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n public noiseStrength = new Vector3(10, 10, 10);\r\n\r\n /**\r\n * Callback triggered when the particle animation is ending.\r\n */\r\n public onAnimationEnd: Nullable<() => void> = null;\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.\r\n */\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n public forceDepthWrite = false;\r\n\r\n /** Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0 */\r\n public preWarmCycles = 0;\r\n\r\n /** Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1) */\r\n public preWarmStepOffset = 1;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n public spriteCellChangeSpeed = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n public startSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n public endSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n public spriteCellWidth = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n public spriteCellHeight = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines wether the sprite animation is looping\r\n */\r\n public spriteCellLoop = true;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n public spriteRandomStartCell = false;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n public translationPivot = new Vector2(0, 0);\r\n\r\n /** @internal */\r\n public _isAnimationSheetEnabled: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n public beginAnimationOnStart = false;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n public beginAnimationFrom = 0;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n public beginAnimationTo = 60;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n public beginAnimationLoop = false;\r\n\r\n /**\r\n * Gets or sets a world offset applied to all particles\r\n */\r\n public worldOffset = new Vector3(0, 0, 0);\r\n\r\n /**\r\n * Gets or sets the active clipplane 1\r\n */\r\n public clipPlane: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 2\r\n */\r\n public clipPlane2: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 3\r\n */\r\n public clipPlane3: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 4\r\n */\r\n public clipPlane4: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 5\r\n */\r\n public clipPlane5: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 6\r\n */\r\n public clipPlane6: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets whether an animation sprite sheet is enabled or not on the particle system\r\n */\r\n public get isAnimationSheetEnabled(): boolean {\r\n return this._isAnimationSheetEnabled;\r\n }\r\n\r\n public set isAnimationSheetEnabled(value: boolean) {\r\n if (this._isAnimationSheetEnabled == value) {\r\n return;\r\n }\r\n\r\n this._isAnimationSheetEnabled = value;\r\n\r\n this._reset();\r\n }\r\n\r\n private _useLogarithmicDepth: boolean = false;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n public get useLogarithmicDepth(): boolean {\r\n return this._useLogarithmicDepth;\r\n }\r\n\r\n public set useLogarithmicDepth(value: boolean) {\r\n this._useLogarithmicDepth = value && this.getScene()!.getEngine().getCaps().fragmentDepthSupported;\r\n }\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n public gravity = Vector3.Zero();\r\n\r\n protected _colorGradients: Nullable<Array<ColorGradient>> = null;\r\n protected _sizeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _lifeTimeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _angularSpeedGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _velocityGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _limitVelocityGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _dragGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _emitRateGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _startSizeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _rampGradients: Nullable<Array<Color3Gradient>> = null;\r\n protected _colorRemapGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _alphaRemapGradients: Nullable<Array<FactorGradient>> = null;\r\n\r\n protected _hasTargetStopDurationDependantGradient() {\r\n return (\r\n (this._startSizeGradients && this._startSizeGradients.length > 0) ||\r\n (this._emitRateGradients && this._emitRateGradients.length > 0) ||\r\n (this._lifeTimeGradients && this._lifeTimeGradients.length > 0)\r\n );\r\n }\r\n\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n public getDragGradients(): Nullable<Array<FactorGradient>> {\r\n return this._dragGradients;\r\n }\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n public limitVelocityDamping = 0.4;\r\n\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n public getLimitVelocityGradients(): Nullable<Array<FactorGradient>> {\r\n return this._limitVelocityGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n public getColorGradients(): Nullable<Array<ColorGradient>> {\r\n return this._colorGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n public getSizeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._sizeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n public getColorRemapGradients(): Nullable<Array<FactorGradient>> {\r\n return this._colorRemapGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n public getAlphaRemapGradients(): Nullable<Array<FactorGradient>> {\r\n return this._alphaRemapGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n public getLifeTimeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._lifeTimeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n public getAngularSpeedGradients(): Nullable<Array<FactorGradient>> {\r\n return this._angularSpeedGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n public getVelocityGradients(): Nullable<Array<FactorGradient>> {\r\n return this._velocityGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n public getStartSizeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._startSizeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n public getEmitRateGradients(): Nullable<Array<FactorGradient>> {\r\n return this._emitRateGradients;\r\n }\r\n\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get direction1(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction1) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).direction1;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set direction1(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction1) {\r\n (<BoxParticleEmitter>this.particleEmitterType).direction1 = value;\r\n }\r\n }\r\n\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get direction2(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction2) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).direction2;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set direction2(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction2) {\r\n (<BoxParticleEmitter>this.particleEmitterType).direction2 = value;\r\n }\r\n }\r\n\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get minEmitBox(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).minEmitBox) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).minEmitBox;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set minEmitBox(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).minEmitBox) {\r\n (<BoxParticleEmitter>this.particleEmitterType).minEmitBox = value;\r\n }\r\n }\r\n\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get maxEmitBox(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).maxEmitBox) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).maxEmitBox;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set maxEmitBox(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).maxEmitBox) {\r\n (<BoxParticleEmitter>this.particleEmitterType).maxEmitBox = value;\r\n }\r\n }\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n public color1 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n public color2 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Color the particle will have at the end of its lifetime\r\n */\r\n public colorDead = new Color4(0, 0, 0, 1.0);\r\n\r\n /**\r\n * An optional mask to filter some colors out of the texture, or filter a part of the alpha channel\r\n */\r\n public textureMask = new Color4(1.0, 1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n public particleEmitterType: IParticleEmitterType;\r\n\r\n /** @internal */\r\n public _isSubEmitter = false;\r\n\r\n /** @internal */\r\n public _billboardMode = Constants.PARTICLES_BILLBOARDMODE_ALL;\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n public get billboardMode(): number {\r\n return this._billboardMode;\r\n }\r\n\r\n public set billboardMode(value: number) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n\r\n this._billboardMode = value;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _isBillboardBased = true;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n public get isBillboardBased(): boolean {\r\n return this._isBillboardBased;\r\n }\r\n\r\n public set isBillboardBased(value: boolean) {\r\n if (this._isBillboardBased === value) {\r\n return;\r\n }\r\n\r\n this._isBillboardBased = value;\r\n this._reset();\r\n }\r\n\r\n /**\r\n * The scene the particle system belongs to.\r\n */\r\n protected _scene: Nullable<Scene>;\r\n\r\n /**\r\n * The engine the particle system belongs to.\r\n */\r\n protected _engine: ThinEngine;\r\n\r\n /**\r\n * Local cache of defines for image processing.\r\n */\r\n protected _imageProcessingConfigurationDefines = new ImageProcessingConfigurationDefines();\r\n\r\n /**\r\n * Default configuration related to image processing available in the standard Material.\r\n */\r\n protected _imageProcessingConfiguration: Nullable<ImageProcessingConfiguration>;\r\n\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): Nullable<ImageProcessingConfiguration> {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: Nullable<ImageProcessingConfiguration>) {\r\n this._attachImageProcessingConfiguration(value);\r\n }\r\n\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void {\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n\r\n // Pick the scene configuration if needed.\r\n if (!configuration && this._scene) {\r\n this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;\r\n } else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _reset() {}\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _removeGradientAndTexture(gradient: number, gradients: Nullable<IValueGradient[]>, texture: Nullable<RawTexture>): BaseParticleSystem {\r\n if (!gradients) {\r\n return this;\r\n }\r\n\r\n let index = 0;\r\n for (const valueGradient of gradients) {\r\n if (valueGradient.gradient === gradient) {\r\n gradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n\r\n if (texture) {\r\n texture.dispose();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n */\r\n public constructor(name: string) {\r\n this.id = name;\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n */\r\n public createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n */\r\n public createHemisphericEmitter(radius = 1, radiusRange = 1): HemisphericParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n */\r\n public createSphereEmitter(radius = 1, radiusRange = 1): SphereParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n */\r\n public createDirectedSphereEmitter(radius = 1, direction1 = new Vector3(0, 1.0, 0), direction2 = new Vector3(0, 1.0, 0)): SphereDirectedParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n */\r\n public createCylinderEmitter(radius = 1, height = 1, radiusRange = 1, directionRandomizer = 0): CylinderParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n */\r\n public createDirectedCylinderEmitter(\r\n radius = 1,\r\n height = 1,\r\n radiusRange = 1,\r\n direction1 = new Vector3(0, 1.0, 0),\r\n direction2 = new Vector3(0, 1.0, 0)\r\n ): CylinderDirectedParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n */\r\n public createConeEmitter(radius = 1, angle = Math.PI / 4): ConeParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n */\r\n public createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"baseParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/baseParticleSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,mCAAmC,EAAE,MAAM,mDAAmD,CAAC;AAGxG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,4CAA4C,CAAC;AAcpD;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAmL3B;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAW,YAAY,CAAC,KAAkC;QACtD,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE;YAC9B,OAAO;SACV;QAED,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAqHD;;OAEG;IACH,IAAW,uBAAuB;QAC9B,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACzC,CAAC;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GAEG;AACW,gCAAa,GAAG,CAAC,AAAJ,CAAK;AAChC;;GAEG;AACW,qCAAkB,GAAG,CAAC,AAAJ,CAAK;AAErC;;GAEG;AACW,wCAAqB,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { ImageProcessingConfigurationDefines } from \"../Materials/imageProcessingConfiguration.defines\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient, IValueGradient } from \"../Misc/gradients\";\r\nimport type { BoxParticleEmitter } from \"../Particles/EmitterTypes/boxParticleEmitter\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport \"../Engines/Extensions/engine.dynamicBuffer\";\r\nimport type { IClipPlanesHolder } from \"../Misc/interfaces/iClipPlanesHolder\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport type { IParticleEmitterType } from \"./EmitterTypes/IParticleEmitterType\";\r\nimport type { PointParticleEmitter } from \"./EmitterTypes/pointParticleEmitter\";\r\nimport type { HemisphericParticleEmitter } from \"./EmitterTypes/hemisphericParticleEmitter\";\r\nimport type { SphereDirectedParticleEmitter, SphereParticleEmitter } from \"./EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderDirectedParticleEmitter, CylinderParticleEmitter } from \"./EmitterTypes/cylinderParticleEmitter\";\r\nimport type { ConeParticleEmitter } from \"./EmitterTypes/coneParticleEmitter\";\r\n\r\n/**\r\n * This represents the base class for particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\nexport class BaseParticleSystem implements IClipPlanesHolder {\r\n /**\r\n * Source color is added to the destination color without alpha affecting the result\r\n */\r\n public static BLENDMODE_ONEONE = 0;\r\n /**\r\n * Blend current color and particle color using particle’s alpha\r\n */\r\n public static BLENDMODE_STANDARD = 1;\r\n /**\r\n * Add current color and particle color multiplied by particle’s alpha\r\n */\r\n public static BLENDMODE_ADD = 2;\r\n /**\r\n * Multiply current color with particle color\r\n */\r\n public static BLENDMODE_MULTIPLY = 3;\r\n\r\n /**\r\n * Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha\r\n */\r\n public static BLENDMODE_MULTIPLYADD = 4;\r\n\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * Gets or sets the unique id of the particle system\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * The id of the Particle system.\r\n */\r\n public id: string;\r\n\r\n /**\r\n * The friendly name of the Particle system.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Snippet ID if the particle system was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n public renderingGroupId = 0;\r\n\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n public emitter: Nullable<AbstractMesh | Vector3> = Vector3.Zero();\r\n\r\n /**\r\n * The maximum number of particles to emit per frame\r\n */\r\n public emitRate = 10;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n public updateSpeed = 0.01;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n public minEmitPower = 1;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n public maxEmitPower = 1;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n public minLifeTime = 1;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n public maxLifeTime = 1;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n public minSize = 1;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n public maxSize = 1;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n public minScaleX = 1;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n public maxScaleX = 1;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n public minScaleY = 1;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n public maxScaleY = 1;\r\n\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n public minInitialRotation = 0;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n public maxInitialRotation = 0;\r\n\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n public minAngularSpeed = 0;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n public maxAngularSpeed = 0;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n public particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n public layerMask: number = 0x0fffffff;\r\n\r\n /**\r\n * This can help using your own shader to render the particle system.\r\n * The according effect will be created\r\n */\r\n public customShader: any = null;\r\n\r\n /**\r\n * By default particle system starts as soon as they are created. This prevents the\r\n * automatic start to happen and let you decide when to start emitting particles.\r\n */\r\n public preventAutoStart: boolean = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this particle system will allow fog to be rendered on it (false by default)\r\n */\r\n public applyFog = false;\r\n\r\n /** @internal */\r\n _wasDispatched = false;\r\n\r\n protected _rootUrl = \"\";\r\n private _noiseTexture: Nullable<ProceduralTexture>;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n public get noiseTexture(): Nullable<ProceduralTexture> {\r\n return this._noiseTexture;\r\n }\r\n\r\n public set noiseTexture(value: Nullable<ProceduralTexture>) {\r\n if (this._noiseTexture === value) {\r\n return;\r\n }\r\n\r\n this._noiseTexture = value;\r\n this._reset();\r\n }\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n public noiseStrength = new Vector3(10, 10, 10);\r\n\r\n /**\r\n * Callback triggered when the particle animation is ending.\r\n */\r\n public onAnimationEnd: Nullable<() => void> = null;\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.\r\n */\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n public forceDepthWrite = false;\r\n\r\n /** Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0 */\r\n public preWarmCycles = 0;\r\n\r\n /** Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1) */\r\n public preWarmStepOffset = 1;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n public spriteCellChangeSpeed = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n public startSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n public endSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n public spriteCellWidth = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n public spriteCellHeight = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines wether the sprite animation is looping\r\n */\r\n public spriteCellLoop = true;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n public spriteRandomStartCell = false;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n public translationPivot = new Vector2(0, 0);\r\n\r\n /** @internal */\r\n public _isAnimationSheetEnabled: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n public beginAnimationOnStart = false;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n public beginAnimationFrom = 0;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n public beginAnimationTo = 60;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n public beginAnimationLoop = false;\r\n\r\n /**\r\n * Gets or sets a world offset applied to all particles\r\n */\r\n public worldOffset = new Vector3(0, 0, 0);\r\n\r\n /**\r\n * Gets or sets the active clipplane 1\r\n */\r\n public clipPlane: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 2\r\n */\r\n public clipPlane2: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 3\r\n */\r\n public clipPlane3: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 4\r\n */\r\n public clipPlane4: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 5\r\n */\r\n public clipPlane5: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets the active clipplane 6\r\n */\r\n public clipPlane6: Nullable<Plane>;\r\n\r\n /**\r\n * Gets or sets whether an animation sprite sheet is enabled or not on the particle system\r\n */\r\n public get isAnimationSheetEnabled(): boolean {\r\n return this._isAnimationSheetEnabled;\r\n }\r\n\r\n public set isAnimationSheetEnabled(value: boolean) {\r\n if (this._isAnimationSheetEnabled == value) {\r\n return;\r\n }\r\n\r\n this._isAnimationSheetEnabled = value;\r\n\r\n this._reset();\r\n }\r\n\r\n private _useLogarithmicDepth: boolean = false;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n public get useLogarithmicDepth(): boolean {\r\n return this._useLogarithmicDepth;\r\n }\r\n\r\n public set useLogarithmicDepth(value: boolean) {\r\n this._useLogarithmicDepth = value && this.getScene()!.getEngine().getCaps().fragmentDepthSupported;\r\n }\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n public gravity = Vector3.Zero();\r\n\r\n protected _colorGradients: Nullable<Array<ColorGradient>> = null;\r\n protected _sizeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _lifeTimeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _angularSpeedGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _velocityGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _limitVelocityGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _dragGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _emitRateGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _startSizeGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _rampGradients: Nullable<Array<Color3Gradient>> = null;\r\n protected _colorRemapGradients: Nullable<Array<FactorGradient>> = null;\r\n protected _alphaRemapGradients: Nullable<Array<FactorGradient>> = null;\r\n\r\n protected _hasTargetStopDurationDependantGradient() {\r\n return (\r\n (this._startSizeGradients && this._startSizeGradients.length > 0) ||\r\n (this._emitRateGradients && this._emitRateGradients.length > 0) ||\r\n (this._lifeTimeGradients && this._lifeTimeGradients.length > 0)\r\n );\r\n }\r\n\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n public getDragGradients(): Nullable<Array<FactorGradient>> {\r\n return this._dragGradients;\r\n }\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n public limitVelocityDamping = 0.4;\r\n\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n public getLimitVelocityGradients(): Nullable<Array<FactorGradient>> {\r\n return this._limitVelocityGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n public getColorGradients(): Nullable<Array<ColorGradient>> {\r\n return this._colorGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n public getSizeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._sizeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n public getColorRemapGradients(): Nullable<Array<FactorGradient>> {\r\n return this._colorRemapGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n public getAlphaRemapGradients(): Nullable<Array<FactorGradient>> {\r\n return this._alphaRemapGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n public getLifeTimeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._lifeTimeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n public getAngularSpeedGradients(): Nullable<Array<FactorGradient>> {\r\n return this._angularSpeedGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n public getVelocityGradients(): Nullable<Array<FactorGradient>> {\r\n return this._velocityGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n public getStartSizeGradients(): Nullable<Array<FactorGradient>> {\r\n return this._startSizeGradients;\r\n }\r\n\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n public getEmitRateGradients(): Nullable<Array<FactorGradient>> {\r\n return this._emitRateGradients;\r\n }\r\n\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get direction1(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction1) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).direction1;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set direction1(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction1) {\r\n (<BoxParticleEmitter>this.particleEmitterType).direction1 = value;\r\n }\r\n }\r\n\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get direction2(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction2) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).direction2;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set direction2(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).direction2) {\r\n (<BoxParticleEmitter>this.particleEmitterType).direction2 = value;\r\n }\r\n }\r\n\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get minEmitBox(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).minEmitBox) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).minEmitBox;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set minEmitBox(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).minEmitBox) {\r\n (<BoxParticleEmitter>this.particleEmitterType).minEmitBox = value;\r\n }\r\n }\r\n\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n public get maxEmitBox(): Vector3 {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).maxEmitBox) {\r\n return (<BoxParticleEmitter>this.particleEmitterType).maxEmitBox;\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n public set maxEmitBox(value: Vector3) {\r\n if ((<BoxParticleEmitter>this.particleEmitterType).maxEmitBox) {\r\n (<BoxParticleEmitter>this.particleEmitterType).maxEmitBox = value;\r\n }\r\n }\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n public color1 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n public color2 = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Color the particle will have at the end of its lifetime\r\n */\r\n public colorDead = new Color4(0, 0, 0, 1.0);\r\n\r\n /**\r\n * An optional mask to filter some colors out of the texture, or filter a part of the alpha channel\r\n */\r\n public textureMask = new Color4(1.0, 1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n public particleEmitterType: IParticleEmitterType;\r\n\r\n /** @internal */\r\n public _isSubEmitter = false;\r\n\r\n /** @internal */\r\n public _billboardMode = Constants.PARTICLES_BILLBOARDMODE_ALL;\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n public get billboardMode(): number {\r\n return this._billboardMode;\r\n }\r\n\r\n public set billboardMode(value: number) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n\r\n this._billboardMode = value;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _isBillboardBased = true;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n public get isBillboardBased(): boolean {\r\n return this._isBillboardBased;\r\n }\r\n\r\n public set isBillboardBased(value: boolean) {\r\n if (this._isBillboardBased === value) {\r\n return;\r\n }\r\n\r\n this._isBillboardBased = value;\r\n this._reset();\r\n }\r\n\r\n /**\r\n * The scene the particle system belongs to.\r\n */\r\n protected _scene: Nullable<Scene>;\r\n\r\n /**\r\n * The engine the particle system belongs to.\r\n */\r\n protected _engine: AbstractEngine;\r\n\r\n /**\r\n * Local cache of defines for image processing.\r\n */\r\n protected _imageProcessingConfigurationDefines = new ImageProcessingConfigurationDefines();\r\n\r\n /**\r\n * Default configuration related to image processing available in the standard Material.\r\n */\r\n protected _imageProcessingConfiguration: Nullable<ImageProcessingConfiguration>;\r\n\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): Nullable<ImageProcessingConfiguration> {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: Nullable<ImageProcessingConfiguration>) {\r\n this._attachImageProcessingConfiguration(value);\r\n }\r\n\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void {\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n\r\n // Pick the scene configuration if needed.\r\n if (!configuration && this._scene) {\r\n this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;\r\n } else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _reset() {}\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _removeGradientAndTexture(gradient: number, gradients: Nullable<IValueGradient[]>, texture: Nullable<RawTexture>): BaseParticleSystem {\r\n if (!gradients) {\r\n return this;\r\n }\r\n\r\n let index = 0;\r\n for (const valueGradient of gradients) {\r\n if (valueGradient.gradient === gradient) {\r\n gradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n\r\n if (texture) {\r\n texture.dispose();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n */\r\n public constructor(name: string) {\r\n this.id = name;\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n */\r\n public createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n */\r\n public createHemisphericEmitter(radius = 1, radiusRange = 1): HemisphericParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n */\r\n public createSphereEmitter(radius = 1, radiusRange = 1): SphereParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n */\r\n public createDirectedSphereEmitter(radius = 1, direction1 = new Vector3(0, 1.0, 0), direction2 = new Vector3(0, 1.0, 0)): SphereDirectedParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n */\r\n public createCylinderEmitter(radius = 1, height = 1, radiusRange = 1, directionRandomizer = 0): CylinderParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n */\r\n public createDirectedCylinderEmitter(\r\n radius = 1,\r\n height = 1,\r\n radiusRange = 1,\r\n direction1 = new Vector3(0, 1.0, 0),\r\n direction2 = new Vector3(0, 1.0, 0)\r\n ): CylinderDirectedParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n */\r\n public createConeEmitter(radius = 1, angle = Math.PI / 4): ConeParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n */\r\n public createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractEngine } from "../Engines/abstractEngine";
|
|
2
2
|
import type { IGPUParticleSystemPlatform } from "./IGPUParticleSystemPlatform";
|
|
3
3
|
import type { Buffer, VertexBuffer } from "../Buffers/buffer";
|
|
4
4
|
import type { GPUParticleSystem } from "./gpuParticleSystem";
|
|
@@ -16,7 +16,7 @@ export declare class ComputeShaderParticleSystem implements IGPUParticleSystemPl
|
|
|
16
16
|
private _bufferComputeShader;
|
|
17
17
|
private _renderVertexBuffers;
|
|
18
18
|
readonly alignDataInBuffer = true;
|
|
19
|
-
constructor(parent: GPUParticleSystem, engine:
|
|
19
|
+
constructor(parent: GPUParticleSystem, engine: AbstractEngine);
|
|
20
20
|
contextLost(): void;
|
|
21
21
|
isUpdateBufferCreated(): boolean;
|
|
22
22
|
isUpdateBufferReady(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeShaderParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/computeShaderParticleSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAGnG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,2CAA2C,CAAC;AAEnD,gBAAgB;AAChB,MAAM,OAAO,2BAA2B;IAUpC,YAAY,MAAyB,EAAE,MAAkB;QALjD,yBAAoB,GAAoB,EAAE,CAAC;QAC3C,yBAAoB,GAA2C,EAAE,CAAC;QAE1D,sBAAiB,GAAG,IAAI,CAAC;QAGrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAEM,WAAW;QACd,IAAI,CAAC,oBAAoB,GAAG,SAAgB,CAAC;QAC7C,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,oBAAoB,CAA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AM,EAAE,EAAE,CAAC,EAAE;YACvD,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC1C;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;QAErC,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,uBAAwB,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,oBAAqB,GAAG,IAAI,CAAC;IAC5C,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ;AAED,aAAa,CAAC,qCAAqC,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { WebGPUEngine } from \"../Engines/webgpuEngine\";\r\nimport { StorageBuffer } from \"../Buffers/storageBuffer\";\r\nimport { ComputeShader } from \"../Compute/computeShader\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport type { IGPUParticleSystemPlatform } from \"./IGPUParticleSystemPlatform\";\r\nimport type { Buffer, VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { GPUParticleSystem } from \"./gpuParticleSystem\";\r\n\r\nimport type { DataArray, Nullable } from \"../types\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { UniformBufferEffectCommonAccessor } from \"../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { ComputeBindingMapping } from \"../Engines/Extensions/engine.computeShader\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nimport \"../ShadersWGSL/gpuUpdateParticles.compute\";\r\n\r\n/** @internal */\r\nexport class ComputeShaderParticleSystem implements IGPUParticleSystemPlatform {\r\n private _parent: GPUParticleSystem;\r\n private _engine: ThinEngine;\r\n private _updateComputeShader: ComputeShader;\r\n private _simParamsComputeShader: UniformBuffer;\r\n private _bufferComputeShader: StorageBuffer[] = [];\r\n private _renderVertexBuffers: Array<{ [key: string]: VertexBuffer }> = [];\r\n\r\n public readonly alignDataInBuffer = true;\r\n\r\n constructor(parent: GPUParticleSystem, engine: ThinEngine) {\r\n this._parent = parent;\r\n this._engine = engine;\r\n }\r\n\r\n public contextLost(): void {\r\n this._updateComputeShader = undefined as any;\r\n this._bufferComputeShader.length = 0;\r\n this._renderVertexBuffers.length = 0;\r\n }\r\n\r\n public isUpdateBufferCreated(): boolean {\r\n return !!this._updateComputeShader;\r\n }\r\n\r\n public isUpdateBufferReady(): boolean {\r\n return this._updateComputeShader?.isReady() ?? false;\r\n }\r\n\r\n public createUpdateBuffer(defines: string): UniformBufferEffectCommonAccessor {\r\n const bindingsMapping: ComputeBindingMapping = {\r\n params: { group: 0, binding: 0 },\r\n particlesIn: { group: 0, binding: 1 },\r\n particlesOut: { group: 0, binding: 2 },\r\n randomTexture: { group: 0, binding: 3 },\r\n randomTexture2: { group: 0, binding: 4 },\r\n };\r\n if (this._parent._sizeGradientsTexture) {\r\n bindingsMapping[\"sizeGradientTexture\"] = { group: 1, binding: 1 };\r\n }\r\n if (this._parent._angularSpeedGradientsTexture) {\r\n bindingsMapping[\"angularSpeedGradientTexture\"] = { group: 1, binding: 3 };\r\n }\r\n if (this._parent._velocityGradientsTexture) {\r\n bindingsMapping[\"velocityGradientTexture\"] = { group: 1, binding: 5 };\r\n }\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n bindingsMapping[\"limitVelocityGradientTexture\"] = { group: 1, binding: 7 };\r\n }\r\n if (this._parent._dragGradientsTexture) {\r\n bindingsMapping[\"dragGradientTexture\"] = { group: 1, binding: 9 };\r\n }\r\n if (this._parent.noiseTexture) {\r\n bindingsMapping[\"noiseTexture\"] = { group: 1, binding: 11 };\r\n }\r\n\r\n this._updateComputeShader = new ComputeShader(\"updateParticles\", this._engine as WebGPUEngine, \"gpuUpdateParticles\", { bindingsMapping, defines: defines.split(\"\\n\") });\r\n\r\n this._simParamsComputeShader?.dispose();\r\n this._simParamsComputeShader = new UniformBuffer(this._engine, undefined, undefined, \"ComputeShaderParticleSystemUBO\");\r\n\r\n this._simParamsComputeShader.addUniform(\"currentCount\", 1);\r\n this._simParamsComputeShader.addUniform(\"timeDelta\", 1);\r\n this._simParamsComputeShader.addUniform(\"stopFactor\", 1);\r\n this._simParamsComputeShader.addUniform(\"randomTextureSize\", 1);\r\n this._simParamsComputeShader.addUniform(\"lifeTime\", 2);\r\n this._simParamsComputeShader.addUniform(\"emitPower\", 2);\r\n if (!this._parent._colorGradientsTexture) {\r\n this._simParamsComputeShader.addUniform(\"color1\", 4);\r\n this._simParamsComputeShader.addUniform(\"color2\", 4);\r\n }\r\n this._simParamsComputeShader.addUniform(\"sizeRange\", 2);\r\n this._simParamsComputeShader.addUniform(\"scaleRange\", 4);\r\n this._simParamsComputeShader.addUniform(\"angleRange\", 4);\r\n this._simParamsComputeShader.addUniform(\"gravity\", 3);\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n this._simParamsComputeShader.addUniform(\"limitVelocityDamping\", 1);\r\n }\r\n if (this._parent.isAnimationSheetEnabled) {\r\n this._simParamsComputeShader.addUniform(\"cellInfos\", 4);\r\n }\r\n if (this._parent.noiseTexture) {\r\n this._simParamsComputeShader.addUniform(\"noiseStrength\", 3);\r\n }\r\n if (!this._parent.isLocal) {\r\n this._simParamsComputeShader.addUniform(\"emitterWM\", 16);\r\n }\r\n if (this._parent.particleEmitterType) {\r\n this._parent.particleEmitterType.buildUniformLayout(this._simParamsComputeShader);\r\n }\r\n\r\n this._updateComputeShader.setUniformBuffer(\"params\", this._simParamsComputeShader);\r\n\r\n return new UniformBufferEffectCommonAccessor(this._simParamsComputeShader);\r\n }\r\n\r\n public createVertexBuffers(updateBuffer: Buffer, renderVertexBuffers: { [key: string]: VertexBuffer }): void {\r\n this._renderVertexBuffers.push(renderVertexBuffers);\r\n }\r\n\r\n public createParticleBuffer(data: number[]): DataArray | DataBuffer {\r\n const buffer = new StorageBuffer(\r\n this._engine,\r\n data.length * 4,\r\n Constants.BUFFER_CREATIONFLAG_READWRITE | Constants.BUFFER_CREATIONFLAG_VERTEX,\r\n \"ComputeShaderParticleSystemBuffer\"\r\n );\r\n\r\n buffer.update(data);\r\n this._bufferComputeShader.push(buffer);\r\n\r\n return buffer.getBuffer();\r\n }\r\n\r\n public bindDrawBuffers(index: number, effect: Effect, indexBuffer: Nullable<DataBuffer>): void {\r\n this._engine.bindBuffers(this._renderVertexBuffers[index], indexBuffer, effect);\r\n }\r\n\r\n public preUpdateParticleBuffer(): void {}\r\n\r\n public updateParticleBuffer(index: number, targetBuffer: Buffer, currentActiveCount: number): void {\r\n this._simParamsComputeShader.update();\r\n\r\n this._updateComputeShader.setTexture(\"randomTexture\", this._parent._randomTexture, false);\r\n this._updateComputeShader.setTexture(\"randomTexture2\", this._parent._randomTexture2, false);\r\n if (this._parent._sizeGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"sizeGradientTexture\", this._parent._sizeGradientsTexture);\r\n }\r\n\r\n if (this._parent._angularSpeedGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"angularSpeedGradientTexture\", this._parent._angularSpeedGradientsTexture);\r\n }\r\n\r\n if (this._parent._velocityGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"velocityGradientTexture\", this._parent._velocityGradientsTexture);\r\n }\r\n\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"limitVelocityGradientTexture\", this._parent._limitVelocityGradientsTexture);\r\n }\r\n\r\n if (this._parent._dragGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"dragGradientTexture\", this._parent._dragGradientsTexture);\r\n }\r\n\r\n if (this._parent.noiseTexture) {\r\n this._updateComputeShader.setTexture(\"noiseTexture\", this._parent.noiseTexture);\r\n }\r\n\r\n this._updateComputeShader.setStorageBuffer(\"particlesIn\", this._bufferComputeShader[index]);\r\n this._updateComputeShader.setStorageBuffer(\"particlesOut\", this._bufferComputeShader[index ^ 1]);\r\n\r\n this._updateComputeShader.dispatch(Math.ceil(currentActiveCount / 64));\r\n }\r\n\r\n public releaseBuffers(): void {\r\n for (let i = 0; i < this._bufferComputeShader.length; ++i) {\r\n this._bufferComputeShader[i].dispose();\r\n }\r\n\r\n this._bufferComputeShader.length = 0;\r\n\r\n this._simParamsComputeShader?.dispose();\r\n (<any>this._simParamsComputeShader) = null;\r\n\r\n (<any>this._updateComputeShader) = null;\r\n }\r\n\r\n public releaseVertexBuffers(): void {\r\n this._renderVertexBuffers.length = 0;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ComputeShaderParticleSystem\", ComputeShaderParticleSystem);\r\n"]}
|
|
1
|
+
{"version":3,"file":"computeShaderParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/computeShaderParticleSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAGnG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,2CAA2C,CAAC;AAEnD,gBAAgB;AAChB,MAAM,OAAO,2BAA2B;IAUpC,YAAY,MAAyB,EAAE,MAAsB;QALrD,yBAAoB,GAAoB,EAAE,CAAC;QAC3C,yBAAoB,GAA2C,EAAE,CAAC;QAE1D,sBAAiB,GAAG,IAAI,CAAC;QAGrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAEM,WAAW;QACd,IAAI,CAAC,oBAAoB,GAAG,SAAgB,CAAC;QAC7C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ACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACvD,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC1C;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;QAErC,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,uBAAwB,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,oBAAqB,GAAG,IAAI,CAAC;IAC5C,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ;AAED,aAAa,CAAC,qCAAqC,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { WebGPUEngine } from \"../Engines/webgpuEngine\";\r\nimport { StorageBuffer } from \"../Buffers/storageBuffer\";\r\nimport { ComputeShader } from \"../Compute/computeShader\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport type { IGPUParticleSystemPlatform } from \"./IGPUParticleSystemPlatform\";\r\nimport type { Buffer, VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { GPUParticleSystem } from \"./gpuParticleSystem\";\r\n\r\nimport type { DataArray, Nullable } from \"../types\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { UniformBufferEffectCommonAccessor } from \"../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { ComputeBindingMapping } from \"../Engines/Extensions/engine.computeShader\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nimport \"../ShadersWGSL/gpuUpdateParticles.compute\";\r\n\r\n/** @internal */\r\nexport class ComputeShaderParticleSystem implements IGPUParticleSystemPlatform {\r\n private _parent: GPUParticleSystem;\r\n private _engine: AbstractEngine;\r\n private _updateComputeShader: ComputeShader;\r\n private _simParamsComputeShader: UniformBuffer;\r\n private _bufferComputeShader: StorageBuffer[] = [];\r\n private _renderVertexBuffers: Array<{ [key: string]: VertexBuffer }> = [];\r\n\r\n public readonly alignDataInBuffer = true;\r\n\r\n constructor(parent: GPUParticleSystem, engine: AbstractEngine) {\r\n this._parent = parent;\r\n this._engine = engine;\r\n }\r\n\r\n public contextLost(): void {\r\n this._updateComputeShader = undefined as any;\r\n this._bufferComputeShader.length = 0;\r\n this._renderVertexBuffers.length = 0;\r\n }\r\n\r\n public isUpdateBufferCreated(): boolean {\r\n return !!this._updateComputeShader;\r\n }\r\n\r\n public isUpdateBufferReady(): boolean {\r\n return this._updateComputeShader?.isReady() ?? false;\r\n }\r\n\r\n public createUpdateBuffer(defines: string): UniformBufferEffectCommonAccessor {\r\n const bindingsMapping: ComputeBindingMapping = {\r\n params: { group: 0, binding: 0 },\r\n particlesIn: { group: 0, binding: 1 },\r\n particlesOut: { group: 0, binding: 2 },\r\n randomTexture: { group: 0, binding: 3 },\r\n randomTexture2: { group: 0, binding: 4 },\r\n };\r\n if (this._parent._sizeGradientsTexture) {\r\n bindingsMapping[\"sizeGradientTexture\"] = { group: 1, binding: 1 };\r\n }\r\n if (this._parent._angularSpeedGradientsTexture) {\r\n bindingsMapping[\"angularSpeedGradientTexture\"] = { group: 1, binding: 3 };\r\n }\r\n if (this._parent._velocityGradientsTexture) {\r\n bindingsMapping[\"velocityGradientTexture\"] = { group: 1, binding: 5 };\r\n }\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n bindingsMapping[\"limitVelocityGradientTexture\"] = { group: 1, binding: 7 };\r\n }\r\n if (this._parent._dragGradientsTexture) {\r\n bindingsMapping[\"dragGradientTexture\"] = { group: 1, binding: 9 };\r\n }\r\n if (this._parent.noiseTexture) {\r\n bindingsMapping[\"noiseTexture\"] = { group: 1, binding: 11 };\r\n }\r\n\r\n this._updateComputeShader = new ComputeShader(\"updateParticles\", this._engine as WebGPUEngine, \"gpuUpdateParticles\", { bindingsMapping, defines: defines.split(\"\\n\") });\r\n\r\n this._simParamsComputeShader?.dispose();\r\n this._simParamsComputeShader = new UniformBuffer(this._engine, undefined, undefined, \"ComputeShaderParticleSystemUBO\");\r\n\r\n this._simParamsComputeShader.addUniform(\"currentCount\", 1);\r\n this._simParamsComputeShader.addUniform(\"timeDelta\", 1);\r\n this._simParamsComputeShader.addUniform(\"stopFactor\", 1);\r\n this._simParamsComputeShader.addUniform(\"randomTextureSize\", 1);\r\n this._simParamsComputeShader.addUniform(\"lifeTime\", 2);\r\n this._simParamsComputeShader.addUniform(\"emitPower\", 2);\r\n if (!this._parent._colorGradientsTexture) {\r\n this._simParamsComputeShader.addUniform(\"color1\", 4);\r\n this._simParamsComputeShader.addUniform(\"color2\", 4);\r\n }\r\n this._simParamsComputeShader.addUniform(\"sizeRange\", 2);\r\n this._simParamsComputeShader.addUniform(\"scaleRange\", 4);\r\n this._simParamsComputeShader.addUniform(\"angleRange\", 4);\r\n this._simParamsComputeShader.addUniform(\"gravity\", 3);\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n this._simParamsComputeShader.addUniform(\"limitVelocityDamping\", 1);\r\n }\r\n if (this._parent.isAnimationSheetEnabled) {\r\n this._simParamsComputeShader.addUniform(\"cellInfos\", 4);\r\n }\r\n if (this._parent.noiseTexture) {\r\n this._simParamsComputeShader.addUniform(\"noiseStrength\", 3);\r\n }\r\n if (!this._parent.isLocal) {\r\n this._simParamsComputeShader.addUniform(\"emitterWM\", 16);\r\n }\r\n if (this._parent.particleEmitterType) {\r\n this._parent.particleEmitterType.buildUniformLayout(this._simParamsComputeShader);\r\n }\r\n\r\n this._updateComputeShader.setUniformBuffer(\"params\", this._simParamsComputeShader);\r\n\r\n return new UniformBufferEffectCommonAccessor(this._simParamsComputeShader);\r\n }\r\n\r\n public createVertexBuffers(updateBuffer: Buffer, renderVertexBuffers: { [key: string]: VertexBuffer }): void {\r\n this._renderVertexBuffers.push(renderVertexBuffers);\r\n }\r\n\r\n public createParticleBuffer(data: number[]): DataArray | DataBuffer {\r\n const buffer = new StorageBuffer(\r\n this._engine,\r\n data.length * 4,\r\n Constants.BUFFER_CREATIONFLAG_READWRITE | Constants.BUFFER_CREATIONFLAG_VERTEX,\r\n \"ComputeShaderParticleSystemBuffer\"\r\n );\r\n\r\n buffer.update(data);\r\n this._bufferComputeShader.push(buffer);\r\n\r\n return buffer.getBuffer();\r\n }\r\n\r\n public bindDrawBuffers(index: number, effect: Effect, indexBuffer: Nullable<DataBuffer>): void {\r\n this._engine.bindBuffers(this._renderVertexBuffers[index], indexBuffer, effect);\r\n }\r\n\r\n public preUpdateParticleBuffer(): void {}\r\n\r\n public updateParticleBuffer(index: number, targetBuffer: Buffer, currentActiveCount: number): void {\r\n this._simParamsComputeShader.update();\r\n\r\n this._updateComputeShader.setTexture(\"randomTexture\", this._parent._randomTexture, false);\r\n this._updateComputeShader.setTexture(\"randomTexture2\", this._parent._randomTexture2, false);\r\n if (this._parent._sizeGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"sizeGradientTexture\", this._parent._sizeGradientsTexture);\r\n }\r\n\r\n if (this._parent._angularSpeedGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"angularSpeedGradientTexture\", this._parent._angularSpeedGradientsTexture);\r\n }\r\n\r\n if (this._parent._velocityGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"velocityGradientTexture\", this._parent._velocityGradientsTexture);\r\n }\r\n\r\n if (this._parent._limitVelocityGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"limitVelocityGradientTexture\", this._parent._limitVelocityGradientsTexture);\r\n }\r\n\r\n if (this._parent._dragGradientsTexture) {\r\n this._updateComputeShader.setTexture(\"dragGradientTexture\", this._parent._dragGradientsTexture);\r\n }\r\n\r\n if (this._parent.noiseTexture) {\r\n this._updateComputeShader.setTexture(\"noiseTexture\", this._parent.noiseTexture);\r\n }\r\n\r\n this._updateComputeShader.setStorageBuffer(\"particlesIn\", this._bufferComputeShader[index]);\r\n this._updateComputeShader.setStorageBuffer(\"particlesOut\", this._bufferComputeShader[index ^ 1]);\r\n\r\n this._updateComputeShader.dispatch(Math.ceil(currentActiveCount / 64));\r\n }\r\n\r\n public releaseBuffers(): void {\r\n for (let i = 0; i < this._bufferComputeShader.length; ++i) {\r\n this._bufferComputeShader[i].dispose();\r\n }\r\n\r\n this._bufferComputeShader.length = 0;\r\n\r\n this._simParamsComputeShader?.dispose();\r\n (<any>this._simParamsComputeShader) = null;\r\n\r\n (<any>this._updateComputeShader) = null;\r\n }\r\n\r\n public releaseVertexBuffers(): void {\r\n this._renderVertexBuffers.length = 0;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ComputeShaderParticleSystem\", ComputeShaderParticleSystem);\r\n"]}
|
|
@@ -11,7 +11,7 @@ import type { IDisposable } from "../scene";
|
|
|
11
11
|
import type { Effect } from "../Materials/effect";
|
|
12
12
|
import { RawTexture } from "../Materials/Textures/rawTexture";
|
|
13
13
|
import type { IAnimatable } from "../Animations/animatable.interface";
|
|
14
|
-
import {
|
|
14
|
+
import { AbstractEngine } from "../Engines/abstractEngine";
|
|
15
15
|
import type { DataBuffer } from "../Buffers/dataBuffer";
|
|
16
16
|
import { DrawWrapper } from "../Materials/drawWrapper";
|
|
17
17
|
import { Scene } from "../scene";
|
|
@@ -436,7 +436,7 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
|
|
|
436
436
|
constructor(name: string, options: Partial<{
|
|
437
437
|
capacity: number;
|
|
438
438
|
randomTextureSize: number;
|
|
439
|
-
}>, sceneOrEngine: Scene |
|
|
439
|
+
}>, sceneOrEngine: Scene | AbstractEngine, customEffect?: Nullable<Effect>, isAnimationSheetEnabled?: boolean);
|
|
440
440
|
protected _reset(): void;
|
|
441
441
|
private _createVertexBuffers;
|
|
442
442
|
private _initialize;
|
|
@@ -522,5 +522,5 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
|
|
|
522
522
|
* @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
|
|
523
523
|
* @returns the parsed GPU particle system
|
|
524
524
|
*/
|
|
525
|
-
static Parse(parsedParticleSystem: any, sceneOrEngine: Scene |
|
|
525
|
+
static Parse(parsedParticleSystem: any, sceneOrEngine: Scene | AbstractEngine, rootUrl: string, doNotStart?: boolean, capacity?: number): GPUParticleSystem;
|
|
526
526
|
}
|
|
@@ -12,7 +12,7 @@ import { RawTexture } from "../Materials/Textures/rawTexture.js";
|
|
|
12
12
|
|
|
13
13
|
import { EngineStore } from "../Engines/engineStore.js";
|
|
14
14
|
import { CustomParticleEmitter } from "./EmitterTypes/customParticleEmitter.js";
|
|
15
|
-
import {
|
|
15
|
+
import { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
16
16
|
import { DrawWrapper } from "../Materials/drawWrapper.js";
|
|
17
17
|
import { GetClass } from "../Misc/typeStore.js";
|
|
18
18
|
import { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from "../Materials/clipPlaneMaterialHelper.js";
|
|
@@ -1643,7 +1643,7 @@ export class GPUParticleSystem extends BaseParticleSystem {
|
|
|
1643
1643
|
const name = parsedParticleSystem.name;
|
|
1644
1644
|
let engine;
|
|
1645
1645
|
let scene;
|
|
1646
|
-
if (sceneOrEngine instanceof
|
|
1646
|
+
if (sceneOrEngine instanceof AbstractEngine) {
|
|
1647
1647
|
engine = sceneOrEngine;
|
|
1648
1648
|
}
|
|
1649
1649
|
else {
|