@woosh/meep-engine 2.113.15 → 2.114.0

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 (30) hide show
  1. package/build/meep.cjs +20 -4
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +20 -4
  4. package/package.json +1 -1
  5. package/src/core/collection/array/array_filter_by_multiple.d.ts +2 -0
  6. package/src/core/collection/array/array_filter_by_multiple.d.ts.map +1 -1
  7. package/src/core/collection/array/array_filter_by_multiple.js +11 -4
  8. package/src/core/collection/array/array_group_by.d.ts +10 -0
  9. package/src/core/collection/array/array_group_by.d.ts.map +1 -0
  10. package/src/core/collection/array/{groupArrayBy.js → array_group_by.js} +3 -3
  11. package/src/core/collection/array/array_sort_quick.d.ts +13 -0
  12. package/src/core/collection/array/array_sort_quick.d.ts.map +1 -0
  13. package/src/core/collection/array/{arrayQuickSort.js → array_sort_quick.js} +5 -1
  14. package/src/core/collection/table/RowFirstTable.d.ts +2 -2
  15. package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
  16. package/src/core/collection/table/RowFirstTable.js +30 -8
  17. package/src/core/color/Color.d.ts +5 -1
  18. package/src/core/color/Color.d.ts.map +1 -1
  19. package/src/core/color/Color.js +16 -2
  20. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  21. package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.js +2 -2
  22. package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.js +2 -2
  23. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  24. package/src/core/collection/array/arrayQuickSort.d.ts +0 -12
  25. package/src/core/collection/array/arrayQuickSort.d.ts.map +0 -1
  26. package/src/core/collection/array/array_remove_element.d.ts +0 -11
  27. package/src/core/collection/array/array_remove_element.d.ts.map +0 -1
  28. package/src/core/collection/array/array_remove_element.js +0 -16
  29. package/src/core/collection/array/groupArrayBy.d.ts +0 -10
  30. package/src/core/collection/array/groupArrayBy.d.ts.map +0 -1
