Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 404 occurring on some pictures in some cases when using particle systems #9671

Merged
merged 3 commits into from Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/preview release/what's new.md
Expand Up @@ -81,6 +81,7 @@
- Fix lens flares not working in right handed system ([Popov72](https://github.com/Popov72))
- Fix canvas not resized correctly in a multi-canvas scenario ([Popov72](https://github.com/Popov72))
- Fix NaN values returned by `GetAngleBetweenVectors` when vectors are the same or directly opposite ([Popov72](https://github.com/Popov72))
- Fix 404 occurring on some pictures in some cases when using particle systems ([Popov72](https://github.com/Popov72))

## Breaking changes

Expand Down
1 change: 1 addition & 0 deletions src/Particles/baseParticleSystem.ts
Expand Up @@ -190,6 +190,7 @@ export class BaseParticleSystem {
*/
public preventAutoStart: boolean = false;

protected _rootUrl = "";
private _noiseTexture: Nullable<ProceduralTexture>;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Particles/gpuParticleSystem.ts
Expand Up @@ -1707,7 +1707,7 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable
*/
public clone(name: string, newEmitter: any): GPUParticleSystem {
let serialization = this.serialize();
var result = GPUParticleSystem.Parse(serialization, this._scene || this._engine, "");
var result = GPUParticleSystem.Parse(serialization, this._scene || this._engine, this._rootUrl);
var custom = { ...this._customEffect };
result.name = name;
result._customEffect = custom;
Expand Down Expand Up @@ -1749,6 +1749,7 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable
public static Parse(parsedParticleSystem: any, sceneOrEngine: Scene | ThinEngine, rootUrl: string, doNotStart = false): GPUParticleSystem {
var name = parsedParticleSystem.name;
var particleSystem = new GPUParticleSystem(name, { capacity: parsedParticleSystem.capacity, randomTextureSize: parsedParticleSystem.randomTextureSize }, sceneOrEngine);
particleSystem._rootUrl = rootUrl;

if (parsedParticleSystem.activeParticleCount) {
particleSystem.activeParticleCount = parsedParticleSystem.activeParticleCount;
Expand Down
3 changes: 2 additions & 1 deletion src/Particles/particleSystem.ts
Expand Up @@ -2130,7 +2130,7 @@ export class ParticleSystem extends BaseParticleSystem implements IDisposable, I
}

let serialization = this.serialize();
var result = ParticleSystem.Parse(serialization, this._scene || this._engine, "");
var result = ParticleSystem.Parse(serialization, this._scene || this._engine, this._rootUrl);
result.name = name;
result.customShader = program;
result._customEffect = custom;
Expand Down Expand Up @@ -2768,6 +2768,7 @@ export class ParticleSystem extends BaseParticleSystem implements IDisposable, I
}
var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, sceneOrEngine, custom, parsedParticleSystem.isAnimationSheetEnabled);
particleSystem.customShader = program;
particleSystem._rootUrl = rootUrl;

if (parsedParticleSystem.id) {
particleSystem.id = parsedParticleSystem.id;
Expand Down