@woosh/meep-engine 2.118.2 → 2.118.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/build/meep.cjs +30 -5
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +30 -5
- package/package.json +1 -1
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +2 -0
- package/src/engine/animation/async/TimeSeries.d.ts +5 -1
- package/src/engine/animation/async/TimeSeries.d.ts.map +1 -1
- package/src/engine/animation/async/TimeSeries.js +14 -2
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +5 -0
- package/src/engine/graphics/canvas/computeHtmlCanvasElementHash.d.ts +7 -0
- package/src/engine/graphics/canvas/computeHtmlCanvasElementHash.d.ts.map +1 -0
- package/src/engine/graphics/canvas/computeHtmlCanvasElementHash.js +12 -0
- package/src/engine/graphics/canvas/computeImageCanvasEquality.js +3 -1
- package/src/engine/graphics/texture/html_canvas_to_rendering_context2d_cached.d.ts +7 -0
- package/src/engine/graphics/texture/html_canvas_to_rendering_context2d_cached.d.ts.map +1 -0
- package/src/engine/graphics/texture/html_canvas_to_rendering_context2d_cached.js +20 -0
- package/src/engine/graphics/texture/html_canvas_to_sampler2d.d.ts.map +1 -1
- package/src/engine/graphics/texture/html_canvas_to_sampler2d.js +2 -11
package/build/meep.module.js
CHANGED
|
@@ -51201,18 +51201,28 @@ const context_cache = new WeakMap();
|
|
|
51201
51201
|
/**
|
|
51202
51202
|
*
|
|
51203
51203
|
* @param {HTMLCanvasElement} canvas
|
|
51204
|
-
* @returns {
|
|
51204
|
+
* @returns {CanvasRenderingContext2D}
|
|
51205
51205
|
*/
|
|
51206
|
-
function
|
|
51207
|
-
const width = canvas.width;
|
|
51208
|
-
const height = canvas.height;
|
|
51209
|
-
|
|
51206
|
+
function html_canvas_to_rendering_context2d_cached(canvas) {
|
|
51210
51207
|
let context = context_cache.get(canvas);
|
|
51211
51208
|
|
|
51212
51209
|
if (context === undefined) {
|
|
51213
51210
|
context = canvas.getContext("2d");
|
|
51214
51211
|
context_cache.set(canvas, context);
|
|
51215
51212
|
}
|
|
51213
|
+
return context;
|
|
51214
|
+
}
|
|
51215
|
+
|
|
51216
|
+
/**
|
|
51217
|
+
*
|
|
51218
|
+
* @param {HTMLCanvasElement} canvas
|
|
51219
|
+
* @returns {Sampler2D}
|
|
51220
|
+
*/
|
|
51221
|
+
function html_canvas_to_sampler2d(canvas) {
|
|
51222
|
+
const width = canvas.width;
|
|
51223
|
+
const height = canvas.height;
|
|
51224
|
+
|
|
51225
|
+
const context = html_canvas_to_rendering_context2d_cached(canvas);
|
|
51216
51226
|
|
|
51217
51227
|
const imageData = context.getImageData(0, 0, width, height);
|
|
51218
51228
|
|
|
@@ -76449,6 +76459,17 @@ function murmur3_32(key, seed) {
|
|
|
76449
76459
|
return h1 >>> 0;
|
|
76450
76460
|
}
|
|
76451
76461
|
|
|
76462
|
+
/**
|
|
76463
|
+
*
|
|
76464
|
+
* @param {HTMLCanvasElement} canvas
|
|
76465
|
+
* @returns {number}
|
|
76466
|
+
*/
|
|
76467
|
+
function computeHtmlCanvasElementHash(canvas) {
|
|
76468
|
+
const sampler = html_canvas_to_sampler2d(canvas);
|
|
76469
|
+
|
|
76470
|
+
return sampler.hash();
|
|
76471
|
+
}
|
|
76472
|
+
|
|
76452
76473
|
/**
|
|
76453
76474
|
* Guards against cases where ImageBitmap doesn't exist
|
|
76454
76475
|
* @param {*} image
|
|
@@ -76693,6 +76714,10 @@ function computeImageDataHash(image) {
|
|
|
76693
76714
|
|
|
76694
76715
|
result = computeStringHash(image.src);
|
|
76695
76716
|
|
|
76717
|
+
}else if(image instanceof HTMLCanvasElement) {
|
|
76718
|
+
|
|
76719
|
+
result = computeHtmlCanvasElementHash(image);
|
|
76720
|
+
|
|
76696
76721
|
}
|
|
76697
76722
|
|
|
76698
76723
|
let width = 0;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAiDjB;IAzCG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,MAFU,WAAW,CAE4D;IAEjF;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,UAFU,QAAQ,CAEqB;IAEvC;;;OAGG;IACH,IAFU;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAOxB;IAIL;;;OAGG;IACH,8BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,4BAFqB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAIrD;IAED;;;OAGG;IACH,6BAFqB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAIrD;IAGD;;;;OAIG;IACH,uDAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA+BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAgDhB;IAED;;OAEG;IACH,aAEC;IAED;;;OAGG;IACH,kBAFW,MAAM,QAsBhB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,gBACN,MAAM,SACN,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,gBACN,MAAM,GACJ,MAAM,CAmBlB;IAED;;;;OAIG;IACH,kBAHW,MAAM,aACN,MAAM,QAyBhB;IAED;;;;;;OAMG;IACH,kBAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,kBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,eAHW,MAAO,MAAM,CAAC,GACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../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IACH,cAHW,aAAa,GACX,OAAO,CAmCnB;IAED;;;;;OAKG;IACH,eAJW,MAAM,WACN,MAAM,EAAE,GACN,MAAM,EAAE,CAUpB;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,MAAM,EAAE,QAUlB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,iBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAetB;IAED;;OAEG;IACH,uBAIC;IAED;;OAEG;IACH,mBAEC;IAGL;;OAEG;IACH,gBAtHe,MAAM,WACN,MAAM,EAAE,KACN,MAAM,EAAE,CAoHK;IAC9B;;OAEG;IACH,gBA1Ge,MAAM,UACN,MAAM,EAAE,UAyGO;CAT7B;mBAlpBkB,+BAA+B"}
|
|
@@ -390,6 +390,8 @@ export class RowFirstTable {
|
|
|
390
390
|
* @returns {number} index of newly added row
|
|
391
391
|
*/
|
|
392
392
|
addRow(values) {
|
|
393
|
+
assert.isArrayLike(values, 'values');
|
|
394
|
+
|
|
393
395
|
const rowIndex = this.createEmptyRow();
|
|
394
396
|
|
|
395
397
|
this.spec.writeRowMethod(this.dataView, this.spec.bytesPerRecord * rowIndex, values);
|
|
@@ -33,7 +33,11 @@ export class TimeSeries<T> {
|
|
|
33
33
|
* @returns {number}
|
|
34
34
|
*/
|
|
35
35
|
get last_timestamp(): number;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {number[]} data
|
|
39
|
+
*/
|
|
40
|
+
validateNextSample(data: number[]): void;
|
|
37
41
|
/**
|
|
38
42
|
*
|
|
39
43
|
* @param {number[]} data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeries.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/async/TimeSeries.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH;IA+BI;;;;OAIG;IACH,4CAFW,MAAM,EAuChB;IAxED;;OAEG;IACH,MAFU,iBAAiB,CAEvB;IAEJ;;OAEG;IACH,OAFU,aAAa,CAElB;IAEL,0BAAsB;IAyHtB;;;;OAIG;IACH,8BAHW,MAAM,OAOhB;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,6BAWC;IAED,
|
|
1
|
+
{"version":3,"file":"TimeSeries.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/async/TimeSeries.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH;IA+BI;;;;OAIG;IACH,4CAFW,MAAM,EAuChB;IAxED;;OAEG;IACH,MAFU,iBAAiB,CAEvB;IAEJ;;OAEG;IACH,OAFU,aAAa,CAElB;IAEL,0BAAsB;IAyHtB;;;;OAIG;IACH,8BAHW,MAAM,OAOhB;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,6BAWC;IAED;;;OAGG;IACH,yBAFW,MAAM,EAAE,QAwBlB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAQlB;IAED;;;OAGG;IACH,mCAIC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,SACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,+BAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,EAAE,iBACR,MAAM,QACN,MAAM,QAuBhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,OAShB;;CAEJ;kCAzSiC,qDAAqD;8BADzD,iDAAiD"}
|
|
@@ -186,8 +186,14 @@ export class TimeSeries {
|
|
|
186
186
|
return table.readCellValue(record_count - 1, time_column);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @param {number[]} data
|
|
192
|
+
*/
|
|
189
193
|
validateNextSample(data) {
|
|
190
194
|
|
|
195
|
+
assert.isArrayLike(data, 'data');
|
|
196
|
+
|
|
191
197
|
const table = this.table;
|
|
192
198
|
const record_count = table.length;
|
|
193
199
|
|
|
@@ -195,8 +201,14 @@ export class TimeSeries {
|
|
|
195
201
|
const time_column = this.time_column_index;
|
|
196
202
|
const last_time = table.readCellValue(record_count - 1, time_column);
|
|
197
203
|
|
|
198
|
-
|
|
199
|
-
|
|
204
|
+
const record = data[time_column];
|
|
205
|
+
|
|
206
|
+
assert.isNumber(record, `data[${time_column}](time)`);
|
|
207
|
+
assert.notNaN(record, `data[${time_column}](time)`);
|
|
208
|
+
assert.isFiniteNumber(record, `data[${time_column}](time)`);
|
|
209
|
+
|
|
210
|
+
if (record <= last_time) {
|
|
211
|
+
throw new Error(`Sample.time[${time_column}] = ${record}, which is <= to previous time stamp(=${last_time}). Each sample's time stamp must be strictly greater than the previous one`);
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,CA0CjB;AA4CD;;;;GAIG;AACH,sCAHW,UAAQ,MAAM,OAAO,GACnB,MAAM,CAqClB"}
|
|
@@ -2,6 +2,7 @@ import { combine_hash } from "../../../../core/collection/array/combine_hash.js"
|
|
|
2
2
|
import { murmur3_32 } from "../../../../core/math/hash/murmur3_32.js";
|
|
3
3
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
4
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
|
+
import { computeHtmlCanvasElementHash } from "../../../graphics/canvas/computeHtmlCanvasElementHash.js";
|
|
5
6
|
import { isImageBitmap } from "../../../graphics/texture/isImageBitmap.js";
|
|
6
7
|
import { computeImageBitmapHash } from "./computeImageBitmapHash.js";
|
|
7
8
|
|
|
@@ -44,6 +45,10 @@ export function computeImageDataHash(image) {
|
|
|
44
45
|
|
|
45
46
|
result = computeStringHash(image.src);
|
|
46
47
|
|
|
48
|
+
}else if(image instanceof HTMLCanvasElement) {
|
|
49
|
+
|
|
50
|
+
result = computeHtmlCanvasElementHash(image);
|
|
51
|
+
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
let width = 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeHtmlCanvasElementHash.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/canvas/computeHtmlCanvasElementHash.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qDAHW,iBAAiB,GACf,MAAM,CAMlB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import html_canvas_to_sampler2d from "../texture/html_canvas_to_sampler2d.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {HTMLCanvasElement} canvas
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function computeHtmlCanvasElementHash(canvas) {
|
|
9
|
+
const sampler = html_canvas_to_sampler2d(canvas);
|
|
10
|
+
|
|
11
|
+
return sampler.hash();
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {HTMLCanvasElement} canvas
|
|
4
|
+
* @returns {CanvasRenderingContext2D}
|
|
5
|
+
*/
|
|
6
|
+
export function html_canvas_to_rendering_context2d_cached(canvas: HTMLCanvasElement): CanvasRenderingContext2D;
|
|
7
|
+
//# sourceMappingURL=html_canvas_to_rendering_context2d_cached.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html_canvas_to_rendering_context2d_cached.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/html_canvas_to_rendering_context2d_cached.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,kEAHW,iBAAiB,GACf,wBAAwB,CAUpC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @type {WeakMap<HTMLCanvasElement, CanvasRenderingContext2D>}
|
|
4
|
+
*/
|
|
5
|
+
const context_cache = new WeakMap();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLCanvasElement} canvas
|
|
10
|
+
* @returns {CanvasRenderingContext2D}
|
|
11
|
+
*/
|
|
12
|
+
export function html_canvas_to_rendering_context2d_cached(canvas) {
|
|
13
|
+
let context = context_cache.get(canvas);
|
|
14
|
+
|
|
15
|
+
if (context === undefined) {
|
|
16
|
+
context = canvas.getContext("2d");
|
|
17
|
+
context_cache.set(canvas, context);
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html_canvas_to_sampler2d.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/html_canvas_to_sampler2d.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"html_canvas_to_sampler2d.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/html_canvas_to_sampler2d.js"],"names":[],"mappings":";AAIA;;;;GAIG;AACH,kDAHW,iBAAiB,GACf,SAAS,CAcrB;0BApByB,wBAAwB"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
import { html_canvas_to_rendering_context2d_cached } from "./html_canvas_to_rendering_context2d_cached.js";
|
|
1
2
|
import { Sampler2D } from './sampler/Sampler2D.js';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @type {WeakMap<HTMLCanvasElement, CanvasRenderingContext2D>}
|
|
6
|
-
*/
|
|
7
|
-
const context_cache = new WeakMap();
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
*
|
|
@@ -15,12 +11,7 @@ function html_canvas_to_sampler2d(canvas) {
|
|
|
15
11
|
const width = canvas.width;
|
|
16
12
|
const height = canvas.height;
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (context === undefined) {
|
|
21
|
-
context = canvas.getContext("2d");
|
|
22
|
-
context_cache.set(canvas, context);
|
|
23
|
-
}
|
|
14
|
+
const context = html_canvas_to_rendering_context2d_cached(canvas);
|
|
24
15
|
|
|
25
16
|
const imageData = context.getImageData(0, 0, width, height);
|
|
26
17
|
|