@@ -53731,7 +53731,7 @@ class Color {
53731
53731
  this.b = b;
53732
53732
 
53733
53733
  /**
53734
- * Alpha channel
53734
+ * Alpha channel (transparency)
53735
53735
  * Value from 0 to 1
53736
53736
  * @type {number}
53737
53737
  */
@@ -54228,6 +54228,20 @@ class Color {
54228
54228
  return destination;
54229
54229
  }
54230
54230
 
54231
+ /**
54232
+ *
54233
+ * @param {number[]|Float32Array} source
54234
+ * @param {number} [offset]
54235
+ */
54236
+ fromArray(source, offset = 0) {
54237
+ const r = source[offset + 0];
54238
+ const g = source[offset + 1];
54239
+ const b = source[offset + 2];
54240
+ const a = source[offset + 3];
54241
+
54242
+ this.set(r, g, b, a);
54243
+ }
54244
+
54231
54245
 
54232
54246
  /**
54233
54247
  *
@@ -54343,7 +54357,7 @@ class Color {
54343
54357
  }
54344
54358
 
54345
54359
  /**
54346
- * Shortcut
54360
+ * @deprecated use {@link Color#toArray} instead
54347
54361
  * @readonly
54348
54362
  */
54349
54363
  Color.prototype.writeToArray = Color.prototype.toArray;
@@ -106382,6 +106396,7 @@ function computeBinaryDataTypeByPrecision(type, precision) {
106382
106396
  const stack$1 = [];
106383
106397
 
106384
106398
  /**
106399
+ * Quicksort implementation, instead of compare operator, uses scoring function
106385
106400
  * @template T
106386
106401
  * @param {T[]|ArrayLike<number>|Uint32Array} data
106387
106402
  * @param {function(T):number} score_function
@@ -106391,12 +106406,13 @@ const stack$1 = [];
106391
106406
  * @param {function(T[],number, number):*} [swap_operator]
106392
106407
  * @param {*} [swap_context]
106393
106408
  */
106394
- function arrayQuickSort(
106409
+ function array_sort_quick(
106395
106410
  data,
106396
106411
  score_function, score_function_context,
106397
106412
  start = 0, end = data.length - 1,
106398
106413
  swap_operator = array_swap_one, swap_context = undefined
106399
106414
  ) {
106415
+
106400
106416
  if (start >= end) {
106401
106417
  // section of 0 size, nothing to sort
106402
106418
  return;
@@ -111337,7 +111353,7 @@ class LightManager {
111337
111353
  array_copy(visible_light_set.elements, 0, sorted_lights, 0, visible_light_count);
111338
111354
  array_copy(visible_decal_set.elements, 0, sorted_lights, visible_light_count, visible_decal_count);
111339
111355
 
111340
- arrayQuickSort(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
111356
+ array_sort_quick(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
111341
111357
  }
111342
111358
 
111343
111359
  __update_visible_bvh() {
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.113.15",
8
+ "version": "2.114.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Similar to standard {@link Array.prototype.filter}, but allows multiple filters. They work as an "AND".
3
+ * Useful to save allocations when multiple filters need to be applied, as the {@link Array.prototype.filter} allocates a new array for each call
2
4
  * @template T
3
5
  * @param {T[]} input_items
4
6
  * @param {((T)=>boolean)[]} filters
@@ -1 +1 @@
1
- {"version":3,"file":"array_filter_by_multiple.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_filter_by_multiple.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oFAHiB,OAAO,UAgCvB"}
1
+ {"version":3,"file":"array_filter_by_multiple.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_filter_by_multiple.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oFAHiB,OAAO,UAqCvB"}
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Similar to standard {@link Array.prototype.filter}, but allows multiple filters. They work as an "AND".
3
+ * Useful to save allocations when multiple filters need to be applied, as the {@link Array.prototype.filter} allocates a new array for each call
2
4
  * @template T
3
5
  * @param {T[]} input_items
4
6
  * @param {((T)=>boolean)[]} filters
@@ -13,23 +15,28 @@ export function array_filter_by_multiple(input_items, filters) {
13
15
  return input_items;
14
16
  }
15
17
 
18
+ /**
19
+ *
20
+ * @type {T[]}
21
+ */
16
22
  const filtered = [];
17
23
 
18
24
  const input_item_count = input_items.length;
19
25
 
20
-
21
26
  main_loop:for (let i = 0; i < input_item_count; i++) {
22
- const d = input_items[i];
27
+ const datum = input_items[i];
28
+
23
29
  for (let j = 0; j < filter_count; j++) {
24
30
  const filter = filters[j];
25
31
 
26
- if (filter(d) === false) {
32
+ if (filter(datum) === false) {
33
+ // filter rejected, let's move onto next element
27
34
  continue main_loop;
28
35
  }
29
36
  }
30
37
 
31
38
  // filters passed
32
- filtered.push(d);
39
+ filtered.push(datum);
33
40
  }
34
41
 
35
42
  return filtered;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @template T,K
3
+ * @param {T[]} array
4
+ * @param {function(T):K} grouping_key_producer given an element from input array, returns a grouping key. Can be an object, if it implements .equals method keys can be compared that way as well
5
+ * @param keyHashFunction
6
+ * @returns {Map<K,T[]>}
7
+ */
8
+ export function array_group_by<T, K>(array: T[], grouping_key_producer: (arg0: T) => K, keyHashFunction?: typeof returnZero): Map<K, T[]>;
9
+ import { returnZero } from "../../function/returnZero.js";
10
+ //# sourceMappingURL=array_group_by.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_group_by.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_group_by.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,0IA+BC;2BAzC0B,8BAA8B"}
@@ -4,11 +4,11 @@ import { HashMap } from "../map/HashMap.js";
4
4
  /**
5
5
  * @template T,K
6
6
  * @param {T[]} array
7
- * @param {function(T):K} groupingFunction
7
+ * @param {function(T):K} grouping_key_producer given an element from input array, returns a grouping key. Can be an object, if it implements .equals method keys can be compared that way as well
8
8
  * @param keyHashFunction
9
9
  * @returns {Map<K,T[]>}
10
10
  */
11
- export function groupArrayBy(array, groupingFunction, keyHashFunction = returnZero) {
11
+ export function array_group_by(array, grouping_key_producer, keyHashFunction = returnZero) {
12
12
  const result = new HashMap({
13
13
  keyHashFunction,
14
14
  keyEqualityFunction(a, b) {
@@ -27,7 +27,7 @@ export function groupArrayBy(array, groupingFunction, keyHashFunction = returnZe
27
27
  for (let i = 0; i < array.length; i++) {
28
28
  const element = array[i];
29
29
 
30
- const groupKey = groupingFunction(element);
30
+ const groupKey = grouping_key_producer(element);
31
31
 
32
32
  const group = result.get(groupKey);
33
33
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Quicksort implementation, instead of compare operator, uses scoring function
3
+ * @template T
4
+ * @param {T[]|ArrayLike<number>|Uint32Array} data
5
+ * @param {function(T):number} score_function
6
+ * @param {*} [score_function_context]
7
+ * @param {number} [start]
8
+ * @param {number} [end]
9
+ * @param {function(T[],number, number):*} [swap_operator]
10
+ * @param {*} [swap_context]
11
+ */
12
+ export function array_sort_quick<T>(data: ArrayLike<number> | Uint32Array | T[], score_function: (arg0: T) => number, score_function_context?: any, start?: number, end?: number, swap_operator?: (arg0: T[], arg1: number, arg2: number) => any, swap_context?: any): void;
13
+ //# sourceMappingURL=array_sort_quick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_sort_quick.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_sort_quick.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,8GAPuB,MAAM,wCAElB,MAAM,QACN,MAAM,oCACO,MAAM,QAAE,MAAM,oCAmErC"}
@@ -1,8 +1,10 @@
1
+ import { assert } from "../../assert.js";
1
2
  import { array_swap_one } from "./array_swap_one.js";
2
3
 
3
4
  const stack = [];
4
5
 
5
6
  /**
7
+ * Quicksort implementation, instead of compare operator, uses scoring function
6
8
  * @template T
7
9
  * @param {T[]|ArrayLike<number>|Uint32Array} data
8
10
  * @param {function(T):number} score_function
@@ -12,12 +14,14 @@ const stack = [];
12
14
  * @param {function(T[],number, number):*} [swap_operator]
13
15
  * @param {*} [swap_context]
14
16
  */
15
- export function arrayQuickSort(
17
+ export function array_sort_quick(
16
18
  data,
17
19
  score_function, score_function_context,
18
20
  start = 0, end = data.length - 1,
19
21
  swap_operator = array_swap_one, swap_context = undefined
20
22
  ) {
23
+ assert.isFunction(score_function, 'score_function');
24
+
21
25
  if (start >= end) {
22
26
  // section of 0 size, nothing to sort
23
27
  return;
@@ -85,9 +85,9 @@ export class RowFirstTable {
85
85
  trim(): void;
86
86
  /**
87
87
  *
88
- * @param {number} rowCount
88
+ * @param {number} row_count
89
89
  */
90
- resize(rowCount: number): void;
90
+ resize(row_count: number): void;
91
91
  /**
92
92
  *
93
93
  * @param {number} row_index
@@ -1 +1 @@
1
- {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAaA;;;;GAIG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAiDjB;IAzCG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,MAFU,WAAW,CAE4D;IAEjF;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,UAFU,QAAQ,CAEqB;IAEvC;;;OAGG;IACH,IAFU;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAOxB;IAIL;;;OAGG;IACH,8BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,4BAFqB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAIrD;IAED;;;OAGG;IACH,6BAFqB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAIrD;IAGD;;;;OAIG;IACH,uDAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA+BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAgDhB;IAED;;OAEG;IACH,aAEC;IAED;;;OAGG;IACH,iBAFW,MAAM,QAchB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,gBACN,MAAM,SACN,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,gBACN,MAAM,GACJ,MAAM,CAmBlB;IAED;;;;OAIG;IACH,kBAHW,MAAM,aACN,MAAM,QAyBhB;IAED;;;;;;OAMG;IACH,kBAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;OAKG;IACH,kBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,eAHW,MAAO,MAAM,CAAC,GACZ,MAAM,CAUlB;IAED;;;;OAIG;IACH,eAHW,MAAM,4BA8ChB;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,MAAM,QAwBhB;IAED;;;;OAIG;IACH,YAFW,aAAa,QAmBvB;IAED;;;OAGG;IACH,cAHW,aAAa,GACX,OAAO,CAmCnB;IAED;;;;;OAKG;IACH,eAJW,MAAM,WACN,MAAM,EAAE,GACN,MAAM,EAAE,CAUpB;IAED;;;;OAIG;IACH,gBAHW,MAAM,UACN,MAAM,EAAE,QAUlB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,iBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAetB;IAED;;OAEG;IACH,uBAIC;IAED;;OAEG;IACH,mBAEC;IAGL;;OAEG;IACH,gBAtHe,MAAM,WACN,MAAM,EAAE,KACN,MAAM,EAAE,CAoHK;IAC9B;;OAEG;IACH,gBA1Ge,MAAM,UACN,MAAM,EAAE,UAyGO;CAT7B;mBAtnBkB,+BAA+B"}
1
+ {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAiDjB;IAzCG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,MAFU,WAAW,CAE4D;IAEjF;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CA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,CAIlB;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAetB;IAED;;OAEG;IACH,uBAIC;IAED;;OAEG;IACH,mBAEC;IAGL;;OAEG;IACH,gBAtHe,MAAM,WACN,MAAM,EAAE,KACN,MAAM,EAAE,CAoHK;IAC9B;;OAEG;IACH,gBA1Ge,MAAM,UACN,MAAM,EAAE,UAyGO;CAT7B;mBAhpBkB,+BAA+B"}
@@ -11,8 +11,22 @@ import { array_buffer_copy } from "../array/typed/array_buffer_copy.js";
11
11
  */
12
12
  const DEFAULT_CAPACITY = 8;
13
13
 
14
+ /**
15
+ * Must be greater than 1
16
+ * @type {number}
17
+ */
14
18
  const ALLOCATION_GROW_FACTOR = 1.5;
15
19
 
20
+ /**
21
+ * Minimum number of rows to add when growing
22
+ * @type {number}
23
+ */
24
+ const ALLOCATION_GROW_MINIMUM_STEP = 32;
25
+
26
+ /**
27
+ * Must be less than 1 and greater than 0
28
+ * @type {number}
29
+ */
16
30
  const ALLOCATION_SHRINK_FACTOR = 0.5;
17
31
 
18
32
  /**
@@ -217,18 +231,26 @@ export class RowFirstTable {
217
231
 
218
232
  /**
219
233
  *
220
- * @param {number} rowCount
234
+ * @param {number} row_count
221
235
  */
222
- resize(rowCount) {
223
- assert.isNonNegativeInteger(rowCount, 'rowCount');
236
+ resize(row_count) {
237
+ assert.isNonNegativeInteger(row_count, 'row_count');
238
+
239
+ if (this.capacity < row_count) {
224
240
 
225
- if (this.capacity < rowCount) {
226
241
  //grow
227
- const newSize = Math.ceil(rowCount * ALLOCATION_GROW_FACTOR);
228
- this.setCapacity(newSize);
229
- } else if (this.capacity * ALLOCATION_SHRINK_FACTOR > rowCount) {
242
+ const new_size = Math.max(
243
+ Math.ceil(row_count * ALLOCATION_GROW_FACTOR),
244
+ row_count + ALLOCATION_GROW_MINIMUM_STEP
245
+ );
246
+
247
+ this.setCapacity(new_size);
248
+
249
+ } else if (this.capacity * ALLOCATION_SHRINK_FACTOR > row_count) {
250
+
230
251
  //shrink
231
- this.setCapacity(rowCount);
252
+ this.setCapacity(row_count);
253
+
232
254
  }
233
255
 
234
256
  }
@@ -12,6 +12,8 @@ export class Color {
12
12
 
13
13
  parse(text: string): void
14
14
 
15
+ set(r: number, g: number, b: number, a: number): void;
16
+
15
17
  setRGB(r: number, g: number, b: number): void
16
18
 
17
19
  setA(a: number): void
@@ -42,5 +44,7 @@ export class Color {
42
44
 
43
45
  toJSON(): any
44
46
 
45
- writeToArray(destination: ArrayLike<number>, destination_offset: number): void
47
+ fromArray(source: ArrayLike<number>, destination_offset?: number): void
48
+
49
+ toArray<T extends ArrayLike<number>>(destination?: T, destination_offset?: number): T
46
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../../../src/core/color/Color.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH;IAylBI;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,KAAK,CAIjB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,GACL,KAAK,CAQhB;IAGD;;;;OAIG;IACH,kBAHW,MAAM,GACL,KAAK,CAQhB;IAED;;;;OAIG;IACH,kCAHW,KAAK,UACL,KAAK,QAIf;IAED;;;;OAIG;IACH,kCAHW,KAAK,UACL,KAAK,QAIf;IAhpBD;;;;;;OAMG;IACH,gBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,EAuChB;IA/BG;;;;OAIG;IACH,GAFU,MAAM,CAEN;IACV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IACV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,oBAFU,OAAO,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,CAAC,CAE5C;IAWjC;;;OAGG;IACH,mBAEC;IAdD;;;OAG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AOC;IAED;;;;OAIG;IACH,WAHW,MAAM,GACJ,IAAI,CAYhB;IAED;;;;;OAKG;IACH,cAJW,KAAK,KACL,KAAK,KACL,MAAM,QAOhB;IA6DL;;;OAGG;IACH,sCAnIe,MAAM,EAAE,uBACR,MAAM,KACJ,MAAM,EAAE,CAiIG;IA9IxB,sDAOC;CAiIJ;;aAUS,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;cAMf,SAAS,KAAK,CAAC;gBAMf,SAAS,KAAK,CAAC;cAMf,SAAS,KAAK,CAAC;iBAMf,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;qBAMf,SAAS,KAAK,CAAC;;mBA/tBN,4BAA4B"}
1
+ {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../../../src/core/color/Color.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH;IAumBI;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,KAAK,CAIjB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,GACL,KAAK,CAQhB;IAGD;;;;OAIG;IACH,kBAHW,MAAM,GACL,KAAK,CAQhB;IAED;;;;OAIG;IACH,kCAHW,KAAK,UACL,KAAK,QAIf;IAED;;;;OAIG;IACH,kCAHW,KAAK,UACL,KAAK,QAIf;IA9pBD;;;;;;OAMG;IACH,gBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,EAuChB;IA/BG;;;;OAIG;IACH,GAFU,MAAM,CAEN;IACV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IACV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IAEV;;;;OAIG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,oBAFU,OAAO,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,CAAC,CAE5C;IAWjC;;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ACH,kBAHW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,QAShB;IAGD;;;OAGG;IACH,2CAKC;IAED;;;OAGG;IACH,6CAOC;IAED;;;;OAIG;IACH,WAHW,MAAM,GACJ,IAAI,CAYhB;IAED;;;;;OAKG;IACH,cAJW,KAAK,KACL,KAAK,KACL,MAAM,QAOhB;IA6DL;;;OAGG;IACH,sCAjJe,MAAM,EAAE,uBACR,MAAM,KACJ,MAAM,EAAE,CA+IG;IA5JxB,sDAOC;CA+IJ;;aAUS,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;cAMf,SAAS,KAAK,CAAC;gBAMf,SAAS,KAAK,CAAC;cAMf,SAAS,KAAK,CAAC;iBAMf,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;eAMf,SAAS,KAAK,CAAC;qBAMf,SAAS,KAAK,CAAC;;mBA7uBN,4BAA4B"}
@@ -54,7 +54,7 @@ export class Color {
54
54
  this.b = b;
55
55
 
56
56
  /**
57
- * Alpha channel
57
+ * Alpha channel (transparency)
58
58
  * Value from 0 to 1
59
59
  * @type {number}
60
60
  */
@@ -566,6 +566,20 @@ export class Color {
566
566
  return destination;
567
567
  }
568
568
 
569
+ /**
570
+ *
571
+ * @param {number[]|Float32Array} source
572
+ * @param {number} [offset]
573
+ */
574
+ fromArray(source, offset = 0) {
575
+ const r = source[offset + 0];
576
+ const g = source[offset + 1];
577
+ const b = source[offset + 2];
578
+ const a = source[offset + 3];
579
+
580
+ this.set(r, g, b, a);
581
+ }
582
+
569
583
 
570
584
  /**
571
585
  *
@@ -681,7 +695,7 @@ export class Color {
681
695
  }
682
696
 
683
697
  /**
684
- * Shortcut
698
+ * @deprecated use {@link Color#toArray} instead
685
699
  * @readonly
686
700
  */
687
701
  Color.prototype.writeToArray = Color.prototype.toArray;
@@ -23,8 +23,8 @@ import {
23
23
  bvh_query_user_data_overlaps_frustum
24
24
  } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
25
25
  import { array_copy } from "../../../../core/collection/array/array_copy.js";
26
+ import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
26
27
  import { array_swap_one } from "../../../../core/collection/array/array_swap_one.js";
27
- import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
28
28
  import { read_cluster_frustum_corners } from "../../../../core/geom/3d/frustum/read_cluster_frustum_corners.js";
29
29
  import { read_three_planes_to_array } from "../../../../core/geom/3d/frustum/read_three_planes_to_array.js";
30
30
  import { slice_frustum_linear_to_points } from "../../../../core/geom/3d/frustum/slice_frustum_linear_to_points.js";
@@ -680,7 +680,7 @@ export class LightManager {
680
680
  array_copy(visible_light_set.elements, 0, sorted_lights, 0, visible_light_count);
681
681
  array_copy(visible_decal_set.elements, 0, sorted_lights, visible_light_count, visible_decal_count);
682
682
 
683
- arrayQuickSort(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
683
+ array_sort_quick(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
684
684
  }
685
685
 
686
686
  __update_visible_bvh() {
@@ -1,5 +1,5 @@
1
1
  import { ELEMENT_WORD_COUNT } from "../../../../../core/bvh2/bvh3/BVH.js";
2
- import { arrayQuickSort } from "../../../../../core/collection/array/arrayQuickSort.js";
2
+ import { array_sort_quick } from "../../../../../core/collection/array/array_sort_quick.js";
3
3
  import {
4
4
  aabb3_unsigned_distance_sqr_to_point
5
5
  } from "../../../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
@@ -28,7 +28,7 @@ export function sort_bvh_nodes_by_distance_to_point(
28
28
  For performance, we bind data directly to avoid extra copies required to read out AABB
29
29
  */
30
30
  const float32 = bvh.__data_float32;
31
- arrayQuickSort(node_list, (node) => {
31
+ array_sort_quick(node_list, (node) => {
32
32
  const address = node * ELEMENT_WORD_COUNT;
33
33
 
34
34
  const aabb_distance_sqr = aabb3_unsigned_distance_sqr_to_point(
@@ -1,5 +1,5 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
- import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
2
+ import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
3
3
  import Signal from "../../../../core/events/signal/Signal.js";
4
4
  import { AssetManager } from "../../../asset/AssetManager.js";
5
5
  import { GameAssetType } from "../../../asset/GameAssetType.js";
@@ -142,7 +142,7 @@ export class VirtualTextureTileLoader {
142
142
  */
143
143
  const score = (fingerprint) => -usage.getCountByFingerprint(fingerprint);
144
144
 
145
- arrayQuickSort(
145
+ array_sort_quick(
146
146
  this.#queue,
147
147
  score, null,
148
148
  0, this.#queue.length - 1
@@ -2,7 +2,7 @@ import { GridTags } from "../../../../../samples/generation/grid/GridTags.js";
2
2
  import { MirGridLayers } from "../../../../../samples/generation/grid/MirGridLayers.js";
3
3
  import { matcher_tag_traversable } from "../../../../../samples/generation/rules/matcher_tag_traversable.js";
4
4
  import { BitSet } from "../../../../core/binary/BitSet.js";
5
- import { groupArrayBy } from "../../../../core/collection/array/groupArrayBy.js";
5
+ import { array_group_by } from "../../../../core/collection/array/array_group_by.js";
6
6
  import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
7
7
  import BinaryHeap from "../../../../core/collection/heap/BinaryHeap.js";
8
8
  import { QuadTreeNode } from "../../../../core/geom/2d/quad-tree/QuadTreeNode.js";
@@ -169,7 +169,7 @@ function buildPaths(
169
169
  const tBuildNodeGroups = actionTask(() => {
170
170
 
171
171
  //group nodes
172
- const groupMap = groupArrayBy(nodes, readMarkerNodeGroupId);
172
+ const groupMap = array_group_by(nodes, readMarkerNodeGroupId);
173
173
 
174
174
  /**
175
175
  *
@@ -1,12 +0,0 @@
1
- /**
2
- * @template T
3
- * @param {T[]|ArrayLike<number>|Uint32Array} data
4
- * @param {function(T):number} score_function
5
- * @param {*} [score_function_context]
6
- * @param {number} [start]
7
- * @param {number} [end]
8
- * @param {function(T[],number, number):*} [swap_operator]
9
- * @param {*} [swap_context]
10
- */
11
- export function arrayQuickSort<T>(data: ArrayLike<number> | Uint32Array | T[], score_function: (arg0: T) => number, score_function_context?: any, start?: number, end?: number, swap_operator?: (arg0: T[], arg1: number, arg2: number) => any, swap_context?: any): void;
12
- //# sourceMappingURL=arrayQuickSort.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayQuickSort.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayQuickSort.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,4GAPuB,MAAM,wCAElB,MAAM,QACN,MAAM,oCACO,MAAM,QAAE,MAAM,oCAiErC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * @deprecated
3
- * @template T
4
- * @param {T[]} array
5
- * @param {number} start_index
6
- * @param {number} end_index
7
- * @param {T} element
8
- * @return {boolean}
9
- */
10
- export function array_remove_element<T>(array: T[], start_index: number, end_index: number, element: T): boolean;
11
- //# sourceMappingURL=array_remove_element.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array_remove_element.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_remove_element.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,iEALW,MAAM,aACN,MAAM,eAEL,OAAO,CAMlB"}
@@ -1,16 +0,0 @@
1
- import { array_remove_first } from "./array_remove_first.js";
2
-
3
- /**
4
- * @deprecated
5
- * @template T
6
- * @param {T[]} array
7
- * @param {number} start_index
8
- * @param {number} end_index
9
- * @param {T} element
10
- * @return {boolean}
11
- */
12
- export function array_remove_element(array, start_index, end_index, element) {
13
- console.warn('deprecated, use array_remove_first instead');
14
-
15
- array_remove_first(array, element, start_index, end_index - start_index);
16
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @template T,K
3
- * @param {T[]} array
4
- * @param {function(T):K} groupingFunction
5
- * @param keyHashFunction
6
- * @returns {Map<K,T[]>}
7
- */
8
- export function groupArrayBy<T, K>(array: T[], groupingFunction: (arg0: T) => K, keyHashFunction?: typeof returnZero): Map<K, T[]>;
9
- import { returnZero } from "../../function/returnZero.js";
10
- //# sourceMappingURL=groupArrayBy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupArrayBy.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/groupArrayBy.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,mIA+BC;2BAzC0B,8BAA8B"}