@onerjs/core 8.41.6 → 8.41.8
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/animation.d.ts +6 -2
- package/Animations/animation.js +28 -4
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +2 -1
- package/Animations/animationGroup.js +3 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.d.ts +161 -0
- package/Animations/animatorAvatar.js +573 -0
- package/Animations/animatorAvatar.js.map +1 -0
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
- package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/Bones/index.d.ts +1 -0
- package/Bones/index.js +1 -0
- package/Bones/index.js.map +1 -1
- package/Bones/skeleton.d.ts +13 -0
- package/Bones/skeleton.functions.d.ts +26 -0
- package/Bones/skeleton.functions.js +91 -0
- package/Bones/skeleton.functions.js.map +1 -0
- package/Bones/skeleton.js +26 -0
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/geospatialCamera.js +21 -20
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +8 -1
- package/Cameras/geospatialCameraMovement.js +29 -8
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +11 -0
- package/Collisions/gpuPicker.js +148 -19
- package/Collisions/gpuPicker.js.map +1 -1
- package/Debug/skeletonViewer.d.ts +4 -8
- package/Debug/skeletonViewer.js +13 -22
- package/Debug/skeletonViewer.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.views.js +5 -2
- package/Engines/AbstractEngine/abstractEngine.views.js.map +1 -1
- package/Engines/Extensions/engine.multiview.d.ts +2 -0
- package/Engines/Extensions/engine.multiview.js +7 -3
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -0
- package/Engines/abstractEngine.js +11 -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/Instrumentation/engineInstrumentation.js +2 -1
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Layers/effectLayer.js +1 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +37 -2
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +109 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +210 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +71 -15
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +161 -0
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +0 -6
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +0 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +0 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +14 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +14 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +20 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +20 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/depthSourceBlock.d.ts +13 -0
- package/Materials/Node/Blocks/Dual/depthSourceBlock.js +13 -0
- package/Materials/Node/Blocks/Dual/depthSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Dual/fogBlock.js +21 -0
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +21 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.d.ts +38 -0
- package/Materials/Node/Blocks/Dual/lightBlock.js +38 -0
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +29 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +29 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +5 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +16 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +16 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +34 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js +34 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +17 -0
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +17 -2
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.d.ts +7 -0
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js +7 -0
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +21 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +10 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +10 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +28 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +28 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +30 -0
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +4 -0
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +5 -0
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/twirlBlock.d.ts +3 -0
- package/Materials/Node/Blocks/Fragment/twirlBlock.js +3 -0
- package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +6 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Input/inputBlock.js +16 -1
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +5 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +10 -0
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +10 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +23 -0
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +23 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +17 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +17 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +41 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +41 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +21 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +29 -0
- package/Materials/Node/Blocks/PBR/refractionBlock.js +29 -0
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +14 -0
- package/Materials/Node/Blocks/PBR/sheenBlock.js +14 -0
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +7 -0
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +7 -0
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +23 -0
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +23 -0
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.d.ts +17 -0
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +17 -0
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +22 -0
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +22 -0
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +13 -0
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +13 -0
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +20 -0
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +20 -0
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +27 -0
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +27 -0
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.d.ts +10 -0
- package/Materials/Node/Blocks/clampBlock.js +10 -0
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.d.ts +10 -0
- package/Materials/Node/Blocks/cloudBlock.js +10 -0
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.d.ts +10 -0
- package/Materials/Node/Blocks/colorMergerBlock.js +10 -0
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.d.ts +14 -0
- package/Materials/Node/Blocks/conditionalBlock.js +14 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.d.ts +10 -0
- package/Materials/Node/Blocks/curveBlock.js +10 -0
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.d.ts +10 -0
- package/Materials/Node/Blocks/customBlock.js +10 -0
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/debugBlock.d.ts +10 -0
- package/Materials/Node/Blocks/debugBlock.js +10 -0
- package/Materials/Node/Blocks/debugBlock.js.map +1 -1
- package/Materials/Node/Blocks/fresnelBlock.d.ts +4 -0
- package/Materials/Node/Blocks/fresnelBlock.js +4 -0
- package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.d.ts +10 -0
- package/Materials/Node/Blocks/gradientBlock.js +10 -0
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.d.ts +10 -0
- package/Materials/Node/Blocks/loopBlock.js +10 -0
- package/Materials/Node/Blocks/loopBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.d.ts +1 -0
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -0
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +10 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +10 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/pannerBlock.d.ts +5 -0
- package/Materials/Node/Blocks/pannerBlock.js +5 -0
- package/Materials/Node/Blocks/pannerBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.d.ts +10 -0
- package/Materials/Node/Blocks/remapBlock.js +10 -0
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.d.ts +1 -0
- package/Materials/Node/Blocks/rotate2dBlock.js +1 -0
- package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.d.ts +10 -0
- package/Materials/Node/Blocks/transformBlock.js +10 -0
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +22 -0
- package/Materials/Node/Blocks/triPlanarBlock.js +22 -0
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.d.ts +10 -0
- package/Materials/Node/Blocks/trigonometryBlock.js +10 -0
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.d.ts +10 -0
- package/Materials/Node/Blocks/vectorMergerBlock.js +10 -0
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.d.ts +5 -0
- package/Materials/Node/Blocks/viewDirectionBlock.js +5 -0
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.d.ts +10 -0
- package/Materials/Node/Blocks/waveBlock.js +10 -0
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +1 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +13 -0
- package/Materials/Node/nodeMaterial.js +14 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +0 -3
- package/Materials/Node/nodeMaterialBlock.js +1 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +1 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/index.d.ts +2 -0
- package/Materials/index.js +2 -0
- package/Materials/index.js.map +1 -1
- package/Maths/math.constants.d.ts +2 -1
- package/Maths/math.constants.js +3 -2
- package/Maths/math.constants.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +17 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +5 -0
- package/Meshes/mesh.js +39 -16
- package/Meshes/mesh.js.map +1 -1
- package/Misc/dataStorage.d.ts +13 -0
- package/Misc/dataStorage.js +25 -0
- package/Misc/dataStorage.js.map +1 -1
- package/Morph/morphTarget.d.ts +9 -5
- package/Morph/morphTarget.js +15 -7
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +3 -1
- package/Morph/morphTargetManager.js +5 -2
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/emitters.functions.js +3 -3
- package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +7 -7
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.js +2 -2
- package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +7 -7
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +9 -4
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +73 -61
- package/Particles/particle.js +106 -91
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.js +5 -5
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.function.js +83 -83
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +8 -8
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +14 -1
- package/Physics/v2/Plugins/havokPlugin.js +154 -10
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Probes/reflectionProbe.js +9 -6
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +3 -1
- package/Rendering/objectRenderer.js +28 -8
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/reflectiveShadowMap.js +1 -1
- package/Rendering/reflectiveShadowMap.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.js +8 -0
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +8 -2
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +8 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +22 -1
- package/scene.js +15 -15
- package/scene.js.map +1 -1
|
@@ -91,15 +91,15 @@ export class UpdateNoiseBlock extends NodeParticleBlock {
|
|
|
91
91
|
if (!noiseTextureData || !noiseTextureSize) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (!particle.
|
|
95
|
-
particle.
|
|
94
|
+
if (!particle._properties.randomNoiseCoordinates1) {
|
|
95
|
+
particle._properties.randomNoiseCoordinates1 = new Vector3(Math.random(), Math.random(), Math.random());
|
|
96
96
|
}
|
|
97
|
-
if (!particle.
|
|
98
|
-
particle.
|
|
97
|
+
if (!particle._properties.randomNoiseCoordinates2) {
|
|
98
|
+
particle._properties.randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());
|
|
99
99
|
}
|
|
100
|
-
const fetchedColorR = system._fetchR(particle.
|
|
101
|
-
const fetchedColorG = system._fetchR(particle.
|
|
102
|
-
const fetchedColorB = system._fetchR(particle.
|
|
100
|
+
const fetchedColorR = system._fetchR(particle._properties.randomNoiseCoordinates1.x, particle._properties.randomNoiseCoordinates1.y, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);
|
|
101
|
+
const fetchedColorG = system._fetchR(particle._properties.randomNoiseCoordinates1.z, particle._properties.randomNoiseCoordinates2.x, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);
|
|
102
|
+
const fetchedColorB = system._fetchR(particle._properties.randomNoiseCoordinates2.y, particle._properties.randomNoiseCoordinates2.z, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);
|
|
103
103
|
const force = TmpVectors.Vector3[0];
|
|
104
104
|
const scaledForce = TmpVectors.Vector3[1];
|
|
105
105
|
force.copyFromFloats((2 * fetchedColorR - 1) * strength.x, (2 * fetchedColorG - 1) * strength.y, (2 * fetchedColorB - 1) * strength.z);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateNoiseBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateNoiseBlock.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAC7D,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EA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,CAAC;QAEF,MAAM,eAAe,GAAG;YACpB,OAAO,EAAE,YAAY;YACrB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,eAAe,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ISize } from \"core/Maths/math.size\";\r\nimport type { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { ParticleTextureSourceBlock } from \"core/Particles/Node/Blocks/particleSourceTextureBlock\";\r\n\r\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update particle position based on a noise texture\r\n */\r\nexport class UpdateNoiseBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateNoiseBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"noiseTexture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"strength\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(100, 100, 100));\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the noiseTexture input component\r\n */\r\n public get noiseTexture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the strength input component\r\n */\r\n public get strength(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateNoiseBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const strength = this.strength.getConnectedValue(state) as Vector3;\r\n if (!strength) {\r\n return;\r\n }\r\n\r\n const noiseTextureBlock = this.noiseTexture.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n if (!noiseTextureBlock) {\r\n return;\r\n }\r\n\r\n // These will be updated each frame for procedural textures\r\n let noiseTextureData: Nullable<Uint8Array | Uint8ClampedArray> = null;\r\n let noiseTextureSize: Nullable<ISize> = null;\r\n let lastFrameId = -1;\r\n\r\n const processNoise = (particle: Particle) => {\r\n // Get the texture directly from the block's stored value to support procedural textures\r\n // (as the block caches the texture data)\r\n const texture = noiseTextureBlock.texture._storedValue as ProceduralTexture;\r\n if (!texture || !texture.isReady()) {\r\n return;\r\n }\r\n\r\n // Fetch fresh texture data once per frame (like in thinParticleSystem)\r\n const currentFrameId = texture.getScene()?.getFrameId() ?? -1;\r\n if (currentFrameId !== lastFrameId) {\r\n lastFrameId = currentFrameId;\r\n\r\n // Texture size only needs to be fetched once\r\n if (!noiseTextureSize) {\r\n noiseTextureSize = texture.getSize();\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n texture.getContent()?.then((data) => {\r\n noiseTextureData = data as Uint8Array;\r\n });\r\n }\r\n\r\n // Skip if we don't have texture data yet\r\n if (!noiseTextureData || !noiseTextureSize) {\r\n return;\r\n }\r\n\r\n if (!particle._randomNoiseCoordinates1) {\r\n particle._randomNoiseCoordinates1 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n if (!particle._randomNoiseCoordinates2) {\r\n particle._randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n const fetchedColorR = system._fetchR(\r\n particle._randomNoiseCoordinates1.x,\r\n particle._randomNoiseCoordinates1.y,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n const fetchedColorG = system._fetchR(\r\n particle._randomNoiseCoordinates1.z,\r\n particle._randomNoiseCoordinates2.x,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n const fetchedColorB = system._fetchR(\r\n particle._randomNoiseCoordinates2.y,\r\n particle._randomNoiseCoordinates2.z,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n\r\n const force = TmpVectors.Vector3[0];\r\n const scaledForce = TmpVectors.Vector3[1];\r\n\r\n force.copyFromFloats((2 * fetchedColorR - 1) * strength.x, (2 * fetchedColorG - 1) * strength.y, (2 * fetchedColorB - 1) * strength.z);\r\n\r\n force.scaleToRef(system._tempScaledUpdateSpeed, scaledForce);\r\n particle.direction.addInPlace(scaledForce);\r\n };\r\n\r\n const noiseProcessing = {\r\n process: processNoise,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(noiseProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = noiseProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateNoiseBlock\", UpdateNoiseBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"updateNoiseBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateNoiseBlock.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAC7D,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAChH,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,OAAO,CAA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;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ISize } from \"core/Maths/math.size\";\r\nimport type { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { ParticleTextureSourceBlock } from \"core/Particles/Node/Blocks/particleSourceTextureBlock\";\r\n\r\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update particle position based on a noise texture\r\n */\r\nexport class UpdateNoiseBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateNoiseBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"noiseTexture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"strength\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(100, 100, 100));\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the noiseTexture input component\r\n */\r\n public get noiseTexture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the strength input component\r\n */\r\n public get strength(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateNoiseBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const strength = this.strength.getConnectedValue(state) as Vector3;\r\n if (!strength) {\r\n return;\r\n }\r\n\r\n const noiseTextureBlock = this.noiseTexture.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n if (!noiseTextureBlock) {\r\n return;\r\n }\r\n\r\n // These will be updated each frame for procedural textures\r\n let noiseTextureData: Nullable<Uint8Array | Uint8ClampedArray> = null;\r\n let noiseTextureSize: Nullable<ISize> = null;\r\n let lastFrameId = -1;\r\n\r\n const processNoise = (particle: Particle) => {\r\n // Get the texture directly from the block's stored value to support procedural textures\r\n // (as the block caches the texture data)\r\n const texture = noiseTextureBlock.texture._storedValue as ProceduralTexture;\r\n if (!texture || !texture.isReady()) {\r\n return;\r\n }\r\n\r\n // Fetch fresh texture data once per frame (like in thinParticleSystem)\r\n const currentFrameId = texture.getScene()?.getFrameId() ?? -1;\r\n if (currentFrameId !== lastFrameId) {\r\n lastFrameId = currentFrameId;\r\n\r\n // Texture size only needs to be fetched once\r\n if (!noiseTextureSize) {\r\n noiseTextureSize = texture.getSize();\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n texture.getContent()?.then((data) => {\r\n noiseTextureData = data as Uint8Array;\r\n });\r\n }\r\n\r\n // Skip if we don't have texture data yet\r\n if (!noiseTextureData || !noiseTextureSize) {\r\n return;\r\n }\r\n\r\n if (!particle._properties.randomNoiseCoordinates1) {\r\n particle._properties.randomNoiseCoordinates1 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n if (!particle._properties.randomNoiseCoordinates2) {\r\n particle._properties.randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());\r\n }\r\n\r\n const fetchedColorR = system._fetchR(\r\n particle._properties.randomNoiseCoordinates1.x,\r\n particle._properties.randomNoiseCoordinates1.y,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n const fetchedColorG = system._fetchR(\r\n particle._properties.randomNoiseCoordinates1.z,\r\n particle._properties.randomNoiseCoordinates2.x,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n const fetchedColorB = system._fetchR(\r\n particle._properties.randomNoiseCoordinates2.y,\r\n particle._properties.randomNoiseCoordinates2.z,\r\n noiseTextureSize.width,\r\n noiseTextureSize.height,\r\n noiseTextureData\r\n );\r\n\r\n const force = TmpVectors.Vector3[0];\r\n const scaledForce = TmpVectors.Vector3[1];\r\n\r\n force.copyFromFloats((2 * fetchedColorR - 1) * strength.x, (2 * fetchedColorG - 1) * strength.y, (2 * fetchedColorB - 1) * strength.z);\r\n\r\n force.scaleToRef(system._tempScaledUpdateSpeed, scaledForce);\r\n particle.direction.addInPlace(scaledForce);\r\n };\r\n\r\n const noiseProcessing = {\r\n process: processNoise,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(noiseProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = noiseProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateNoiseBlock\", UpdateNoiseBlock);\r\n"]}
|
|
@@ -74,9 +74,9 @@ export class ParticleLocalVariableBlock extends NodeParticleBlock {
|
|
|
74
74
|
}
|
|
75
75
|
this._storage.set(id, value);
|
|
76
76
|
if (this.scope === ParticleLocalVariableBlockScope.Particle) {
|
|
77
|
-
state.particleContext.onReset = () => {
|
|
77
|
+
state.particleContext._properties.onReset = () => {
|
|
78
78
|
this._storage.delete(id);
|
|
79
|
-
state.particleContext.onReset = null;
|
|
79
|
+
state.particleContext._properties.onReset = null;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
state.systemContext.onDisposeObservable.addOnce(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particleLocalVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleLocalVariableBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACvC,6FAAY,CAAA;IACZ,qFAAQ,CAAA;AACZ,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAnBhB;;WAEG;QASI,UAAK,GAAG,+BAA+B,CAAC,QAAQ,CAAC;QAChD,aAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;QAStC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,C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AG,IAAI,CAAC;YAChC,OAAO;QACX,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,KAA6B,EAAE,EAAE;YAC3C,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBACjD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,+BAA+B,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAEvJ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACzB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAEhD,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBACd,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,gDAAgD;gBAC3E,CAAC;gBACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;gBAE7B,IAAI,IAAI,CAAC,KAAK,KAAK,+BAA+B,CAAC,QAAQ,EAAE,CAAC;oBAC1D,KAAK,CAAC,eAAgB,CAAC,OAAO,GAAG,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"particleLocalVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleLocalVariableBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CA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C/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC;IAC3C,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AA7GU;IARN,sBAAsB,CAAC,OAAO,uCAA+B,UAAU,EAAE;QACtE,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,+BAA+B,CAAC,IAAI,EAAE;SACjE;KACJ,CAAC;yDACsD;AA+G5D,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nexport enum ParticleLocalVariableBlockScope {\r\n Particle = 0,\r\n Loop = 1,\r\n}\r\n\r\n/**\r\n * Defines a block used to store local values\r\n * #A1OS53#5\r\n */\r\nexport class ParticleLocalVariableBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the scope used by the block\r\n */\r\n @editableInPropertyPage(\"Scope\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n embedded: true,\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Particle\", value: ParticleLocalVariableBlockScope.Particle },\r\n { label: \"Loop\", value: ParticleLocalVariableBlockScope.Loop },\r\n ],\r\n })\r\n public scope = ParticleLocalVariableBlockScope.Particle;\r\n private _storage = new Map<number, any>();\r\n\r\n /**\r\n * Create a new ParticleLocalVariableBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleLocalVariableBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeParticleBuildState) => {\r\n if (!state.particleContext && !state.systemContext) {\r\n this._storage.clear();\r\n return null;\r\n }\r\n\r\n const id = (this.scope === ParticleLocalVariableBlockScope.Particle ? state.particleContext?.id : state.systemContext?.getScene()!.getFrameId()) || -1;\r\n\r\n if (!this._storage.has(id)) {\r\n let value = this.input.getConnectedValue(state);\r\n\r\n if (value.clone) {\r\n value = value.clone(); // We clone to snapshot the value at this moment\r\n }\r\n this._storage.set(id, value);\r\n\r\n if (this.scope === ParticleLocalVariableBlockScope.Particle) {\r\n state.particleContext!._properties.onReset = () => {\r\n this._storage.delete(id);\r\n state.particleContext!._properties.onReset = null;\r\n };\r\n }\r\n state.systemContext!.onDisposeObservable.addOnce(() => {\r\n this._storage.clear();\r\n });\r\n }\r\n\r\n return this._storage.get(id);\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.scope = this.scope;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.scope = serializationObject.scope;\r\n }\r\n\r\n public override dispose() {\r\n this._storage.clear();\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleLocalVariableBlock\", ParticleLocalVariableBlock);\r\n"]}
|
|
@@ -76,10 +76,10 @@ export class NodeParticleBuildState {
|
|
|
76
76
|
case NodeParticleContextualSources.Direction:
|
|
77
77
|
return this.particleContext.direction;
|
|
78
78
|
case NodeParticleContextualSources.DirectionScale:
|
|
79
|
-
return this.particleContext.
|
|
79
|
+
return this.particleContext._properties.directionScale;
|
|
80
80
|
case NodeParticleContextualSources.ScaledDirection:
|
|
81
|
-
this.particleContext.direction.scaleToRef(this.particleContext.
|
|
82
|
-
return this.particleContext.
|
|
81
|
+
this.particleContext.direction.scaleToRef(this.particleContext._properties.directionScale, this.particleContext._properties.scaledDirection);
|
|
82
|
+
return this.particleContext._properties.scaledDirection;
|
|
83
83
|
case NodeParticleContextualSources.Color:
|
|
84
84
|
return this.particleContext.color;
|
|
85
85
|
case NodeParticleContextualSources.InitialColor:
|
|
@@ -105,16 +105,16 @@ export class NodeParticleBuildState {
|
|
|
105
105
|
case NodeParticleContextualSources.SpriteCellStart:
|
|
106
106
|
return this.systemContext.startSpriteCellID;
|
|
107
107
|
case NodeParticleContextualSources.InitialDirection:
|
|
108
|
-
return this.particleContext.
|
|
108
|
+
return this.particleContext._properties.initialDirection;
|
|
109
109
|
case NodeParticleContextualSources.ColorStep:
|
|
110
110
|
return this.particleContext.colorStep;
|
|
111
111
|
case NodeParticleContextualSources.ScaledColorStep:
|
|
112
112
|
this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);
|
|
113
113
|
return this.systemContext._scaledColorStep;
|
|
114
114
|
case NodeParticleContextualSources.LocalPositionUpdated:
|
|
115
|
-
this.particleContext.direction.scaleToRef(this.particleContext.
|
|
116
|
-
this.particleContext.
|
|
117
|
-
Vector3.TransformCoordinatesToRef(this.particleContext.
|
|
115
|
+
this.particleContext.direction.scaleToRef(this.particleContext._properties.directionScale, this.particleContext._properties.scaledDirection);
|
|
116
|
+
this.particleContext._properties.localPosition.addInPlace(this.particleContext._properties.scaledDirection);
|
|
117
|
+
Vector3.TransformCoordinatesToRef(this.particleContext._properties.localPosition, this.systemContext._emitterWorldMatrix, this.particleContext.position);
|
|
118
118
|
return this.particleContext.position;
|
|
119
119
|
}
|
|
120
120
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAC1D,O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AM,EAAE,CAAC;YACb,KAAK,yBAAyB,CAAC,IAAI;gBAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;YAC3C,KAAK,yBAAyB,CAAC,KAAK;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC;YACjD,KAAK,yBAAyB,CAAC,OAAO;gBAClC,OAAO,IAAI,CAAC,eAAe,CAAC;YAChC,KAAK,yBAAyB,CAAC,cAAc;gBACzC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleContextualSources } from \"core/Particles/Node/Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"core/Particles/Node/Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.DirectionScale:\r\n return this.particleContext._directionScale;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n return this.particleContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.Size:\r\n return this.particleContext.size;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n this.particleContext._localPosition!.addInPlace(this.particleContext._scaledDirection);\r\n Vector3.TransformCoordinatesToRef(this.particleContext._localPosition!, this.systemContext._emitterWorldMatrix, this.particleContext.position);\r\n return this.particleContext.position;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition(): Nullable<Vector3> {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (!this.systemContext.emitter) {\r\n return null;\r\n }\r\n\r\n if (this.systemContext.emitter instanceof Vector3) {\r\n return this.systemContext.emitter;\r\n }\r\n\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n return this.emitterPosition;\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAC1D,OAAO,E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CAAC,MAAiC;QACnD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,yBAAyB,CAAC,IAAI;gBAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;YAC3C,KAAK,yBAAyB,CAAC,KAAK;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC;YACjD,KAAK,yBAAyB,CAAC,OAAO;gBAClC,OAAO,IAAI,CAAC,eAAe,CAAC;YAChC,KAAK,yBAAyB,CAAC,cAAc;gBACzC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleContextualSources } from \"core/Particles/Node/Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"core/Particles/Node/Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.DirectionScale:\r\n return this.particleContext._properties.directionScale;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.particleContext._properties.directionScale, this.particleContext._properties.scaledDirection);\r\n return this.particleContext._properties.scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.Size:\r\n return this.particleContext.size;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._properties.initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this.particleContext.direction.scaleToRef(this.particleContext._properties.directionScale, this.particleContext._properties.scaledDirection);\r\n this.particleContext._properties.localPosition!.addInPlace(this.particleContext._properties.scaledDirection);\r\n Vector3.TransformCoordinatesToRef(this.particleContext._properties.localPosition!, this.systemContext._emitterWorldMatrix, this.particleContext.position);\r\n return this.particleContext.position;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition(): Nullable<Vector3> {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (!this.systemContext.emitter) {\r\n return null;\r\n }\r\n\r\n if (this.systemContext.emitter instanceof Vector3) {\r\n return this.systemContext.emitter;\r\n }\r\n\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n return this.emitterPosition;\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
@@ -12,6 +12,7 @@ import { ParticleGradientValueBlock } from "./Blocks/particleGradientValueBlock.
|
|
|
12
12
|
import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
|
|
13
13
|
import { ParticleMathBlock, ParticleMathBlockOperations } from "./Blocks/particleMathBlock.js";
|
|
14
14
|
import { ParticleRandomBlock, ParticleRandomBlockLocks } from "./Blocks/particleRandomBlock.js";
|
|
15
|
+
import { ParticleLerpBlock } from "./Blocks/particleLerpBlock.js";
|
|
15
16
|
import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
|
|
16
17
|
import { ParticleVectorLengthBlock } from "./Blocks/particleVectorLengthBlock.js";
|
|
17
18
|
import { SystemBlock } from "./Blocks/systemBlock.js";
|
|
@@ -184,10 +185,14 @@ function _CreateParticleColorBlockGroup(oldSystem, context) {
|
|
|
184
185
|
return context.colorGradientValue0Output;
|
|
185
186
|
}
|
|
186
187
|
else {
|
|
187
|
-
const
|
|
188
|
-
_CreateAndConnectInput("
|
|
189
|
-
_CreateAndConnectInput("
|
|
190
|
-
|
|
188
|
+
const randomStepBlock = new ParticleRandomBlock("Random color step");
|
|
189
|
+
_CreateAndConnectInput("Min", 0, randomStepBlock.min);
|
|
190
|
+
_CreateAndConnectInput("Max", 1, randomStepBlock.max);
|
|
191
|
+
const lerpColorBlock = new ParticleLerpBlock("Lerp color");
|
|
192
|
+
_CreateAndConnectInput("Color 1", oldSystem.color1.clone(), lerpColorBlock.left);
|
|
193
|
+
_CreateAndConnectInput("Color 2", oldSystem.color2.clone(), lerpColorBlock.right);
|
|
194
|
+
randomStepBlock.output.connectTo(lerpColorBlock.gradient);
|
|
195
|
+
return lerpColorBlock.output;
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
function _CreateParticleInitialValueFromGradient(gradients) {
|