@woosh/meep-engine 2.110.7 → 2.110.9

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.
Files changed (189) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +115 -119
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +115 -119
  5. package/editor/tools/v2/TransformControls.js +11 -6
  6. package/package.json +2 -1
  7. package/src/core/UUID.d.ts +3 -0
  8. package/src/core/UUID.d.ts.map +1 -1
  9. package/src/core/UUID.js +9 -7
  10. package/src/core/collection/array/arraySetDiff.d.ts.map +1 -1
  11. package/src/core/collection/array/arraySetDiff.js +0 -1
  12. package/src/core/collection/array/binarySearchHighIndex.d.ts.map +1 -1
  13. package/src/core/collection/array/binarySearchHighIndex.js +7 -1
  14. package/src/core/collection/array/computeHashArray.d.ts.map +1 -1
  15. package/src/core/collection/array/computeHashArray.js +3 -2
  16. package/src/core/collection/array/fastArrayEquals.d.ts +1 -0
  17. package/src/core/collection/array/fastArrayEquals.d.ts.map +1 -1
  18. package/src/core/collection/array/fastArrayEquals.js +1 -0
  19. package/src/core/collection/array/isArrayEqual.d.ts.map +1 -1
  20. package/src/core/collection/array/isArrayEqual.js +9 -12
  21. package/src/core/collection/array/isArrayEqual.spec.d.ts +2 -0
  22. package/src/core/collection/array/isArrayEqual.spec.d.ts.map +1 -0
  23. package/src/core/collection/array/isArrayEqual.spec.js +25 -0
  24. package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
  25. package/src/core/collection/array/typed/is_typed_array_equals.js +1 -0
  26. package/src/core/function/makeSequenceLoop.d.ts.map +1 -0
  27. package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
  28. package/src/core/geom/3d/shape/AbstractShape3D.js +14 -0
  29. package/src/core/geom/3d/shape/PointShape3D.d.ts +9 -0
  30. package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -0
  31. package/src/core/geom/3d/shape/PointShape3D.js +14 -0
  32. package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
  33. package/src/core/geom/3d/shape/TransformedShape3D.js +26 -8
  34. package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
  35. package/src/core/geom/3d/shape/UnionShape3D.js +33 -4
  36. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
  37. package/src/core/geom/3d/shape/UnitCubeShape3D.js +13 -6
  38. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
  39. package/src/core/geom/3d/shape/UnitSphereShape3D.js +10 -0
  40. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +15 -8
  41. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
  42. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +33 -9
  43. package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts +1 -1
  44. package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts.map +1 -1
  45. package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +7 -7
  46. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts +2 -0
  47. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts.map +1 -0
  48. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js +38 -0
  49. package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +42 -39
  50. package/src/core/geom/3d/v3_compute_triangle_normal.js +1 -1
  51. package/src/core/geom/3d/v3_negate_array.d.ts +9 -0
  52. package/src/core/geom/3d/v3_negate_array.d.ts.map +1 -0
  53. package/src/core/geom/3d/v3_negate_array.js +16 -0
  54. package/src/core/geom/Quaternion.d.ts.map +1 -1
  55. package/src/core/geom/Quaternion.js +30 -77
  56. package/src/core/geom/Vector3.d.ts +4 -0
  57. package/src/core/geom/Vector3.js +4 -4
  58. package/src/core/geom/vec3/v3_cross_array.d.ts +11 -0
  59. package/src/core/geom/vec3/v3_cross_array.d.ts.map +1 -0
  60. package/src/core/geom/vec3/v3_cross_array.js +31 -0
  61. package/src/core/geom/vec3/v3_displace_in_direction.js +3 -2
  62. package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts +12 -0
  63. package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts.map +1 -0
  64. package/src/core/geom/vec3/v3_displace_in_direction_array.js +22 -0
  65. package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
  66. package/src/core/geom/vec3/v3_dot_array_array.js +4 -1
  67. package/src/core/geom/vec3/v3_normalize_array.d.ts +3 -3
  68. package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
  69. package/src/core/geom/vec3/v3_normalize_array.js +3 -3
  70. package/src/core/math/copysign.d.ts +1 -1
  71. package/src/core/math/copysign.js +1 -1
  72. package/src/core/math/epsilonEquals.d.ts.map +1 -1
  73. package/src/core/math/epsilonEquals.js +3 -2
  74. package/src/core/math/linalg/README.md +1 -1
  75. package/src/core/math/random/randomGaussian.spec.js +1 -1
  76. package/src/core/math/spline/spline_hermite3.d.ts +1 -1
  77. package/src/core/math/spline/spline_hermite3.js +1 -1
  78. package/src/core/process/delay.d.ts +6 -1
  79. package/src/core/process/delay.d.ts.map +1 -1
  80. package/src/core/process/delay.js +6 -1
  81. package/src/core/process/undo/Mark.d.ts +5 -5
  82. package/src/core/process/undo/Mark.d.ts.map +1 -1
  83. package/src/core/process/undo/Mark.js +6 -5
  84. package/src/core/process/worker/WorkerBuilder.d.ts +13 -2
  85. package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
  86. package/src/core/process/worker/WorkerBuilder.js +9 -1
  87. package/src/core/process/worker/WorkerProxy.d.ts +16 -6
  88. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  89. package/src/core/process/worker/WorkerProxy.js +24 -5
  90. package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
  91. package/src/core/process/worker/extractTransferables.js +3 -1
  92. package/src/engine/EngineHarness.d.ts +7 -1
  93. package/src/engine/EngineHarness.d.ts.map +1 -1
  94. package/src/engine/EngineHarness.js +12 -1
  95. package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
  96. package/src/engine/animation/clip/AnimationTrack.js +3 -0
  97. package/src/engine/animation/clip/bind_property_writer.d.ts +2 -2
  98. package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -1
  99. package/src/engine/animation/clip/bind_property_writer.js +22 -13
  100. package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -1
  101. package/src/engine/animation/clip/curve_from_track_data.js +9 -1
  102. package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
  103. package/src/engine/animation/clip/ecd_bind_animation_curve.js +6 -5
  104. package/src/engine/animation/curve/AnimationCurve.d.ts +21 -0
  105. package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
  106. package/src/engine/animation/curve/AnimationCurve.js +43 -15
  107. package/src/engine/animation/curve/AnimationCurve.spec.js +67 -0
  108. package/src/engine/animation/curve/Keyframe.d.ts +24 -3
  109. package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
  110. package/src/engine/animation/curve/Keyframe.js +49 -3
  111. package/src/engine/animation/curve/Keyframe.spec.js +11 -0
  112. package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts +7 -0
  113. package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts.map +1 -0
  114. package/src/engine/animation/curve/{compute_curve_aabb.js → animation_curve_compute_aabb.js} +1 -1
  115. package/src/engine/animation/curve/animation_curve_optimize.d.ts +8 -0
  116. package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -0
  117. package/src/engine/animation/curve/animation_curve_optimize.js +89 -0
  118. package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts +2 -0
  119. package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts.map +1 -0
  120. package/src/engine/animation/curve/animation_curve_optimize.spec.js +50 -0
  121. package/src/engine/animation/curve/draw/build_curve_editor.js +2 -2
  122. package/src/engine/animation/curve/evaluate_two_key_curve.d.ts +9 -0
  123. package/src/engine/animation/curve/evaluate_two_key_curve.d.ts.map +1 -0
  124. package/src/engine/animation/curve/evaluate_two_key_curve.js +23 -0
  125. package/src/engine/animation/curve/prototypeGLTF.js +14 -14
  126. package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
  127. package/src/engine/asset/loaders/material/computeTextureEquality.js +4 -6
  128. package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
  129. package/src/engine/asset/loaders/material/computeTextureHash.js +6 -6
  130. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts +6 -1
  131. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
  132. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +11 -6
  133. package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +5 -5
  134. package/src/engine/ecs/guid/{GUID.d.ts → UUID.d.ts} +17 -12
  135. package/src/engine/ecs/guid/UUID.d.ts.map +1 -0
  136. package/src/engine/ecs/guid/{GUID.js → UUID.js} +35 -12
  137. package/src/engine/ecs/guid/UUID.spec.d.ts +2 -0
  138. package/src/engine/ecs/guid/UUID.spec.d.ts.map +1 -0
  139. package/src/engine/ecs/guid/{GUID.spec.js → UUID.spec.js} +18 -12
  140. package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts +18 -0
  141. package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts.map +1 -0
  142. package/src/engine/ecs/guid/{GUIDSerializationAdapter.js → UUIDSerializationAdapter.js} +5 -5
  143. package/src/engine/ecs/ik/InverseKinematics.js +3 -3
  144. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.d.ts.map +1 -1
  145. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +1 -140
  146. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +1 -1
  147. package/src/engine/graphics/material/manager/MaterialManager.d.ts.map +1 -1
  148. package/src/engine/graphics/texture/isImageBitmap.d.ts +7 -0
  149. package/src/engine/graphics/texture/isImageBitmap.d.ts.map +1 -0
  150. package/src/engine/graphics/texture/isImageBitmap.js +12 -0
  151. package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
  152. package/src/engine/graphics/trail/x/RibbonXPlugin.js +9 -1
  153. package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
  154. package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.d.ts +1 -1
  155. package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.js +4 -4
  156. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +13 -0
  157. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -0
  158. package/src/engine/physics/gjk/expanding_polytope_algorithm.js +395 -0
  159. package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts +2 -0
  160. package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts.map +1 -0
  161. package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.js +46 -0
  162. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts +18 -0
  163. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts.map +1 -0
  164. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.js +277 -0
  165. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts +2 -0
  166. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts.map +1 -0
  167. package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.js +43 -0
  168. package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts +12 -0
  169. package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts.map +1 -0
  170. package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.js +100 -0
  171. package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts +2 -0
  172. package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts.map +1 -0
  173. package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +112 -0
  174. package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts +16 -0
  175. package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts.map +1 -0
  176. package/src/engine/physics/inverse_kinematics/two_joint_ik.js +127 -0
  177. package/src/view/elements/DropDownSelectionView.js +2 -2
  178. package/src/view/elements/tiles2d/Tile.d.ts.map +1 -1
  179. package/src/view/elements/tiles2d/Tile.js +2 -3
  180. package/src/core/math/makeSequenceLoop.d.ts.map +0 -1
  181. package/src/engine/animation/curve/compute_curve_aabb.d.ts +0 -7
  182. package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +0 -1
  183. package/src/engine/ecs/guid/GUID.d.ts.map +0 -1
  184. package/src/engine/ecs/guid/GUID.spec.d.ts +0 -2
  185. package/src/engine/ecs/guid/GUID.spec.d.ts.map +0 -1
  186. package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts +0 -18
  187. package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts.map +0 -1
  188. /package/src/core/{math → function}/makeSequenceLoop.d.ts +0 -0
  189. /package/src/core/{math → function}/makeSequenceLoop.js +0 -0
