@woosh/meep-engine 2.124.8 → 2.124.11
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/LICENSE +1 -0
- package/package.json +1 -1
- package/src/core/math/spline/spline_hermite3.d.ts +3 -0
- package/src/core/math/spline/spline_hermite3.d.ts.map +1 -1
- package/src/core/math/spline/spline_hermite3.js +3 -0
- package/src/core/model/ObservedBoolean.d.ts +4 -2
- package/src/core/model/ObservedBoolean.d.ts.map +1 -1
- package/src/core/model/ObservedBoolean.js +12 -4
- package/src/core/model/ObservedEnum.d.ts.map +1 -1
- package/src/core/model/ObservedEnum.js +9 -3
- package/src/core/model/ObservedString.d.ts +41 -16
- package/src/core/model/ObservedString.d.ts.map +1 -1
- package/src/core/model/ObservedString.js +60 -24
- package/src/core/model/ObservedValue.d.ts +2 -1
- package/src/core/model/ObservedValue.d.ts.map +1 -1
- package/src/core/model/ObservedValue.js +8 -3
- package/src/core/model/reactive/model/ReactiveExpression.d.ts.map +1 -1
- package/src/core/model/reactive/model/ReactiveExpression.js +17 -7
- package/src/core/path/PATH_SEPARATOR.d.ts +5 -1
- package/src/core/path/PATH_SEPARATOR.d.ts.map +1 -1
- package/src/core/path/PATH_SEPARATOR.js +4 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts +12 -2
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +73 -15
- package/src/engine/animation/curve/Keyframe.d.ts +3 -0
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +3 -0
- package/src/engine/animation/curve/animation_curve_optimize.d.ts +3 -0
- package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.js +13 -2
- package/src/engine/ecs/guid/UUID.d.ts +3 -1
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -1
- package/src/engine/ecs/guid/UUID.js +23 -21
- package/src/engine/ecs/name/Name.d.ts +6 -13
- package/src/engine/ecs/name/Name.d.ts.map +1 -1
- package/src/engine/ecs/name/Name.js +11 -25
package/LICENSE
CHANGED
|
@@ -7,6 +7,7 @@ For illustration purposes, this means that unless you have obtained a license, a
|
|
|
7
7
|
* You are NOT permitted to re-distribute this package
|
|
8
8
|
* You are NOT permitted to extend the code from this package
|
|
9
9
|
* You are NOT permitted to make use of this package for any purpose, commercial or otherwise
|
|
10
|
+
* You are NOT permitted to copy any parts of the source code
|
|
10
11
|
|
|
11
12
|
If you would like to use this package in any context, please contact me via email so we can arrange a license:
|
|
12
13
|
|
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.124.
|
|
8
|
+
"version": "2.124.11",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* @param {number} m0 first tangent (tangent exiting from first value)
|
|
8
8
|
* @param {number} m1 second tangent (tangent entering into second value)
|
|
9
9
|
* @return {number}
|
|
10
|
+
*
|
|
11
|
+
* @author Alex Goldring
|
|
12
|
+
* @copyright Company Named Limited (c) 2025
|
|
10
13
|
*/
|
|
11
14
|
export function spline_hermite3(t: number, p0: number, p1: number, m0: number, m1: number): number;
|
|
12
15
|
//# sourceMappingURL=spline_hermite3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spline_hermite3.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline_hermite3.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spline_hermite3.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline_hermite3.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,mCAVW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,MAAM,CAgBjB"}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* @param {number} m0 first tangent (tangent exiting from first value)
|
|
8
8
|
* @param {number} m1 second tangent (tangent entering into second value)
|
|
9
9
|
* @return {number}
|
|
10
|
+
*
|
|
11
|
+
* @author Alex Goldring
|
|
12
|
+
* @copyright Company Named Limited (c) 2025
|
|
10
13
|
*/
|
|
11
14
|
export function spline_hermite3(t, p0, p1, m0, m1) {
|
|
12
15
|
|
|
@@ -43,9 +43,11 @@ declare class ObservedBoolean extends Boolean {
|
|
|
43
43
|
hashCode(): number;
|
|
44
44
|
/**
|
|
45
45
|
*
|
|
46
|
-
* @param {function(boolean)} f
|
|
46
|
+
* @param {function(boolean,boolean)} f
|
|
47
|
+
* @param {*} [thisArg]
|
|
48
|
+
* @returns {this}
|
|
47
49
|
*/
|
|
48
|
-
process(f: (arg0: boolean) => any):
|
|
50
|
+
process(f: (arg0: boolean, arg1: boolean) => any, thisArg?: any): this;
|
|
49
51
|
/**
|
|
50
52
|
*
|
|
51
53
|
* @returns {Boolean}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedBoolean.js"],"names":[],"mappings":";AAGA;IAQI;;;;OAIG;IACH,mBAHW,OAAO,EAcjB;IAtBD;;;OAGG;IACH,oBAFU,MAAM,CAAC,OAAO,EAAC,OAAO,CAAC,CAER;IAYrB;;;;OAIG;IACH,gBAAoB;IAmBxB;;;;OAIG;IACH,WAHW,OAAO,GACL,eAAe,CAa3B;IAED,gBAEC;IAED,iBAEC;IAED;;;OAGG;IACH,YAFW,eAAe,QAIzB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CAInB;IAED;;;OAGG;IACH,YAFY,MAAM,CAIjB;IAED
|
|
1
|
+
{"version":3,"file":"ObservedBoolean.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedBoolean.js"],"names":[],"mappings":";AAGA;IAQI;;;;OAIG;IACH,mBAHW,OAAO,EAcjB;IAtBD;;;OAGG;IACH,oBAFU,MAAM,CAAC,OAAO,EAAC,OAAO,CAAC,CAER;IAYrB;;;;OAIG;IACH,gBAAoB;IAmBxB;;;;OAIG;IACH,WAHW,OAAO,GACL,eAAe,CAa3B;IAED,gBAEC;IAED,iBAEC;IAED;;;OAGG;IACH,YAFW,eAAe,QAIzB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CAInB;IAED;;;OAGG;IACH,YAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,WAJW,CAAS,IAAO,EAAP,OAAO,EAAC,IAAO,EAAP,OAAO,QAAC,YACzB,GAAC,GACC,IAAI,CAWhB;IAED;;;OAGG;IACH,oBAEC;IAED;;OAEG;IACH,eAEC;IAED,kBAEC;IAED,yBAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAKtB;IAeL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAlB1C;;eAIS,eAAe;cAMf,eAAe;;mBAjKN,4BAA4B"}
|
|
@@ -96,11 +96,19 @@ class ObservedBoolean extends Boolean {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
*
|
|
99
|
-
* @param {function(boolean)} f
|
|
99
|
+
* @param {function(boolean,boolean)} f
|
|
100
|
+
* @param {*} [thisArg]
|
|
101
|
+
* @returns {this}
|
|
100
102
|
*/
|
|
101
|
-
process(f) {
|
|
102
|
-
|
|
103
|
-
this.onChanged.add(f);
|
|
103
|
+
process(f, thisArg) {
|
|
104
|
+
|
|
105
|
+
this.onChanged.add(f, thisArg);
|
|
106
|
+
|
|
107
|
+
const v = this.__value;
|
|
108
|
+
|
|
109
|
+
f.call(thisArg, v, v);
|
|
110
|
+
|
|
111
|
+
return this;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedEnum.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedEnum.js"],"names":[],"mappings":";AAGA;IACI;;;;;OAKG;IACH,mBAJW,CAAC;;OAiBX;IATG;;;;OAIG;IACH,gBAAoB;IACpB;;MAA0B;IAE1B,0DAA6B;IAGjC;;;OAGG;IACH;;MAEC;IAED;;;;OAIG;IACH,WAHW,CAAC,GACC,YAAY,CAYxB;IAED;;;;OAIG;IACH,OAJa,CAAC,SACH,YAAY,CAAC,CAAC,CAAC,GACb,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,YAAY,QAItB;IAED;;;OAGG;IACH,YAFa,CAAC,CAIb;IAED,eAEC;IAED
|
|
1
|
+
{"version":3,"file":"ObservedEnum.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedEnum.js"],"names":[],"mappings":";AAGA;IACI;;;;;OAKG;IACH,mBAJW,CAAC;;OAiBX;IATG;;;;OAIG;IACH,gBAAoB;IACpB;;MAA0B;IAE1B,0DAA6B;IAGjC;;;OAGG;IACH;;MAEC;IAED;;;;OAIG;IACH,WAHW,CAAC,GACC,YAAY,CAYxB;IAED;;;;OAIG;IACH,OAJa,CAAC,SACH,YAAY,CAAC,CAAC,CAAC,GACb,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,YAAY,QAItB;IAED;;;OAGG;IACH,YAFa,CAAC,CAIb;IAED,eAEC;IAED;;;;;OAKG;IACH,mBAJW,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,QAAC,YACb,GAAC,GACC,IAAI,CAUhB;IAED,YAEC;IAED,yBAEC;CACJ;mBArGkB,4BAA4B"}
|
|
@@ -80,11 +80,17 @@ class ObservedEnum {
|
|
|
80
80
|
/**
|
|
81
81
|
*
|
|
82
82
|
* @param {function(T,T)} processor
|
|
83
|
+
* @param {*} [thisArg]
|
|
84
|
+
* @returns {this}
|
|
83
85
|
*/
|
|
84
|
-
process(processor) {
|
|
85
|
-
this.onChanged.add(processor);
|
|
86
|
+
process(processor, thisArg) {
|
|
87
|
+
this.onChanged.add(processor, thisArg);
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
const v = this.__value;
|
|
90
|
+
|
|
91
|
+
processor.call(thisArg, v, v);
|
|
92
|
+
|
|
93
|
+
return this;
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
toJSON() {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export default ObservedString;
|
|
2
2
|
/**
|
|
3
|
+
* Observable string container.
|
|
4
|
+
* Signals change via {@link onChanged}.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const name = new ObservedString("Alice")
|
|
8
|
+
* name.onChanged((new_name, old_name) => console.log(`Name changed from ${old_name} to ${new_name}!`));
|
|
9
|
+
* ...
|
|
10
|
+
* name.set("Barbara"); // will print "Name changed from Alice to Barbara!" in console
|
|
11
|
+
* name.getValue() === "Barbara"
|
|
3
12
|
*
|
|
4
13
|
* @author Alex Goldring
|
|
5
14
|
* @copyright Company Named Limited (c) 2025
|
|
@@ -7,20 +16,23 @@ export default ObservedString;
|
|
|
7
16
|
declare class ObservedString extends String {
|
|
8
17
|
/**
|
|
9
18
|
*
|
|
10
|
-
* @param {string} [value]
|
|
11
|
-
* @constructor
|
|
19
|
+
* @param {string} [value=""]
|
|
12
20
|
*/
|
|
13
21
|
constructor(value?: string);
|
|
14
22
|
/**
|
|
15
23
|
*
|
|
16
|
-
* @type {
|
|
24
|
+
* @type {string}
|
|
17
25
|
* @private
|
|
18
26
|
*/
|
|
19
27
|
private __value;
|
|
20
|
-
onChanged: Signal<any, any, any, any, any, any, any, any>;
|
|
21
28
|
/**
|
|
22
29
|
*
|
|
23
|
-
* @
|
|
30
|
+
* @type {Signal<string,string>}
|
|
31
|
+
*/
|
|
32
|
+
onChanged: Signal<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {string} value
|
|
24
36
|
* @returns {ObservedString}
|
|
25
37
|
*/
|
|
26
38
|
set(value: string): ObservedString;
|
|
@@ -30,33 +42,41 @@ declare class ObservedString extends String {
|
|
|
30
42
|
*/
|
|
31
43
|
copy(other: ObservedString): void;
|
|
32
44
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param {ObservedString} other
|
|
35
|
-
* @returns {boolean}
|
|
45
|
+
* @return {ObservedString}
|
|
36
46
|
*/
|
|
37
|
-
|
|
47
|
+
clone(): ObservedString;
|
|
38
48
|
/**
|
|
39
49
|
*
|
|
40
|
-
* @returns {
|
|
50
|
+
* @returns {string}
|
|
41
51
|
*/
|
|
42
52
|
getValue(): string;
|
|
43
53
|
/**
|
|
44
54
|
*
|
|
45
|
-
* @param {function} f
|
|
55
|
+
* @param {function(string,string)} f
|
|
56
|
+
* @param {*} [thisArg]
|
|
57
|
+
* @returns {this}
|
|
46
58
|
*/
|
|
47
|
-
process(f:
|
|
48
|
-
toJSON(): string;
|
|
49
|
-
fromJSON(obj: any): void;
|
|
59
|
+
process(f: (arg0: string, arg1: string) => any, thisArg?: any): this;
|
|
50
60
|
/**
|
|
51
|
-
*
|
|
61
|
+
* @deprecated use {@link buffer.writeUTF8String} directly instead
|
|
52
62
|
* @param {BinaryBuffer} buffer
|
|
53
63
|
*/
|
|
54
64
|
toBinaryBuffer(buffer: BinaryBuffer): void;
|
|
55
65
|
/**
|
|
56
|
-
*
|
|
66
|
+
* @deprecated use {@link buffer.readUTF8String} directly instead
|
|
57
67
|
* @param {BinaryBuffer} buffer
|
|
58
68
|
*/
|
|
59
69
|
fromBinaryBuffer(buffer: BinaryBuffer): void;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {ObservedString} other
|
|
73
|
+
* @returns {boolean}
|
|
74
|
+
*/
|
|
75
|
+
equals(other: ObservedString): boolean;
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @return {number}
|
|
79
|
+
*/
|
|
60
80
|
hash(): number;
|
|
61
81
|
/**
|
|
62
82
|
* Used for optimized "instanceof" check
|
|
@@ -64,6 +84,11 @@ declare class ObservedString extends String {
|
|
|
64
84
|
* @type {boolean}
|
|
65
85
|
*/
|
|
66
86
|
readonly isObservedString: boolean;
|
|
87
|
+
toJSON: () => string;
|
|
88
|
+
fromJSON: (value: string) => ObservedString;
|
|
89
|
+
}
|
|
90
|
+
declare namespace ObservedString {
|
|
91
|
+
let typeName: string;
|
|
67
92
|
}
|
|
68
93
|
import Signal from "../events/signal/Signal.js";
|
|
69
94
|
//# sourceMappingURL=ObservedString.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedString.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedString.js"],"names":[],"mappings":";AAIA
|
|
1
|
+
{"version":3,"file":"ObservedString.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedString.js"],"names":[],"mappings":";AAIA;;;;;;;;;;;;;GAaG;AACH;IACI;;;OAGG;IACH,oBAFW,MAAM,EAmBhB;IAZG;;;;OAIG;IACH,gBAAoB;IAEpB;;;OAGG;IACH,WAFU,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAEF;IAmBjC;;;;OAIG;IACH,WAHW,MAAM,GACJ,cAAc,CAa1B;IAED;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;OAEG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,WAJW,CAAS,IAAM,EAAN,MAAM,EAAC,IAAM,EAAN,MAAM,QAAC,YACvB,GAAC,GACC,IAAI,CAUhB;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAMtB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAInB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAGL;;;;OAIG;IACH,2BAFU,OAAO,CAEwB;IAUzC,cAtHiB,MAAM,CAsHQ;IAC/B,kBA/Ge,MAAM,KACJ,cAAc,CA8GE;CAlBhC;;kBAWS,MAAM;;mBAnKG,4BAA4B"}
|
|
@@ -3,6 +3,15 @@ import Signal from "../events/signal/Signal.js";
|
|
|
3
3
|
import { computeStringHash } from "../primitives/strings/computeStringHash.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
+
* Observable string container.
|
|
7
|
+
* Signals change via {@link onChanged}.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const name = new ObservedString("Alice")
|
|
11
|
+
* name.onChanged((new_name, old_name) => console.log(`Name changed from ${old_name} to ${new_name}!`));
|
|
12
|
+
* ...
|
|
13
|
+
* name.set("Barbara"); // will print "Name changed from Alice to Barbara!" in console
|
|
14
|
+
* name.getValue() === "Barbara"
|
|
6
15
|
*
|
|
7
16
|
* @author Alex Goldring
|
|
8
17
|
* @copyright Company Named Limited (c) 2025
|
|
@@ -10,8 +19,7 @@ import { computeStringHash } from "../primitives/strings/computeStringHash.js";
|
|
|
10
19
|
class ObservedString extends String {
|
|
11
20
|
/**
|
|
12
21
|
*
|
|
13
|
-
* @param {string} [value]
|
|
14
|
-
* @constructor
|
|
22
|
+
* @param {string} [value=""]
|
|
15
23
|
*/
|
|
16
24
|
constructor(value = "") {
|
|
17
25
|
super();
|
|
@@ -20,17 +28,21 @@ class ObservedString extends String {
|
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
30
|
*
|
|
23
|
-
* @type {
|
|
31
|
+
* @type {string}
|
|
24
32
|
* @private
|
|
25
33
|
*/
|
|
26
34
|
this.__value = value;
|
|
27
35
|
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {Signal<string,string>}
|
|
39
|
+
*/
|
|
28
40
|
this.onChanged = new Signal();
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
/**
|
|
32
44
|
*
|
|
33
|
-
* @returns {
|
|
45
|
+
* @returns {string}
|
|
34
46
|
*/
|
|
35
47
|
valueOf() {
|
|
36
48
|
return this.__value;
|
|
@@ -38,7 +50,7 @@ class ObservedString extends String {
|
|
|
38
50
|
|
|
39
51
|
/**
|
|
40
52
|
*
|
|
41
|
-
* @returns {
|
|
53
|
+
* @returns {string}
|
|
42
54
|
*/
|
|
43
55
|
toString() {
|
|
44
56
|
return this.__value;
|
|
@@ -46,7 +58,7 @@ class ObservedString extends String {
|
|
|
46
58
|
|
|
47
59
|
/**
|
|
48
60
|
*
|
|
49
|
-
* @param {
|
|
61
|
+
* @param {string} value
|
|
50
62
|
* @returns {ObservedString}
|
|
51
63
|
*/
|
|
52
64
|
set(value) {
|
|
@@ -71,17 +83,19 @@ class ObservedString extends String {
|
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @param {ObservedString} other
|
|
76
|
-
* @returns {boolean}
|
|
86
|
+
* @return {ObservedString}
|
|
77
87
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
clone() {
|
|
89
|
+
const r = new this.constructor();
|
|
90
|
+
|
|
91
|
+
r.copy(this);
|
|
92
|
+
|
|
93
|
+
return r;
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
/**
|
|
83
97
|
*
|
|
84
|
-
* @returns {
|
|
98
|
+
* @returns {string}
|
|
85
99
|
*/
|
|
86
100
|
getValue() {
|
|
87
101
|
return this.__value;
|
|
@@ -89,24 +103,22 @@ class ObservedString extends String {
|
|
|
89
103
|
|
|
90
104
|
/**
|
|
91
105
|
*
|
|
92
|
-
* @param {function} f
|
|
106
|
+
* @param {function(string,string)} f
|
|
107
|
+
* @param {*} [thisArg]
|
|
108
|
+
* @returns {this}
|
|
93
109
|
*/
|
|
94
|
-
process(f) {
|
|
95
|
-
|
|
110
|
+
process(f, thisArg) {
|
|
111
|
+
this.onChanged.add(f, thisArg);
|
|
96
112
|
|
|
97
|
-
this.
|
|
98
|
-
}
|
|
113
|
+
const v = this.getValue();
|
|
99
114
|
|
|
100
|
-
|
|
101
|
-
return this.__value;
|
|
102
|
-
}
|
|
115
|
+
f.call(thisArg, v, v);
|
|
103
116
|
|
|
104
|
-
|
|
105
|
-
this.set(obj);
|
|
117
|
+
return this;
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
/**
|
|
109
|
-
*
|
|
121
|
+
* @deprecated use {@link buffer.writeUTF8String} directly instead
|
|
110
122
|
* @param {BinaryBuffer} buffer
|
|
111
123
|
*/
|
|
112
124
|
toBinaryBuffer(buffer) {
|
|
@@ -114,7 +126,7 @@ class ObservedString extends String {
|
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
/**
|
|
117
|
-
*
|
|
129
|
+
* @deprecated use {@link buffer.readUTF8String} directly instead
|
|
118
130
|
* @param {BinaryBuffer} buffer
|
|
119
131
|
*/
|
|
120
132
|
fromBinaryBuffer(buffer) {
|
|
@@ -123,6 +135,19 @@ class ObservedString extends String {
|
|
|
123
135
|
this.set(value);
|
|
124
136
|
}
|
|
125
137
|
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param {ObservedString} other
|
|
141
|
+
* @returns {boolean}
|
|
142
|
+
*/
|
|
143
|
+
equals(other) {
|
|
144
|
+
return this.__value === other.__value;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @return {number}
|
|
150
|
+
*/
|
|
126
151
|
hash() {
|
|
127
152
|
return computeStringHash(this.__value);
|
|
128
153
|
}
|
|
@@ -135,4 +160,15 @@ class ObservedString extends String {
|
|
|
135
160
|
*/
|
|
136
161
|
ObservedString.prototype.isObservedString = true;
|
|
137
162
|
|
|
163
|
+
/**
|
|
164
|
+
* @readonly
|
|
165
|
+
* @type {string}
|
|
166
|
+
*/
|
|
167
|
+
ObservedString.typeName = "ObservedString";
|
|
168
|
+
|
|
169
|
+
// JSON methods
|
|
170
|
+
|
|
171
|
+
ObservedString.prototype.toJSON = ObservedString.prototype.toString;
|
|
172
|
+
ObservedString.prototype.fromJSON = ObservedString.prototype.set;
|
|
173
|
+
|
|
138
174
|
export default ObservedString;
|
|
@@ -49,9 +49,10 @@ declare class ObservedValue {
|
|
|
49
49
|
/**
|
|
50
50
|
* Convenience method, invoked given function with current value and registers onChanged callback
|
|
51
51
|
* @param {function} processor
|
|
52
|
+
* @param {*} [thisArg]
|
|
52
53
|
* @returns {ObservedValue.<T>}
|
|
53
54
|
*/
|
|
54
|
-
process(processor: Function): ObservedValue<T>;
|
|
55
|
+
process(processor: Function, thisArg?: any): ObservedValue<T>;
|
|
55
56
|
toString(): string;
|
|
56
57
|
toJSON(): T;
|
|
57
58
|
fromJSON(value: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedValue.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedValue.js"],"names":[],"mappings":";AAEA;IACI;;;;;OAKG;IACH,eAHW,CAAC,EAWX;IAPG,0DAA6B;IAC7B,WAAgB;IAChB;;;OAGG;IACH,UAFU,CAAC,MAAY,CAAC,CAAC,CAEkB;IAG/C;;;OAGG;IACH,WAFW,CAAC,QAQX;IAED;;;;OAIG;IACH,iBAHW,CAAC,QAKX;IAED;;;OAGG;IACH,OAFa,CAAC,CAIb;IAED;;;OAGG;IACH,YAFW,aAAa,QAIvB;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,aAAa,CAAE,CAAC,CAAC,CAI7B;IAED
|
|
1
|
+
{"version":3,"file":"ObservedValue.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedValue.js"],"names":[],"mappings":";AAEA;IACI;;;;;OAKG;IACH,eAHW,CAAC,EAWX;IAPG,0DAA6B;IAC7B,WAAgB;IAChB;;;OAGG;IACH,UAFU,CAAC,MAAY,CAAC,CAAC,CAEkB;IAG/C;;;OAGG;IACH,WAFW,CAAC,QAQX;IAED;;;;OAIG;IACH,iBAHW,CAAC,QAKX;IAED;;;OAGG;IACH,OAFa,CAAC,CAIb;IAED;;;OAGG;IACH,YAFW,aAAa,QAIvB;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,aAAa,CAAE,CAAC,CAAC,CAI7B;IAED;;;;;OAKG;IACH,uCAHW,GAAC,GACC,aAAa,CAAE,CAAC,CAAC,CAU7B;IAED,mBAIC;IAED,YAEC;IAED,2BAEC;CACJ;mBAtGkB,4BAA4B"}
|
|
@@ -74,11 +74,16 @@ class ObservedValue {
|
|
|
74
74
|
/**
|
|
75
75
|
* Convenience method, invoked given function with current value and registers onChanged callback
|
|
76
76
|
* @param {function} processor
|
|
77
|
+
* @param {*} [thisArg]
|
|
77
78
|
* @returns {ObservedValue.<T>}
|
|
78
79
|
*/
|
|
79
|
-
process(processor) {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
process(processor, thisArg) {
|
|
81
|
+
this.onChanged.add(processor, thisArg);
|
|
82
|
+
|
|
83
|
+
const v = this.__value;
|
|
84
|
+
|
|
85
|
+
processor.call(thisArg, v, v);
|
|
86
|
+
|
|
82
87
|
return this;
|
|
83
88
|
}
|
|
84
89
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,gCAFa,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,gCAFa,CAAC;IAIV;;;OAGG;IACH,oBAFU,MAAM,CAAC,CAAC,EAAC,CAAC,CAAC,CAEI;IAGzB,uBAEC;IAED,cAEC;IAED;;;;OAIG;IACH,wCAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;OAEG;IACH,YAFa,CAAC,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAInC;IAED;;;;OAIG;IACH,iCAFW,GAAC,QAIX;IAED;;;OAGG;IACH,mBAFY,MAAM,CAQjB;IAED;;;;;OAKG;IACH,iBAJW,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,QAAC,YACb,GAAC,GACC,IAAI,CAUhB;IAED;;;;OAIG;IACH,sBAFa,OAAO,GAAC,MAAM,GAAC,MAAM,CAIjC;IAGL,cAAqC;IAErC;;;OAGG;IACH,+BAFU,OAAO,CAEgC;CARhD;mBAzGkB,kCAAkC"}
|
|
@@ -6,9 +6,13 @@ import { computeStringHash } from "../../../primitives/strings/computeStringHash
|
|
|
6
6
|
* @template T
|
|
7
7
|
*/
|
|
8
8
|
export class ReactiveExpression {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @readonly
|
|
12
|
+
* @type {Signal<T,T>}
|
|
13
|
+
*/
|
|
14
|
+
onChanged = new Signal();
|
|
15
|
+
|
|
12
16
|
|
|
13
17
|
copy(other) {
|
|
14
18
|
throw new Error('Not Implemented');
|
|
@@ -77,12 +81,18 @@ export class ReactiveExpression {
|
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
83
|
*
|
|
80
|
-
* @param {function} handler
|
|
84
|
+
* @param {function(T,T)} handler
|
|
85
|
+
* @param {*} [thisArg]
|
|
86
|
+
* @returns {this}
|
|
81
87
|
*/
|
|
82
|
-
process(handler) {
|
|
83
|
-
|
|
88
|
+
process(handler, thisArg) {
|
|
89
|
+
this.onChanged.add(handler, thisArg);
|
|
90
|
+
|
|
91
|
+
const v = this.getValue();
|
|
92
|
+
|
|
93
|
+
handler.call(thisArg, v, v);
|
|
84
94
|
|
|
85
|
-
this
|
|
95
|
+
return this;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PATH_SEPARATOR.d.ts","sourceRoot":"","sources":["../../../../src/core/path/PATH_SEPARATOR.js"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"PATH_SEPARATOR.d.ts","sourceRoot":"","sources":["../../../../src/core/path/PATH_SEPARATOR.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,6BAFU,MAAM,CAEkB"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Describes change of a numeric value over time.
|
|
3
|
-
*
|
|
2
|
+
* Describes change of a numeric value over time.
|
|
3
|
+
* Values are stored in {@link Keyframe}s, interpolation is defined by tangents on {@link Keyframe}s.
|
|
4
|
+
* The curve is a cubic Hermite spline, see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
|
|
5
|
+
*
|
|
6
|
+
* @author Alex Goldring
|
|
7
|
+
* @copyright Company Named Limited (c) 2025
|
|
4
8
|
*/
|
|
5
9
|
export class AnimationCurve {
|
|
6
10
|
/**
|
|
@@ -81,6 +85,12 @@ export class AnimationCurve {
|
|
|
81
85
|
* @returns {number}
|
|
82
86
|
*/
|
|
83
87
|
get duration(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Returns index of a key that is just before or at the time specified.
|
|
90
|
+
* @param {number} time
|
|
91
|
+
* @returns {number} index of the key
|
|
92
|
+
*/
|
|
93
|
+
getKeyIndexByTime(time: number): number;
|
|
84
94
|
/**
|
|
85
95
|
*
|
|
86
96
|
* @param {number} time time in seconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAqBA
|
|
1
|
+
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH;IAkFI;;;;OAIG;IACH,kBAHW,QAAQ,EAAE,GACR,cAAc,CAQ1B;IAgRD;;;;;;;OAOG;IACH,6BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAUzB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,YACN,MAAM,UACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAYzB;IA9ZD;;;OAGG;IACH,eAFU,QAAQ,EAAE,CAEV;IAEV;;;;OAIG;IACH,SAHW,QAAQ,GACN,MAAM,CAgClB;IAED;;;OAGG;IACH,cAFW,QAAQ,EAAE,QAUpB;IAED;;;;OAIG;IACH,YAHW,QAAQ,GACN,OAAO,CAYnB;IAED;;OAEG;IACH,cAEC;IAeD;;;OAGG;IACH,cAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAYlB;IAED;;;OAGG;IACH,gBAFY,MAAM,CAYjB;IAED;;;OAGG;IACH,gBAFa,MAAM,CAelB;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,MAAM,CA0ClB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACL,MAAM,CAoCjB;IAED;;;;OAIG;IACH,qBAFW,MAAM,QAmChB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAWhB;IAED,0BAKC;IAED;;;;OAIG;IACH,cAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;MAIC;IAED;;aAeC;CAqDJ;yBApbwB,eAAe"}
|
|
@@ -20,8 +20,12 @@ function compareKeyframeToTime(time, keyframe) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Describes change of a numeric value over time.
|
|
24
|
-
*
|
|
23
|
+
* Describes change of a numeric value over time.
|
|
24
|
+
* Values are stored in {@link Keyframe}s, interpolation is defined by tangents on {@link Keyframe}s.
|
|
25
|
+
* The curve is a cubic Hermite spline, see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
|
|
26
|
+
*
|
|
27
|
+
* @author Alex Goldring
|
|
28
|
+
* @copyright Company Named Limited (c) 2025
|
|
25
29
|
*/
|
|
26
30
|
export class AnimationCurve {
|
|
27
31
|
/**
|
|
@@ -177,6 +181,53 @@ export class AnimationCurve {
|
|
|
177
181
|
return last.time - first.time;
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Returns index of a key that is just before or at the time specified.
|
|
186
|
+
* @param {number} time
|
|
187
|
+
* @returns {number} index of the key
|
|
188
|
+
*/
|
|
189
|
+
getKeyIndexByTime(time) {
|
|
190
|
+
const keys = this.keys;
|
|
191
|
+
const key_count = keys.length;
|
|
192
|
+
|
|
193
|
+
let i0 = 0;
|
|
194
|
+
let i1 = key_count - 1;
|
|
195
|
+
|
|
196
|
+
if (time <= keys[0].time) {
|
|
197
|
+
// before start
|
|
198
|
+
return 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// binary search
|
|
202
|
+
while (i0 <= i1) {
|
|
203
|
+
const pivot = (i0 + i1) >>> 1;
|
|
204
|
+
|
|
205
|
+
const key = keys[pivot];
|
|
206
|
+
const key_time = key.time;
|
|
207
|
+
|
|
208
|
+
if (key_time < time) {
|
|
209
|
+
i0 = pivot + 1;
|
|
210
|
+
} else if (key_time > time) {
|
|
211
|
+
i1 = pivot - 1;
|
|
212
|
+
} else {
|
|
213
|
+
i0 = pivot;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (i0 > i1) {
|
|
219
|
+
// swap
|
|
220
|
+
i0 = i1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// fast-forward to last matching frame if there are multiple matches
|
|
224
|
+
while (i0 + 1 < key_count - 1 && keys[i0 + 1].time === time) {
|
|
225
|
+
i0++;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return i0;
|
|
229
|
+
}
|
|
230
|
+
|
|
180
231
|
/**
|
|
181
232
|
*
|
|
182
233
|
* @param {number} time time in seconds
|
|
@@ -189,30 +240,33 @@ export class AnimationCurve {
|
|
|
189
240
|
const key_count = keys.length;
|
|
190
241
|
|
|
191
242
|
if (key_count === 0) {
|
|
243
|
+
// no keys, produce arbitrary value
|
|
192
244
|
return 0;
|
|
193
245
|
}
|
|
194
246
|
|
|
195
247
|
if (key_count === 1) {
|
|
248
|
+
// only have one key
|
|
196
249
|
return keys[0].value;
|
|
197
250
|
}
|
|
198
251
|
|
|
199
|
-
|
|
200
|
-
// before start
|
|
201
|
-
return keys[0].value;
|
|
202
|
-
}
|
|
252
|
+
const i = this.getKeyIndexByTime(time);
|
|
203
253
|
|
|
204
|
-
|
|
205
|
-
|
|
254
|
+
if (i >= key_count - 1) {
|
|
255
|
+
// past last keyframe
|
|
256
|
+
return keys[key_count - 1].value;
|
|
257
|
+
}
|
|
206
258
|
|
|
207
|
-
|
|
208
|
-
const keyframe0 = keys[i - 1];
|
|
259
|
+
const keyframe0 = keys[i];
|
|
209
260
|
|
|
210
|
-
|
|
211
|
-
|
|
261
|
+
if (keyframe0.time >= time) {
|
|
262
|
+
// on or past the keyframe
|
|
263
|
+
return keyframe0.value;
|
|
212
264
|
}
|
|
213
265
|
|
|
214
|
-
|
|
215
|
-
|
|
266
|
+
const keyframe1 = keys[i + 1];
|
|
267
|
+
|
|
268
|
+
return evaluate_two_key_curve(time, keyframe0, keyframe1);
|
|
269
|
+
|
|
216
270
|
}
|
|
217
271
|
|
|
218
272
|
/**
|
|
@@ -230,6 +284,11 @@ export class AnimationCurve {
|
|
|
230
284
|
const key_main = keys[index];
|
|
231
285
|
|
|
232
286
|
const has_previous = index > 0;
|
|
287
|
+
|
|
288
|
+
const has_next = index < last_index;
|
|
289
|
+
|
|
290
|
+
// TODO check out https://github.com/MonoGame/MonoGame/blob/f6ce4cbbe3ca5a93f0d1926f58ed501217a04069/MonoGame.Framework/Curve.cs#L232
|
|
291
|
+
|
|
233
292
|
if (has_previous) {
|
|
234
293
|
const key_previous = keys[index - 1];
|
|
235
294
|
|
|
@@ -239,7 +298,6 @@ export class AnimationCurve {
|
|
|
239
298
|
key_main.inTangent = value_span / time_span;
|
|
240
299
|
}
|
|
241
300
|
|
|
242
|
-
const has_next = index < last_index;
|
|
243
301
|
|
|
244
302
|
if (has_next) {
|
|
245
303
|
const key_next = keys[index + 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH;IAyBI;;;;;;;OAOG;IACH,kBANW,MAAM,SACN,MAAM,cACN,MAAM,eACN,MAAM,GACL,QAAQ,CAQnB;IAtCD;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,YAFU,MAAM,CAED;IAkBf;;;;;;OAMG;IACH,UALW,MAAM,SACN,MAAM,aACN,MAAM,cACN,MAAM,QAmBhB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAQnB;IAED;;;OAGG;IACH,YAFW,QAAQ,QAOlB;IAED;;;OAGG;IACH,SAFY,QAAQ,CAQnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAKjB;IAED;;;;;MAOC;IAED;;;;;aAQC;IAIL;;;;OAIG;IACH,qBAFU,OAAO,CAEY;CAP5B"}
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Intended to reduce complexity of a curve to improve performance and lower memory usage
|
|
4
4
|
* @param {AnimationCurve} curve
|
|
5
5
|
* @param {number} [error_tolerance] how much of a loss to accept, this is relative to normalized value bounds of the curve
|
|
6
|
+
*
|
|
7
|
+
* @author Alex Goldring
|
|
8
|
+
* @copyright Company Named Limited (c) 2025
|
|
6
9
|
*/
|
|
7
10
|
export function animation_curve_optimize(curve: AnimationCurve, error_tolerance?: number): void;
|
|
8
11
|
//# sourceMappingURL=animation_curve_optimize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation_curve_optimize.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_optimize.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animation_curve_optimize.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_optimize.js"],"names":[],"mappings":"AAkDA;;;;;;;;GAQG;AACH,gDANW,cAAc,oBACd,MAAM,QA6ChB"}
|
|
@@ -12,9 +12,17 @@ const NORMALIZED_CHECK_DISTANCE = 0.07;
|
|
|
12
12
|
* @param {Keyframe} key_middle
|
|
13
13
|
* @param {Keyframe} key_previous
|
|
14
14
|
* @param {Keyframe} key_next
|
|
15
|
-
* @return {number} value delta if the middle frame is removed
|
|
15
|
+
* @return {number} value delta if the middle frame is removed, the higher this value - the more important the middle keyframe is
|
|
16
|
+
*
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2025
|
|
16
19
|
*/
|
|
17
|
-
function compute_keyframe_value_effect(
|
|
20
|
+
function compute_keyframe_value_effect(
|
|
21
|
+
key_middle,
|
|
22
|
+
key_previous,
|
|
23
|
+
key_next
|
|
24
|
+
) {
|
|
25
|
+
|
|
18
26
|
// check if this key contributes to the shape
|
|
19
27
|
const v1_actual = evaluate_two_key_curve(key_middle.time, key_previous, key_next);
|
|
20
28
|
const v1_expected = key_middle.value;
|
|
@@ -45,6 +53,9 @@ function compute_keyframe_value_effect(key_middle, key_previous, key_next) {
|
|
|
45
53
|
* Intended to reduce complexity of a curve to improve performance and lower memory usage
|
|
46
54
|
* @param {AnimationCurve} curve
|
|
47
55
|
* @param {number} [error_tolerance] how much of a loss to accept, this is relative to normalized value bounds of the curve
|
|
56
|
+
*
|
|
57
|
+
* @author Alex Goldring
|
|
58
|
+
* @copyright Company Named Limited (c) 2025
|
|
48
59
|
*/
|
|
49
60
|
export function animation_curve_optimize(curve, error_tolerance = 1e-3) {
|
|
50
61
|
assert.lessThan(error_tolerance, 1, 'error_tolerance must be less than 1');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA
|
|
1
|
+
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA2HI;;;OAGG;IACH,aAFY,IAAI,CAQf;IA2BD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IAxOD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,UAAU,GAAC,SAAS,CAAC,MAAM,CAAC,EAO/C;IAED;;;OAGG;IACH,YAFa,UAAU,CAItB;IAED;;;;;;;;OAQG;IACH,eALY,MAAM,CAUjB;IAED;;;;OAIG;IACH,OAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAqBhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,uBA7EiB,MAAM,CA6EF;IAErB;;OAEG;IACH,4BA7Ie,MAAM,UA6IE;IAQvB;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAtBpB;;kBAcS,MAAM"}
|
|
@@ -7,21 +7,21 @@ import { randomUint8 } from "../../../core/math/random/randomUint8.js";
|
|
|
7
7
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
8
8
|
|
|
9
9
|
// Previous uuid creation time
|
|
10
|
-
let
|
|
11
|
-
let
|
|
10
|
+
let _last_milliseconds = 0;
|
|
11
|
+
let _last_nanoseconds = 0;
|
|
12
12
|
|
|
13
13
|
// seed random with current time to lower potential correlation
|
|
14
14
|
const random = seededRandom(Date.now());
|
|
15
15
|
|
|
16
16
|
// node and clockseq need to be initialized to random values.
|
|
17
|
-
const
|
|
17
|
+
const _node_id = new Uint8Array(6);
|
|
18
18
|
|
|
19
19
|
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
20
|
-
randomBytes(
|
|
21
|
-
|
|
20
|
+
randomBytes(_node_id, 0, random, 6);
|
|
21
|
+
_node_id[0] |= 0x01;
|
|
22
22
|
|
|
23
23
|
// Per 4.2.2, randomize (14 bit) clockseq
|
|
24
|
-
let
|
|
24
|
+
let _clock_seq = ((randomUint8(random) << 8) | randomUint8(random)) & 0x3fff;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Universally Unique Identifier (UUID), a 128 bit label used to uniquely identify resources.
|
|
@@ -40,7 +40,9 @@ let _clockseq = ((randomUint8(random) << 8) | randomUint8(random)) & 0x3fff;
|
|
|
40
40
|
* const id_b = UUID.v1();
|
|
41
41
|
*
|
|
42
42
|
* id_a.equals(id_b); // false
|
|
43
|
-
|
|
43
|
+
*
|
|
44
|
+
* @author Alex Goldring
|
|
45
|
+
* @copyright Company Named Limited (c) 2025
|
|
44
46
|
*/
|
|
45
47
|
export class UUID {
|
|
46
48
|
#data = new Uint8Array(16);
|
|
@@ -98,7 +100,7 @@ export class UUID {
|
|
|
98
100
|
|
|
99
101
|
const b = this.#data;
|
|
100
102
|
|
|
101
|
-
let
|
|
103
|
+
let clock_seq = _clock_seq;
|
|
102
104
|
|
|
103
105
|
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
104
106
|
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
@@ -108,37 +110,37 @@ export class UUID {
|
|
|
108
110
|
|
|
109
111
|
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
110
112
|
// cycle to simulate higher resolution clock
|
|
111
|
-
let
|
|
113
|
+
let nanoseconds = _last_nanoseconds + 1;
|
|
112
114
|
|
|
113
115
|
// Time since last uuid creation (in msecs)
|
|
114
|
-
const dt = msecs -
|
|
116
|
+
const dt = msecs - _last_milliseconds + (nanoseconds - _last_nanoseconds) / 10000;
|
|
115
117
|
|
|
116
118
|
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
117
119
|
if (dt < 0) {
|
|
118
|
-
|
|
120
|
+
clock_seq = (clock_seq + 1) & 0x3fff;
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
122
124
|
// time interval
|
|
123
|
-
if ((dt < 0 || msecs >
|
|
124
|
-
|
|
125
|
+
if ((dt < 0 || msecs > _last_milliseconds)) {
|
|
126
|
+
nanoseconds = 0;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
128
|
-
if (
|
|
130
|
+
if (nanoseconds >= 10000) {
|
|
129
131
|
throw new Error(".v1(): Can't create more than 10M uuids/sec");
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
_last_milliseconds = msecs;
|
|
135
|
+
_last_nanoseconds = nanoseconds;
|
|
136
|
+
_clock_seq = clock_seq;
|
|
135
137
|
|
|
136
138
|
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
137
139
|
msecs += 12219292800000;
|
|
138
140
|
|
|
139
141
|
let i = 0
|
|
140
142
|
// `time_low`
|
|
141
|
-
const tl = ((msecs & 0xfffffff) * 10000 +
|
|
143
|
+
const tl = ((msecs & 0xfffffff) * 10000 + nanoseconds) % 0x100000000;
|
|
142
144
|
b[i++] = (tl >>> 24) & 0xff;
|
|
143
145
|
b[i++] = (tl >>> 16) & 0xff;
|
|
144
146
|
b[i++] = (tl >>> 8) & 0xff;
|
|
@@ -154,14 +156,14 @@ export class UUID {
|
|
|
154
156
|
b[i++] = (tmh >>> 16) & 0xff;
|
|
155
157
|
|
|
156
158
|
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
157
|
-
b[i++] = (
|
|
159
|
+
b[i++] = (clock_seq >>> 8) | 0x80;
|
|
158
160
|
|
|
159
161
|
// `clock_seq_low`
|
|
160
|
-
b[i++] =
|
|
162
|
+
b[i++] = clock_seq & 0xff;
|
|
161
163
|
|
|
162
164
|
// `node`
|
|
163
165
|
for (let n = 0; n < 6; ++n) {
|
|
164
|
-
b[i + n] =
|
|
166
|
+
b[i + n] = _node_id[n];
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
declare class Name extends ObservedString {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @returns {string}
|
|
6
|
-
*/
|
|
7
|
-
getLocalizationKey(): string;
|
|
1
|
+
export class Name extends ObservedString {
|
|
8
2
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* @returns {string}
|
|
3
|
+
* @readonly
|
|
4
|
+
* @type {boolean}
|
|
12
5
|
*/
|
|
13
|
-
|
|
14
|
-
clone(): Name;
|
|
6
|
+
readonly isName: boolean;
|
|
15
7
|
}
|
|
16
|
-
|
|
8
|
+
export namespace Name {
|
|
17
9
|
let typeName: string;
|
|
18
10
|
}
|
|
11
|
+
export default Name;
|
|
19
12
|
import ObservedString from "../../../core/model/ObservedString.js";
|
|
20
13
|
//# sourceMappingURL=Name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Name.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/name/Name.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Name.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/name/Name.js"],"names":[],"mappings":"AAEA;IAiBA;;;OAGG;IACH,iBAFU,OAAO,CAEI;CAZpB;;kBAIS,MAAM;;;2BAfW,uCAAuC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ObservedString from "../../../core/model/ObservedString.js";
|
|
2
2
|
|
|
3
|
-
class Name extends ObservedString {
|
|
3
|
+
export class Name extends ObservedString {
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param {string} [value]
|
|
@@ -9,34 +9,20 @@ class Name extends ObservedString {
|
|
|
9
9
|
super(value);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @returns {string}
|
|
15
|
-
*/
|
|
16
|
-
getLocalizationKey() {
|
|
17
|
-
return `component.name.${this.getValue()}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {Localization} localization
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
getLocalizedValue(localization) {
|
|
26
|
-
return localization.getString(this.getLocalizationKey());
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
clone() {
|
|
30
|
-
const clone = new Name();
|
|
31
|
-
|
|
32
|
-
clone.copy(this);
|
|
33
|
-
|
|
34
|
-
return clone;
|
|
35
|
-
}
|
|
36
12
|
}
|
|
37
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @readonly
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
38
18
|
Name.typeName = "Name";
|
|
39
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @readonly
|
|
22
|
+
* @type {boolean}
|
|
23
|
+
*/
|
|
24
|
+
Name.prototype.isName = true;
|
|
40
25
|
|
|
26
|
+
// prefer named import instead
|
|
41
27
|
export default Name;
|
|
42
28
|
|