@babylonjs/core 8.34.1 → 8.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/Audio/audioSceneComponent.d.ts +9 -5
  2. package/Audio/audioSceneComponent.js +1 -0
  3. package/Audio/audioSceneComponent.js.map +1 -1
  4. package/AudioV2/abstractAudio/audioEngineV2.d.ts +10 -0
  5. package/AudioV2/abstractAudio/audioEngineV2.js +29 -0
  6. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  7. package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
  8. package/AudioV2/webAudio/webAudioEngine.js +8 -0
  9. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  10. package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
  11. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  12. package/AudioV2/webAudio/webAudioStreamingSound.js +2 -2
  13. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  14. package/Cameras/camera.d.ts +4 -0
  15. package/Cameras/camera.js +18 -9
  16. package/Cameras/camera.js.map +1 -1
  17. package/Engines/abstractEngine.js +2 -2
  18. package/Engines/abstractEngine.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
  20. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  21. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  23. package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
  24. package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
  25. package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
  26. package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
  27. package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
  28. package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  30. package/FrameGraph/Node/Blocks/index.js +1 -0
  31. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  33. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  34. package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
  35. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
  36. package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
  37. package/FrameGraph/Node/nodeRenderGraph.js +7 -3
  38. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  39. package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
  40. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  41. package/FrameGraph/Passes/pass.d.ts +11 -1
  42. package/FrameGraph/Passes/pass.js +11 -1
  43. package/FrameGraph/Passes/pass.js.map +1 -1
  44. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
  45. package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
  46. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
  47. package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
  48. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  49. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  50. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
  51. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
  52. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  53. package/FrameGraph/frameGraph.d.ts +1 -1
  54. package/FrameGraph/frameGraph.js +3 -6
  55. package/FrameGraph/frameGraph.js.map +1 -1
  56. package/FrameGraph/frameGraphTask.d.ts +3 -2
  57. package/FrameGraph/frameGraphTask.js +5 -2
  58. package/FrameGraph/frameGraphTask.js.map +1 -1
  59. package/FrameGraph/frameGraphTextureManager.js +2 -2
  60. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  61. package/FrameGraph/index.d.ts +1 -0
  62. package/FrameGraph/index.js +1 -0
  63. package/FrameGraph/index.js.map +1 -1
  64. package/Lights/directionalLight.js +1 -4
  65. package/Lights/directionalLight.js.map +1 -1
  66. package/Lights/pointLight.js +2 -5
  67. package/Lights/pointLight.js.map +1 -1
  68. package/Materials/clipPlaneMaterialHelper.js +11 -1
  69. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  70. package/Materials/floatingOriginMatrixOverrides.d.ts +4 -1
  71. package/Materials/floatingOriginMatrixOverrides.js +14 -2
  72. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  73. package/Materials/index.d.ts +1 -0
  74. package/Materials/index.js +1 -0
  75. package/Materials/index.js.map +1 -1
  76. package/Maths/math.like.d.ts +7 -2
  77. package/Maths/math.like.js.map +1 -1
  78. package/Maths/math.vector.functions.d.ts +57 -15
  79. package/Maths/math.vector.functions.js +77 -8
  80. package/Maths/math.vector.functions.js.map +1 -1
  81. package/Misc/decorators.d.ts +1 -1
  82. package/Misc/decorators.js.map +1 -1
  83. package/Misc/dumpTools.d.ts +20 -0
  84. package/Misc/dumpTools.js +60 -49
  85. package/Misc/dumpTools.js.map +1 -1
  86. package/Misc/index.d.ts +1 -2
  87. package/Misc/index.js +1 -2
  88. package/Misc/index.js.map +1 -1
  89. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +7 -7
  90. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  91. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +8 -0
  92. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +25 -2
  93. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  94. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +7 -7
  95. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  96. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +8 -8
  97. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  98. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +9 -9
  99. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  100. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +6 -6
  101. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  102. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +7 -7
  103. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  104. package/Particles/Node/Blocks/systemBlock.d.ts +32 -0
  105. package/Particles/Node/Blocks/systemBlock.js +76 -0
  106. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  107. package/Particles/Node/nodeParticleBuildState.d.ts +2 -7
  108. package/Particles/Node/nodeParticleBuildState.js +7 -22
  109. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  110. package/Particles/Node/nodeParticleSystemSet.helper.js +164 -56
  111. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  112. package/Particles/thinParticleSystem.js +1 -0
  113. package/Particles/thinParticleSystem.js.map +1 -1
  114. package/Physics/physicsRaycastResult.d.ts +3 -0
  115. package/Physics/physicsRaycastResult.js.map +1 -1
  116. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  117. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  118. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
  119. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  120. package/PostProcesses/thinSSAO2PostProcess.js +9 -2
  121. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  122. package/package.json +1 -1
  123. package/scene.d.ts +7 -2
  124. package/scene.js +15 -8
  125. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dumpTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/dumpTools.ts"],"names":[],"mappings":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./devTools\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Tools } from \"./tools\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\n\r\ntype DumpResources = {\r\n canvas: HTMLCanvasElement | OffscreenCanvas;\r\n dumpEngine?: {\r\n engine: ThinEngine;\r\n renderer: EffectRenderer;\r\n wrapper: EffectWrapper;\r\n };\r\n};\r\n\r\nlet ResourcesPromise: Promise<DumpResources> | null = null;\r\n\r\nasync function _CreateDumpResourcesAsync(): Promise<DumpResources> {\r\n // Create a compatible canvas. Prefer an HTMLCanvasElement if possible to avoid alpha issues with OffscreenCanvas + WebGL in many browsers.\r\n const canvas = (EngineStore.LastCreatedEngine?.createCanvas(100, 100) ?? new OffscreenCanvas(100, 100)) as HTMLCanvasElement | OffscreenCanvas; // will be resized later\r\n if (canvas instanceof OffscreenCanvas) {\r\n Logger.Warn(\"DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.\");\r\n }\r\n\r\n // If WebGL via ThinEngine is not available (e.g. Native), use the BitmapRenderer.\r\n // If https://github.com/whatwg/html/issues/10142 is resolved, we can migrate to just BitmapRenderer and avoid an engine dependency altogether.\r\n const { ThinEngine: thinEngineClass } = await import(\"../Engines/thinEngine\");\r\n if (!thinEngineClass.IsSupported) {\r\n if (!canvas.getContext(\"bitmaprenderer\")) {\r\n throw new Error(\"DumpData: No WebGL or bitmap rendering context available. Cannot dump data.\");\r\n }\r\n return { canvas };\r\n }\r\n\r\n const options = {\r\n preserveDrawingBuffer: true,\r\n depth: false,\r\n stencil: false,\r\n alpha: true,\r\n premultipliedAlpha: false,\r\n antialias: false,\r\n failIfMajorPerformanceCaveat: false,\r\n };\r\n const engine = new thinEngineClass(canvas, false, options);\r\n\r\n // remove this engine from the list of instances to avoid using it for other purposes\r\n EngineStore.Instances.pop();\r\n // However, make sure to dispose it when no other engines are left\r\n EngineStore.OnEnginesDisposedObservable.add((e) => {\r\n // guaranteed to run when no other instances are left\r\n // only dispose if it's not the current engine\r\n if (engine && e !== engine && !engine.isDisposed && EngineStore.Instances.length === 0) {\r\n // Dump the engine and the associated resources\r\n Dispose();\r\n }\r\n });\r\n\r\n engine.getCaps().parallelShaderCompile = undefined;\r\n\r\n const renderer = new EffectRenderer(engine);\r\n const { passPixelShader } = await import(\"../Shaders/pass.fragment\");\r\n const wrapper = new EffectWrapper({\r\n engine,\r\n name: passPixelShader.name,\r\n fragmentShader: passPixelShader.shader,\r\n samplerNames: [\"textureSampler\"],\r\n });\r\n\r\n return {\r\n canvas: canvas,\r\n dumpEngine: { engine, renderer, wrapper },\r\n };\r\n}\r\n\r\nasync function _GetDumpResourcesAsync() {\r\n if (!ResourcesPromise) {\r\n ResourcesPromise = _CreateDumpResourcesAsync();\r\n }\r\n return await ResourcesPromise;\r\n}\r\n\r\n/**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a void promise\r\n */\r\n// Should have \"Async\" in the name but this is a public API and we can't break it now\r\n// eslint-disable-next-line no-restricted-syntax\r\nexport async function DumpFramebuffer(\r\n width: number,\r\n height: number,\r\n engine: AbstractEngine,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n quality?: number\r\n) {\r\n // Read the contents of the framebuffer\r\n const bufferView = await engine.readPixels(0, 0, width, height);\r\n\r\n const data = new Uint8Array(bufferView.buffer);\r\n\r\n DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n}\r\n\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType: string | undefined,\r\n fileName: string | undefined,\r\n invertY: boolean | undefined,\r\n toArrayBuffer: true,\r\n quality?: number\r\n): Promise<ArrayBuffer>;\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType?: string,\r\n fileName?: string,\r\n invertY?: boolean,\r\n toArrayBuffer?: boolean,\r\n quality?: number\r\n): Promise<string>;\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolve to the final data\r\n */\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): Promise<string | ArrayBuffer> {\r\n // Convert if data are float32\r\n if (data instanceof Float32Array) {\r\n const data2 = new Uint8Array(data.length);\r\n let n = data.length;\r\n while (n--) {\r\n const v = data[n];\r\n data2[n] = Math.round(Clamp(v) * 255);\r\n }\r\n data = data2;\r\n }\r\n\r\n const resources = await _GetDumpResourcesAsync();\r\n\r\n // Keep the async render + read from the shared canvas atomic\r\n // eslint-disable-next-line no-async-promise-executor\r\n return await new Promise<string | ArrayBuffer>(async (resolve) => {\r\n if (resources.dumpEngine) {\r\n const dumpEngine = resources.dumpEngine;\r\n dumpEngine.engine.setSize(width, height, true);\r\n\r\n // Create the image\r\n const texture = dumpEngine.engine.createRawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, false, !invertY, Constants.TEXTURE_NEAREST_NEAREST);\r\n\r\n dumpEngine.renderer.setViewport();\r\n dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);\r\n dumpEngine.wrapper.effect._bindTexture(\"textureSampler\", texture);\r\n dumpEngine.renderer.draw();\r\n\r\n texture.dispose();\r\n } else {\r\n const ctx = resources.canvas.getContext(\"bitmaprenderer\") as ImageBitmapRenderingContext;\r\n resources.canvas.width = width;\r\n resources.canvas.height = height;\r\n\r\n const imageData = new ImageData(width, height); // ImageData(data, sw, sh) ctor not yet widely implemented\r\n imageData.data.set(data as Uint8ClampedArray);\r\n const imageBitmap = await createImageBitmap(imageData, { premultiplyAlpha: \"none\", imageOrientation: invertY ? \"flipY\" : \"from-image\" });\r\n\r\n ctx.transferFromImageBitmap(imageBitmap);\r\n }\r\n\r\n Tools.ToBlob(\r\n resources.canvas,\r\n (blob) => {\r\n if (!blob) {\r\n throw new Error(\"DumpData: Failed to convert canvas to blob.\");\r\n }\r\n\r\n if (fileName !== undefined) {\r\n Tools.DownloadBlob(blob, fileName);\r\n }\r\n\r\n const fileReader = new FileReader();\r\n fileReader.onload = (event: any) => {\r\n const result = event.target!.result as string | ArrayBuffer;\r\n resolve(result);\r\n };\r\n\r\n if (toArrayBuffer) {\r\n fileReader.readAsArrayBuffer(blob);\r\n } else {\r\n fileReader.readAsDataURL(blob);\r\n }\r\n },\r\n mimeType,\r\n quality\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName The name of the file to download. If present, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function DumpData(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n successCallback?: (data: string | ArrayBuffer) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): void {\r\n // For back-compat: if no fileName and no callback, force download the result\r\n if (fileName === undefined && !successCallback) {\r\n fileName = \"\";\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n DumpDataAsync(width, height, data, mimeType, fileName, invertY, toArrayBuffer, quality)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n if (successCallback) {\r\n successCallback(result);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Dispose the dump tools associated resources\r\n */\r\nexport function Dispose() {\r\n if (!ResourcesPromise) {\r\n return;\r\n }\r\n\r\n // in cases where the engine is not yet created, we need to wait for it to dispose it\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n ResourcesPromise?.then((resources) => {\r\n if (resources.canvas instanceof HTMLCanvasElement) {\r\n resources.canvas.remove();\r\n }\r\n if (resources.dumpEngine) {\r\n resources.dumpEngine.engine.dispose();\r\n resources.dumpEngine.renderer.dispose();\r\n resources.dumpEngine.wrapper.dispose();\r\n }\r\n });\r\n\r\n ResourcesPromise = null;\r\n}\r\n\r\n/**\r\n * Object containing a set of static utilities functions to dump data from a canvas\r\n * @deprecated use functions\r\n */\r\nexport const DumpTools = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpData,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpDataAsync,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpFramebuffer,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Dispose,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst InitSideEffects = () => {\r\n // References the dependencies.\r\n Tools.DumpData = DumpData;\r\n Tools.DumpDataAsync = DumpDataAsync;\r\n Tools.DumpFramebuffer = DumpFramebuffer;\r\n};\r\n\r\nInitSideEffects();\r\n"]}
