@woosh/meep-engine 2.120.2 → 2.120.3

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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +2 -1
  3. package/editor/view/ecs/EntityEditor.js +2 -1
  4. package/editor/view/makeEntityDecorators.js +5 -5
  5. package/package.json +1 -1
  6. package/src/core/binary/BitSet.d.ts +59 -38
  7. package/src/core/binary/BitSet.d.ts.map +1 -1
  8. package/src/core/binary/BitSet.js +76 -55
  9. package/src/core/function/noop.d.ts +4 -1
  10. package/src/core/function/noop.d.ts.map +1 -1
  11. package/src/core/function/noop.js +4 -1
  12. package/src/core/geom/Vector4.d.ts.map +1 -1
  13. package/src/core/geom/Vector4.js +27 -5
  14. package/src/core/math/gaussian.d.ts +5 -4
  15. package/src/core/math/gaussian.d.ts.map +1 -1
  16. package/src/core/math/gaussian.js +5 -4
  17. package/src/core/math/matrix/SquareMatrix.d.ts +55 -32
  18. package/src/core/math/matrix/SquareMatrix.d.ts.map +1 -1
  19. package/src/core/math/matrix/SquareMatrix.js +59 -33
  20. package/src/core/math/spline/spline_hermite3_to_bezier.d.ts +6 -5
  21. package/src/core/math/spline/spline_hermite3_to_bezier.d.ts.map +1 -1
  22. package/src/core/math/spline/spline_hermite3_to_bezier.js +15 -11
  23. package/src/core/model/ModuleRegistry.d.ts.map +1 -1
  24. package/src/core/model/ModuleRegistry.js +2 -2
  25. package/src/engine/EngineConfiguration.js +1 -1
  26. package/src/engine/ecs/Entity.d.ts.map +1 -1
  27. package/src/engine/ecs/Entity.js +42 -2
  28. package/src/engine/ecs/EntityBuilderUtils.js +1 -1
  29. package/src/engine/ecs/EntityComponentDataset.d.ts +1 -1
  30. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  31. package/src/engine/ecs/EntityComponentDataset.js +25 -4
  32. package/src/engine/ecs/EntityManager.d.ts.map +1 -1
  33. package/src/engine/ecs/EntityManager.js +6 -12
  34. package/src/engine/ecs/EntityReference.d.ts +14 -0
  35. package/src/engine/ecs/EntityReference.d.ts.map +1 -1
  36. package/src/engine/ecs/EntityReference.js +18 -0
  37. package/src/engine/ecs/EventType.d.ts +10 -0
  38. package/src/engine/ecs/EventType.d.ts.map +1 -0
  39. package/src/engine/ecs/EventType.js +10 -0
  40. package/src/engine/ecs/System.d.ts.map +1 -1
  41. package/src/engine/ecs/System.js +1 -12
  42. package/src/engine/ecs/computeSystemName.d.ts +8 -0
  43. package/src/engine/ecs/computeSystemName.d.ts.map +1 -0
  44. package/src/engine/ecs/computeSystemName.js +10 -0
  45. package/src/engine/ecs/parent/ParentEntitySystem.js +1 -1
  46. package/src/engine/ecs/terrain/TerrainClouds.d.ts +43 -10
  47. package/src/engine/ecs/terrain/TerrainClouds.d.ts.map +1 -1
  48. package/src/engine/ecs/terrain/TerrainClouds.js +38 -2
  49. package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
  50. package/src/engine/ecs/terrain/ecs/Terrain.js +6 -0
  51. package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.d.ts.map +1 -1
  52. package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +3 -1
  53. package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.d.ts.map +1 -1
  54. package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +7 -7
  55. package/src/engine/input/devices/InputDeviceSwitch.d.ts +4 -0
  56. package/src/engine/input/devices/InputDeviceSwitch.d.ts.map +1 -1
  57. package/src/engine/input/devices/InputDeviceSwitch.js +4 -2
  58. package/src/engine/input/devices/KeyCodes.d.ts.map +1 -1
  59. package/src/engine/input/devices/KeyCodes.js +1 -0
  60. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  61. package/src/engine/input/devices/KeyboardDevice.js +28 -3
  62. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts.map +1 -1
  63. package/src/engine/knowledge/database/StaticKnowledgeDataTable.js +3 -0
  64. package/src/engine/ui/notification/NotificationManager.d.ts.map +1 -1
  65. package/src/engine/ui/notification/NotificationManager.js +2 -1
  66. package/src/engine/ecs/transform/Transform.editor.schema.json +0 -16