@@ -1,19 +1,19 @@
1
- import { GUID } from "./GUID.js";
2
- import { GUIDSerializationAdapter } from "./GUIDSerializationAdapter.js";
3
1
  import { BinaryBuffer } from "../../../core/binary/BinaryBuffer.js";
2
+ import { UUID } from "./UUID.js";
3
+ import { UUIDSerializationAdapter } from "./UUIDSerializationAdapter.js";
4
4
 
5
5
  test("to/from consistency", () => {
6
6
 
7
- const source = GUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
7
+ const source = UUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
8
8
 
9
- const adapter = new GUIDSerializationAdapter();
9
+ const adapter = new UUIDSerializationAdapter();
10
10
 
11
11
  const buffer = new BinaryBuffer();
12
12
 
13
13
  adapter.serialize(buffer, source);
14
14
  buffer.position = 0; // rewind
15
15
 
16
- const destination = new GUID();
16
+ const destination = new UUID();
17
17
 
18
18
  adapter.deserialize(buffer, destination);
19
19
 
@@ -2,18 +2,19 @@
2
2
  * Globally unique identifier
3
3
  * @class
4
4
  */
5
- export class GUID {
5
+ export class UUID {
6
6
  /**
7
7
  *
8
- * @return {GUID}
8
+ * @return {UUID}
9
9
  */
10
- static v1(): GUID;
10
+ static v1(): UUID;
11
+ static v4(): UUID;
11
12
  /**
12
13
  *
13
14
  * @param {string} string
14
- * @return {GUID}
15
+ * @return {UUID}
15
16
  */
16
- static parse(string: string): GUID;
17
+ static parse(string: string): UUID;
17
18
  /**
18
19
  *
19
20
  * @param {number[]|Uint8Array|ArrayLike<number>} bytes
@@ -29,6 +30,10 @@ export class GUID {
29
30
  * @see https://github.com/uuidjs/uuid/blob/8f028c4ea42ce41a9a9dc5fa634abe525b2e2066/src/v1.js#L17
30
31
  */
31
32
  v1(): void;
33
+ /**
34
+ * Generate Variant 4 UUID (fully random)
35
+ */
36
+ v4(): void;
32
37
  /***
33
38
  * String in UUID format
34
39
  * @see https://github.com/uuidjs/uuid/blob/8f028c4ea42ce41a9a9dc5fa634abe525b2e2066/src/parse.js#L3
@@ -42,15 +47,15 @@ export class GUID {
42
47
  toString(): string;
43
48
  /**
44
49
  *
45
- * @param {GUID} other
50
+ * @param {UUID} other
46
51
  */
47
- copy(other: GUID): void;
52
+ copy(other: UUID): void;
48
53
  /**
49
54
  *
50
- * @param {GUID} other
55
+ * @param {UUID} other
51
56
  * @returns {boolean}
52
57
  */
53
- equals(other: GUID): boolean;
58
+ equals(other: UUID): boolean;
54
59
  /**
55
60
  * @returns {number}
56
61
  */
@@ -61,10 +66,10 @@ export class GUID {
61
66
  * @readonly
62
67
  * @type {boolean}
63
68
  */
64
- readonly isGUID: boolean;
69
+ readonly isUUID: boolean;
65
70
  #private;
66
71
  }
67
- export namespace GUID {
72
+ export namespace UUID {
68
73
  let typeName: string;
69
74
  }
70
- //# sourceMappingURL=GUID.d.ts.map
75
+ //# sourceMappingURL=UUID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH;IAgHI;;;OAGG;IACH,aAFY,IAAI,CAQf;IAED,kBAMC;IA0CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IApLD;;;OAGG;IACH,0BAKC;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,WAqEC;IAED;;OAEG;IACH,WAUC;IAsBD;;;;OAIG;IACH,cAFW,MAAM,QAmChB;IAeD;;;OAGG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAanB;IAED;;OAEG;IACH,QAFa,MAAM,CAWlB;IAED,iBAEC;IAED,uBAEC;IASL;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAZpB;;kBAIS,MAAM"}
@@ -1,9 +1,9 @@
1
- import { seededRandom } from "../../../core/math/random/seededRandom.js";
2
- import { randomUint8 } from "../../../core/math/random/randomUint8.js";
1
+ import { assert } from "../../../core/assert.js";
3
2
  import { dec2hex } from "../../../core/binary/dec2hex.js";
4
3
  import { array_copy } from "../../../core/collection/array/array_copy.js";
5
4
  import { randomBytes } from "../../../core/math/random/randomBytes.js";
6
- import { assert } from "../../../core/assert.js";
5
+ import { randomUint8 } from "../../../core/math/random/randomUint8.js";
6
+ import { seededRandom } from "../../../core/math/random/seededRandom.js";
7
7
 
8
8
  // Previous uuid creation time
9
9
  let _lastMSecs = 0;
@@ -25,7 +25,7 @@ let _clockseq = ((randomUint8(random) << 8) | randomUint8(random)) & 0x3fff;
25
25
  * Globally unique identifier
26
26
  * @class
27
27
  */
28
- export class GUID {
28
+ export class UUID {
29
29
  #data = new Uint8Array(16);
30
30
 
31
31
  /**
@@ -122,18 +122,41 @@ export class GUID {
122
122
  }
123
123
  }
124
124
 
125
+ /**
126
+ * Generate Variant 4 UUID (fully random)
127
+ */
128
+ v4() {
129
+
130
+ const data = this.data;
131
+
132
+ randomBytes(data, 0, random, 16);
133
+
134
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
135
+ data[6] = (data[6] & 0x0f) | 0x40;
136
+ data[8] = (data[8] & 0x3f) | 0x80;
137
+
138
+ }
139
+
125
140
  /**
126
141
  *
127
- * @return {GUID}
142
+ * @return {UUID}
128
143
  */
129
144
  static v1() {
130
- const uuid = new GUID();
145
+ const uuid = new UUID();
131
146
 
132
147
  uuid.v1();
133
148
 
134
149
  return uuid;
135
150
  }
136
151
 
152
+ static v4() {
153
+ const r = new UUID();
154
+
155
+ r.v4();
156
+
157
+ return r;
158
+ }
159
+
137
160
  /***
138
161
  * String in UUID format
139
162
  * @see https://github.com/uuidjs/uuid/blob/8f028c4ea42ce41a9a9dc5fa634abe525b2e2066/src/parse.js#L3
@@ -177,10 +200,10 @@ export class GUID {
177
200
  /**
178
201
  *
179
202
  * @param {string} string
180
- * @return {GUID}
203
+ * @return {UUID}
181
204
  */
182
205
  static parse(string) {
183
- const r = new GUID();
206
+ const r = new UUID();
184
207
 
185
208
  r.parse(string);
186
209
 
@@ -220,7 +243,7 @@ export class GUID {
220
243
 
221
244
  /**
222
245
  *
223
- * @param {GUID} other
246
+ * @param {UUID} other
224
247
  */
225
248
  copy(other) {
226
249
  this.#data.set(other.#data);
@@ -228,7 +251,7 @@ export class GUID {
228
251
 
229
252
  /**
230
253
  *
231
- * @param {GUID} other
254
+ * @param {UUID} other
232
255
  * @returns {boolean}
233
256
  */
234
257
  equals(other) {
@@ -271,10 +294,10 @@ export class GUID {
271
294
  * @readonly
272
295
  * @type {string}
273
296
  */
274
- GUID.typeName = "GUID";
297
+ UUID.typeName = "UUID";
275
298
 
276
299
  /**
277
300
  * @readonly
278
301
  * @type {boolean}
279
302
  */
280
- GUID.prototype.isGUID = true;
303
+ UUID.prototype.isUUID = true;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UUID.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UUID.spec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.spec.js"],"names":[],"mappings":""}
@@ -1,15 +1,15 @@
1
- import { GUID } from "./GUID.js";
1
+ import { UUID } from "./UUID.js";
2
2
 
3
3
  test("uniqueness out of 2", () => {
4
- const a = GUID.v1();
5
- const b = GUID.v1();
4
+ const a = UUID.v1();
5
+ const b = UUID.v1();
6
6
 
7
7
  expect(a.equals(b)).toBe(false);
8
8
  });
9
9
 
10
10
  test("equality", () => {
11
- const a = GUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
12
- const b = GUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
11
+ const a = UUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
12
+ const b = UUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
13
13
 
14
14
  expect(a.equals(b)).toBe(true);
15
15
 
@@ -19,16 +19,16 @@ test("equality", () => {
19
19
  });
20
20
 
21
21
  test("hash stability", () => {
22
- const guid = new GUID();
22
+ const guid = new UUID();
23
23
 
24
24
  expect(guid.hash()).toBe(guid.hash());
25
25
  });
26
26
 
27
27
  test("copy", () => {
28
- const a = GUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
28
+ const a = UUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
29
29
  const a_string = a.toString();
30
30
 
31
- const b = GUID.parse("bb75b300-c89f-11ed-afa1-0242ac120002");
31
+ const b = UUID.parse("bb75b300-c89f-11ed-afa1-0242ac120002");
32
32
 
33
33
  expect(a.equals(b)).toBe(false);
34
34
 
@@ -41,9 +41,9 @@ test("copy", () => {
41
41
  });
42
42
 
43
43
  test("to/from JSON consistency", () => {
44
- const a = GUID.parse("bb75b300-c89f-11ed-afa1-0242ac120002");
44
+ const a = UUID.parse("bb75b300-c89f-11ed-afa1-0242ac120002");
45
45
 
46
- const b = new GUID();
46
+ const b = new UUID();
47
47
 
48
48
  b.fromJSON(a.toJSON());
49
49
 
@@ -51,7 +51,7 @@ test("to/from JSON consistency", () => {
51
51
  });
52
52
 
53
53
  test(".data setter performs a copy instead of assignment", () => {
54
- const id = new GUID();
54
+ const id = new UUID();
55
55
 
56
56
  const data = new Uint8Array(16);
57
57
 
@@ -61,7 +61,7 @@ test(".data setter performs a copy instead of assignment", () => {
61
61
  });
62
62
 
63
63
  test(".data set/get", () => {
64
- const a = new GUID();
64
+ const a = new UUID();
65
65
 
66
66
  const sample_0 = [
67
67
  0xFF, 0xFF, 0xFF, 0xFF,
@@ -85,3 +85,9 @@ test(".data set/get", () => {
85
85
 
86
86
  expect(Array.from(a.data)).toEqual(sample_1);
87
87
  });
88
+
89
+ test("version bits in v4", () => {
90
+ const uuid = UUID.v4();
91
+
92
+ expect((uuid.data[6] >> 4) & 0xF).toEqual(4);
93
+ });
@@ -0,0 +1,18 @@
1
+ export class UUIDSerializationAdapter extends BinaryClassSerializationAdapter {
2
+ klass: typeof UUID;
3
+ /**
4
+ *
5
+ * @param buffer
6
+ * @param {UUID} value
7
+ */
8
+ serialize(buffer: any, value: UUID): void;
9
+ /**
10
+ *
11
+ * @param buffer
12
+ * @param {UUID} value
13
+ */
14
+ deserialize(buffer: any, value: UUID): void;
15
+ }
16
+ import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
17
+ import { UUID } from "./UUID.js";
18
+ //# sourceMappingURL=UUIDSerializationAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UUIDSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUIDSerializationAdapter.js"],"names":[],"mappings":"AAGA;IACI,mBAAY;IAGZ;;;;OAIG;IACH,8BAFW,IAAI,QAId;IAED;;;;OAIG;IACH,gCAFW,IAAI,QAId;CACJ;gDAxB+C,sDAAsD;qBACjF,WAAW"}
@@ -1,14 +1,14 @@
1
1
  import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
2
- import { GUID } from "./GUID.js";
2
+ import { UUID } from "./UUID.js";
3
3
 
4
- export class GUIDSerializationAdapter extends BinaryClassSerializationAdapter {
5
- klass = GUID
4
+ export class UUIDSerializationAdapter extends BinaryClassSerializationAdapter {
5
+ klass = UUID
6
6
  version = 0
7
7
 
8
8
  /**
9
9
  *
10
10
  * @param buffer
11
- * @param {GUID} value
11
+ * @param {UUID} value
12
12
  */
13
13
  serialize(buffer, value) {
14
14
  buffer.writeUint8Array(value.data, 0, 16);
@@ -17,7 +17,7 @@ export class GUIDSerializationAdapter extends BinaryClassSerializationAdapter {
17
17
  /**
18
18
  *
19
19
  * @param buffer
20
- * @param {GUID} value
20
+ * @param {UUID} value
21
21
  */
22
22
  deserialize(buffer, value) {
23
23
  buffer.readUint8Array(value.data, 0, 16);
@@ -16,11 +16,11 @@ export class InverseKinematics {
16
16
  copy(other) {
17
17
  this.constraints.splice(0, this.constraints.length);
18
18
 
19
- const ikConstraints = other.constraints;
20
- const n = ikConstraints.length;
19
+ const other_constraints = other.constraints;
20
+ const n = other_constraints.length;
21
21
 
22
22
  for (let i = 0; i < n; i++) {
23
- const constraint = ikConstraints[i];
23
+ const constraint = other_constraints[i];
24
24
 
25
25
  const constraintClone = constraint.clone();
26
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"TwoBoneInverseKinematicsSolver.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js"],"names":[],"mappings":"AAyLA;IAGI,0BAuIC;CACJ;yBAzTwB,eAAe"}
1
+ {"version":3,"file":"TwoBoneInverseKinematicsSolver.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js"],"names":[],"mappings":"AA8CA;IAGI,0BAuIC;CACJ;yBA9KwB,eAAe"}
@@ -5,10 +5,10 @@ import { v3_displace_in_direction } from "../../../core/geom/vec3/v3_displace_in
5
5
  import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
6
6
  import { v3_length } from "../../../core/geom/vec3/v3_length.js";
7
7
  import Vector3 from "../../../core/geom/Vector3.js";
8
- import { clamp } from "../../../core/math/clamp.js";
9
8
  import { clamp01 } from "../../../core/math/clamp01.js";
10
9
  import { inverseLerp } from "../../../core/math/inverseLerp.js";
11
10
  import { findSkeletonBoneByType } from "../../graphics/ecs/mesh/SkeletonUtils.js";
11
+ import { two_joint_ik } from "../../physics/inverse_kinematics/two_joint_ik.js";
12
12
  import { IKSolver } from "./IKSolver.js";
13
13
 
14
14
  const boneWorldPositionC = new Vector3();
@@ -28,147 +28,8 @@ const globalRotationC = new Quaternion();
28
28
  const targetLocalRotationA = new Quaternion();
29
29
  const targetLocalRotationB = new Quaternion();
30
30
 
31
-
32
- /**
33
- * Compute interior angle between tree points
34
- * @param {Vector3} a
35
- * @param {Vector3} b
36
- * @param {Vector3} c
37
- * @returns {number} angle in radians
38
- */
39
- function computeInteriorAngle(a, b, c) {
40
-
41
- //compute AB delta
42
- const d_ab_x = a.x - b.x;
43
- const d_ab_y = a.y - b.y;
44
- const d_ab_z = a.z - b.z;
45
-
46
- //normalize AB delta vector
47
- const d_ab_length = v3_length(d_ab_x, d_ab_y, d_ab_z);
48
-
49
- const nd_ab_x = d_ab_x / d_ab_length;
50
- const nd_ab_y = d_ab_y / d_ab_length;
51
- const nd_ab_z = d_ab_z / d_ab_length;
52
-
53
- //compute CB delta
54
- const d_cb_x = c.x - b.x;
55
- const d_cb_y = c.y - b.y;
56
- const d_cb_z = c.z - b.z;
57
-
58
- //normalize CB delta vector
59
- const d_cb_length = v3_length(d_cb_x, d_cb_y, d_cb_z);
60
-
61
- const nd_cb_x = d_cb_x / d_cb_length;
62
- const nd_cb_y = d_cb_y / d_cb_length;
63
- const nd_cb_z = d_cb_z / d_cb_length;
64
-
65
- //compute dot product
66
- const dot = v3_dot(nd_ab_x, nd_ab_y, nd_ab_z, nd_cb_x, nd_cb_y, nd_cb_z);
67
-
68
- //clamp value of dot product for arc cosine function
69
- const clamped_dot = clamp(dot, -1, 1);
70
-
71
- return Math.acos(clamped_dot);
72
- }
73
-
74
-
75
- const d = new Vector3();
76
- const delta_ca = new Vector3();
77
- const delta_ta = new Vector3();
78
-
79
- const axis0 = new Vector3();
80
- const axis1 = new Vector3();
81
-
82
- const inv_a_gr = new Quaternion();
83
- const inv_b_gr = new Quaternion();
84
-
85
31
  const r0 = new Quaternion();
86
32
  const r1 = new Quaternion();
87
- const r2 = new Quaternion();
88
-
89
- const axis0_la = new Vector3();
90
- const axis0_lb = new Vector3();
91
- const axis1_la = new Vector3();
92
-
93
- /**
94
- * Based on http://theorangeduck.com/page/simple-two-joint
95
- * @param {Vector3} a Root bone position
96
- * @param {Vector3} b Second bone position
97
- * @param {Vector3} c Effector position
98
- * @param {Vector3} t Target position
99
- * @param {number} eps EPSILON value, small value for rounding error compensation
100
- * @param {Quaternion} a_gr Global rotation of root bone
101
- * @param {Quaternion} b_gr Global rotation of second bone
102
- * @param {Quaternion} a_lr local rotation for root bone, this will be updated as a result
103
- * @param {Quaternion} b_lr local rotation for second bone, this will be updated as a result
104
- */
105
- function two_joint_ik(
106
- a, b, c, t, eps,
107
- a_gr, b_gr,
108
- a_lr, b_lr
109
- ) {
110
-
111
- //Compute lengths of bones
112
- const lab = b.distanceTo(a);
113
- const lcb = b.distanceTo(c);
114
-
115
- const maximum_extension = lab + lcb - eps;
116
-
117
- //clamp length to the target to maximum extension of the joint
118
- const lat = clamp(t.distanceTo(a), eps, maximum_extension);
119
-
120
- //compute current interior angles
121
- const ac_ab_0 = computeInteriorAngle(c, a, b);
122
- const ba_bc_0 = computeInteriorAngle(a, b, c);
123
- const ac_at_0 = computeInteriorAngle(c, a, t);
124
-
125
- // Using the cosine rule to compute desired interior angles
126
- const length_at_sqr = lat * lat;
127
- const length_cb_sqr = lcb * lcb;
128
- const length_ab_sqr = lab * lab;
129
-
130
- const ac_ab_1 = Math.acos(clamp((length_cb_sqr - length_ab_sqr - length_at_sqr) / (-2 * lab * lat), -1, 1));
131
- const ba_bc_1 = Math.acos(clamp((length_at_sqr - length_ab_sqr - length_cb_sqr) / (-2 * lab * lcb), -1, 1));
132
-
133
- d.copy(Vector3.back);
134
- d.applyQuaternion(b_gr);
135
-
136
- delta_ca.subVectors(c, a);
137
- delta_ta.subVectors(t, a);
138
-
139
- axis0.crossVectors(delta_ca, d);
140
- axis0.normalize();
141
-
142
- axis1.crossVectors(delta_ca, delta_ta);
143
- axis1.normalize();
144
-
145
- inv_a_gr.copyInverse(a_gr);
146
- inv_b_gr.copyInverse(b_gr);
147
-
148
- axis0_la.copy(axis0);
149
- axis0_la.applyQuaternion(inv_a_gr);
150
-
151
- const angle0 = ac_ab_1 - ac_ab_0;
152
-
153
- r0.fromAxisAngle(axis0_la, angle0);
154
-
155
- const angle1 = ba_bc_1 - ba_bc_0;
156
-
157
- axis0_lb.copy(axis0);
158
- axis0_lb.applyQuaternion(inv_b_gr);
159
-
160
- r1.fromAxisAngle(axis0_lb, angle1);
161
-
162
- axis1_la.copy(axis1);
163
- axis1_la.applyQuaternion(inv_a_gr);
164
-
165
- r2.fromAxisAngle(axis1_la, ac_at_0);
166
-
167
- r0.multiply(r2);
168
-
169
- a_lr.multiply(r0);
170
- b_lr.multiply(r1);
171
- }
172
33
 
173
34
  /**
174
35
  *
@@ -125,7 +125,7 @@ class Trail2DSystem extends System {
125
125
  */
126
126
  __build_trail(trail, transform) {
127
127
  const segmentsPerSecond = 60;
128
- const maxSegments = 1000;
128
+ const maxSegments = 1024;
129
129
  //instantiation
130
130
 
131
131
  //make a mesh
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/manager/MaterialManager.js"],"names":[],"mappings":"AAOA;IAGQ;;;;OAIG;IACH,kBAIE;IAEF;;;;OAIG;IACH,gBAIE;IAEF;;;;OAIG;IACH,0BAIE;IAIF;;;;OAIG;IACH,0BAA2B;IAG/B;;;;;OAKG;IACH,2BAEC;IAED;;;;OAIG;IACH,wCAUC;IAED;;;OAGG;IACH,uDAEC;IAED;;;;OAIG;IACH,qDAFa,OAAO,CAYnB;IAED;;;;;OAKG;IACH,kBAcC;IAGD;;;;OAIG;IACH,8CAmCC;CACJ"}
1
+ {"version":3,"file":"MaterialManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/manager/MaterialManager.js"],"names":[],"mappings":"AAMA;IAGQ;;;;OAIG;IACH,kBAIE;IAEF;;;;OAIG;IACH,gBAIE;IAEF;;;;OAIG;IACH,0BAIE;IAIF;;;;OAIG;IACH,0BAA2B;IAG/B;;;;;OAKG;IACH,2BAEC;IAED;;;;OAIG;IACH,wCAUC;IAED;;;OAGG;IACH,uDAEC;IAED;;;;OAIG;IACH,qDAFa,OAAO,CAYnB;IAED;;;;;OAKG;IACH,kBAcC;IAGD;;;;OAIG;IACH,8CAmCC;CACJ"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Guards against cases where ImageBitmap doesn't exist
3
+ * @param {*} image
4
+ * @return {boolean}
5
+ */
6
+ export function isImageBitmap(image: any): boolean;
7
+ //# sourceMappingURL=isImageBitmap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isImageBitmap.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/isImageBitmap.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,2CAFY,OAAO,CAQlB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Guards against cases where ImageBitmap doesn't exist
3
+ * @param {*} image
4
+ * @return {boolean}
5
+ */
6
+ export function isImageBitmap(image) {
7
+ /**
8
+ * check that browser/environment has the class at all to avoid potential exceptions
9
+ * Required for Safari below version 15.6
10
+ */
11
+ return typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap;
12
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"RibbonXPlugin.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonXPlugin.js"],"names":[],"mappings":"AASA;IACI,8BA6BC;IA1BG,WAA2B;IAE3B;;;;OAIG;IACH,+BAKE;IAEF;;;;MAIC;IAED;;;;OAIG;IACH,oBAAwC;IAG5C,sCAIC;IAED,wBAMC;IAED,yBAKC;IAED;;;;OAIG;IACH,0EAIC;IAED;;;;OAIG;IACH,8CAFa,eAAe,CAe3B;IAGD;;;;;OAKG;IACH,yBA8BC;CACJ;6BA9H4B,iCAAiC;wBAL1B,OAAO;gCAOX,sBAAsB"}
1
+ {"version":3,"file":"RibbonXPlugin.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonXPlugin.js"],"names":[],"mappings":"AASA;IACI,8BA6BC;IA1BG,WAA2B;IAE3B;;;;OAIG;IACH,+BAKE;IAEF;;;;MAIC;IAED;;;;OAIG;IACH,oBAAwC;IAG5C,sCAIC;IAED,wBAMC;IAED,yBAKC;IAED;;;;OAIG;IACH,0EAIC;IAED;;;;OAIG;IACH,8CAFa,eAAe,CAe3B;IAGD;;;;;OAKG;IACH,yBAsCC;CACJ;6BAtI4B,iCAAiC;wBAL1B,OAAO;gCAOX,sBAAsB"}
@@ -119,7 +119,15 @@ export class RibbonXPlugin extends EnginePlugin {
119
119
  path: spec.diffuse,
120
120
  type: GameAssetType.Texture,
121
121
  callback: (asset) => {
122
- material.uniforms.uDiffuse.value = asset.create();
122
+ /**
123
+ *
124
+ * @type {Texture}
125
+ */
126
+ const texture = asset.create();
127
+
128
+ texture.generateMipmaps = true;
129
+
130
+ material.uniforms.uDiffuse.value = texture;
123
131
  }, failure: console.warn
124
132
  });
125
133
 
@@ -181,7 +181,7 @@ function removeBindings(mapping, devices, proxies) {
181
181
  }
182
182
 
183
183
  /**
184
- * @deprecated Use {@link InputSystem} instead
184
+ * Prefer to use {@link InputSystem} instead
185
185
  */
186
186
  class InputControllerSystem extends System {
187
187
  constructor(devices) {
@@ -38,7 +38,7 @@ export class BlackboardDynamicStorageAdapter {
38
38
  */
39
39
  private __write_timeout_handle;
40
40
  /**
41
- *
41
+ * In milliseconds
42
42
  * @type {number}
43
43
  * @private
44
44
  */
@@ -54,7 +54,7 @@ export class BlackboardDynamicStorageAdapter {
54
54
  this.__write_timeout_handle = -1;
55
55
 
56
56
  /**
57
- *
57
+ * In milliseconds
58
58
  * @type {number}
59
59
  * @private
60
60
  */
@@ -101,14 +101,14 @@ export class BlackboardDynamicStorageAdapter {
101
101
  async read() {
102
102
  const data = await this.__storage.promiseLoadBinary(this.__storage_key);
103
103
 
104
+ this.__blackboard.reset();
105
+
104
106
  if (data === undefined) {
105
107
  // no data
106
- this.__blackboard.reset();
107
108
  return;
108
109
  }
109
110
 
110
- const buffer = new BinaryBuffer();
111
- buffer.fromArrayBuffer(data);
111
+ const buffer = BinaryBuffer.fromArrayBuffer(data);
112
112
 
113
113
  const object = this.__serialization_adapter.deserialize(buffer);
114
114
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * TODO: needs to be tested thoroughly, intended to be working with GJK
3
+ * @param {number[]} result
4
+ * @param {number} result_offset
5
+ * @param {number[]} a
6
+ * @param {number[]} b
7
+ * @param {number[]} c
8
+ * @param {number[]} d
9
+ * @param {AbstractShape3D} coll1
10
+ * @param {AbstractShape3D} coll2
11
+ */
12
+ export function expanding_polytope_algorithm(result: number[], result_offset: number, a: number[], b: number[], c: number[], d: number[], coll1: AbstractShape3D, coll2: AbstractShape3D): void;
13
+ //# sourceMappingURL=expanding_polytope_algorithm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expanding_polytope_algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/gjk/expanding_polytope_algorithm.js"],"names":[],"mappings":"AAuFA;;;;;;;;;;GAUG;AACH,qDATW,MAAM,EAAE,iBACR,MAAM,KACN,MAAM,EAAE,KACR,MAAM,EAAE,KACR,MAAM,EAAE,KACR,MAAM,EAAE,wDAgQlB"}