1
+ {"version":3,"file":"dumpTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/dumpTools.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAW9C,IAAI,gBAAgB,GAAkC,IAAI,CAAC;AAE3D,KAAK,UAAU,yBAAyB;IACpC,2IAA2I;IAC3I,MAAM,MAAM,GAAG,CAAC,WAAW,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,IAAI,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAwC,CAAC,CAAC,wBAAwB;IACxK,IAAI,MAAM,YAAY,eA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ChE,OAAO;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,+BAA+B;IAC/B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Tools } from \"./tools\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { nativeOverride } from \"./decorators\";\r\n\r\ntype DumpResources = {\r\n canvas: HTMLCanvasElement | OffscreenCanvas;\r\n dumpEngine: {\r\n engine: ThinEngine;\r\n renderer: EffectRenderer;\r\n wrapper: EffectWrapper;\r\n };\r\n};\r\n\r\nlet ResourcesPromise: Promise<DumpResources> | null = null;\r\n\r\nasync function _CreateDumpResourcesAsync(): Promise<DumpResources> {\r\n // Create a compatible canvas. Prefer an HTMLCanvasElement if possible to avoid alpha issues with OffscreenCanvas + WebGL in many browsers.\r\n const canvas = (EngineStore.LastCreatedEngine?.createCanvas(100, 100) ?? new OffscreenCanvas(100, 100)) as HTMLCanvasElement | OffscreenCanvas; // will be resized later\r\n if (canvas instanceof OffscreenCanvas) {\r\n Logger.Warn(\"DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.\");\r\n }\r\n\r\n // If WebGL via ThinEngine is not available, we cannot encode the data.\r\n // If https://github.com/whatwg/html/issues/10142 is resolved, we can migrate to just BitmapRenderer and avoid an engine dependency altogether.\r\n const { ThinEngine: thinEngineClass } = await import(\"../Engines/thinEngine\");\r\n if (!thinEngineClass.IsSupported) {\r\n throw new Error(\"DumpData: No WebGL context available. Cannot dump data.\");\r\n }\r\n\r\n const options = {\r\n preserveDrawingBuffer: true,\r\n depth: false,\r\n stencil: false,\r\n alpha: true,\r\n premultipliedAlpha: false,\r\n antialias: false,\r\n failIfMajorPerformanceCaveat: false,\r\n };\r\n const engine = new thinEngineClass(canvas, false, options);\r\n\r\n // remove this engine from the list of instances to avoid using it for other purposes\r\n EngineStore.Instances.pop();\r\n // However, make sure to dispose it when no other engines are left\r\n EngineStore.OnEnginesDisposedObservable.add((e) => {\r\n // guaranteed to run when no other instances are left\r\n // only dispose if it's not the current engine\r\n if (engine && e !== engine && !engine.isDisposed && EngineStore.Instances.length === 0) {\r\n // Dump the engine and the associated resources\r\n Dispose();\r\n }\r\n });\r\n\r\n engine.getCaps().parallelShaderCompile = undefined;\r\n\r\n const renderer = new EffectRenderer(engine);\r\n const { passPixelShader } = await import(\"../Shaders/pass.fragment\");\r\n const wrapper = new EffectWrapper({\r\n engine,\r\n name: passPixelShader.name,\r\n fragmentShader: passPixelShader.shader,\r\n samplerNames: [\"textureSampler\"],\r\n });\r\n\r\n return {\r\n canvas: canvas,\r\n dumpEngine: { engine, renderer, wrapper },\r\n };\r\n}\r\n\r\nasync function _GetDumpResourcesAsync() {\r\n if (!ResourcesPromise) {\r\n ResourcesPromise = _CreateDumpResourcesAsync();\r\n }\r\n return await ResourcesPromise;\r\n}\r\n\r\nclass EncodingHelper {\r\n /**\r\n * Encodes image data to the given mime type.\r\n * This is put into a helper class so we can apply the nativeOverride decorator to it.\r\n * @internal\r\n */\r\n @nativeOverride\r\n public static async EncodeImageAsync(pixelData: ArrayBufferView, width: number, height: number, mimeType?: string, invertY?: boolean, quality?: number): Promise<Blob> {\r\n const resources = await _GetDumpResourcesAsync();\r\n\r\n const dumpEngine = resources.dumpEngine;\r\n dumpEngine.engine.setSize(width, height, true);\r\n\r\n // Create the image\r\n const texture = dumpEngine.engine.createRawTexture(pixelData, width, height, Constants.TEXTUREFORMAT_RGBA, false, !invertY, Constants.TEXTURE_NEAREST_NEAREST);\r\n\r\n dumpEngine.renderer.setViewport();\r\n dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);\r\n dumpEngine.wrapper.effect._bindTexture(\"textureSampler\", texture);\r\n dumpEngine.renderer.draw();\r\n\r\n texture.dispose();\r\n\r\n return await new Promise<Blob>((resolve, reject) => {\r\n Tools.ToBlob(\r\n resources.canvas,\r\n (blob) => {\r\n if (!blob) {\r\n reject(new Error(\"EncodeImageAsync: Failed to convert canvas to blob.\"));\r\n } else {\r\n resolve(blob);\r\n }\r\n },\r\n mimeType,\r\n quality\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Encodes pixel data to an image\r\n * @param pixelData 8-bit RGBA pixel data\r\n * @param width the width of the image\r\n * @param height the height of the image\r\n * @param mimeType the requested MIME type\r\n * @param invertY true to invert the image in the Y direction\r\n * @param quality the quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolves to the encoded image data. Note that the `blob.type` may differ from `mimeType` if it was not supported.\r\n */\r\nexport const EncodeImageAsync = EncodingHelper.EncodeImageAsync;\r\n\r\n/**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a void promise\r\n */\r\n// Should have \"Async\" in the name but this is a public API and we can't break it now\r\n// eslint-disable-next-line no-restricted-syntax\r\nexport async function DumpFramebuffer(\r\n width: number,\r\n height: number,\r\n engine: AbstractEngine,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n quality?: number\r\n) {\r\n // Read the contents of the framebuffer\r\n const bufferView = await engine.readPixels(0, 0, width, height);\r\n\r\n const data = new Uint8Array(bufferView.buffer);\r\n\r\n DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n}\r\n\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType: string | undefined,\r\n fileName: string | undefined,\r\n invertY: boolean | undefined,\r\n toArrayBuffer: true,\r\n quality?: number\r\n): Promise<ArrayBuffer>;\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType?: string,\r\n fileName?: string,\r\n invertY?: boolean,\r\n toArrayBuffer?: boolean,\r\n quality?: number\r\n): Promise<string>;\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolve to the final data\r\n */\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): Promise<string | ArrayBuffer> {\r\n // Convert if data are float32\r\n if (data instanceof Float32Array) {\r\n const data2 = new Uint8Array(data.length);\r\n let n = data.length;\r\n while (n--) {\r\n const v = data[n];\r\n data2[n] = Math.round(Clamp(v) * 255);\r\n }\r\n data = data2;\r\n }\r\n\r\n const blob = await EncodingHelper.EncodeImageAsync(data, width, height, mimeType, invertY, quality);\r\n\r\n if (fileName !== undefined) {\r\n Tools.DownloadBlob(blob, fileName);\r\n }\r\n\r\n if (blob.type !== mimeType) {\r\n Logger.Warn(`DumpData: The requested mimeType '${mimeType}' is not supported. The result has mimeType '${blob.type}' instead.`);\r\n }\r\n\r\n const buffer = await blob.arrayBuffer();\r\n\r\n if (toArrayBuffer) {\r\n return buffer;\r\n }\r\n\r\n return `data:${mimeType};base64,${EncodeArrayBufferToBase64(buffer)}`;\r\n}\r\n\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName The name of the file to download. If present, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function DumpData(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n successCallback?: (data: string | ArrayBuffer) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): void {\r\n // For back-compat: if no fileName and no callback, force download the result\r\n if (fileName === undefined && !successCallback) {\r\n fileName = \"\";\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n DumpDataAsync(width, height, data, mimeType, fileName, invertY, toArrayBuffer, quality)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n if (successCallback) {\r\n successCallback(result);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Dispose the dump tools associated resources\r\n */\r\nexport function Dispose() {\r\n if (!ResourcesPromise) {\r\n return;\r\n }\r\n\r\n // in cases where the engine is not yet created, we need to wait for it to dispose it\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n ResourcesPromise?.then((resources) => {\r\n if (resources.canvas instanceof HTMLCanvasElement) {\r\n resources.canvas.remove();\r\n }\r\n if (resources.dumpEngine) {\r\n resources.dumpEngine.engine.dispose();\r\n resources.dumpEngine.renderer.dispose();\r\n resources.dumpEngine.wrapper.dispose();\r\n }\r\n });\r\n\r\n ResourcesPromise = null;\r\n}\r\n\r\n/**\r\n * Object containing a set of static utilities functions to dump data from a canvas\r\n * @deprecated use functions\r\n */\r\nexport const DumpTools = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpData,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpDataAsync,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpFramebuffer,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Dispose,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst InitSideEffects = () => {\r\n // References the dependencies.\r\n Tools.DumpData = DumpData;\r\n Tools.DumpDataAsync = DumpDataAsync;\r\n Tools.DumpFramebuffer = DumpFramebuffer;\r\n};\r\n\r\nInitSideEffects();\r\n"]}
package/Misc/index.d.ts CHANGED
@@ -67,8 +67,7 @@ export * from "./error.js";
67
67
  export * from "./snapshotRenderingHelper.js";
