@woosh/meep-engine 2.39.33 → 2.39.34
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/binary/BinaryBuffer.js +825 -827
- package/core/binary/EncodingBinaryBuffer.js +38 -41
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.d.ts +20 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +5 -35
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +19 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +3 -3
- package/engine/ecs/speaker/VoiceSystem.js +8 -0
- package/engine/metrics/GoogleAnalyticsMetrics.js +2 -1
- package/package.json +1 -1
|
@@ -36,62 +36,59 @@ class Dictionary {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
EncodingBinaryBuffer.prototype = Object.create(BinaryBuffer.prototype);
|
|
39
|
+
export class EncodingBinaryBuffer extends BinaryBuffer {
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
this.__dictionary = new Dictionary();
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
writeUTF8String(value) {
|
|
46
|
+
const address = this.__dictionary.getAddress(value);
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (address === undefined) {
|
|
49
|
+
this.writeUint8(0); //mark as complete value
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
const address1 = this.position;
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
super.writeUTF8String(value);
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
this.__dictionary.add(value, address1);
|
|
56
|
+
} else {
|
|
57
|
+
//write as reference
|
|
58
|
+
this.writeUint32LE(1 | (address << 1));
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
|
-
};
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
readUTF8String() {
|
|
63
|
+
const header0 = this.readUint8();
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
if (header0 === 0) {
|
|
66
|
+
//complete value
|
|
67
|
+
return super.readUTF8String();
|
|
68
|
+
} else {
|
|
69
|
+
this.position--;
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
const header = this.readUint32LE();
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
const address = header >> 1;
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
let value = this.__dictionary.getValue(address);
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
if (value === undefined) {
|
|
78
|
+
//remember position
|
|
79
|
+
const p = this.position;
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
this.position = address;
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
value = super.readUTF8String();
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
//restore position
|
|
86
|
+
this.position = p;
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
this.__dictionary.add(value, address);
|
|
89
|
+
}
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
93
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export { EncodingBinaryBuffer };
|
|
94
|
+
}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
export class ExplicitBinaryBoundingVolumeHierarchy {
|
|
2
|
+
readonly root: number
|
|
2
3
|
|
|
4
|
+
allocate_node(): number
|
|
5
|
+
|
|
6
|
+
release_node(node: number): void
|
|
7
|
+
|
|
8
|
+
insert_leaf(node: number): void
|
|
9
|
+
|
|
10
|
+
remove_leaf(node: number): void
|
|
11
|
+
|
|
12
|
+
collect_nodes_all(destination: ArrayLike<number>, destination_offset: number): void
|
|
13
|
+
|
|
14
|
+
node_set_aabb(node: number, aabb: ArrayLike<number>): void
|
|
15
|
+
|
|
16
|
+
node_get_aabb(node: number, aabb: ArrayLike<number>): void
|
|
17
|
+
|
|
18
|
+
node_set_user_data(node: number, data: number): void
|
|
19
|
+
|
|
20
|
+
node_get_user_data(node: number): number
|
|
21
|
+
|
|
22
|
+
release_all(): void
|
|
3
23
|
}
|
|
@@ -49,12 +49,6 @@ const ELEMENT_WORD_COUNT = 10;
|
|
|
49
49
|
*/
|
|
50
50
|
const INITIAL_CAPACITY = 128;
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @type {number[]}
|
|
55
|
-
*/
|
|
56
|
-
const scratch_stack = [];
|
|
57
|
-
|
|
58
52
|
/**
|
|
59
53
|
* Bounding Volume Hierarchy implementation. Stores unsigned integer values at leaves, these are typically IDs or Index values.
|
|
60
54
|
* Highly optimized both in terms of memory usage and CPU. Most of the code inlined. No allocation are performed during usage (except for growing the tree capacity).
|
|
@@ -300,7 +294,7 @@ export class ExplicitBinaryBoundingVolumeHierarchy {
|
|
|
300
294
|
/**
|
|
301
295
|
*
|
|
302
296
|
* @param {number} id
|
|
303
|
-
* @param {number[]} aabb
|
|
297
|
+
* @param {number[]|ArrayLike<number>} aabb
|
|
304
298
|
*/
|
|
305
299
|
node_set_aabb(id, aabb) {
|
|
306
300
|
assert.isNonNegativeInteger(id, 'id');
|
|
@@ -882,36 +876,12 @@ export class ExplicitBinaryBoundingVolumeHierarchy {
|
|
|
882
876
|
|
|
883
877
|
/**
|
|
884
878
|
* Release all nodes, this essentially resets the tree to empty state
|
|
879
|
+
* NOTE: For performance reasons, released memory is not reset, this means that attempting to access cleared nodes' memory will yield garbage data
|
|
885
880
|
*/
|
|
886
881
|
release_all() {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
const root = this.__root;
|
|
891
|
-
|
|
892
|
-
if (root !== NULL_NODE) {
|
|
893
|
-
stack[cursor++] = root;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
const uint32 = this.__data_uint32;
|
|
897
|
-
|
|
898
|
-
while (cursor > 0) {
|
|
899
|
-
cursor--;
|
|
900
|
-
|
|
901
|
-
const node = stack[cursor];
|
|
902
|
-
|
|
903
|
-
const node_address = node * ELEMENT_WORD_COUNT;
|
|
904
|
-
|
|
905
|
-
const child1 = uint32[node_address + COLUMN_CHILD_1];
|
|
906
|
-
const child2 = uint32[node_address + COLUMN_CHILD_2];
|
|
907
|
-
|
|
908
|
-
if (child1 !== NULL_NODE) {
|
|
909
|
-
stack[cursor++] = child2;
|
|
910
|
-
stack[cursor++] = child1;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
this.release_node(node);
|
|
914
|
-
}
|
|
882
|
+
this.__root = NULL_NODE;
|
|
883
|
+
this.__size = 0;
|
|
884
|
+
this.__free_pointer = 0;
|
|
915
885
|
}
|
|
916
886
|
|
|
917
887
|
/**
|
|
@@ -143,3 +143,22 @@ test("add and remove 5 nodes", () => {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
});
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
test("release_all from empty doesn't throw", () => {
|
|
149
|
+
const bvh = new ExplicitBinaryBoundingVolumeHierarchy();
|
|
150
|
+
|
|
151
|
+
expect(() => bvh.release_all()).not.toThrow();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("release_all with 1 leaf", () => {
|
|
155
|
+
const bvh = new ExplicitBinaryBoundingVolumeHierarchy();
|
|
156
|
+
|
|
157
|
+
const a = bvh.allocate_node();
|
|
158
|
+
|
|
159
|
+
bvh.insert_leaf(a);
|
|
160
|
+
|
|
161
|
+
bvh.release_all();
|
|
162
|
+
|
|
163
|
+
expect(bvh.root).toBe(NULL_NODE);
|
|
164
|
+
});
|
|
@@ -57,7 +57,7 @@ class DirectionStyle {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
function
|
|
60
|
+
function apply_hierarchical_options_from_json(source, target) {
|
|
61
61
|
for (const prop_name in source) {
|
|
62
62
|
if (!target.hasOwnProperty(prop_name)) {
|
|
63
63
|
console.warn(`Property '${prop_name}' doesn't exist, valid properties are : ${Object.keys(target)}`);
|
|
@@ -71,7 +71,7 @@ function apply_hierarchical_options(source, target) {
|
|
|
71
71
|
if (typeof existing_target_value.fromJSON === "function") {
|
|
72
72
|
existing_target_value.fromJSON(source_value);
|
|
73
73
|
} else {
|
|
74
|
-
|
|
74
|
+
apply_hierarchical_options_from_json(source_value, existing_target_value);
|
|
75
75
|
}
|
|
76
76
|
} else {
|
|
77
77
|
target[prop_name] = source_value;
|
|
@@ -153,7 +153,7 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
|
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
// read options
|
|
156
|
-
|
|
156
|
+
apply_hierarchical_options_from_json(options, this.options);
|
|
157
157
|
|
|
158
158
|
// Generate list of axes
|
|
159
159
|
this.bubbles = [
|
|
@@ -28,6 +28,8 @@ import { AnimationBehavior } from "../../animation/keyed2/behavior/AnimationBeha
|
|
|
28
28
|
import AnimationTrack from "../../animation/keyed2/AnimationTrack.js";
|
|
29
29
|
import TransitionFunctions from "../../animation/TransitionFunctions.js";
|
|
30
30
|
import AnimationTrackPlayback from "../../animation/keyed2/AnimationTrackPlayback.js";
|
|
31
|
+
import { globalMetrics } from "../../metrics/GlobalMetrics.js";
|
|
32
|
+
import { MetricsCategory } from "../../metrics/MetricsCategory.js";
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* Delay before the user notices the text and begins to read
|
|
@@ -443,5 +445,11 @@ export class VoiceSystem extends AbstractContextSystem {
|
|
|
443
445
|
|
|
444
446
|
entityBuilder
|
|
445
447
|
.build(ecd);
|
|
448
|
+
|
|
449
|
+
// send metrics
|
|
450
|
+
globalMetrics.record('ecs.system.voice', {
|
|
451
|
+
category: MetricsCategory.System,
|
|
452
|
+
label: line_id
|
|
453
|
+
});
|
|
446
454
|
}
|
|
447
455
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { MetricsGateway } from "./MetricsGateway.js";
|
|
2
2
|
|
|
3
3
|
// const GOOGLE_ANALYTICS_KEY = 'UA-66021000-1'; //Lazy-Kitty.com
|
|
4
|
-
const GOOGLE_ANALYTICS_KEY = 'UA-138821093-1'; //Itch.com
|
|
4
|
+
// const GOOGLE_ANALYTICS_KEY = 'UA-138821093-1'; //Itch.com
|
|
5
|
+
const GOOGLE_ANALYTICS_KEY = 'G-ZBGZD4ZMZ1'; //ASKARA
|
|
5
6
|
|
|
6
7
|
function loadGTAG(MEASUREMENT_ID) {
|
|
7
8
|
|
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.34",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|