From 8fb2fd44978f00eb18f275a39eca60e111093402 Mon Sep 17 00:00:00 2001 From: sebavan Date: Thu, 30 May 2024 00:41:50 +0200 Subject: [PATCH] Fix dupplicate ImageProcessing defines in NME particles --- packages/dev/core/src/Materials/Node/nodeMaterial.ts | 4 ++-- packages/dev/core/src/Particles/IParticleSystem.ts | 3 ++- packages/dev/core/src/Particles/gpuParticleSystem.ts | 5 +++-- packages/dev/core/src/Particles/thinParticleSystem.ts | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/dev/core/src/Materials/Node/nodeMaterial.ts b/packages/dev/core/src/Materials/Node/nodeMaterial.ts index a8e74e6e473..1541c389e68 100644 --- a/packages/dev/core/src/Materials/Node/nodeMaterial.ts +++ b/packages/dev/core/src/Materials/Node/nodeMaterial.ts @@ -1295,7 +1295,7 @@ export class NodeMaterial extends PushMaterial { Effect.RegisterShader(tempName, this._fragmentCompilationState._builtCompilationString); - particleSystem.fillDefines(particleSystemDefines, blendMode); + particleSystem.fillDefines(particleSystemDefines, blendMode, false); join = particleSystemDefines.join("\n"); @@ -1328,7 +1328,7 @@ export class NodeMaterial extends PushMaterial { particleSystemDefines.length = 0; - particleSystem.fillDefines(particleSystemDefines, blendMode); + particleSystem.fillDefines(particleSystemDefines, blendMode, false); const particleSystemDefinesJoinedCurrent = particleSystemDefines.join("\n"); diff --git a/packages/dev/core/src/Particles/IParticleSystem.ts b/packages/dev/core/src/Particles/IParticleSystem.ts index 0b350d865ba..784e468b92d 100644 --- a/packages/dev/core/src/Particles/IParticleSystem.ts +++ b/packages/dev/core/src/Particles/IParticleSystem.ts @@ -399,8 +399,9 @@ export interface IParticleSystem { * Fill the defines array according to the current settings of the particle system * @param defines Array to be updated * @param blendMode blend mode to take into account when updating the array + * @param fillImageProcessing fills the image processing defines */ - fillDefines(defines: Array, blendMode: number): void; + fillDefines(defines: Array, blendMode: number, fillImageProcessing?: boolean): void; /** * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system * @param uniforms Uniforms array to fill diff --git a/packages/dev/core/src/Particles/gpuParticleSystem.ts b/packages/dev/core/src/Particles/gpuParticleSystem.ts index 876ca9d3375..f4033ed7f14 100644 --- a/packages/dev/core/src/Particles/gpuParticleSystem.ts +++ b/packages/dev/core/src/Particles/gpuParticleSystem.ts @@ -1466,8 +1466,9 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable * Fill the defines array according to the current settings of the particle system * @param defines Array to be updated * @param blendMode blend mode to take into account when updating the array + * @param fillImageProcessing fills the image processing defines */ - public fillDefines(defines: Array, blendMode: number = 0) { + public fillDefines(defines: Array, blendMode: number = 0, fillImageProcessing: boolean = true): void { if (this._scene) { prepareStringDefinesForClipPlanes(this, this._scene, defines); if (this.applyFog && this._scene.fogEnabled && this._scene.fogMode !== Scene.FOGMODE_NONE) { @@ -1513,7 +1514,7 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable defines.push("#define ANIMATESHEET"); } - if (this._imageProcessingConfiguration) { + if (fillImageProcessing && this._imageProcessingConfiguration) { this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines); defines.push("" + this._imageProcessingConfigurationDefines.toString()); } diff --git a/packages/dev/core/src/Particles/thinParticleSystem.ts b/packages/dev/core/src/Particles/thinParticleSystem.ts index a74c8ed3f07..f3f8a52da48 100644 --- a/packages/dev/core/src/Particles/thinParticleSystem.ts +++ b/packages/dev/core/src/Particles/thinParticleSystem.ts @@ -1675,8 +1675,9 @@ export class ThinParticleSystem extends BaseParticleSystem implements IDisposabl * Fill the defines array according to the current settings of the particle system * @param defines Array to be updated * @param blendMode blend mode to take into account when updating the array + * @param fillImageProcessing fills the image processing defines */ - public fillDefines(defines: Array, blendMode: number) { + public fillDefines(defines: Array, blendMode: number, fillImageProcessing: boolean = true): void { if (this._scene) { prepareStringDefinesForClipPlanes(this, this._scene, defines); if (this.applyFog && this._scene.fogEnabled && this._scene.fogMode !== Constants.FOGMODE_NONE) { @@ -1722,7 +1723,7 @@ export class ThinParticleSystem extends BaseParticleSystem implements IDisposabl } } - if (this._imageProcessingConfiguration) { + if (fillImageProcessing && this._imageProcessingConfiguration) { this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines); defines.push(this._imageProcessingConfigurationDefines.toString()); }