فهرست منبع

Fix WebGPU Particles NoiseTexture

sebavan 4 سال پیش
والد
کامیت
bd7d5bddf4
2فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 3 0
      dist/preview release/what's new.md
  2. 4 2
      src/Particles/particleSystem.ts

+ 3 - 0
dist/preview release/what's new.md

@@ -48,6 +48,9 @@
 
 ## Breaking changes
 
+- [List of breaking changes introduced by ou compatibility with WebGPU](https://doc.babylonjs.com/advanced_topics/webGPU/webGPUBreakingChanges)
+    - [ReadPixels and ProceduralTexture.getContent are now async](https://doc.babylonjs.com/advanced_topics/webGPU/webGPUBreakingChanges#readpixels-is-now-asynchronous)
+    - [Shader support differences](https://doc.babylonjs.com/advanced_topics/webGPU/webGPUBreakingChanges#shader-code-differences)
 - Use both `mesh.visibility` and `material.alpha` values to compute the global alpha value used by the soft transparent shadow rendering code. Formerly was only using `mesh.visibility` ([Popov72](https://github.com/Popov72))
 - The `Texture.hasAlpha` property is automatically set by the KTX2 loader if the texture has an alpha channel ([Popov72](https://github.com/Popov72))
 - Depth renderer: don't render mesh if `infiniteDistance = true` or if `material.disableDepthWrite = true` ([Popov72](https://github.com/Popov72))

+ 4 - 2
src/Particles/particleSystem.ts

@@ -309,15 +309,17 @@ export class ParticleSystem extends BaseParticleSystem implements IDisposable, I
 
         // Default emitter type
         this.particleEmitterType = new BoxParticleEmitter();
+        let noiseTextureData: Nullable<Uint8Array> = null;
 
         // Update
         this.updateFunction = (particles: Particle[]): void => {
             let noiseTextureSize: Nullable<ISize> = null;
-            let noiseTextureData: Nullable<Uint8Array> = null;
 
             if (this.noiseTexture) { // We need to get texture data back to CPU
                 noiseTextureSize = this.noiseTexture.getSize();
-                noiseTextureData = <Nullable<Uint8Array>>(this.noiseTexture.getContent());
+                this.noiseTexture.getContent()?.then((data) => {
+                    noiseTextureData = data as Uint8Array;
+                });
             }
 
             for (var index = 0; index < particles.length; index++) {