@woosh/meep-engine 2.34.32 → 2.34.33

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/engine/Engine.js CHANGED
@@ -131,6 +131,11 @@ class Engine {
131
131
  const v_fps = (1 / stats.mean).toFixed(2);
132
132
 
133
133
 
134
+ // clear stats
135
+ m_render.clear();
136
+ m_sim.clear();
137
+ m_frame.clear();
138
+
134
139
  return `FPS: ${v_fps}, RENDER: ${v_render}ms, SIMULATION: ${v_sim}ms`;
135
140
  });
136
141
 
@@ -21,4 +21,8 @@ export class AbstractMetric {
21
21
  computeStats(result) {
22
22
  throw new Error('Not implemented');
23
23
  }
24
+
25
+ clear(){
26
+ throw new Error('Not implemented');
27
+ }
24
28
  }
@@ -31,4 +31,8 @@ export class RingBufferMetric extends AbstractMetric {
31
31
  result.max = computeArrayMax(array, 0, data_count);
32
32
  result.min = computeArrayMin(array, 0, data_count);
33
33
  }
34
+
35
+ clear() {
36
+ this.__data.clear();
37
+ }
34
38
  }
@@ -81,6 +81,9 @@ export class ShadedGeometrySystem extends System {
81
81
 
82
82
  const leaf_node = sg.bvh;
83
83
 
84
+ // record entity on the BVH leaf
85
+ leaf_node.entity = entity;
86
+
84
87
  // remember entity for lookups
85
88
  sg.__entity = entity;
86
89
 
@@ -130,30 +130,31 @@ const DataConverterType = {
130
130
  * @returns {DataConverterType}
131
131
  */
132
132
  function compute_attribute_data_converter(source, spec) {
133
- if (spec.type === DataType.Float16) {
133
+ const target_type = spec.type;
134
+ if (target_type === DataType.Float16) {
134
135
  return DataConverterType.Number2HalfFloat;
135
136
  } else if (spec.normalized && !source.normalized) {
136
137
  // source data can be normalized but isn't
137
- if (spec.type === DataType.Int8) {
138
+ if (target_type === DataType.Int8) {
138
139
  return DataConverterType.Normalize2Int8;
139
140
  } else {
140
- throw new Error(`Unsupported normalized type '${spec.type}'`);
141
+ throw new Error(`Unsupported normalized type '${target_type}'`);
141
142
  }
142
143
  } else {
143
144
  const source_array = source.array;
144
145
 
145
146
  const source_type = typedArrayToDataType(source_array);
146
147
 
147
- const target_byte_size = dataTypeByteSize(spec.type);
148
+ const target_byte_size = dataTypeByteSize(target_type);
148
149
  const source_byte_size = dataTypeByteSize(source_type)
149
150
 
150
151
  if (target_byte_size !== source_byte_size) {
151
152
  // wrong data size
152
153
 
153
- if (spec.type === DataType.Uint8 && source_type === DataType.Uint16) {
154
+ if (target_type === DataType.Uint8 && source_type === DataType.Uint16) {
154
155
  return DataConverterType.ResampleNormalized_Uint16_to_Uint8;
155
156
  } else {
156
- throw new Error(`Unsupported conversion ${source_type} -> `);
157
+ throw new Error(`Unsupported conversion ${source_type} -> ${target_type}`);
157
158
  }
158
159
 
159
160
  } else {
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.34.32",
8
+ "version": "2.34.33",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",