Skip to content

Commit

Permalink
Merge pull request #15146 from sebavan/work1
Browse files Browse the repository at this point in the history
Fix duplicate ImageProcessing defines in NME particles
  • Loading branch information
sebavan authored May 29, 2024
2 parents b9a4086 + 8fb2fd4 commit d1a616d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/dev/core/src/Materials/Node/nodeMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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");

Expand Down
3 changes: 2 additions & 1 deletion packages/dev/core/src/Particles/IParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>, blendMode: number): void;
fillDefines(defines: Array<string>, 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
Expand Down
5 changes: 3 additions & 2 deletions packages/dev/core/src/Particles/gpuParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>, blendMode: number = 0) {
public fillDefines(defines: Array<string>, 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) {
Expand Down Expand Up @@ -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());
}
Expand Down
5 changes: 3 additions & 2 deletions packages/dev/core/src/Particles/thinParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>, blendMode: number) {
public fillDefines(defines: Array<string>, 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) {
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit d1a616d

Please sign in to comment.