@woosh/meep-engine 2.109.24 → 2.109.25

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 (47) hide show
  1. package/build/meep.cjs +231 -104
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +231 -104
  4. package/package.json +1 -1
  5. package/src/core/collection/heap/FastBinaryHeap.d.ts +17 -10
  6. package/src/core/collection/heap/FastBinaryHeap.d.ts.map +1 -1
  7. package/src/core/collection/heap/FastBinaryHeap.js +33 -23
  8. package/src/core/collection/heap/FastBinaryHeap.spec.js +10 -10
  9. package/src/core/collection/table/RowFirstTable.d.ts +10 -7
  10. package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
  11. package/src/core/collection/table/RowFirstTable.js +23 -6
  12. package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +2 -2
  13. package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +2 -2
  14. package/src/engine/animation/async/TimeSeries.d.ts.map +1 -1
  15. package/src/engine/animation/async/TimeSeries.js +6 -2
  16. package/src/engine/animation/async/table_find_min_index_in_ordered_column.d.ts +9 -0
  17. package/src/engine/animation/async/table_find_min_index_in_ordered_column.d.ts.map +1 -0
  18. package/src/engine/animation/async/{findSampleIndex.js → table_find_min_index_in_ordered_column.js} +5 -4
  19. package/src/engine/asset/AssetManager.js +1 -1
  20. package/src/engine/graphics/sh3/gi/material/common.glsl +1 -1
  21. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +1 -1
  22. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
  23. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +5 -0
  24. package/src/engine/graphics/sh3/prototypeSH3Probe.js +2 -2
  25. package/src/engine/input/devices/InputDeviceSwitch.d.ts.map +1 -1
  26. package/src/engine/input/devices/InputDeviceSwitch.js +18 -0
  27. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  28. package/src/engine/input/devices/KeyboardDevice.js +4 -41
  29. package/src/engine/input/devices/LocationalInteractionMetadata.d.ts +11 -0
  30. package/src/engine/input/devices/LocationalInteractionMetadata.d.ts.map +1 -0
  31. package/src/engine/input/devices/LocationalInteractionMetadata.js +18 -0
  32. package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
  33. package/src/engine/input/devices/PointerDevice.js +90 -37
  34. package/src/engine/input/devices/eventToSourceIdentifier.d.ts +7 -0
  35. package/src/engine/input/devices/eventToSourceIdentifier.d.ts.map +1 -0
  36. package/src/engine/input/devices/eventToSourceIdentifier.js +36 -0
  37. package/src/engine/input/devices/isHTMLElementFocusable.d.ts +6 -0
  38. package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -0
  39. package/src/engine/input/devices/isHTMLElementFocusable.js +34 -0
  40. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +3 -3
  41. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
  42. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +5 -5
  43. package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.d.ts.map +1 -1
  44. package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +3 -3
  45. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  46. package/src/engine/animation/async/findSampleIndex.d.ts +0 -9
  47. package/src/engine/animation/async/findSampleIndex.d.ts.map +0 -1
@@ -2,20 +2,20 @@ import { passThrough } from "../../function/passThrough.js";
2
2
  import { returnZero } from "../../function/returnZero.js";
3
3
  import { randomIntegerBetween } from "../../math/random/randomIntegerBetween.js";
4
4
  import { seededRandom } from "../../math/random/seededRandom.js";
5
- import BinaryHeap from "./FastBinaryHeap.js";
5
+ import FastBinaryHeap from "./FastBinaryHeap.js";
6
6
 
7
7
  test("constructor doesn't throw", () => {
8
- new BinaryHeap(returnZero);
8
+ new FastBinaryHeap(returnZero);
9
9
  });
10
10
 
11
11
  test("empty heap has size 0", () => {
12
- const h = new BinaryHeap(returnZero);
12
+ const h = new FastBinaryHeap(returnZero);
13
13
 
14
14
  expect(h.size()).toBe(0);
15
15
  });
16
16
 
