@woosh/meep-engine 2.33.12 → 2.33.16
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.
|
@@ -62,15 +62,17 @@ function codeToURL(code) {
|
|
|
62
62
|
|
|
63
63
|
let blob;
|
|
64
64
|
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
if (typeof window === 'object') {
|
|
66
|
+
if (typeof window.Blob !== "undefined") {
|
|
67
|
+
blob = new Blob([code], { type: js_mime });
|
|
68
|
+
} else {
|
|
69
|
+
// Backwards-compatibility
|
|
70
|
+
const BlobBuilder = window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
|
|
71
|
+
if (BlobBuilder !== undefined) {
|
|
72
|
+
blob = new BlobBuilder();
|
|
73
|
+
blob.append(code);
|
|
74
|
+
blob = blob.getBlob();
|
|
75
|
+
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -13,26 +13,17 @@ import { build_geometry_info } from "./build_geometry_info.js";
|
|
|
13
13
|
import { build_leaf_patches_metis } from "./clustering/build_leaf_patches_metis.js";
|
|
14
14
|
import { compute_buffer_geometry_byte_size } from "../../geometry/buffered/compute_buffer_geometry_byte_size.js";
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Returns current time in milliseconds
|
|
18
|
+
* Wrapper to ensure support of both web as well as node.js
|
|
19
|
+
* @return {number}
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const spec = attributes[i];
|
|
27
|
-
|
|
28
|
-
const itemSize = spec.itemSize;
|
|
29
|
-
|
|
30
|
-
for (let j = 0; j < itemSize; j++) {
|
|
31
|
-
data_types.push(spec.type);
|
|
32
|
-
}
|
|
21
|
+
function current_time_millis() {
|
|
22
|
+
if (typeof performance !== 'undefined') {
|
|
23
|
+
return performance.now();
|
|
24
|
+
} else {
|
|
25
|
+
return Date.now();
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
return data_types;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
29
|
/**
|
|
@@ -141,7 +132,7 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
|
|
|
141
132
|
|
|
142
133
|
// TODO drop patches with 0 volume (degenerate triangles)
|
|
143
134
|
|
|
144
|
-
const t_build_leaf_patches_start =
|
|
135
|
+
const t_build_leaf_patches_start = current_time_millis();
|
|
145
136
|
|
|
146
137
|
const patches = await build_leaf_patches_metis(
|
|
147
138
|
topoMesh,
|
|
@@ -152,7 +143,7 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
|
|
|
152
143
|
);
|
|
153
144
|
|
|
154
145
|
if (PRINT_VERBOSE_STATS) {
|
|
155
|
-
console.log(`build leaf patches: ${(
|
|
146
|
+
console.log(`build leaf patches: ${(current_time_millis() - t_build_leaf_patches_start)}ms`);
|
|
156
147
|
|
|
157
148
|
|
|
158
149
|
console.log(build_clustering_info(patches));
|
|
@@ -167,11 +158,11 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
|
|
|
167
158
|
// console.timeEnd('assign initial neighbours');
|
|
168
159
|
|
|
169
160
|
|
|
170
|
-
const t_build_hierarchy_start =
|
|
161
|
+
const t_build_hierarchy_start = current_time_millis();
|
|
171
162
|
const root = await buildAbstractPatchHierarchy(patches);
|
|
172
163
|
|
|
173
164
|
if (PRINT_VERBOSE_STATS) {
|
|
174
|
-
console.log(`build hierarchy: ${(
|
|
165
|
+
console.log(`build hierarchy: ${(current_time_millis() - t_build_hierarchy_start)}ms`);
|
|
175
166
|
}
|
|
176
167
|
|
|
177
168
|
// console.profile('simplification');
|
|
@@ -35,8 +35,20 @@ export function convertPathToURL(path) {
|
|
|
35
35
|
} else if (ENVIRONMENT_IS_WORKER) {
|
|
36
36
|
scope = self;
|
|
37
37
|
} else if (ENVIRONMENT_IS_NODE) {
|
|
38
|
+
|
|
39
|
+
let normalized_path = path.replace(/\\/g, '/');
|
|
40
|
+
|
|
41
|
+
if (normalized_path[0] !== '/') {
|
|
42
|
+
// Windows drive letter must be prefixed with a slash.
|
|
43
|
+
normalized_path = `/${normalized_path}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
scope = {
|
|
39
|
-
location:
|
|
47
|
+
location: {
|
|
48
|
+
pathname: normalized_path,
|
|
49
|
+
host: '',
|
|
50
|
+
protocol: 'file:'
|
|
51
|
+
}
|
|
40
52
|
};
|
|
41
53
|
} else {
|
|
42
54
|
throw new Error('Unknown environment');
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"productName": "Meep",
|
|
5
5
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
6
6
|
"author": "Alexander Goldring",
|
|
7
|
-
"version": "2.33.
|
|
7
|
+
"version": "2.33.16",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"fast-levenshtein": "2.0.6",
|
|
10
10
|
"opentype.js": "1.3.3",
|