@woosh/meep-engine 2.39.35 → 2.39.36

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.
@@ -18,7 +18,8 @@ export function bvh_query_user_data_overlaps_frustum(
18
18
  result,
19
19
  result_offset,
20
20
  bvh,
21
- frustum) {
21
+ frustum
22
+ ) {
22
23
  const root = bvh.root;
23
24
 
24
25
  if (root === NULL_NODE) {
@@ -58,19 +59,19 @@ export function bvh_query_user_data_overlaps_frustum(
58
59
  if (!node_is_leaf) {
59
60
 
60
61
  if (intersection === 2) {
61
- // fully inside
62
+ // fully inside, fast collection path
62
63
  result_cursor += bvh_collect_user_data(result, result_cursor, bvh, node);
63
- continue;
64
+ } else {
65
+ // partially inside
66
+ // read in-order
67
+ const child1 = bvh.node_get_child1(node);
68
+ const child2 = bvh.node_get_child2(node);
69
+
70
+ // write to stack in reverse order, so that fist child ends up being visited first
71
+ traversal_stack[traversal_cursor++] = child1;
72
+ traversal_stack[traversal_cursor++] = child2;
64
73
  }
65
74
 
66
- // read in-order
67
- const child1 = bvh.node_get_child1(node);
68
- const child2 = bvh.node_get_child2(node);
69
-
70
- // write to stack in reverse order, so that fist child ends up being visited first
71
- traversal_stack[traversal_cursor++] = child1;
72
- traversal_stack[traversal_cursor++] = child2;
73
-
74
75
  } else {
75
76
  // leaf node
76
77
 
@@ -0,0 +1 @@
1
+ export function computeHashIntegerArray(...value: number[]): number
@@ -1,15 +1,10 @@
1
+ import { computeIntegerArrayHash } from "../../primitives/array/computeIntegerArrayHash.js";
2
+
1
3
  /**
2
4
  * Computes hash on integer values
3
5
  * @param {...number} value
4
6
  * @returns {number}
5
7
  */
6
- export function computeHashIntegerArray(value) {
7
- let hash = 0;
8
- const numArguments = arguments.length;
9
- for (let i = 0; i < numArguments; i++) {
10
- const singleValue = arguments[i];
11
- hash = ((hash << 5) - hash) + singleValue;
12
- hash |= 0; // Convert to 32bit integer
13
- }
14
- return hash;
8
+ export function computeHashIntegerArray(...value) {
9
+ return computeIntegerArrayHash(value, 0, value.length);
15
10
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  *
3
- * @param {Uint8Array} data
3
+ * @param {Uint8Array|number[]|ArrayLike<number>|IArguments} data
4
4
  * @param {number} offset
5
5
  * @param {number} length
6
6
  */
@@ -200,6 +200,11 @@ export class AnimationGraphSystem extends System {
200
200
  return false;
201
201
  }
202
202
 
203
+ if (!graph.getFlag(AnimationGraphFlag.Linked)) {
204
+ // not linked this is generally a case of failed linkage, either way - don't animate
205
+ return false;
206
+ }
207
+
203
208
  if (graph.getFlag(AnimationGraphFlag.MeshSizeCulling)) {
204
209
 
205
210
  //check the size of the mesh in screen space, culling animation of tiny objects
@@ -4,7 +4,9 @@ import { AnimationStateType } from "./AnimationStateType.js";
4
4
  import { AnimationMixer } from "three";
5
5
  import { AnimationGraphFlag } from "./AnimationGraphFlag.js";
6
6
  import { writeAnimationGraphDefinitionToJSON } from "./definition/serialization/writeAnimationGraphDefinitionToJSON.js";
7
- import { readAnimationGraphDefinitionFromJSON } from "./definition/serialization/readAnimationGraphDefinitionFromJSON.js";
7
+ import {
8
+ readAnimationGraphDefinitionFromJSON
9
+ } from "./definition/serialization/readAnimationGraphDefinitionFromJSON.js";
8
10
  import { assert } from "../../../../../../core/assert.js";
9
11
  import { threeUpdateTransform } from "../../../../util/threeUpdateTransform.js";
10
12
  import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
@@ -399,7 +401,6 @@ export class AnimationGraph {
399
401
  const clipIndex = graphDefinition.clipIndex;
400
402
  const nClips = clipIndex.length;
401
403
 
402
-
403
404
  /**
404
405
  * @type {AnimationClip[]}
405
406
  */
@@ -433,6 +434,7 @@ export class AnimationGraph {
433
434
 
434
435
  throw new Error(`Animation '${animationClipDefinition.name}' not found`);
435
436
  }
437
+
436
438
  }
437
439
 
438
440
  link(entity, ecd) {
@@ -549,6 +551,10 @@ export class AnimationGraph {
549
551
  */
550
552
  const action = this.__actions[i];
551
553
 
554
+ if (action === undefined) {
555
+ console.warn(`Action[${i}] is undefined`);
556
+ }
557
+
552
558
  action.weight = weight;
553
559
  action.timeScale = timeScale;
554
560
  }
@@ -64,6 +64,13 @@ export class StaticKnowledgeDataTable {
64
64
  */
65
65
  __automatic_ids = false;
66
66
 
67
+ /**
68
+ *
69
+ * @type {string}
70
+ * @protected
71
+ */
72
+ __element_type_name = 'element';
73
+
67
74
  reset() {
68
75
  Object.keys(this.elements).forEach(id => {
69
76
  delete this.elements[id];
@@ -134,7 +141,7 @@ export class StaticKnowledgeDataTable {
134
141
  const element = this.get(id);
135
142
 
136
143
  if (element === null) {
137
- throw new Error(`Failed to get element '${id}' from the database'`);
144
+ throw new Error(`Failed to get ${this.__element_type_name} '${id}' from the database'`);
138
145
  }
139
146
 
140
147
  result.push(element);
@@ -248,6 +255,17 @@ export class StaticKnowledgeDataTable {
248
255
 
249
256
  }
250
257
 
258
+ const flag_ignore = datum['@ignore'];
259
+ if (flag_ignore !== undefined) {
260
+ if (typeof flag_ignore !== "boolean") {
261
+ console.warn(`@ignore flag is present on ${this.__element_type_name} '${id}'. @ignore must be a boolean (true/false), instead was '${typeof flag_ignore}'(=${flag_ignore})`);
262
+ } else if (flag_ignore) {
263
+ console.warn(`[${this.__element_type_name}:${id}] @ignore flag is set to true, skipping`);
264
+ } else {
265
+ console.warn(`[${this.__element_type_name}:${id}] @ignore flag is set to false and has no effect, please remove this field from JSON`);
266
+ }
267
+ }
268
+
251
269
  let element;
252
270
 
253
271
  try {
@@ -262,7 +280,7 @@ export class StaticKnowledgeDataTable {
262
280
  _id = 'ERROR';
263
281
  }
264
282
 
265
- console.error(`Failed to parse element (id=${_id})`, e, datum);
283
+ console.error(`Failed to parse ${this.__element_type_name} (id=${_id})`, e, datum);
266
284
  return;
267
285
  }
268
286
 
@@ -291,7 +309,7 @@ export class StaticKnowledgeDataTable {
291
309
  const added = this.add(element);
292
310
 
293
311
  if (!added) {
294
- console.error(`Failed to add element '${id}', most likely this a duplicate key`);
312
+ console.error(`Failed to add ${this.__element_type_name} '${id}', most likely this a duplicate key`);
295
313
  }
296
314
  });
297
315
 
@@ -344,10 +362,14 @@ export class StaticKnowledgeDataTable {
344
362
  try {
345
363
  promise = this.linkOne(element, json, database, assetManager);
346
364
  } catch (e) {
347
- console.error(`.linkOne(#id=${id}) threw unexpectedly:`, e);
365
+ const wrap = new Error(`.linkOne(#id=${id}) threw unexpectedly: ${e.message}`);
366
+
367
+ if (e.stack !== undefined) {
368
+ wrap.stack = e.stack;
369
+ }
348
370
 
349
371
  //re-throw to fail
350
- throw e;
372
+ throw wrap;
351
373
  }
352
374
 
353
375
  if (promise === undefined) {
@@ -153,7 +153,6 @@ export class EnginePluginManager extends BaseProcess {
153
153
  const removed = this.__plugins.delete(PluginClass);
154
154
 
155
155
  if (!removed) {
156
- console.error('Plugin was not found', PluginClass);
157
156
  return;
158
157
  }
159
158
 
@@ -259,7 +258,7 @@ export class EnginePluginManager extends BaseProcess {
259
258
 
260
259
  const engine = this.engine;
261
260
 
262
- await ctx.transition(manager_state_value,engine);
261
+ await ctx.transition(manager_state_value, engine);
263
262
 
264
263
  return reference;
265
264
 
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.39.35",
8
+ "version": "2.39.36",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",