@woosh/meep-engine 2.117.21 → 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.
- package/build/meep.cjs +63 -10
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +63 -10
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +6 -2
package/build/meep.module.js
CHANGED
|
@@ -52064,19 +52064,52 @@ class TerrainPreview {
|
|
|
52064
52064
|
const UINT32_MAX = 4294967295;
|
|
52065
52065
|
|
|
52066
52066
|
/**
|
|
52067
|
-
*
|
|
52068
|
-
* @
|
|
52069
|
-
* @param {
|
|
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
|
|
52072
|
-
|
|
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
|
-
//
|
|
52078
|
-
|
|
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
|
-
|
|
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
|
@@ -1 +1 @@
|
|
|
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,MAAM,CAEoB;AAcpC;;;;;GAKG;AACH,iCAFU,MAAM,CAEqB;AAgBrC;;;;;;GAMG;AACH;IAEI;;;;OAIG;IACH,sBAA2E;IAE3E;;;;OAIG;IACH,uBAAsD;IAEtD;;;;OAIG;IACH,sBAAoD;IAEpD;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,eAAW;IAEX;;;;OAIG;IACH,eAAY;IAEZ;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,eAAmB;IAUnB;;;OAGG;IACH,sBAEC;IAdD;;;OAGG;IACH,mBAEC;IAkBD;;;OAGG;IACH,+BAMC;IAlBD;;;OAGG;IACH,4BAEC;IAcD,wBAgBC;IAED;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"BVH.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/BVH.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;;;;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,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 {
|
|
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
|
-
|
|
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
|
}
|