@woosh/meep-engine 2.39.34 → 2.39.37
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/core/bvh2/binary/IndexedBinaryBVH.js +8 -0
- package/core/bvh2/bvh3/bvh_query_user_data_overlaps_frustum.js +12 -11
- package/core/collection/array/computeHashArray.d.ts +1 -0
- package/core/collection/array/computeHashIntegerArray.d.ts +1 -0
- package/core/collection/array/computeHashIntegerArray.js +4 -9
- package/core/events/signal/Signal.js +2 -2
- package/core/events/signal/SignalHandler.js +1 -1
- package/core/function/FunctionCompiler.js +1 -1
- package/core/land/reactive/compileReactiveExpression.js +1 -1
- package/core/land/reactive/compiler/ReactiveCompiler.js +1 -1
- package/core/primitives/array/computeIntegerArrayHash.js +1 -1
- package/engine/ecs/EntityComponentDataset.js +2 -2
- package/engine/graphics/ecs/animation/animator/AnimationGraphSystem.js +5 -0
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +8 -2
- package/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +1 -1
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +27 -5
- package/engine/plugin/EnginePluginManager.js +1 -2
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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 computeHashArray<T>(array: T[], hash: (T) => number): number
|
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -182,7 +182,7 @@ export class Signal {
|
|
|
182
182
|
* @returns {boolean} true if a handler was removed, false otherwise
|
|
183
183
|
*/
|
|
184
184
|
remove(h, thisArg) {
|
|
185
|
-
assert.
|
|
185
|
+
assert.isFunction(h, "handler");
|
|
186
186
|
|
|
187
187
|
if (thisArg === undefined) {
|
|
188
188
|
return removeHandlerByHandler(this, h);
|
|
@@ -707,7 +707,7 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
function dispatchCallback(f, context, args) {
|
|
710
|
-
assert.
|
|
710
|
+
assert.isFunction(f, 'f');
|
|
711
711
|
|
|
712
712
|
try {
|
|
713
713
|
f.apply(context, args)
|
|
@@ -8,7 +8,7 @@ import { ReactivePegParser } from "./pegjs/ReactivePegParser.js";
|
|
|
8
8
|
* @returns {ReactiveExpression}
|
|
9
9
|
*/
|
|
10
10
|
export function compileReactiveExpression(code) {
|
|
11
|
-
assert.
|
|
11
|
+
assert.isString(code, 'code');
|
|
12
12
|
|
|
13
13
|
const parseTree = ReactivePegParser.INSTANCE.parse(code);
|
|
14
14
|
|
|
@@ -320,7 +320,7 @@ class CompilingVisitor extends AbstractParseTreeVisitor {
|
|
|
320
320
|
* @returns {ReactiveExpression}
|
|
321
321
|
*/
|
|
322
322
|
export function compileReactiveExpression(code) {
|
|
323
|
-
assert.
|
|
323
|
+
assert.isString(code, 'code');
|
|
324
324
|
|
|
325
325
|
const chars = new ANTLRInputStream(code);
|
|
326
326
|
|
|
@@ -1473,8 +1473,8 @@ export class EntityComponentDataset {
|
|
|
1473
1473
|
addEntityEventListener(entity, eventName, listener, thisArg) {
|
|
1474
1474
|
|
|
1475
1475
|
if (!ENV_PRODUCTION) {
|
|
1476
|
-
assert.
|
|
1477
|
-
assert.
|
|
1476
|
+
assert.isString(eventName, "eventName");
|
|
1477
|
+
assert.isFunction(listener, "listener");
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
1480
1480
|
if (!this.entityExists(entity)) {
|
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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.
|
|
8
|
+
"version": "2.39.37",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|