@babylonjs/core 8.11.0 → 8.12.1
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/Cameras/arcRotateCamera.js +8 -0
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/targetCamera.js +2 -0
- package/Cameras/targetCamera.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +4 -0
- package/Collisions/gpuPicker.js +6 -0
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +4 -0
- package/Engines/constants.js +4 -0
- package/Engines/constants.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +2 -0
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.d.ts +6 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +29 -0
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +36 -9
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -0
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.js +1 -0
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +23 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +126 -21
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +5 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -4
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +4 -17
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/frameGraph.js +1 -1
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphContext.d.ts +30 -0
- package/FrameGraph/frameGraphContext.js +47 -0
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +1 -4
- package/FrameGraph/frameGraphRenderContext.js +2 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.d.ts +0 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +0 -12
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +4 -1
- 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 +1 -1
- 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 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +2 -2
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +3 -4
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -3
- package/Materials/Node/Blocks/Dual/textureBlock.js +2 -2
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +4 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +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/GaussianSplatting/gaussianSplattingBlock.d.ts +3 -3
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +6 -3
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -2
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -4
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -2
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +2 -3
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +5 -2
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -2
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +2 -3
- package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +2 -3
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +2 -2
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +2 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +8 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.d.ts +3 -3
- package/Materials/Node/Blocks/transformBlock.js +4 -5
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -3
- package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +28 -42
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +8 -12
- package/Materials/Node/nodeMaterialBlock.js +10 -12
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +3 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +7 -3
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +17 -6
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -0
- package/Materials/PBR/pbrBaseMaterial.js +11 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +10 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js +28 -1
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
- package/Materials/materialHelper.functions.js +1 -1
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.js +7 -0
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -0
- package/Materials/standardMaterial.js +11 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +7 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +11 -5
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +6 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +42 -4
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +8 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/minMaxReducer.d.ts +8 -6
- package/Misc/minMaxReducer.js +57 -90
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/observable.d.ts +1 -1
- package/Misc/observable.js.map +1 -1
- package/Misc/thinMinMaxReducer.d.ts +47 -0
- package/Misc/thinMinMaxReducer.js +148 -0
- package/Misc/thinMinMaxReducer.js.map +1 -0
- package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -0
- package/Particles/EmitterTypes/customParticleEmitter.js +9 -1
- package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +8 -0
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.d.ts +75 -0
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +179 -0
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +47 -0
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +107 -0
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +46 -0
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +97 -0
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +84 -0
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +48 -0
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +120 -0
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/index.d.ts +7 -0
- package/Particles/Node/Blocks/Emitters/index.js +8 -0
- package/Particles/Node/Blocks/Emitters/index.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +86 -0
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +53 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +111 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +43 -0
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +108 -0
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.d.ts +48 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js +100 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js.map +1 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.d.ts +47 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js +82 -0
- package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js.map +1 -0
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.d.ts +48 -0
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js +133 -0
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js.map +1 -0
- package/Particles/Node/Blocks/Triggers/triggerTools.d.ts +9 -0
- package/Particles/Node/Blocks/Triggers/triggerTools.js +16 -0
- package/Particles/Node/Blocks/Triggers/triggerTools.js.map +1 -0
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +31 -0
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +64 -0
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.d.ts +31 -0
- package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js +63 -0
- package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateAngleBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateAngleBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateAngleBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateColorBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateColorBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateColorBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateDirectionBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateDirectionBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateDirectionBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +41 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +102 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updatePositionBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updatePositionBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updatePositionBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateScaleBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateScaleBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateScaleBlock.js.map +1 -0
- package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js +74 -0
- package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +27 -0
- package/Particles/Node/Blocks/index.js +29 -0
- package/Particles/Node/Blocks/index.js.map +1 -0
- package/Particles/Node/Blocks/particleConverterBlock.d.ts +85 -0
- package/Particles/Node/Blocks/particleConverterBlock.js +267 -0
- package/Particles/Node/Blocks/particleConverterBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleDebugBlock.d.ts +37 -0
- package/Particles/Node/Blocks/particleDebugBlock.js +109 -0
- package/Particles/Node/Blocks/particleDebugBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleElbowBlock.d.ts +27 -0
- package/Particles/Node/Blocks/particleElbowBlock.js +47 -0
- package/Particles/Node/Blocks/particleElbowBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleGradientBlock.d.ts +28 -0
- package/Particles/Node/Blocks/particleGradientBlock.js +118 -0
- package/Particles/Node/Blocks/particleGradientBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleGradientValueBlock.d.ts +32 -0
- package/Particles/Node/Blocks/particleGradientValueBlock.js +79 -0
- package/Particles/Node/Blocks/particleGradientValueBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleInputBlock.d.ts +87 -0
- package/Particles/Node/Blocks/particleInputBlock.js +279 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleLerpBlock.d.ts +34 -0
- package/Particles/Node/Blocks/particleLerpBlock.js +92 -0
- package/Particles/Node/Blocks/particleLerpBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleMathBlock.d.ts +64 -0
- package/Particles/Node/Blocks/particleMathBlock.js +321 -0
- package/Particles/Node/Blocks/particleMathBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleRandomBlock.d.ts +52 -0
- package/Particles/Node/Blocks/particleRandomBlock.js +161 -0
- package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +65 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +173 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleTrigonometryBlock.d.ts +80 -0
- package/Particles/Node/Blocks/particleTrigonometryBlock.js +272 -0
- package/Particles/Node/Blocks/particleTrigonometryBlock.js.map +1 -0
- package/Particles/Node/Blocks/randomRangeBlock.d.ts +45 -0
- package/Particles/Node/Blocks/randomRangeBlock.js +151 -0
- package/Particles/Node/Blocks/randomRangeBlock.js.map +1 -0
- package/Particles/Node/Blocks/systemBlock.d.ts +71 -0
- package/Particles/Node/Blocks/systemBlock.js +193 -0
- package/Particles/Node/Blocks/systemBlock.js.map +1 -0
- package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.d.ts +39 -0
- package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js +41 -0
- package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js.map +1 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +31 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js +34 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -0
- package/Particles/Node/Enums/nodeParticleSystemSources.d.ts +13 -0
- package/Particles/Node/Enums/nodeParticleSystemSources.js +15 -0
- package/Particles/Node/Enums/nodeParticleSystemSources.js.map +1 -0
- package/Particles/Node/index.d.ts +8 -0
- package/Particles/Node/index.js +10 -0
- package/Particles/Node/index.js.map +1 -0
- package/Particles/Node/nodeParticleBlock.d.ts +154 -0
- package/Particles/Node/nodeParticleBlock.js +355 -0
- package/Particles/Node/nodeParticleBlock.js.map +1 -0
- package/Particles/Node/nodeParticleBlockConnectionPoint.d.ts +188 -0
- package/Particles/Node/nodeParticleBlockConnectionPoint.js +337 -0
- package/Particles/Node/nodeParticleBlockConnectionPoint.js.map +1 -0
- package/Particles/Node/nodeParticleBuildState.d.ts +89 -0
- package/Particles/Node/nodeParticleBuildState.js +170 -0
- package/Particles/Node/nodeParticleBuildState.js.map +1 -0
- package/Particles/Node/nodeParticleSystemSet.d.ts +121 -0
- package/Particles/Node/nodeParticleSystemSet.js +383 -0
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -0
- package/Particles/Queue/executionQueue.d.ts +2 -0
- package/Particles/Queue/executionQueue.js +10 -0
- package/Particles/Queue/executionQueue.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +6 -1
- package/Particles/baseParticleSystem.js +7 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/flowMap.d.ts +7 -0
- package/Particles/flowMap.js +32 -0
- package/Particles/flowMap.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +4 -0
- package/Particles/gpuParticleSystem.js +4 -0
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/index.d.ts +1 -0
- package/Particles/index.js +1 -0
- package/Particles/index.js.map +1 -1
- package/Particles/particleSystem.d.ts +12 -0
- package/Particles/particleSystem.js +22 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +32 -11
- package/Particles/thinParticleSystem.js +62 -36
- package/Particles/thinParticleSystem.js.map +1 -1
- package/PostProcesses/postProcessManager.d.ts +2 -1
- package/PostProcesses/postProcessManager.js +3 -2
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/defaultVertexDeclaration.js +1 -0
- package/Shaders/ShadersInclude/defaultVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +5 -2
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
- package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +1 -0
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/prePassDeclaration.js +3 -0
- package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/prePassVertex.js +3 -0
- package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
- package/Shaders/ShadersInclude/prePassVertexDeclaration.js +3 -0
- package/Shaders/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
- package/Shaders/default.fragment.js +3 -0
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/minmaxRedux.fragment.js +13 -5
- package/Shaders/minmaxRedux.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +5 -2
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +3 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +3 -0
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/minmaxRedux.fragment.js +14 -6
- package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +5 -0
- package/scene.js +8 -0
- package/scene.js.map +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
/**
|
|
3
|
+
* Defines the kind of contextual sources for node particles
|
|
4
|
+
*/
|
|
5
|
+
export var NodeParticleContextualSources;
|
|
6
|
+
(function (NodeParticleContextualSources) {
|
|
7
|
+
/** None */
|
|
8
|
+
NodeParticleContextualSources[NodeParticleContextualSources["None"] = 0] = "None";
|
|
9
|
+
/** Position */
|
|
10
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Position"] = 1] = "Position";
|
|
11
|
+
/** Direction */
|
|
12
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Direction"] = 2] = "Direction";
|
|
13
|
+
/** Age */
|
|
14
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Age"] = 3] = "Age";
|
|
15
|
+
/** Lifetime */
|
|
16
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Lifetime"] = 4] = "Lifetime";
|
|
17
|
+
/** Color */
|
|
18
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Color"] = 5] = "Color";
|
|
19
|
+
/** ScaledDirection */
|
|
20
|
+
NodeParticleContextualSources[NodeParticleContextualSources["ScaledDirection"] = 6] = "ScaledDirection";
|
|
21
|
+
/** Scale */
|
|
22
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Scale"] = 7] = "Scale";
|
|
23
|
+
/** AgeGradient */
|
|
24
|
+
NodeParticleContextualSources[NodeParticleContextualSources["AgeGradient"] = 8] = "AgeGradient";
|
|
25
|
+
/** Angle */
|
|
26
|
+
NodeParticleContextualSources[NodeParticleContextualSources["Angle"] = 9] = "Angle";
|
|
27
|
+
/** SpriteCellIndex */
|
|
28
|
+
NodeParticleContextualSources[NodeParticleContextualSources["SpriteCellIndex"] = 16] = "SpriteCellIndex";
|
|
29
|
+
/** SpriteCellStart */
|
|
30
|
+
NodeParticleContextualSources[NodeParticleContextualSources["SpriteCellStart"] = 17] = "SpriteCellStart";
|
|
31
|
+
/** SpriteCellEnd */
|
|
32
|
+
NodeParticleContextualSources[NodeParticleContextualSources["SpriteCellEnd"] = 18] = "SpriteCellEnd";
|
|
33
|
+
})(NodeParticleContextualSources || (NodeParticleContextualSources = {}));
|
|
34
|
+
//# sourceMappingURL=nodeParticleContextualSources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeParticleContextualSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Enums/nodeParticleContextualSources.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD;;GAEG;AACH,MAAM,CAAN,IAAY,6BA2BX;AA3BD,WAAY,6BAA6B;IACrC,WAAW;IACX,iFAAa,CAAA;IACb,eAAe;IACf,yFAAiB,CAAA;IACjB,gBAAgB;IAChB,2FAAkB,CAAA;IAClB,UAAU;IACV,+EAAY,CAAA;IACZ,eAAe;IACf,yFAAiB,CAAA;IACjB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,uGAAwB,CAAA;IACxB,YAAY;IACZ,mFAAc,CAAA;IACd,kBAAkB;IAClB,+FAAoB,CAAA;IACpB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,oBAAoB;IACpB,oGAAsB,CAAA;AAC1B,CAAC,EA3BW,6BAA6B,KAA7B,6BAA6B,QA2BxC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/**\r\n * Defines the kind of contextual sources for node particles\r\n */\r\nexport enum NodeParticleContextualSources {\r\n /** None */\r\n None = 0x0000,\r\n /** Position */\r\n Position = 0x0001,\r\n /** Direction */\r\n Direction = 0x0002,\r\n /** Age */\r\n Age = 0x0003,\r\n /** Lifetime */\r\n Lifetime = 0x0004,\r\n /** Color */\r\n Color = 0x0005,\r\n /** ScaledDirection */\r\n ScaledDirection = 0x0006,\r\n /** Scale */\r\n Scale = 0x0007,\r\n /** AgeGradient */\r\n AgeGradient = 0x0008,\r\n /** Angle */\r\n Angle = 0x0009,\r\n /** SpriteCellIndex */\r\n SpriteCellIndex = 0x0010,\r\n /** SpriteCellStart */\r\n SpriteCellStart = 0x0011,\r\n /** SpriteCellEnd */\r\n SpriteCellEnd = 0x0012,\r\n}\r\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum used to define system values e.g. values automatically provided by the system
|
|
3
|
+
*/
|
|
4
|
+
export declare enum NodeParticleSystemSources {
|
|
5
|
+
/** None */
|
|
6
|
+
None = 0,
|
|
7
|
+
/** Time */
|
|
8
|
+
Time = 1,
|
|
9
|
+
/** Delta time */
|
|
10
|
+
Delta = 2,
|
|
11
|
+
/** Emitter */
|
|
12
|
+
Emitter = 3
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum used to define system values e.g. values automatically provided by the system
|
|
3
|
+
*/
|
|
4
|
+
export var NodeParticleSystemSources;
|
|
5
|
+
(function (NodeParticleSystemSources) {
|
|
6
|
+
/** None */
|
|
7
|
+
NodeParticleSystemSources[NodeParticleSystemSources["None"] = 0] = "None";
|
|
8
|
+
/** Time */
|
|
9
|
+
NodeParticleSystemSources[NodeParticleSystemSources["Time"] = 1] = "Time";
|
|
10
|
+
/** Delta time */
|
|
11
|
+
NodeParticleSystemSources[NodeParticleSystemSources["Delta"] = 2] = "Delta";
|
|
12
|
+
/** Emitter */
|
|
13
|
+
NodeParticleSystemSources[NodeParticleSystemSources["Emitter"] = 3] = "Emitter";
|
|
14
|
+
})(NodeParticleSystemSources || (NodeParticleSystemSources = {}));
|
|
15
|
+
//# sourceMappingURL=nodeParticleSystemSources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeParticleSystemSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Enums/nodeParticleSystemSources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,yBASX;AATD,WAAY,yBAAyB;IACjC,WAAW;IACX,yEAAQ,CAAA;IACR,WAAW;IACX,yEAAQ,CAAA;IACR,iBAAiB;IACjB,2EAAS,CAAA;IACT,cAAc;IACd,+EAAW,CAAA;AACf,CAAC,EATW,yBAAyB,KAAzB,yBAAyB,QASpC","sourcesContent":["/**\r\n * Enum used to define system values e.g. values automatically provided by the system\r\n */\r\nexport enum NodeParticleSystemSources {\r\n /** None */\r\n None = 0,\r\n /** Time */\r\n Time = 1,\r\n /** Delta time */\r\n Delta = 2,\r\n /** Emitter */\r\n Emitter = 3,\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./nodeParticleBlock.js";
|
|
2
|
+
export * from "./nodeParticleSystemSet.js";
|
|
3
|
+
export * from "./nodeParticleBlockConnectionPoint.js";
|
|
4
|
+
export * from "./nodeParticleBuildState.js";
|
|
5
|
+
export * from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
6
|
+
export * from "./Enums/nodeParticleContextualSources.js";
|
|
7
|
+
export * from "./Enums/nodeParticleSystemSources.js";
|
|
8
|
+
export * from "./Blocks/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
export * from "./nodeParticleBlock.js";
|
|
3
|
+
export * from "./nodeParticleSystemSet.js";
|
|
4
|
+
export * from "./nodeParticleBlockConnectionPoint.js";
|
|
5
|
+
export * from "./nodeParticleBuildState.js";
|
|
6
|
+
export * from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
7
|
+
export * from "./Enums/nodeParticleContextualSources.js";
|
|
8
|
+
export * from "./Enums/nodeParticleSystemSources.js";
|
|
9
|
+
export * from "./Blocks/index.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./nodeParticleBlock\";\r\nexport * from \"./nodeParticleSystemSet\";\r\nexport * from \"./nodeParticleBlockConnectionPoint\";\r\nexport * from \"./nodeParticleBuildState\";\r\nexport * from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nexport * from \"./Enums/nodeParticleContextualSources\";\r\nexport * from \"./Enums/nodeParticleSystemSources\";\r\nexport * from \"./Blocks/index\";\r\n"]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { NodeParticleConnectionPoint } from "./nodeParticleBlockConnectionPoint.js";
|
|
2
|
+
import type { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
3
|
+
import type { NodeParticleBuildState } from "./nodeParticleBuildState.js";
|
|
4
|
+
import { Observable } from "../../Misc/observable.js";
|
|
5
|
+
/**
|
|
6
|
+
* Defines a block that can be used inside a node based particle system
|
|
7
|
+
*/
|
|
8
|
+
export declare class NodeParticleBlock {
|
|
9
|
+
private _name;
|
|
10
|
+
protected _buildId: number;
|
|
11
|
+
protected _isInput: boolean;
|
|
12
|
+
protected _isSystem: boolean;
|
|
13
|
+
protected _isDebug: boolean;
|
|
14
|
+
protected _isTeleportOut: boolean;
|
|
15
|
+
protected _isTeleportIn: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets the unique id of the node
|
|
18
|
+
*/
|
|
19
|
+
uniqueId: number;
|
|
20
|
+
/** @internal */
|
|
21
|
+
_inputs: NodeParticleConnectionPoint[];
|
|
22
|
+
/** @internal */
|
|
23
|
+
_outputs: NodeParticleConnectionPoint[];
|
|
24
|
+
/**
|
|
25
|
+
* Gets an observable raised when the block is built
|
|
26
|
+
*/
|
|
27
|
+
onBuildObservable: Observable<NodeParticleBlock>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets an observable raised when the block is disposed
|
|
30
|
+
*/
|
|
31
|
+
onDisposeObservable: Observable<NodeParticleBlock>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets an observable raised when the inputs of the block change
|
|
34
|
+
*/
|
|
35
|
+
onInputChangedObservable: Observable<NodeParticleConnectionPoint>;
|
|
36
|
+
/**
|
|
37
|
+
* Gets a boolean indicating if this block is a teleport out
|
|
38
|
+
*/
|
|
39
|
+
get isTeleportOut(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Gets a boolean indicating if this block is a teleport in
|
|
42
|
+
*/
|
|
43
|
+
get isTeleportIn(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Gets a boolean indicating that this block is a system block
|
|
46
|
+
*/
|
|
47
|
+
get isSystem(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Gets a boolean indicating that this block is an input block
|
|
50
|
+
*/
|
|
51
|
+
get isInput(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Gets a boolean indicating if this block is a debug block
|
|
54
|
+
*/
|
|
55
|
+
get isDebug(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* A free comment about the block
|
|
58
|
+
*/
|
|
59
|
+
comments: string;
|
|
60
|
+
/** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */
|
|
61
|
+
visibleOnFrame: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Gets or set the name of the block
|
|
64
|
+
*/
|
|
65
|
+
get name(): string;
|
|
66
|
+
set name(value: string);
|
|
67
|
+
/**
|
|
68
|
+
* Gets the current class name e.g. "NodeParticleBlock"
|
|
69
|
+
* @returns the class name
|
|
70
|
+
*/
|
|
71
|
+
getClassName(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the list of input points
|
|
74
|
+
*/
|
|
75
|
+
get inputs(): NodeParticleConnectionPoint[];
|
|
76
|
+
/** Gets the list of output points */
|
|
77
|
+
get outputs(): NodeParticleConnectionPoint[];
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new NodeParticleBlock
|
|
80
|
+
* @param name defines the block name
|
|
81
|
+
*/
|
|
82
|
+
constructor(name: string);
|
|
83
|
+
protected _inputRename(name: string): string;
|
|
84
|
+
protected _outputRename(name: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if the current block is an ancestor of a given block
|
|
87
|
+
* @param block defines the potential descendant block to check
|
|
88
|
+
* @returns true if block is a descendant
|
|
89
|
+
*/
|
|
90
|
+
isAnAncestorOf(block: NodeParticleBlock): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Checks if the current block is an ancestor of a given type
|
|
93
|
+
* @param type defines the potential type to check
|
|
94
|
+
* @returns true if block is a descendant
|
|
95
|
+
*/
|
|
96
|
+
isAnAncestorOfType(type: string): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Find an input by its name
|
|
99
|
+
* @param name defines the name of the input to look for
|
|
100
|
+
* @returns the input or null if not found
|
|
101
|
+
*/
|
|
102
|
+
getInputByName(name: string): NodeParticleConnectionPoint | null;
|
|
103
|
+
protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling?: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* Register a new input. Must be called inside a block constructor
|
|
106
|
+
* @param name defines the connection point name
|
|
107
|
+
* @param type defines the connection point type
|
|
108
|
+
* @param isOptional defines a boolean indicating that this input can be omitted
|
|
109
|
+
* @param value value to return if there is no connection
|
|
110
|
+
* @param valueMin min value accepted for value
|
|
111
|
+
* @param valueMax max value accepted for value
|
|
112
|
+
* @returns the current block
|
|
113
|
+
*/
|
|
114
|
+
registerInput(name: string, type: NodeParticleBlockConnectionPointTypes, isOptional?: boolean, value?: any, valueMin?: any, valueMax?: any): this;
|
|
115
|
+
/**
|
|
116
|
+
* Register a new output. Must be called inside a block constructor
|
|
117
|
+
* @param name defines the connection point name
|
|
118
|
+
* @param type defines the connection point type
|
|
119
|
+
* @param point an already created connection point. If not provided, create a new one
|
|
120
|
+
* @returns the current block
|
|
121
|
+
*/
|
|
122
|
+
registerOutput(name: string, type: NodeParticleBlockConnectionPointTypes, point?: NodeParticleConnectionPoint): this;
|
|
123
|
+
/**
|
|
124
|
+
* Builds the block. Must be implemented by derived classes.
|
|
125
|
+
* @param _state defines the current build state
|
|
126
|
+
*/
|
|
127
|
+
_build(_state: NodeParticleBuildState): void;
|
|
128
|
+
protected _customBuildStep(_state: NodeParticleBuildState): void;
|
|
129
|
+
/**
|
|
130
|
+
* Builds the block
|
|
131
|
+
* @param state defines the current build state
|
|
132
|
+
* @returns the built block
|
|
133
|
+
*/
|
|
134
|
+
build(state: NodeParticleBuildState): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Serializes this block in a JSON representation
|
|
137
|
+
* @returns the serialized block object
|
|
138
|
+
*/
|
|
139
|
+
serialize(): any;
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
_deserialize(serializationObject: any): void;
|
|
144
|
+
private _deserializePortDisplayNamesAndExposedOnFrame;
|
|
145
|
+
/**
|
|
146
|
+
* Clone the current block to a new identical block
|
|
147
|
+
* @returns a copy of the current block
|
|
148
|
+
*/
|
|
149
|
+
clone(): NodeParticleBlock | null;
|
|
150
|
+
/**
|
|
151
|
+
* Release resources
|
|
152
|
+
*/
|
|
153
|
+
dispose(): void;
|
|
154
|
+
}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { __decorate } from "../../tslib.es6.js";
|
|
2
|
+
import { serialize } from "../../Misc/decorators.js";
|
|
3
|
+
import { UniqueIdGenerator } from "../../Misc/uniqueIdGenerator.js";
|
|
4
|
+
import { NodeParticleConnectionPoint } from "./nodeParticleBlockConnectionPoint.js";
|
|
5
|
+
import { Logger } from "../../Misc/logger.js";
|
|
6
|
+
import { Observable } from "../../Misc/observable.js";
|
|
7
|
+
import { GetClass } from "../../Misc/typeStore.js";
|
|
8
|
+
/**
|
|
9
|
+
* Defines a block that can be used inside a node based particle system
|
|
10
|
+
*/
|
|
11
|
+
export class NodeParticleBlock {
|
|
12
|
+
/**
|
|
13
|
+
* Gets a boolean indicating if this block is a teleport out
|
|
14
|
+
*/
|
|
15
|
+
get isTeleportOut() {
|
|
16
|
+
return this._isTeleportOut;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets a boolean indicating if this block is a teleport in
|
|
20
|
+
*/
|
|
21
|
+
get isTeleportIn() {
|
|
22
|
+
return this._isTeleportIn;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets a boolean indicating that this block is a system block
|
|
26
|
+
*/
|
|
27
|
+
get isSystem() {
|
|
28
|
+
return this._isSystem;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets a boolean indicating that this block is an input block
|
|
32
|
+
*/
|
|
33
|
+
get isInput() {
|
|
34
|
+
return this._isInput;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets a boolean indicating if this block is a debug block
|
|
38
|
+
*/
|
|
39
|
+
get isDebug() {
|
|
40
|
+
return this._isDebug;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets or set the name of the block
|
|
44
|
+
*/
|
|
45
|
+
get name() {
|
|
46
|
+
return this._name;
|
|
47
|
+
}
|
|
48
|
+
set name(value) {
|
|
49
|
+
this._name = value;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the current class name e.g. "NodeParticleBlock"
|
|
53
|
+
* @returns the class name
|
|
54
|
+
*/
|
|
55
|
+
getClassName() {
|
|
56
|
+
return "NodeParticleBlock";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the list of input points
|
|
60
|
+
*/
|
|
61
|
+
get inputs() {
|
|
62
|
+
return this._inputs;
|
|
63
|
+
}
|
|
64
|
+
/** Gets the list of output points */
|
|
65
|
+
get outputs() {
|
|
66
|
+
return this._outputs;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new NodeParticleBlock
|
|
70
|
+
* @param name defines the block name
|
|
71
|
+
*/
|
|
72
|
+
constructor(name) {
|
|
73
|
+
this._name = "";
|
|
74
|
+
this._isInput = false;
|
|
75
|
+
this._isSystem = false;
|
|
76
|
+
this._isDebug = false;
|
|
77
|
+
this._isTeleportOut = false;
|
|
78
|
+
this._isTeleportIn = false;
|
|
79
|
+
/** @internal */
|
|
80
|
+
this._inputs = new Array();
|
|
81
|
+
/** @internal */
|
|
82
|
+
this._outputs = new Array();
|
|
83
|
+
/**
|
|
84
|
+
* Gets an observable raised when the block is built
|
|
85
|
+
*/
|
|
86
|
+
this.onBuildObservable = new Observable();
|
|
87
|
+
/**
|
|
88
|
+
* Gets an observable raised when the block is disposed
|
|
89
|
+
*/
|
|
90
|
+
this.onDisposeObservable = new Observable();
|
|
91
|
+
/**
|
|
92
|
+
* Gets an observable raised when the inputs of the block change
|
|
93
|
+
*/
|
|
94
|
+
this.onInputChangedObservable = new Observable();
|
|
95
|
+
/** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */
|
|
96
|
+
this.visibleOnFrame = false;
|
|
97
|
+
this._name = name;
|
|
98
|
+
this.uniqueId = UniqueIdGenerator.UniqueId;
|
|
99
|
+
}
|
|
100
|
+
_inputRename(name) {
|
|
101
|
+
return name;
|
|
102
|
+
}
|
|
103
|
+
_outputRename(name) {
|
|
104
|
+
return name;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Checks if the current block is an ancestor of a given block
|
|
108
|
+
* @param block defines the potential descendant block to check
|
|
109
|
+
* @returns true if block is a descendant
|
|
110
|
+
*/
|
|
111
|
+
isAnAncestorOf(block) {
|
|
112
|
+
for (const output of this._outputs) {
|
|
113
|
+
if (!output.hasEndpoints) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
for (const endpoint of output.endpoints) {
|
|
117
|
+
if (endpoint.ownerBlock === block) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (endpoint.ownerBlock.isAnAncestorOf(block)) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Checks if the current block is an ancestor of a given type
|
|
129
|
+
* @param type defines the potential type to check
|
|
130
|
+
* @returns true if block is a descendant
|
|
131
|
+
*/
|
|
132
|
+
isAnAncestorOfType(type) {
|
|
133
|
+
if (this.getClassName() === type) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
for (const output of this._outputs) {
|
|
137
|
+
if (!output.hasEndpoints) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
for (const endpoint of output.endpoints) {
|
|
141
|
+
if (endpoint.ownerBlock.isAnAncestorOfType(type)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Find an input by its name
|
|
150
|
+
* @param name defines the name of the input to look for
|
|
151
|
+
* @returns the input or null if not found
|
|
152
|
+
*/
|
|
153
|
+
getInputByName(name) {
|
|
154
|
+
const filter = this._inputs.filter((e) => e.name === name);
|
|
155
|
+
if (filter.length) {
|
|
156
|
+
return filter[0];
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
_linkConnectionTypes(inputIndex0, inputIndex1, looseCoupling = false) {
|
|
161
|
+
if (looseCoupling) {
|
|
162
|
+
this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];
|
|
166
|
+
this._inputs[inputIndex0]._isMainLinkSource = true;
|
|
167
|
+
}
|
|
168
|
+
this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Register a new input. Must be called inside a block constructor
|
|
172
|
+
* @param name defines the connection point name
|
|
173
|
+
* @param type defines the connection point type
|
|
174
|
+
* @param isOptional defines a boolean indicating that this input can be omitted
|
|
175
|
+
* @param value value to return if there is no connection
|
|
176
|
+
* @param valueMin min value accepted for value
|
|
177
|
+
* @param valueMax max value accepted for value
|
|
178
|
+
* @returns the current block
|
|
179
|
+
*/
|
|
180
|
+
registerInput(name, type, isOptional = false, value, valueMin, valueMax) {
|
|
181
|
+
const point = new NodeParticleConnectionPoint(name, this, 0 /* NodeParticleConnectionPointDirection.Input */);
|
|
182
|
+
point.type = type;
|
|
183
|
+
point.isOptional = isOptional;
|
|
184
|
+
point.defaultValue = value;
|
|
185
|
+
point.value = value;
|
|
186
|
+
point.valueMin = valueMin;
|
|
187
|
+
point.valueMax = valueMax;
|
|
188
|
+
this._inputs.push(point);
|
|
189
|
+
this.onInputChangedObservable.notifyObservers(point);
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Register a new output. Must be called inside a block constructor
|
|
194
|
+
* @param name defines the connection point name
|
|
195
|
+
* @param type defines the connection point type
|
|
196
|
+
* @param point an already created connection point. If not provided, create a new one
|
|
197
|
+
* @returns the current block
|
|
198
|
+
*/
|
|
199
|
+
registerOutput(name, type, point) {
|
|
200
|
+
point = point ?? new NodeParticleConnectionPoint(name, this, 1 /* NodeParticleConnectionPointDirection.Output */);
|
|
201
|
+
point.type = type;
|
|
202
|
+
this._outputs.push(point);
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Builds the block. Must be implemented by derived classes.
|
|
207
|
+
* @param _state defines the current build state
|
|
208
|
+
*/
|
|
209
|
+
_build(_state) { }
|
|
210
|
+
_customBuildStep(_state) {
|
|
211
|
+
// Must be implemented by children
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Builds the block
|
|
215
|
+
* @param state defines the current build state
|
|
216
|
+
* @returns the built block
|
|
217
|
+
*/
|
|
218
|
+
build(state) {
|
|
219
|
+
if (this._buildId === state.buildId) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
if (this._outputs.length > 0) {
|
|
223
|
+
if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug && !this.isSystem) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this._buildId = state.buildId;
|
|
228
|
+
// Check if "parent" blocks are compiled
|
|
229
|
+
for (const input of this._inputs) {
|
|
230
|
+
if (!input.connectedPoint) {
|
|
231
|
+
if (!input.isOptional) {
|
|
232
|
+
// Emit a warning
|
|
233
|
+
state.notConnectedNonOptionalInputs.push(input);
|
|
234
|
+
}
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
const block = input.connectedPoint.ownerBlock;
|
|
238
|
+
if (block && block !== this && !block.isSystem) {
|
|
239
|
+
block.build(state);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
this._customBuildStep(state);
|
|
243
|
+
// Logs
|
|
244
|
+
if (state.verbose) {
|
|
245
|
+
Logger.Log(`Building ${this.name} [${this.getClassName()}]`);
|
|
246
|
+
}
|
|
247
|
+
this._build(state);
|
|
248
|
+
this.onBuildObservable.notifyObservers(this);
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Serializes this block in a JSON representation
|
|
253
|
+
* @returns the serialized block object
|
|
254
|
+
*/
|
|
255
|
+
serialize() {
|
|
256
|
+
const serializationObject = {};
|
|
257
|
+
serializationObject.customType = "BABYLON." + this.getClassName();
|
|
258
|
+
serializationObject.id = this.uniqueId;
|
|
259
|
+
serializationObject.name = this.name;
|
|
260
|
+
serializationObject.visibleOnFrame = this.visibleOnFrame;
|
|
261
|
+
serializationObject.inputs = [];
|
|
262
|
+
serializationObject.outputs = [];
|
|
263
|
+
for (const input of this.inputs) {
|
|
264
|
+
serializationObject.inputs.push(input.serialize());
|
|
265
|
+
}
|
|
266
|
+
for (const output of this.outputs) {
|
|
267
|
+
serializationObject.outputs.push(output.serialize(false));
|
|
268
|
+
}
|
|
269
|
+
return serializationObject;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
_deserialize(serializationObject) {
|
|
275
|
+
this._name = serializationObject.name;
|
|
276
|
+
this.comments = serializationObject.comments;
|
|
277
|
+
this.visibleOnFrame = !!serializationObject.visibleOnFrame;
|
|
278
|
+
this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);
|
|
279
|
+
}
|
|
280
|
+
_deserializePortDisplayNamesAndExposedOnFrame(serializationObject) {
|
|
281
|
+
const serializedInputs = serializationObject.inputs;
|
|
282
|
+
const serializedOutputs = serializationObject.outputs;
|
|
283
|
+
if (serializedInputs) {
|
|
284
|
+
for (const port of serializedInputs) {
|
|
285
|
+
const input = this.inputs.find((i) => i.name === port.name);
|
|
286
|
+
if (!input) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (port.displayName) {
|
|
290
|
+
input.displayName = port.displayName;
|
|
291
|
+
}
|
|
292
|
+
if (port.isExposedOnFrame) {
|
|
293
|
+
input.isExposedOnFrame = port.isExposedOnFrame;
|
|
294
|
+
input.exposedPortPosition = port.exposedPortPosition;
|
|
295
|
+
}
|
|
296
|
+
if (port.value !== undefined && port.value !== null) {
|
|
297
|
+
if (port.valueType === "number") {
|
|
298
|
+
input.value = port.value;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
const valueType = GetClass(port.valueType);
|
|
302
|
+
if (valueType) {
|
|
303
|
+
input.value = valueType.FromArray(port.value);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (serializedOutputs) {
|
|
310
|
+
for (let i = 0; i < serializedOutputs.length; i++) {
|
|
311
|
+
const port = serializedOutputs[i];
|
|
312
|
+
if (port.displayName) {
|
|
313
|
+
this.outputs[i].displayName = port.displayName;
|
|
314
|
+
}
|
|
315
|
+
if (port.isExposedOnFrame) {
|
|
316
|
+
this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;
|
|
317
|
+
this.outputs[i].exposedPortPosition = port.exposedPortPosition;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Clone the current block to a new identical block
|
|
324
|
+
* @returns a copy of the current block
|
|
325
|
+
*/
|
|
326
|
+
clone() {
|
|
327
|
+
const serializationObject = this.serialize();
|
|
328
|
+
const blockType = GetClass(serializationObject.customType);
|
|
329
|
+
if (blockType) {
|
|
330
|
+
const block = new blockType();
|
|
331
|
+
block._deserialize(serializationObject);
|
|
332
|
+
return block;
|
|
333
|
+
}
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Release resources
|
|
338
|
+
*/
|
|
339
|
+
dispose() {
|
|
340
|
+
this.onDisposeObservable.notifyObservers(this);
|
|
341
|
+
this.onDisposeObservable.clear();
|
|
342
|
+
for (const input of this.inputs) {
|
|
343
|
+
input.dispose();
|
|
344
|
+
}
|
|
345
|
+
for (const output of this.outputs) {
|
|
346
|
+
output.dispose();
|
|
347
|
+
}
|
|
348
|
+
this.onBuildObservable.clear();
|
|
349
|
+
this.onInputChangedObservable.clear();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
__decorate([
|
|
353
|
+
serialize("comment")
|
|
354
|
+
], NodeParticleBlock.prototype, "comments", void 0);
|
|
355
|
+
//# sourceMappingURL=nodeParticleBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeParticleBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE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EAAE,CAAC;oBACxB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBACzD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;gBACnE,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE7C,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,KAAK,GAAsB,IAAI,SAAS,EAAE,CAAC;YACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAExC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAEjC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,KAAK,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;CACJ;AAvVU;IADN,SAAS,CAAC,SAAS,CAAC;mDACG","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\nimport { NodeParticleConnectionPoint, NodeParticleConnectionPointDirection } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node based particle system\r\n */\r\nexport class NodeParticleBlock {\r\n private _name = \"\";\r\n protected _buildId: number;\r\n protected _isInput = false;\r\n protected _isSystem = false;\r\n protected _isDebug = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeParticleConnectionPoint>();\r\n /** @internal */\r\n public _outputs = new Array<NodeParticleConnectionPoint>();\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleBlock>();\r\n\r\n /**\r\n * Gets an observable raised when the block is disposed\r\n */\r\n public onDisposeObservable = new Observable<NodeParticleBlock>();\r\n\r\n /**\r\n * Gets an observable raised when the inputs of the block change\r\n */\r\n public onInputChangedObservable = new Observable<NodeParticleConnectionPoint>();\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block is a system block\r\n */\r\n public get isSystem(): boolean {\r\n return this._isSystem;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block is an input block\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeParticleBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeParticleConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeParticleConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Creates a new NodeParticleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n this._name = name;\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeParticleBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex0]._isMainLinkSource = true;\r\n }\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param value value to return if there is no connection\r\n * @param valueMin min value accepted for value\r\n * @param valueMax max value accepted for value\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeParticleBlockConnectionPointTypes, isOptional: boolean = false, value?: any, valueMin?: any, valueMax?: any) {\r\n const point = new NodeParticleConnectionPoint(name, this, NodeParticleConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n point.defaultValue = value;\r\n point.value = value;\r\n point.valueMin = valueMin;\r\n point.valueMax = valueMax;\r\n\r\n this._inputs.push(point);\r\n\r\n this.onInputChangedObservable.notifyObservers(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeParticleBlockConnectionPointTypes, point?: NodeParticleConnectionPoint) {\r\n point = point ?? new NodeParticleConnectionPoint(name, this, NodeParticleConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Builds the block. Must be implemented by derived classes.\r\n * @param _state defines the current build state\r\n */\r\n public _build(_state: NodeParticleBuildState) {}\r\n\r\n protected _customBuildStep(_state: NodeParticleBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n * @returns the built block\r\n */\r\n public build(state: NodeParticleBuildState) {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n if (this._outputs.length > 0) {\r\n if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug && !this.isSystem) {\r\n return false;\r\n }\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this && !block.isSystem) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n Logger.Log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n this._build(state);\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.visibleOnFrame = this.visibleOnFrame;\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = !!serializationObject.visibleOnFrame;\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n if (serializedInputs) {\r\n for (const port of serializedInputs) {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n\r\n if (!input) {\r\n return;\r\n }\r\n\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n if (port.value !== undefined && port.value !== null) {\r\n if (port.valueType === \"number\") {\r\n input.value = port.value;\r\n } else {\r\n const valueType = GetClass(port.valueType);\r\n\r\n if (valueType) {\r\n input.value = valueType.FromArray(port.value);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (serializedOutputs) {\r\n for (let i = 0; i < serializedOutputs.length; i++) {\r\n const port = serializedOutputs[i];\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n\r\n const blockType = GetClass(serializationObject.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(serializationObject);\r\n\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this.onBuildObservable.clear();\r\n this.onInputChangedObservable.clear();\r\n }\r\n}\r\n"]}
|