68
68
  export * from "./observableCoroutine.js";
69
69
  export * from "./copyTextureToTexture.js";
70
- /** @deprecated Use individual exports */
71
- export { DumpTools } from "./dumpTools.js";
70
+ export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
72
71
  export * from "./greasedLineTools.js";
73
72
  export * from "./equirectangularCapture.js";
74
73
  export * from "./decorators.serialization.js";
package/Misc/index.js CHANGED
@@ -70,8 +70,7 @@ export * from "./snapshotRenderingHelper.js";
70
70
  // eslint-disable-next-line import/export
71
71
  export * from "./observableCoroutine.js";
72
72
  export * from "./copyTextureToTexture.js";
73
- /** @deprecated Use individual exports */
74
- export { DumpTools } from "./dumpTools.js";
73
+ export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
75
74
  export * from "./greasedLineTools.js";
76
75
  export * from "./equirectangularCapture.js";
77
76
  export * from "./decorators.serialization.js";
package/Misc/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,4BAA4B;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6B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,EAAE,MAAM,aAAa,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\n/** @deprecated Use individual exports */\r\nexport { DumpTools } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,4BAA4B;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,C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A0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}
@@ -77,11 +77,11 @@ export class BoxShapeBlock extends NodeParticleBlock {
77
77
  const randX = RandomRange(direction1.x, direction2.x);
78
78
  const randY = RandomRange(direction1.y, direction2.y);
79
79
  const randZ = RandomRange(direction1.z, direction2.z);
80
- if (state.isEmitterTransformNode) {
81
- Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.direction);
80
+ if (system.isLocal) {
81
+ particle.direction.copyFromFloats(randX, randY, randZ);
82
82
  }
83
83
  else {
84
- particle.direction.copyFromFloats(randX, randY, randZ);
84
+ Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.direction);
85
85
  }
