@woosh/meep-engine 2.92.12 → 2.92.13

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
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.92.12",
8
+ "version": "2.92.13",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"EntityNodeAnimationClip.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/EntityNodeAnimationClip.js"],"names":[],"mappings":"AAAA;IACI,aAAS;IACT;;;OAGG;IACH,QAFU,sBAAsB,CAErB;IACX,iBAAY;IAEZ,yBAMC;CACJ"}
1
+ {"version":3,"file":"EntityNodeAnimationClip.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/EntityNodeAnimationClip.js"],"names":[],"mappings":"AAAA;IACI,aAAS;IACT;;;OAGG;IACH,QAFU,sBAAsB,CAErB;IACX,iBAAY;IAEZ;;;OAGG;IACH,cAFW,MAAM,QAWhB;CACJ"}
@@ -7,9 +7,16 @@ export class EntityNodeAnimationClip {
7
7
  tracks = []
8
8
  duration = 0
9
9
 
10
+ /**
11
+ *
12
+ * @param {number} time time in seconds
13
+ */
10
14
  writeAt(time) {
11
- for (let i = 0; i < this.tracks.length; i++) {
12
- const track = this.tracks[i];
15
+ const tracks = this.tracks;
16
+ const track_count = tracks.length;
17
+
18
+ for (let i = 0; i < track_count; i++) {
19
+ const track = tracks[i];
13
20
 
14
21
  track.writeAt(time);
15
22
  }
@@ -1,8 +1,11 @@
1
+ import Signal from "../../../../../core/events/signal/Signal";
1
2
  import {System} from "../../../../ecs/System";
2
3
  import Engine from "../../../../Engine";
3
4
  import {SGMesh} from "./SGMesh";
4
5
  import {SGMeshAnimationController} from "./SGMeshAnimationController";
5
6
 
6
7
  export class SGMeshAnimationControllerSystem extends System<SGMeshAnimationController,SGMesh>{
8
+ readonly onWorkDone: Signal<void>
9
+
7
10
  constructor(engine:Engine)
8
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SGMeshAnimationControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js"],"names":[],"mappings":"AAQA;IAaI;;;OAGG;IACH,4BAeC;IAZG,eAAoB;IAEpB,mEAGC;IAED,gIAGC;IA2CL;;;;;OAKG;IACH,WAJW,yBAAyB,QACzB,MAAM,UACN,MAAM,iBAUhB;IA6CD,sBAoBC;;CACJ;uBA9JsB,2BAA2B;uBAE3B,aAAa;0CACM,gCAAgC;4CAL9B,0DAA0D"}
1
+ {"version":3,"file":"SGMeshAnimationControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js"],"names":[],"mappings":"AASA;IA0BI;;;OAGG;IACH,4BAeC;IAhCD;;;;OAIG;IACH,qBAFU,MAAM,CAES;IAerB,eAAoB;IAEpB,mEAGC;IAED,gIAGC;IAyCL;;;;;OAKG;IACH,WAJW,yBAAyB,QACzB,MAAM,UACN,MAAM,iBAUhB;IA+CD,sBAyBC;;CACJ;uBAhLsB,2BAA2B;mBAJ/B,6CAA6C;uBAMzC,aAAa;0CACM,gCAAgC;4CAL9B,0DAA0D"}
@@ -1,3 +1,4 @@
1
+ import Signal from "../../../../../core/events/signal/Signal.js";
1
2
  import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
2
3
  import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
3
4
  import { convert_three_clip } from "../../../../animation/curve/ecd_bind_animation_curve.js";
@@ -19,6 +20,19 @@ export class SGMeshAnimationControllerSystem extends System {
19
20
  */
20
21
  #queue = [];
21
22
 
23
+ /**
24
+ * Fires when one or more animation clips are currently playing and are updated
25
+ * @readonly
26
+ * @type {Signal}
27
+ */
28
+ onWorkDone = new Signal()
29
+
30
+ /**
31
+ * How many clips were updated during last tick
32
+ * @type {number}
33
+ */
34
+ #cycle_clip_advance_count = 0;
35
+
22
36
  /**
23
37
  *
24
38
  * @param {Engine} engine
@@ -67,8 +81,6 @@ export class SGMeshAnimationControllerSystem extends System {
67
81
  const controller = ecd.getComponent(entity, SGMeshAnimationController);
68
82
 
69
83
  controller.bound = animations;
70
-
71
- console.log(asset, animations);
72
84
  }
73
85
 
74
86
  /**
@@ -125,7 +137,7 @@ export class SGMeshAnimationControllerSystem extends System {
125
137
  } else {
126
138
  t = clip.duration;
127
139
 
128
- // remove active
140
+ // playback finished, remove active
129
141
  active.splice(i, 1);
130
142
 
131
143
  i--;
@@ -135,10 +147,13 @@ export class SGMeshAnimationControllerSystem extends System {
135
147
 
136
148
  clip.writeAt(t);
137
149
 
150
+ // mark clip update
151
+ this.#cycle_clip_advance_count++;
138
152
  }
139
153
  }
140
154
 
141
155
  update(td) {
156
+ this.#cycle_clip_advance_count = 0;
142
157
  this.#time_delta = td;
143
158
 
144
159
  for (let i = 0; i < 1000; i++) {
@@ -158,5 +173,9 @@ export class SGMeshAnimationControllerSystem extends System {
158
173
  }
159
174
 
160
175
  ecd.traverseComponents(SGMeshAnimationController, this.#visit_entity, this);
176
+
177
+ if (this.#cycle_clip_advance_count > 0) {
178
+ this.onWorkDone.send0();
179
+ }
161
180
  }
162
181
  }
@@ -10,7 +10,9 @@ test("1 point triangle geometry", () => {
10
10
  1, 2, 3
11
11
  ]));
12
12
 
13
- const address = bvh.getNodeAddress(0);
13
+ expect(bvh.leaf_node_count).toEqual(1);
14
+
15
+ const address = bvh.getLeafBlockAddress();
14
16
 
15
17
  const bounds = [];
16
18