@woosh/meep-engine 2.92.24 → 2.93.2
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 +8 -41
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +8 -41
- package/package.json +6 -4
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +8 -41
- package/src/core/collection/set/HashSet.spec.js +16 -0
- package/src/core/math/spline/spline_hermite3.d.ts +4 -3
- package/src/core/math/spline/spline_hermite3.d.ts.map +1 -1
- package/src/core/math/spline/spline_hermite3.js +4 -3
- package/src/engine/animation/clip/AnimationClip.d.ts +4 -0
- package/src/engine/animation/clip/AnimationClip.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationClip.js +23 -0
- package/src/engine/animation/clip/AnimationClipBinding.d.ts +14 -0
- package/src/engine/animation/clip/AnimationClipBinding.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationClipBinding.js +94 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts +45 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationTrack.js +83 -0
- package/src/engine/animation/clip/AnimationTrackBinding.d.ts +25 -0
- package/src/engine/animation/clip/AnimationTrackBinding.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationTrackBinding.js +42 -0
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts +9 -0
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -0
- package/src/engine/animation/{curve → clip}/ecd_bind_animation_curve.js +28 -20
- package/src/engine/animation/curve/AnimationCurve.d.ts +31 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +81 -23
- package/src/engine/animation/curve/AnimationCurve.spec.js +34 -0
- package/src/engine/animation/curve/Keyframe.d.ts +8 -0
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +53 -44
- package/src/engine/animation/curve/Keyframe.spec.d.ts +2 -0
- package/src/engine/animation/curve/Keyframe.spec.d.ts.map +1 -0
- package/src/engine/animation/curve/Keyframe.spec.js +31 -0
- package/src/engine/animation/curve/binding/BoundQuaternionWriter.d.ts.map +1 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts +14 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts.map +1 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.js +19 -0
- package/src/engine/animation/curve/binding/BoundVector3Writer.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.d.ts +2 -2
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +5 -3
- package/src/engine/animation/curve/EntityNodeAnimationClip.d.ts +0 -4
- package/src/engine/animation/curve/EntityNodeAnimationClip.d.ts.map +0 -1
- package/src/engine/animation/curve/EntityNodeAnimationClip.js +0 -24
- package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts +0 -8
- package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts +0 -27
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.js +0 -61
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts +0 -8
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.js +0 -10
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.d.ts.map +0 -1
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundQuaternionWriter.d.ts +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundQuaternionWriter.js +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundVector3Writer.d.ts +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundVector3Writer.js +0 -0
|
@@ -9,6 +9,32 @@ export class AnimationCurve {
|
|
|
9
9
|
* @returns {AnimationCurve}
|
|
10
10
|
*/
|
|
11
11
|
static from(keys: Keyframe[]): AnimationCurve;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {number} timeStart
|
|
15
|
+
* @param {number} valueStart
|
|
16
|
+
* @param {number} timeEnd
|
|
17
|
+
* @param {number} valueEnd
|
|
18
|
+
* @return {AnimationCurve}
|
|
19
|
+
*/
|
|
20
|
+
static easeInOut(timeStart: number, valueStart: number, timeEnd: number, valueEnd: number): AnimationCurve;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {number} timeStart
|
|
24
|
+
* @param {number} timeEnd
|
|
25
|
+
* @param {number} value
|
|
26
|
+
* @return {AnimationCurve}
|
|
27
|
+
*/
|
|
28
|
+
static constant(timeStart: number, timeEnd: number, value: number): AnimationCurve;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param {number} timeStart
|
|
32
|
+
* @param {number} valueStart
|
|
33
|
+
* @param {number} timeEnd
|
|
34
|
+
* @param {number} valueEnd
|
|
35
|
+
* @return {AnimationCurve}
|
|
36
|
+
*/
|
|
37
|
+
static linear(timeStart: number, valueStart: number, timeEnd: number, valueEnd: number): AnimationCurve;
|
|
12
38
|
/**
|
|
13
39
|
* @readonly
|
|
14
40
|
* @type {Keyframe[]}
|
|
@@ -40,6 +66,11 @@ export class AnimationCurve {
|
|
|
40
66
|
* @returns {number}
|
|
41
67
|
*/
|
|
42
68
|
get length(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Time of the last chronological key in the curve
|
|
71
|
+
* @return {number}
|
|
72
|
+
*/
|
|
73
|
+
get duration(): number;
|
|
43
74
|
/**
|
|
44
75
|
*
|
|
45
76
|
* @param {number} t time in seconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH;IAiFI;;;;OAIG;IACH,kBAHW,QAAQ,EAAE,GACR,cAAc,CAU1B;IA6ID;;;;;;;OAOG;IACH,4BANW,MAAM,cACN,MAAM,WACN,MAAM,YACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,WACN,MAAM,SACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;;OAOG;IACH,yBANW,MAAM,cACN,MAAM,WACN,MAAM,YACN,MAAM,GACL,cAAc,CASzB;IAtRD;;;OAGG;IACH,eAFU,QAAQ,EAAE,CAEV;IAEV;;;;OAIG;IACH,SAHW,QAAQ,GACN,MAAM,CA+BlB;IAED;;;OAGG;IACH,cAFW,QAAQ,EAAE,QAUpB;IAED;;;;OAIG;IACH,YAHW,QAAQ,GACN,OAAO,CAYnB;IAED;;OAEG;IACH,cAEC;IAiBD;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,uBAUC;IAED;;;;OAIG;IACH,YAHW,MAAM,GACL,MAAM,CAwCjB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAoBhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAWhB;IAED,0BAKC;IAED;;MAIC;IAED;;aAeC;CA+CJ;yBAxSwB,eAAe"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
1
2
|
import { binarySearchHighIndex } from "../../../core/collection/array/binarySearchHighIndex.js";
|
|
2
3
|
import { inverseLerp } from "../../../core/math/inverseLerp.js";
|
|
3
4
|
import { lerp } from "../../../core/math/lerp.js";
|
|
@@ -5,24 +6,6 @@ import { spline_hermite3 } from "../../../core/math/spline/spline_hermite3.js";
|
|
|
5
6
|
import { invokeObjectToJSON } from "../../../core/model/object/invokeObjectToJSON.js";
|
|
6
7
|
import { Keyframe } from "./Keyframe.js";
|
|
7
8
|
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {number} t interpolation value, between 0 and 1
|
|
11
|
-
* @param {Keyframe} keyframe0
|
|
12
|
-
* @param {Keyframe} keyframe1
|
|
13
|
-
* @return {number}
|
|
14
|
-
*/
|
|
15
|
-
function evaluate(t, keyframe0, keyframe1) {
|
|
16
|
-
const time_distance = keyframe1.time - keyframe0.time;
|
|
17
|
-
|
|
18
|
-
return spline_hermite3(
|
|
19
|
-
t,
|
|
20
|
-
keyframe0.value, keyframe1.value,
|
|
21
|
-
keyframe0.outTangent * time_distance,
|
|
22
|
-
keyframe1.inTangent * time_distance
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
9
|
/**
|
|
27
10
|
*
|
|
28
11
|
* @param {number} time
|
|
@@ -50,6 +33,9 @@ export class AnimationCurve {
|
|
|
50
33
|
* @returns {number} key index
|
|
51
34
|
*/
|
|
52
35
|
add(key) {
|
|
36
|
+
assert.defined(key, 'key');
|
|
37
|
+
assert.notNull(key, 'key');
|
|
38
|
+
|
|
53
39
|
const keys = this.keys;
|
|
54
40
|
|
|
55
41
|
const key_count = keys.length;
|
|
@@ -82,6 +68,8 @@ export class AnimationCurve {
|
|
|
82
68
|
* @param {Keyframe[]} keys
|
|
83
69
|
*/
|
|
84
70
|
addMany(keys) {
|
|
71
|
+
assert.isArray(keys, 'keys');
|
|
72
|
+
|
|
85
73
|
const key_count = keys.length;
|
|
86
74
|
|
|
87
75
|
for (let i = 0; i < key_count; i++) {
|
|
@@ -136,6 +124,21 @@ export class AnimationCurve {
|
|
|
136
124
|
return this.keys.length;
|
|
137
125
|
}
|
|
138
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Time of the last chronological key in the curve
|
|
129
|
+
* @return {number}
|
|
130
|
+
*/
|
|
131
|
+
get duration() {
|
|
132
|
+
const keys = this.keys;
|
|
133
|
+
const key_count = keys.length;
|
|
134
|
+
|
|
135
|
+
if (key_count === 0) {
|
|
136
|
+
return 0
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// keys are sorted, so we can rely on the last key's time
|
|
140
|
+
return keys[key_count - 1].time;
|
|
141
|
+
}
|
|
139
142
|
|
|
140
143
|
/**
|
|
141
144
|
*
|
|
@@ -159,13 +162,22 @@ export class AnimationCurve {
|
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
for (let i = 1; i < key_count; i++) {
|
|
162
|
-
const
|
|
165
|
+
const keyframe1 = keys[i];
|
|
163
166
|
|
|
164
|
-
if (t <
|
|
165
|
-
const
|
|
166
|
-
const kt = inverseLerp(f0.time, f1.time, t);
|
|
167
|
+
if (t < keyframe1.time) {
|
|
168
|
+
const keyframe0 = keys[i - 1];
|
|
167
169
|
|
|
168
|
-
|
|
170
|
+
// convert to 0..1 region
|
|
171
|
+
const normalized_time = inverseLerp(keyframe0.time, keyframe1.time, t);
|
|
172
|
+
|
|
173
|
+
const time_distance = keyframe1.time - keyframe0.time;
|
|
174
|
+
|
|
175
|
+
return spline_hermite3(
|
|
176
|
+
normalized_time,
|
|
177
|
+
keyframe0.value, keyframe1.value,
|
|
178
|
+
keyframe0.outTangent * time_distance,
|
|
179
|
+
keyframe1.inTangent * time_distance
|
|
180
|
+
);
|
|
169
181
|
}
|
|
170
182
|
}
|
|
171
183
|
|
|
@@ -242,4 +254,50 @@ export class AnimationCurve {
|
|
|
242
254
|
}
|
|
243
255
|
|
|
244
256
|
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @param {number} timeStart
|
|
261
|
+
* @param {number} valueStart
|
|
262
|
+
* @param {number} timeEnd
|
|
263
|
+
* @param {number} valueEnd
|
|
264
|
+
* @return {AnimationCurve}
|
|
265
|
+
*/
|
|
266
|
+
static easeInOut(timeStart, valueStart, timeEnd, valueEnd) {
|
|
267
|
+
return AnimationCurve.from([
|
|
268
|
+
Keyframe.from(timeStart, valueStart, 0, 0),
|
|
269
|
+
Keyframe.from(timeEnd, valueEnd, 0, 0)
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
275
|
+
* @param {number} timeStart
|
|
276
|
+
* @param {number} timeEnd
|
|
277
|
+
* @param {number} value
|
|
278
|
+
* @return {AnimationCurve}
|
|
279
|
+
*/
|
|
280
|
+
static constant(timeStart, timeEnd, value) {
|
|
281
|
+
return AnimationCurve.from([
|
|
282
|
+
Keyframe.from(timeStart, value, 0, 0),
|
|
283
|
+
Keyframe.from(timeEnd, value, 0, 0)
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
*
|
|
289
|
+
* @param {number} timeStart
|
|
290
|
+
* @param {number} valueStart
|
|
291
|
+
* @param {number} timeEnd
|
|
292
|
+
* @param {number} valueEnd
|
|
293
|
+
* @return {AnimationCurve}
|
|
294
|
+
*/
|
|
295
|
+
static linear(timeStart, valueStart, timeEnd, valueEnd) {
|
|
296
|
+
const tangent = valueEnd - valueStart;
|
|
297
|
+
|
|
298
|
+
return AnimationCurve.from([
|
|
299
|
+
Keyframe.from(timeStart, valueStart, 0, tangent),
|
|
300
|
+
Keyframe.from(timeEnd, valueEnd, tangent, 0)
|
|
301
|
+
]);
|
|
302
|
+
}
|
|
245
303
|
}
|
|
@@ -145,3 +145,37 @@ test("to/from JSON consistency", () => {
|
|
|
145
145
|
expect(first_key.inTangent).toBe(13);
|
|
146
146
|
expect(first_key.outTangent).toBe(-17);
|
|
147
147
|
});
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
test("static easeInOut constructor", () => {
|
|
151
|
+
|
|
152
|
+
const curve = AnimationCurve.easeInOut(1, 3, 5, 7);
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
expect(curve.evaluate(1.1)).toBeCloseTo(3, 0.1);
|
|
156
|
+
expect(curve.evaluate(4.9)).toBeCloseTo(7, 0.1);
|
|
157
|
+
|
|
158
|
+
expect(curve.evaluate(3)).toBeCloseTo(5, 0.01);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("static linear constructor", () => {
|
|
162
|
+
|
|
163
|
+
const curve = AnimationCurve.linear(1, 3, 5, 7);
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
expect(curve.evaluate(1.1)).toBeCloseTo(3.1, 0.01);
|
|
167
|
+
expect(curve.evaluate(4.9)).toBeCloseTo(6.9, 0.01);
|
|
168
|
+
|
|
169
|
+
expect(curve.evaluate(3)).toBeCloseTo(5, 0.01);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("static constant constructor", () => {
|
|
173
|
+
|
|
174
|
+
const curve = AnimationCurve.constant(1, 5, 7);
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
expect(curve.evaluate(1.1)).toBe(7);
|
|
178
|
+
expect(curve.evaluate(4.9)).toBe(7);
|
|
179
|
+
|
|
180
|
+
expect(curve.evaluate(3)).toBe(7);
|
|
181
|
+
});
|
|
@@ -28,6 +28,14 @@ export class Keyframe {
|
|
|
28
28
|
* @type {number}
|
|
29
29
|
*/
|
|
30
30
|
outTangent: number;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {number} time
|
|
34
|
+
* @param {number} value
|
|
35
|
+
* @param {number} inTangent
|
|
36
|
+
* @param {number} outTangent
|
|
37
|
+
*/
|
|
38
|
+
set(time: number, value: number, inTangent: number, outTangent: number): void;
|
|
31
39
|
toJSON(): {
|
|
32
40
|
value: number;
|
|
33
41
|
time: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"AAEA;
|
|
1
|
+
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"AAEA;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;;;;;MAOC;IAED;;;;;aAQC;CAEJ"}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
|
|
3
3
|
export class Keyframe {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.outTangent = 0;
|
|
28
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {number}
|
|
7
|
+
*/
|
|
8
|
+
value = 0;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
time = 0;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {number}
|
|
19
|
+
*/
|
|
20
|
+
inTangent = 0;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
outTangent = 0;
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
*
|
|
@@ -36,26 +34,37 @@ export class Keyframe {
|
|
|
36
34
|
* @return {Keyframe}
|
|
37
35
|
*/
|
|
38
36
|
static from(time, value, inTangent = 0, outTangent = 0) {
|
|
39
|
-
|
|
40
|
-
assert.notNaN(time,'time');
|
|
37
|
+
const r = new Keyframe();
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
assert.notNaN(value,'value');
|
|
39
|
+
r.set(time, value, inTangent, outTangent);
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
return r;
|
|
42
|
+
}
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {number} time
|
|
47
|
+
* @param {number} value
|
|
48
|
+
* @param {number} inTangent
|
|
49
|
+
* @param {number} outTangent
|
|
50
|
+
*/
|
|
51
|
+
set(time, value, inTangent, outTangent) {
|
|
52
|
+
assert.isNumber(time, 'time');
|
|
53
|
+
assert.notNaN(time, 'time');
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
assert.isNumber(value, 'value');
|
|
56
|
+
assert.notNaN(value, 'value');
|
|
52
57
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
r.inTangent = inTangent;
|
|
56
|
-
r.outTangent = outTangent;
|
|
58
|
+
assert.isNumber(inTangent, 'inTangent');
|
|
59
|
+
assert.notNaN(inTangent, 'inTangent');
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
assert.isNumber(outTangent, 'outTangent');
|
|
62
|
+
assert.notNaN(outTangent, 'outTangent');
|
|
63
|
+
|
|
64
|
+
this.time = time;
|
|
65
|
+
this.value = value;
|
|
66
|
+
this.inTangent = inTangent;
|
|
67
|
+
this.outTangent = outTangent;
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
toJSON() {
|
|
@@ -68,13 +77,13 @@ export class Keyframe {
|
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
fromJSON({
|
|
71
|
-
value,
|
|
80
|
+
value,
|
|
81
|
+
time,
|
|
82
|
+
inTangent,
|
|
83
|
+
outTangent
|
|
72
84
|
}) {
|
|
73
85
|
|
|
74
|
-
this.value
|
|
75
|
-
this.time = time;
|
|
76
|
-
this.inTangent = inTangent;
|
|
77
|
-
this.outTangent = outTangent;
|
|
86
|
+
this.set(time, value, inTangent, outTangent);
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Keyframe.spec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Keyframe } from "./Keyframe.js";
|
|
2
|
+
|
|
3
|
+
test("toJSON", () => {
|
|
4
|
+
|
|
5
|
+
const k = Keyframe.from(1, 3, 5, 7);
|
|
6
|
+
|
|
7
|
+
expect(k.toJSON()).toEqual({
|
|
8
|
+
time: 1,
|
|
9
|
+
value: 3,
|
|
10
|
+
inTangent: 5,
|
|
11
|
+
outTangent: 7
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("fromJSON", () => {
|
|
16
|
+
|
|
17
|
+
const keyframe = new Keyframe();
|
|
18
|
+
|
|
19
|
+
keyframe.fromJSON({
|
|
20
|
+
time: 1,
|
|
21
|
+
value: 3,
|
|
22
|
+
inTangent: 5,
|
|
23
|
+
outTangent: 7
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(keyframe.time).toEqual(1);
|
|
27
|
+
expect(keyframe.value).toEqual(3);
|
|
28
|
+
expect(keyframe.inTangent).toEqual(5);
|
|
29
|
+
expect(keyframe.outTangent).toEqual(7);
|
|
30
|
+
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundQuaternionWriter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/animation/curve/binding/BoundQuaternionWriter.js"],"names":[],"mappings":"AAEA;IAOI,6BAIC;IAED,uBAGC;;CACJ;iCAnBgC,uBAAuB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class BoundValueWriter {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {number[]|ArrayLike<number>|Float32Array|Float64Array} data
|
|
5
|
+
*/
|
|
6
|
+
write(data: number[] | ArrayLike<number> | Float32Array | Float64Array): void;
|
|
7
|
+
/**
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {T} root
|
|
10
|
+
* @param {string[]} path
|
|
11
|
+
*/
|
|
12
|
+
bind<T>(root: T, path: string[]): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=BoundValueWriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundValueWriter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/animation/curve/binding/BoundValueWriter.js"],"names":[],"mappings":"AAAA;IAEI;;;OAGG;IACH,YAFW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,QAI9D;IAED;;;;OAIG;IACH,uBAFW,MAAM,EAAE,QAIlB;CACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class BoundValueWriter {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]|ArrayLike<number>|Float32Array|Float64Array} data
|
|
6
|
+
*/
|
|
7
|
+
write(data) {
|
|
8
|
+
throw new Error('Not Implemented');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @template T
|
|
13
|
+
* @param {T} root
|
|
14
|
+
* @param {string[]} path
|
|
15
|
+
*/
|
|
16
|
+
bind(root, path) {
|
|
17
|
+
throw new Error('Not Implemented');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundVector3Writer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/animation/curve/binding/BoundVector3Writer.js"],"names":[],"mappings":"AAEA;IAOI,yBAIC;IAED,uBAEC;;CACJ;iCAlBgC,uBAAuB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {AnimationClipBinding} from "../../../../animation/clip/AnimationClipBinding";
|
|
2
2
|
import {SGAnimationPlayback} from "./SGAnimationPlayback";
|
|
3
3
|
|
|
4
4
|
export class SGMeshAnimationController {
|
|
5
|
-
readonly bound:
|
|
5
|
+
readonly bound: AnimationClipBinding[]
|
|
6
6
|
|
|
7
7
|
start(name: string, loop?: boolean, time_offset?: number): SGAnimationPlayback
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
2
2
|
import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
|
|
3
3
|
import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
|
|
4
|
-
import { convert_three_clip } from "../../../../animation/
|
|
4
|
+
import { convert_three_clip } from "../../../../animation/clip/ecd_bind_animation_curve.js";
|
|
5
5
|
import { System } from "../../../../ecs/System.js";
|
|
6
6
|
import { assetTypeByPath } from "../../mesh/assetTypeByPath.js";
|
|
7
7
|
import { SGMesh } from "./SGMesh.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTextureUsageUpdater.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js"],"names":[],"mappings":"AA2EA;IAgBI;;;OAGG;IACH,uCAEC;IAVD,oCAEC;IA8CD,iCAEC;IAED,8BAEC;IAED,4BAEC;IASD;;;;;OAKG;IACH,iCAJW,MAAM,aACN,MAAM,cACN,MAAM,QAqBhB;IAED,0CAEC;IAED,4BAEC;IAiCD;;;;OAIG;IACH,yBAHW,MAAM,KACN,MAAM,QA+BhB;
|
|
1
|
+
{"version":3,"file":"VirtualTextureUsageUpdater.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js"],"names":[],"mappings":"AA2EA;IAgBI;;;OAGG;IACH,uCAEC;IAVD,oCAEC;IA8CD,iCAEC;IAED,8BAEC;IAED,4BAEC;IASD;;;;;OAKG;IACH,iCAJW,MAAM,aACN,MAAM,cACN,MAAM,QAqBhB;IAED,0CAEC;IAED,4BAEC;IAiCD;;;;OAIG;IACH,yBAHW,MAAM,KACN,MAAM,QA+BhB;IA0BD;;;;;OAKG;IACH,yEAoDC;IAED,gBAEC;;CACJ;oCAlUmC,0BAA0B;0BADpC,yBAAyB"}
|
|
@@ -83,7 +83,7 @@ export class VirtualTextureUsageUpdater {
|
|
|
83
83
|
*/
|
|
84
84
|
#frame_jitter_offsets = new Float32Array([0, 0]);
|
|
85
85
|
#frame_jitter_samples = 1;
|
|
86
|
-
#frame_jitter_enabled =
|
|
86
|
+
#frame_jitter_enabled = true;
|
|
87
87
|
|
|
88
88
|
get frame_jitter_enabled() {
|
|
89
89
|
return this.#frame_jitter_enabled;
|
|
@@ -264,8 +264,10 @@ export class VirtualTextureUsageUpdater {
|
|
|
264
264
|
// apply jitter to projection matrix
|
|
265
265
|
const jitter_index = this.#frame_index % this.#frame_jitter_samples;
|
|
266
266
|
|
|
267
|
-
const
|
|
268
|
-
|
|
267
|
+
const jitter_index_2 = jitter_index * 2;
|
|
268
|
+
|
|
269
|
+
const jitter_offset_x = this.#frame_jitter_offsets[jitter_index_2];
|
|
270
|
+
const jitter_offset_y = this.#frame_jitter_offsets[jitter_index_2 + 1];
|
|
269
271
|
|
|
270
272
|
camera_projection_matrix[8] = jitter_offset_x / usage_buffer.width;
|
|
271
273
|
camera_projection_matrix[9] = jitter_offset_y / usage_buffer.height;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntityNodeAnimationClip.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/EntityNodeAnimationClip.js"],"names":[],"mappings":"AAAA;IACI,aAAS;IACT;;;OAGG;IACH,QAFU,sBAAsB,CAErB;IACX,iBAAY;IAEZ;;;OAGG;IACH,cAFW,MAAM,QAWhB;CACJ"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export class EntityNodeAnimationClip {
|
|
2
|
-
name = ""
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @type {AnimatedValueBinding[]}
|
|
6
|
-
*/
|
|
7
|
-
tracks = []
|
|
8
|
-
duration = 0
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {number} time time in seconds
|
|
13
|
-
*/
|
|
14
|
-
writeAt(time) {
|
|
15
|
-
const tracks = this.tracks;
|
|
16
|
-
const track_count = tracks.length;
|
|
17
|
-
|
|
18
|
-
for (let i = 0; i < track_count; i++) {
|
|
19
|
-
const track = tracks[i];
|
|
20
|
-
|
|
21
|
-
track.writeAt(time);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Three.js clip to internal representation
|
|
3
|
-
* @param {EntityNode} node
|
|
4
|
-
* @param {AnimationClip} clip
|
|
5
|
-
*/
|
|
6
|
-
export function convert_three_clip(node: EntityNode, clip: AnimationClip): EntityNodeAnimationClip;
|
|
7
|
-
import { EntityNodeAnimationClip } from "./EntityNodeAnimationClip.js";
|
|
8
|
-
//# sourceMappingURL=ecd_bind_animation_curve.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/ecd_bind_animation_curve.js"],"names":[],"mappings":"AAgUA;;;;GAIG;AACH,mGAsBC;wCApVuC,8BAA8B"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export class AnimatedValueBinding {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {BoundValueWriter} writer
|
|
5
|
-
* @param {AnimationCurve[]} curves
|
|
6
|
-
* @returns {AnimatedValueBinding}
|
|
7
|
-
*/
|
|
8
|
-
static from(writer: BoundValueWriter, curves: AnimationCurve[]): AnimatedValueBinding;
|
|
9
|
-
constructor(itemSize: any);
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @type {BoundValueWriter|null}
|
|
13
|
-
*/
|
|
14
|
-
writer: BoundValueWriter | null;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {AnimationCurve[]}
|
|
18
|
-
*/
|
|
19
|
-
curves: AnimationCurve[];
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {number} time
|
|
23
|
-
*/
|
|
24
|
-
writeAt(time: number): void;
|
|
25
|
-
#private;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=AnimatedValueBinding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedValueBinding.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.js"],"names":[],"mappings":"AAAA;IAoBI;;;;;OAKG;IACH,8CAHW,gBAAgB,GACd,oBAAoB,CAWhC;IArBD,2BAIC;IAjBD;;;OAGG;IACH,QAFU,mBAAiB,IAAI,CAElB;IAEb;;;OAGG;IACH,QAFU,gBAAgB,CAEf;IAkCX;;;OAGG;IACH,cAFW,MAAM,QAYhB;;CACJ"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export class AnimatedValueBinding {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @type {BoundValueWriter|null}
|
|
5
|
-
*/
|
|
6
|
-
writer = null
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @type {AnimationCurve[]}
|
|
11
|
-
*/
|
|
12
|
-
curves = []
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
constructor(itemSize) {
|
|
16
|
-
this.#itemSize = itemSize;
|
|
17
|
-
|
|
18
|
-
this.#sample = new Float32Array(itemSize);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param {BoundValueWriter} writer
|
|
24
|
-
* @param {AnimationCurve[]} curves
|
|
25
|
-
* @returns {AnimatedValueBinding}
|
|
26
|
-
*/
|
|
27
|
-
static from(writer, curves) {
|
|
28
|
-
|
|
29
|
-
const r = new AnimatedValueBinding(curves.length);
|
|
30
|
-
|
|
31
|
-
r.writer = writer;
|
|
32
|
-
r.curves = curves;
|
|
33
|
-
|
|
34
|
-
return r;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
#itemSize = 1;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @type {Float32Array|null}
|
|
43
|
-
*/
|
|
44
|
-
#sample = null;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param {number} time
|
|
49
|
-
*/
|
|
50
|
-
writeAt(time) {
|
|
51
|
-
|
|
52
|
-
for (let i = 0; i < this.#itemSize; i++) {
|
|
53
|
-
const curve = this.curves[i];
|
|
54
|
-
|
|
55
|
-
this.#sample[i] = curve.evaluate(time)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.writer.write(this.#sample);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoundQuaternionWriter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.js"],"names":[],"mappings":"AAEA;IAOI,6BAIC;IAED,uBAGC;;CACJ;iCAnBgC,uBAAuB"}
|