86
86
  particle._initialDirection = particle.direction.clone();
87
87
  };
@@ -93,13 +93,13 @@ export class BoxShapeBlock extends NodeParticleBlock {
93
93
  const randX = RandomRange(minEmitBox.x, maxEmitBox.x);
94
94
  const randY = RandomRange(minEmitBox.y, maxEmitBox.y);
95
95
  const randZ = RandomRange(minEmitBox.z, maxEmitBox.z);
96
- if (state.isEmitterTransformNode) {
97
- Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.position);
98
- }
99
- else {
96
+ if (system.isLocal) {
100
97
  particle.position.copyFromFloats(randX, randY, randZ);
101
98
  particle.position.addInPlace(state.emitterPosition);
102
99
  }
100
+ else {
101
+ Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.position);
102
+ }
103
103
  };
104
104
  this.output._storedValue = system;
105
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"boxShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/boxShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAG/D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAA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ConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a box shape.\r\n */\r\nexport class BoxShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new BoxShapeBlock\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(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"minEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(-0.5, -0.5, -0.5));\r\n this.registerInput(\"maxEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0.5, 0.5, 0.5));\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 \"BoxShapeBlock\";\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 direction1 input component\r\n */\r\n public get direction1(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\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[2];\r\n }\r\n\r\n /**\r\n * Gets the minEmitBox input component\r\n */\r\n public get minEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the maxEmitBox input component\r\n */\r\n public get maxEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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 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 (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\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 const minEmitBox = this.minEmitBox.getConnectedValue(state) as Vector3;\r\n const maxEmitBox = this.maxEmitBox.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(minEmitBox.x, maxEmitBox.x);\r\n const randY = RandomRange(minEmitBox.y, maxEmitBox.y);\r\n const randZ = RandomRange(minEmitBox.z, maxEmitBox.z);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxShapeBlock\", BoxShapeBlock);\r\n"]}
1
+ {"version":3,"file":"boxShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/boxShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAG/D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;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,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrH,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,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AC;YAEtD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACtD,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,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;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a box shape.\r\n */\r\nexport class BoxShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new BoxShapeBlock\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(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"minEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(-0.5, -0.5, -0.5));\r\n this.registerInput(\"maxEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0.5, 0.5, 0.5));\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 \"BoxShapeBlock\";\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 direction1 input component\r\n */\r\n public get direction1(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\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[2];\r\n }\r\n\r\n /**\r\n * Gets the minEmitBox input component\r\n */\r\n public get minEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the maxEmitBox input component\r\n */\r\n public get maxEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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 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 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 const minEmitBox = this.minEmitBox.getConnectedValue(state) as Vector3;\r\n const maxEmitBox = this.maxEmitBox.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(minEmitBox.x, maxEmitBox.x);\r\n const randY = RandomRange(minEmitBox.y, maxEmitBox.y);\r\n const randZ = RandomRange(minEmitBox.z, maxEmitBox.z);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxShapeBlock\", BoxShapeBlock);\r\n"]}
@@ -39,6 +39,14 @@ export declare class CreateParticleBlock extends NodeParticleBlock {
39
39
  * Gets the angle input component
40
40
  */
41
41
  get angle(): NodeParticleConnectionPoint;
42
+ /**
43
+ * Gets the angular speed input component
44
+ */
45
+ get angularSpeed(): NodeParticleConnectionPoint;
46
+ /**
47
+ * Gets the size component
48
+ */
49
+ get size(): NodeParticleConnectionPoint;
42
50
  /**
43
51
  * Gets the particle output component
44
52
  */
@@ -22,6 +22,8 @@ export class CreateParticleBlock extends NodeParticleBlock {
22
22
  this.registerInput("colorDead", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(0, 0, 0, 0));
23
23
  this.registerInput("scale", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));
24
24
  this.registerInput("angle", NodeParticleBlockConnectionPointTypes.Float, true, 0);
25
+ this.registerInput("angularSpeed", NodeParticleBlockConnectionPointTypes.Float, true, 0);
26
+ this.registerInput("size", NodeParticleBlockConnectionPointTypes.Float, true, 0);
25
27
  this.registerOutput("particle", NodeParticleBlockConnectionPointTypes.Particle);
26
28
  this.scale.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
27
29
  }
