@woosh/meep-engine 2.88.1 → 2.88.3
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/package.json +1 -1
- package/src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.d.ts +3 -1
- package/src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.d.ts.map +1 -1
- package/src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js +4 -2
- package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
- package/src/engine/grid/obstacle/GridObstacle.js +4 -4
- package/src/generation/placement/action/GridCellActionPlaceTags.d.ts.map +1 -1
- package/src/generation/placement/action/GridCellActionPlaceTags.js +15 -4
package/package.json
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* @param {ParameterLookupTable} [params.lut]
|
|
6
6
|
* @param {NumericInterval} [params.range] Range of values of interest within the sampler that are to be mapped onto LUT
|
|
7
7
|
* @param {function(number):number} [params.lookupScaleFunction]
|
|
8
|
+
* @param {number} [params.channel]
|
|
8
9
|
*/
|
|
9
|
-
export function paintTerrainOverlayViaLookupTable({ overlay, sampler, lut, range, lookupScaleFunction }: {
|
|
10
|
+
export function paintTerrainOverlayViaLookupTable({ overlay, sampler, lut, range, lookupScaleFunction, channel }: {
|
|
10
11
|
overlay: TerrainOverlay;
|
|
11
12
|
sampler: Sampler2D;
|
|
12
13
|
lut?: ParameterLookupTable;
|
|
13
14
|
range?: NumericInterval;
|
|
14
15
|
lookupScaleFunction?: (arg0: number) => number;
|
|
16
|
+
channel?: number;
|
|
15
17
|
}): void;
|
|
16
18
|
import { Sampler2D } from "../../../graphics/texture/sampler/Sampler2D.js";
|
|
17
19
|
import { ParameterLookupTable } from "../../../graphics/particles/particular/engine/parameter/ParameterLookupTable.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paintTerrainOverlayViaLookupTable.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js"],"names":[],"mappings":"AAmBA
|
|
1
|
+
{"version":3,"file":"paintTerrainOverlayViaLookupTable.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js"],"names":[],"mappings":"AAmBA;;;;;;;;GAQG;AACH;IAPkC,OAAO;IACZ,OAAO,EAAzB,SAAS;IACqB,GAAG,GAAjC,oBAAoB;IACK,KAAK,GAA9B,eAAe;IACkB,mBAAmB,UAA3C,MAAM,KAAE,MAAM;IACP,OAAO,GAAvB,MAAM;SA2ChB;0BAhEyB,gDAAgD;qCAFrC,iFAAiF;gCADtF,mDAAmD"}
|
|
@@ -24,13 +24,15 @@ heatmap_lut.computeUniformPositions();
|
|
|
24
24
|
* @param {ParameterLookupTable} [params.lut]
|
|
25
25
|
* @param {NumericInterval} [params.range] Range of values of interest within the sampler that are to be mapped onto LUT
|
|
26
26
|
* @param {function(number):number} [params.lookupScaleFunction]
|
|
27
|
+
* @param {number} [params.channel]
|
|
27
28
|
*/
|
|
28
29
|
export function paintTerrainOverlayViaLookupTable({
|
|
29
30
|
overlay,
|
|
30
31
|
sampler,
|
|
31
32
|
lut = heatmap_lut,
|
|
32
33
|
range = new NumericInterval(0, 1),
|
|
33
|
-
lookupScaleFunction = passThrough
|
|
34
|
+
lookupScaleFunction = passThrough,
|
|
35
|
+
channel = 0
|
|
34
36
|
}) {
|
|
35
37
|
let i, j;
|
|
36
38
|
|
|
@@ -51,7 +53,7 @@ export function paintTerrainOverlayViaLookupTable({
|
|
|
51
53
|
|
|
52
54
|
for (i = 0; i < w; i++) {
|
|
53
55
|
|
|
54
|
-
const p = scaled_sampler.readChannel(i, j,
|
|
56
|
+
const p = scaled_sampler.readChannel(i, j, channel);
|
|
55
57
|
|
|
56
58
|
const scaledPosition = lookupScaleFunction(p);
|
|
57
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAWA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;
|
|
1
|
+
{"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAWA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;oBA5PmB,+BAA+B"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import Vector2 from '../../../core/geom/Vector2.js';
|
|
7
6
|
import { assert } from "../../../core/assert.js";
|
|
8
|
-
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
9
|
-
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
10
7
|
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
8
|
+
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
9
|
+
import Vector2 from '../../../core/geom/Vector2.js';
|
|
10
|
+
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
11
11
|
|
|
12
12
|
class GridObstacle {
|
|
13
13
|
data = [1];
|
|
@@ -208,7 +208,7 @@ class GridObstacle {
|
|
|
208
208
|
toJSON() {
|
|
209
209
|
return {
|
|
210
210
|
size: this.size.toJSON(),
|
|
211
|
-
data: this.data
|
|
211
|
+
data: Array.from(this.data) //make sure to force it to Array type for JSON serialization to work correctly
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridCellActionPlaceTags.d.ts","sourceRoot":"","sources":["../../../../../src/generation/placement/action/GridCellActionPlaceTags.js"],"names":[],"mappings":"AAKA;IAsCI;;;;;OAKG;IACH,mBAJW,MAAM,SACN,MAAM,GACJ,uBAAuB,CAgBnC;IAxDD;;;OAGG;IACH,kBAFmB,MAAM,QAAE,MAAM,KAAG,MAAM,CAEpB;IAEtB;;;OAGG;IACH,MAFU,SAAS,CAEc;IAEjC;;;OAGG;IACH,SAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,gBAAe;IAGf,uCAQC;IAwBD;;;OAGG;IACH,WAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAIhB;IAED;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"GridCellActionPlaceTags.d.ts","sourceRoot":"","sources":["../../../../../src/generation/placement/action/GridCellActionPlaceTags.js"],"names":[],"mappings":"AAKA;IAsCI;;;;;OAKG;IACH,mBAJW,MAAM,SACN,MAAM,GACJ,uBAAuB,CAgBnC;IAxDD;;;OAGG;IACH,kBAFmB,MAAM,QAAE,MAAM,KAAG,MAAM,CAEpB;IAEtB;;;OAGG;IACH,MAFU,SAAS,CAEc;IAEjC;;;OAGG;IACH,SAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,gBAAe;IAGf,uCAQC;IAwBD;;;OAGG;IACH,WAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAIhB;IAED;;OAEG;IACH,wDA2CC;CACJ;+BAhI8B,qBAAqB;0BAD1B,uDAAuD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GridCellAction } from "./GridCellAction.js";
|
|
2
|
-
import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
1
|
import { assert } from "../../../core/assert.js";
|
|
4
2
|
import { bitwiseOr } from "../../../core/binary/operations/bitwiseOr.js";
|
|
3
|
+
import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
4
|
+
import { GridCellAction } from "./GridCellAction.js";
|
|
5
5
|
|
|
6
6
|
export class GridCellActionPlaceTags extends GridCellAction {
|
|
7
7
|
|
|
@@ -99,8 +99,6 @@ export class GridCellActionPlaceTags extends GridCellAction {
|
|
|
99
99
|
for (let local_y = 0; local_y < height; local_y++) {
|
|
100
100
|
for (let local_x = 0; local_x < width; local_x++) {
|
|
101
101
|
|
|
102
|
-
//read the tag value
|
|
103
|
-
const cell_tags = tags.readChannel(local_x, local_y, 0);
|
|
104
102
|
|
|
105
103
|
//rotate rule position
|
|
106
104
|
const rotated_local_x = local_x * cos - local_y * sin
|
|
@@ -110,6 +108,19 @@ export class GridCellActionPlaceTags extends GridCellAction {
|
|
|
110
108
|
const target_x = Math.round(rotated_local_x + x);
|
|
111
109
|
const target_y = Math.round(rotated_local_y + y);
|
|
112
110
|
|
|
111
|
+
if (
|
|
112
|
+
target_x < 0
|
|
113
|
+
|| target_x >= sampler.width
|
|
114
|
+
|| target_y < 0
|
|
115
|
+
|| target_y >= sampler.height
|
|
116
|
+
) {
|
|
117
|
+
// out of bounds
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//read the tag value
|
|
122
|
+
const cell_tags = tags.readChannel(local_x, local_y, 0);
|
|
123
|
+
|
|
113
124
|
const source = sampler.readChannel(target_x, target_y, 0);
|
|
114
125
|
|
|
115
126
|
const result = this.operation(source, cell_tags);
|