@woosh/meep-engine 2.86.5 → 2.86.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/meep.cjs +28 -32
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +28 -32
- package/package.json +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -2
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +17 -25
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +12 -7
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +21 -8
package/build/meep.module.js
CHANGED
|
@@ -54282,13 +54282,6 @@ Color.black = Object.freeze(new Color(0, 0, 0));
|
|
|
54282
54282
|
*/
|
|
54283
54283
|
Color.transparent = Object.freeze(new Color(0, 0, 0, 0));
|
|
54284
54284
|
|
|
54285
|
-
/**
|
|
54286
|
-
* No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
|
|
54287
|
-
* @param {*} arguments
|
|
54288
|
-
*/
|
|
54289
|
-
function noop() {
|
|
54290
|
-
}
|
|
54291
|
-
|
|
54292
54285
|
/**
|
|
54293
54286
|
* Returns true if two 1D lines overlap, touch is not considered overlap
|
|
54294
54287
|
* Parameters are assumed to be ordered, a1 > a0, b1 > b0
|
|
@@ -58336,25 +58329,20 @@ class TerrainTileManager {
|
|
|
58336
58329
|
|
|
58337
58330
|
const tiles = this.tiles;
|
|
58338
58331
|
|
|
58339
|
-
const self = this;
|
|
58340
|
-
|
|
58341
|
-
function ensureBuilt(x, y) {
|
|
58342
|
-
return function (resolve) {
|
|
58343
|
-
self.obtain(x, y).then(resolve);
|
|
58344
|
-
}
|
|
58345
|
-
}
|
|
58346
|
-
|
|
58347
58332
|
//populate tiles
|
|
58348
|
-
|
|
58333
|
+
const tile_resolution_y = gridSize.y;
|
|
58334
|
+
const tile_resolution_x = gridSize.x;
|
|
58335
|
+
|
|
58336
|
+
for (let y = 0; y < tile_resolution_y; y++) {
|
|
58349
58337
|
|
|
58350
|
-
const tY = y <
|
|
58338
|
+
const tY = y < tile_resolution_y - 1 ? time_size.y : (total_size.y - time_size.y * y);
|
|
58351
58339
|
|
|
58352
|
-
for (let x = 0; x <
|
|
58340
|
+
for (let x = 0; x < tile_resolution_x; x++) {
|
|
58353
58341
|
|
|
58354
|
-
const tX = x <
|
|
58342
|
+
const tX = x < tile_resolution_x - 1 ? time_size.x : (total_size.x - time_size.x * x);
|
|
58355
58343
|
|
|
58356
58344
|
const tile = new TerrainTile();
|
|
58357
|
-
const index = y *
|
|
58345
|
+
const index = y * tile_resolution_x + x;
|
|
58358
58346
|
tiles[index] = tile;
|
|
58359
58347
|
|
|
58360
58348
|
this.assignTileMaterial(tile);
|
|
@@ -58369,9 +58357,6 @@ class TerrainTileManager {
|
|
|
58369
58357
|
tile.setInitialHeightBounds(this.heightRange.min, this.heightRange.max);
|
|
58370
58358
|
tile.computeBoundingBox();
|
|
58371
58359
|
|
|
58372
|
-
//hook for building
|
|
58373
|
-
tile.ensureBuilt = ensureBuilt(x, y);
|
|
58374
|
-
|
|
58375
58360
|
tile.external_bvh.link(this.bvh, index);
|
|
58376
58361
|
}
|
|
58377
58362
|
}
|
|
@@ -58477,16 +58462,16 @@ class TerrainTileManager {
|
|
|
58477
58462
|
return Promise.resolve(tile);
|
|
58478
58463
|
|
|
58479
58464
|
} else {
|
|
58480
|
-
const promise = new Promise((resolve, reject) => {
|
|
58481
|
-
tile.onBuilt.addOne(resolve);
|
|
58482
|
-
tile.onDestroyed.addOne(reject);
|
|
58483
|
-
});
|
|
58484
58465
|
|
|
58485
58466
|
if (!tile.isBuildInProgress) {
|
|
58486
|
-
this.build(x, y,
|
|
58467
|
+
return new Promise((resolve, reject) => this.build(x, y, resolve, reject));
|
|
58468
|
+
} else {
|
|
58469
|
+
return new Promise((resolve, reject) => {
|
|
58470
|
+
tile.onBuilt.addOne(resolve);
|
|
58471
|
+
tile.onDestroyed.addOne(reject);
|
|
58472
|
+
});
|
|
58487
58473
|
}
|
|
58488
58474
|
|
|
58489
|
-
return promise;
|
|
58490
58475
|
}
|
|
58491
58476
|
|
|
58492
58477
|
}
|
|
@@ -58602,7 +58587,7 @@ class TerrainTileManager {
|
|
|
58602
58587
|
|
|
58603
58588
|
const tile = this.tiles[tile_index];
|
|
58604
58589
|
|
|
58605
|
-
if(!tile.isBuilt){
|
|
58590
|
+
if (!tile.isBuilt) {
|
|
58606
58591
|
continue;
|
|
58607
58592
|
}
|
|
58608
58593
|
|
|
@@ -58699,6 +58684,8 @@ class TerrainTileManager {
|
|
|
58699
58684
|
// console.timeEnd(processName);
|
|
58700
58685
|
|
|
58701
58686
|
this.on.tileBuilt.send1(tile);
|
|
58687
|
+
|
|
58688
|
+
resolve(tile);
|
|
58702
58689
|
}, reject);
|
|
58703
58690
|
}
|
|
58704
58691
|
}
|
|
@@ -63657,6 +63644,13 @@ function array_push_if_unique(array, element) {
|
|
|
63657
63644
|
return false;
|
|
63658
63645
|
}
|
|
63659
63646
|
|
|
63647
|
+
/**
|
|
63648
|
+
* No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
|
|
63649
|
+
* @param {*} arguments
|
|
63650
|
+
*/
|
|
63651
|
+
function noop() {
|
|
63652
|
+
}
|
|
63653
|
+
|
|
63660
63654
|
/**
|
|
63661
63655
|
* Created by Alex on 25/08/2016.
|
|
63662
63656
|
*/
|
|
@@ -65119,8 +65113,10 @@ class Terrain {
|
|
|
65119
65113
|
const promisedTiles = [];
|
|
65120
65114
|
|
|
65121
65115
|
tiles.traverse(function (tile) {
|
|
65122
|
-
const
|
|
65123
|
-
|
|
65116
|
+
const position = tile.gridPosition;
|
|
65117
|
+
|
|
65118
|
+
const x = position.x;
|
|
65119
|
+
const y = position.y;
|
|
65124
65120
|
|
|
65125
65121
|
const tilePromise = tiles.obtain(x, y);
|
|
65126
65122
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Terrain.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/Terrain.js"],"names":[],"mappings":";AAyCA;IACI;;;OAGG;IACH,IAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,cAAU;IAEV;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,eAFU,sBAAsB,CAEa;IAE7C;;;OAGG;IACH,mBAFU,MAAM,CAE6B;IAE7C;;;;OAIG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,eAFU,OAAO,CAEQ;IACzB;;;OAGG;IACH,SAFU,cAAc,CAEO;IAC/B;;;OAGG;IACH,gBAFU,YAAY,CAEK;IAE3B;;;OAGG;IACH,iBAFU,aAAa,CAEM;IAE7B;;;OAGG;IACH,oCAAyC;IAEzC;;;OAGG;IACH,cAFU,SAAS,CAEG;IAIlB;;;OAGG;IACH,QAFU,MAAM,CAEU;IAG1B;;;OAGG;IACH,aAFU,MAAM,CAEI;IAGpB;;;OAGG;IACH,eAFU,SAAS,CAE4B;IAE/C;;;OAGG;IACH,eAFU,WAAW,CAE4G;IAejI;;OAEG;IACH,yBAAqC;IAErC;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,2BAAuC;IAGvC;;;OAGG;IACH,SAFU,cAAc,CAEoB;IAE5C;;;;OAIG;IACH,gBAGE;IAMF;;;;OAIG;IACH,uBAA0B;IAE1B;;;;;OAKG;IACH,6BAAgC;IAEhC;;;;;OAKG;IACH,iCAAoC;IAEpC;;;OAGG;IACH,oBAAuB;IAEvB;;;;OAIG;IACH,6BAAgC;IAKpC;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,SACnB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,qCA0BC;IAED;;OAEG;IACH,eAyBC;IAED,gBAIC;IAED,mBAmBC;IAED,iCA4BC;IAED,6BAEC;IAED;;;;;;OAMG;IACH,gBANW,MAAM,KACN,MAAM,6EAiBhB;IAED;;;;;;;;;;OAUG;IACH,yBATW,aAAa,WACb,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,OAAO,CAQnB;IAED;;;;;;OAMG;IACH,0FAEC;IAED;;;;;;;OAOG;IACH,mBANW,MAAM,KACN,MAAM,6EAOhB;IAED;;;;;;OAMG;IACH,kCALW,aAAa,KACb,MAAM,KACN,MAAM,GACL,OAAO,CAIlB;IAED;;;;;OAKG;IACH,gCAJW,cAAe,qDAmDzB;IAED;;;;;;OAMG;IACH,wBALW,MAAO,OAAO,CAAC,UACf,SAAS,qDAkBnB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,KACN,MAAM,yBAiBhB;IAED;;;;OAIG;IACH,wCAFW,OAAO,QASjB;IAED;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"Terrain.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/Terrain.js"],"names":[],"mappings":";AAyCA;IACI;;;OAGG;IACH,IAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,cAAU;IAEV;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,eAFU,sBAAsB,CAEa;IAE7C;;;OAGG;IACH,mBAFU,MAAM,CAE6B;IAE7C;;;;OAIG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,eAFU,OAAO,CAEQ;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les.traverse(function (tile) {
|
|
598
|
-
const
|
|
599
|
-
|
|
598
|
+
const position = tile.gridPosition;
|
|
599
|
+
|
|
600
|
+
const x = position.x;
|
|
601
|
+
const y = position.y;
|
|
600
602
|
|
|
601
603
|
const tilePromise = tiles.obtain(x, y);
|
|
602
604
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainTileManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTileManager.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TerrainTileManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTileManager.js"],"names":[],"mappings":";AA+BA;IA6DI;;;;;OAKG;IACH,wCAJW,OAAO,EA8BjB;IA5FD;;;OAGG;IACH,OAFU,WAAW,EAAE,CAEZ;IAEX;;;MAGE;IAEF;;;OAGG;IACH,UAFU,OAAO,CAEc;IAE/B;;;OAGG;IACH,WAFU,OAAO,CAEa;IAC9B;;;OAGG;IACH,YAFU,eAAe,CAEW;IAEpC;;;OAGG;IACH,OAFU,OAAO,CAES;IAG1B;;;;OAIG;IACH,oBAAmC;IAEnC;;;OAGG;IACH,cAFU,GAAG,CAEG;IAEhB;;;OAGG;IACH,aAFU,eAAe,CAEe;IAExC;;;OAGG;IACH,yBAFU,OAAO,CAEe;IAqB5B,6BAA2C;IAG3C;;;OAGG;IACH,yBAA8B;IAQlC,iCAWC;IAED,8BAEC;IAED;;;;OAIG;IACH,2BAHW,MAAM,cACN,MAAM,QA8BhB;IAED,mBAIC;IAED;;;OAGG;IACH,yBAFW,WAAW,QAerB;IAED;;;;OAIG;IACH,6CASC;IAED,qBAmBC;IAED;;OAEG;IACH,gBAIC;IAED;;;;;;OAMG;IACH,qBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAuBhB;IAGD;;;;;;;OAOG;IACH,oCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,WAAW,EAAE,CAgCzB;IAED,wBA6CC;IAED;;;;;OAKG;IACH,oBAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,GACJ,WAAW,GAAC,SAAS,CAiBjC;IAED;;;;;OAKG;IACH,wBAJW,MAAM,KACN,MAAM,GACJ,WAAW,CAavB;IAED;;;;;OAKG;IACH,4BAJW,MAAM,KACN,MAAM,GACL,WAAW,GAAC,SAAS,CAahC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,KACN,MAAM,GACJ,QAAQ,WAAW,CAAC,CAYhC;IAED;;;;;;OAMG;IACH,UALW,MAAM,KACN,MAAM,GACJ,QAAQ,WAAW,CAAC,CA4BhC;IAED;;;OAGG;IACH,cAFW,WAAW,QAcrB;IAED,gBASC;IAED;;;;;;OAMG;IACH,cAJW,MAAM,KACN,MAAM,QACN,WAAW,QAsCrB;IAED;;;;;;;;;;OAUG;IACH,yBATW,aAAa,WACb,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,OAAO,CAuDnB;IAED;;;;;;OAMG;IACH,kCALW,aAAa,KACb,MAAM,KACN,MAAM,GACL,OAAO,CAOlB;IAED;;;;;;OAMG;IACH,SALW,MAAM,KACN,MAAM,6CA6DhB;CACJ;wBAvrBuB,kBAAkB;mBAVvB,0CAA0C;oBAGzC,kCAAkC;4BAG1B,2CAA2C;oBAVnD,mCAAmC;gCAQvB,mDAAmD;0BAGzD,yCAAyC;8BALrC,2CAA2C"}
|
|
@@ -11,8 +11,6 @@ import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query
|
|
|
11
11
|
import { isArrayEqualStrict } from "../../../../core/collection/array/isArrayEqualStrict.js";
|
|
12
12
|
import { Color } from "../../../../core/color/Color.js";
|
|
13
13
|
import Signal from '../../../../core/events/signal/Signal.js';
|
|
14
|
-
|
|
15
|
-
import { noop } from "../../../../core/function/noop.js";
|
|
16
14
|
import { aabb2_overlap_exists } from "../../../../core/geom/2d/aabb/aabb2_overlap_exists.js";
|
|
17
15
|
import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
|
|
18
16
|
import Vector2 from '../../../../core/geom/Vector2.js';
|
|
@@ -333,25 +331,20 @@ class TerrainTileManager {
|
|
|
333
331
|
|
|
334
332
|
const tiles = this.tiles;
|
|
335
333
|
|
|
336
|
-
const self = this;
|
|
337
|
-
|
|
338
|
-
function ensureBuilt(x, y) {
|
|
339
|
-
return function (resolve) {
|
|
340
|
-
self.obtain(x, y).then(resolve);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
334
|
//populate tiles
|
|
345
|
-
|
|
335
|
+
const tile_resolution_y = gridSize.y;
|
|
336
|
+
const tile_resolution_x = gridSize.x;
|
|
337
|
+
|
|
338
|
+
for (let y = 0; y < tile_resolution_y; y++) {
|
|
346
339
|
|
|
347
|
-
const tY = y <
|
|
340
|
+
const tY = y < tile_resolution_y - 1 ? time_size.y : (total_size.y - time_size.y * y);
|
|
348
341
|
|
|
349
|
-
for (let x = 0; x <
|
|
342
|
+
for (let x = 0; x < tile_resolution_x; x++) {
|
|
350
343
|
|
|
351
|
-
const tX = x <
|
|
344
|
+
const tX = x < tile_resolution_x - 1 ? time_size.x : (total_size.x - time_size.x * x);
|
|
352
345
|
|
|
353
346
|
const tile = new TerrainTile();
|
|
354
|
-
const index = y *
|
|
347
|
+
const index = y * tile_resolution_x + x;
|
|
355
348
|
tiles[index] = tile;
|
|
356
349
|
|
|
357
350
|
this.assignTileMaterial(tile);
|
|
@@ -366,9 +359,6 @@ class TerrainTileManager {
|
|
|
366
359
|
tile.setInitialHeightBounds(this.heightRange.min, this.heightRange.max);
|
|
367
360
|
tile.computeBoundingBox();
|
|
368
361
|
|
|
369
|
-
//hook for building
|
|
370
|
-
tile.ensureBuilt = ensureBuilt(x, y);
|
|
371
|
-
|
|
372
362
|
tile.external_bvh.link(this.bvh, index);
|
|
373
363
|
}
|
|
374
364
|
}
|
|
@@ -492,16 +482,16 @@ class TerrainTileManager {
|
|
|
492
482
|
return Promise.resolve(tile);
|
|
493
483
|
|
|
494
484
|
} else {
|
|
495
|
-
const promise = new Promise((resolve, reject) => {
|
|
496
|
-
tile.onBuilt.addOne(resolve);
|
|
497
|
-
tile.onDestroyed.addOne(reject);
|
|
498
|
-
});
|
|
499
485
|
|
|
500
486
|
if (!tile.isBuildInProgress) {
|
|
501
|
-
this.build(x, y,
|
|
487
|
+
return new Promise((resolve, reject) => this.build(x, y, resolve, reject));
|
|
488
|
+
} else {
|
|
489
|
+
return new Promise((resolve, reject) => {
|
|
490
|
+
tile.onBuilt.addOne(resolve);
|
|
491
|
+
tile.onDestroyed.addOne(reject);
|
|
492
|
+
});
|
|
502
493
|
}
|
|
503
494
|
|
|
504
|
-
return promise;
|
|
505
495
|
}
|
|
506
496
|
|
|
507
497
|
}
|
|
@@ -619,7 +609,7 @@ class TerrainTileManager {
|
|
|
619
609
|
|
|
620
610
|
const tile = this.tiles[tile_index];
|
|
621
611
|
|
|
622
|
-
if(!tile.isBuilt){
|
|
612
|
+
if (!tile.isBuilt) {
|
|
623
613
|
continue;
|
|
624
614
|
}
|
|
625
615
|
|
|
@@ -721,6 +711,8 @@ class TerrainTileManager {
|
|
|
721
711
|
// console.timeEnd(processName);
|
|
722
712
|
|
|
723
713
|
this.on.tileBuilt.send1(tile);
|
|
714
|
+
|
|
715
|
+
resolve(tile);
|
|
724
716
|
}, reject);
|
|
725
717
|
}
|
|
726
718
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"AAiCA;;;;;;GAMG;AACH,gDALW,SAAS,SACT,SAAS,QACT,MAAM,YACN,MAAM,QAqFhB;0BAxHyB,iBAAiB"}
|
|
@@ -9,14 +9,16 @@ let temp_data = new Float64Array(1);
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param {number} sample_count
|
|
12
|
+
* @param {number} sigma
|
|
12
13
|
* @param {Float32Array} kernel
|
|
13
14
|
*/
|
|
14
|
-
function build_kernel(sample_count, kernel) {
|
|
15
|
-
|
|
15
|
+
function build_kernel(sample_count, sigma, kernel) {
|
|
16
|
+
|
|
17
|
+
const half_width = (sample_count - 1) * 0.5;
|
|
16
18
|
|
|
17
19
|
let kernel_power_sum = 0;
|
|
18
20
|
for (let i = 0; i < sample_count; i++) {
|
|
19
|
-
const local = i -
|
|
21
|
+
const local = i - half_width;
|
|
20
22
|
|
|
21
23
|
const power = gaussian(sigma, local);
|
|
22
24
|
kernel[i] = power;
|
|
@@ -38,11 +40,12 @@ function build_kernel(sample_count, kernel) {
|
|
|
38
40
|
*/
|
|
39
41
|
export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
|
|
40
42
|
|
|
43
|
+
const sigma = size * 3;
|
|
41
44
|
const sample_count = max2(3, makeNextOdd(Math.round(size * quality)));
|
|
42
45
|
|
|
43
46
|
const kernel = new Float32Array(sample_count);
|
|
44
47
|
|
|
45
|
-
build_kernel(sample_count, kernel);
|
|
48
|
+
build_kernel(sample_count, sigma, kernel);
|
|
46
49
|
|
|
47
50
|
const width = input.width;
|
|
48
51
|
const height = input.height;
|
|
@@ -57,8 +60,8 @@ export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
|
|
|
57
60
|
let target = new Sampler2D(temp_data, channel_count, width, height);
|
|
58
61
|
|
|
59
62
|
const half_samples = (sample_count - 1) * 0.5;
|
|
60
|
-
const local_u_scale =
|
|
61
|
-
const local_v_scale =
|
|
63
|
+
const local_u_scale = size / (sample_count - 1);
|
|
64
|
+
const local_v_scale = size / (sample_count - 1);
|
|
62
65
|
|
|
63
66
|
const sample = new Float64Array(channel_count);
|
|
64
67
|
|
|
@@ -90,6 +93,8 @@ export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
|
|
|
90
93
|
source = target;
|
|
91
94
|
target = output;
|
|
92
95
|
|
|
96
|
+
// typed_array_copy(source.data, target.data);
|
|
97
|
+
|
|
93
98
|
// vertical pass
|
|
94
99
|
for (let y = 0; y < height; y++) {
|
|
95
100
|
for (let x = 0; x < width; x++) {
|
|
@@ -99,7 +104,7 @@ export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
|
|
|
99
104
|
|
|
100
105
|
const local_y = iy - half_samples;
|
|
101
106
|
|
|
102
|
-
const sample_y =
|
|
107
|
+
const sample_y = y + local_y * local_v_scale;
|
|
103
108
|
|
|
104
109
|
const power = kernel[iy];
|
|
105
110
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellFilterGaussianBlur.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CellFilterGaussianBlur.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js"],"names":[],"mappings":"AA6DA;IA8EI;;;;;;;OAOG;IACH,oBANW,UAAU,KACV,MAAM,KACN,MAAM,YACN,MAAM,GACJ,sBAAsB,CAkBlC;IAlGG,kBAAkB;IAClB,kBAAkB;IAElB,gBAAiB;IACjB,gBAAiB;IAEjB;;;OAGG;IACH,QAFU,UAAU,CAEF;IAElB,eAAe;IACf,eAAe;IAEf;;;;OAIG;IACH,iBAAkB;IAElB;;;;OAIG;IACH,6BAA6B;IAE7B;;;;OAIG;IACH,iCAAiC;IAEjC;;;;OAIG;IACH,wBAAwB;IAExB;;;;OAIG;IACH,wBAAwB;IAG5B,uCAoBC;IA6BD,0DA8CC;CACJ;2BAhN0B,qBAAqB"}
|
|
@@ -13,12 +13,16 @@ import { CellFilter } from "../../CellFilter.js";
|
|
|
13
13
|
* @param {number} sigma_y
|
|
14
14
|
* @return {number}
|
|
15
15
|
*/
|
|
16
|
-
function buildKernel(
|
|
16
|
+
function buildKernel(
|
|
17
|
+
result,
|
|
18
|
+
samplesX, samplesY,
|
|
19
|
+
sigma_x, sigma_y
|
|
20
|
+
) {
|
|
17
21
|
assert.isNonNegativeInteger(samplesX, 'samplesX');
|
|
18
22
|
assert.isNonNegativeInteger(samplesY, 'samplesY');
|
|
19
23
|
|
|
20
|
-
const half_samples_x = samplesX * 0.5;
|
|
21
|
-
const half_samples_y = samplesY * 0.5;
|
|
24
|
+
const half_samples_x = (samplesX - 1) * 0.5;
|
|
25
|
+
const half_samples_y = (samplesY - 1) * 0.5;
|
|
22
26
|
|
|
23
27
|
let powerTotal = 0;
|
|
24
28
|
let ix, iy;
|
|
@@ -45,7 +49,14 @@ function buildKernel(result, samplesX, samplesY, sigma_x, sigma_y) {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
const inv_total_power = 1 / powerTotal;
|
|
53
|
+
|
|
54
|
+
// normalize kernel
|
|
55
|
+
for (let i = 0; i < samplesX * samplesY; i++) {
|
|
56
|
+
result[i] *= inv_total_power;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return 1;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export class CellFilterGaussianBlur extends CellFilter {
|
|
@@ -117,9 +128,6 @@ export class CellFilterGaussianBlur extends CellFilter {
|
|
|
117
128
|
// initialize kernel
|
|
118
129
|
this.__kernel_total_power = buildKernel(this.__kernel, this.samples_x, this.samples_y, this.sigma_x, this.sigma_y);
|
|
119
130
|
|
|
120
|
-
// store inverse, to be able to use multiply instead of division in execution
|
|
121
|
-
this.__inv_kernel_total_power = 1 / this.__kernel_total_power;
|
|
122
|
-
|
|
123
131
|
|
|
124
132
|
// precompute scaling for the sampling(execute) stage
|
|
125
133
|
this.__local_u_scale = this.size_x / (this.samples_x - 1);
|
|
@@ -148,6 +156,10 @@ export class CellFilterGaussianBlur extends CellFilter {
|
|
|
148
156
|
r.size_x = x;
|
|
149
157
|
r.size_y = y;
|
|
150
158
|
|
|
159
|
+
// sigma should scale with radius
|
|
160
|
+
r.sigma_x = x * 3;
|
|
161
|
+
r.sigma_y = y * 3;
|
|
162
|
+
|
|
151
163
|
return r;
|
|
152
164
|
}
|
|
153
165
|
|
|
@@ -195,6 +207,7 @@ export class CellFilterGaussianBlur extends CellFilter {
|
|
|
195
207
|
}
|
|
196
208
|
}
|
|
197
209
|
|
|
198
|
-
|
|
210
|
+
// note that the kernel is already normalized, so we don't need to do anything special here
|
|
211
|
+
return sum;
|
|
199
212
|
}
|
|
200
213
|
}
|