@@ -68,6 +70,18 @@ export class CreateParticleBlock extends NodeParticleBlock {
68
70
  get angle() {
69
71
  return this._inputs[5];
70
72
  }
73
+ /**
74
+ * Gets the angular speed input component
75
+ */
76
+ get angularSpeed() {
77
+ return this._inputs[6];
78
+ }
79
+ /**
80
+ * Gets the size component
81
+ */
82
+ get size() {
83
+ return this._inputs[7];
84
+ }
71
85
  /**
72
86
  * Gets the particle output component
73
87
  */
@@ -88,7 +102,10 @@ export class CreateParticleBlock extends NodeParticleBlock {
88
102
  };
89
103
  system._colorCreation.process = (particle) => {
90
104
  state.particleContext = particle;
91
- particle.color.copyFrom(this.color.getConnectedValue(state));
105
+ const color = this.color.getConnectedValue(state);
106
+ if (color !== undefined) {
107
+ particle.color.copyFrom(color);
108
+ }
92
109
  };
93
110
  system._colorDeadCreation.process = (particle) => {
94
111
  state.particleContext = particle;
@@ -99,7 +116,13 @@ export class CreateParticleBlock extends NodeParticleBlock {
99
116
  };
100
117
  system._sizeCreation.process = (particle) => {
101
118
  state.particleContext = particle;
102
- particle.size = 1;
119
+ const size = this.size.getConnectedValue(state);
120
+ if (size !== undefined) {
121
+ particle.size = size;
122
+ }
123
+ else {
124
+ particle.size = 1.0;
125
+ }
103
126
  const scale = this.scale.getConnectedValue(state);
104
127
  if (scale.x !== undefined) {
105
128
  particle.scale.x = scale.x;
@@ -1 +1 @@
1
- {"version":3,"file":"createParticleBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/createParticleBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,i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C;gBACxB,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;gBAC3B,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;gBACzB,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;YAC7B,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACnD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC;IACxC,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport type { _IExecutionQueueItem } from \"core/Particles/Queue/executionQueue\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport { _RemoveFromQueue } from \"core/Particles/Queue/executionQueue\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\n\r\nconst ColorDiff = new Color4();\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class CreateParticleBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new CreateParticleBlock\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(\"emitPower\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"lifeTime\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"color\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(1, 1, 1, 1));\r\n this.registerInput(\"colorDead\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(0, 0, 0, 0));\r\n this.registerInput(\"scale\", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n\r\n this.scale.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\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 \"CreateParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the emitPower input component\r\n */\r\n public get emitPower(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the lifeTime input component\r\n */\r\n public get lifeTime(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get color(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the color dead input component\r\n */\r\n public get colorDead(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get scale(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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[5];\r\n }\r\n\r\n /**\r\n * Gets the particle output component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = new ParticleSystem(this.name, state.capacity, state.scene, null, false, undefined, true);\r\n system.particleEmitterType = new PointParticleEmitter();\r\n\r\n // Creation\r\n system._lifeTimeCreation.process = (particle: Particle, system: ThinParticleSystem) => {\r\n state.particleContext = particle;\r\n particle.lifeTime = this.lifeTime.getConnectedValue(state);\r\n system._emitPower = this.emitPower.getConnectedValue(state);\r\n };\r\n\r\n system._colorCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.color.copyFrom(this.color.getConnectedValue(state));\r\n };\r\n\r\n system._colorDeadCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.colorDead.copyFrom(this.colorDead.getConnectedValue(state));\r\n particle.initialColor.copyFrom(particle.color);\r\n particle.colorDead.subtractToRef(particle.initialColor, ColorDiff);\r\n ColorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n };\r\n\r\n system._sizeCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.size = 1;\r\n\r\n const scale = this.scale.getConnectedValue(state);\r\n\r\n if (scale.x !== undefined) {\r\n particle.scale.x = scale.x;\r\n particle.scale.y = scale.y;\r\n } else {\r\n particle.scale.x = scale;\r\n particle.scale.y = scale;\r\n }\r\n };\r\n\r\n system._angleCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.angle = this.angle.getConnectedValue(state);\r\n };\r\n\r\n this.particle._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CreateParticleBlock\", CreateParticleBlock);\r\n"]}
1
+ {"version":3,"file":"createParticleBlock.js","sourceRoot":"","sources":["../../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AAQ,CAAC;YACjC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC;IACxC,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport type { _IExecutionQueueItem } from \"core/Particles/Queue/executionQueue\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport { _RemoveFromQueue } from \"core/Particles/Queue/executionQueue\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\n\r\nconst ColorDiff = new Color4();\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class CreateParticleBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new CreateParticleBlock\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(\"emitPower\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"lifeTime\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"color\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(1, 1, 1, 1));\r\n this.registerInput(\"colorDead\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(0, 0, 0, 0));\r\n this.registerInput(\"scale\", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"angularSpeed\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"size\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n\r\n this.scale.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\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 \"CreateParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the emitPower input component\r\n */\r\n public get emitPower(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the lifeTime input component\r\n */\r\n public get lifeTime(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get color(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the color dead input component\r\n */\r\n public get colorDead(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get scale(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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[5];\r\n }\r\n\r\n /**\r\n * Gets the angular speed input component\r\n */\r\n public get angularSpeed(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the size component\r\n */\r\n public get size(): NodeParticleConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the particle output component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = new ParticleSystem(this.name, state.capacity, state.scene, null, false, undefined, true);\r\n system.particleEmitterType = new PointParticleEmitter();\r\n\r\n // Creation\r\n system._lifeTimeCreation.process = (particle: Particle, system: ThinParticleSystem) => {\r\n state.particleContext = particle;\r\n particle.lifeTime = this.lifeTime.getConnectedValue(state);\r\n system._emitPower = this.emitPower.getConnectedValue(state);\r\n };\r\n\r\n system._colorCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n\r\n const color = this.color.getConnectedValue(state);\r\n if (color !== undefined) {\r\n particle.color.copyFrom(color);\r\n }\r\n };\r\n\r\n system._colorDeadCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n\r\n particle.colorDead.copyFrom(this.colorDead.getConnectedValue(state));\r\n particle.initialColor.copyFrom(particle.color);\r\n particle.colorDead.subtractToRef(particle.initialColor, ColorDiff);\r\n ColorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n };\r\n\r\n system._sizeCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n\r\n const size = this.size.getConnectedValue(state);\r\n if (size !== undefined) {\r\n particle.size = size;\r\n } else {\r\n particle.size = 1.0;\r\n }\r\n\r\n const scale = this.scale.getConnectedValue(state);\r\n if (scale.x !== undefined) {\r\n particle.scale.x = scale.x;\r\n particle.scale.y = scale.y;\r\n } else {\r\n particle.scale.x = scale;\r\n particle.scale.y = scale;\r\n }\r\n };\r\n\r\n system._angleCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.angle = this.angle.getConnectedValue(state);\r\n };\r\n\r\n this.particle._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CreateParticleBlock\", CreateParticleBlock);\r\n"]}
@@ -58,11 +58,11 @@ export class CustomShapeBlock extends NodeParticleBlock {
58
58
  state.particleContext = particle;
59
59
  state.systemContext = system;
60
60
  const direction = this.direction.getConnectedValue(state);
61
- if (state.isEmitterTransformNode) {
62
- Vector3.TransformNormalToRef(direction, state.emitterWorldMatrix, particle.direction);
61
+ if (system.isLocal) {
62
+ particle.direction.copyFrom(direction);
63
63
  }
64
64
  else {
65
- particle.direction.copyFrom(direction);
65
+ Vector3.TransformNormalToRef(direction, state.emitterWorldMatrix, particle.direction);
66
66
  }
67
67
  particle._initialDirection = particle.direction.clone();
68
68
  };
@@ -70,13 +70,13 @@ export class CustomShapeBlock extends NodeParticleBlock {
70
70
  state.particleContext = particle;
71
71
  state.systemContext = system;
72
72
  const position = this.position.getConnectedValue(state);
73
- if (state.isEmitterTransformNode) {
74
- Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix, particle.position);
75
- }
76
- else {
73
+ if (system.isLocal) {
77
74
  particle.position.copyFrom(position);
78
75
  particle.position.addInPlace(state.emitterPosition);
79
76
  }
77
+ else {
78
+ Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix, particle.position);
79
+ }
80
80
  };
81
81
  this.output._storedValue = system;
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"customShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/customShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,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,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC3F,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;YAED,QAAQ,CAAC,iBAAiB,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAC5D,CAAC,CAAC;QAEF,MAAM,CAAC,iBAAiB,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACtD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAExD,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;gBAC/B,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC9F,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a custom position.\r\n */\r\nexport class CustomShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new CustomShapeBlock\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(\"position\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.registerInput(\"direction\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 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 \"CustomShapeBlock\";\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 position input component\r\n */\r\n public get position(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get direction(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * 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 direction = this.direction.getConnectedValue(state);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalToRef(direction, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFrom(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 const position = this.position.getConnectedValue(state);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFrom(position);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomShapeBlock\", CustomShapeBlock);\r\n"]}
1
+ {"version":3,"file":"customShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/customShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7G,IAA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AEF,MAAM,CAAC,iBAAiB,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACtD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAExD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC9F,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a custom position.\r\n */\r\nexport class CustomShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new CustomShapeBlock\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(\"position\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.registerInput(\"direction\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 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 \"CustomShapeBlock\";\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 position input component\r\n */\r\n public get position(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get direction(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * 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 direction = this.direction.getConnectedValue(state);\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFrom(direction);\r\n } else {\r\n Vector3.TransformNormalToRef(direction, 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 const position = this.position.getConnectedValue(state);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFrom(position);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n } else {\r\n Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix!, particle.position);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomShapeBlock\", CustomShapeBlock);\r\n"]}
@@ -76,7 +76,7 @@ export class CylinderShapeBlock extends NodeParticleBlock {
76
76
  const directionRandomizer = this.directionRandomizer.getConnectedValue(state);
77
77
  particle.position.subtractToRef(state.emitterPosition, this._tempVector);
78
78
  this._tempVector.normalize();
79
- if (state.isEmitterTransformNode) {
79
+ if (state.emitterInverseWorldMatrix) {
80
80
  Vector3.TransformNormalToRef(this._tempVector, state.emitterInverseWorldMatrix, this._tempVector);
81
81
  }
82
82
  const randY = RandomRange(-directionRandomizer / 2, directionRandomizer / 2);
@@ -86,11 +86,11 @@ export class CylinderShapeBlock extends NodeParticleBlock {
86
86
  this._tempVector.x = Math.sin(angle);
87
87
  this._tempVector.z = Math.cos(angle);
88
88
  this._tempVector.normalize();
89
- if (state.isEmitterTransformNode) {
90
- Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.z, state.emitterWorldMatrix, particle.direction);
89
+ if (system.isLocal) {
90
+ particle.direction.copyFrom(this._tempVector);
91
91
  }
92
92
  else {
93
- particle.direction.copyFrom(this._tempVector);
93
+ Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.z, state.emitterWorldMatrix, particle.direction);
94
94
  }
95
95
  particle._initialDirection = particle.direction.clone();
96
96
  };
@@ -106,13 +106,13 @@ export class CylinderShapeBlock extends NodeParticleBlock {
106
106
  const positionRadius = Math.sqrt(radiusDistribution) * radius;
107
107
  const xPos = positionRadius * Math.cos(angle);
108
108
  const zPos = positionRadius * Math.sin(angle);
109
- if (state.isEmitterTransformNode) {
110
- Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, state.emitterWorldMatrix, particle.position);
111
- }
112
- else {
109
+ if (system.isLocal) {
113
110
  particle.position.copyFromFloats(xPos, yPos, zPos);
114
111
  particle.position.addInPlace(state.emitterPosition);
115
112
  }
113
+ else {
114
+ Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, state.emitterWorldMatrix, particle.position);
115
+ }
116
116
  };
