@woosh/meep-engine 2.92.7 → 2.92.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/ecd_bind_animation_curve.js"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -3,6 +3,7 @@ import { AnimatedValueBinding } from "../../graphics/ecs/mesh-v2/aggregate/anima
|
|
|
3
3
|
import { BoundQuaternionWriter } from "../../graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.js";
|
|
4
4
|
import { BoundValueWriter } from "../../graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.js";
|
|
5
5
|
import { BoundVector3Writer } from "../../graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.js";
|
|
6
|
+
import { logger } from "../../logging/GlobalLogger.js";
|
|
6
7
|
import { AnimationCurve } from "./AnimationCurve.js";
|
|
7
8
|
import { EntityNodeAnimationClip } from "./EntityNodeAnimationClip.js";
|
|
8
9
|
import { Keyframe } from "./Keyframe.js";
|
|
@@ -22,6 +23,40 @@ function get_node_name(node) {
|
|
|
22
23
|
return name.getValue();
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Following THREE.js PropertyBinding.findNode implementation
|
|
28
|
+
* @param {EntityNode} root
|
|
29
|
+
* @param {string} nodeName
|
|
30
|
+
* @returns {EntityNode|undefined}
|
|
31
|
+
*/
|
|
32
|
+
function find_node(root, nodeName) {
|
|
33
|
+
|
|
34
|
+
const root_name = get_node_name(root);
|
|
35
|
+
|
|
36
|
+
if (root_name === nodeName) {
|
|
37
|
+
return root;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// search into node subtree.
|
|
41
|
+
const children = root.children;
|
|
42
|
+
|
|
43
|
+
const child_count = children.length;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
for (let j = 0; j < child_count; j++) {
|
|
47
|
+
/**
|
|
48
|
+
* @type {EntityNode}
|
|
49
|
+
*/
|
|
50
|
+
const child = children[j];
|
|
51
|
+
|
|
52
|
+
const subtree_result = find_node(child, nodeName);
|
|
53
|
+
|
|
54
|
+
if (subtree_result !== undefined) {
|
|
55
|
+
return subtree_result;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
25
60
|
/**
|
|
26
61
|
*
|
|
27
62
|
* @param {EntityNode} root
|
|
@@ -31,30 +66,20 @@ function entity_node_resolve_path(root, path_parts) {
|
|
|
31
66
|
|
|
32
67
|
let node = root;
|
|
33
68
|
|
|
34
|
-
|
|
69
|
+
const part_count = path_parts.length;
|
|
70
|
+
for (let i = 0; i < part_count; i++) {
|
|
35
71
|
|
|
36
72
|
const part = path_parts[i];
|
|
37
73
|
|
|
38
|
-
const
|
|
74
|
+
const sub_node = find_node(node, part);
|
|
39
75
|
|
|
40
|
-
|
|
76
|
+
if (sub_node === undefined) {
|
|
41
77
|
|
|
78
|
+
throw new Error(`Child '${part}' not found, at index ${i} of [${path_parts.join(', ')}]. Valid names at this level: [${node.children.map(get_node_name)}]`);
|
|
42
79
|
|
|
43
|
-
for (let j = 0; j < child_count; j++) {
|
|
44
|
-
/**
|
|
45
|
-
* @type {EntityNode}
|
|
46
|
-
*/
|
|
47
|
-
const child = children[j];
|
|
48
|
-
|
|
49
|
-
const name = get_node_name(child);
|
|
50
|
-
|
|
51
|
-
if (name === part) {
|
|
52
|
-
node = child;
|
|
53
|
-
continue main;
|
|
54
|
-
}
|
|
55
80
|
}
|
|
56
81
|
|
|
57
|
-
|
|
82
|
+
node = sub_node;
|
|
58
83
|
}
|
|
59
84
|
|
|
60
85
|
return node;
|
|
@@ -300,9 +325,18 @@ function convert_three_track(track, node) {
|
|
|
300
325
|
*/
|
|
301
326
|
export function convert_three_clip(node, clip) {
|
|
302
327
|
const three_tracks = clip.tracks;
|
|
328
|
+
const track_count = three_tracks.length;
|
|
303
329
|
|
|
304
|
-
const tracks =
|
|
330
|
+
const tracks = [];
|
|
305
331
|
|
|
332
|
+
for (let i = 0; i < track_count; i++) {
|
|
333
|
+
try {
|
|
334
|
+
const engine_track = convert_three_track(three_tracks[i], node);
|
|
335
|
+
tracks.push(engine_track);
|
|
336
|
+
} catch (e) {
|
|
337
|
+
logger.error(`Failed to parse track[${i}]: ${e.message}`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
306
340
|
|
|
307
341
|
const r = new EntityNodeAnimationClip();
|
|
308
342
|
|
|
@@ -37,10 +37,8 @@ async function main(engine) {
|
|
|
37
37
|
pitch: 0.030000000000008027,
|
|
38
38
|
yaw: 3.123185307179593,
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[
|
|
40
|
+
//
|
|
41
|
+
make_sample('data/models/samples/InterpolationTest.glb',[
|
|
44
42
|
'Step Scale',
|
|
45
43
|
'Linear Scale',
|
|
46
44
|
'CubicSpline Scale',
|
|
@@ -50,23 +48,45 @@ async function main(engine) {
|
|
|
50
48
|
'Step Translation',
|
|
51
49
|
'CubicSpline Translation',
|
|
52
50
|
'Linear Translation'
|
|
53
|
-
].
|
|
51
|
+
],engine.entityManager.dataset);
|
|
52
|
+
//
|
|
53
|
+
// make_sample('data/models/samples/BoxAnimated.glb',[
|
|
54
|
+
// 'animation_01'
|
|
55
|
+
// ],engine.entityManager.dataset);
|
|
56
|
+
//
|
|
57
|
+
// make_sample('data/models/samples/animatedbox1.gltf', [
|
|
58
|
+
// 'All Animations'
|
|
59
|
+
// ], engine.entityManager.dataset);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param {string} path
|
|
65
|
+
* @param {string[]} animations
|
|
66
|
+
* @param {EntityComponentDataset} ecd
|
|
67
|
+
*/
|
|
68
|
+
function make_sample(path, animations, ecd) {
|
|
69
|
+
|
|
70
|
+
const controller = new SGMeshAnimationController();
|
|
71
|
+
|
|
72
|
+
animations.forEach(name => {
|
|
54
73
|
|
|
55
|
-
controller.start(name,true);
|
|
74
|
+
controller.start(name, true);
|
|
56
75
|
|
|
57
76
|
})
|
|
58
77
|
|
|
59
78
|
new Entity()
|
|
60
|
-
.add(SGMesh.fromURL(
|
|
79
|
+
.add(SGMesh.fromURL(path))
|
|
61
80
|
.add(controller)
|
|
62
81
|
.add(new Transform())
|
|
63
|
-
.build(
|
|
64
|
-
|
|
82
|
+
.build(ecd);
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
harness.initialize({
|
|
68
86
|
configuration(config, engine) {
|
|
69
|
-
|
|
87
|
+
const gltfAssetLoader = new GLTFAssetLoader();
|
|
88
|
+
config.addLoader(GameAssetType.ModelGLTF, gltfAssetLoader);
|
|
89
|
+
config.addLoader(GameAssetType.ModelGLTF_JSON, gltfAssetLoader);
|
|
70
90
|
config.addSystem(new SGMeshAnimationControllerSystem(engine));
|
|
71
91
|
config.addSystem(new SGMeshSystem(engine));
|
|
72
92
|
config.addSystem(new ShadedGeometrySystem(engine));
|