@woosh/meep-engine 2.43.38 → 2.43.40

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 (60) hide show
  1. package/core/bvh2/aabb3/AABB3.js +72 -85
  2. package/core/bvh2/aabb3/serializeAABB3Encoded_v0.js +75 -0
  3. package/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +1 -1
  4. package/core/collection/HashMap.js +16 -8
  5. package/core/color/Color.js +1 -1
  6. package/core/geom/3d/aabb/aabb3_matrix4_project.js +4 -0
  7. package/core/geom/ConicRay.js +1 -1
  8. package/core/geom/Quaternion.d.ts +7 -2
  9. package/core/geom/Quaternion.js +19 -3
  10. package/core/geom/Vector1.d.ts +19 -1
  11. package/core/geom/Vector1.js +11 -3
  12. package/core/geom/Vector2.d.ts +7 -0
  13. package/core/geom/Vector2.js +21 -4
  14. package/core/geom/Vector3.d.ts +4 -4
  15. package/core/geom/Vector3.js +29 -4
  16. package/core/geom/Vector4.d.ts +7 -2
  17. package/core/geom/Vector4.js +8 -8
  18. package/core/math/hash/computeHashFloatArray.js +1 -1
  19. package/core/math/hash/computeObjectHash.js +22 -22
  20. package/core/math/hash/computeObjectHash.spec.js +42 -0
  21. package/core/math/interval/NumericInterval.js +1 -1
  22. package/core/model/BoundedValue.js +1 -1
  23. package/core/model/node-graph/Connection.js +6 -6
  24. package/core/model/node-graph/DataType.js +13 -12
  25. package/core/model/node-graph/NodeGraph.js +30 -5
  26. package/core/model/node-graph/node/NodeDescription.js +14 -11
  27. package/core/model/node-graph/node/NodeDescription.spec.js +14 -0
  28. package/core/model/node-graph/node/NodeInstance.js +2 -2
  29. package/core/model/node-graph/node/parameter/NodeParameterDescription.js +1 -1
  30. package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
  31. package/core/model/stat/LinearModifier.js +1 -1
  32. package/core/{math/hash → primitives/numbers}/computeHashFloat.js +0 -0
  33. package/core/{math/hash → primitives/numbers}/computeHashFloat.spec.js +0 -0
  34. package/engine/Engine.d.ts +1 -1
  35. package/engine/asset/loaders/material/computeMaterialHash.js +1 -1
  36. package/engine/asset/loaders/material/computeTextureHash.js +1 -1
  37. package/engine/ecs/animation/Animation.js +1 -1
  38. package/engine/ecs/animation/InverseKinematics.js +1 -1
  39. package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
  40. package/engine/ecs/gui/position/ViewportPosition.js +1 -1
  41. package/engine/ecs/transform/Transform.js +20 -8
  42. package/engine/graphics/ecs/animation/animator/AnimationClip.js +1 -1
  43. package/engine/graphics/ecs/animation/animator/AnimationNotification.js +1 -1
  44. package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +1 -1
  45. package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +1 -1
  46. package/engine/graphics/ecs/highlight/HighlightDefinition.js +1 -1
  47. package/engine/graphics/ecs/mesh/Mesh.js +1 -1
  48. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
  49. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +4 -1
  50. package/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +1 -1
  51. package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
  52. package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +1 -1
  53. package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +1 -1
  54. package/engine/intelligence/behavior/Behavior.js +2 -35
  55. package/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
  56. package/engine/plugin/EnginePlugin.js +6 -0
  57. package/engine/sound/ecs/emitter/SoundEmitter.js +1 -1
  58. package/engine/sound/ecs/emitter/SoundTrack.js +1 -1
  59. package/engine/ui/bindings/{DomElementManager.js → DomElementProcessorManager.js} +43 -18
  60. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Color } from "../../../../core/color/Color.js";
2
2
  import { assert } from "../../../../core/assert.js";
3
3
  import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
4
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
4
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
5
5
 
