@woosh/meep-engine 2.34.7 → 2.34.8

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/assert.js CHANGED
@@ -268,7 +268,10 @@ assert.isFunction = function (value, name = 'value') {
268
268
  */
269
269
  assert.isNonNegativeInteger = function (value, name = 'value') {
270
270
  assert.isNumber(value, name);
271
- assert.greaterThanOrEqual(value, 0, `${name} must be >= 0, instead was ${value}`);
271
+
272
+ if (value < 0) {
273
+ throw new Error(`${name} must be >= 0, instead was ${value}`);
274
+ }
272
275
 
273
276
  if (!Number.isInteger(value)) {
274
277
  throw new Error(`${name} must be an integer, instead was ${value}`);
@@ -472,11 +472,11 @@ BitSet.prototype.get = function (bitIndex) {
472
472
  const byteOffset = bitIndex >> 5;
473
473
  const bitOffset = bitIndex & 31;
474
474
 
475
- const byte = this.__data_uint32[byteOffset];
475
+ const word = this.__data_uint32[byteOffset];
476
476
 
477
- const maskedValue = byte & (1 << bitOffset);
477
+ const masked_word = word & (1 << bitOffset);
478
478
 
479
- return maskedValue !== 0;
479
+ return masked_word !== 0;
480
480
  };
481
481
 
482
482
  /**
@@ -1057,7 +1057,7 @@ export class EntityComponentDataset {
1057
1057
  if (!ENV_PRODUCTION) {
1058
1058
  assert.isArray(classes, "classes");
1059
1059
  // assert.notOk(classes.some((c, i) => classes.indexOf(c) !== i), 'classes contains duplicates');
1060
- assert.typeOf(visitor, "function", "visitor");
1060
+ assert.isFunction(visitor, "visitor");
1061
1061
  }
1062
1062
 
1063
1063
  let entityIndex, i;
@@ -1093,18 +1093,23 @@ export class EntityComponentDataset {
1093
1093
 
1094
1094
  const entityOccupancy = this.entityOccupancy;
1095
1095
 
1096
+ const component_type_count = this.componentTypeCount;
1097
+ const component_occupancy = this.componentOccupancy;
1098
+ const components = this.components;
1099
+
1096
1100
  entity_loop: for (entityIndex = entityOccupancy.nextSetBit(0); entityIndex !== -1; entityIndex = entityOccupancy.nextSetBit(entityIndex + 1)) {
1097
- const componentOccupancyAddress = entityIndex * this.componentTypeCount;
1101
+ const componentOccupancyAddress = entityIndex * component_type_count;
1102
+
1098
1103
  for (i = 0; i < numClasses; i++) {
1099
1104
  const componentIndex = indices[i];
1100
1105
 
1101
- const componentPresent = this.componentOccupancy.get(componentOccupancyAddress + componentIndex);
1106
+ const componentPresent = component_occupancy.get(componentOccupancyAddress + componentIndex);
1102
1107
 
1103
1108
  if (!componentPresent) {
1104
1109
  continue entity_loop;
1105
1110
  }
1106
1111
 
1107
- args[i] = this.components[componentIndex][entityIndex];
1112
+ args[i] = components[componentIndex][entityIndex];
1108
1113
  }
1109
1114
 
1110
1115
  args[numClasses] = entityIndex;
@@ -184,10 +184,11 @@ export class IncrementalDeltaSet {
184
184
  */
185
185
  push(element) {
186
186
  //check if element is already in the set
187
- const i = this.elements.indexOf(element); //TODO this can probably be done faster. Maybe use a bloom filter? or some kind of a hash
187
+ const elements = this.elements;
188
+ const i = elements.indexOf(element); //TODO this can probably be done faster. Maybe use a bloom filter? or some kind of a hash
188
189
 
189
190
  if (i === -1) {
190
- this.elements.push(element);
191
+ elements.push(element);
191
192
  this.size++;
192
193
 
193
194
  this.onAdded.send1(element);
@@ -95,7 +95,7 @@ export class VisibilityComputer {
95
95
  * @param {Object3D} object3d
96
96
  */
97
97
  __includeObject(object3d) {
98
- assert.equal(object3d.isObject3D, true, `expected isObject3D to be true, instead was '${object3d.isObject3D}'`);
98
+ assert.equal(object3d.isObject3D, true, 'object3d.isObject3D !== true');
99
99
 
100
100
  // mark object, this is a hack, needs to be fixed at some point
101
101
  object3d[SOURCE_RENDER_LAYER_PROPERTY] = this.__activeLayer;
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.7",
8
+ "version": "2.34.8",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",