package/README.md CHANGED
@@ -13,7 +13,7 @@ To help get you started, various samples are provided under `/samples` folder. F
13
13
 
14
14
  ## Quality
15
15
 
16
- Meep is covered by 2,458 unit tests
16
+ Meep is covered by 2,508 unit tests
17
17
 
18
18
  The aim is not to have 100% coverage, [but to ensure quality](https://about.codecov.io/blog/the-case-against-100-code-coverage/). As a result, the tests are written to cover complex code first and to exhaustively validate critical algorithms.
19
19
  Most of the test code is significantly larger than the code that is being tested.
@@ -7,7 +7,8 @@ import { ProcessState } from "../../../src/core/process/ProcessState.js";
7
7
  import Task from "../../../src/core/process/task/Task.js";
8
8
  import { TaskSignal } from "../../../src/core/process/task/TaskSignal.js";
9
9
  import Entity from "../../../src/engine/ecs/Entity.js";
10
- import { EventType } from "../../../src/engine/ecs/EntityManager.js";
10
+
11
+ import { EventType } from "../../../src/engine/ecs/EventType.js";
11
12
  import Renderable from "../../../src/engine/ecs/renderable/Renderable.js";
12
13
  import { obtainTerrain } from "../../../src/engine/ecs/terrain/util/obtainTerrain.js";
13
14
  import { Transform } from "../../../src/engine/ecs/transform/Transform.js";
@@ -1,7 +1,8 @@
1
1
  import List from '../../../src/core/collection/list/List.js';
2
2
  import ObservedValue from '../../../src/core/model/ObservedValue.js';
3
3
  import { isDefined } from "../../../src/core/process/matcher/isDefined.js";
4
- import { EntityManager, EventType } from "../../../src/engine/ecs/EntityManager.js";
4
+ import { EntityManager } from "../../../src/engine/ecs/EntityManager.js";
5
+ import { EventType } from "../../../src/engine/ecs/EventType.js";
5
6
  import LabelView from '../../../src/view/common/LabelView.js';
6
7
  import dom from "../../../src/view/DOM.js";
7
8
  import ButtonView from '../../../src/view/elements/button/ButtonView.js';
@@ -1,12 +1,12 @@
1
1
  import { Tag } from "../../src/engine/ecs/components/Tag.js";
2
- import EmptyView from "../../src/view/elements/EmptyView.js";
3
- import LabelView from "../../src/view/common/LabelView.js";
2
+ import { EventType } from "../../src/engine/ecs/EventType.js";
3
+ import { Camera } from "../../src/engine/graphics/ecs/camera/Camera.js";
4
+ import { Light } from "../../src/engine/graphics/ecs/light/Light.js";
4
5
  import Mesh from "../../src/engine/graphics/ecs/mesh/Mesh.js";
5
6
  import { ParticleEmitter } from "../../src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js";
6
- import { Light } from "../../src/engine/graphics/ecs/light/Light.js";
7
- import { Camera } from "../../src/engine/graphics/ecs/camera/Camera.js";
7
+ import LabelView from "../../src/view/common/LabelView.js";
8
+ import EmptyView from "../../src/view/elements/EmptyView.js";
8
9
  import ImageView from "../../src/view/elements/image/ImageView.js";
9
- import { EventType } from "../../src/engine/ecs/EntityManager.js";
10
10
 
11
11
  /**
12
12
  *
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.120.2",
8
+ "version": "2.120.3",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * A dynamically resizable bitset (bit array) implementation.
3
+ * The bitset automatically grows and shrinks as bits are set and cleared.
4
+ */
1
5
  export class BitSet {
2
6
  /**
3
7
  *
@@ -6,19 +10,19 @@ export class BitSet {
6
10
  */
7
11
  static fixedSize(x: number): BitSet;
8
12
  /**
9
- * Dynamically sized bit field
10
13
  * @constructor
11
14
  * @param {number} [initial_capacity]
12
15
  */
13
16
  constructor(initial_capacity?: number);
14
17
  /**
15
- * Number of bits currently in use
18
+ * Number of bits currently in use (highest set bit + 1).
16
19
  * @private
17
20
  * @type {number}
18
21
  */
19
22
  private __length;
20
23
  /**
21
24
  * Current capacity in bits, this is at least equal to length
25
+ * Always a multiple of 32.
22
26
  * @private
23
27
  * @type {number}
24
28
  */
@@ -30,90 +34,107 @@ export class BitSet {
30
34
  */
31
35
  private __data_uint32;
32
36
  /**
37
+ * The fraction of capacity at which to trigger a shrink operation.
33
38
  * @type {number}
34
39
  */
35
40
  __shrinkFactor: number;
41
+ /**
42
+ * Prevents the BitSet from shrinking automatically.
43
+ * Useful for fixed-size bitsets.
44
+ * @returns {void}
45
+ */
36
46
  preventShrink(): void;
37
47
  /**
38
48
  *
39
- * @param {number} x
49
+ * @param {number} x The new shrink factor (must be between 0 and 1, inclusive of 0, exclusive of 1).
40
50
  */
41
51
  setShrinkFactor(x: number): void;
42
52
  /**
43
- *
44
- * @param {number} bit_count
53
+ * Sets the capacity of the bitset, ensuring enough space.
54
+ * Does NOT change set bits.
55
+ * @param {number} bit_count The new capacity, in bits.
56
+ * @throws {Error} If the requested capacity is smaller than the current {@link size}.
57
+ * @returns {void}
45
58
  */
46
59
  setCapacity(bit_count: number): void;
47
60
  /**
48
- * Number of bits currently used for flags.
49
- * @returns {number}
61
+ * Returns the number of bits currently "used" by the BitSet.
62
+ * This is equivalent to the index of the highest set bit plus one.
63
+ * @returns {number} The size of the BitSet (in bits).
50
64
  */
51
65
  size(): number;
52
66
  /**
53
- * Number of bits reserved for the field, note that not all of these bits are typically being used.
54
- * @returns {number}
67
+ * Returns the current capacity (allocated bits) of the BitSet.
68
+ * This is always a multiple of 32.
69
+ * @returns {number} The capacity of the BitSet (in bits).
55
70
  */
56
71
  capacity(): number;
57
72
  /**
58
- *
59
- * @param {int} bitCapacity
73
+ * Resizes the internal Uint32Array to the specified capacity.
74
+ * @param {number} bitCapacity New capacity in bits.
60
75
  * @private
61
76
  */
62
77
  private __resize;
63
- __updateLength(): void;
64
78
  /**
65
- *
66
- * @param {int} new_length
79
+ * Updates the internal length of the bitset after clearing bits.
80
+ * @private
81
+ */
82
+ private __updateLength;
83
+ /**
84
+ * Sets the internal length of the BitSet and manages capacity.
85
+ * Grows or shrinks if necessary
86
+ * @param {number} new_length The new length of the BitSet.
67
87
  * @private
68
88
  */
69
89
  private __setLength;
70
90
  /**
71
91
  * Returns the index of the nearest bit that is set to true that occurs on or before the specified starting index
72
- * @param {int} fromIndex
73
- * @returns {int} Index of previous set bit, or -1 if no set bit found
92
+ * @param {number} from_index The index to start searching from (inclusive).
93
+ * @returns {number} Index of previous set bit, or -1 if no set bit found
74
94
  */
75
- previousSetBit(fromIndex: int): int;
95
+ previousSetBit(from_index: number): number;
76
96
  /**
77
97
  * Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
78
- * @param {int} fromIndex
98
+ * @param {number} from_index The index to start searching from (inclusive).
79
99
  * @returns {number} index of the next set bit, or -1 if no bits are set beyond supplied index
80
100
  */
81
- nextSetBit(fromIndex: int): number;
101
+ nextSetBit(from_index: number): number;
82
102
  /**
83
103
  * Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
84
- * @param {int} fromIndex
85
- * @returns {number}
104
+ * @param {number} from_index The index to start searching from (inclusive).
105
+ * @returns {number} Index of the next clear bit (bit set to false), or the current length of BitSet if all the bits are set.
86
106
  */
87
- nextClearBit(fromIndex: int): number;
107
+ nextClearBit(from_index: number): number;
88
108
  /**
89
- *
90
- * @param {int} bit_index
91
- * @param {boolean} value
109
+ * Sets the bit at the specified index to the specified value.
110
+ * @param {number} bit_index The index of the bit to set.
111
+ * @param {boolean} value The value to set the bit to (true for 1, false for 0).
112
+ * @returns {void}
92
113
  */
93
- set(bit_index: int, value: boolean): void;
114
+ set(bit_index: number, value: boolean): void;
94
115
  /**
95
- * Sets the bit specified by the index to false.
96
- * @param {int} bitIndex
116
+ * Sets the bit specified by the index to false (0).
117
+ * @param {number} bit_index The index of the bit to clear.
97
118
  */
98
- clear(bitIndex: int): void;
119
+ clear(bit_index: number): void;
99
120
  /**
100
121
  * Set all bits in a given range
101
- * @param {number} startIndex first bit to be set
102
- * @param {number} endIndex last bit to be set
122
+ * @param {number} start_index first bit to be set (inclusive)
123
+ * @param {number} end_index last bit to be set (inclusive)
103
124
  */
104
- setRange(startIndex: number, endIndex: number): void;
125
+ setRange(start_index: number, end_index: number): void;
105
126
  /**
106
127
  * Clears bit values in a given (inclusive) range
107
- * @param {number} startIndex first bit to be cleared
108
- * @param {number} endIndex clear up to here, excluding this position
128
+ * @param {number} start_index first bit to be cleared (inclusive)
129
+ * @param {number} end_index clear up to here, excluding this position
109
130
  */
110
- clearRange(startIndex: number, endIndex: number): void;
131
+ clearRange(start_index: number, end_index: number): void;
111
132
  /**
112
133
  * Returns the value of the bit with the specified index.
113
- * @param {int} bitIndex
114
- * @returns {boolean}
134
+ * @param {int} bit_index The index of the bit to get.
135
+ * @returns {boolean} The value of the bit (true for 1, false for 0). Returns `false` if `bitIndex` is out of bounds.
115
136
  */
116
- get(bitIndex: int): boolean;
137
+ get(bit_index: int): boolean;
117
138
  /**
118
139
  * Set a bit at the specified index and return its previous value
119
140
  * @param {number} index
@@ -1 +1 @@
1
- {"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"AAgCA;IAiiBI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAQlB;IA3iBD;;;;OAIG;IACH,+BAFW,MAAM,EA8BhB;IAzBG;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,mBAA4C;IAE5C;;;;OAIG;IACH,sBAA0D;IAE1D;;OAEG;IACH,gBAFU,MAAM,CAE2B;IAG/C,sBAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,uBAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAsBC;IAED,uBAMC;IAED;;;;OAIG;IACH,oBAyBC;IAED;;;;OAIG;IACH,0BAHW,GAAG,GACD,GAAG,CAuCf;IAED;;;;OAIG;IACH,sBAHW,GAAG,GACD,MAAM,CAuDlB;IAED;;;;OAIG;IACH,wBAHW,GAAG,GACD,MAAM,CAkDlB;IAED;;;;OAIG;IACH,eAHW,GAAG,SACH,OAAO,QAmCjB;IAED;;;OAGG;IACH,gBAFW,GAAG,QAIb;IAED;;;;OAIG;IACH,qBAHW,MAAM,YACN,MAAM,QAWhB;IAED;;;;OAIG;IACH,uBAHW,MAAM,YACN,MAAM,QAShB;IAED;;;;OAIG;IACH,cAHW,GAAG,GACD,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAQhB;IAED;;OAEG;IACH,cAgBC;IAED;;;OAGG;IACH,YAFW,MAAM,QAoChB;CAcJ"}
1
+ {"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"AAgCA;;;GAGG;AACH;IAkjBI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAQlB;IA3jBD;;;OAGG;IACH,+BAFW,MAAM,EAgChB;IA3BG;;;;OAIG;IACH,iBAAiB;IAEjB;;;;;OAKG;IACH,mBAA4C;IAE5C;;;;OAIG;IACH,sBAA0D;IAE1D;;;OAGG;IACH,gBAFU,MAAM,CAE2B;IAG/C;;;;OAIG;IACH,iBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,mBAFW,MAAM,QAOhB;IACD;;;;;;OAMG;IACH,uBAJW,MAAM,GAEJ,IAAI,CAUhB;IAED;;;;OAIG;IACH,QAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAsBC;IAED;;;OAGG;IACH,uBAMC;IAED;;;;;OAKG;IACH,oBAyBC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAuClB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAuDlB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,MAAM,CAkDlB;IAED;;;;;OAKG;IACH,eAJW,MAAM,SACN,OAAO,GACL,IAAI,CAmChB;IAED;;;OAGG;IACH,iBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,aACN,MAAM,QAWhB;IAED;;;;OAIG;IACH,wBAHW,MAAM,aACN,MAAM,QAShB;IAED;;;;OAIG;IACH,eAHW,GAAG,GACD,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAQhB;IAED;;OAEG;IACH,cAgBC;IAED;;;OAGG;IACH,YAFW,MAAM,QAoChB;CAcJ"}
@@ -30,9 +30,13 @@ const RESIZE_COUNT_THRESHOLD = 128;
30
30
  */
31
31
  const DEFAULT_INITIAL_CAPACITY = 64;
32
32
 
33
+ /**
34
+ * A dynamically resizable bitset (bit array) implementation.
35
+ * The bitset automatically grows and shrinks as bits are set and cleared.
36
+ */
33
37
  export class BitSet {
38
+
34
39
  /**
35
- * Dynamically sized bit field
36
40
  * @constructor
37
41
  * @param {number} [initial_capacity]
38
42
  */
@@ -40,7 +44,7 @@ export class BitSet {
40
44
  assert.isNonNegativeInteger(initial_capacity, 'initial_capacity');
41
45
 
42
46
  /**
43
- * Number of bits currently in use
47
+ * Number of bits currently in use (highest set bit + 1).
44
48
  * @private
45
49
  * @type {number}
46
50
  */
@@ -48,6 +52,7 @@ export class BitSet {
48
52
 
49
53
  /**
50
54
  * Current capacity in bits, this is at least equal to length
55
+ * Always a multiple of 32.
51
56
  * @private
52
57
  * @type {number}
53
58
  */
@@ -61,18 +66,24 @@ export class BitSet {
61
66
  this.__data_uint32 = new Uint32Array(this.__capacity >> 5);
62
67
 
63
68
  /**
69
+ * The fraction of capacity at which to trigger a shrink operation.
64
70
  * @type {number}
65
71
  */
66
72
  this.__shrinkFactor = DEFAULT_SHRINK_FACTOR;
67
73
  }
68
74
 
75
+ /**
76
+ * Prevents the BitSet from shrinking automatically.
77
+ * Useful for fixed-size bitsets.
78
+ * @returns {void}
79
+ */
69
80
  preventShrink() {
70
81
  this.setShrinkFactor(0);
71
82
  }
72
83
 
73
84
  /**
74
85
  *
75
- * @param {number} x
86
+ * @param {number} x The new shrink factor (must be between 0 and 1, inclusive of 0, exclusive of 1).
76
87
  */
77
88
  setShrinkFactor(x) {
78
89
  assert.greaterThanOrEqual(x, 0, 'x >= 0');
@@ -80,10 +91,12 @@ export class BitSet {
80
91
 
81
92
  this.__shrinkFactor = x;
82
93
  }
83
-
84
94
  /**
85
- *
86
- * @param {number} bit_count
95
+ * Sets the capacity of the bitset, ensuring enough space.
96
+ * Does NOT change set bits.
97
+ * @param {number} bit_count The new capacity, in bits.
98
+ * @throws {Error} If the requested capacity is smaller than the current {@link size}.
99
+ * @returns {void}
87
100
  */
88
101
  setCapacity(bit_count) {
89
102
  assert.isNonNegativeInteger(bit_count, "bit_count");
@@ -96,24 +109,26 @@ export class BitSet {
96
109
  }
97
110
 
98
111
  /**
99
- * Number of bits currently used for flags.
100
- * @returns {number}
112
+ * Returns the number of bits currently "used" by the BitSet.
113
+ * This is equivalent to the index of the highest set bit plus one.
114
+ * @returns {number} The size of the BitSet (in bits).
101
115
  */
102
116
  size() {
103
117
  return this.__length;
104
118
  }
105
119
 
106
120
  /**
107
- * Number of bits reserved for the field, note that not all of these bits are typically being used.
108
- * @returns {number}
121
+ * Returns the current capacity (allocated bits) of the BitSet.
122
+ * This is always a multiple of 32.
123
+ * @returns {number} The capacity of the BitSet (in bits).
109
124
  */
110
125
  capacity() {
111
126
  return this.__capacity;
112
127
  }
113
128
 
114
129
  /**
115
- *
116
- * @param {int} bitCapacity
130
+ * Resizes the internal Uint32Array to the specified capacity.
131
+ * @param {number} bitCapacity New capacity in bits.
117
132
  * @private
118
133
  */
119
134
  __resize(bitCapacity) {
@@ -140,6 +155,10 @@ export class BitSet {
140
155
  this.__capacity = uint32_capacity * 32;
141
156
  }
142
157
 
158
+ /**
159
+ * Updates the internal length of the bitset after clearing bits.
160
+ * @private
161
+ */
143
162
  __updateLength() {
144
163
  const found_length = this.previousSetBit(this.__length) + 1;
145
164
 
@@ -149,8 +168,9 @@ export class BitSet {
149
168
  }
150
169
 
151
170
  /**
152
- *
153
- * @param {int} new_length
171
+ * Sets the internal length of the BitSet and manages capacity.
172
+ * Grows or shrinks if necessary
173
+ * @param {number} new_length The new length of the BitSet.
154
174
  * @private
155
175
  */
156
176
  __setLength(new_length) {
@@ -182,13 +202,13 @@ export class BitSet {
182
202
 
183
203
  /**
184
204
  * Returns the index of the nearest bit that is set to true that occurs on or before the specified starting index
185
- * @param {int} fromIndex
186
- * @returns {int} Index of previous set bit, or -1 if no set bit found
205
+ * @param {number} from_index The index to start searching from (inclusive).
206
+ * @returns {number} Index of previous set bit, or -1 if no set bit found
187
207
  */
188
- previousSetBit(fromIndex) {
189
- assert.isNonNegativeInteger(fromIndex, `fromIndex`);
208
+ previousSetBit(from_index) {
209
+ assert.isNonNegativeInteger(from_index, `fromIndex`);
190
210
 
191
- const index = min2(fromIndex, this.__length - 1);
211
+ const index = min2(from_index, this.__length - 1);
192
212
 
193
213
  let word_index = index >> 5;
194
214
  let bit_index = index & 31; // modulo operation is slow, bitwise and is fast, this is the same as %8
@@ -226,26 +246,26 @@ export class BitSet {
226
246
 
227
247
  /**
228
248
  * Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
229
- * @param {int} fromIndex
249
+ * @param {number} from_index The index to start searching from (inclusive).
230
250
  * @returns {number} index of the next set bit, or -1 if no bits are set beyond supplied index
231
251
  */
232
- nextSetBit(fromIndex) {
252
+ nextSetBit(from_index) {
233
253
  // assert.ok(fromIndex >= 0, `fromIndex must be greater or equal to 0, instead was ${fromIndex}`);
234
254
  // assert.ok(Number.isInteger(fromIndex), `fromIndex must be an integer, instead was ${fromIndex}`);
235
255
 
236
256
  const bit_length = this.__length;
237
- if (fromIndex >= bit_length) {
257
+ if (from_index >= bit_length) {
238
258
  //index is out of bounds, return -1
239
259
  return -1;
240
260
  }
241
261
 
242
262
  const data = this.__data_uint32;
243
263
 
244
- let word_index = fromIndex >> 5;
264
+ let word_index = from_index >> 5;
245
265
  let word;
246
266
  let bit_address;
247
267
 
248
- let bit_index = fromIndex & 31;
268
+ let bit_index = from_index & 31;
249
269
 
250
270
  if (bit_index !== 0) {
251
271
  // bit offset boundary in inside the word, we need to mask part of the word
@@ -286,19 +306,19 @@ export class BitSet {
286
306
 
287
307
  /**
288
308
  * Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
289
- * @param {int} fromIndex
290
- * @returns {number}
309
+ * @param {number} from_index The index to start searching from (inclusive).
310
+ * @returns {number} Index of the next clear bit (bit set to false), or the current length of BitSet if all the bits are set.
291
311
  */
292
- nextClearBit(fromIndex) {
312
+ nextClearBit(from_index) {
293
313
  //assert.ok(fromIndex >= 0, `fromIndex must be greater or equal to 0, instead was ${fromIndex}`);
294
314
  //assert.ok(Number.isInteger(fromIndex), `fromIndex must be an integer, instead was ${fromIndex}`);
295
315
 
296
- let word_index = fromIndex >> 5;
316
+ let word_index = from_index >> 5;
297
317
 
298
318
  let word;
299
319
 
300
320
  // treat first word specially, as we may need to mask out portion of a word to skip certain number of bits
301
- let bit_index = fromIndex & 31;
321
+ let bit_index = from_index & 31;
302
322
 
303
323
  const data = this.__data_uint32;
304
324
 
@@ -340,9 +360,10 @@ export class BitSet {
340
360
  }
341
361
 
342
362
  /**
343
- *
344
- * @param {int} bit_index
345
- * @param {boolean} value
363
+ * Sets the bit at the specified index to the specified value.
364
+ * @param {number} bit_index The index of the bit to set.
365
+ * @param {boolean} value The value to set the bit to (true for 1, false for 0).
366
+ * @returns {void}
346
367
  */
347
368
  set(bit_index, value) {
348
369
  assert.isNonNegativeInteger(bit_index, 'bit_index');
@@ -380,24 +401,24 @@ export class BitSet {
380
401
  }
381
402
 
382
403
  /**
383
- * Sets the bit specified by the index to false.
384
- * @param {int} bitIndex
404
+ * Sets the bit specified by the index to false (0).
405
+ * @param {number} bit_index The index of the bit to clear.
385
406
  */
386
- clear(bitIndex) {
387
- this.set(bitIndex, false);
407
+ clear(bit_index) {
408
+ this.set(bit_index, false);
388
409
  }
389
410
 
390
411
  /**
391
412
  * Set all bits in a given range
392
- * @param {number} startIndex first bit to be set
393
- * @param {number} endIndex last bit to be set
413
+ * @param {number} start_index first bit to be set (inclusive)
414
+ * @param {number} end_index last bit to be set (inclusive)
394
415
  */
395
- setRange(startIndex, endIndex) {
396
- assert.greaterThanOrEqual(startIndex, 0, "invalid start index");
397
- assert.greaterThanOrEqual(endIndex, 0, "invalid end index");
416
+ setRange(start_index, end_index) {
417
+ assert.greaterThanOrEqual(start_index, 0, "invalid start index");
418
+ assert.greaterThanOrEqual(end_index, 0, "invalid end index");
398
419
 
399
420
 
400
- for (let i = startIndex; i <= endIndex; i++) {
421
+ for (let i = start_index; i <= end_index; i++) {
401
422
  this.set(i, true);
402
423
  }
403
424
 
@@ -405,33 +426,33 @@ export class BitSet {
405
426
 
406
427
  /**
407
428
  * Clears bit values in a given (inclusive) range
408
- * @param {number} startIndex first bit to be cleared
409
- * @param {number} endIndex clear up to here, excluding this position
429
+ * @param {number} start_index first bit to be cleared (inclusive)
430
+ * @param {number} end_index clear up to here, excluding this position
410
431
  */
411
- clearRange(startIndex, endIndex) {
412
- assert.greaterThanOrEqual(startIndex, 0, "invalid start index");
413
- assert.greaterThanOrEqual(endIndex, 0, "invalid end index");
432
+ clearRange(start_index, end_index) {
433
+ assert.greaterThanOrEqual(start_index, 0, "invalid start index");
434
+ assert.greaterThanOrEqual(end_index, 0, "invalid end index");
414
435
 
415
- for (let i = startIndex; i < endIndex; i++) {
436
+ for (let i = start_index; i < end_index; i++) {
416
437
  this.set(i, false);
417
438
  }
418
439
  }
419
440
 
420
441
  /**
421
442
  * Returns the value of the bit with the specified index.
422
- * @param {int} bitIndex
423
- * @returns {boolean}
443
+ * @param {int} bit_index The index of the bit to get.
444
+ * @returns {boolean} The value of the bit (true for 1, false for 0). Returns `false` if `bitIndex` is out of bounds.
424
445
  */
425
- get(bitIndex) {
426
- assert.isNonNegativeInteger(bitIndex, "bitIndex");
446
+ get(bit_index) {
447
+ assert.isNonNegativeInteger(bit_index, "bitIndex");
427
448
 
428
- if (bitIndex >= this.__length) {
449
+ if (bit_index >= this.__length) {
429
450
  //bit is outside the recorded region
430
451
  return false;
431
452
  }
432
453
 
433
- const byteOffset = bitIndex >> 5;
434
- const bitOffset = bitIndex & 31;
454
+ const byteOffset = bit_index >> 5;
455
+ const bitOffset = bit_index & 31;
435
456
 
436
457
  const word = this.__data_uint32[byteOffset];
437
458
 
@@ -1,6 +1,9 @@
1
1
  /**
2
- * No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
2
+ * No-operation function.
3
+ * Does nothing.
4
+ * Useful when a callback is required to avoid checks for a missing function.
3
5
  * @param {*} arguments
6
+ * @return {void}
4
7
  */
5
8
  export function noop(): void;
6
9
  //# sourceMappingURL=noop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../../../src/core/function/noop.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,6BACC"}
1
+ {"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../../../src/core/function/noop.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAFY,IAAI,CAGf"}
@@ -1,6 +1,9 @@
1
1
  /**
2
- * No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
2
+ * No-operation function.
3
+ * Does nothing.
4
+ * Useful when a callback is required to avoid checks for a missing function.
3
5
  * @param {*} arguments
6
+ * @return {void}
4
7
  */
5
8
  export function noop() {
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Vector4.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector4.js"],"names":[],"mappings":";AAMA;IA2YI;;;;;;OAMG;IACH,gBALW,OAAO,MACP,OAAO,qBAEP,OAAO,QASjB;IAxZD;;;;;;;;OAQG;IACH,4DAOC;IANG,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IAEV,eAA6B;IAOjC;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAVD,SAMW,MAAM,CAJhB;IAcD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAVD,SAMW,MAAM,CAJhB;IAcD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAVD,SAMW,MAAM,CAJhB;IAcD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAVD,SAMW,MAAM,CAJhB;IAUD;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAShB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAOhB;IAED;;;;;;;OAOG;IACH,iDAFa,OAAO,CAkCnB;IAED;;;OAGG;IACH,oBAFW,OAAO,QAQjB;IAED;;;;OAIG;IACH,+BAFa,OAAO,CAOnB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAlBW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAoBnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,SAHW,OAAO,GAAC,OAAO,GACb,OAAO,CASnB;IAED;;;;OAIG;IACH,qBAHW,OAAO,GACL,OAAO,CAUnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,mBAFW,UAAU,QAyBpB;IAED;;;;OAIG;IACH,aAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,QAFY,MAAM,CASjB;IAED;;;;OAIG;IACH,gBAJW,OAAO,MACP,OAAO,mBAKjB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAOlB;IAED;;OAEG;IACH,WAFa,MAAM,EAAE,CAQpB;IAED;;;;OAIG;IACH,mBAHW,MAAM,EAAE,UACR,MAAM,QAIhB;IAED;;;;;MAOC;IAED,0BAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAOtB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAStB;IAED,sDAOC;CAiBJ"}
1
+ {"version":3,"file":"Vector4.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector4.js"],"names":[],"mappings":";AAMA;IAiaI;;;;;;OAMG;IACH,gBALW,OAAO,MACP,OAAO,qBAEP,OAAO,QASjB;IA9aD;;;;;;;;OAQG;IACH,gBAPW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,EAiBhB;IANG,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IAEV,eAA6B;IAWjC;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,SAFa,MAAM,CAIlB;IAkBD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,SAFa,MAAM,CAIlB;IAkBD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,SAFa,MAAM,CAIlB;IAkBD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,SAFa,MAAM,CAIlB;IAUD;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAShB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAOhB;IAED;;;;;;;OAOG;IACH,iDAFa,OAAO,CAkCnB;IAED;;;OAGG;IACH,oBAFW,OAAO,QAQjB;IAED;;;;OAIG;IACH,+BAFa,OAAO,CAOnB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAlBW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAoBnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,SAHW,OAAO,GAAC,OAAO,GACb,OAAO,CASnB;IAED;;;;OAIG;IACH,qBAHW,OAAO,GACL,OAAO,CAUnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,mBAFW,UAAU,QAyBpB;IAED;;;;OAIG;IACH,aAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,QAFY,MAAM,CASjB;IAED;;;;OAIG;IACH,gBAJW,OAAO,MACP,OAAO,mBAKjB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAOlB;IAED;;OAEG;IACH,WAFa,MAAM,EAAE,CAQpB;IAED;;;;OAIG;IACH,mBAHW,MAAM,EAAE,UACR,MAAM,QAIhB;IAED;;;;;MAOC;IAED,0BAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAOtB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAStB;IAED,sDAOC;CAiBJ"}
@@ -7,14 +7,20 @@ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
7
7
  class Vector4 {
8
8
  /**
9
9
  *
10
- * @param {Number} [x=0]
11
- * @param {Number} [y=0]
12
- * @param {Number} [z=0]
13
- * @param {Number} [w=0]
10
+ * @param {number} [x=0]
11
+ * @param {number} [y=0]
12
+ * @param {number} [z=0]
13
+ * @param {number} [w=0]
14
14
  * @constructor
15
15
  * @class
16
16
  */
17
- constructor(x = 0, y = 0, z = 0, w = 0) {
17
+ constructor(
18
+ x = 0,
19
+ y = 0,
20
+ z = 0,
21
+ w = 0
22
+ ) {
23
+
18
24
  this.x = x;
19
25
  this.y = y;
20
26
  this.z = z;
@@ -23,6 +29,10 @@ class Vector4 {
23
29
  this.onChanged = new Signal();
24
30
  }
25
31
 
32
+ /**
33
+ *
34
+ * @returns {number}
35
+ */
26
36
  get 0() {
27
37
  return this.x;
28
38
  }
@@ -35,6 +45,10 @@ class Vector4 {
35
45
  this.x = v;
36
46
  }
37
47
 
48
+ /**
49
+ *
50
+ * @returns {number}
51
+ */
38
52
  get 1() {
39
53
  return this.y;
40
54
  }
@@ -47,6 +61,10 @@ class Vector4 {
47
61
  this.y = v;
48
62
  }
49
63
 
64
+ /**
65
+ *
66
+ * @returns {number}
67
+ */
50
68
  get 2() {
51
69
  return this.z;
52
70
  }
@@ -59,6 +77,10 @@ class Vector4 {
59
77
  this.z = v;
60
78
  }
61
79
 
80
+ /**
81
+ *
82
+ * @returns {number}
83
+ */
62
84
  get 3() {
63
85
  return this.w;
64
86
  }