@babylonjs/core 8.37.0 → 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.
Files changed (193) hide show
  1. package/Animations/animationGroup.js +1 -4
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Behaviors/Cameras/interpolatingBehavior.d.ts +58 -0
  4. package/Behaviors/Cameras/interpolatingBehavior.js +157 -0
  5. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
  6. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
  7. package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
  10. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
  11. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
  12. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
  13. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
  14. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +17 -21
  15. package/Cameras/Inputs/geospatialCameraPointersInput.js +49 -71
  16. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  17. package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
  18. package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
  19. package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
  20. package/Cameras/Limits/geospatialLimits.d.ts +60 -0
  21. package/Cameras/Limits/geospatialLimits.js +89 -0
  22. package/Cameras/Limits/geospatialLimits.js.map +1 -0
  23. package/Cameras/cameraMovement.d.ts +150 -0
  24. package/Cameras/cameraMovement.js +190 -0
  25. package/Cameras/cameraMovement.js.map +1 -0
  26. package/Cameras/geospatialCamera.d.ts +78 -49
  27. package/Cameras/geospatialCamera.js +210 -191
  28. package/Cameras/geospatialCamera.js.map +1 -1
  29. package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
  30. package/Cameras/geospatialCameraInputsManager.js +9 -0
  31. package/Cameras/geospatialCameraInputsManager.js.map +1 -1
  32. package/Cameras/geospatialCameraMovement.d.ts +66 -0
  33. package/Cameras/geospatialCameraMovement.js +199 -0
  34. package/Cameras/geospatialCameraMovement.js.map +1 -0
  35. package/Decorators/nodeDecorator.d.ts +9 -7
  36. package/Decorators/nodeDecorator.js +9 -7
  37. package/Decorators/nodeDecorator.js.map +1 -1
  38. package/Engines/Native/nativeInterfaces.d.ts +14 -6
  39. package/Engines/Native/nativeInterfaces.js +6 -1
  40. package/Engines/Native/nativeInterfaces.js.map +1 -1
  41. package/Engines/WebGPU/webgpuTextureManager.js +2 -2
  42. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  43. package/Engines/abstractEngine.js +2 -2
  44. package/Engines/abstractEngine.js.map +1 -1
  45. package/Engines/nativeEngine.js +2 -2
  46. package/Engines/nativeEngine.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
  48. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
  49. package/FlowGraph/flowGraphMath.d.ts +25 -0
  50. package/FlowGraph/flowGraphMath.js +40 -0
  51. package/FlowGraph/flowGraphMath.js.map +1 -0
  52. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
  53. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
  54. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +1 -1
  55. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
  56. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
  57. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  58. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +1 -1
  59. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +1 -1
  60. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +1 -1
  61. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +1 -1
  62. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +1 -1
  63. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +1 -1
  64. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -1
  65. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +1 -1
  66. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
  67. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +6 -0
  68. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +26 -0
  69. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  70. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
  71. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +48 -22
  72. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  73. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
  74. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  75. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
  76. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +1 -1
  77. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
  78. package/FrameGraph/Node/nodeRenderGraph.js +2 -1
  79. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  80. package/FrameGraph/Passes/{cullPass.d.ts → objectListPass.d.ts} +8 -8
  81. package/FrameGraph/Passes/{cullPass.js → objectListPass.js} +9 -9
  82. package/FrameGraph/Passes/objectListPass.js.map +1 -0
  83. package/FrameGraph/Passes/renderPass.d.ts +6 -2
  84. package/FrameGraph/Passes/renderPass.js +14 -2
  85. package/FrameGraph/Passes/renderPass.js.map +1 -1
  86. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +2 -2
  87. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  88. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +8 -0
  89. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +10 -0
  90. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  91. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -0
  92. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +13 -0
  93. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  94. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
  95. package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
  96. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  97. package/FrameGraph/frameGraph.d.ts +10 -4
  98. package/FrameGraph/frameGraph.js +22 -9
  99. package/FrameGraph/frameGraph.js.map +1 -1
  100. package/FrameGraph/frameGraphTask.js +3 -3
  101. package/FrameGraph/frameGraphTask.js.map +1 -1
  102. package/FrameGraph/index.d.ts +1 -1
  103. package/FrameGraph/index.js +1 -1
  104. package/FrameGraph/index.js.map +1 -1
  105. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  106. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  107. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
  108. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  109. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
  110. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  111. package/Materials/shaderMaterial.d.ts +9 -0
  112. package/Materials/shaderMaterial.js +39 -2
  113. package/Materials/shaderMaterial.js.map +1 -1
  114. package/Maths/math.vector.functions.d.ts +5 -24
  115. package/Maths/math.vector.functions.js +32 -35
  116. package/Maths/math.vector.functions.js.map +1 -1
  117. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
  118. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
  119. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  120. package/Meshes/csg2.js +1 -1
  121. package/Meshes/csg2.js.map +1 -1
  122. package/Meshes/thinInstanceMesh.js +15 -0
  123. package/Meshes/thinInstanceMesh.js.map +1 -1
  124. package/Misc/fileTools.js.map +1 -1
  125. package/Misc/tools.d.ts +3 -0
  126. package/Misc/tools.js +43 -4
  127. package/Misc/tools.js.map +1 -1
  128. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +3 -1
  129. package/Particles/EmitterTypes/coneParticleEmitter.js +7 -1
  130. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  131. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +9 -0
  132. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +43 -12
  133. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
  134. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
  135. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
  136. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
  137. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
  138. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +3 -3
  139. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  140. package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
  141. package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
  142. package/Particles/Node/Blocks/Update/updateSizeBlock.js.map +1 -0
  143. package/Particles/Node/Blocks/index.d.ts +1 -0
  144. package/Particles/Node/Blocks/index.js +1 -0
  145. package/Particles/Node/Blocks/index.js.map +1 -1
  146. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  147. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  148. package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
  149. package/Particles/Node/Blocks/particleRandomBlock.js +32 -14
  150. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
  151. package/Particles/Node/Blocks/systemBlock.d.ts +20 -12
  152. package/Particles/Node/Blocks/systemBlock.js +26 -22
  153. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  154. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  155. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  156. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  157. package/Particles/Node/nodeParticleBuildState.d.ts +5 -5
  158. package/Particles/Node/nodeParticleBuildState.js +11 -7
  159. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  160. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
  161. package/Particles/Node/nodeParticleSystemSet.helper.js +524 -147
  162. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  163. package/Particles/particle.d.ts +4 -0
  164. package/Particles/particle.js +2 -0
  165. package/Particles/particle.js.map +1 -1
  166. package/Particles/thinParticleSystem.d.ts +3 -7
  167. package/Particles/thinParticleSystem.function.d.ts +1 -1
  168. package/Particles/thinParticleSystem.function.js +9 -6
  169. package/Particles/thinParticleSystem.function.js.map +1 -1
  170. package/Particles/thinParticleSystem.js +5 -7
  171. package/Particles/thinParticleSystem.js.map +1 -1
  172. package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
  173. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  174. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  175. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  176. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
  177. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  178. package/Shaders/gaussianSplatting.vertex.js +3 -3
  179. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  180. package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
  181. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  182. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
  183. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  184. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  185. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  186. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
  187. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  188. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  189. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  190. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
  191. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  192. package/package.json +1 -1
  193. package/FrameGraph/Passes/cullPass.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"coneParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/coneParticleEmitter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,mCAA+B;AACjD,OAAO,EAAE,WAAW,EAAE,6CAAyC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAoB5B;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAa;QAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,YAA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OAAO,EAAE,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,KAAK,CAAC,mBAAwB;QAC1C,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;CACJ","sourcesContent":["import type { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"core/Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\n\r\nimport { DeepCopier } from \"core/Misc/deepCopier\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cone.\r\n * It emits the particles alongside the cone volume from the base to the particle.\r\n * The emission direction might be randomized.\r\n */\r\nexport class ConeParticleEmitter implements IParticleEmitterType {\r\n private _radius: number;\r\n private _angle: number;\r\n private _height: number;\r\n\r\n /**\r\n * Gets or sets a value indicating where on the radius the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n public radiusRange = 1;\r\n\r\n /**\r\n * Gets or sets a value indicating where on the height the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n public heightRange = 1;\r\n\r\n /**\r\n * Gets or sets a value indicating if all the particles should be emitted from the spawn point only (the base of the cone)\r\n */\r\n public emitFromSpawnPointOnly = false;\r\n\r\n /**\r\n * Gets or sets the radius of the emission cone\r\n */\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n\r\n public set radius(value: number) {\r\n this._radius = value;\r\n this._buildHeight();\r\n }\r\n\r\n /**\r\n * Gets or sets the angle of the emission cone\r\n */\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._buildHeight();\r\n }\r\n\r\n private _buildHeight() {\r\n if (this._angle !== 0) {\r\n this._height = this._radius / Math.tan(this._angle / 2);\r\n } else {\r\n this._height = 1;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new instance ConeParticleEmitter\r\n * @param radius the radius of the emission cone (1 by default)\r\n * @param angle the cone base angle (PI by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1] (default is 0)\r\n */\r\n constructor(\r\n radius = 1,\r\n angle = Math.PI,\r\n /** [0] defines how much to randomize the particle direction [0-1] (default is 0) */\r\n public directionRandomizer = 0\r\n ) {\r\n this.angle = angle;\r\n this.radius = radius;\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n const randX = RandomRange(0, this.directionRandomizer);\r\n const randY = RandomRange(0, this.directionRandomizer);\r\n const randZ = RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(direction);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const s = RandomRange(0, Math.PI * 2);\r\n let h: number;\r\n\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = RandomRange(0, this.heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n } else {\r\n h = 0.0001;\r\n }\r\n let radius = this._radius - RandomRange(0, this._radius * this.radiusRange);\r\n radius = radius * h;\r\n\r\n const randX = radius * Math.sin(s);\r\n const randZ = radius * Math.cos(s);\r\n const randY = h * this._height;\r\n\r\n if (isLocal) {\r\n positionToUpdate.x = randX;\r\n positionToUpdate.y = randY;\r\n positionToUpdate.z = randZ;\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): ConeParticleEmitter {\r\n const newOne = new ConeParticleEmitter(this._radius, this._angle, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat2(\"radius\", this._radius, this.radiusRange);\r\n uboOrEffect.setFloat(\"coneAngle\", this._angle);\r\n uboOrEffect.setFloat2(\"height\", this._height, this.heightRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 2);\r\n ubo.addUniform(\"coneAngle\", 1);\r\n ubo.addUniform(\"height\", 2);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n let defines = \"#define CONEEMITTER\";\r\n\r\n if (this.emitFromSpawnPointOnly) {\r\n defines += \"\\n#define CONEEMITTERSPAWNPOINT\";\r\n }\r\n\r\n return defines;\r\n }\r\n\r\n /**\r\n * Returns the string \"ConeParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"ConeParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this._radius;\r\n serializationObject.angle = this._angle;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.heightRange = this.heightRange;\r\n serializationObject.emitFromSpawnPointOnly = this.emitFromSpawnPointOnly;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.angle = serializationObject.angle;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n\r\n this.radiusRange = serializationObject.radiusRange !== undefined ? serializationObject.radiusRange : 1;\r\n this.heightRange = serializationObject.radiusRange !== undefined ? serializationObject.heightRange : 1;\r\n this.emitFromSpawnPointOnly = serializationObject.emitFromSpawnPointOnly !== undefined ? serializationObject.emitFromSpawnPointOnly : false;\r\n }\r\n}\r\nexport class ConeDirectedParticleEmitter extends ConeParticleEmitter {\r\n constructor(\r\n radius = 1,\r\n angle = Math.PI,\r\n /**\r\n * [Up vector] The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * [Up vector] The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius, angle);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n */\r\n public override startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3): void {\r\n const randX = RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = RandomRange(this.direction1.z, this.direction2.z);\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public override clone(): ConeDirectedParticleEmitter {\r\n const newOne = new ConeDirectedParticleEmitter(this.radius, this.angle, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public override applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public override buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public override getEffectDefines(): string {\r\n return \"#define CONEEMITTER\\n#define DIRECTEDCONEEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"ConeDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public override getClassName(): string {\r\n return \"ConeDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public override parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"coneParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/coneParticleEmitter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,mCAA+B;AACjD,OAAO,EAAE,WAAW,EAAE,6CAAyC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAoB5B;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAa;QAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAEO,YAAY;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI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,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;CACJ","sourcesContent":["import type { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"core/Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\n\r\nimport { DeepCopier } from \"core/Misc/deepCopier\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cone.\r\n * It emits the particles alongside the cone volume from the base to the particle.\r\n * The emission direction might be randomized.\r\n */\r\nexport class ConeParticleEmitter implements IParticleEmitterType {\r\n private _radius: number;\r\n private _angle: number;\r\n private _height: number;\r\n\r\n /**\r\n * Gets or sets a value indicating where on the radius the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n public radiusRange = 1;\r\n\r\n /**\r\n * Gets or sets a value indicating where on the height the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n public heightRange = 1;\r\n\r\n /**\r\n * Gets or sets a value indicating if all the particles should be emitted from the spawn point only (the base of the cone)\r\n */\r\n public emitFromSpawnPointOnly = false;\r\n\r\n /**\r\n * Gets or sets the radius of the emission cone\r\n */\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n\r\n public set radius(value: number) {\r\n this._radius = value;\r\n this._buildHeight();\r\n }\r\n\r\n /**\r\n * Gets or sets the angle of the emission cone\r\n */\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._buildHeight();\r\n }\r\n\r\n private _buildHeight() {\r\n if (this._angle !== 0) {\r\n this._height = this._radius / Math.tan(this._angle / 2);\r\n } else {\r\n this._height = 1;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new instance ConeParticleEmitter\r\n * @param radius the radius of the emission cone (1 by default)\r\n * @param angle the cone base angle (PI by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1] (default is 0)\r\n */\r\n constructor(\r\n radius = 1,\r\n angle = Math.PI,\r\n /** [0] defines how much to randomize the particle direction [0-1] (default is 0) */\r\n public directionRandomizer = 0\r\n ) {\r\n this.angle = angle;\r\n this.radius = radius;\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n const randX = RandomRange(0, this.directionRandomizer);\r\n const randY = RandomRange(0, this.directionRandomizer);\r\n const randZ = RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(direction);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const s = RandomRange(0, Math.PI * 2);\r\n let h: number;\r\n\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = RandomRange(0, this.heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n } else {\r\n h = 0.0001;\r\n }\r\n let radius = this._radius - RandomRange(0, this._radius * this.radiusRange);\r\n radius = radius * h;\r\n\r\n const randX = radius * Math.sin(s);\r\n const randZ = radius * Math.cos(s);\r\n const randY = h * this._height;\r\n\r\n if (isLocal) {\r\n positionToUpdate.x = randX;\r\n positionToUpdate.y = randY;\r\n positionToUpdate.z = randZ;\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): ConeParticleEmitter {\r\n const newOne = new ConeParticleEmitter(this._radius, this._angle, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat2(\"radius\", this._radius, this.radiusRange);\r\n uboOrEffect.setFloat(\"coneAngle\", this._angle);\r\n uboOrEffect.setFloat2(\"height\", this._height, this.heightRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 2);\r\n ubo.addUniform(\"coneAngle\", 1);\r\n ubo.addUniform(\"height\", 2);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n let defines = \"#define CONEEMITTER\";\r\n\r\n if (this.emitFromSpawnPointOnly) {\r\n defines += \"\\n#define CONEEMITTERSPAWNPOINT\";\r\n }\r\n\r\n return defines;\r\n }\r\n\r\n /**\r\n * Returns the string \"ConeParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"ConeParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this._radius;\r\n serializationObject.angle = this._angle;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.heightRange = this.heightRange;\r\n serializationObject.emitFromSpawnPointOnly = this.emitFromSpawnPointOnly;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.angle = serializationObject.angle;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n\r\n this.radiusRange = serializationObject.radiusRange !== undefined ? serializationObject.radiusRange : 1;\r\n this.heightRange = serializationObject.radiusRange !== undefined ? serializationObject.heightRange : 1;\r\n this.emitFromSpawnPointOnly = serializationObject.emitFromSpawnPointOnly !== undefined ? serializationObject.emitFromSpawnPointOnly : false;\r\n }\r\n}\r\nexport class ConeDirectedParticleEmitter extends ConeParticleEmitter {\r\n constructor(\r\n radius = 1,\r\n angle = Math.PI,\r\n /**\r\n * [Up vector] The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * [Up vector] The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius, angle);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public override startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const randX = RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = RandomRange(this.direction1.z, this.direction2.z);\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFromFloats(randX, randY, randZ);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public override clone(): ConeDirectedParticleEmitter {\r\n const newOne = new ConeDirectedParticleEmitter(this.radius, this.angle, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public override applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public override buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public override getEffectDefines(): string {\r\n return \"#define CONEEMITTER\\n#define DIRECTEDCONEEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"ConeDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public override getClassName(): string {\r\n return \"ConeDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public override parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n }\r\n}\r\n"]}
@@ -8,6 +8,7 @@ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
8
8
  export declare class ConeShapeBlock extends NodeParticleBlock implements IShapeBlock {
9
9
  /**
10
10
  * Gets or sets a boolean indicating if the system should emit only from the spawn point
11
+ * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.
11
12
  */
12
13
  emitFromSpawnPointOnly: boolean;
13
14
  /**
@@ -44,6 +45,14 @@ export declare class ConeShapeBlock extends NodeParticleBlock implements IShapeB
44
45
  * Gets the directionRandomizer input component
45
46
  */
46
47
  get directionRandomizer(): NodeParticleConnectionPoint;
48
+ /**
49
+ * Gets the direction1 input component
50
+ */
51
+ get direction1(): NodeParticleConnectionPoint;
52
+ /**
53
+ * Gets the direction2 input component
54
+ */
55
+ get direction2(): NodeParticleConnectionPoint;
47
56
  /**
48
57
  * Gets the output component
49
58
  */
@@ -18,6 +18,7 @@ export class ConeShapeBlock extends NodeParticleBlock {
18
18
  super(name);
19
19
  /**
20
20
  * Gets or sets a boolean indicating if the system should emit only from the spawn point
21
+ * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.
21
22
  */
22
23
  this.emitFromSpawnPointOnly = false;
23
24
  this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
@@ -26,6 +27,8 @@ export class ConeShapeBlock extends NodeParticleBlock {
26
27
  this.registerInput("radiusRange", NodeParticleBlockConnectionPointTypes.Float, true, 1);
27
28
  this.registerInput("heightRange", NodeParticleBlockConnectionPointTypes.Float, true, 1);
28
29
  this.registerInput("directionRandomizer", NodeParticleBlockConnectionPointTypes.Float, true, 0);
30
+ this.registerInput("direction1", NodeParticleBlockConnectionPointTypes.Vector3, true);
31
+ this.registerInput("direction2", NodeParticleBlockConnectionPointTypes.Vector3, true);
29
32
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
30
33
  }
31
34
  /**
@@ -71,6 +74,18 @@ export class ConeShapeBlock extends NodeParticleBlock {
71
74
  get directionRandomizer() {
72
75
  return this._inputs[5];
73
76
  }
77
+ /**
78
+ * Gets the direction1 input component
79
+ */
80
+ get direction1() {
81
+ return this._inputs[6];
82
+ }
83
+ /**
84
+ * Gets the direction2 input component
85
+ */
86
+ get direction2() {
87
+ return this._inputs[7];
88
+ }
74
89
  /**
75
90
  * Gets the output component
76
91
  */
@@ -86,20 +101,36 @@ export class ConeShapeBlock extends NodeParticleBlock {
86
101
  system._directionCreation.process = (particle) => {
87
102
  state.particleContext = particle;
88
103
  state.systemContext = system;
89
- const directionRandomizer = this.directionRandomizer.getConnectedValue(state);
90
- const direction = particle.position.subtract(state.emitterPosition).normalize();
91
- const randX = RandomRange(0, directionRandomizer);
92
- const randY = RandomRange(0, directionRandomizer);
93
- const randZ = RandomRange(0, directionRandomizer);
94
- direction.x += randX;
95
- direction.y += randY;
96
- direction.z += randZ;
97
- direction.normalize();
98
- if (system.isLocal) {
99
- particle.direction.copyFromFloats(direction.x, direction.y, direction.z);
104
+ // We always use directionRandomizer unless both directions are connected
105
+ if (this.direction1.isConnected === false || this.direction2.isConnected === false) {
106
+ const directionRandomizer = this.directionRandomizer.getConnectedValue(state);
107
+ const direction = particle.position.subtract(state.emitterPosition).normalize();
108
+ const randX = RandomRange(0, directionRandomizer);
109
+ const randY = RandomRange(0, directionRandomizer);
110
+ const randZ = RandomRange(0, directionRandomizer);
111
+ direction.x += randX;
112
+ direction.y += randY;
113
+ direction.z += randZ;
114
+ direction.normalize();
115
+ if (system.isLocal) {
116
+ particle.direction.copyFromFloats(direction.x, direction.y, direction.z);
117
+ }
118
+ else {
119
+ Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix, particle.direction);
120
+ }
100
121
  }
101
122
  else {
102
- Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix, particle.direction);
123
+ const direction1 = this.direction1.getConnectedValue(state);
124
+ const direction2 = this.direction2.getConnectedValue(state);
125
+ const randX = RandomRange(direction1.x, direction2.x);
126
+ const randY = RandomRange(direction1.y, direction2.y);
127
+ const randZ = RandomRange(direction1.z, direction2.z);
128
+ if (system.isLocal) {
129
+ particle.direction.copyFromFloats(randX, randY, randZ);
130
+ }
131
+ else {
132
+ Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.direction);
133
+ }
103
134
  }
104
135
  particle._initialDirection = particle.direction.clone();
105
136
  };
@@ -1 +1 @@
1
- {"version":3,"file":"coneShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/coneShapeBlock.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,OAAO,EAAE,yCAA+B;AACjD,OAAO,EAAE,sBAAsB,EAA0B,gDAAsC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAOjD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAXhB;;WAEG;QAEI,2BAAsB,GAAG,KAAK,CAAC;QASlC,IAAI,CAAC,aAAa,CAAC,UA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vKU;IADN,sBAAsB,CAAC,4BAA4B,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC7G;AAyK1C,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import type { IShapeBlock } from \"./IShapeBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\n\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { _CreateLocalPositionData } from \"./emitters.functions\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a cone shape.\r\n */\r\nexport class ConeShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Gets or sets a boolean indicating if the system should emit only from the spawn point\r\n */\r\n @editableInPropertyPage(\"Emit from spawn point only\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public emitFromSpawnPointOnly = false;\r\n\r\n /**\r\n * Create a new ConeShapeBlock\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(\"radius\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, Math.PI);\r\n this.registerInput(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"heightRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\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 \"ConeShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 radius input component\r\n */\r\n public get radius(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the angle input component\r\n */\r\n public get angle(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the radiusRange input component\r\n */\r\n public get radiusRange(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the heightRange input component\r\n */\r\n public get heightRange(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the directionRandomizer input component\r\n */\r\n public get directionRandomizer(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\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 * Builds the block\r\n * @param state defines the build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state);\r\n\r\n system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n const directionRandomizer = this.directionRandomizer.getConnectedValue(state) as number;\r\n\r\n const direction = particle.position.subtract(state.emitterPosition!).normalize();\r\n const randX = RandomRange(0, directionRandomizer);\r\n const randY = RandomRange(0, directionRandomizer);\r\n const randZ = RandomRange(0, directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(direction.x, direction.y, direction.z);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n\r\n particle._initialDirection = particle.direction.clone();\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n // Connected values\r\n const radius = this.radius.getConnectedValue(state) as number;\r\n const angle = this.angle.getConnectedValue(state) as number;\r\n const radiusRange = this.radiusRange.getConnectedValue(state) as number;\r\n const heightRange = this.heightRange.getConnectedValue(state) as number;\r\n\r\n // Calculate position creation logic\r\n let h: number;\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = RandomRange(0, heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n } else {\r\n h = 0.0001;\r\n }\r\n\r\n let newRadius = radius - RandomRange(0, radius * radiusRange);\r\n newRadius = newRadius * h;\r\n const s = RandomRange(0, Math.PI * 2);\r\n\r\n const randX = newRadius * Math.sin(s);\r\n const randZ = newRadius * Math.cos(s);\r\n const randY = h * this._calculateHeight(angle, radius);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n\r\n _CreateLocalPositionData(particle);\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n private _calculateHeight(angle: number, radius: number): number {\r\n if (angle !== 0) {\r\n return radius / Math.tan(angle / 2);\r\n } else {\r\n return 1;\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.emitFromSpawnPointOnly = this.emitFromSpawnPointOnly;\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.emitFromSpawnPointOnly = serializationObject.emitFromSpawnPointOnly;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConeShapeBlock\", ConeShapeBlock);\r\n"]}
1
+ {"version":3,"file":"coneShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/coneShapeBlock.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,OAAO,EAAE,yCAA+B;AACjD,OAAO,EAAE,sBAAsB,EAA0B,gDAAsC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAQjD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,2BAAsB,GAAG,KAAK,CAAC;QASlC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnF,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CA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C1D,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnH,CAAC;YAED,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;IAEO,gBAAgB,CAAC,KAAa,EAAE,MAAc;QAClD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACd,OAAO,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,CAAC;QACb,CAAC;IACL,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAEzE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,sBAAsB,GAAG,mBAAmB,CAAC,sBAAsB,CAAC;IAC7E,CAAC;CACJ;AAvMU;IADN,sBAAsB,CAAC,4BAA4B,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC7G;AAyM1C,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import type { IShapeBlock } from \"./IShapeBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\n\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { _CreateLocalPositionData } from \"./emitters.functions\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a cone shape.\r\n */\r\nexport class ConeShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Gets or sets a boolean indicating if the system should emit only from the spawn point\r\n * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.\r\n */\r\n @editableInPropertyPage(\"Emit from spawn point only\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public emitFromSpawnPointOnly = false;\r\n\r\n /**\r\n * Create a new ConeShapeBlock\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(\"radius\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, Math.PI);\r\n this.registerInput(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"heightRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true);\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\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 \"ConeShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 radius input component\r\n */\r\n public get radius(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the angle input component\r\n */\r\n public get angle(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the radiusRange input component\r\n */\r\n public get radiusRange(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the heightRange input component\r\n */\r\n public get heightRange(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the directionRandomizer input component\r\n */\r\n public get directionRandomizer(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the direction1 input component\r\n */\r\n public get direction1(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the direction2 input component\r\n */\r\n public get direction2(): NodeParticleConnectionPoint {\r\n return this._inputs[7];\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 * Builds the block\r\n * @param state defines the build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state);\r\n\r\n system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n // We always use directionRandomizer unless both directions are connected\r\n if (this.direction1.isConnected === false || this.direction2.isConnected === false) {\r\n const directionRandomizer = this.directionRandomizer.getConnectedValue(state) as number;\r\n\r\n const direction = particle.position.subtract(state.emitterPosition!).normalize();\r\n const randX = RandomRange(0, directionRandomizer);\r\n const randY = RandomRange(0, directionRandomizer);\r\n const randZ = RandomRange(0, directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(direction.x, direction.y, direction.z);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n } else {\r\n const direction1 = this.direction1.getConnectedValue(state) as Vector3;\r\n const direction2 = this.direction2.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(direction1.x, direction2.x);\r\n const randY = RandomRange(direction1.y, direction2.y);\r\n const randZ = RandomRange(direction1.z, direction2.z);\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n }\r\n\r\n particle._initialDirection = particle.direction.clone();\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n // Connected values\r\n const radius = this.radius.getConnectedValue(state) as number;\r\n const angle = this.angle.getConnectedValue(state) as number;\r\n const radiusRange = this.radiusRange.getConnectedValue(state) as number;\r\n const heightRange = this.heightRange.getConnectedValue(state) as number;\r\n\r\n // Calculate position creation logic\r\n let h: number;\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = RandomRange(0, heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n } else {\r\n h = 0.0001;\r\n }\r\n\r\n let newRadius = radius - RandomRange(0, radius * radiusRange);\r\n newRadius = newRadius * h;\r\n const s = RandomRange(0, Math.PI * 2);\r\n\r\n const randX = newRadius * Math.sin(s);\r\n const randZ = newRadius * Math.cos(s);\r\n const randY = h * this._calculateHeight(angle, radius);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n\r\n _CreateLocalPositionData(particle);\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n private _calculateHeight(angle: number, radius: number): number {\r\n if (angle !== 0) {\r\n return radius / Math.tan(angle / 2);\r\n } else {\r\n return 1;\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.emitFromSpawnPointOnly = this.emitFromSpawnPointOnly;\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.emitFromSpawnPointOnly = serializationObject.emitFromSpawnPointOnly;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConeShapeBlock\", ConeShapeBlock);\r\n"]}
@@ -6,7 +6,7 @@ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
6
6
  */
7
7
  export declare class BasicColorUpdateBlock extends NodeParticleBlock {
8
8
  /**
9
- * Create a new UpdateScaleBlock
9
+ * Create a new BasicColorUpdateBlock
10
10
  * @param name defines the block name
11
11
  */
12
12
  constructor(name: string);
@@ -7,7 +7,7 @@ import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
7
7
  */
8
8
  export class BasicColorUpdateBlock extends NodeParticleBlock {
9
9
  /**
10
- * Create a new UpdateScaleBlock
10
+ * Create a new BasicColorUpdateBlock
11
11
  * @param name defines the block name
12
12
  */
13
13
  constructor(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"basicColorUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicColorUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK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AY,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,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particle colors.\r\n */\r\nexport class BasicColorUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateScaleBlock\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.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 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 \"BasicColorUpdateBlock\";\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 processColor = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n particle.colorStep.scaleToRef(system._scaledUpdateSpeed, system._scaledColorStep);\r\n particle.color.addInPlace(system._scaledColorStep);\r\n\r\n if (particle.color.a < 0) {\r\n particle.color.a = 0;\r\n }\r\n };\r\n\r\n const colorProcessing = {\r\n process: processColor,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(colorProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = colorProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicColorUpdateBlock\", BasicColorUpdateBlock);\r\n"]}
1
+ {"version":3,"file":"basicColorUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicColorUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IACxD;;;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,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED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BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particle colors.\r\n */\r\nexport class BasicColorUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new BasicColorUpdateBlock\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.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 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 \"BasicColorUpdateBlock\";\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 processColor = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n particle.colorStep.scaleToRef(system._scaledUpdateSpeed, system._scaledColorStep);\r\n particle.color.addInPlace(system._scaledColorStep);\r\n\r\n if (particle.color.a < 0) {\r\n particle.color.a = 0;\r\n }\r\n };\r\n\r\n const colorProcessing = {\r\n process: processColor,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(colorProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = colorProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicColorUpdateBlock\", BasicColorUpdateBlock);\r\n"]}
@@ -6,7 +6,7 @@ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
6
6
  */
7
7
  export declare class BasicPositionUpdateBlock extends NodeParticleBlock {
8
8
  /**
9
- * Create a new UpdateScaleBlock
9
+ * Create a new BasicPositionUpdateBlock
10
10
  * @param name defines the block name
11
11
  */
12
12
  constructor(name: string);
@@ -7,7 +7,7 @@ import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
7
7
  */
8
8
  export class BasicPositionUpdateBlock extends NodeParticleBlock {
9
9
  /**
10
- * Create a new UpdateScaleBlock
10
+ * Create a new BasicPositionUpdateBlock
11
11
  * @param name defines the block name
12
12
  */
13
13
  constructor(name) {
@@ -43,8 +43,8 @@ export class BasicPositionUpdateBlock extends NodeParticleBlock {
43
43
  const processPosition = (particle) => {
44
44
  state.particleContext = particle;
45
45
  state.systemContext = system;
46
- particle.direction.scaleToRef(system._directionScale, system._scaledDirection);
47
- particle.position.addInPlace(system._scaledDirection);
46
+ particle.direction.scaleToRef(particle._directionScale, particle._scaledDirection);
47
+ particle.position.addInPlace(particle._scaledDirection);
48
48
  };
49
49
  const positionProcessing = {
50
50
  process: processPosition,
@@ -1 +1 @@
1
- {"version":3,"file":"basicPositionUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicPositionUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAA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I,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,kBAAkB,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particles.\r\n */\r\nexport class BasicPositionUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateScaleBlock\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.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 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 \"BasicPositionUpdateBlock\";\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 processPosition = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.direction.scaleToRef(system._directionScale, system._scaledDirection);\r\n particle.position.addInPlace(system._scaledDirection);\r\n };\r\n\r\n const positionProcessing = {\r\n process: processPosition,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(positionProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = positionProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicPositionUpdateBlock\", BasicPositionUpdateBlock);\r\n"]}
1
+ {"version":3,"file":"basicPositionUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicPositionUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC3D;;;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,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,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,0BAA0B,CAAC;IACtC,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,KAA6B;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAuB,CAAC;QAE5E,MAAM,eAAe,GAAG,CAAC,QAAkB,EAAE,EAAE;YAC3C,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YACnF,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5D,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACvB,OAAO,EAAE,eAAe;YACxB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,kBAAkB,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particles.\r\n */\r\nexport class BasicPositionUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new BasicPositionUpdateBlock\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.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 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 \"BasicPositionUpdateBlock\";\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 processPosition = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.direction.scaleToRef(particle._directionScale, particle._scaledDirection);\r\n particle.position.addInPlace(particle._scaledDirection);\r\n };\r\n\r\n const positionProcessing = {\r\n process: processPosition,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(positionProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = positionProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicPositionUpdateBlock\", BasicPositionUpdateBlock);\r\n"]}
@@ -0,0 +1,35 @@
1
+ import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
2
+ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
3
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
+ /**
5
+ * Block used to update the size of a particle
6
+ */
7
+ export declare class UpdateSizeBlock extends NodeParticleBlock {
8
+ /**
9
+ * Create a new UpdateSizeBlock
10
+ * @param name defines the block name
11
+ */
12
+ constructor(name: string);
13
+ /**
14
+ * Gets the particle component
15
+ */
16
+ get particle(): NodeParticleConnectionPoint;
17
+ /**
18
+ * Gets the size input component
19
+ */
20
+ get size(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the output component
23
+ */
24
+ get output(): NodeParticleConnectionPoint;
25
+ /**
26
+ * Gets the current class name
27
+ * @returns the class name
28
+ */
29
+ getClassName(): string;
30
+ /**
31
+ * Builds the block
32
+ * @param state defines the current build state
33
+ */
34
+ _build(state: NodeParticleBuildState): void;
35
+ }
@@ -0,0 +1,73 @@
1
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
2
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
3
+ import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
4
+ import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
5
+ /**
6
+ * Block used to update the size of a particle
7
+ */
8
+ export class UpdateSizeBlock extends NodeParticleBlock {
9
+ /**
10
+ * Create a new UpdateSizeBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name) {
14
+ super(name);
15
+ this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
16
+ this.registerInput("size", NodeParticleBlockConnectionPointTypes.Float);
17
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
18
+ }
19
+ /**
20
+ * Gets the particle component
21
+ */
22
+ get particle() {
23
+ return this._inputs[0];
24
+ }
25
+ /**
26
+ * Gets the size input component
27
+ */
28
+ get size() {
29
+ return this._inputs[1];
30
+ }
31
+ /**
32
+ * Gets the output component
33
+ */
34
+ get output() {
35
+ return this._outputs[0];
36
+ }
37
+ /**
38
+ * Gets the current class name
39
+ * @returns the class name
40
+ */
41
+ getClassName() {
42
+ return "UpdateSizeBlock";
43
+ }
44
+ /**
45
+ * Builds the block
46
+ * @param state defines the current build state
47
+ */
48
+ _build(state) {
49
+ const system = this.particle.getConnectedValue(state);
50
+ this.output._storedValue = system;
51
+ if (!this.size.isConnected) {
52
+ return;
53
+ }
54
+ const processSize = (particle) => {
55
+ state.particleContext = particle;
56
+ state.systemContext = system;
57
+ particle.size = this.size.getConnectedValue(state);
58
+ };
59
+ const sizeProcessing = {
60
+ process: processSize,
61
+ previousItem: null,
62
+ nextItem: null,
63
+ };
64
+ if (system._updateQueueStart) {
65
+ _ConnectAtTheEnd(sizeProcessing, system._updateQueueStart);
66
+ }
67
+ else {
68
+ system._updateQueueStart = sizeProcessing;
69
+ }
70
+ }
71
+ }
72
+ RegisterClass("BABYLON.UpdateSizeBlock", UpdateSizeBlock);
73
+ //# sourceMappingURL=updateSizeBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateSizeBlock.ts"],"names":[],"mappings":"AAKA,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,eAAgB,SAAQ,iBAAiB;IAClD;;;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,MAAM,EAAE,qCAAqC,CAAC,KAAK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AAc,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import 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\n\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 the size of a particle\r\n */\r\nexport class UpdateSizeBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateSizeBlock\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(\"size\", NodeParticleBlockConnectionPointTypes.Float);\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 size input component\r\n */\r\n public get size(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateSizeBlock\";\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 this.output._storedValue = system;\r\n\r\n if (!this.size.isConnected) {\r\n return;\r\n }\r\n\r\n const processSize = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.size = this.size.getConnectedValue(state) as number;\r\n };\r\n\r\n const sizeProcessing = {\r\n process: processSize,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(sizeProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = sizeProcessing;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateSizeBlock\", UpdateSizeBlock);\r\n"]}
@@ -7,6 +7,7 @@ export * from "./Update/updateDirectionBlock.js";
7
7
  export * from "./Update/updatePositionBlock.js";
8
8
  export * from "./Update/updateColorBlock.js";
9
9
  export * from "./Update/updateScaleBlock.js";
10
+ export * from "./Update/updateSizeBlock.js";
10
11
  export * from "./Update/updateAngleBlock.js";
11
12
  export * from "./Update/updateAgeBlock.js";
12
13
  export * from "./Update/basicPositionUpdateBlock.js";
@@ -8,6 +8,7 @@ export * from "./Update/updateDirectionBlock.js";
8
8
  export * from "./Update/updatePositionBlock.js";
9
9
  export * from "./Update/updateColorBlock.js";
10
10
  export * from "./Update/updateScaleBlock.js";
11
+ export * from "./Update/updateSizeBlock.js";
11
12
  export * from "./Update/updateAngleBlock.js";
12
13
  export * from "./Update/updateAgeBlock.js";
13
14
  export * from "./Update/basicPositionUpdateBlock.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
@@ -108,6 +108,8 @@ export class ParticleInputBlock extends NodeParticleBlock {
108
108
  case NodeParticleContextualSources.Lifetime:
109
109
  case NodeParticleContextualSources.Angle:
110
110
  case NodeParticleContextualSources.AgeGradient:
111
+ case NodeParticleContextualSources.Size:
112
+ case NodeParticleContextualSources.DirectionScale:
111
113
  this._type = NodeParticleBlockConnectionPointTypes.Float;
112
114
  break;
113
115
  case NodeParticleContextualSources.SpriteCellEnd: