@woosh/meep-engine 2.117.20 → 2.117.22

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.
@@ -52064,19 +52064,52 @@ class TerrainPreview {
52064
52064
  const UINT32_MAX = 4294967295;
52065
52065
 
52066
52066
  /**
52067
- * Assumes arrays have the same type
52068
- * @param {TypedArray|Float32Array|Uint8Array|Uint32Array} source
52069
- * @param {TypedArray|Float32Array|Uint8Array|Uint32Array} destination
52067
+ * This is essentially a {@link memcopy} implementation for ArrayBuffers
52068
+ * NOTE: allocates light-weight typed arrays under the hood, so beware of potential GC implications. Generally not an issue, unless you're copying very large number of very small arrays, consider alternatives such as {@link array_copy} instead
52069
+ * @param {ArrayBuffer} source
52070
+ * @param {number} source_offset
52071
+ * @param {ArrayBuffer} target
52072
+ * @param {number} target_offset
52073
+ * @param {number} byte_length
52070
52074
  */
52071
- function typed_array_copy(source, destination) {
52072
- const destination_size = destination.length;
52075
+ function array_buffer_copy(
52076
+ source, source_offset,
52077
+ target, target_offset,
52078
+ byte_length
52079
+ ) {
52080
+
52081
+ /**
52082
+ * @type {Uint8Array|Uint16Array|Uint32Array}
52083
+ */
52084
+ let source_array;
52085
+ /**
52086
+ * @type {Uint8Array|Uint16Array|Uint32Array}
52087
+ */
52088
+ let target_array;
52089
+
52090
+ const alignment = largest_common_alignment_uint32(source_offset,target_offset,byte_length);
52091
+
52092
+ if (
52093
+ alignment === 4
52094
+ ) {
52095
+ // aligned on 4-byte boundary
52096
+ source_array = new Uint32Array(source, source_offset, byte_length >>> 2);
52097
+ target_array = new Uint32Array(target, target_offset, byte_length >>> 2);
52098
+
52099
+ } else if (
52100
+ alignment === 2
52101
+ ) {
52102
+ // aligned on 2-byte boundary
52103
+ source_array = new Uint16Array(source, source_offset, byte_length >>> 1);
52104
+ target_array = new Uint16Array(target, target_offset, byte_length >>> 1);
52073
52105
 
52074
- if (destination_size >= source.length) {
52075
- destination.set(source, 0);
52076
52106
  } else {
52077
- // destination is smaller than source, crop source data
52078
- array_copy(source, 0, destination, 0, destination_size);
52107
+ // worst-case, assume 1-byte boundary
52108
+ source_array = new Uint8Array(source, source_offset, byte_length);
52109
+ target_array = new Uint8Array(target, target_offset, byte_length);
52079
52110
  }
52111
+
52112
+ target_array.set(source_array);
52080
52113
  }
52081
52114
 
52082
52115
  /**
@@ -52290,7 +52323,11 @@ class BVH {
52290
52323
  this.__data_uint32 = new Uint32Array(new_data_buffer);
52291
52324
 
52292
52325
  // copy old data into new buffer
52293
- typed_array_copy(old_data_uint32, this.__data_uint32);
52326
+ array_buffer_copy(
52327
+ old_data_uint32.buffer, old_data_uint32.byteOffset,
52328
+ new_data_buffer, 0,
52329
+ Math.min(old_data_uint32.byteLength, new_data_buffer.byteLength)
52330
+ );
52294
52331
 
52295
52332
  this.__capacity = new_capacity;
52296
52333
  }
@@ -61428,6 +61465,22 @@ Cache.prototype.delete = Cache.prototype.remove;
61428
61465
  */
61429
61466
  Cache.prototype.has = Cache.prototype.contains;
61430
61467
 
61468
+ /**
61469
+ * Assumes arrays have the same type
61470
+ * @param {TypedArray|Float32Array|Uint8Array|Uint32Array} source
61471
+ * @param {TypedArray|Float32Array|Uint8Array|Uint32Array} destination
61472
+ */
61473
+ function typed_array_copy(source, destination) {
61474
+ const destination_size = destination.length;
61475
+
61476
+ if (destination_size >= source.length) {
61477
+ destination.set(source, 0);
61478
+ } else {
61479
+ // destination is smaller than source, crop source data
61480
+ array_copy(source, 0, destination, 0, destination_size);
61481
+ }
61482
+ }
61483
+
61431
61484
  /**
61432
61485
  *
61433
61486
  * @param {Object} a
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.117.20",
8
+ "version": "2.117.22",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"BVH.d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;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,oBAHW,MAAM,UACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;OAIG;IACH,kBAHW,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAAM,QAsB1C;IAED;;;;OAIG;IACH,mBAHW,MAAM,QACN,MAAM,EAAE,QAWlB;IAED;;;;;;;;;OASG;IACH,4BARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAmBhB;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,MAAM,CAoBlB;IAED;;;;;OAKG;IACH,wCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAoClB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,WACN,MAAM,WACN,MAAM,QAwChB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA0GhB;IAED;;;;;OAKG;IACH,wBAqBC;IAED;;;;OAIG;IACH,yBA4BC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA6ChB;IAED;;;;;;OAMG;IACH,gBAoMC;IAED;;;OAGG;IACH,oBAIC;IAED;;;;OAIG;IACH,yCA8BC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,0BA6BC;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAsCnB;CACJ"}
1
+ {"version":3,"file":"BVH.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/BVH.js"],"names":[],"mappings":"AAQA,8BAA+B;AAC/B,+BAAgC;AAChC,+BAAgC;AAChC,8BAA+B;AAE/B;;;;;GAKG;AACH,+BAFU,MAAM,CAE+B;AAE/C;;;GAGG;AACH,wBAFU,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,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAAM,QAsB1C;IAED;;;;OAIG;IACH,mBAHW,MAAM,QACN,MAAM,EAAE,QAWlB;IAED;;;;;;;;;OASG;IACH,4BARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAmBhB;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,MAAM,CAoBlB;IAED;;;;;OAKG;IACH,wCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAoClB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,WACN,MAAM,WACN,MAAM,QAwChB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA0GhB;IAED;;;;;OAKG;IACH,wBAqBC;IAED;;;;OAIG;IACH,yBA4BC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,IAAI,CA6ChB;IAED;;;;;;OAMG;IACH,gBAoMC;IAED;;;OAGG;IACH,oBAIC;IAED;;;;OAIG;IACH,yCA8BC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,0BA6BC;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAsCnB;CACJ"}
@@ -1,7 +1,7 @@
1
1
  import { assert } from "../../assert.js";
2
2
  import { UINT32_MAX } from "../../binary/UINT32_MAX.js";
3
3
  import { array_copy } from "../../collection/array/array_copy.js";
4
- import { typed_array_copy } from "../../collection/array/typed/typed_array_copy.js";
4
+ import { array_buffer_copy } from "../../collection/array/typed/array_buffer_copy.js";
5
5
  import { aabb3_compute_surface_area } from "../../geom/3d/aabb/aabb3_compute_surface_area.js";
6
6
  import { max2 } from "../../math/max2.js";
7
7
  import { min2 } from "../../math/min2.js";
@@ -201,7 +201,11 @@ export class BVH {
201
201
  this.__data_uint32 = new Uint32Array(new_data_buffer);
202
202
 
203
203
  // copy old data into new buffer
204
- typed_array_copy(old_data_uint32, this.__data_uint32);
204
+ array_buffer_copy(
205
+ old_data_uint32.buffer, old_data_uint32.byteOffset,
206
+ new_data_buffer, 0,
207
+ Math.min(old_data_uint32.byteLength, new_data_buffer.byteLength)
208
+ );
205
209
 
206
210
  this.__capacity = new_capacity;
207
211
  }
@@ -5,7 +5,7 @@
5
5
  * @param {number[]|Float32Array} index_array
6
6
  * @param {number[]|Float32Array} position_array
7
7
  * @param {Uint32Array} [morton_codes]
8
- * @param {AABB3} [bounds]
8
+ * @param {AABB3} [bounds] Bounding box of the entire geometry, if not supplied will be computed internally
9
9
  */
10
10
  export function ebvh_build_for_geometry_morton(bvh: BVH, index_array: number[] | Float32Array, position_array: number[] | Float32Array, morton_codes?: Uint32Array, bounds?: AABB3): void;
11
11
  import { AABB3 } from "../../geom/3d/aabb/AABB3.js";
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,QA4Ff;sBA3GqB,6BAA6B"}
1
+ {"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,QAgHf;sBA/HqB,6BAA6B"}
@@ -16,14 +16,14 @@ import { ebvh_build_hierarchy } from "./ebvh_build_hierarchy.js";
16
16
  * @param {number[]|Float32Array} index_array
17
17
  * @param {number[]|Float32Array} position_array
18
18
  * @param {Uint32Array} [morton_codes]
19
- * @param {AABB3} [bounds]
19
+ * @param {AABB3} [bounds] Bounding box of the entire geometry, if not supplied will be computed internally
20
20
  */
21
21
  export function ebvh_build_for_geometry_morton(
22
22
  bvh,
23
23
  index_array,
24
24
  position_array,
25
25
  morton_codes = new Uint32Array(index_array.length / 3),
26
- bounds = new AABB3()
26
+ bounds
27
27
  ) {
28
28
  assert.defined(bvh, 'bvh');
29
29
 
@@ -38,8 +38,6 @@ export function ebvh_build_for_geometry_morton(
38
38
  // clear out existing BVH
39
39
  bvh.release_all();
40
40
 
41
- // get bounds for the entire geometry
42
- aabb3_from_v3_array(bounds, position_array, position_array.length);
43
41
 
44
42
  // allocate nodes
45
43
  const tri_count = index_array.length / 3;
@@ -70,7 +68,29 @@ export function ebvh_build_for_geometry_morton(
70
68
  sorted_triangle_order[i] = i;
71
69
  }
72
70
 
73
- build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, bounds.x0, bounds.y0, bounds.z0, bounds.x1, bounds.y1, bounds.z1);
71
+ let _geometry_bounds = bounds;
72
+
73
+ if (_geometry_bounds === undefined) {
74
+ // get bounds for the entire geometry
75
+ _geometry_bounds = new AABB3();
76
+
77
+ aabb3_from_v3_array(_geometry_bounds, position_array, position_array.length);
78
+ } else {
79
+
80
+ assert.greaterThanOrEqual(_geometry_bounds.width, 0, 'x extents');
81
+ assert.greaterThanOrEqual(_geometry_bounds.height, 0, 'y extents');
82
+ assert.greaterThanOrEqual(_geometry_bounds.depth, 0, 'z extents');
83
+
84
+ }
85
+
86
+ build_triangle_morton_codes(
87
+ morton_codes,
88
+ tri_count,
89
+ index_array,
90
+ position_array,
91
+ _geometry_bounds.x0, _geometry_bounds.y0, _geometry_bounds.z0,
92
+ _geometry_bounds.x1, _geometry_bounds.y1, _geometry_bounds.z1
93
+ );
74
94
 
75
95
  // sort leaves by morton codes
76
96
  array_quick_sort_by_lookup_uint(sorted_triangle_order, morton_codes, 0, tri_count - 1);
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Inverts a 4x4 matrix
3
3
  * @see Adapted from glMatrix
4
- * @param {Float32Array|number[]|mat4} out
5
- * @param {Float32Array|number[]|mat4} input
4
+ * @param {Float64Array|Float32Array|number[]|mat4} out
5
+ * @param {Float64Array|Float32Array|number[]|mat4} input
6
6
  * @returns {boolean}
7
7
  */
8
- export function m4_invert(out: Float32Array | number[] | mat4, input: Float32Array | number[] | mat4): boolean;
8
+ export function m4_invert(out: Float64Array | Float32Array | number[] | mat4, input: Float64Array | Float32Array | number[] | mat4): boolean;
9
9
  //# sourceMappingURL=m4_invert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"m4_invert.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/m4_invert.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,+BAJW,YAAY,GAAC,MAAM,EAAE,OAAK,SAC1B,YAAY,GAAC,MAAM,EAAE,OAAK,GACxB,OAAO,CA+DnB"}
1
+ {"version":3,"file":"m4_invert.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/m4_invert.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,+BAJW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,OAAK,SACvC,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,OAAK,GACrC,OAAO,CA+DnB"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Inverts a 4x4 matrix
3
3
  * @see Adapted from glMatrix
4
- * @param {Float32Array|number[]|mat4} out
5
- * @param {Float32Array|number[]|mat4} input
4
+ * @param {Float64Array|Float32Array|number[]|mat4} out
5
+ * @param {Float64Array|Float32Array|number[]|mat4} input
6
6
  * @returns {boolean}
7
7
  */
8
8
  export function m4_invert(out, input) {
@@ -1 +1 @@
1
- {"version":3,"file":"BufferedGeometryBVH.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js"],"names":[],"mappings":"AA+CA;IAkBI;;;OAGG;IACH,eAFW,KAAK,GAAC,MAAM,EAAE,QAIxB;IAIG;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,6BAAgC;IAGhC;;;;OAIG;IACH,yBAAyB;IAG7B;;;OAGG;IACH,WAFW,MAAM,cAAc,QAwC9B;IAED;;;;;OAKG;IACH,qBAFa,OAAO,CAmHnB;IAED;;;;;;;OAOG;IACH,4BANW,aAAa,KACb,MAAM,KACN,MAAM,KACN,MAAM,GACJ,OAAO,CAqKnB;IAGD;;;;;;OAMG;IACH,iBAJW,MAAM,EAAE,OACR,MAAM,EAAE,OAAK,GACX,MAAM,CAoIlB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,EAAE,OACR,MAAM,EAAE,OAAK,GACX,MAAM,CA2ElB;;CACJ;sBA3oBqB,wCAAwC;8BAKhC,2CAA2C"}
1
+ {"version":3,"file":"BufferedGeometryBVH.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js"],"names":[],"mappings":"AA8CA;IAkBI;;;OAGG;IACH,eAFW,KAAK,GAAC,MAAM,EAAE,QAIxB;IAIG;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,6BAAgC;IAGhC;;;;OAIG;IACH,yBAAyB;IAG7B;;;OAGG;IACH,WAFW,MAAM,cAAc,QA0C9B;IAED;;;;;OAKG;IACH,qBAFa,OAAO,CAmHnB;IAED;;;;;;;OAOG;IACH,4BANW,aAAa,KACb,MAAM,KACN,MAAM,KACN,MAAM,GACJ,OAAO,CAqKnB;IAGD;;;;;;OAMG;IACH,iBAJW,MAAM,EAAE,OACR,MAAM,EAAE,OAAK,GACX,MAAM,CAoIlB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,EAAE,OACR,MAAM,EAAE,OAAK,GACX,MAAM,CA2ElB;;CACJ;sBA5oBqB,wCAAwC;8BAMhC,2CAA2C"}
@@ -11,6 +11,7 @@ import { bvh_query_user_data_ray_segment } from "../../../../core/bvh2/bvh3/quer
11
11
  import { array_copy } from "../../../../core/collection/array/array_copy.js";
12
12
  import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
13
13
  import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
14
+ import { aabb3_from_v3_array } from "../../../../core/geom/3d/aabb/aabb3_from_v3_array.js";
14
15
  import { aabb3_intersects_ray_segment } from "../../../../core/geom/3d/aabb/aabb3_intersects_ray_segment.js";
15
16
  import {
16
17
  aabb3_unsigned_distance_sqr_to_point
@@ -41,8 +42,6 @@ const scratch_uint32_array = new Uint32Array(4096);
41
42
  */
42
43
  const v3_scratch_0 = [];
43
44
 
44
- const scratch_contact = new SurfacePoint3();
45
-
46
45
  const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
47
46
 
48
47
  export class BufferedGeometryBVH {
@@ -128,6 +127,8 @@ export class BufferedGeometryBVH {
128
127
 
129
128
  const bvh = this.#bvh;
130
129
 
130
+ aabb3_from_v3_array( this.#bounds, array_positions, array_positions.length);
131
+
131
132
  ebvh_build_for_geometry_morton(
132
133
  bvh,
133
134
  index_array,