17
17
  test('clear empty', () => {
18
- const h = new BinaryHeap(returnZero);
18
+ const h = new FastBinaryHeap(returnZero);
19
19
 
20
20
  h.clear();
21
21
 
@@ -24,7 +24,7 @@ test('clear empty', () => {
24
24
  });
25
25
 
26
26
  test('clear heap with 1 element', () => {
27
- const h = new BinaryHeap(returnZero);
27
+ const h = new FastBinaryHeap(returnZero);
28
28
 
29
29
  h.push(1);
30
30
 
@@ -35,7 +35,7 @@ test('clear heap with 1 element', () => {
35
35
  });
36
36
 
37
37
  test("isEmpty", () => {
38
- const h = new BinaryHeap(returnZero);
38
+ const h = new FastBinaryHeap(returnZero);
39
39
 
40
40
  expect(h.isEmpty()).toBe(true);
41
41
 
@@ -49,7 +49,7 @@ test("isEmpty", () => {
49
49
  });
50
50
 
51
51
  test("push followed by a pop", () => {
52
- const h = new BinaryHeap(returnZero);
52
+ const h = new FastBinaryHeap(returnZero);
53
53
 
54
54
  h.push(7);
55
55
 
@@ -63,7 +63,7 @@ test("push followed by a pop", () => {
63
63
  });
64
64
 
65
65
  test("contains method", () => {
66
- const h = new BinaryHeap(returnZero);
66
+ const h = new FastBinaryHeap(returnZero);
67
67
 
68
68
  expect(h.contains(7)).toBe(false);
69
69
 
@@ -82,7 +82,7 @@ test("contains method", () => {
82
82
  });
83
83
 
84
84
  test("correct sorting of 4 numbers", () => {
85
- const h = new BinaryHeap(passThrough);
85
+ const h = new FastBinaryHeap(passThrough);
86
86
 
87
87
  const input = [2, 7, 1, 5];
88
88
 
@@ -100,7 +100,7 @@ test("correct sorting of 4 numbers", () => {
100
100
  });
101
101
 
102
102
  test.skip("performance 100k random fill -> drain", () => {
103
- const h = new BinaryHeap(passThrough);
103
+ const h = new FastBinaryHeap(passThrough);
104
104
 
105
105
  const random = seededRandom(42);
106
106
 
@@ -1,7 +1,10 @@
1
+ /**
2
+ * Compact binary table storage
3
+ */
1
4
  export class RowFirstTable {
2
5
  /**
3
6
  *
4
- * @param {RowFirstTableSpec} spec
7
+ * @param {RowFirstTableSpec} spec what does the schema look like? How many columns do we have and what are their types?
5
8
  * @param {boolean} [shared_array] should we use SharedArrayBuffer instead of ArrayBuffer?
6
9
  * @constructor
7
10
  */
@@ -71,9 +74,9 @@ export class RowFirstTable {
71
74
  hash(): number;
72
75
  /**
73
76
  *
74
- * @param {int} rowCount
77
+ * @param {number} rowCount
75
78
  */
76
- setCapacity(rowCount: int): void;
79
+ setCapacity(rowCount: number): void;
77
80
  /**
78
81
  * Drop excess capacity, setting capacity exactly to the current length
79
82
  */
@@ -112,15 +115,15 @@ export class RowFirstTable {
112
115
  insertRows(index: number, rowCount: number): void;
113
116
  /**
114
117
  *
115
- * @param {Array.<Number>} values
118
+ * @param {Array.<number>} values
116
119
  */
117
120
  addRow(values: Array<number>): void;
118
121
  /**
119
122
  *
120
- * @param {int} count number of rows to be added
121
- * @param {function} valueSupplier supplier of row values, called with row index and an empty row to be filled
123
+ * @param {number} count number of rows to be added
124
+ * @param {function(row_index:number, row:Array.<number>):*} valueSupplier supplier of row values, called with row index and an empty row to be filled
122
125
  */
123
- addRows(count: int, valueSupplier: Function): void;
126
+ addRows(count: number, valueSupplier: any): void;
124
127
  /**
125
128
  * Copy data from another table. Specs must match.
126
129
  * NOTE: does not send onAdded signal
@@ -1 +1 @@
1
- {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAMA;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAuDjB;IA/CG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,gBAFU,qBAAsB,CAET;IAEvB;;;OAGG;IACH,MAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,gBAFU,MAAM,CAEyB;IAEzC;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,UAFU,QAAQ,CAEE;IAEpB;;MAEC;IAKL;;OAEG;IACH,mBAiBC;IAXG;;;OAGG;IACH,sBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEb;IAEvC;;;OAGG;IACH,uBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEX;IAG7C;;;;OAIG;IACH,uDAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA4BlB;IAED;;;OAGG;IACH,iCAoCC;IAED;;OAEG;IACH,aAEC;IAED;;;OAGG;IACH,iBAFW,MAAM,QAYhB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,eACN,MAAM,SACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAclB;IAED;;;;OAIG;IACH,kBAHW,MAAM,YACN,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,YACN,MAAM,QAqBhB;IAED;;;OAGG;IACH,eAFW,aAAc,QAgBxB;IAED;;;;OAIG;IACH,mDAiCC;IAED;;;;OAIG;IACH,YAFW,aAAa,QAsBvB;IAED;;;OAGG;IACH,cAHW,aAAa,GACX,OAAO,CAyBnB;IAED;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,EAAE,QAIlB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,wBAEC;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAgBtB;IAED;;OAEG;IACH,uBAIC;CACJ;mBA1fkB,+BAA+B"}
1
+ {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAuDjB;IA/CG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,gBAFU,qBAAsB,CAET;IAEvB;;;OAGG;IACH,MAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,gBAFU,MAAM,CAEyB;IAEzC;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,UAFU,QAAQ,CAEE;IAEpB;;MAEC;IAKL;;OAEG;IACH,mBAiBC;IAXG;;;OAGG;IACH,sBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEb;IAEvC;;;OAGG;IACH,uBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEX;IAG7C;;;;OAIG;IACH,uDAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA4BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QA+ChB;IAED;;OAEG;IACH,aAEC;IAED;;;OAGG;IACH,iBAFW,MAAM,QAchB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,eACN,MAAM,SACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAclB;IAED;;;;OAIG;IACH,kBAHW,MAAM,YACN,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,YACN,MAAM,QAqBhB;IAED;;;OAGG;IACH,eAFW,MAAO,MAAM,CAAC,QAexB;IAED;;;;OAIG;IACH,eAHW,MAAM,4BAoChB;IAED;;;;OAIG;IACH,YAFW,aAAa,QAsBvB;IAED;;;OAGG;IACH,cAHW,aAAa,GACX,OAAO,CAyBnB;IAED;;;;OAIG;IACH,wCAIC;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,EAAE,QAMlB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,wBAEC;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAgBtB;IAED;;OAEG;IACH,uBAIC;CACJ;mBA3gBkB,+BAA+B"}
@@ -4,10 +4,13 @@ import Signal from "../../events/signal/Signal.js";
4
4
  import { max2 } from "../../math/max2.js";
5
5
  import { array_copy } from "../array/array_copy.js";
6
6
 
7
+ /**
8
+ * Compact binary table storage
9
+ */
7
10
  export class RowFirstTable {
8
11
  /**
9
12
  *
10
- * @param {RowFirstTableSpec} spec
13
+ * @param {RowFirstTableSpec} spec what does the schema look like? How many columns do we have and what are their types?
11
14
  * @param {boolean} [shared_array] should we use SharedArrayBuffer instead of ArrayBuffer?
12
15
  * @constructor
13
16
  */
@@ -134,13 +137,22 @@ export class RowFirstTable {
134
137
 
135
138
  /**
136
139
  *
137
- * @param {int} rowCount
140
+ * @param {number} rowCount
138
141
  */
139
142
  setCapacity(rowCount) {
143
+ assert.isNonNegativeInteger(rowCount, 'rowCount');
144
+
145
+ if(this.capacity === rowCount){
146
+ // already right size
147
+ return;
148
+ }
149
+
150
+
140
151
  const oldData = this.data;
141
152
 
142
153
  const bytesPerRecord = this.bytesPerRecord;
143
154
  const byteSize = rowCount * bytesPerRecord;
155
+
144
156
  try {
145
157
  // can be either ArrayBuffer or SharedArrayBuffer
146
158
  const BufferConstructor = this.data.constructor;
@@ -186,6 +198,8 @@ export class RowFirstTable {
186
198
  * @param {number} rowCount
187
199
  */
188
200
  resize(rowCount) {
201
+ assert.isNonNegativeInteger(rowCount, 'rowCount');
202
+
189
203
  if (this.capacity < rowCount) {
190
204
  //grow
191
205
  const growFactor = 1.5;
@@ -296,7 +310,7 @@ export class RowFirstTable {
296
310
 
297
311
  /**
298
312
  *
299
- * @param {Array.<Number>} values
313
+ * @param {Array.<number>} values
300
314
  */
301
315
  addRow(values) {
302
316
 
@@ -308,7 +322,6 @@ export class RowFirstTable {
308
322
 
309
323
  this.length = newRowCount;
310
324
 
311
-
312
325
  this.writeRowMethod(this.dataView, this.bytesPerRecord * rowIndex, values);
313
326
 
314
327
  this.on.added.send2(rowIndex, values);
@@ -316,8 +329,8 @@ export class RowFirstTable {
316
329
 
317
330
  /**
318
331
  *
319
- * @param {int} count number of rows to be added
320
- * @param {function} valueSupplier supplier of row values, called with row index and an empty row to be filled
332
+ * @param {number} count number of rows to be added
333
+ * @param {function(row_index:number, row:Array.<number>):*} valueSupplier supplier of row values, called with row index and an empty row to be filled
321
334
  */
322
335
  addRows(count, valueSupplier) {
323
336
  const newRowCount = this.length + count;
@@ -416,6 +429,8 @@ export class RowFirstTable {
416
429
  * @param {Array} result where row values are to be stored
417
430
  */
418
431
  getRow(index, result) {
432
+ assert.isNonNegativeInteger(index,'index');
433
+
419
434
  this.readRowMethod(this.dataView, this.bytesPerRecord * index, result);
420
435
  }
421
436
 
@@ -425,6 +440,8 @@ export class RowFirstTable {
425
440
  * @param {number[]} record
426
441
  */
427
442
  setRow(index, record) {
443
+ assert.isNonNegativeInteger(index,'index');
444
+
428
445
  this.writeRowMethod(this.dataView, this.bytesPerRecord * index, record);
429
446
  }
430
447
 
@@ -23,10 +23,10 @@ export function encode_unit_to_octahedron(
23
23
  const inverse_sum = 1 / abs_sum;
24
24
 
25
25
  let p_x = x * inverse_sum;
26
- let p_y = y * inverse_sum;
26
+ let p_y = z * inverse_sum;
27
27
 
28
28
  // Reflect the folds of the lower hemisphere over the diagonals
29
- if (z < 0) {
29
+ if (y < 0) {
30
30
  const abs_x = Math.abs(p_x);
31
31
  const abs_y = Math.abs(p_y);
32
32
 
@@ -1,5 +1,5 @@
1
1
  import { assert } from "../../../assert.js";
2
- import BinaryHeap from "../../../collection/heap/FastBinaryHeap.js";
2
+ import FastBinaryHeap from "../../../collection/heap/FastBinaryHeap.js";
3
3
  import AABB2 from "../../2d/aabb/AABB2.js";
4
4
  import { QuadTreeDatum } from "../../2d/quad-tree/QuadTreeDatum.js";
5
5
  import { QuadTreeNode } from "../../2d/quad-tree/QuadTreeNode.js";
@@ -136,7 +136,7 @@ export class MaxRectanglesPacker {
136
136
  return -Math.min(box.getWidth(), box.getHeight());
137
137
  }
138
138
 
139
- const heap = new BinaryHeap(scoreBoxByMinSide);
139
+ const heap = new FastBinaryHeap(scoreBoxByMinSide);
140
140
 
141
141
  for (let i = 0; i < numBoxes; i++) {
142
142
  heap.push(i);
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeries.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/async/TimeSeries.js"],"names":[],"mappings":"AAaA;;GAEG;AACH;IA+BI;;;;OAIG;IACH,4CAFW,MAAM,EAuChB;IAxED;;OAEG;IACH,MAFU,iBAAiB,CAEvB;IAEJ;;OAEG;IACH,OAFU,aAAa,CAElB;IAEL,0BAAsB;IAyHtB;;;;OAIG;IACH,8BAHW,MAAM,OAOhB;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,6BAWC;IAED,oCAcC;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAQlB;IAED;;;OAGG;IACH,mCAIC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,SACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,+BAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,EAAE,iBACR,MAAM,QACN,MAAM,QAuBhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,OAShB;;CAEJ;kCAzRiC,qDAAqD;8BADzD,iDAAiD"}
1
+ {"version":3,"file":"TimeSeries.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/async/TimeSeries.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH;IA+BI;;;;OAIG;IACH,4CAFW,MAAM,EAuChB;IAxED;;OAEG;IACH,MAFU,iBAAiB,CAEvB;IAEJ;;OAEG;IACH,OAFU,aAAa,CAElB;IAEL,0BAAsB;IAyHtB;;;;OAIG;IACH,8BAHW,MAAM,OAOhB;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,6BAWC;IAED,oCAcC;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAQlB;IAED;;;OAGG;IACH,mCAIC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,SACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,+BAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,EAAE,iBACR,MAAM,QACN,MAAM,QAuBhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,OAShB;;CAEJ;kCA7RiC,qDAAqD;8BADzD,iDAAiD"}
@@ -7,8 +7,12 @@ import { lerp } from "../../../core/math/lerp.js";
7
7
  import { max2 } from "../../../core/math/max2.js";
8
8
  import { min2 } from "../../../core/math/min2.js";
9
9
  import { validate_enum_schema } from "../../../core/model/validate_enum_schema.js";
10
- import { findSampleIndex } from "./findSampleIndex.js";
10
+ import { table_find_min_index_in_ordered_column } from "./table_find_min_index_in_ordered_column.js";
11
11
 
12
+ /**
13
+ *
14
+ * @type {number[]}
15
+ */
12
16
  const scratch_row = [];
13
17
 
14
18
  /**
@@ -237,7 +241,7 @@ export class TimeSeries {
237
241
  findLowSampleIndexByTime(time) {
238
242
  const table = this.table;
239
243
  const time_column_index = this.time_column_index;
240
- return max2(0, findSampleIndex(table, time, time_column_index))
244
+ return max2(0, table_find_min_index_in_ordered_column(table, time, time_column_index))
241
245
  }
242
246
 
243
247
  /**
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Given a column of ordered values in increasing order, returns low index of matching value
3
+ * @param {RowFirstTable} table
4
+ * @param {number} time
5
+ * @param {number} [column_index]
6
+ * @return {number}
7
+ */
8
+ export function table_find_min_index_in_ordered_column(table: RowFirstTable, time: number, column_index?: number): number;
9
+ //# sourceMappingURL=table_find_min_index_in_ordered_column.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table_find_min_index_in_ordered_column.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/async/table_find_min_index_in_ordered_column.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,mFAJW,MAAM,iBACN,MAAM,GACL,MAAM,CAwBjB"}
@@ -1,19 +1,20 @@
1
1
  import { min2 } from "../../../core/math/min2.js";
2
2
 
3
3
  /**
4
- *
4
+ * Given a column of ordered values in increasing order, returns low index of matching value
5
5
  * @param {RowFirstTable} table
6
6
  * @param {number} time
7
7
  * @param {number} [column_index]
8
8
  * @return {number}
9
9
  */
10
- export function findSampleIndex(table, time, column_index = 0) {
10
+ export function table_find_min_index_in_ordered_column(table, time, column_index = 0) {
11
11
  let minIndex = 0;
12
12
  let maxIndex = table.length - 1;
13
13
 
14
14
  while (minIndex <= maxIndex) {
15
15
 
16
- const pivotIndex = (minIndex + maxIndex) >> 1;
16
+ // low midpoint, this is essentially Math.floor( (minIndex + maxIndex) / 2 )
17
+ const pivotIndex = (minIndex + maxIndex) >>> 1;
17
18
 
18
19
  const cmp = time - table.readCellValue(pivotIndex, column_index);
19
20
 
@@ -22,7 +23,7 @@ export function findSampleIndex(table, time, column_index = 0) {
22
23
  } else if (cmp < 0) {
23
24
  maxIndex = pivotIndex - 1;
24
25
  } else {
25
- //set low boundary for next step based on assumption that upper bound is higher than lower bound
26
+ // exactly on the pivot sample
26
27
  return pivotIndex;
27
28
  }
28
29
  }
@@ -33,7 +33,7 @@ class Response {
33
33
  }
34
34
 
35
35
  /**
36
- * Used by the priority queue, so the priority is inverted as the BinaryHeap returns elements in ascending score order (from lowest)
36
+ * Used by the priority queue, so the priority is inverted as the FastBinaryHeap returns elements in ascending score order (from lowest)
37
37
  * @param {PendingAsset} pending_asset
38
38
  * @returns {number}
39
39
  */
@@ -362,7 +362,7 @@ float lpv_probe_getVisibilityMask(vec3 position, uint probe_index) {
362
362
  float chebyshevWeight = variance / (variance + distance_delta * distance_delta);
363
363
 
364
364
  // Increase contrast in the weight
365
- // chebyshevWeight = max(chebyshevWeight * chebyshevWeight * chebyshevWeight, 0.0);
365
+ chebyshevWeight = max(chebyshevWeight * chebyshevWeight * chebyshevWeight, 0.0);
366
366
 
367
367
  return (distToProbe <= mean) ? 1.0 : chebyshevWeight;
368
368
  }
@@ -35,7 +35,7 @@ export class LightProbeVolume {
35
35
  * Depth map is stored as a 2d texture of size RESOLUTION x RESOLUTION
36
36
  * @type {number}
37
37
  */
38
- #probe_depth_resolution = 16;
38
+ #probe_depth_resolution = 64;
39
39
 
40
40
  /**
41
41
  * Octahedral-encoded depth map for each probe
@@ -1 +1 @@
1
- {"version":3,"file":"bake_octahedral_depth_map.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js"],"names":[],"mappings":"AAiCA;;;;;;;;;GASG;AACH,kDARW,MAAM,EAAE,iBACR,MAAM,oCAEN,MAAM,EAAE,UAAQ,mBAChB,MAAM,cACN,MAAM,aACN,MAAM,QAuHhB"}
1
+ {"version":3,"file":"bake_octahedral_depth_map.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js"],"names":[],"mappings":"AAiCA;;;;;;;;;GASG;AACH,kDARW,MAAM,EAAE,iBACR,MAAM,oCAEN,MAAM,EAAE,UAAQ,mBAChB,MAAM,cACN,MAAM,aACN,MAAM,QA4HhB"}
@@ -92,6 +92,11 @@ export function bake_octahedral_depth_map(
92
92
  const u = (oct_x + 0.5) / (resolution);
93
93
  const v = (oct_y + 0.5) / (resolution);
94
94
 
95
+ decode_octahedron_to_unit(
96
+ probe_direction, 0,
97
+ u * 2 - 1, v * 2 - 1
98
+ );
99
+
95
100
  for (let sub_sample_index = 0; sub_sample_index < SUB_SAMPLE_COUNT; sub_sample_index++) {
96
101
 
97
102
  const sample_index2 = sub_sample_index * 2;
@@ -383,13 +383,13 @@ async function main(engine) {
383
383
  // const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
384
384
  // const path = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
385
385
  // const path = 'data/models/sibenik/3-window-less/model.gltf';
386
- const path = 'data/models/sponza-pbr/gltf/sponza.glb';
386
+ // const path = 'data/models/sponza-pbr/gltf/sponza.glb';
387
387
  // const path = 'data/models/samples/susanne.glb';
388
388
  // const path = 'data/models/samples/teapot.gltf';
389
389
  // const path = 'data/models/samples/salle_de_bain/model.glb';
390
390
  // const path = 'data/models/samples/conference/model-no-curtains.glb';
391
391
  // const path = 'data/models/pica_pica/pica_pica.gltf';
392
- // const path = 'data/models/samples/gi_box_01/model.glb';
392
+ const path = 'data/models/samples/gi_box_01/model.glb';
393
393
  // const path = 'data/models/samples/low_poly_classroom/no-glass/model.gltf';
394
394
 
395
395
  const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
@@ -1 +1 @@
1
- {"version":3,"file":"InputDeviceSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/InputDeviceSwitch.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI;;;OAGG;IACH,MAFU,MAAM,CAEG;IACnB;;;OAGG;IACH,IAFU,MAAM,CAEC;IACjB;;;OAGG;IACH,SAFU,OAAO,CAEF;CAClB;mBArBkB,uCAAuC"}
1
+ {"version":3,"file":"InputDeviceSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/InputDeviceSwitch.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI;;;OAGG;IACH,MAFU,MAAM,CAEG;IACnB;;;OAGG;IACH,IAFU,MAAM,CAEC;IACjB;;;OAGG;IACH,SAFU,OAAO,CAEF;IAEf,cAOC;IAED,gBAOC;CACJ;mBAvCkB,uCAAuC"}
@@ -19,4 +19,22 @@ export class InputDeviceSwitch {
19
19
  * @type {boolean}
20
20
  */
21
21
  is_down = false
22
+
23
+ press() {
24
+ if (this.is_down) {
25
+ return;
26
+ }
27
+
28
+ this.is_down = true;
29
+ this.down.send0();
30
+ }
31
+
32
+ release() {
33
+ if (!this.is_down) {
34
+ return;
35
+ }
36
+
37
+ this.is_down = false;
38
+ this.up.send0();
39
+ }
22
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AA8CA;IAgBI;;;OAGG;IACH,wBAFW,WAAW,GAAC,OAAO,EA+B7B;IA/CD;;OAEG;IACH;;;MAGE;IAEF;;;OAGG;IACH,mBAAU;IAkBN;;;OAGG;IACH,YAFU,WAAW,CAEO;IA+DhC,cAGC;IAED,aAGC;;CACJ;mBA1JkB,uCAAuC"}
1
+ {"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AAYA;IAgBI;;;OAGG;IACH,wBAFW,WAAW,GAAC,OAAO,EA+B7B;IA/CD;;OAEG;IACH;;;MAGE;IAEF;;;OAGG;IACH,mBAAU;IAkBN;;;OAGG;IACH,YAFU,WAAW,CAEO;IA4DhC,cAGC;IAED,aAGC;;CACJ;mBArHkB,uCAAuC"}
@@ -1,43 +1,9 @@
1
1
  import Signal from "../../../core/events/signal/Signal.js";
2
2
  import { KeyboardEvents } from "./events/KeyboardEvents.js";
3
3
  import { InputDeviceSwitch } from "./InputDeviceSwitch.js";
4
+ import { isHTMLElementFocusable } from "./isHTMLElementFocusable.js";
4
5
  import { KeyCodes } from './KeyCodes.js';
5
6
 
6
- /**
7
- *
8
- * @param thing
9
- * @param klass
10
- * @returns {boolean}
11
- */
12
- function isInstanceOf(thing, klass) {
13
- if (klass === undefined) {
14
- return false;
15
- }
16
- if (klass === null) {
17
- return false;
18
- }
19
-
20
- if (typeof klass !== "object") {
21
- return false;
22
- }
23
-
24
-
25
- return thing instanceof klass;
26
- }
27
-
28
- /**
29
- * Based on the article about focusable events: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
30
- * @param {Element} el
31
- */
32
- function isFocusable(el) {
33
- return isInstanceOf(el, HTMLInputElement)
34
- || isInstanceOf(el, HTMLSelectElement)
35
- || isInstanceOf(el, HTMLTextAreaElement)
36
- || isInstanceOf(el, HTMLAnchorElement)
37
- || isInstanceOf(el, HTMLButtonElement)
38
- || isInstanceOf(el, HTMLAreaElement)
39
- }
40
-
41
7
  /**
42
8
  * @readonly
43
9
  * @type {string[]}
@@ -70,7 +36,7 @@ class KeyboardDevice {
70
36
  Only element in focus receives keyboard events, so the element supplied here must be focusable in order to be able to receive events
71
37
  */
72
38
  if (
73
- !isFocusable(domElement)
39
+ !isHTMLElementFocusable(domElement)
74
40
  && domElement.getAttribute('tabindex') === null
75
41
  ) {
76
42
  new TypeError('Supplied element is not inherently focusable and does not have tabindex attribute, so it must have a tabindex attribute in order to be able receive keyboard events. Something like tabindex=0 would suffice.');
@@ -116,9 +82,7 @@ class KeyboardDevice {
116
82
  if (keyName !== undefined) {
117
83
  const button = this.keys[keyName];
118
84
 
119
- button.is_down = true;
120
- button.down.send1(event);
121
-
85
+ button.press()
122
86
  }
123
87
  }
124
88
 
@@ -138,8 +102,7 @@ class KeyboardDevice {
138
102
  if (keyName !== undefined) {
139
103
  const button = this.keys[keyName];
140
104
 
141
- button.is_down = false;
142
- button.up.send1(event);
105
+ button.release();
143
106
  }
144
107
  }
145
108
 
@@ -0,0 +1,11 @@
1
+ export class LocationalInteractionMetadata {
2
+ /**
3
+ *
4
+ * @param {Vector2} p
5
+ */
6
+ static from(p: Vector2): LocationalInteractionMetadata;
7
+ timestamp: number;
8
+ position: Vector2;
9
+ }
10
+ import Vector2 from "../../../core/geom/Vector2.js";
11
+ //# sourceMappingURL=LocationalInteractionMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocationalInteractionMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/LocationalInteractionMetadata.js"],"names":[],"mappings":"AAEA;IAII;;;OAGG;IACH,eAFW,OAAO,iCAQjB;IAbD,kBAA6B;IAC7B,kBAAwB;CAa3B;oBAjBmB,+BAA+B"}
@@ -0,0 +1,18 @@
1
+ import Vector2 from "../../../core/geom/Vector2.js";
2
+
3
+ export class LocationalInteractionMetadata {
4
+ timestamp = performance.now()
5
+ position = new Vector2()
6
+
7
+ /**
8
+ *
9
+ * @param {Vector2} p
10
+ */
11
+ static from(p) {
12
+ const r = new LocationalInteractionMetadata();
13
+
14
+ r.position.copy(p);
15
+
16
+ return r;
17
+ }
18
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"PointerDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/PointerDevice.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,wDAFY,OAAO,EAAE,CAapB;AAiRD;;;;;GAKG;AACH,mDAJW,OAAO,SACP,UAAU,GAAC,KAAK,WAChB,OAAO,QAejB;AAED;;GAEG;AACH;IA2FI;;;;OAIG;IACH,wBAHW,WAAW,EA0CrB;IArID;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;IAczB;;OAEG;IACH;;;;QAII;;WAEG;aADO,OAAO,OAAO,EAAE,CAAC,UAAU,GAAC,UAAU,CAAC,CAAC;;;;;;;;MAUpD;IAeF;;;OAGG;IACH,kBAAkB;IAElB;;;;OAIG;IACH,kBAFU,iBAAiB,EAAE,CAEL;IAExB;;;OAGG;IACH,yCAEC;IAED;;;OAGG;IACH,0CAEC;IAED;;;OAGG;IACH,2CAEC;IAgLD;;;OAGG;IACH,oBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,6BAsBC;IAED,0BAEC;IAED;;;;OAIG;IACH,qCAHW,OAAO,SACP,UAAU,GAAC,KAAK,QAI1B;IAED,cAkCC;IAED,aA2BC;;CACJ;oBA5rBmB,+BAA+B;mBADhC,uCAAuC;kCAMxB,wBAAwB"}
1
+ {"version":3,"file":"PointerDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/PointerDevice.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,wDAFY,OAAO,EAAE,CAapB;AA+UD;;;;;GAKG;AACH,mDAJW,OAAO,SACP,UAAU,GAAC,KAAK,WAChB,OAAO,QAejB;AAED;;GAEG;AACH;IA2FI;;;;OAIG;IACH,wBAHW,WAAW,EAoCrB;IA/HD;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;IAczB;;OAEG;IACH;;;;QAII;;WAEG;aADO,OAAO,OAAO,EAAE,CAAC,UAAU,GAAC,UAAU,CAAC,CAAC;;;;;;;;MAUpD;IAeF;;;OAGG;IACH,kBAAkB;IAElB;;;;OAIG;IACH,kBAFU,iBAAiB,EAAE,CAEL;IAExB;;;OAGG;IACH,yCAEC;IAED;;;OAGG;IACH,0CAEC;IAED;;;OAGG;IACH,2CAEC;IAqKD;;;OAGG;IACH,oBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,6BAsBC;IAED,0BAEC;IAED;;;;OAIG;IACH,qCAHW,OAAO,SACP,UAAU,GAAC,KAAK,QAI1B;IAED,cAkCC;IAED,aA2BC;;CACJ;oBAjvBmB,+BAA+B;mBADhC,uCAAuC;kCAOxB,wBAAwB"}