117
117
  this.output._storedValue = system;
118
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cylinderShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/cylinderShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAGjD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAErD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QANR,gBAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAQjC,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,QAAQ,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9F,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACtG,IAAI,CAAC,cAA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,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBACnD,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a cylinder shape.\r\n */\r\nexport class CylinderShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n private _tempVector = Vector3.Zero();\r\n /**\r\n * Create a new CylinderShapeBlock\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(\"height\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0);\r\n this.registerInput(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);\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 \"CylinderShapeBlock\";\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 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 height input component\r\n */\r\n public get height(): 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 directionRandomizer input component\r\n */\r\n public get directionRandomizer(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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);\r\n particle.position.subtractToRef(state.emitterPosition!, this._tempVector);\r\n\r\n this._tempVector.normalize();\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalToRef(this._tempVector, state.emitterInverseWorldMatrix!, this._tempVector);\r\n }\r\n\r\n const randY = RandomRange(-directionRandomizer / 2, directionRandomizer / 2);\r\n\r\n let angle = Math.atan2(this._tempVector.x, this._tempVector.z);\r\n angle += RandomRange(-Math.PI / 2, Math.PI / 2) * directionRandomizer;\r\n\r\n this._tempVector.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n this._tempVector.x = Math.sin(angle);\r\n this._tempVector.z = Math.cos(angle);\r\n this._tempVector.normalize();\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.z, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFrom(this._tempVector);\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 const height = this.height.getConnectedValue(state);\r\n const radiusRange = this.radiusRange.getConnectedValue(state);\r\n const radius = this.radius.getConnectedValue(state);\r\n const yPos = RandomRange(-height / 2, height / 2);\r\n const angle = RandomRange(0, 2 * Math.PI);\r\n\r\n const radiusDistribution = RandomRange((1 - radiusRange) * (1 - radiusRange), 1);\r\n const positionRadius = Math.sqrt(radiusDistribution) * radius;\r\n const xPos = positionRadius * Math.cos(angle);\r\n const zPos = positionRadius * Math.sin(angle);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(xPos, yPos, zPos);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CylinderShapeBlock\", CylinderShapeBlock);\r\n"]}
1
+ {"version":3,"file":"cylinderShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/cylinderShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAGjD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iB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AAW,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;YAE1C,MAAM,kBAAkB,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;YACjF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;YAC9D,MAAM,IAAI,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9C,MAAM,IAAI,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAE9C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBACnD,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,mCAAmC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAChH,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a cylinder shape.\r\n */\r\nexport class CylinderShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n private _tempVector = Vector3.Zero();\r\n /**\r\n * Create a new CylinderShapeBlock\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(\"height\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0);\r\n this.registerInput(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);\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 \"CylinderShapeBlock\";\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 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 height input component\r\n */\r\n public get height(): 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 directionRandomizer input component\r\n */\r\n public get directionRandomizer(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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);\r\n particle.position.subtractToRef(state.emitterPosition!, this._tempVector);\r\n\r\n this._tempVector.normalize();\r\n\r\n if (state.emitterInverseWorldMatrix) {\r\n Vector3.TransformNormalToRef(this._tempVector, state.emitterInverseWorldMatrix, this._tempVector);\r\n }\r\n\r\n const randY = RandomRange(-directionRandomizer / 2, directionRandomizer / 2);\r\n\r\n let angle = Math.atan2(this._tempVector.x, this._tempVector.z);\r\n angle += RandomRange(-Math.PI / 2, Math.PI / 2) * directionRandomizer;\r\n\r\n this._tempVector.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n this._tempVector.x = Math.sin(angle);\r\n this._tempVector.z = Math.cos(angle);\r\n this._tempVector.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFrom(this._tempVector);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.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 const height = this.height.getConnectedValue(state);\r\n const radiusRange = this.radiusRange.getConnectedValue(state);\r\n const radius = this.radius.getConnectedValue(state);\r\n const yPos = RandomRange(-height / 2, height / 2);\r\n const angle = RandomRange(0, 2 * Math.PI);\r\n\r\n const radiusDistribution = RandomRange((1 - radiusRange) * (1 - radiusRange), 1);\r\n const positionRadius = Math.sqrt(radiusDistribution) * radius;\r\n const xPos = positionRadius * Math.cos(angle);\r\n const zPos = positionRadius * Math.sin(angle);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(xPos, yPos, zPos);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, state.emitterWorldMatrix!, particle.position);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CylinderShapeBlock\", CylinderShapeBlock);\r\n"]}
@@ -124,11 +124,11 @@ export class MeshShapeBlock extends NodeParticleBlock {
124
124
  state.particleContext = particle;
125
125
  state.systemContext = system;
126
126
  if (this.useMeshNormalsForDirection && this._normals) {
127
- if (state.isEmitterTransformNode) {
128
- Vector3.TransformNormalToRef(this._storedNormal, state.emitterWorldMatrix, particle.direction);
127
+ if (system.isLocal) {
128
+ particle.direction.copyFrom(this._storedNormal);
129
129
  }
130
130
  else {
131
- particle.direction.copyFrom(this._storedNormal);
131
+ Vector3.TransformNormalToRef(this._storedNormal, state.emitterWorldMatrix, particle.direction);
132
132
  }
133
133
  return;
134
134
  }
@@ -137,11 +137,11 @@ export class MeshShapeBlock extends NodeParticleBlock {
137
137
  const randX = RandomRange(direction1.x, direction2.x);
138
138
  const randY = RandomRange(direction1.y, direction2.y);
139
139
  const randZ = RandomRange(direction1.z, direction2.z);
140
- if (state.isEmitterTransformNode) {
141
- Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.direction);
140
+ if (system.isLocal) {
141
+ particle.direction.copyFromFloats(randX, randY, randZ);
142
142
  }
143
143
  else {
144
- particle.direction.copyFromFloats(randX, randY, randZ);
144
+ Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.direction);
145
145
  }
146
146
  particle._initialDirection = particle.direction.clone();
147
147
  };
@@ -169,11 +169,11 @@ export class MeshShapeBlock extends NodeParticleBlock {
169
169
  if (this.worldSpace && this.mesh) {
170
170
  Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, this.mesh.getWorldMatrix(), randomVertex);
171
171
  }
172
- if (state.isEmitterTransformNode) {
173
- Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, state.emitterWorldMatrix, particle.position);
172
+ if (system.isLocal) {
173
+ particle.position.copyFromFloats(randomVertex.x, randomVertex.y, randomVertex.z);
174
174
  }
175
175
  else {
176
- particle.position.copyFromFloats(randomVertex.x, randomVertex.y, randomVertex.z);
176
+ Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, state.emitterWorldMatrix, particle.position);
177
177
  }
178
178
  if (this.useMeshNormalsForDirection && this._normals) {
179
179
  Vector3.FromArrayToRef(this._normals, faceIndexA * 3, vertexA);