@woosh/meep-engine 2.36.12 → 2.36.13

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.
@@ -510,6 +510,36 @@ BitSet.prototype.getAndClear = function (index) {
510
510
  return v;
511
511
  };
512
512
 
513
+ /**
514
+ *
515
+ * @param {number} distance
516
+ * @param {number} start_index
517
+ * @param {number} end_index
518
+ */
519
+ BitSet.prototype.shift_right = function (distance, start_index, end_index) {
520
+ assert.isNonNegativeInteger(distance, 'distance');
521
+
522
+ for (let i = end_index; i >= start_index; i--) {
523
+ const v = this.get(i);
524
+ this.set(i + distance, v);
525
+ }
526
+ }
527
+
528
+ /**
529
+ *
530
+ * @param {number} distance
531
+ * @param {number} start_index
532
+ * @param {number} end_index
533
+ */
534
+ BitSet.prototype.shift_left = function (distance, start_index, end_index) {
535
+ assert.isNonNegativeInteger(distance, 'distance');
536
+
537
+ for (let i = start_index; i <= end_index; i++) {
538
+ const v = this.get(i);
539
+ this.set(i - distance, v);
540
+ }
541
+ }
542
+
513
543
  /**
514
544
  *
515
545
  * @param {number} distance
@@ -518,15 +548,9 @@ BitSet.prototype.getAndClear = function (index) {
518
548
  */
519
549
  BitSet.prototype.shift = function (distance, start_index, end_index) {
520
550
  if (distance > 0) {
521
- for (let i = end_index; i >= start_index; i--) {
522
- const v = this.get(i);
523
- this.set(i + distance, v);
524
- }
551
+ this.shift_right(distance, start_index, end_index);
525
552
  } else {
526
- for (let i = start_index; i <= end_index; i++) {
527
- const v = this.get(i);
528
- this.set(i + distance, v);
529
- }
553
+ this.shift_right(-distance, start_index, end_index);
530
554
  }
531
555
  };
532
556
 
@@ -452,3 +452,15 @@ test('performance, next clear from 0', () => {
452
452
  const v = s.nextClearBit(0);
453
453
  }
454
454
  });
455
+
456
+
457
+ test('shift right by 1', () => {
458
+ const s = new BitSet();
459
+
460
+ s.set(0, true);
461
+
462
+ s.shift_right(1, 0, 1);
463
+
464
+ expect(s.get(0)).toBe(true);
465
+ expect(s.get(1)).toBe(true);
466
+ });
@@ -10,7 +10,12 @@ import { ShadedGeometry } from "./ShadedGeometry.js";
10
10
  export function three_object_to_entity_composition(root) {
11
11
  const node = new EntityNode();
12
12
 
13
- node.transform.fromMatrix4(root.matrix.elements);
13
+ const node_transform = node.transform;
14
+
15
+ // copy object transform
16
+ node_transform.position.copy(root.position);
17
+ node_transform.scale.copy(root.scale);
18
+ node_transform.rotation.copy(root.quaternion);
14
19
 
15
20
  const entity = node.entity;
16
21
 
@@ -265,7 +265,7 @@ export class IncrementalDeltaSet {
265
265
  // element is not in the set
266
266
 
267
267
  // shift flags to make space for it
268
- flags.shift(1, index, existing_size);
268
+ flags.shift_right(1, index, existing_size);
269
269
 
270
270
  // insert
271
271
  elements.splice(index, 0, element);
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.36.12",
8
+ "version": "2.36.13",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",