@woosh/meep-engine 2.126.66 → 2.126.68
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/README.md +1 -1
- package/package.json +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.js +0 -2
- package/src/core/geom/3d/aabb/aabb3_array_set.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_set.js +7 -2
- package/src/core/math/min2.d.ts +1 -1
- package/src/core/math/min2.js +1 -1
- package/src/core/math/spline/spline3_hermite_nearest_point.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_nearest_point.js +2 -0
- package/src/core/model/DebouncedObservedBoolean.d.ts +2 -1
- package/src/core/model/DebouncedObservedBoolean.d.ts.map +1 -1
- package/src/core/model/DebouncedObservedBoolean.js +1 -1
- package/src/core/process/worker/OnDemandWorkerManager.d.ts +9 -3
- package/src/core/process/worker/OnDemandWorkerManager.d.ts.map +1 -1
- package/src/core/process/worker/OnDemandWorkerManager.js +23 -17
- package/src/core/process/worker/WorkerProxy.d.ts +12 -1
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +23 -10
- package/src/engine/asset/AssetManager.d.ts.map +1 -1
- package/src/engine/asset/AssetManager.js +4 -0
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts +11 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +4 -0
- package/src/engine/asset/loaders/image/codec/Codec.d.ts +8 -7
- package/src/engine/asset/loaders/image/codec/Codec.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/Codec.js +7 -1
- package/src/engine/asset/loaders/image/codec/CodecWithFallback.d.ts +16 -5
- package/src/engine/asset/loaders/image/codec/CodecWithFallback.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/CodecWithFallback.js +34 -2
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts +5 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +11 -8
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts +1 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +7 -1
- package/src/engine/graphics/geometry/skining/meshFromSkinnedMesh.d.ts +8 -0
- package/src/engine/graphics/geometry/skining/meshFromSkinnedMesh.d.ts.map +1 -0
- package/src/engine/graphics/geometry/skining/meshFromSkinnedMesh.js +39 -0
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +2 -1
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
- package/src/engine/logging/elastic/ElasticSearchLogger.js +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ To help get you started, various samples are provided under `/samples` folder. F
|
|
|
13
13
|
|
|
14
14
|
## Quality
|
|
15
15
|
|
|
16
|
-
Meep is covered by 2,
|
|
16
|
+
Meep is covered by 2,790 handwritten unit tests
|
|
17
17
|
|
|
18
18
|
The aim is to [ensure quality](https://about.codecov.io/blog/the-case-against-100-code-coverage/). As a result, the tests are written to cover complex code first and to exhaustively validate critical algorithms.
|
|
19
19
|
Most of the test code is significantly larger than the code that is being tested.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.126.
|
|
8
|
+
"version": "2.126.68",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,
|
|
1
|
+
{"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,QA8ChB"}
|
|
@@ -22,12 +22,10 @@ export function aabb3_array_combine(
|
|
|
22
22
|
assert.isNumber(a_offset,'a_offset');
|
|
23
23
|
assert.notNaN(a_offset,'a_offset');
|
|
24
24
|
assert.isNonNegativeInteger(a_offset, 'a_offset');
|
|
25
|
-
assert.lessThanOrEqual(a_offset, a.length - 6, 'a_offset array overflow');
|
|
26
25
|
|
|
27
26
|
assert.isNumber(b_offset,'b_offset');
|
|
28
27
|
assert.notNaN(a_offset,'b_offset');
|
|
29
28
|
assert.isNonNegativeInteger(b_offset, 'b_offset');
|
|
30
|
-
assert.lessThanOrEqual(b_offset, b.length - 6, 'b_offset array overflow');
|
|
31
29
|
|
|
32
30
|
const ax0 = a[a_offset + 0];
|
|
33
31
|
const ay0 = a[a_offset + 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_array_set.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_set.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wCATW,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,MAAM,EAAE,iBACvC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,
|
|
1
|
+
{"version":3,"file":"aabb3_array_set.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_set.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wCATW,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,MAAM,EAAE,iBACvC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAsBhB"}
|
|
@@ -16,8 +16,13 @@ export function aabb3_array_set(
|
|
|
16
16
|
x0, y0, z0,
|
|
17
17
|
x1, y1, z1
|
|
18
18
|
) {
|
|
19
|
-
|
|
20
|
-
assert.
|
|
19
|
+
assert.isNonNegativeInteger(result_offset, 'result_offset');
|
|
20
|
+
assert.isNumber(x0, 'x0');
|
|
21
|
+
assert.isNumber(y0, 'y0');
|
|
22
|
+
assert.isNumber(z0, 'z0');
|
|
23
|
+
assert.isNumber(x1, 'x1');
|
|
24
|
+
assert.isNumber(y1, 'y1');
|
|
25
|
+
assert.isNumber(z1, 'z1');
|
|
21
26
|
|
|
22
27
|
result[result_offset] = x0;
|
|
23
28
|
result[result_offset + 1] = y0;
|
package/src/core/math/min2.d.ts
CHANGED
package/src/core/math/min2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spline3_hermite_nearest_point.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_nearest_point.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;GAYG;AACH,qDARW,MAAM,SACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"spline3_hermite_nearest_point.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_nearest_point.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;GAYG;AACH,qDARW,MAAM,SACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAyFlB"}
|
|
@@ -90,6 +90,8 @@ export function spline3_hermite_nearest_point(
|
|
|
90
90
|
for (let j = NEWTON_STEPS; j > 0; j--) {
|
|
91
91
|
|
|
92
92
|
const f_t = polyval(quintic_coeffs, t, 6);
|
|
93
|
+
|
|
94
|
+
// derivative of the polynomial we are finding the root of
|
|
93
95
|
const fp_t = polyval(quartic_coeffs, t, 5);
|
|
94
96
|
|
|
95
97
|
if (Math.abs(fp_t) < tolerance) {
|
|
@@ -17,7 +17,7 @@ export class DebouncedObservedBoolean extends ObservedBoolean {
|
|
|
17
17
|
constructor(source: ObservedBoolean, time: number, mode?: DebouncedObservedBooleanMode | number);
|
|
18
18
|
__source: ObservedBoolean;
|
|
19
19
|
time: number;
|
|
20
|
-
|
|
20
|
+
__timeout_ms: any;
|
|
21
21
|
mode: number;
|
|
22
22
|
link(): void;
|
|
23
23
|
unlink(): void;
|
|
@@ -26,6 +26,7 @@ export class DebouncedObservedBoolean extends ObservedBoolean {
|
|
|
26
26
|
* @private
|
|
27
27
|
*/
|
|
28
28
|
private __clearTimeout;
|
|
29
|
+
__timeout: NodeJS.Timer;
|
|
29
30
|
/**
|
|
30
31
|
*
|
|
31
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebouncedObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/DebouncedObservedBoolean.js"],"names":[],"mappings":"2CAYU,MAAM;;;;;;AAQhB;;GAEG;AACH;IACI;;;;;OAKG;IACH,oBAJW,eAAe,QACf,MAAM,SACN,4BAA4B,GAAC,MAAM,EAY7C;IAPG,0BAAsB;IAEtB,aAAgB;IAEhB,
|
|
1
|
+
{"version":3,"file":"DebouncedObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/DebouncedObservedBoolean.js"],"names":[],"mappings":"2CAYU,MAAM;;;;;;AAQhB;;GAEG;AACH;IACI;;;;;OAKG;IACH,oBAJW,eAAe,QACf,MAAM,SACN,4BAA4B,GAAC,MAAM,EAY7C;IAPG,0BAAsB;IAEtB,aAAgB;IAEhB,kBAAwB;IAExB,aAAgB;IAGpB,aAGC;IAED,eAGC;IAGD;;;OAGG;IACH,uBAKC;IAFO,wBAAqB;IAI7B;;OAEG;IACH,0BAOC;IAED;;;OAGG;IACH,OAFW,OAAO,QAYjB;IAED;;;;;OAKG;IACH,6BAYC;CAMJ;4BAhH2B,sBAAsB"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker manager that will terminate the worker after a timeout if it is idle.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
1
5
|
export class OnDemandWorkerManager {
|
|
2
6
|
/**
|
|
3
7
|
*
|
|
@@ -16,7 +20,7 @@ export class OnDemandWorkerManager {
|
|
|
16
20
|
* @type {number}
|
|
17
21
|
* @private
|
|
18
22
|
*/
|
|
19
|
-
private
|
|
23
|
+
private __timeout_ms;
|
|
20
24
|
/**
|
|
21
25
|
* ID of the timer set via setTimeout
|
|
22
26
|
* @type {number}
|
|
@@ -28,7 +32,9 @@ export class OnDemandWorkerManager {
|
|
|
28
32
|
*/
|
|
29
33
|
worker: WorkerProxy;
|
|
30
34
|
/**
|
|
31
|
-
* Configure how long to wait after processing a request until deciding to shut down the worker
|
|
35
|
+
* Configure how long to wait after processing a request until deciding to shut down the worker.
|
|
36
|
+
* The browser limits the number of workers we can have open at once, so releasing them when not in use is critical.
|
|
37
|
+
*
|
|
32
38
|
* @param {number} delay_ms In milliseconds
|
|
33
39
|
*/
|
|
34
40
|
setTimeout(delay_ms: number): void;
|
|
@@ -54,7 +60,7 @@ export class OnDemandWorkerManager {
|
|
|
54
60
|
*/
|
|
55
61
|
private increment;
|
|
56
62
|
/**
|
|
57
|
-
* Submit request to the worker
|
|
63
|
+
* Submit a request to the worker
|
|
58
64
|
* @template T
|
|
59
65
|
* @param {string} name
|
|
60
66
|
* @param {Array} [parameters]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnDemandWorkerManager.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/OnDemandWorkerManager.js"],"names":[],"mappings":"AAEA;IAwBI;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"OnDemandWorkerManager.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/OnDemandWorkerManager.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAwBI;;;OAGG;IACH,iCAOC;IAjCD;;;;OAIG;IACH,wBAAoB;IAEpB;;;;;OAKG;IACH,qBAAoB;IAEpB;;;;OAIG;IACH,8BAA2B;IASvB;;OAEG;IACH,oBAAoB;IAGxB;;;;;OAKG;IACH,qBAFW,MAAM,QAMhB;IAED;;OAEG;IACH,kBAKC;IAED;;OAEG;IACH,mCASC;IAED;;;OAGG;IACH,6BAFW,MAAM,QAMhB;IAED;;OAEG;IACH,kBAMC;IAED;;OAEG;IACH,kBAeC;IAGD;;;;;;OAMG;IACH,iBAJW,MAAM,kCAahB;CACJ"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Worker manager that will terminate the worker after a timeout if it is idle.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
3
7
|
export class OnDemandWorkerManager {
|
|
4
8
|
|
|
5
9
|
/**
|
|
@@ -15,7 +19,7 @@ export class OnDemandWorkerManager {
|
|
|
15
19
|
* @type {number}
|
|
16
20
|
* @private
|
|
17
21
|
*/
|
|
18
|
-
|
|
22
|
+
__timeout_ms = 1000;
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* ID of the timer set via setTimeout
|
|
@@ -29,6 +33,8 @@ export class OnDemandWorkerManager {
|
|
|
29
33
|
* @param {WorkerProxy} worker
|
|
30
34
|
*/
|
|
31
35
|
constructor(worker) {
|
|
36
|
+
assert.defined(worker, 'worker');
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* @type {WorkerProxy}
|
|
34
40
|
*/
|
|
@@ -36,13 +42,15 @@ export class OnDemandWorkerManager {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
|
-
* Configure how long to wait after processing a request until deciding to shut down the worker
|
|
45
|
+
* Configure how long to wait after processing a request until deciding to shut down the worker.
|
|
46
|
+
* The browser limits the number of workers we can have open at once, so releasing them when not in use is critical.
|
|
47
|
+
*
|
|
40
48
|
* @param {number} delay_ms In milliseconds
|
|
41
49
|
*/
|
|
42
50
|
setTimeout(delay_ms) {
|
|
43
|
-
assert.isNonNegativeInteger(delay_ms, '
|
|
51
|
+
assert.isNonNegativeInteger(delay_ms, 'delay_ms');
|
|
44
52
|
|
|
45
|
-
this.
|
|
53
|
+
this.__timeout_ms = delay_ms;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
/**
|
|
@@ -60,13 +68,13 @@ export class OnDemandWorkerManager {
|
|
|
60
68
|
*/
|
|
61
69
|
cancelScheduledTermination() {
|
|
62
70
|
|
|
63
|
-
if (this.__pending_termination
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.__pending_termination = -1;
|
|
68
|
-
|
|
71
|
+
if (this.__pending_termination < 0) {
|
|
72
|
+
// no pending termination
|
|
73
|
+
return;
|
|
69
74
|
}
|
|
75
|
+
|
|
76
|
+
clearInterval(this.__pending_termination);
|
|
77
|
+
this.__pending_termination = -1;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
/**
|
|
@@ -86,7 +94,7 @@ export class OnDemandWorkerManager {
|
|
|
86
94
|
this.__request_count--;
|
|
87
95
|
|
|
88
96
|
if (this.__request_count <= 0 && this.worker.isRunning()) {
|
|
89
|
-
this.scheduleTermination(this.
|
|
97
|
+
this.scheduleTermination(this.__timeout_ms);
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
|
|
@@ -102,19 +110,17 @@ export class OnDemandWorkerManager {
|
|
|
102
110
|
|
|
103
111
|
this.worker.start();
|
|
104
112
|
|
|
105
|
-
} else
|
|
106
|
-
|
|
107
|
-
// worker is up, but we're in the termination timeout period, lets clear that
|
|
113
|
+
} else {
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
this.
|
|
115
|
+
// worker is up, ensure we're not waiting for it to terminate
|
|
116
|
+
this.cancelScheduledTermination();
|
|
111
117
|
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
|
|
116
122
|
/**
|
|
117
|
-
* Submit request to the worker
|
|
123
|
+
* Submit a request to the worker
|
|
118
124
|
* @template T
|
|
119
125
|
* @param {string} name
|
|
120
126
|
* @param {Array} [parameters]
|
|
@@ -8,7 +8,7 @@ declare class WorkerProxy {
|
|
|
8
8
|
constructor(url: string, methods: any);
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* @type {{}}
|
|
11
|
+
* @type {Object<Array<{id:number, parameters:[], resolve: function, reject:function}>>}
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
14
|
private __pending;
|
|
@@ -60,6 +60,10 @@ declare class WorkerProxy {
|
|
|
60
60
|
*/
|
|
61
61
|
private __handleMessage;
|
|
62
62
|
isRunning(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Stop the worker.
|
|
65
|
+
* If the worker is not running, this method does nothing.
|
|
66
|
+
*/
|
|
63
67
|
stop(): void;
|
|
64
68
|
/**
|
|
65
69
|
*
|
|
@@ -69,6 +73,13 @@ declare class WorkerProxy {
|
|
|
69
73
|
*/
|
|
70
74
|
cancelRequest(id: number, method_name: string): boolean;
|
|
71
75
|
sendPendingRequests(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Start the worker.
|
|
78
|
+
* Any requests made while the worker is not running will be queued and sent once the worker is started.
|
|
79
|
+
*
|
|
80
|
+
* If the worker is already running, this method does nothing.
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
72
83
|
start(): void;
|
|
73
84
|
}
|
|
74
85
|
//# sourceMappingURL=WorkerProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";AAsCA;IAiCI;;;;OAIG;IACH,iBAHW,MAAM,gBAQhB;IAzCD;;;;OAIG;IACH,kBAAe;IAEf,qBAAoB;IAEpB;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,qBAAiB;IAEjB;;;;;OAKG;IACH,eAAiB;IAQb,YAAc;IACd,aAAsB;IAK1B;;;;;;OAMG;IACH,wBAJW,MAAM,2BAkDhB;IAED;;;;OAIG;IACH,qBAgBC;IAED;;;OAGG;IACH,sBAQC;IAED;;;;OAIG;IACH,wBAqCC;IAED,qBAEC;IAED;;;OAGG;IACH,aAOC;IAED;;;;;OAKG;IACH,kBAJW,MAAM,eACN,MAAM,GACJ,OAAO,CAkCnB;IAED,4BAmBC;IAED;;;;;;OAMG;IACH,cAoBC;CACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
|
+
import { array_remove_first } from "../../collection/array/array_remove_first.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
*
|
|
@@ -39,7 +40,7 @@ class WorkerProxy {
|
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
*
|
|
42
|
-
* @type {{}}
|
|
43
|
+
* @type {Object<Array<{id:number, parameters:[], resolve: function, reject:function}>>}
|
|
43
44
|
* @private
|
|
44
45
|
*/
|
|
45
46
|
__pending = {};
|
|
@@ -127,10 +128,9 @@ class WorkerProxy {
|
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
if (!trySendMessage(this.__worker, message)) {
|
|
130
|
-
//failed to send message
|
|
131
|
-
//drop pending request
|
|
132
|
-
|
|
133
|
-
pending.splice(i, 1);
|
|
131
|
+
// failed to send the message
|
|
132
|
+
// drop the pending request
|
|
133
|
+
array_remove_first(pending, request);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
});
|
|
@@ -148,12 +148,13 @@ class WorkerProxy {
|
|
|
148
148
|
throw new Error(`Method '${name}' already defined`);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
// initialize the pending request queue for this method
|
|
151
152
|
this.__pending[name] = [];
|
|
152
153
|
|
|
153
154
|
const proxy = this;
|
|
154
155
|
|
|
155
|
-
this[name] = function () {
|
|
156
|
-
return proxy.$submitRequest(name,
|
|
156
|
+
this[name] = function (...args) {
|
|
157
|
+
return proxy.$submitRequest(name, args);
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
}
|
|
@@ -220,6 +221,10 @@ class WorkerProxy {
|
|
|
220
221
|
return this.__isRunning;
|
|
221
222
|
}
|
|
222
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Stop the worker.
|
|
226
|
+
* If the worker is not running, this method does nothing.
|
|
227
|
+
*/
|
|
223
228
|
stop() {
|
|
224
229
|
if (!this.__isRunning) {
|
|
225
230
|
//not running
|
|
@@ -254,14 +259,14 @@ class WorkerProxy {
|
|
|
254
259
|
|
|
255
260
|
|
|
256
261
|
if (!this.__isRunning) {
|
|
257
|
-
//not running, simply cut from the queue
|
|
262
|
+
// not running, simply cut from the queue
|
|
258
263
|
|
|
259
264
|
requestQueue.splice(i, 1);
|
|
260
265
|
|
|
261
266
|
return true;
|
|
262
267
|
} else {
|
|
263
|
-
//worker is running, send termination request for this ID
|
|
264
|
-
throw new Error('Ability to cancel pending requests while worker is running is not implemented
|
|
268
|
+
// worker is running, send a termination request for this ID
|
|
269
|
+
throw new Error('Ability to cancel pending requests while worker is running is not implemented');
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
}
|
|
@@ -290,6 +295,13 @@ class WorkerProxy {
|
|
|
290
295
|
}
|
|
291
296
|
}
|
|
292
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Start the worker.
|
|
300
|
+
* Any requests made while the worker is not running will be queued and sent once the worker is started.
|
|
301
|
+
*
|
|
302
|
+
* If the worker is already running, this method does nothing.
|
|
303
|
+
*
|
|
304
|
+
*/
|
|
293
305
|
start() {
|
|
294
306
|
if (this.__isRunning) {
|
|
295
307
|
//already running
|
|
@@ -299,6 +311,7 @@ class WorkerProxy {
|
|
|
299
311
|
this.__worker = new Worker(this.url,{
|
|
300
312
|
name: this.__name
|
|
301
313
|
});
|
|
314
|
+
|
|
302
315
|
this.__worker.onmessage = this.__handleMessage;
|
|
303
316
|
|
|
304
317
|
// TODO attach proper error handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,
|
|
1
|
+
{"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,sBAmBhB;IA2QD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;OAIG;IACH,+BAHW,MAAM,4CAqBhB;IAED;;;;OAIG;IACH,iCAHW,MAAM,+CAyBhB;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,kCAEJ,QAAQ,OAAO,CAAC,CAU5B;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;OAMG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;;OAKG;IACH,eAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BAn3B2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
|
|
@@ -323,6 +323,10 @@ export class AssetManager {
|
|
|
323
323
|
* @param {Asset} asset
|
|
324
324
|
*/
|
|
325
325
|
insert(path, type, asset) {
|
|
326
|
+
assert.isString(path, 'path');
|
|
327
|
+
assert.isString(type, 'type');
|
|
328
|
+
assert.isObject(asset, 'asset');
|
|
329
|
+
|
|
326
330
|
const assetDescription = new AssetDescription(path, type);
|
|
327
331
|
|
|
328
332
|
const existing_resource = this.assets.get(assetDescription);
|
|
@@ -4,7 +4,17 @@ export class ImageRGBADataLoader extends AssetLoader<any, any> {
|
|
|
4
4
|
* @param {string} [worker_path] Path to decoder worker, allows flexibility in deployment
|
|
5
5
|
*/
|
|
6
6
|
constructor({ worker_path }?: string);
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {CodecWithFallback<{data, width:number, height:number, itemSize:number, bitDepth:number}>}
|
|
10
|
+
*/
|
|
11
|
+
decoder: CodecWithFallback<{
|
|
12
|
+
data;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
itemSize: number;
|
|
16
|
+
bitDepth: number;
|
|
17
|
+
}>;
|
|
8
18
|
link(assetManager: any, engine: any): Promise<void>;
|
|
9
19
|
/**
|
|
10
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageRGBADataLoader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/image/ImageRGBADataLoader.js"],"names":[],"mappings":"AAYA;IACI;;;OAGG;IACH,8BAFW,MAAM,
|
|
1
|
+
{"version":3,"file":"ImageRGBADataLoader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/image/ImageRGBADataLoader.js"],"names":[],"mappings":"AAYA;IACI;;;OAGG;IACH,8BAFW,MAAM,EAehB;IARG;;;OAGG;IACH,SAFU,kBAAkB;QAAC,IAAI,CAAC;QAAC,KAAK,EAAC,MAAM,CAAC;QAAC,MAAM,EAAC,MAAM,CAAC;QAAC,QAAQ,EAAC,MAAM,CAAC;QAAC,QAAQ,EAAC,MAAM,CAAA;KAAC,CAAC,CAKjG;IAGL,oDAOC;IAED;;;;;;OAMG;IACH,4BASC;IAED;;;;;;OAMG;IACH,mBAoBC;IAED,6EAiCC;CACJ;4BAtH2B,mBAAmB;kCACb,8BAA8B"}
|
|
@@ -20,6 +20,10 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
20
20
|
} = {}) {
|
|
21
21
|
super();
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @type {CodecWithFallback<{data, width:number, height:number, itemSize:number, bitDepth:number}>}
|
|
26
|
+
*/
|
|
23
27
|
this.decoder = new CodecWithFallback(
|
|
24
28
|
new ThreadedImageDecoder({ worker_path }),
|
|
25
29
|
new NativeImageDecoder()
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This is an abstract class, must be implemented by subclasses
|
|
3
|
+
*
|
|
4
|
+
* @template T
|
|
5
|
+
*/
|
|
6
|
+
export class Codec<T> {
|
|
2
7
|
/**
|
|
3
8
|
*
|
|
4
9
|
* @param {Uint8Array} data
|
|
5
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<T>}
|
|
6
11
|
*/
|
|
7
|
-
decode(data: Uint8Array): Promise<
|
|
8
|
-
data: Uint8Array;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}>;
|
|
12
|
+
decode(data: Uint8Array): Promise<T>;
|
|
12
13
|
/**
|
|
13
14
|
* Whether codec is able to decode this data, typically checks headers in the data
|
|
14
15
|
* @param {Uint8Array} data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Codec.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/Codec.js"],"names":[],"mappings":"AAAA;IACI;;;;OAIG;IACH,aAHW,UAAU,GACR,QAAQ
|
|
1
|
+
{"version":3,"file":"Codec.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/Codec.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;IACI;;;;OAIG;IACH,aAHW,UAAU,GACR,QAAQ,CAAC,CAAC,CAKtB;IAED;;;;OAIG;IACH,WAHW,UAAU,GACT,QAAQ,OAAO,CAAC,CAI3B;CACJ"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an abstract class, must be implemented by subclasses
|
|
3
|
+
*
|
|
4
|
+
* @template T
|
|
5
|
+
*/
|
|
1
6
|
export class Codec {
|
|
2
7
|
/**
|
|
3
8
|
*
|
|
4
9
|
* @param {Uint8Array} data
|
|
5
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<T>}
|
|
6
11
|
*/
|
|
7
12
|
async decode(data) {
|
|
13
|
+
// need to implement in the subclass
|
|
8
14
|
throw new Error('Unsupported Operation');
|
|
9
15
|
}
|
|
10
16
|
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Codec that tries to decode data with multiple codecs in order.
|
|
3
|
+
*
|
|
4
|
+
* @template T
|
|
5
|
+
* @extends {Codec<T>}
|
|
6
|
+
*/
|
|
7
|
+
export class CodecWithFallback<T> extends Codec<T> {
|
|
2
8
|
/**
|
|
3
9
|
*
|
|
4
|
-
* @param {Codec} codecs
|
|
10
|
+
* @param {Codec<T>} codecs
|
|
5
11
|
*/
|
|
6
|
-
constructor(...codecs: Codec);
|
|
7
|
-
|
|
12
|
+
constructor(...codecs: Codec<T>);
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {Codec<T>[]}
|
|
16
|
+
*/
|
|
17
|
+
children: Codec<T>[];
|
|
8
18
|
test(data: any): Promise<boolean>;
|
|
9
|
-
decode(data: any): Promise<
|
|
19
|
+
decode(data: any): Promise<T>;
|
|
20
|
+
#private;
|
|
10
21
|
}
|
|
11
22
|
import { Codec } from "./Codec.js";
|
|
12
23
|
//# sourceMappingURL=CodecWithFallback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodecWithFallback.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/CodecWithFallback.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodecWithFallback.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/CodecWithFallback.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH;IAOI;;;OAGG;IACH,uBAFW,MAAM,CAAC,CAAC,EAclB;IAtBD;;;OAGG;IACH,UAFU,MAAM,CAAC,CAAC,EAAE,CAEP;IAgCb,kCAeC;IAED,8BAuCC;;CACJ;sBAtGqB,YAAY"}
|
|
@@ -1,20 +1,50 @@
|
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { array_push_if_unique } from "../../../../../core/collection/array/array_push_if_unique.js";
|
|
1
3
|
import { Codec } from "./Codec.js";
|
|
2
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Codec that tries to decode data with multiple codecs in order.
|
|
7
|
+
*
|
|
8
|
+
* @template T
|
|
9
|
+
* @extends {Codec<T>}
|
|
10
|
+
*/
|
|
3
11
|
export class CodecWithFallback extends Codec {
|
|
4
12
|
/**
|
|
5
13
|
*
|
|
6
|
-
* @
|
|
14
|
+
* @type {Codec<T>[]}
|
|
15
|
+
*/
|
|
16
|
+
children = []
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {Codec<T>} codecs
|
|
7
21
|
*/
|
|
8
22
|
constructor(...codecs) {
|
|
9
23
|
super();
|
|
10
24
|
|
|
11
|
-
|
|
25
|
+
assert.isArray(codecs, 'codecs');
|
|
26
|
+
|
|
27
|
+
for (const codec of codecs) {
|
|
28
|
+
this.#add(codec);
|
|
29
|
+
}
|
|
12
30
|
|
|
13
31
|
if (this.children.length < 1) {
|
|
14
32
|
throw new Error('At least one codec must be provided');
|
|
15
33
|
}
|
|
16
34
|
}
|
|
17
35
|
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {Codec<T>} codec
|
|
39
|
+
*/
|
|
40
|
+
#add(codec) {
|
|
41
|
+
assert.defined(codec, 'codec');
|
|
42
|
+
assert.isObject(codec, 'codec');
|
|
43
|
+
assert.isInstanceOf(codec, Codec, 'codec', 'Codec');
|
|
44
|
+
|
|
45
|
+
return array_push_if_unique(this.children, codec);
|
|
46
|
+
}
|
|
47
|
+
|
|
18
48
|
async test(data) {
|
|
19
49
|
const codecs = this.children;
|
|
20
50
|
const codec_count = codecs.length;
|
|
@@ -47,9 +77,11 @@ export class CodecWithFallback extends Codec {
|
|
|
47
77
|
const codec_supports_data = await codec.test(data);
|
|
48
78
|
|
|
49
79
|
if (!codec_supports_data) {
|
|
80
|
+
|
|
50
81
|
errors.push({
|
|
51
82
|
index: i, error: "Codec doesn't support this data"
|
|
52
83
|
});
|
|
84
|
+
|
|
53
85
|
continue;
|
|
54
86
|
}
|
|
55
87
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeImageDecoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/NativeImageDecoder.js"],"names":[],"mappings":"AA0BA;IACI;;;;;;OA2BC;CACJ;
|
|
1
|
+
{"version":3,"file":"NativeImageDecoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/NativeImageDecoder.js"],"names":[],"mappings":"AA0BA;;GAEG;AACH;;IACI;;;;;;OA2BC;CACJ;sBA1DqB,YAAY"}
|
|
@@ -6,24 +6,27 @@ import { Codec } from "./Codec.js";
|
|
|
6
6
|
* @returns {Uint8Array}
|
|
7
7
|
*/
|
|
8
8
|
function decode(img) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const width = img.width;
|
|
10
|
+
const height = img.height;
|
|
11
11
|
|
|
12
12
|
//
|
|
13
13
|
const canvas = document.createElement('canvas');
|
|
14
14
|
|
|
15
|
-
canvas.width =
|
|
16
|
-
canvas.height =
|
|
15
|
+
canvas.width = width;
|
|
16
|
+
canvas.height = height;
|
|
17
17
|
|
|
18
18
|
const context = canvas.getContext('2d');
|
|
19
19
|
|
|
20
|
-
context.drawImage(img, 0, 0,
|
|
20
|
+
context.drawImage(img, 0, 0, width, height);
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const image_data = context.getImageData(0, 0, width, height);
|
|
23
23
|
|
|
24
|
-
return
|
|
24
|
+
return image_data.data;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Uses the browser's native image decoder
|
|
29
|
+
*/
|
|
27
30
|
export class NativeImageDecoder extends Codec {
|
|
28
31
|
async decode(data) {
|
|
29
32
|
const image = new Image();
|
|
@@ -34,7 +37,7 @@ export class NativeImageDecoder extends Codec {
|
|
|
34
37
|
|
|
35
38
|
image.src = url;
|
|
36
39
|
|
|
37
|
-
// give browser a chance to decode image in async
|
|
40
|
+
// give the browser a chance to decode image in async
|
|
38
41
|
await image.decode();
|
|
39
42
|
|
|
40
43
|
const rgba_data = decode(image);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadedImageDecoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThreadedImageDecoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js"],"names":[],"mappings":"AAMA;IACI;;;OAGG;IACH,8BAFW,MAAM,EAwBhB;IARG;;;OAGG;IACH,QAFU,qBAAqB,CAE+B;IAMlE,kCAaC;IAED,gCAEC;CACJ;sBAjDqB,YAAY;sCAHI,6DAA6D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
1
2
|
import { OnDemandWorkerManager } from "../../../../../core/process/worker/OnDemandWorkerManager.js";
|
|
2
3
|
import WorkerBuilder from "../../../../../core/process/worker/WorkerBuilder.js";
|
|
3
4
|
import { PNG_HEADER_BYTES } from "../png/PNG_HEADER_BYTES.js";
|
|
@@ -10,7 +11,7 @@ export class ThreadedImageDecoder extends Codec {
|
|
|
10
11
|
*/
|
|
11
12
|
constructor({
|
|
12
13
|
worker_path = 'bundle-worker-image-decoder.js'
|
|
13
|
-
}={}) {
|
|
14
|
+
} = {}) {
|
|
14
15
|
|
|
15
16
|
super();
|
|
16
17
|
|
|
@@ -28,13 +29,18 @@ export class ThreadedImageDecoder extends Codec {
|
|
|
28
29
|
*/
|
|
29
30
|
this.worker = new OnDemandWorkerManager(workerBuilder.build());
|
|
30
31
|
|
|
32
|
+
// shut down worker if it's not used for a while
|
|
31
33
|
this.worker.setTimeout(1200);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
async test(data) {
|
|
37
|
+
assert.defined(data, 'data');
|
|
38
|
+
assert.notNull(data, 'data');
|
|
39
|
+
assert.isInstanceOf(data, Uint8Array, 'data', 'Uint8Array');
|
|
35
40
|
|
|
36
41
|
for (let i = 0; i < PNG_HEADER_BYTES.length; i++) {
|
|
37
42
|
if (data[i] !== PNG_HEADER_BYTES[i]) {
|
|
43
|
+
// only supports PNG
|
|
38
44
|
return false;
|
|
39
45
|
}
|
|
40
46
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rebuild skinned mesh as a regular mesh applying skinning in the process
|
|
3
|
+
* @param {SkinnedMesh} skinned
|
|
4
|
+
* @returns {Mesh}
|
|
5
|
+
*/
|
|
6
|
+
export function meshFromSkinnedMesh(skinned: SkinnedMesh): Mesh;
|
|
7
|
+
import { Mesh } from "three";
|
|
8
|
+
//# sourceMappingURL=meshFromSkinnedMesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meshFromSkinnedMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/skining/meshFromSkinnedMesh.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,2DAFa,IAAI,CAgChB;qBAtCoB,OAAO"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Mesh } from "three";
|
|
2
|
+
import { computeSkinnedMeshVertices } from "./computeSkinnedMeshVertices.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Rebuild skinned mesh as a regular mesh applying skinning in the process
|
|
6
|
+
* @param {SkinnedMesh} skinned
|
|
7
|
+
* @returns {Mesh}
|
|
8
|
+
*/
|
|
9
|
+
export function meshFromSkinnedMesh(skinned) {
|
|
10
|
+
|
|
11
|
+
const geometry = skinned.geometry;
|
|
12
|
+
|
|
13
|
+
const bakedGeometry = geometry.clone();
|
|
14
|
+
|
|
15
|
+
delete bakedGeometry.attributes.skinIndex;
|
|
16
|
+
delete bakedGeometry.attributes.skinWeight;
|
|
17
|
+
|
|
18
|
+
const positionAttribute = bakedGeometry.getAttribute("position");
|
|
19
|
+
const vertices = positionAttribute.array;
|
|
20
|
+
|
|
21
|
+
computeSkinnedMeshVertices(vertices, skinned);
|
|
22
|
+
|
|
23
|
+
const mesh = new Mesh(bakedGeometry, skinned.material);
|
|
24
|
+
|
|
25
|
+
mesh.position.copy(skinned.position);
|
|
26
|
+
mesh.rotation.copy(skinned.rotation);
|
|
27
|
+
mesh.scale.copy(skinned.scale);
|
|
28
|
+
|
|
29
|
+
//apply transform to each vertex
|
|
30
|
+
skinned.updateMatrix();
|
|
31
|
+
skinned.updateMatrixWorld(true);
|
|
32
|
+
|
|
33
|
+
const m4 = skinned.matrixWorld.clone();
|
|
34
|
+
m4.invert();
|
|
35
|
+
|
|
36
|
+
positionAttribute.applyMatrix4(m4);
|
|
37
|
+
|
|
38
|
+
return mesh;
|
|
39
|
+
}
|
|
@@ -38,7 +38,7 @@ export class ElasticSearchLogger extends LoggerBackend {
|
|
|
38
38
|
* @type {number}
|
|
39
39
|
* @private
|
|
40
40
|
*/
|
|
41
|
-
private
|
|
41
|
+
private __timeout_ms;
|
|
42
42
|
/**
|
|
43
43
|
*
|
|
44
44
|
* @type {any}
|
|
@@ -46,6 +46,7 @@ export class ElasticSearchLogger extends LoggerBackend {
|
|
|
46
46
|
*/
|
|
47
47
|
private __bound_flush;
|
|
48
48
|
flush(): void;
|
|
49
|
+
__timeout: number | NodeJS.Timer;
|
|
49
50
|
__prod(): void;
|
|
50
51
|
log(level: any, message: any): void;
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElasticSearchLogger.d.ts","sourceRoot":"","sources":["../../../../../src/engine/logging/elastic/ElasticSearchLogger.js"],"names":[],"mappings":"AAmCA;IACI;;;OAqDC;IA/CG;;;;OAIG;IACH,iBAA2B;IAE3B;;;;OAIG;IACH,qBAAuB;IACvB;;;;OAIG;IACH,wBAA2B;IAE3B;;;;OAIG;IACH,cAAgB;IAEhB;;;;OAIG;IACH,iBAAsB;IAEtB;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"ElasticSearchLogger.d.ts","sourceRoot":"","sources":["../../../../../src/engine/logging/elastic/ElasticSearchLogger.js"],"names":[],"mappings":"AAmCA;IACI;;;OAqDC;IA/CG;;;;OAIG;IACH,iBAA2B;IAE3B;;;;OAIG;IACH,qBAAuB;IACvB;;;;OAIG;IACH,wBAA2B;IAE3B;;;;OAIG;IACH,cAAgB;IAEhB;;;;OAIG;IACH,iBAAsB;IAEtB;;;;OAIG;IACH,qBAAsB;IAEtB;;;;OAIG;IACH,sBAA0C;IAG9C,cAuCC;IAlCO,iCAAmB;IAoC3B,eAOC;IAED,oCAUC;CACJ;8BAvJ6B,qBAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoggerBackend } from "../LoggerBackend.js";
|
|
2
1
|
import { Deque } from "../../../core/collection/queue/Deque.js";
|
|
2
|
+
import { LoggerBackend } from "../LoggerBackend.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
Transformer function to transform log data as provided by winston into
|
|
@@ -79,7 +79,7 @@ export class ElasticSearchLogger extends LoggerBackend {
|
|
|
79
79
|
* @type {number}
|
|
80
80
|
* @private
|
|
81
81
|
*/
|
|
82
|
-
this.
|
|
82
|
+
this.__timeout_ms = -1;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
*
|