@woosh/meep-engine 2.117.21 → 2.117.23
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 +73 -10
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +73 -10
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts +2 -0
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +16 -2
package/build/meep.cjs
CHANGED
|
@@ -52066,19 +52066,52 @@ class TerrainPreview {
|
|
|
52066
52066
|
const UINT32_MAX = 4294967295;
|
|
52067
52067
|
|
|
52068
52068
|
/**
|
|
52069
|
-
*
|
|
52070
|
-
* @
|
|
52071
|
-
* @param {
|
|
52069
|
+
* This is essentially a {@link memcopy} implementation for ArrayBuffers
|
|
52070
|
+
* 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
|
|
52071
|
+
* @param {ArrayBuffer} source
|
|
52072
|
+
* @param {number} source_offset
|
|
52073
|
+
* @param {ArrayBuffer} target
|
|
52074
|
+
* @param {number} target_offset
|
|
52075
|
+
* @param {number} byte_length
|
|
52072
52076
|
*/
|
|
52073
|
-
function
|
|
52074
|
-
|
|
52077
|
+
function array_buffer_copy(
|
|
52078
|
+
source, source_offset,
|
|
52079
|
+
target, target_offset,
|
|
52080
|
+
byte_length
|
|
52081
|
+
) {
|
|
52082
|
+
|
|
52083
|
+
/**
|
|
52084
|
+
* @type {Uint8Array|Uint16Array|Uint32Array}
|
|
52085
|
+
*/
|
|
52086
|
+
let source_array;
|
|
52087
|
+
/**
|
|
52088
|
+
* @type {Uint8Array|Uint16Array|Uint32Array}
|
|
52089
|
+
*/
|
|
52090
|
+
let target_array;
|
|
52091
|
+
|
|
52092
|
+
const alignment = largest_common_alignment_uint32(source_offset,target_offset,byte_length);
|
|
52093
|
+
|
|
52094
|
+
if (
|
|
52095
|
+
alignment === 4
|
|
52096
|
+
) {
|
|
52097
|
+
// aligned on 4-byte boundary
|
|
52098
|
+
source_array = new Uint32Array(source, source_offset, byte_length >>> 2);
|
|
52099
|
+
target_array = new Uint32Array(target, target_offset, byte_length >>> 2);
|
|
52100
|
+
|
|
52101
|
+
} else if (
|
|
52102
|
+
alignment === 2
|
|
52103
|
+
) {
|
|
52104
|
+
// aligned on 2-byte boundary
|
|
52105
|
+
source_array = new Uint16Array(source, source_offset, byte_length >>> 1);
|
|
52106
|
+
target_array = new Uint16Array(target, target_offset, byte_length >>> 1);
|
|
52075
52107
|
|
|
52076
|
-
if (destination_size >= source.length) {
|
|
52077
|
-
destination.set(source, 0);
|
|
52078
52108
|
} else {
|
|
52079
|
-
//
|
|
52080
|
-
|
|
52109
|
+
// worst-case, assume 1-byte boundary
|
|
52110
|
+
source_array = new Uint8Array(source, source_offset, byte_length);
|
|
52111
|
+
target_array = new Uint8Array(target, target_offset, byte_length);
|
|
52081
52112
|
}
|
|
52113
|
+
|
|
52114
|
+
target_array.set(source_array);
|
|
52082
52115
|
}
|
|
52083
52116
|
|
|
52084
52117
|
/**
|
|
@@ -52167,6 +52200,16 @@ class BVH {
|
|
|
52167
52200
|
*/
|
|
52168
52201
|
__data_buffer = new ArrayBuffer(INITIAL_CAPACITY * ELEMENT_WORD_COUNT * 4);
|
|
52169
52202
|
|
|
52203
|
+
/**
|
|
52204
|
+
* Access raw data
|
|
52205
|
+
* Useful for serialization
|
|
52206
|
+
* If you intend to modify the data directly - make sure you fully understand the implications of doing so
|
|
52207
|
+
* @returns {ArrayBuffer}
|
|
52208
|
+
*/
|
|
52209
|
+
get data_buffer(){
|
|
52210
|
+
return this.__data_buffer;
|
|
52211
|
+
}
|
|
52212
|
+
|
|
52170
52213
|
/**
|
|
52171
52214
|
*
|
|
52172
52215
|
* @type {Float32Array}
|
|
@@ -52292,7 +52335,11 @@ class BVH {
|
|
|
52292
52335
|
this.__data_uint32 = new Uint32Array(new_data_buffer);
|
|
52293
52336
|
|
|
52294
52337
|
// copy old data into new buffer
|
|
52295
|
-
|
|
52338
|
+
array_buffer_copy(
|
|
52339
|
+
old_data_uint32.buffer, old_data_uint32.byteOffset,
|
|
52340
|
+
new_data_buffer, 0,
|
|
52341
|
+
Math.min(old_data_uint32.byteLength, new_data_buffer.byteLength)
|
|
52342
|
+
);
|
|
52296
52343
|
|
|
52297
52344
|
this.__capacity = new_capacity;
|
|
52298
52345
|
}
|
|
@@ -61430,6 +61477,22 @@ Cache.prototype.delete = Cache.prototype.remove;
|
|
|
61430
61477
|
*/
|
|
61431
61478
|
Cache.prototype.has = Cache.prototype.contains;
|
|
61432
61479
|
|
|
61480
|
+
/**
|
|
61481
|
+
* Assumes arrays have the same type
|
|
61482
|
+
* @param {TypedArray|Float32Array|Uint8Array|Uint32Array} source
|
|
61483
|
+
* @param {TypedArray|Float32Array|Uint8Array|Uint32Array} destination
|
|
61484
|
+
*/
|
|
61485
|
+
function typed_array_copy(source, destination) {
|
|
61486
|
+
const destination_size = destination.length;
|
|
61487
|
+
|
|
61488
|
+
if (destination_size >= source.length) {
|
|
61489
|
+
destination.set(source, 0);
|
|
61490
|
+
} else {
|
|
61491
|
+
// destination is smaller than source, crop source data
|
|
61492
|
+
array_copy(source, 0, destination, 0, destination_size);
|
|
61493
|
+
}
|
|
61494
|
+
}
|
|
61495
|
+
|
|
61433
61496
|
/**
|
|
61434
61497
|
*
|
|
61435
61498
|
* @param {Object} a
|