@woosh/meep-engine 2.33.14 → 2.33.15

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.
@@ -13,6 +13,18 @@ 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
+ * Returns current time in milliseconds
18
+ * Wrapper to ensure support of both web as well as node.js
19
+ * @return {number}
20
+ */
21
+ function current_time_millis() {
22
+ if (typeof performance !== 'undefined') {
23
+ return performance.now();
24
+ } else {
25
+ return Date.now();
26
+ }
27
+ }
16
28
 
17
29
  /**
18
30
  *
@@ -141,7 +153,7 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
141
153
 
142
154
  // TODO drop patches with 0 volume (degenerate triangles)
143
155
 
144
- const t_build_leaf_patches_start = performance.now();
156
+ const t_build_leaf_patches_start = current_time_millis();
145
157
 
146
158
  const patches = await build_leaf_patches_metis(
147
159
  topoMesh,
@@ -152,7 +164,7 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
152
164
  );
153
165
 
154
166
  if (PRINT_VERBOSE_STATS) {
155
- console.log(`build leaf patches: ${(performance.now() - t_build_leaf_patches_start)}ms`);
167
+ console.log(`build leaf patches: ${(current_time_millis() - t_build_leaf_patches_start)}ms`);
156
168
 
157
169
 
158
170
  console.log(build_clustering_info(patches));
@@ -167,11 +179,11 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
167
179
  // console.timeEnd('assign initial neighbours');
168
180
 
169
181
 
170
- const t_build_hierarchy_start = performance.now();
182
+ const t_build_hierarchy_start = current_time_millis();
171
183
  const root = await buildAbstractPatchHierarchy(patches);
172
184
 
173
185
  if (PRINT_VERBOSE_STATS) {
174
- console.log(`build hierarchy: ${(performance.now() - t_build_hierarchy_start)}ms`);
186
+ console.log(`build hierarchy: ${(current_time_millis() - t_build_hierarchy_start)}ms`);
175
187
  }
176
188
 
177
189
  // console.profile('simplification');
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.14",
7
+ "version": "2.33.15",
8
8
  "dependencies": {
9
9
  "fast-levenshtein": "2.0.6",
10
10
  "opentype.js": "1.3.3",