@babylonjs/core 8.36.1 → 8.37.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/Animations/animationGroup.js +1 -4
- package/Animations/animationGroup.js.map +1 -1
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +0 -4
- package/AudioV2/abstractAudio/audioEngineV2.js +0 -4
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js +1 -1
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -1
- package/AudioV2/audioParameter.d.ts +5 -1
- package/AudioV2/audioParameter.js +4 -0
- package/AudioV2/audioParameter.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +0 -18
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +7 -67
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +58 -0
- package/Behaviors/Cameras/interpolatingBehavior.js +157 -0
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +17 -21
- package/Cameras/Inputs/geospatialCameraPointersInput.js +49 -71
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
- package/Cameras/Limits/geospatialLimits.d.ts +60 -0
- package/Cameras/Limits/geospatialLimits.js +89 -0
- package/Cameras/Limits/geospatialLimits.js.map +1 -0
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraMovement.d.ts +150 -0
- package/Cameras/cameraMovement.js +190 -0
- package/Cameras/cameraMovement.js.map +1 -0
- package/Cameras/geospatialCamera.d.ts +78 -49
- package/Cameras/geospatialCamera.js +210 -191
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
- package/Cameras/geospatialCameraInputsManager.js +9 -0
- package/Cameras/geospatialCameraInputsManager.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +66 -0
- package/Cameras/geospatialCameraMovement.js +199 -0
- package/Cameras/geospatialCameraMovement.js.map +1 -0
- package/Cameras/targetCamera.js +0 -4
- package/Cameras/targetCamera.js.map +1 -1
- package/Culling/ray.core.js +1 -1
- package/Culling/ray.core.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +9 -7
- package/Decorators/nodeDecorator.js +9 -7
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +14 -6
- package/Engines/Native/nativeInterfaces.js +6 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +4 -0
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
- package/FlowGraph/flowGraphMath.d.ts +25 -0
- package/FlowGraph/flowGraphMath.js +40 -0
- package/FlowGraph/flowGraphMath.js.map +1 -0
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +26 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +1 -1
- 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 +48 -22
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +14 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +2 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Passes/{cullPass.d.ts → objectListPass.d.ts} +8 -8
- package/FrameGraph/Passes/{cullPass.js → objectListPass.js} +9 -9
- package/FrameGraph/Passes/objectListPass.js.map +1 -0
- package/FrameGraph/Passes/renderPass.d.ts +6 -2
- package/FrameGraph/Passes/renderPass.js +14 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +2 -2
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +4 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +10 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +13 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -3
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +1 -2
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +11 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +4 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +7 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +10 -4
- package/FrameGraph/frameGraph.js +22 -9
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +2 -1
- package/FrameGraph/frameGraphRenderContext.js +22 -3
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.js +3 -3
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -1
- package/FrameGraph/index.js +1 -1
- package/FrameGraph/index.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.js +2 -1
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/floatingOriginMatrixOverrides.js +19 -0
- package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +9 -0
- package/Materials/shaderMaterial.js +39 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +5 -24
- package/Maths/math.vector.functions.js +32 -35
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +11 -11
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +15 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +8 -1
- package/Misc/copyTextureToTexture.js +16 -2
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/tools.d.ts +3 -0
- package/Misc/tools.js +43 -4
- package/Misc/tools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.d.ts +6 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js +18 -12
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -3
- package/Particles/EmitterTypes/customParticleEmitter.js +8 -6
- package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +3 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.js +7 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +2 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +15 -4
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +66 -36
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +0 -4
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +1 -8
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +13 -9
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +36 -23
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +10 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +50 -17
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/emitters.functions.d.ts +6 -0
- package/Particles/Node/Blocks/Emitters/emitters.functions.js +13 -0
- package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.d.ts +2 -2
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +5 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +3 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +16 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +67 -14
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +3 -3
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +3 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
- package/Particles/Node/Blocks/particleRandomBlock.js +40 -22
- package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +21 -9
- package/Particles/Node/Blocks/systemBlock.js +37 -22
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +7 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +6 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.d.ts +5 -5
- package/Particles/Node/nodeParticleBuildState.js +14 -5
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
- package/Particles/Node/nodeParticleSystemSet.helper.js +586 -148
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/particle.d.ts +4 -0
- package/Particles/particle.js +2 -0
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +3 -7
- package/Particles/thinParticleSystem.function.d.ts +3 -3
- package/Particles/thinParticleSystem.function.js +11 -8
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +5 -7
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/prePassRenderer.js +4 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/copyTextureToTexture.fragment.js +2 -2
- package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/copyTextureToTexture.fragment.js +3 -3
- package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/XR/webXRSessionManager.js +4 -0
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -3
- package/scene.js +8 -7
- package/scene.js.map +1 -1
- package/FrameGraph/Passes/cullPass.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Vector2 } from "../../Maths/math.vector.js";
|
|
2
|
-
import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
1
|
+
import { Vector2, Vector3 } from "../../Maths/math.vector.js";
|
|
3
2
|
import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
4
3
|
import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
|
|
5
4
|
import { NodeParticleSystemSources } from "./Enums/nodeParticleSystemSources.js";
|
|
@@ -11,23 +10,26 @@ import { ParticleMathBlock, ParticleMathBlockOperations } from "./Blocks/particl
|
|
|
11
10
|
import { ParticleRandomBlock, ParticleRandomBlockLocks } from "./Blocks/particleRandomBlock.js";
|
|
12
11
|
import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
|
|
13
12
|
import { SystemBlock } from "./Blocks/systemBlock.js";
|
|
13
|
+
import { ParticleVectorLengthBlock } from "./Blocks/particleVectorLengthBlock.js";
|
|
14
|
+
import { ParticleConditionBlock, ParticleConditionBlockTests } from "./Blocks/Conditions/particleConditionBlock.js";
|
|
14
15
|
import { CreateParticleBlock } from "./Blocks/Emitters/createParticleBlock.js";
|
|
15
16
|
import { BoxShapeBlock } from "./Blocks/Emitters/boxShapeBlock.js";
|
|
16
17
|
import { ConeShapeBlock } from "./Blocks/Emitters/coneShapeBlock.js";
|
|
17
18
|
import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
|
|
19
|
+
import { CustomShapeBlock } from "./Blocks/Emitters/customShapeBlock.js";
|
|
18
20
|
import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
|
|
19
21
|
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
20
22
|
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
23
|
+
import { UpdateAngleBlock } from "./Blocks/Update/updateAngleBlock.js";
|
|
21
24
|
import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
|
|
22
25
|
import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
|
|
23
26
|
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
27
|
+
import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
|
|
24
28
|
/**
|
|
25
29
|
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
26
30
|
* @param name The name of the node particle system set.
|
|
27
31
|
* @param particleSystemsList The particle systems to convert.
|
|
28
32
|
* @returns The converted node particle system set or null if conversion failed.
|
|
29
|
-
* #0K3AQ2#3672
|
|
30
|
-
* #7J0NXA#4
|
|
31
33
|
*/
|
|
32
34
|
export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsList) {
|
|
33
35
|
if (!particleSystemsList || !particleSystemsList.length) {
|
|
@@ -36,39 +38,36 @@ export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsL
|
|
|
36
38
|
const nodeParticleSystemSet = new NodeParticleSystemSet(name);
|
|
37
39
|
const promises = [];
|
|
38
40
|
for (const particleSystem of particleSystemsList) {
|
|
39
|
-
promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));
|
|
41
|
+
promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem, {}));
|
|
40
42
|
}
|
|
41
43
|
await Promise.all(promises);
|
|
42
44
|
return nodeParticleSystemSet;
|
|
43
45
|
}
|
|
44
|
-
async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem) {
|
|
45
|
-
// CreateParticle block
|
|
46
|
-
const
|
|
46
|
+
async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem, context) {
|
|
47
|
+
// CreateParticle block group
|
|
48
|
+
const createParticleOutput = _CreateParticleBlockGroup(oldSystem, context);
|
|
47
49
|
// Emitter Shape block
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
const
|
|
52
|
-
// Color update
|
|
53
|
-
const colorUpdateBlock = _CreateColorUpdateBlock(oldSystem, createParticleBlock);
|
|
54
|
-
positionUpdatedParticle.connectTo(colorUpdateBlock.particle);
|
|
50
|
+
const shapeOutput = _EmitterShapeBlock(oldSystem);
|
|
51
|
+
createParticleOutput.particle.connectTo(shapeOutput.particle);
|
|
52
|
+
// UpdateParticle block group
|
|
53
|
+
const updateParticleOutput = _UpdateParticleBlockGroup(shapeOutput.output, oldSystem, context);
|
|
55
54
|
// System block
|
|
56
|
-
const newSystem =
|
|
57
|
-
|
|
55
|
+
const newSystem = _SystemBlockGroup(oldSystem, context);
|
|
56
|
+
updateParticleOutput.connectTo(newSystem.particle);
|
|
58
57
|
// Register
|
|
59
58
|
newSet.systemBlocks.push(newSystem);
|
|
60
59
|
}
|
|
61
|
-
|
|
60
|
+
// ------------- SYSTEM FUNCTIONS -------------
|
|
61
|
+
function _SystemBlockGroup(oldSystem, context) {
|
|
62
62
|
const newSystem = new SystemBlock(oldSystem.name);
|
|
63
|
-
// Translation pivot
|
|
64
63
|
_CreateAndConnectInput("Translation pivot", oldSystem.translationPivot, newSystem.translationPivot);
|
|
64
|
+
_CreateAndConnectInput("Texture mask", oldSystem.textureMask, newSystem.textureMask);
|
|
65
|
+
_CreateTargetStopDurationInputBlock(oldSystem, context).connectTo(newSystem.targetStopDuration);
|
|
65
66
|
newSystem.emitRate = oldSystem.emitRate;
|
|
66
67
|
newSystem.manualEmitCount = oldSystem.manualEmitCount;
|
|
67
68
|
newSystem.blendMode = oldSystem.blendMode;
|
|
68
69
|
newSystem.capacity = oldSystem.getCapacity();
|
|
69
|
-
newSystem.targetStopDuration = oldSystem.targetStopDuration;
|
|
70
70
|
newSystem.startDelay = oldSystem.startDelay;
|
|
71
|
-
newSystem.targetStopDuration = oldSystem.targetStopDuration;
|
|
72
71
|
newSystem.updateSpeed = oldSystem.updateSpeed;
|
|
73
72
|
newSystem.preWarmCycles = oldSystem.preWarmCycles;
|
|
74
73
|
newSystem.preWarmStepOffset = oldSystem.preWarmStepOffset;
|
|
@@ -87,45 +86,149 @@ function _CreateSystemBlock(oldSystem) {
|
|
|
87
86
|
textureBlock.texture.connectTo(newSystem.texture);
|
|
88
87
|
return newSystem;
|
|
89
88
|
}
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
// ------------- CREATE PARTICLE FUNCTIONS -------------
|
|
90
|
+
// The creation of the different properties follows the order they are added to the CreationQueue in ThinParticleSystem:
|
|
91
|
+
// Lifetime, Emit Power, Size, Scale/StartSize, Angle, Color, Noise, ColorDead, Ramp, Sheet
|
|
92
|
+
function _CreateParticleBlockGroup(oldSystem, context) {
|
|
93
|
+
// Create particle block
|
|
92
94
|
const createParticleBlock = new CreateParticleBlock("Create Particle");
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const randomScaleBlock = new ParticleRandomBlock("Random Scale");
|
|
100
|
-
_CreateAndConnectInput("Min Scale", new Vector2(oldSystem.minScaleX, oldSystem.minScaleY), randomScaleBlock.min);
|
|
101
|
-
_CreateAndConnectInput("Max Scale", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);
|
|
102
|
-
randomScaleBlock.output.connectTo(createParticleBlock.scale);
|
|
103
|
-
// Color is handled when we do the color update block to manage gradients
|
|
95
|
+
_CreateParticleLifetimeBlockGroup(oldSystem, context).connectTo(createParticleBlock.lifeTime);
|
|
96
|
+
_CreateParticleEmitPowerBlockGroup(oldSystem).connectTo(createParticleBlock.emitPower);
|
|
97
|
+
_CreateParticleSizeBlockGroup(oldSystem, context).connectTo(createParticleBlock.size);
|
|
98
|
+
_CreateParticleScaleBlockGroup(oldSystem, context).connectTo(createParticleBlock.scale);
|
|
99
|
+
_CreateParticleAngleBlockGroup(oldSystem).connectTo(createParticleBlock.angle);
|
|
100
|
+
_CreateParticleColorBlockGroup(oldSystem, context).connectTo(createParticleBlock.color);
|
|
104
101
|
// Dead color
|
|
105
102
|
_CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
|
|
106
|
-
|
|
103
|
+
return createParticleBlock;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates the group of blocks that represent the particle lifetime
|
|
107
|
+
* @param oldSystem The old particle system to convert
|
|
108
|
+
* @param context The context of the current conversion
|
|
109
|
+
* @returns The output of the group of blocks that represent the particle lifetime
|
|
110
|
+
*/
|
|
111
|
+
function _CreateParticleLifetimeBlockGroup(oldSystem, context) {
|
|
112
|
+
if (oldSystem.targetStopDuration && oldSystem._lifeTimeGradients && oldSystem._lifeTimeGradients.length > 0) {
|
|
113
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
114
|
+
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._lifeTimeGradients, ParticleRandomBlockLocks.PerParticle, "Lifetime");
|
|
115
|
+
return gradientBlockGroupOutput;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
|
|
119
|
+
_CreateAndConnectInput("Min Lifetime", oldSystem.minLifeTime, randomLifetimeBlock.min);
|
|
120
|
+
_CreateAndConnectInput("Max Lifetime", oldSystem.maxLifeTime, randomLifetimeBlock.max);
|
|
121
|
+
return randomLifetimeBlock.output;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates the group of blocks that represent the particle emit power
|
|
126
|
+
* @param oldSystem The old particle system to convert
|
|
127
|
+
* @returns The output of the group of blocks that represent the particle emit power
|
|
128
|
+
*/
|
|
129
|
+
function _CreateParticleEmitPowerBlockGroup(oldSystem) {
|
|
107
130
|
const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
|
|
108
131
|
_CreateAndConnectInput("Min Emit Power", oldSystem.minEmitPower, randomEmitPowerBlock.min);
|
|
109
132
|
_CreateAndConnectInput("Max Emit Power", oldSystem.maxEmitPower, randomEmitPowerBlock.max);
|
|
110
|
-
randomEmitPowerBlock.output
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
return randomEmitPowerBlock.output;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Creates the group of blocks that represent the particle size
|
|
137
|
+
* @param oldSystem The old particle system to convert
|
|
138
|
+
* @param context The context of the current conversion
|
|
139
|
+
* @returns The output of the group of blocks that represent the particle size
|
|
140
|
+
*/
|
|
141
|
+
function _CreateParticleSizeBlockGroup(oldSystem, context) {
|
|
142
|
+
if (oldSystem._sizeGradients && oldSystem._sizeGradients.length > 0) {
|
|
143
|
+
context.sizeGradientValue0Output = _CreateParticleInitialValueFromGradient(oldSystem._sizeGradients);
|
|
144
|
+
return context.sizeGradientValue0Output;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const randomSizeBlock = new ParticleRandomBlock("Random size");
|
|
148
|
+
_CreateAndConnectInput("Min size", oldSystem.minSize, randomSizeBlock.min);
|
|
149
|
+
_CreateAndConnectInput("Max size", oldSystem.maxSize, randomSizeBlock.max);
|
|
150
|
+
return randomSizeBlock.output;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Creates the group of blocks that represent the particle scale
|
|
155
|
+
* @param oldSystem The old particle system to convert
|
|
156
|
+
* @param context The context of the current conversion
|
|
157
|
+
* @returns The output of the group of blocks that represent the particle scale
|
|
158
|
+
*/
|
|
159
|
+
function _CreateParticleScaleBlockGroup(oldSystem, context) {
|
|
160
|
+
// Create the random scale
|
|
161
|
+
const randomScaleBlock = new ParticleRandomBlock("Random Scale");
|
|
162
|
+
_CreateAndConnectInput("Min Scale", new Vector2(oldSystem.minScaleX, oldSystem.minScaleY), randomScaleBlock.min);
|
|
163
|
+
_CreateAndConnectInput("Max Scale", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);
|
|
164
|
+
if (oldSystem.targetStopDuration && oldSystem._startSizeGradients && oldSystem._startSizeGradients.length > 0) {
|
|
165
|
+
// Create the start size gradient
|
|
166
|
+
context.timeToStopTimeRatioBlockGroupOutput = _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context);
|
|
167
|
+
const gradientBlockGroupOutput = _CreateGradientBlockGroup(context.timeToStopTimeRatioBlockGroupOutput, oldSystem._startSizeGradients, ParticleRandomBlockLocks.PerParticle, "Start Size");
|
|
168
|
+
// Multiply the initial random scale by the start size gradient
|
|
169
|
+
const multiplyScaleBlock = new ParticleMathBlock("Multiply Scale by Start Size Gradient");
|
|
170
|
+
multiplyScaleBlock.operation = ParticleMathBlockOperations.Multiply;
|
|
171
|
+
randomScaleBlock.output.connectTo(multiplyScaleBlock.left);
|
|
172
|
+
gradientBlockGroupOutput.connectTo(multiplyScaleBlock.right);
|
|
173
|
+
return multiplyScaleBlock.output;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return randomScaleBlock.output;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Creates the group of blocks that represent the particle angle (rotation)
|
|
181
|
+
* @param oldSystem The old particle system to convert
|
|
182
|
+
* @returns The output of the group of blocks that represent the particle angle (rotation)
|
|
183
|
+
*/
|
|
184
|
+
function _CreateParticleAngleBlockGroup(oldSystem) {
|
|
117
185
|
const randomRotationBlock = new ParticleRandomBlock("Random Rotation");
|
|
118
186
|
_CreateAndConnectInput("Min Rotation", oldSystem.minInitialRotation, randomRotationBlock.min);
|
|
119
187
|
_CreateAndConnectInput("Max Rotation", oldSystem.maxInitialRotation, randomRotationBlock.max);
|
|
120
|
-
randomRotationBlock.output
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
188
|
+
return randomRotationBlock.output;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Creates the group of blocks that represent the particle color
|
|
192
|
+
* @param oldSystem The old particle system to convert
|
|
193
|
+
* @param context The context of the current conversion
|
|
194
|
+
* @returns The output of the group of blocks that represent the particle color
|
|
195
|
+
*/
|
|
196
|
+
function _CreateParticleColorBlockGroup(oldSystem, context) {
|
|
197
|
+
if (oldSystem._colorGradients && oldSystem._colorGradients.length > 0) {
|
|
198
|
+
context.colorGradientValue0Output = _CreateParticleInitialValueFromGradient(oldSystem._colorGradients);
|
|
199
|
+
return context.colorGradientValue0Output;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const randomColorBlock = new ParticleRandomBlock("Random color");
|
|
203
|
+
_CreateAndConnectInput("Color 1", oldSystem.color1, randomColorBlock.min);
|
|
204
|
+
_CreateAndConnectInput("Color 2", oldSystem.color2, randomColorBlock.max);
|
|
205
|
+
return randomColorBlock.output;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function _CreateParticleInitialValueFromGradient(gradients) {
|
|
209
|
+
if (gradients.length === 0) {
|
|
210
|
+
throw new Error("No gradients provided.");
|
|
211
|
+
}
|
|
212
|
+
const gradientStep = gradients[0];
|
|
213
|
+
const value1 = gradientStep.factor1 ?? gradientStep.color1;
|
|
214
|
+
const value2 = gradientStep.factor2 ?? gradientStep.color2;
|
|
215
|
+
if (value2 !== undefined) {
|
|
216
|
+
// Create a random between value1 and value2
|
|
217
|
+
const randomBlock = new ParticleRandomBlock("Random Value 0");
|
|
218
|
+
randomBlock.lockMode = ParticleRandomBlockLocks.OncePerParticle;
|
|
219
|
+
_CreateAndConnectInput("Value 1", value1, randomBlock.min);
|
|
220
|
+
_CreateAndConnectInput("Value 2", value2, randomBlock.max);
|
|
221
|
+
return randomBlock.output;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
// Single value
|
|
225
|
+
const sizeBlock = new ParticleInputBlock("Value");
|
|
226
|
+
sizeBlock.value = value1;
|
|
227
|
+
return sizeBlock.output;
|
|
228
|
+
}
|
|
127
229
|
}
|
|
128
|
-
|
|
230
|
+
// ------------- EMITTER SHAPE FUNCTIONS -------------
|
|
231
|
+
function _EmitterShapeBlock(oldSystem) {
|
|
129
232
|
const emitter = oldSystem.particleEmitterType;
|
|
130
233
|
if (!emitter) {
|
|
131
234
|
throw new Error("Particle system has no emitter type.");
|
|
@@ -146,17 +249,35 @@ function _CreateEmitterShapeBlock(oldSystem) {
|
|
|
146
249
|
const source = emitter;
|
|
147
250
|
shapeBlock = new ConeShapeBlock("Cone Shape");
|
|
148
251
|
const target = shapeBlock;
|
|
252
|
+
target.emitFromSpawnPointOnly = source.emitFromSpawnPointOnly;
|
|
149
253
|
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
150
254
|
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
151
255
|
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
152
256
|
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
153
|
-
_CreateAndConnectInput("Emit From Spawn Point Only", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);
|
|
154
257
|
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
155
258
|
break;
|
|
156
259
|
}
|
|
260
|
+
case "ConeDirectedParticleEmitter": {
|
|
261
|
+
const source = emitter;
|
|
262
|
+
shapeBlock = new ConeShapeBlock("Cone Shape");
|
|
263
|
+
const target = shapeBlock;
|
|
264
|
+
target.emitFromSpawnPointOnly = source.emitFromSpawnPointOnly;
|
|
265
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
266
|
+
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
267
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
268
|
+
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
269
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
270
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
157
273
|
case "CustomParticleEmitter": {
|
|
158
|
-
|
|
159
|
-
|
|
274
|
+
const source = emitter;
|
|
275
|
+
shapeBlock = new CustomShapeBlock("Custom Shape");
|
|
276
|
+
const target = shapeBlock;
|
|
277
|
+
target.particlePositionGenerator = source.particlePositionGenerator;
|
|
278
|
+
target.particleDestinationGenerator = source.particleDestinationGenerator;
|
|
279
|
+
target.particleDirectionGenerator = source.particleDirectionGenerator;
|
|
280
|
+
break;
|
|
160
281
|
}
|
|
161
282
|
case "CylinderParticleEmitter": {
|
|
162
283
|
const source = emitter;
|
|
@@ -168,14 +289,32 @@ function _CreateEmitterShapeBlock(oldSystem) {
|
|
|
168
289
|
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
169
290
|
break;
|
|
170
291
|
}
|
|
292
|
+
case "CylinderDirectedParticleEmitter": {
|
|
293
|
+
const source = emitter;
|
|
294
|
+
shapeBlock = new CylinderShapeBlock("Cylinder Shape");
|
|
295
|
+
const target = shapeBlock;
|
|
296
|
+
_CreateAndConnectInput("Height", source.height, target.height);
|
|
297
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
298
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
299
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
300
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
171
303
|
case "HemisphericParticleEmitter": {
|
|
172
|
-
|
|
173
|
-
|
|
304
|
+
const source = emitter;
|
|
305
|
+
shapeBlock = new SphereShapeBlock("Sphere Shape");
|
|
306
|
+
const target = shapeBlock;
|
|
307
|
+
target.isHemispheric = true;
|
|
308
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
309
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
310
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
311
|
+
break;
|
|
174
312
|
}
|
|
175
313
|
case "MeshParticleEmitter": {
|
|
176
314
|
const source = emitter;
|
|
177
315
|
shapeBlock = new MeshShapeBlock("Mesh Shape");
|
|
178
316
|
const target = shapeBlock;
|
|
317
|
+
target.useMeshNormalsForDirection = source.useMeshNormalsForDirection;
|
|
179
318
|
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
180
319
|
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
181
320
|
target.mesh = source.mesh;
|
|
@@ -198,129 +337,299 @@ function _CreateEmitterShapeBlock(oldSystem) {
|
|
|
198
337
|
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
199
338
|
break;
|
|
200
339
|
}
|
|
340
|
+
case "SphereDirectedParticleEmitter": {
|
|
341
|
+
const source = emitter;
|
|
342
|
+
shapeBlock = new SphereShapeBlock("Sphere Shape");
|
|
343
|
+
const target = shapeBlock;
|
|
344
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
345
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
346
|
+
_CreateAndConnectInput("Direction1", source.direction1, target.direction1);
|
|
347
|
+
_CreateAndConnectInput("Direction2", source.direction2, target.direction2);
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
201
350
|
}
|
|
202
351
|
if (!shapeBlock) {
|
|
203
352
|
throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);
|
|
204
353
|
}
|
|
205
354
|
return shapeBlock;
|
|
206
355
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
356
|
+
// ------------- UPDATE PARTICLE FUNCTIONS -------------
|
|
357
|
+
/**
|
|
358
|
+
* Creates the group of blocks that represent the particle system update
|
|
359
|
+
* The creation of the different properties follows the order they are added to the ProcessQueue in ThinParticleSystem:
|
|
360
|
+
* Color, AngularSpeedGradients, AngularSpeed, VelocityGradients, Direction, LimitVelocityGradients, DragGradients, Position, Noise, SizeGradients, Gravity, RemapGradients
|
|
361
|
+
* @param inputParticle The particle input connection point
|
|
362
|
+
* @param oldSystem The old particle system to convert
|
|
363
|
+
* @param context The runtime conversion context
|
|
364
|
+
* @returns The output connection point after all updates have been applied
|
|
365
|
+
*/
|
|
366
|
+
function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
367
|
+
let updateBlockGroupOutput = inputParticle;
|
|
368
|
+
updateBlockGroupOutput = _UpdateParticleColorBlockGroup(updateBlockGroupOutput, oldSystem._colorGradients, context);
|
|
369
|
+
updateBlockGroupOutput = _UpdateParticleAngleBlockGroup(updateBlockGroupOutput, oldSystem, context);
|
|
370
|
+
if (oldSystem._velocityGradients && oldSystem._velocityGradients.length > 0) {
|
|
371
|
+
context.scaledDirection = _UpdateParticleVelocityGradientBlockGroup(oldSystem._velocityGradients, context);
|
|
372
|
+
}
|
|
373
|
+
if (oldSystem._dragGradients && oldSystem._dragGradients.length > 0) {
|
|
374
|
+
context.scaledDirection = _UpdateParticleDragGradientBlockGroup(oldSystem._dragGradients, context);
|
|
375
|
+
}
|
|
376
|
+
updateBlockGroupOutput = _UpdateParticlePositionBlockGroup(updateBlockGroupOutput, oldSystem.isLocal, context);
|
|
377
|
+
if (oldSystem._limitVelocityGradients && oldSystem._limitVelocityGradients.length > 0 && oldSystem.limitVelocityDamping !== 0) {
|
|
378
|
+
updateBlockGroupOutput = _UpdateParticleVelocityLimitGradientBlockGroup(updateBlockGroupOutput, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
|
|
379
|
+
}
|
|
380
|
+
if (oldSystem._sizeGradients && oldSystem._sizeGradients.length > 0) {
|
|
381
|
+
updateBlockGroupOutput = _UpdateParticleSizeGradientBlockGroup(updateBlockGroupOutput, oldSystem._sizeGradients, context);
|
|
382
|
+
}
|
|
210
383
|
if (oldSystem.gravity.equalsToFloats(0, 0, 0) === false) {
|
|
211
|
-
|
|
384
|
+
updateBlockGroupOutput = _UpdateParticleGravityBlockGroup(updateBlockGroupOutput, oldSystem.gravity);
|
|
385
|
+
}
|
|
386
|
+
return updateBlockGroupOutput;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Creates the group of blocks that represent the particle color update
|
|
390
|
+
* @param inputParticle The input particle to update
|
|
391
|
+
* @param colorGradients The color gradients (if any)
|
|
392
|
+
* @param context The context of the current conversion
|
|
393
|
+
* @returns The output of the group of blocks that represent the particle color update
|
|
394
|
+
*/
|
|
395
|
+
function _UpdateParticleColorBlockGroup(inputParticle, colorGradients, context) {
|
|
396
|
+
let colorCalculation = undefined;
|
|
397
|
+
if (colorGradients && colorGradients.length > 0) {
|
|
398
|
+
if (context.colorGradientValue0Output === undefined) {
|
|
399
|
+
throw new Error("Initial color gradient values not found in context.");
|
|
400
|
+
}
|
|
401
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
402
|
+
colorCalculation = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, colorGradients, ParticleRandomBlockLocks.OncePerParticle, "Color", [
|
|
403
|
+
context.colorGradientValue0Output,
|
|
404
|
+
]);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
colorCalculation = _BasicColorUpdateBlockGroup();
|
|
408
|
+
}
|
|
409
|
+
// Create the color update block clamping alpha >= 0
|
|
410
|
+
const colorUpdateBlock = new UpdateColorBlock("Color update");
|
|
411
|
+
inputParticle.connectTo(colorUpdateBlock.particle);
|
|
412
|
+
_ClampUpdateColorAlpha(colorCalculation).connectTo(colorUpdateBlock.color);
|
|
413
|
+
return colorUpdateBlock.output;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Creates the group of blocks that represent the particle angle update
|
|
417
|
+
* @param inputParticle The input particle to update
|
|
418
|
+
* @param oldSystem The old particle system to convert
|
|
419
|
+
* @param context The context of the current conversion
|
|
420
|
+
* @returns The output of the group of blocks that represent the particle color update
|
|
421
|
+
*/
|
|
422
|
+
function _UpdateParticleAngleBlockGroup(inputParticle, oldSystem, context) {
|
|
423
|
+
// We will try to use gradients if they exist
|
|
424
|
+
// If not, we will try to use min/max angular speed
|
|
425
|
+
let angularSpeedCalculation = null;
|
|
426
|
+
if (oldSystem._angularSpeedGradients && oldSystem._angularSpeedGradients.length > 0) {
|
|
427
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedGradientBlockGroup(oldSystem._angularSpeedGradients, context);
|
|
428
|
+
}
|
|
429
|
+
else if (oldSystem.minAngularSpeed !== 0 || oldSystem.maxAngularSpeed !== 0) {
|
|
430
|
+
angularSpeedCalculation = _UpdateParticleAngularSpeedBlockGroup(oldSystem.minAngularSpeed, oldSystem.maxAngularSpeed);
|
|
431
|
+
}
|
|
432
|
+
// If we have an angular speed calculation, then update the angle
|
|
433
|
+
if (angularSpeedCalculation) {
|
|
434
|
+
// Create the angular speed delta
|
|
435
|
+
const angleSpeedDeltaOutput = _CreateDeltaModifiedInput("Angular Speed", angularSpeedCalculation);
|
|
436
|
+
// Add it to the angle
|
|
437
|
+
const addAngle = new ParticleMathBlock("Add Angular Speed to Angle");
|
|
438
|
+
addAngle.operation = ParticleMathBlockOperations.Add;
|
|
439
|
+
_CreateAndConnectContextualSource("Angle", NodeParticleContextualSources.Angle, addAngle.left);
|
|
440
|
+
angleSpeedDeltaOutput.connectTo(addAngle.right);
|
|
441
|
+
// Update the particle angle
|
|
442
|
+
const updateAngle = new UpdateAngleBlock("Angle Update with Angular Speed");
|
|
443
|
+
inputParticle.connectTo(updateAngle.particle);
|
|
444
|
+
addAngle.output.connectTo(updateAngle.angle);
|
|
445
|
+
return updateAngle.output;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
return inputParticle;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Creates the group of blocks that represent the particle velocity update
|
|
453
|
+
* @param velocityGradients The velocity gradients
|
|
454
|
+
* @param context The context of the current conversion
|
|
455
|
+
* @returns The output of the group of blocks that represent the particle velocity update
|
|
456
|
+
*/
|
|
457
|
+
function _UpdateParticleVelocityGradientBlockGroup(velocityGradients, context) {
|
|
458
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
459
|
+
// Generate the gradient
|
|
460
|
+
const velocityValueOutput = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, velocityGradients, ParticleRandomBlockLocks.OncePerParticle, "Velocity");
|
|
461
|
+
// Update the direction scale based on the velocity
|
|
462
|
+
const multiplyScaleByVelocity = new ParticleMathBlock("Multiply Direction Scale by Velocity");
|
|
463
|
+
multiplyScaleByVelocity.operation = ParticleMathBlockOperations.Multiply;
|
|
464
|
+
velocityValueOutput.connectTo(multiplyScaleByVelocity.left);
|
|
465
|
+
_CreateAndConnectContextualSource("Direction Scale", NodeParticleContextualSources.DirectionScale, multiplyScaleByVelocity.right);
|
|
466
|
+
// Update the particle direction scale
|
|
467
|
+
const multiplyDirection = new ParticleMathBlock("Scaled Direction");
|
|
468
|
+
multiplyDirection.operation = ParticleMathBlockOperations.Multiply;
|
|
469
|
+
multiplyScaleByVelocity.output.connectTo(multiplyDirection.left);
|
|
470
|
+
_CreateAndConnectContextualSource("Direction", NodeParticleContextualSources.Direction, multiplyDirection.right);
|
|
471
|
+
// Store the new calculation of the scaled direction in the context
|
|
472
|
+
context.scaledDirection = multiplyDirection.output;
|
|
473
|
+
return multiplyDirection.output;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Creates the group of blocks that represent the particle velocity limit update
|
|
477
|
+
* @param inputParticle The input particle to update
|
|
478
|
+
* @param velocityLimitGradients The velocity limit gradients
|
|
479
|
+
* @param limitVelocityDamping The limit velocity damping factor
|
|
480
|
+
* @param context The context of the current conversion
|
|
481
|
+
* @returns The output of the group of blocks that represent the particle velocity limit update
|
|
482
|
+
*/
|
|
483
|
+
function _UpdateParticleVelocityLimitGradientBlockGroup(inputParticle, velocityLimitGradients, limitVelocityDamping, context) {
|
|
484
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
485
|
+
// Calculate the current speed
|
|
486
|
+
const currentSpeedBlock = new ParticleVectorLengthBlock("Current Speed");
|
|
487
|
+
_CreateAndConnectContextualSource("Direction", NodeParticleContextualSources.Direction, currentSpeedBlock.input);
|
|
488
|
+
// Calculate the velocity limit from the gradient
|
|
489
|
+
const velocityLimitValueOutput = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, velocityLimitGradients, ParticleRandomBlockLocks.OncePerParticle, "Velocity Limit");
|
|
490
|
+
// Blocks that will calculate the new velocity if over the limit
|
|
491
|
+
const damped = new ParticleMathBlock("Damped Speed");
|
|
492
|
+
damped.operation = ParticleMathBlockOperations.Multiply;
|
|
493
|
+
_CreateAndConnectContextualSource("Direction", NodeParticleContextualSources.Direction, damped.left);
|
|
494
|
+
_CreateAndConnectInput("Limit Velocity Damping", limitVelocityDamping, damped.right);
|
|
495
|
+
// Compare current speed and limit
|
|
496
|
+
const compareSpeed = new ParticleConditionBlock("Compare Speed to Limit");
|
|
497
|
+
compareSpeed.test = ParticleConditionBlockTests.GreaterThan;
|
|
498
|
+
currentSpeedBlock.output.connectTo(compareSpeed.left);
|
|
499
|
+
velocityLimitValueOutput.connectTo(compareSpeed.right);
|
|
500
|
+
damped.output.connectTo(compareSpeed.ifTrue);
|
|
501
|
+
_CreateAndConnectContextualSource("Direction", NodeParticleContextualSources.Direction, compareSpeed.ifFalse);
|
|
502
|
+
// Update the direction based on the calculted value
|
|
503
|
+
const updateDirection = new UpdateDirectionBlock("Direction Update");
|
|
504
|
+
inputParticle.connectTo(updateDirection.particle);
|
|
505
|
+
compareSpeed.output.connectTo(updateDirection.direction);
|
|
506
|
+
return updateDirection.output;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Creates the group of blocks that represent the particle drag update
|
|
510
|
+
* @param dragGradients The drag gradients
|
|
511
|
+
* @param context The context of the current conversion
|
|
512
|
+
* @returns The output of the group of blocks that represent the particle drag update
|
|
513
|
+
*/
|
|
514
|
+
function _UpdateParticleDragGradientBlockGroup(dragGradients, context) {
|
|
515
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
516
|
+
// Generate the gradient
|
|
517
|
+
const dragValueOutput = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, dragGradients, ParticleRandomBlockLocks.OncePerParticle, "Drag");
|
|
518
|
+
// Calculate drag factor
|
|
519
|
+
const oneMinusDragBlock = new ParticleMathBlock("1 - Drag");
|
|
520
|
+
oneMinusDragBlock.operation = ParticleMathBlockOperations.Subtract;
|
|
521
|
+
_CreateAndConnectInput("One", 1, oneMinusDragBlock.left);
|
|
522
|
+
dragValueOutput.connectTo(oneMinusDragBlock.right);
|
|
523
|
+
// Multiply the scaled direction by drag factor
|
|
524
|
+
const multiplyDirection = new ParticleMathBlock("Scaled Direction with Drag");
|
|
525
|
+
multiplyDirection.operation = ParticleMathBlockOperations.Multiply;
|
|
526
|
+
oneMinusDragBlock.output.connectTo(multiplyDirection.left);
|
|
527
|
+
if (context.scaledDirection === undefined) {
|
|
528
|
+
_CreateAndConnectContextualSource("Scaled Direction", NodeParticleContextualSources.ScaledDirection, multiplyDirection.right);
|
|
212
529
|
}
|
|
213
|
-
|
|
530
|
+
else {
|
|
531
|
+
context.scaledDirection.connectTo(multiplyDirection.right);
|
|
532
|
+
}
|
|
533
|
+
// Store the new calculation of the scaled direction in the context
|
|
534
|
+
context.scaledDirection = multiplyDirection.output;
|
|
535
|
+
return multiplyDirection.output;
|
|
214
536
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Creates the group of blocks that represent the particle position update
|
|
539
|
+
* @param inputParticle The input particle to update
|
|
540
|
+
* @param isLocal Whether the particle coordinate system is local or not
|
|
541
|
+
* @param context The context of the current conversion
|
|
542
|
+
* @returns The output of the group of blocks that represent the particle position update
|
|
543
|
+
*/
|
|
544
|
+
function _UpdateParticlePositionBlockGroup(inputParticle, isLocal, context) {
|
|
221
545
|
// Update the particle position
|
|
222
546
|
const updatePosition = new UpdatePositionBlock("Position Update");
|
|
223
547
|
inputParticle.connectTo(updatePosition.particle);
|
|
224
|
-
|
|
548
|
+
if (isLocal) {
|
|
549
|
+
_CreateAndConnectContextualSource("Local Position Updated", NodeParticleContextualSources.LocalPositionUpdated, updatePosition.position);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
// Calculate the new position
|
|
553
|
+
const addPositionBlock = new ParticleMathBlock("Add Position");
|
|
554
|
+
addPositionBlock.operation = ParticleMathBlockOperations.Add;
|
|
555
|
+
_CreateAndConnectContextualSource("Position", NodeParticleContextualSources.Position, addPositionBlock.left);
|
|
556
|
+
if (context.scaledDirection === undefined) {
|
|
557
|
+
_CreateAndConnectContextualSource("Scaled Direction", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
context.scaledDirection.connectTo(addPositionBlock.right);
|
|
561
|
+
}
|
|
562
|
+
addPositionBlock.output.connectTo(updatePosition.position);
|
|
563
|
+
}
|
|
225
564
|
return updatePosition.output;
|
|
226
565
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
566
|
+
/**
|
|
567
|
+
* Creates the group of blocks that represent the particle size update
|
|
568
|
+
* @param inputParticle The input particle to update
|
|
569
|
+
* @param sizeGradients The size gradients (if any)
|
|
570
|
+
* @param context The context of the current conversion
|
|
571
|
+
* @returns The output of the group of blocks that represent the particle size update
|
|
572
|
+
*/
|
|
573
|
+
function _UpdateParticleSizeGradientBlockGroup(inputParticle, sizeGradients, context) {
|
|
574
|
+
if (context.sizeGradientValue0Output === undefined) {
|
|
575
|
+
throw new Error("Initial size gradient values not found in context.");
|
|
576
|
+
}
|
|
577
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
578
|
+
// Generate the gradient
|
|
579
|
+
const sizeValueOutput = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, sizeGradients, ParticleRandomBlockLocks.OncePerParticle, "Size", [
|
|
580
|
+
context.sizeGradientValue0Output,
|
|
581
|
+
]);
|
|
582
|
+
// Create the update size
|
|
583
|
+
const updateSizeBlock = new UpdateSizeBlock("Size Update");
|
|
584
|
+
inputParticle.connectTo(updateSizeBlock.particle);
|
|
585
|
+
sizeValueOutput.connectTo(updateSizeBlock.size);
|
|
586
|
+
return updateSizeBlock.output;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Creates the group of blocks that represent the particle gravity update
|
|
590
|
+
* @param inputParticle The input particle to update
|
|
591
|
+
* @param gravity The gravity vector to apply
|
|
592
|
+
* @returns The output of the group of blocks that represent the particle gravity update
|
|
593
|
+
*/
|
|
594
|
+
function _UpdateParticleGravityBlockGroup(inputParticle, gravity) {
|
|
595
|
+
// Create the gravity delta
|
|
596
|
+
const gravityDeltaOutput = _CreateDeltaModifiedInput("Gravity", gravity);
|
|
230
597
|
// Add it to the direction
|
|
231
598
|
const addDirectionBlock = new ParticleMathBlock("Add Gravity to Direction");
|
|
232
599
|
addDirectionBlock.operation = ParticleMathBlockOperations.Add;
|
|
233
600
|
_CreateAndConnectContextualSource("Direction", NodeParticleContextualSources.Direction, addDirectionBlock.left);
|
|
234
|
-
|
|
601
|
+
gravityDeltaOutput.connectTo(addDirectionBlock.right);
|
|
235
602
|
// Update the particle direction
|
|
236
603
|
const updateDirection = new UpdateDirectionBlock("Direction Update with Gravity");
|
|
237
604
|
inputParticle.connectTo(updateDirection.particle);
|
|
238
605
|
addDirectionBlock.output.connectTo(updateDirection.direction);
|
|
239
606
|
return updateDirection.output;
|
|
240
607
|
}
|
|
241
|
-
function
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const colorGradients = oldSystem.getColorGradients();
|
|
247
|
-
let colorBlock = null;
|
|
248
|
-
if (colorGradients && colorGradients.length > 0) {
|
|
249
|
-
colorBlock = _CreateGradientColorUpdate(oldSystem, colorGradients, createParticleBlock);
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
colorBlock = _CreateBasicColorUpdate();
|
|
253
|
-
}
|
|
254
|
-
// Clamp alpha >= 0
|
|
255
|
-
const clampedColor = _ClampUpdateColorAlpha(colorBlock);
|
|
256
|
-
// Create the color update block
|
|
257
|
-
const colorUpdateBlock = new UpdateColorBlock("Color update");
|
|
258
|
-
clampedColor.colorOut.connectTo(colorUpdateBlock.color);
|
|
259
|
-
return colorUpdateBlock;
|
|
260
|
-
}
|
|
261
|
-
function _CreateGradientColorUpdate(oldSystem, gradient, createParticleBlock) {
|
|
262
|
-
const colorGradientBlock = new ParticleGradientBlock("Color Gradient");
|
|
263
|
-
_CreateAndConnectContextualSource("gradient", NodeParticleContextualSources.Age, colorGradientBlock.gradient);
|
|
264
|
-
let tempColor = null;
|
|
265
|
-
let colorStart = null;
|
|
266
|
-
let colorEnd = null;
|
|
267
|
-
for (let i = 0; i < gradient.length; i++) {
|
|
268
|
-
const gradientStep = gradient[i];
|
|
269
|
-
const gradientValueBlock = new ParticleGradientValueBlock("Color Gradient Value " + i);
|
|
270
|
-
gradientValueBlock.reference = gradientStep.gradient;
|
|
271
|
-
if (gradientStep.color2) {
|
|
272
|
-
// Create a random between color1 and color2
|
|
273
|
-
const randomColorBlock = new ParticleRandomBlock("Random Color for Gradient " + i);
|
|
274
|
-
randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;
|
|
275
|
-
_CreateAndConnectInput("Color 1", gradientStep.color1, randomColorBlock.min);
|
|
276
|
-
_CreateAndConnectInput("Color 2", gradientStep.color2, randomColorBlock.max);
|
|
277
|
-
randomColorBlock.output.connectTo(gradientValueBlock.value);
|
|
278
|
-
tempColor = randomColorBlock;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
// Single color
|
|
282
|
-
const input = new ParticleInputBlock("Color " + i);
|
|
283
|
-
input.value = gradientStep.color1;
|
|
284
|
-
input.output.connectTo(gradientValueBlock.value);
|
|
285
|
-
tempColor = input;
|
|
286
|
-
}
|
|
287
|
-
if (gradientStep.gradient === 0) {
|
|
288
|
-
colorStart = tempColor;
|
|
289
|
-
}
|
|
290
|
-
else if (gradientStep.gradient === 1) {
|
|
291
|
-
colorEnd = tempColor;
|
|
292
|
-
}
|
|
293
|
-
gradientValueBlock.output.connectTo(colorGradientBlock.inputs[i + 1]);
|
|
294
|
-
}
|
|
295
|
-
_UpdateCreateParticleColor(oldSystem, colorStart, colorEnd, createParticleBlock);
|
|
296
|
-
return colorGradientBlock;
|
|
608
|
+
function _UpdateParticleAngularSpeedGradientBlockGroup(angularSpeedGradients, context) {
|
|
609
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
610
|
+
// Generate the gradient
|
|
611
|
+
const angularSpeedValueOutput = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, angularSpeedGradients, ParticleRandomBlockLocks.OncePerParticle, "Angular Speed");
|
|
612
|
+
return angularSpeedValueOutput;
|
|
297
613
|
}
|
|
298
|
-
function
|
|
614
|
+
function _UpdateParticleAngularSpeedBlockGroup(minAngularSpeed, maxAngularSpeed) {
|
|
615
|
+
// Random value between for the angular speed of the particle
|
|
616
|
+
const randomAngularSpeedBlock = new ParticleRandomBlock("Random Angular Speed");
|
|
617
|
+
randomAngularSpeedBlock.lockMode = ParticleRandomBlockLocks.OncePerParticle;
|
|
618
|
+
_CreateAndConnectInput("Min Angular Speed", minAngularSpeed, randomAngularSpeedBlock.min);
|
|
619
|
+
_CreateAndConnectInput("Max Angular Speed", maxAngularSpeed, randomAngularSpeedBlock.max);
|
|
620
|
+
return randomAngularSpeedBlock.output;
|
|
621
|
+
}
|
|
622
|
+
function _BasicColorUpdateBlockGroup() {
|
|
299
623
|
const addColorBlock = new ParticleMathBlock("Add Color");
|
|
300
624
|
addColorBlock.operation = ParticleMathBlockOperations.Add;
|
|
301
625
|
_CreateAndConnectContextualSource("Color", NodeParticleContextualSources.Color, addColorBlock.left);
|
|
302
626
|
_CreateAndConnectContextualSource("Scaled Color Step", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);
|
|
303
|
-
return addColorBlock;
|
|
627
|
+
return addColorBlock.output;
|
|
304
628
|
}
|
|
305
|
-
function
|
|
306
|
-
if (colorStart === null) {
|
|
307
|
-
colorStart = new ParticleInputBlock("Color Start");
|
|
308
|
-
colorStart.value = oldSystem.color1;
|
|
309
|
-
}
|
|
310
|
-
if (colorEnd === null) {
|
|
311
|
-
colorEnd = new ParticleInputBlock("Color End");
|
|
312
|
-
colorEnd.value = oldSystem.color2;
|
|
313
|
-
}
|
|
314
|
-
const randomColorBlock = new ParticleRandomBlock("Random color");
|
|
315
|
-
randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;
|
|
316
|
-
colorStart.output.connectTo(randomColorBlock.min);
|
|
317
|
-
colorEnd.output.connectTo(randomColorBlock.max);
|
|
318
|
-
randomColorBlock.output.connectTo(createParticleBlock.color);
|
|
319
|
-
}
|
|
320
|
-
function _ClampUpdateColorAlpha(colorBlock) {
|
|
629
|
+
function _ClampUpdateColorAlpha(colorCalculationOutput) {
|
|
321
630
|
// Decompose color to clamp alpha
|
|
322
631
|
const decomposeColorBlock = new ParticleConverterBlock("Decompose Color");
|
|
323
|
-
|
|
632
|
+
colorCalculationOutput.connectTo(decomposeColorBlock.colorIn);
|
|
324
633
|
// Clamp alpha to be >= 0
|
|
325
634
|
const maxAlphaBlock = new ParticleMathBlock("Alpha >= 0");
|
|
326
635
|
maxAlphaBlock.operation = ParticleMathBlockOperations.Max;
|
|
@@ -330,12 +639,18 @@ function _ClampUpdateColorAlpha(colorBlock) {
|
|
|
330
639
|
const composeColorBlock = new ParticleConverterBlock("Compose Color");
|
|
331
640
|
decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);
|
|
332
641
|
maxAlphaBlock.output.connectTo(composeColorBlock.wIn);
|
|
333
|
-
return composeColorBlock;
|
|
642
|
+
return composeColorBlock.colorOut;
|
|
334
643
|
}
|
|
644
|
+
// ------------- UTILITY FUNCTIONS -------------
|
|
335
645
|
function _CreateDeltaModifiedInput(name, value) {
|
|
336
646
|
const multiplyBlock = new ParticleMathBlock("Multiply by Delta");
|
|
337
647
|
multiplyBlock.operation = ParticleMathBlockOperations.Multiply;
|
|
338
|
-
|
|
648
|
+
if (value instanceof Vector3) {
|
|
649
|
+
_CreateAndConnectInput(name, value, multiplyBlock.left);
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
value.connectTo(multiplyBlock.left);
|
|
653
|
+
}
|
|
339
654
|
_CreateAndConnectSystemSource("Delta", NodeParticleSystemSources.Delta, multiplyBlock.right);
|
|
340
655
|
return multiplyBlock.output;
|
|
341
656
|
}
|
|
@@ -354,4 +669,127 @@ function _CreateAndConnectSystemSource(systemBlockName, systemSource, targetToCo
|
|
|
354
669
|
input.systemSource = systemSource;
|
|
355
670
|
input.output.connectTo(targetToConnectTo);
|
|
356
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* Creates the target stop duration input block, as it can be shared in multiple places
|
|
674
|
+
* This block is stored in the context so the same block is shared in the graph
|
|
675
|
+
* @param oldSystem The old particle system to convert
|
|
676
|
+
* @param context The context of the current conversion
|
|
677
|
+
* @returns
|
|
678
|
+
*/
|
|
679
|
+
function _CreateTargetStopDurationInputBlock(oldSystem, context) {
|
|
680
|
+
// If we have already created the target stop duration input block, return it
|
|
681
|
+
if (context.targetStopDurationBlockOutput) {
|
|
682
|
+
return context.targetStopDurationBlockOutput;
|
|
683
|
+
}
|
|
684
|
+
// Create the target stop duration input block if not already created
|
|
685
|
+
const targetStopDurationInputBlock = new ParticleInputBlock("Target Stop Duration");
|
|
686
|
+
targetStopDurationInputBlock.value = oldSystem.targetStopDuration;
|
|
687
|
+
// Save the output in our context to avoid regenerating it again
|
|
688
|
+
context.targetStopDurationBlockOutput = targetStopDurationInputBlock.output;
|
|
689
|
+
return context.targetStopDurationBlockOutput;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Create a group of blocks that calculates the ratio between the actual frame and the target stop duration, clamped between 0 and 1.
|
|
693
|
+
* This is used to simulate the behavior of the old particle system where several particle gradient values are affected by the target stop duration.
|
|
694
|
+
* This block group is stored in the context so the same group is shared in the graph
|
|
695
|
+
* @param oldSystem The old particle system to convert
|
|
696
|
+
* @param context The context of the current conversion
|
|
697
|
+
* @returns The ratio block output connection point
|
|
698
|
+
*/
|
|
699
|
+
function _CreateTimeToStopTimeRatioBlockGroup(oldSystem, context) {
|
|
700
|
+
// If we have already generated this group, return it
|
|
701
|
+
if (context.timeToStopTimeRatioBlockGroupOutput) {
|
|
702
|
+
return context.timeToStopTimeRatioBlockGroupOutput;
|
|
703
|
+
}
|
|
704
|
+
context.targetStopDurationBlockOutput = _CreateTargetStopDurationInputBlock(oldSystem, context);
|
|
705
|
+
// Find the ratio between the actual frame and the target stop duration
|
|
706
|
+
const ratio = new ParticleMathBlock("Frame/Stop Ratio");
|
|
707
|
+
ratio.operation = ParticleMathBlockOperations.Divide;
|
|
708
|
+
_CreateAndConnectSystemSource("Actual Frame", NodeParticleSystemSources.Time, ratio.left);
|
|
709
|
+
context.targetStopDurationBlockOutput.connectTo(ratio.right);
|
|
710
|
+
// Make sure values is >=0
|
|
711
|
+
const clampMin = new ParticleMathBlock("Clamp Min 0");
|
|
712
|
+
clampMin.operation = ParticleMathBlockOperations.Max;
|
|
713
|
+
_CreateAndConnectInput("Zero", 0, clampMin.left);
|
|
714
|
+
ratio.output.connectTo(clampMin.right);
|
|
715
|
+
// Make sure values is <=1
|
|
716
|
+
const clampMax = new ParticleMathBlock("Clamp Max 1");
|
|
717
|
+
clampMax.operation = ParticleMathBlockOperations.Min;
|
|
718
|
+
_CreateAndConnectInput("One", 1, clampMax.left);
|
|
719
|
+
clampMin.output.connectTo(clampMax.right);
|
|
720
|
+
// Save the group output in our context to avoid regenerating it again
|
|
721
|
+
context.timeToStopTimeRatioBlockGroupOutput = clampMax.output;
|
|
722
|
+
return context.timeToStopTimeRatioBlockGroupOutput;
|
|
723
|
+
}
|
|
724
|
+
function _CreateAgeToLifeTimeRatioBlockGroup(context) {
|
|
725
|
+
// If we have already generated this group, return it
|
|
726
|
+
if (context.ageToLifeTimeRatioBlockGroupOutput) {
|
|
727
|
+
return context.ageToLifeTimeRatioBlockGroupOutput;
|
|
728
|
+
}
|
|
729
|
+
// Find the ratio between the age and the lifetime
|
|
730
|
+
const ratio = new ParticleMathBlock("Age/LifeTime Ratio");
|
|
731
|
+
ratio.operation = ParticleMathBlockOperations.Divide;
|
|
732
|
+
_CreateAndConnectContextualSource("Age", NodeParticleContextualSources.Age, ratio.left);
|
|
733
|
+
_CreateAndConnectContextualSource("LifeTime", NodeParticleContextualSources.Lifetime, ratio.right);
|
|
734
|
+
// Save the group output in our context to avoid regenerating it again
|
|
735
|
+
context.ageToLifeTimeRatioBlockGroupOutput = ratio.output;
|
|
736
|
+
return ratio.output;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Creates the blocks that represent a gradient
|
|
740
|
+
* @param gradientSelector The value that determines which gradient to use
|
|
741
|
+
* @param gradientValues The list of gradient values
|
|
742
|
+
* @param randomLockMode The type of random to use for the gradient values
|
|
743
|
+
* @param prefix The prefix to use for naming the blocks
|
|
744
|
+
* @param initialValues Optional initial values to connect to the gradient inputs that were calculated during other steps of the conversion
|
|
745
|
+
* @returns The output connection point of the gradient block
|
|
746
|
+
*/
|
|
747
|
+
function _CreateGradientBlockGroup(gradientSelector, gradientValues, randomLockMode, prefix, initialValues = []) {
|
|
748
|
+
// Create the gradient block and connect the value that controls the gradient selection
|
|
749
|
+
const gradientBlock = new ParticleGradientBlock(prefix + " Gradient Block");
|
|
750
|
+
gradientSelector.connectTo(gradientBlock.gradient);
|
|
751
|
+
// If initial values are provided, we use them instead of the values in the gradientValues array
|
|
752
|
+
// These means this values were already transformed into blocks on a previous step of the conversion and we must reuse them
|
|
753
|
+
for (let i = 0; i < initialValues.length; i++) {
|
|
754
|
+
const reference = i < gradientValues.length ? gradientValues[i].gradient : 1;
|
|
755
|
+
const gradientValueBlock = new ParticleGradientValueBlock(prefix + " Gradient Value " + i);
|
|
756
|
+
gradientValueBlock.reference = reference;
|
|
757
|
+
initialValues[i].connectTo(gradientValueBlock.value);
|
|
758
|
+
gradientValueBlock.output.connectTo(gradientBlock.inputs[i + 1]);
|
|
759
|
+
}
|
|
760
|
+
// Create the gradient values
|
|
761
|
+
for (let i = 0 + initialValues.length; i < gradientValues.length; i++) {
|
|
762
|
+
const gradientValueBlockGroupOutput = _CreateGradientValueBlockGroup(gradientValues[i], randomLockMode, prefix, i);
|
|
763
|
+
gradientValueBlockGroupOutput.connectTo(gradientBlock.inputs[i + 1]);
|
|
764
|
+
}
|
|
765
|
+
return gradientBlock.output;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Creates the blocks that represent a gradient value
|
|
769
|
+
* This can be either a single value or a random between two values
|
|
770
|
+
* @param gradientStep The gradient step data
|
|
771
|
+
* @param randomLockMode The lock mode to use for random values
|
|
772
|
+
* @param prefix The prefix to use for naming the blocks
|
|
773
|
+
* @param index The index of the gradient step
|
|
774
|
+
* @returns The output connection point of the gradient value block
|
|
775
|
+
*/
|
|
776
|
+
function _CreateGradientValueBlockGroup(gradientStep, randomLockMode, prefix, index) {
|
|
777
|
+
const gradientValueBlock = new ParticleGradientValueBlock(prefix + " Gradient Value " + index);
|
|
778
|
+
gradientValueBlock.reference = gradientStep.gradient;
|
|
779
|
+
const value1 = gradientStep.factor1 ?? gradientStep.color1;
|
|
780
|
+
const value2 = gradientStep.factor2 ?? gradientStep.color2;
|
|
781
|
+
if (value2 !== undefined) {
|
|
782
|
+
// Create a random between value1 and value2
|
|
783
|
+
const randomBlock = new ParticleRandomBlock("Random Value " + index);
|
|
784
|
+
randomBlock.lockMode = randomLockMode;
|
|
785
|
+
_CreateAndConnectInput("Value 1", value1, randomBlock.min);
|
|
786
|
+
_CreateAndConnectInput("Value 2", value2, randomBlock.max);
|
|
787
|
+
randomBlock.output.connectTo(gradientValueBlock.value);
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
// Single value
|
|
791
|
+
_CreateAndConnectInput("Value", value1, gradientValueBlock.value);
|
|
792
|
+
}
|
|
793
|
+
return gradientValueBlock.output;
|
|
794
|
+
}
|
|
357
795
|
//# sourceMappingURL=nodeParticleSystemSet.helper.js.map
|