@woosh/meep-engine 2.110.4 → 2.110.6
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 +117 -111
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +118 -109
- package/package.json +1 -1
- package/src/core/events/signal/Signal.d.ts.map +1 -1
- package/src/core/events/signal/Signal.js +3 -98
- package/src/core/events/signal/dispatchViaProxy.d.ts +7 -0
- package/src/core/events/signal/dispatchViaProxy.d.ts.map +1 -0
- package/src/core/events/signal/dispatchViaProxy.js +60 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandle.d.ts +9 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandle.d.ts.map +1 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandle.js +26 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.d.ts +9 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.d.ts.map +1 -0
- package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.js +21 -0
- package/src/core/fsm/simple/SimpleStateMachine.d.ts.map +1 -1
- package/src/core/fsm/simple/SimpleStateMachine.js +2 -1
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts +2 -2
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +1 -1
- package/src/core/geom/3d/sphere/sphere_fibonacci_point.d.ts +18 -0
- package/src/core/geom/3d/sphere/sphere_fibonacci_point.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/sphere_fibonacci_point.js +51 -0
- package/src/engine/animation/clip/AnimationClip.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationClip.js +4 -0
- package/src/engine/animation/clip/AnimationInterpolationKind.d.ts +7 -0
- package/src/engine/animation/clip/AnimationInterpolationKind.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationInterpolationKind.js +9 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts +12 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationTrack.js +20 -1
- package/src/engine/animation/clip/AnimationTrackBinding.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationTrackBinding.js +12 -0
- package/src/engine/animation/clip/bind_property_writer.d.ts +9 -0
- package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -0
- package/src/engine/animation/clip/bind_property_writer.js +118 -0
- package/src/engine/animation/clip/curve_from_track_data.d.ts +12 -0
- package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -0
- package/src/engine/animation/clip/curve_from_track_data.js +27 -0
- package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.d.ts +10 -0
- package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.d.ts.map +1 -0
- package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.js +33 -0
- package/src/engine/animation/clip/curve_from_track_data_discrete.d.ts +10 -0
- package/src/engine/animation/clip/curve_from_track_data_discrete.d.ts.map +1 -0
- package/src/engine/animation/clip/curve_from_track_data_discrete.js +30 -0
- package/src/engine/animation/clip/curve_from_track_data_linear.d.ts +10 -0
- package/src/engine/animation/clip/curve_from_track_data_linear.d.ts.map +1 -0
- package/src/engine/animation/clip/curve_from_track_data_linear.js +25 -0
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +14 -239
- package/src/engine/animation/curve/AnimationCurve.d.ts +17 -17
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +30 -20
- package/src/engine/animation/curve/Keyframe.d.ts +5 -0
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +6 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts +7 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts.map +1 -1
- package/src/engine/animation/curve/binding/BoundValueWriter.js +9 -1
- package/src/engine/animation/curve/compute_curve_aabb.d.ts +1 -1
- package/src/engine/animation/curve/compute_curve_aabb.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +9 -7
- package/src/engine/ecs/components/Tag.d.ts +2 -0
- package/src/engine/ecs/parent/EntityNode.d.ts.map +1 -1
- package/src/engine/ecs/parent/EntityNode.js +2 -1
- package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.d.ts +2 -1
- package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.js +4 -1
- package/src/engine/graphics/sh3/gi/material/common.glsl +3 -3
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -3
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts +2 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +6 -30
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.js +163 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +2 -2
- package/src/engine/graphics/trail/x/RibbonXMaterialSpec.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXMaterialSpec.js +10 -2
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +7 -5
package/build/meep.module.js
CHANGED
|
@@ -897,13 +897,6 @@ function m4_multiply(out, a, b) {
|
|
|
897
897
|
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
-
const SignalFlags = {
|
|
901
|
-
/**
|
|
902
|
-
* If set - signal will not invoke handlers when dispatched
|
|
903
|
-
*/
|
|
904
|
-
Silent: 1
|
|
905
|
-
};
|
|
906
|
-
|
|
907
900
|
/**
|
|
908
901
|
*
|
|
909
902
|
* @enum {number}
|
|
@@ -982,6 +975,118 @@ class SignalHandler {
|
|
|
982
975
|
*/
|
|
983
976
|
SignalHandler.prototype.isSignalHandler = true;
|
|
984
977
|
|
|
978
|
+
/**
|
|
979
|
+
* Common dispatch stack
|
|
980
|
+
* @readonly
|
|
981
|
+
* @type {SignalHandler[]}
|
|
982
|
+
*/
|
|
983
|
+
const dispatch_stack$1 = [];
|
|
984
|
+
let dispatch_stack_top$1 = 0;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
*
|
|
988
|
+
* @param {function} f
|
|
989
|
+
* @param {*} context
|
|
990
|
+
* @param {Array} args
|
|
991
|
+
*/
|
|
992
|
+
function dispatchCallback(f, context, args) {
|
|
993
|
+
|
|
994
|
+
try {
|
|
995
|
+
f.apply(context, args);
|
|
996
|
+
} catch (e) {
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
*
|
|
1002
|
+
* @param {SignalHandler[]} handlers
|
|
1003
|
+
* @param {Array} [args]
|
|
1004
|
+
*/
|
|
1005
|
+
function dispatchViaProxy(handlers, args) {
|
|
1006
|
+
const length = handlers.length;
|
|
1007
|
+
|
|
1008
|
+
const stack_pointer = dispatch_stack_top$1;
|
|
1009
|
+
const stack_frame_end = stack_pointer + length;
|
|
1010
|
+
dispatch_stack_top$1 = stack_frame_end;
|
|
1011
|
+
|
|
1012
|
+
let i, h;
|
|
1013
|
+
for (i = 0; i < length; i++) {
|
|
1014
|
+
//copy to proxy
|
|
1015
|
+
dispatch_stack$1[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
1019
|
+
h = dispatch_stack$1[i];
|
|
1020
|
+
|
|
1021
|
+
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1022
|
+
//handler should be cut
|
|
1023
|
+
const p = handlers.indexOf(h);
|
|
1024
|
+
handlers.splice(p, 1);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
dispatchCallback(h.handle, h.context, args);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
//drop stack frame
|
|
1031
|
+
dispatch_stack_top$1 = stack_pointer;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
*
|
|
1036
|
+
* @param {SignalHandler[]} handlers
|
|
1037
|
+
* @param {function} f
|
|
1038
|
+
* @param {*} [thisArg]
|
|
1039
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
1040
|
+
*/
|
|
1041
|
+
function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
1042
|
+
const l = handlers.length;
|
|
1043
|
+
|
|
1044
|
+
for (let i = 0; i < l; i++) {
|
|
1045
|
+
const signalHandler = handlers[i];
|
|
1046
|
+
|
|
1047
|
+
if (signalHandler.handle === f) {
|
|
1048
|
+
|
|
1049
|
+
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
1050
|
+
//context variable doesn't match
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
return i;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
return -1;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
*
|
|
1063
|
+
* @param {SignalHandler[]} handlers
|
|
1064
|
+
* @param {function} f
|
|
1065
|
+
* @param {*} ctx
|
|
1066
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
1067
|
+
*/
|
|
1068
|
+
function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
1069
|
+
const l = handlers.length;
|
|
1070
|
+
|
|
1071
|
+
for (let i = 0; i < l; i++) {
|
|
1072
|
+
const handler = handlers[i];
|
|
1073
|
+
|
|
1074
|
+
if (handler.handle === f && handler.context === ctx) {
|
|
1075
|
+
return i;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
return -1;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
const SignalFlags = {
|
|
1084
|
+
/**
|
|
1085
|
+
* If set - signal will not invoke handlers when dispatched
|
|
1086
|
+
*/
|
|
1087
|
+
Silent: 1
|
|
1088
|
+
};
|
|
1089
|
+
|
|
985
1090
|
/**
|
|
986
1091
|
* Common dispatch stack
|
|
987
1092
|
* @readonly
|
|
@@ -1560,55 +1665,6 @@ class Signal {
|
|
|
1560
1665
|
*/
|
|
1561
1666
|
Signal.prototype.isSignal = true;
|
|
1562
1667
|
|
|
1563
|
-
/**
|
|
1564
|
-
*
|
|
1565
|
-
* @param {SignalHandler[]} handlers
|
|
1566
|
-
* @param {function} f
|
|
1567
|
-
* @param {*} [thisArg]
|
|
1568
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
1569
|
-
*/
|
|
1570
|
-
function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
1571
|
-
const l = handlers.length;
|
|
1572
|
-
|
|
1573
|
-
for (let i = 0; i < l; i++) {
|
|
1574
|
-
const signalHandler = handlers[i];
|
|
1575
|
-
|
|
1576
|
-
if (signalHandler.handle === f) {
|
|
1577
|
-
|
|
1578
|
-
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
1579
|
-
//context variable doesn't match
|
|
1580
|
-
continue;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
return i;
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
return -1;
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
/**
|
|
1591
|
-
*
|
|
1592
|
-
* @param {SignalHandler[]} handlers
|
|
1593
|
-
* @param {function} f
|
|
1594
|
-
* @param {*} ctx
|
|
1595
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
1596
|
-
*/
|
|
1597
|
-
function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
1598
|
-
const l = handlers.length;
|
|
1599
|
-
|
|
1600
|
-
for (let i = 0; i < l; i++) {
|
|
1601
|
-
const handler = handlers[i];
|
|
1602
|
-
|
|
1603
|
-
if (handler.handle === f && handler.context === ctx) {
|
|
1604
|
-
return i;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
return -1;
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
1668
|
/**
|
|
1613
1669
|
*
|
|
1614
1670
|
* @param {Signal} signal
|
|
@@ -1644,54 +1700,6 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
|
1644
1700
|
}
|
|
1645
1701
|
|
|
1646
1702
|
return false;
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
*
|
|
1651
|
-
* @param {function} f
|
|
1652
|
-
* @param {*} context
|
|
1653
|
-
* @param {Array} args
|
|
1654
|
-
*/
|
|
1655
|
-
function dispatchCallback(f, context, args) {
|
|
1656
|
-
|
|
1657
|
-
try {
|
|
1658
|
-
f.apply(context, args);
|
|
1659
|
-
} catch (e) {
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1664
|
-
*
|
|
1665
|
-
* @param {SignalHandler[]} handlers
|
|
1666
|
-
* @param {Array} [args]
|
|
1667
|
-
*/
|
|
1668
|
-
function dispatchViaProxy(handlers, args) {
|
|
1669
|
-
const length = handlers.length;
|
|
1670
|
-
|
|
1671
|
-
const stack_pointer = dispatch_stack_top;
|
|
1672
|
-
const stack_frame_end = stack_pointer + length;
|
|
1673
|
-
dispatch_stack_top = stack_frame_end;
|
|
1674
|
-
|
|
1675
|
-
let i, h;
|
|
1676
|
-
for (i = 0; i < length; i++) {
|
|
1677
|
-
//copy to proxy
|
|
1678
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
1682
|
-
h = dispatch_stack[i];
|
|
1683
|
-
|
|
1684
|
-
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
1685
|
-
//handler should be cut
|
|
1686
|
-
const p = handlers.indexOf(h);
|
|
1687
|
-
handlers.splice(p, 1);
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
dispatchCallback(h.handle, h.context, args);
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
//drop stack frame
|
|
1694
|
-
dispatch_stack_top = stack_pointer;
|
|
1695
1703
|
}
|
|
1696
1704
|
|
|
1697
1705
|
/**
|
|
@@ -74517,7 +74525,8 @@ class EntityNode {
|
|
|
74517
74525
|
// destroy children first
|
|
74518
74526
|
const children = this.__children;
|
|
74519
74527
|
const child_count = children.length;
|
|
74520
|
-
|
|
74528
|
+
|
|
74529
|
+
for (let i = child_count - 1; i >= 0; i--) {
|
|
74521
74530
|
const child = children[i];
|
|
74522
74531
|
|
|
74523
74532
|
child.destroy();
|
|
@@ -94725,11 +94734,11 @@ class EntityComponentDataset {
|
|
|
94725
94734
|
|
|
94726
94735
|
/**
|
|
94727
94736
|
* @template T
|
|
94728
|
-
* @param {number}
|
|
94737
|
+
* @param {number} entity_id
|
|
94729
94738
|
* @param {Class<T>} klass
|
|
94730
94739
|
* @returns {T|undefined}
|
|
94731
94740
|
*/
|
|
94732
|
-
getComponent(
|
|
94741
|
+
getComponent(entity_id, klass) {
|
|
94733
94742
|
|
|
94734
94743
|
const componentIndex = this.computeComponentTypeIndex(klass);
|
|
94735
94744
|
|
|
@@ -94738,7 +94747,7 @@ class EntityComponentDataset {
|
|
|
94738
94747
|
return undefined;
|
|
94739
94748
|
}
|
|
94740
94749
|
|
|
94741
|
-
return this.getComponentByIndex(
|
|
94750
|
+
return this.getComponentByIndex(entity_id, componentIndex);
|
|
94742
94751
|
}
|
|
94743
94752
|
|
|
94744
94753
|
/**
|
|
@@ -118146,4 +118155,4 @@ function v4_distance_sqr(
|
|
|
118146
118155
|
return v4_length_sqr(x0 - x1, y0 - y1, z0 - z1, w0 - w1);
|
|
118147
118156
|
}
|
|
118148
118157
|
|
|
118149
|
-
export { AmbientOcclusionPostProcessEffect, Behavior, BehaviorStatus, Blackboard, Cache, EngineConfiguration, EngineHarness, ForwardPlusRenderingPlugin, HashMap, Light, ParallelBehavior, ParallelBehaviorPolicy, SGMesh, SGMeshSystem, SelectorBehavior, SequenceBehavior, ShadedGeometry, ShadedGeometrySystem, Signal, SignalBinding, Transform,
|
|
118158
|
+
export { AmbientOcclusionPostProcessEffect, Behavior, BehaviorStatus, Blackboard, Cache, EngineConfiguration, EngineHarness, ForwardPlusRenderingPlugin, HashMap, Light, ParallelBehavior, ParallelBehaviorPolicy, SGMesh, SGMeshSystem, SelectorBehavior, SequenceBehavior, ShadedGeometry, ShadedGeometrySystem, Signal, SignalBinding, Transform, find_path_on_grid_astar, quat3_createFromAxisAngle, three_update_shadow_camera_extents, v2_angle_between, v2_bearing_angle_towards, v2_distance, v2_dot, v2_length_sqr, v2_magnitude, v4_distance_sqr, v4_dot, v4_length_sqr, v4_multiply_mat4 };
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/Signal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/Signal.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;IACI;;;OAGG;IACH,iBAAc;IAEd;;;;OAIG;IACH,cAAU;IAWV;;;OAGG;IACH,yBAEC;IAfD;;;OAGG;IACH,sBAEC;IAYD;;;;OAIG;IACH,cAHW,MAAM;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;KAAY,SAClB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM;;KAAY,GAChB,OAAO,CAInB;IAGD;;;;;OAKG;IACH,4CAFa,OAAO,CAQnB;IAED,aAEC;IAED,eAEC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,yCAQC;IAED;;;;OAIG;IACH,sCAYC;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAUnB;IAED;;;;;;OAMG;IACH,kBAGC;IAED;;;OAGG;IACH,+BAQC;IAED;;;OAGG;IACH,cA4CC;IAED;;;;OAIG;IACH,sBA6CC;IAED;;;;OAIG;IACH,4BA4CC;IAED;;;;;OAKG;IACH,oCA4CC;IAED;;;;;;OAMG;IACH,4CA4CC;IAED;;;;;;;;OAQG;IACH,4DA4CC;IAED;;;;;;;;;;OAUG;IACH,4EA4CC;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,MAAM,CAalB;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;CAPxB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
|
+
import { dispatchViaProxy } from "./dispatchViaProxy.js";
|
|
3
|
+
import { findSignalHandlerIndexByHandle } from "./findSignalHandlerIndexByHandle.js";
|
|
4
|
+
import { findSignalHandlerIndexByHandleAndContext } from "./findSignalHandlerIndexByHandleAndContext.js";
|
|
2
5
|
import { SignalFlags } from "./SignalFlags.js";
|
|
3
6
|
import { SignalHandler, SignalHandlerFlags } from "./SignalHandler.js";
|
|
4
7
|
|
|
@@ -590,55 +593,6 @@ export class Signal {
|
|
|
590
593
|
*/
|
|
591
594
|
Signal.prototype.isSignal = true;
|
|
592
595
|
|
|
593
|
-
/**
|
|
594
|
-
*
|
|
595
|
-
* @param {SignalHandler[]} handlers
|
|
596
|
-
* @param {function} f
|
|
597
|
-
* @param {*} [thisArg]
|
|
598
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
599
|
-
*/
|
|
600
|
-
export function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
601
|
-
const l = handlers.length;
|
|
602
|
-
|
|
603
|
-
for (let i = 0; i < l; i++) {
|
|
604
|
-
const signalHandler = handlers[i];
|
|
605
|
-
|
|
606
|
-
if (signalHandler.handle === f) {
|
|
607
|
-
|
|
608
|
-
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
609
|
-
//context variable doesn't match
|
|
610
|
-
continue;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
return i;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
return -1;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
*
|
|
622
|
-
* @param {SignalHandler[]} handlers
|
|
623
|
-
* @param {function} f
|
|
624
|
-
* @param {*} ctx
|
|
625
|
-
* @returns {number} index of the handler, or -1 if not found
|
|
626
|
-
*/
|
|
627
|
-
export function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
628
|
-
const l = handlers.length;
|
|
629
|
-
|
|
630
|
-
for (let i = 0; i < l; i++) {
|
|
631
|
-
const handler = handlers[i];
|
|
632
|
-
|
|
633
|
-
if (handler.handle === f && handler.context === ctx) {
|
|
634
|
-
return i;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
return -1;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
596
|
/**
|
|
643
597
|
*
|
|
644
598
|
* @param {Signal} signal
|
|
@@ -676,54 +630,5 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
|
676
630
|
return false;
|
|
677
631
|
}
|
|
678
632
|
|
|
679
|
-
/**
|
|
680
|
-
*
|
|
681
|
-
* @param {function} f
|
|
682
|
-
* @param {*} context
|
|
683
|
-
* @param {Array} args
|
|
684
|
-
*/
|
|
685
|
-
function dispatchCallback(f, context, args) {
|
|
686
|
-
assert.isFunction(f, 'f');
|
|
687
|
-
|
|
688
|
-
try {
|
|
689
|
-
f.apply(context, args)
|
|
690
|
-
} catch (e) {
|
|
691
|
-
console.error("Failed to dispatch handler", f, e);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
*
|
|
697
|
-
* @param {SignalHandler[]} handlers
|
|
698
|
-
* @param {Array} [args]
|
|
699
|
-
*/
|
|
700
|
-
export function dispatchViaProxy(handlers, args) {
|
|
701
|
-
const length = handlers.length;
|
|
702
|
-
|
|
703
|
-
const stack_pointer = dispatch_stack_top;
|
|
704
|
-
const stack_frame_end = stack_pointer + length;
|
|
705
|
-
dispatch_stack_top = stack_frame_end;
|
|
706
|
-
|
|
707
|
-
let i, h;
|
|
708
|
-
for (i = 0; i < length; i++) {
|
|
709
|
-
//copy to proxy
|
|
710
|
-
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
714
|
-
h = dispatch_stack[i];
|
|
715
|
-
|
|
716
|
-
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
717
|
-
//handler should be cut
|
|
718
|
-
const p = handlers.indexOf(h);
|
|
719
|
-
handlers.splice(p, 1);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
dispatchCallback(h.handle, h.context, args);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
//drop stack frame
|
|
726
|
-
dispatch_stack_top = stack_pointer;
|
|
727
|
-
}
|
|
728
633
|
|
|
729
634
|
export default Signal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatchViaProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/dispatchViaProxy.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,2CAHW,eAAe,sBA8BzB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import { SignalHandlerFlags } from "./SignalHandler.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Common dispatch stack
|
|
6
|
+
* @readonly
|
|
7
|
+
* @type {SignalHandler[]}
|
|
8
|
+
*/
|
|
9
|
+
const dispatch_stack = [];
|
|
10
|
+
let dispatch_stack_top = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {function} f
|
|
15
|
+
* @param {*} context
|
|
16
|
+
* @param {Array} args
|
|
17
|
+
*/
|
|
18
|
+
function dispatchCallback(f, context, args) {
|
|
19
|
+
assert.isFunction(f, 'f');
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
f.apply(context, args)
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error("Failed to dispatch handler", f, e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {SignalHandler[]} handlers
|
|
31
|
+
* @param {Array} [args]
|
|
32
|
+
*/
|
|
33
|
+
export function dispatchViaProxy(handlers, args) {
|
|
34
|
+
const length = handlers.length;
|
|
35
|
+
|
|
36
|
+
const stack_pointer = dispatch_stack_top;
|
|
37
|
+
const stack_frame_end = stack_pointer + length;
|
|
38
|
+
dispatch_stack_top = stack_frame_end;
|
|
39
|
+
|
|
40
|
+
let i, h;
|
|
41
|
+
for (i = 0; i < length; i++) {
|
|
42
|
+
//copy to proxy
|
|
43
|
+
dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
|
|
47
|
+
h = dispatch_stack[i];
|
|
48
|
+
|
|
49
|
+
if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
|
|
50
|
+
//handler should be cut
|
|
51
|
+
const p = handlers.indexOf(h);
|
|
52
|
+
handlers.splice(p, 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dispatchCallback(h.handle, h.context, args);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//drop stack frame
|
|
59
|
+
dispatch_stack_top = stack_pointer;
|
|
60
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {SignalHandler[]} handlers
|
|
4
|
+
* @param {function} f
|
|
5
|
+
* @param {*} [thisArg]
|
|
6
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
7
|
+
*/
|
|
8
|
+
export function findSignalHandlerIndexByHandle(handlers: SignalHandler[], f: Function, thisArg?: any): number;
|
|
9
|
+
//# sourceMappingURL=findSignalHandlerIndexByHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findSignalHandlerIndexByHandle.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/findSignalHandlerIndexByHandle.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,yDALW,eAAe,+BAGb,MAAM,CAoBlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {SignalHandler[]} handlers
|
|
4
|
+
* @param {function} f
|
|
5
|
+
* @param {*} [thisArg]
|
|
6
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
7
|
+
*/
|
|
8
|
+
export function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
|
|
9
|
+
const l = handlers.length;
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < l; i++) {
|
|
12
|
+
const signalHandler = handlers[i];
|
|
13
|
+
|
|
14
|
+
if (signalHandler.handle === f) {
|
|
15
|
+
|
|
16
|
+
if (thisArg !== undefined && thisArg !== signalHandler.context) {
|
|
17
|
+
//context variable doesn't match
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return i;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return -1;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {SignalHandler[]} handlers
|
|
4
|
+
* @param {function} f
|
|
5
|
+
* @param {*} ctx
|
|
6
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
7
|
+
*/
|
|
8
|
+
export function findSignalHandlerIndexByHandleAndContext(handlers: SignalHandler[], f: Function, ctx: any): number;
|
|
9
|
+
//# sourceMappingURL=findSignalHandlerIndexByHandleAndContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findSignalHandlerIndexByHandleAndContext.d.ts","sourceRoot":"","sources":["../../../../../src/core/events/signal/findSignalHandlerIndexByHandleAndContext.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mEALW,eAAe,0BAGb,MAAM,CAelB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {SignalHandler[]} handlers
|
|
4
|
+
* @param {function} f
|
|
5
|
+
* @param {*} ctx
|
|
6
|
+
* @returns {number} index of the handler, or -1 if not found
|
|
7
|
+
*/
|
|
8
|
+
export function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
|
|
9
|
+
const l = handlers.length;
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < l; i++) {
|
|
12
|
+
const handler = handlers[i];
|
|
13
|
+
|
|
14
|
+
if (handler.handle === f && handler.context === ctx) {
|
|
15
|
+
return i;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStateMachine.d.ts","sourceRoot":"","sources":["../../../../../src/core/fsm/simple/SimpleStateMachine.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SimpleStateMachine.d.ts","sourceRoot":"","sources":["../../../../../src/core/fsm/simple/SimpleStateMachine.js"],"names":[],"mappings":"AAOA;IAuBI;;;OAGG;IACH,yBAFW,6BAA6B,EAUvC;IAjCD;;;;OAIG;IACH,gBAAa;IAEb;;;;OAIG;IACH,kCAA+B;IAE/B;;;;OAIG;IACH,iCAA8B;IAS1B;;;OAGG;IACH,aAFU,6BAA6B,CAET;IAGlC;;;;;OAKG;IACH,iCAJW,MAAM,0CAgBhB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,6CAmBhB;IAED;;;;;OAKG;IACH,gCAJW,MAAM,0CAgBhB;IAED;;;;;OAKG;IACH,mCAJW,MAAM,6CAqBhB;IAED;;;OAGG;IACH,YAFW,MAAM,QAuBhB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,sDAFY,OAAO,CAmClB;CACJ;8CAxO6C,oCAAoC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { dispatchViaProxy
|
|
1
|
+
import { dispatchViaProxy } from "../../events/signal/dispatchViaProxy.js";
|
|
2
|
+
import { findSignalHandlerIndexByHandle } from "../../events/signal/findSignalHandlerIndexByHandle.js";
|
|
2
3
|
import { SignalHandler } from "../../events/signal/SignalHandler.js";
|
|
3
4
|
|
|
4
5
|
import { noop } from "../../function/noop.js";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @see A Survey of Efficient Representations for Independent Unit Vectors (Journal of Computer Graphics Techniques Vol. 3, No. 2, 2014) - page 13
|
|
5
5
|
* @see https://gamedev.stackexchange.com/questions/169508/octahedral-impostors-octahedral-mapping
|
|
6
6
|
*
|
|
7
|
-
* @param {number[]} output
|
|
7
|
+
* @param {number[]|Float32Array} output
|
|
8
8
|
* @param {number} output_offset
|
|
9
9
|
* @param {number} x range [-1,1]
|
|
10
10
|
* @param {number} y range [-1,1]
|
|
11
11
|
* @param {number} z range [-1,1]
|
|
12
12
|
*/
|
|
13
|
-
export function encode_unit_to_octahedron(output: number[], output_offset: number, x: number, y: number, z: number): void;
|
|
13
|
+
export function encode_unit_to_octahedron(output: number[] | Float32Array, output_offset: number, x: number, y: number, z: number): void;
|
|
14
14
|
//# sourceMappingURL=encode_unit_to_octahedron.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode_unit_to_octahedron.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,kDANW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"encode_unit_to_octahedron.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,kDANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QA0BhB"}
|
|
@@ -6,7 +6,7 @@ import { sign_not_zero } from "../../../../math/sign_not_zero.js";
|
|
|
6
6
|
* @see A Survey of Efficient Representations for Independent Unit Vectors (Journal of Computer Graphics Techniques Vol. 3, No. 2, 2014) - page 13
|
|
7
7
|
* @see https://gamedev.stackexchange.com/questions/169508/octahedral-impostors-octahedral-mapping
|
|
8
8
|
*
|
|
9
|
-
* @param {number[]} output
|
|
9
|
+
* @param {number[]|Float32Array} output
|
|
10
10
|
* @param {number} output_offset
|
|
11
11
|
* @param {number} x range [-1,1]
|
|
12
12
|
* @param {number} y range [-1,1]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a spherical fibonacci point
|
|
3
|
+
*
|
|
4
|
+
* http://lgdv.cs.fau.de/publications/publication/Pub.2015.tech.IMMD.IMMD9.spheri/
|
|
5
|
+
*
|
|
6
|
+
* To generate a nearly uniform point distribution on the unit sphere of size N, do
|
|
7
|
+
* for (const i = 0.0; i < N; i += 1.0) {
|
|
8
|
+
* sphere_fibonacci_point(points, i*3, i, N);
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* The points go from z = +1 down to z = -1 in a spiral. To generate samples on the +z hemisphere, just stop before i > N/2.
|
|
12
|
+
* @param {number[]|Float32Array} output
|
|
13
|
+
* @param {number} output_offset
|
|
14
|
+
* @param {number} i index of a point, from 0 to n-1
|
|
15
|
+
* @param {number} n total number of points
|
|
16
|
+
*/
|
|
17
|
+
export function sphere_fibonacci_point(output: number[] | Float32Array, output_offset: number, i: number, n: number): void;
|
|
18
|
+
//# sourceMappingURL=sphere_fibonacci_point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sphere_fibonacci_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/sphere/sphere_fibonacci_point.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AACH,+CALW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,KACN,MAAM,KACN,MAAM,QAoBhB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
import { clamp01 } from "../../../math/clamp01.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} a
|
|
7
|
+
* @param {number} b
|
|
8
|
+
* @return {number}
|
|
9
|
+
*/
|
|
10
|
+
function multiply_add_fraction(a, b) {
|
|
11
|
+
const ab = a * b;
|
|
12
|
+
return ab - Math.floor(ab);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const PHI = Math.sqrt(5) * 0.5 + 0.5;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generate a spherical fibonacci point
|
|
19
|
+
*
|
|
20
|
+
* http://lgdv.cs.fau.de/publications/publication/Pub.2015.tech.IMMD.IMMD9.spheri/
|
|
21
|
+
*
|
|
22
|
+
* To generate a nearly uniform point distribution on the unit sphere of size N, do
|
|
23
|
+
* for (const i = 0.0; i < N; i += 1.0) {
|
|
24
|
+
* sphere_fibonacci_point(points, i*3, i, N);
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* The points go from z = +1 down to z = -1 in a spiral. To generate samples on the +z hemisphere, just stop before i > N/2.
|
|
28
|
+
* @param {number[]|Float32Array} output
|
|
29
|
+
* @param {number} output_offset
|
|
30
|
+
* @param {number} i index of a point, from 0 to n-1
|
|
31
|
+
* @param {number} n total number of points
|
|
32
|
+
*/
|
|
33
|
+
export function sphere_fibonacci_point(output, output_offset, i, n) {
|
|
34
|
+
assert.isNonNegativeInteger(i, 'i');
|
|
35
|
+
assert.isNonNegativeInteger(n, 'n');
|
|
36
|
+
assert.isNonNegativeInteger(output_offset, 'output_offset');
|
|
37
|
+
|
|
38
|
+
const phi = 2 * Math.PI * multiply_add_fraction(i, PHI - 1);
|
|
39
|
+
|
|
40
|
+
const cosTheta = 1.0 - (2.0 * i + 1.0) * (1.0 / n);
|
|
41
|
+
|
|
42
|
+
const sinTheta = Math.sqrt(clamp01(1.0 - cosTheta * cosTheta));
|
|
43
|
+
|
|
44
|
+
const x = Math.cos(phi) * sinTheta;
|
|
45
|
+
const y = Math.sin(phi) * sinTheta;
|
|
46
|
+
const z = cosTheta;
|
|
47
|
+
|
|
48
|
+
output[output_offset] = x;
|
|
49
|
+
output[output_offset + 1] = y;
|
|
50
|
+
output[output_offset + 2] = z;
|
|
51
|
+
}
|