@woosh/meep-engine 2.78.1 → 2.79.0
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 +57 -35
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +57 -35
- package/package.json +1 -1
- package/src/core/geom/Quaternion.js +1 -1
- package/src/core/geom/vec3/v3_angle_between.js +15 -4
- package/src/core/geom/vec3/{v3_computeOffsetVector.js → v3_displace_in_direction.js} +11 -2
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +2 -2
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +2 -2
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +2 -1
- package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +45 -33
- package/src/core/primitives/strings/prefixTree/PrefixTree.js +0 -225
- package/src/core/primitives/strings/prefixTree/PrefixTree.spec.js +0 -39
- package/src/core/primitives/strings/prefixTree/PrefixTreeLeaf.js +0 -25
- package/src/core/primitives/strings/prefixTree/PrefixTreeNode.js +0 -16
package/build/meep.cjs
CHANGED
|
@@ -1980,10 +1980,15 @@ function v3_length(x, y, z) {
|
|
|
1980
1980
|
* @param {number} z1
|
|
1981
1981
|
* @returns {number}
|
|
1982
1982
|
*/
|
|
1983
|
-
function v3_angle_between(
|
|
1983
|
+
function v3_angle_between(
|
|
1984
|
+
x0, y0, z0,
|
|
1985
|
+
x1, y1, z1
|
|
1986
|
+
) {
|
|
1987
|
+
|
|
1984
1988
|
const theta = v3_angle_cos_between(x0, y0, z0, x1, y1, z1);
|
|
1985
1989
|
|
|
1986
1990
|
return Math.acos(theta);
|
|
1991
|
+
|
|
1987
1992
|
}
|
|
1988
1993
|
|
|
1989
1994
|
/**
|
|
@@ -1994,9 +1999,13 @@ function v3_angle_between(x0, y0, z0, x1, y1, z1) {
|
|
|
1994
1999
|
* @param {number} x1
|
|
1995
2000
|
* @param {number} y1
|
|
1996
2001
|
* @param {number} z1
|
|
1997
|
-
* @returns {number}
|
|
2002
|
+
* @returns {number} value between -1 and 1, cosine of the angle between vectors
|
|
1998
2003
|
*/
|
|
1999
|
-
function v3_angle_cos_between(
|
|
2004
|
+
function v3_angle_cos_between(
|
|
2005
|
+
x0, y0, z0,
|
|
2006
|
+
x1, y1, z1
|
|
2007
|
+
) {
|
|
2008
|
+
|
|
2000
2009
|
const d = v3_dot(x0, y0, z0, x1, y1, z1);
|
|
2001
2010
|
|
|
2002
2011
|
const magnitude_0 = v3_length(x0, y0, z0);
|
|
@@ -2006,10 +2015,12 @@ function v3_angle_cos_between(x0, y0, z0, x1, y1, z1){
|
|
|
2006
2015
|
|
|
2007
2016
|
if (l === 0) {
|
|
2008
2017
|
// collective magnitude is 0, provide arbitrary angle
|
|
2018
|
+
// avoid division by 0
|
|
2009
2019
|
return 0;
|
|
2010
2020
|
}
|
|
2011
2021
|
|
|
2012
2022
|
return clamp$1(d / l, -1, 1);
|
|
2023
|
+
|
|
2013
2024
|
}
|
|
2014
2025
|
|
|
2015
2026
|
/**
|
|
@@ -4708,7 +4719,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
4708
4719
|
* @param {Quaternion} result
|
|
4709
4720
|
* @param {Quaternion} from
|
|
4710
4721
|
* @param {Quaternion} to
|
|
4711
|
-
* @param {number} max_delta
|
|
4722
|
+
* @param {number} max_delta in radians
|
|
4712
4723
|
*/
|
|
4713
4724
|
static rotateTowards(result, from, to, max_delta) {
|
|
4714
4725
|
|
|
@@ -72960,6 +72971,7 @@ class TransformAttachment {
|
|
|
72960
72971
|
|
|
72961
72972
|
/**
|
|
72962
72973
|
* transform relative to the attachment target
|
|
72974
|
+
* Think of it as "local transform"
|
|
72963
72975
|
* @type {Transform}
|
|
72964
72976
|
*/
|
|
72965
72977
|
transform = new Transform();
|
|
@@ -73573,7 +73585,10 @@ class UpdateContext {
|
|
|
73573
73585
|
}
|
|
73574
73586
|
|
|
73575
73587
|
update() {
|
|
73576
|
-
this.transform.multiplyTransforms(
|
|
73588
|
+
this.transform.multiplyTransforms(
|
|
73589
|
+
this.parent_transform,
|
|
73590
|
+
this.attachment.transform
|
|
73591
|
+
);
|
|
73577
73592
|
}
|
|
73578
73593
|
|
|
73579
73594
|
/**
|
|
@@ -73596,51 +73611,51 @@ class UpdateContext {
|
|
|
73596
73611
|
link() {
|
|
73597
73612
|
const t_parent = this.parent_transform;
|
|
73598
73613
|
|
|
73599
|
-
t_parent.
|
|
73600
|
-
t_parent.rotation.onChanged.add(this.update, this);
|
|
73601
|
-
t_parent.scale.onChanged.add(this.update, this);
|
|
73614
|
+
t_parent.subscribe(this.update, this);
|
|
73602
73615
|
|
|
73603
73616
|
const t_attachment = this.attachment.transform;
|
|
73604
|
-
|
|
73605
|
-
t_attachment.
|
|
73606
|
-
t_attachment.scale.onChanged.add(this.update,this);
|
|
73617
|
+
|
|
73618
|
+
t_attachment.subscribe(this.update, this);
|
|
73607
73619
|
}
|
|
73608
73620
|
|
|
73609
73621
|
unlink() {
|
|
73610
73622
|
const transform = this.parent_transform;
|
|
73611
73623
|
|
|
73612
|
-
transform.
|
|
73613
|
-
transform.rotation.onChanged.remove(this.update, this);
|
|
73614
|
-
transform.scale.onChanged.remove(this.update, this);
|
|
73624
|
+
transform.unsubscribe(this.update, this);
|
|
73615
73625
|
|
|
73616
73626
|
const t_attachment = this.attachment.transform;
|
|
73617
|
-
|
|
73618
|
-
t_attachment.
|
|
73619
|
-
t_attachment.scale.onChanged.remove(this.update,this);
|
|
73627
|
+
|
|
73628
|
+
t_attachment.unsubscribe(this.update, this);
|
|
73620
73629
|
}
|
|
73621
73630
|
}
|
|
73622
73631
|
|
|
73623
73632
|
class TransformAttachmentSystem extends System {
|
|
73633
|
+
|
|
73634
|
+
/**
|
|
73635
|
+
*
|
|
73636
|
+
* @type {UpdateContext[]}
|
|
73637
|
+
* @private
|
|
73638
|
+
*/
|
|
73639
|
+
__contexts = [];
|
|
73640
|
+
|
|
73641
|
+
/**
|
|
73642
|
+
*
|
|
73643
|
+
* @type {UpdateContext[]}
|
|
73644
|
+
* @private
|
|
73645
|
+
*/
|
|
73646
|
+
__queue = [];
|
|
73647
|
+
__queue_size = 0;
|
|
73648
|
+
__queue_cursor = 0;
|
|
73649
|
+
|
|
73624
73650
|
constructor() {
|
|
73625
73651
|
super();
|
|
73626
73652
|
|
|
73627
73653
|
this.dependencies = [TransformAttachment, Transform];
|
|
73628
73654
|
|
|
73629
|
-
|
|
73630
|
-
|
|
73631
|
-
|
|
73632
|
-
|
|
73633
|
-
*/
|
|
73634
|
-
this.__contexts = [];
|
|
73635
|
-
|
|
73636
|
-
/**
|
|
73637
|
-
*
|
|
73638
|
-
* @type {UpdateContext[]}
|
|
73639
|
-
* @private
|
|
73640
|
-
*/
|
|
73641
|
-
this.__queue = [];
|
|
73642
|
-
this.__queue_size = 0;
|
|
73643
|
-
this.__queue_cursor = 0;
|
|
73655
|
+
this.components_used = [
|
|
73656
|
+
ResourceAccessSpecification.from(TransformAttachment, ResourceAccessKind.Read),
|
|
73657
|
+
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
73658
|
+
];
|
|
73644
73659
|
}
|
|
73645
73660
|
|
|
73646
73661
|
/**
|
|
@@ -73668,6 +73683,12 @@ class TransformAttachmentSystem extends System {
|
|
|
73668
73683
|
this.__queue[this.__queue_size++] = ctx;
|
|
73669
73684
|
}
|
|
73670
73685
|
|
|
73686
|
+
/**
|
|
73687
|
+
*
|
|
73688
|
+
* @param {number} entity
|
|
73689
|
+
* @returns {boolean}
|
|
73690
|
+
* @private
|
|
73691
|
+
*/
|
|
73671
73692
|
__dequeue_entity(entity) {
|
|
73672
73693
|
for (let i = 0; i < this.__queue_size; i++) {
|
|
73673
73694
|
const ctx = this.__queue[i];
|
|
@@ -73696,9 +73717,7 @@ class TransformAttachmentSystem extends System {
|
|
|
73696
73717
|
ctx.entity = entity;
|
|
73697
73718
|
|
|
73698
73719
|
|
|
73699
|
-
|
|
73700
|
-
|
|
73701
|
-
ctx.ecd = ecd;
|
|
73720
|
+
ctx.ecd = this.entityManager.dataset;
|
|
73702
73721
|
|
|
73703
73722
|
if (ctx.bind_parent()) {
|
|
73704
73723
|
this.__finalize_link(ctx);
|
|
@@ -73733,12 +73752,14 @@ class TransformAttachmentSystem extends System {
|
|
|
73733
73752
|
|
|
73734
73753
|
update(timeDelta) {
|
|
73735
73754
|
const step_count = min2(this.__queue_size, QUEUE_ITERATION_COUNT);
|
|
73755
|
+
|
|
73736
73756
|
for (let i = 0; i < step_count; i++) {
|
|
73737
73757
|
const index = this.__queue_cursor % this.__queue_size;
|
|
73738
73758
|
|
|
73739
73759
|
const ctx = this.__queue[index];
|
|
73740
73760
|
|
|
73741
73761
|
if (ctx.bind_parent()) {
|
|
73762
|
+
// parent obtained
|
|
73742
73763
|
this.__finalize_link(ctx);
|
|
73743
73764
|
|
|
73744
73765
|
this.__queue.splice(index, 1);
|
|
@@ -73748,6 +73769,7 @@ class TransformAttachmentSystem extends System {
|
|
|
73748
73769
|
this.__queue_cursor++;
|
|
73749
73770
|
}
|
|
73750
73771
|
}
|
|
73772
|
+
|
|
73751
73773
|
}
|
|
73752
73774
|
}
|
|
73753
73775
|
|