6
6
  export class HighlightDefinition {
7
7
  constructor() {
@@ -10,7 +10,7 @@ import { Transform } from "../../../ecs/transform/Transform.js";
10
10
  import { updateNodeByTransformAndBBB } from "./updateNodeByTransformAndBBB.js";
11
11
  import { applyTransformToThreeObject } from "./applyTransformToThreeObject.js";
12
12
  import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
13
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
13
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
14
14
 
15
15
  /**
16
16
  *
@@ -50,7 +50,7 @@ export class ShadedGeometry {
50
50
  this.material = null;
51
51
 
52
52
  /**
53
- *
53
+ * Optional extra material used for shadowmaps
54
54
  * @type {THREE.Material|null}
55
55
  */
56
56
  this.depth_material = null;
@@ -84,7 +84,7 @@ export class ShadedGeometry {
84
84
  this.__entity = -1;
85
85
 
86
86
  /**
87
- *
87
+ * Transient, cached for convenience. Associated transform component from the same entity
88
88
  * @type {Transform|null}
89
89
  * @private
90
90
  */
@@ -20,7 +20,10 @@ export class InstancedRendererAdapter extends AbstractRenderAdapter {
20
20
  */
21
21
  this.__instanced_meshes = new HashMap({
22
22
  keyHashFunction(sg) {
23
- return sg.geometry.id ^ sg.material.id ^ sg.mode;
23
+ return sg.geometry.id
24
+ ^ sg.material.id
25
+ ^ sg.mode
26
+ ;
24
27
  },
25
28
  keyEqualityFunction(a, b) {
26
29
  return a.material.id === b.material.id
@@ -1,6 +1,6 @@
1
1
  import { vec3 } from "gl-matrix";
2
2
  import { GetPosition } from "./GetPosition.js";
3
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
3
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
4
4
  import { GetNormal } from "./GetNormal.js";
5
5
  import { GetTexCoord } from "./GetTexCoord.js";
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { mortonEncode_magicbits } from "../../../../core/geom/3d/morton/mortonEncode_magicbits.js";
2
2
  import { isArrayEqualStrict } from "../../../../core/collection/array/isArrayEqualStrict.js";
3
3
  import { SimpleObjectPoolFactory } from "../../../../core/model/object/SimpleObjectPoolFactory.js";
4
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
4
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
5
5
 
6
6
  export class PatchCacheKey {
7
7
  constructor() {
@@ -12,7 +12,7 @@ import { computeConeBoundingBox } from "../../../../../../core/geom/3d/cone/comp
12
12
  import { EmissionFromType } from "./EmissionFromType.js";
13
13
  import { EmissionShapeType } from "./EmissionShapeType.js";
14
14
  import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
15
- import { computeHashFloat } from "../../../../../../core/math/hash/computeHashFloat.js";
15
+ import { computeHashFloat } from "../../../../../../core/primitives/numbers/computeHashFloat.js";
16
16
 
17
17
  const aabb3 = new AABB3(0, 0, 0, 0, 0, 0);
18
18
 
@@ -1,7 +1,7 @@
1
1
  import { ProgramValueSlotParameterType } from "./ProgramValueSlotParameterType.js";
2
2
  import { computeStringHash } from "../../../../../../core/primitives/strings/computeStringHash.js";
3
3
  import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
4
- import { computeHashFloat } from "../../../../../../core/math/hash/computeHashFloat.js";
4
+ import { computeHashFloat } from "../../../../../../core/primitives/numbers/computeHashFloat.js";
5
5
 
6
6
  /**
7
7
  *
@@ -2,50 +2,17 @@ import { BehaviorStatus } from "./BehaviorStatus.js";
2
2
 
3
3
  /**
4
4
  * Base class of behavior tree implementation
5
+ * @template CTX
5
6
  */
6
7
  export class Behavior {
7
8
  constructor() {
8
9
  /**
9
10
  * Any internal state used by the behavior
10
- * @type {*}
11
+ * @type {CTX|null}
11
12
  */
12
13
  this.context = null;
13
14
  }
14
15
 
15
- /**
16
- * @deprecated
17
- * @private
18
- * @returns {BehaviorStatus}
19
- */
20
- get __status() {
21
- throw new Error('Deprecated');
22
- }
23
-
24
- /**
25
- * @deprecated
26
- * @param {BehaviorStatus} v
27
- * @private
28
- */
29
- set __status(v) {
30
- throw new Error('Deprecated');
31
- }
32
-
33
- /**
34
- * @deprecated
35
- * @returns {BehaviorStatus}
36
- */
37
- getStatus() {
38
- throw new Error('Deprecated');
39
- }
40
-
41
- /**
42
- * @deprecated
43
- * @param {BehaviorStatus} s
44
- */
45
- setStatus(s) {
46
- throw new Error('Deprecated');
47
- }
48
-
49
16
  /**
50
17
  * Main update function
51
18
  * @param {number} timeDelta time step in seconds
@@ -2,7 +2,7 @@ import { assert } from "../../../../core/assert.js";
2
2
  import { invokeObjectEquals } from "../../../../core/model/object/invokeObjectEquals.js";
3
3
  import { invokeObjectHash } from "../../../../core/model/object/invokeObjectHash.js";
4
4
  import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
5
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
5
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
6
6
 
7
7
  export class WeightedElement {
8
8
 
@@ -11,6 +11,12 @@ export class EnginePlugin extends BaseProcess {
11
11
  * @private
12
12
  */
13
13
  this.__dependencies = [];
14
+
15
+ /**
16
+ *
17
+ * @type {Engine|null}
18
+ */
19
+ this.engine = null;
14
20
  }
15
21
 
16
22
  attach() {
@@ -19,7 +19,7 @@ import { interpolate_irradiance_smith } from "../../../../core/math/physics/irra
19
19
  import { objectKeyByValue } from "../../../../core/model/object/objectKeyByValue.js";
20
20
  import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
21
21
  import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
22
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
22
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
23
23
  import { compareStrings } from "../../../../core/primitives/strings/compareStrings.js";
24
24
  import { compareNumbers } from "../../../../core/primitives/numbers/compareNumbers.js";
25
25
 
@@ -3,7 +3,7 @@ import { SoundTrackFlags } from "./SoundTrackFlags.js";
3
3
  import { assert } from "../../../../core/assert.js";
4
4
  import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
5
5
  import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
6
- import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
6
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
7
7
  import { compareStrings } from "../../../../core/primitives/strings/compareStrings.js";
8
8
  import { compareNumbers } from "../../../../core/primitives/numbers/compareNumbers.js";
9
9
 
@@ -1,13 +1,12 @@
1
1
  import { DomElementBinding } from "./DomElementBinding.js";
2
+ import { EnginePlugin } from "../../plugin/EnginePlugin.js";
3
+ import { array_remove_first } from "../../../core/collection/array/array_remove_first.js";
2
4
 
3
- export class DomElementManager {
5
+ export class DomElementProcessorManager extends EnginePlugin {
4
6
  constructor() {
5
- /**
6
- *
7
- * @type {Engine|null}
8
- * @private
9
- */
10
- this.__engine = null;
7
+ super();
8
+
9
+ this.id = "dom-element-processor-manager";
11
10
 
12
11
  /**
13
12
  *
@@ -59,6 +58,23 @@ export class DomElementManager {
59
58
  this.__descriptors.push(descriptor);
60
59
  }
61
60
 
61
+ /**
62
+ *
63
+ * @param {DomElementBindingDescription} descriptor
64
+ * @return {boolean}
65
+ */
66
+ deregister(descriptor) {
67
+ if (array_remove_first(this.__descriptors, descriptor)) {
68
+ // element removed
69
+
70
+ // TODO cleanup whatever effects have been applied to elements matching the descriptor
71
+ return true;
72
+ } else {
73
+ // not found
74
+ return false;
75
+ }
76
+ }
77
+
62
78
  /**
63
79
  *
64
80
  * @param {sequence<MutationRecord>} mutations_list
@@ -215,17 +231,7 @@ export class DomElementManager {
215
231
  * @return {Engine|null}
216
232
  */
217
233
  getEngine() {
218
- return this.__engine;
219
- }
220
-
221
- /**
222
- *
223
- * @param {Engine} engine
224
- */
225
- initialize(engine) {
226
-
227
- this.__engine = engine;
228
-
234
+ return this.engine;
229
235
  }
230
236
 
231
237
  /**
@@ -258,6 +264,25 @@ export class DomElementManager {
258
264
 
259
265
  }
260
266
 
267
+ async startup() {
268
+ const view = this.getEngine().viewStack;
269
+
270
+ this.link(view.el);
271
+
272
+ return super.startup();
273
+ }
274
+
275
+ async shutdown() {
276
+
277
+ this.unlink();
278
+
279
+ return super.shutdown();
280
+ }
281
+
282
+ /**
283
+ *
284
+ * @param {Element} root
285
+ */
261
286
  link(root) {
262
287
 
263
288
  this.__root = root;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.43.38",
8
+ "version": "2.43.40",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",