ソースを参照

Be GC friendly

Popov72 5 年 前
コミット
b471a32649
1 ファイル変更6 行追加4 行削除
  1. 6 4
      src/Misc/minMaxReducer.ts

+ 6 - 4
src/Misc/minMaxReducer.ts

@@ -147,11 +147,13 @@ export class MinMaxReducer {
 
             if (w == 1 && h == 1) {
                 let func = (w: number, h: number, reduction: PostProcess) => {
-                    let buffer0 = new Float32Array(4 * w * h);
+                    let buffer = new Float32Array(4 * w * h),
+                        minmax = { min: 0, max: 0};
                     return () => {
-                        scene.getEngine()._readTexturePixels(reduction.inputTexture, w, h, -1, 0, buffer0);
-                        let min = buffer0[0], max = buffer0[1];
-                        this.onAfterReductionPerformed.notifyObservers({ min, max });
+                        scene.getEngine()._readTexturePixels(reduction.inputTexture, w, h, -1, 0, buffer);
+                        minmax.min = buffer[0];
+                        minmax.max = buffer[1];
+                        this.onAfterReductionPerformed.notifyObservers(minmax);
                     };
                 };
                 reduction.onAfterRenderObservable.add(func(w, h, reduction));