소스 검색

copy dynamic texture img data on clone

ycw 6 년 전
부모
커밋
74cc5ef35f
1개의 변경된 파일5개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 7
      src/Particles/particleSystem.ts

+ 5 - 7
src/Particles/particleSystem.ts

@@ -11,7 +11,7 @@ import { MaterialHelper } from "../Materials/materialHelper";
 import { Effect } from "../Materials/effect";
 import { Effect } from "../Materials/effect";
 import { ImageProcessingConfiguration } from "../Materials/imageProcessingConfiguration";
 import { ImageProcessingConfiguration } from "../Materials/imageProcessingConfiguration";
 import { Texture } from "../Materials/Textures/texture";
 import { Texture } from "../Materials/Textures/texture";
-import { InternalTexture } from "../Materials/Textures/internalTexture"
+import { DynamicTexture } from "../Materials/Textures/dynamicTexture";
 import { RawTexture } from "../Materials/Textures/rawTexture";
 import { RawTexture } from "../Materials/Textures/rawTexture";
 import { ProceduralTexture } from "../Materials/Textures/Procedurals/proceduralTexture";
 import { ProceduralTexture } from "../Materials/Textures/Procedurals/proceduralTexture";
 import { EngineStore } from "../Engines/engineStore";
 import { EngineStore } from "../Engines/engineStore";
@@ -1928,13 +1928,11 @@ export class ParticleSystem extends BaseParticleSystem implements IDisposable, I
         result.noiseTexture = this.noiseTexture;
         result.noiseTexture = this.noiseTexture;
         result.emitter = newEmitter;
         result.emitter = newEmitter;
         if (this.particleTexture) {
         if (this.particleTexture) {
-            if (this.particleTexture.getInternalTexture().dataSource === InternalTexture.DATASOURCE_DYNAMIC) {
-                // clone 
+            if (this.particleTexture instanceof DynamicTexture) {
                 result.particleTexture = this.particleTexture.clone();
                 result.particleTexture = this.particleTexture.clone();
-                // copy underlying image data 
-                const ctx = result.particleTexture.getContext();
-                ctx.drawImage(this.particleTexture.getContext().canvas, 0, 0);
-                result.particleTexture.update();
+                const ctx = (<unknown>result.particleTexture as DynamicTexture).getContext();
+                ctx.drawImage((<unknown>this.particleTexture as DynamicTexture).getContext().canvas, 0, 0);
+                (<unknown>result.particleTexture as DynamicTexture).update();
             } else {
             } else {
                 result.particleTexture = new Texture(this.particleTexture.url, this._scene);
                 result.particleTexture = new Texture(this.particleTexture.url, this._scene);
             }
             }