@woosh/meep-engine 2.114.0 → 2.115.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.
- package/build/meep.cjs +92 -53
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +92 -53
- package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
- package/package.json +1 -1
- package/src/core/binary/clz32.d.ts +7 -0
- package/src/core/binary/clz32.d.ts.map +1 -0
- package/src/core/binary/clz32.js +37 -0
- package/src/core/binary/is_data_url.d.ts.map +1 -1
- package/src/core/binary/is_data_url.js +1 -0
- package/src/core/binary/makeArrayBuffer.d.ts.map +1 -1
- package/src/core/binary/makeArrayBuffer.js +1 -0
- package/src/core/binary/msb_32.d.ts +7 -1
- package/src/core/binary/msb_32.d.ts.map +1 -1
- package/src/core/binary/msb_32.js +3 -12
- package/src/core/collection/RingBuffer.d.ts +1 -1
- package/src/core/collection/RingBuffer.js +1 -1
- package/src/core/collection/array/combine_hash.js +1 -1
- package/src/core/{primitives → collection}/array/compareArrays.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.d.ts +6 -6
- package/src/core/collection/array/randomMultipleFromArray.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.js +5 -5
- package/src/core/collection/array/typed/sparse_typed_array_hash.js +1 -1
- package/src/core/collection/array/typed/typedArrayConstructorByInstance.d.ts.map +1 -0
- package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
- package/src/core/geom/2d/Rectangle.js +18 -5
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +4 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts +3 -3
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +11 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -2
- package/src/core/geom/2d/convex-hull/orientation3_array.js +2 -2
- package/src/core/geom/2d/intersect_ray_2d.d.ts.map +1 -1
- package/src/core/geom/2d/intersect_ray_2d.js +5 -5
- package/src/core/geom/2d/{compute_triangle_area_2d.d.ts → triangle2d_compute_area.d.ts} +2 -2
- package/src/core/geom/2d/triangle2d_compute_area.d.ts.map +1 -0
- package/src/core/geom/2d/{compute_triangle_area_2d.js → triangle2d_compute_area.js} +1 -1
- package/src/core/geom/2d/triangle2d_contains_point.d.ts +14 -0
- package/src/core/geom/2d/triangle2d_contains_point.d.ts.map +1 -0
- package/src/core/geom/2d/triangle2d_contains_point.js +39 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -1
- package/src/core/geom/2d/triangle2d_get_barycentric.js +1 -1
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector2.js +2 -2
- package/src/core/math/bessel_3.d.ts +1 -1
- package/src/core/math/bessel_3.js +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts.map +1 -1
- package/src/core/math/computeWholeDivisorLow.js +8 -5
- package/src/core/math/interval/separation1D.d.ts.map +1 -0
- package/src/core/math/{separation1D.js → interval/separation1D.js} +3 -3
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +10 -0
- package/src/core/model/object/compareValues.js +3 -3
- package/src/engine/EntityCreator.d.ts +11 -11
- package/src/engine/EntityCreator.d.ts.map +1 -1
- package/src/engine/EntityCreator.js +2 -4
- package/src/engine/ecs/grid/HeightMap2NormalMap.js +2 -2
- package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +2 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +5 -55
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts +9 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts.map +1 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js +64 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
- package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler_multiply_vector.js → sampler2d_multiply_vector.js} +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler2DToFloat32Texture.js → sampler2d_to_float32_texture.js} +2 -2
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -1
- package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
- package/src/engine/grid/obstacle/GridObstacle.js +1 -1
- package/src/engine/physics/computeInterceptPoint.js +20 -6
- package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
- package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -17
- package/src/core/UUID.d.ts +0 -6
- package/src/core/UUID.d.ts.map +0 -1
- package/src/core/UUID.js +0 -21
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.d.ts +0 -12
- package/src/core/geom/2d/convex-hull/orientation3.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.js +0 -489
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts +0 -9
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3_v2.js +0 -12
- package/src/core/math/separation1D.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts +0 -6
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.js +0 -13
- /package/src/core/{primitives → collection}/array/compareArrays.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/compareArrays.js +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.js +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.d.ts +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.js +0 -0
- /package/src/core/math/{separation1D.d.ts → interval/separation1D.d.ts} +0 -0
package/build/meep.cjs
CHANGED
|
@@ -47415,7 +47415,7 @@ class Vector2 {
|
|
|
47415
47415
|
|
|
47416
47416
|
/**
|
|
47417
47417
|
*
|
|
47418
|
-
* @param {number[]} array
|
|
47418
|
+
* @param {number[]|Float32Array} array
|
|
47419
47419
|
* @param {number} offset
|
|
47420
47420
|
*/
|
|
47421
47421
|
fromArray(array, offset = 0) {
|
|
@@ -47427,7 +47427,7 @@ class Vector2 {
|
|
|
47427
47427
|
|
|
47428
47428
|
/**
|
|
47429
47429
|
*
|
|
47430
|
-
* @param {number[]} array
|
|
47430
|
+
* @param {number[]|Float32Array} array
|
|
47431
47431
|
* @param {number} offset
|
|
47432
47432
|
*/
|
|
47433
47433
|
toArray(array, offset = 0) {
|
|
@@ -49003,6 +49003,34 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49003
49003
|
return r;
|
|
49004
49004
|
}
|
|
49005
49005
|
|
|
49006
|
+
/**
|
|
49007
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49008
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49009
|
+
* @param {number} offset
|
|
49010
|
+
* @param {number} length
|
|
49011
|
+
* @param {number} stride
|
|
49012
|
+
* @return {number}
|
|
49013
|
+
*/
|
|
49014
|
+
function computeStridedIntegerArrayHash(
|
|
49015
|
+
array, offset, length, stride
|
|
49016
|
+
) {
|
|
49017
|
+
let hash = length;
|
|
49018
|
+
|
|
49019
|
+
for (let i = offset; i < length; i += stride) {
|
|
49020
|
+
const value = array[i] >>> 0; //force uint32
|
|
49021
|
+
|
|
49022
|
+
/**
|
|
49023
|
+
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49024
|
+
* (h<<5) - h === h*31
|
|
49025
|
+
* @type {number}
|
|
49026
|
+
*/
|
|
49027
|
+
hash = ((hash << 5) - hash) + value;
|
|
49028
|
+
}
|
|
49029
|
+
|
|
49030
|
+
// force uint32
|
|
49031
|
+
return hash >>> 0;
|
|
49032
|
+
}
|
|
49033
|
+
|
|
49006
49034
|
/**
|
|
49007
49035
|
*
|
|
49008
49036
|
* @param {*} array
|
|
@@ -49128,47 +49156,6 @@ function is_typed_array_equals(a, b) {
|
|
|
49128
49156
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
49129
49157
|
}
|
|
49130
49158
|
|
|
49131
|
-
/**
|
|
49132
|
-
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49133
|
-
* @param {number} t ratio
|
|
49134
|
-
* @param {number} a position -2
|
|
49135
|
-
* @param {number} b position -1
|
|
49136
|
-
* @param {number} c position +1
|
|
49137
|
-
* @param {number} d position +2
|
|
49138
|
-
* @returns {number}
|
|
49139
|
-
*/
|
|
49140
|
-
function interpolate_bicubic(t, a, b, c, d) {
|
|
49141
|
-
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
49142
|
-
}
|
|
49143
|
-
|
|
49144
|
-
/**
|
|
49145
|
-
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49146
|
-
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49147
|
-
* @param {number} offset
|
|
49148
|
-
* @param {number} length
|
|
49149
|
-
* @param {number} stride
|
|
49150
|
-
* @return {number}
|
|
49151
|
-
*/
|
|
49152
|
-
function computeStridedIntegerArrayHash(
|
|
49153
|
-
array, offset, length, stride
|
|
49154
|
-
) {
|
|
49155
|
-
let hash = length;
|
|
49156
|
-
|
|
49157
|
-
for (let i = offset; i < length; i += stride) {
|
|
49158
|
-
const value = array[i] >>> 0; //force uint32
|
|
49159
|
-
|
|
49160
|
-
/**
|
|
49161
|
-
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49162
|
-
* (h<<5) - h === h*31
|
|
49163
|
-
* @type {number}
|
|
49164
|
-
*/
|
|
49165
|
-
hash = ((hash << 5) - hash) + value;
|
|
49166
|
-
}
|
|
49167
|
-
|
|
49168
|
-
// force uint32
|
|
49169
|
-
return hash >>> 0;
|
|
49170
|
-
}
|
|
49171
|
-
|
|
49172
49159
|
function typedArrayConstructorByInstance(a) {
|
|
49173
49160
|
if (a instanceof Int8Array) {
|
|
49174
49161
|
return Int8Array;
|
|
@@ -49195,6 +49182,19 @@ function typedArrayConstructorByInstance(a) {
|
|
|
49195
49182
|
}
|
|
49196
49183
|
}
|
|
49197
49184
|
|
|
49185
|
+
/**
|
|
49186
|
+
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49187
|
+
* @param {number} t ratio
|
|
49188
|
+
* @param {number} a position -2
|
|
49189
|
+
* @param {number} b position -1
|
|
49190
|
+
* @param {number} c position +1
|
|
49191
|
+
* @param {number} d position +2
|
|
49192
|
+
* @returns {number}
|
|
49193
|
+
*/
|
|
49194
|
+
function interpolate_bicubic(t, a, b, c, d) {
|
|
49195
|
+
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
49196
|
+
}
|
|
49197
|
+
|
|
49198
49198
|
/**
|
|
49199
49199
|
* Data Texture class, providing an abstraction around 2d numerical arrays, mostly for sampling purposes
|
|
49200
49200
|
* Inspired by OpenGL's glsl sampler2d API
|
|
@@ -54444,7 +54444,10 @@ function overlap1D(a0, a1, b0, b1) {
|
|
|
54444
54444
|
* @param {number} by1
|
|
54445
54445
|
* @returns {boolean} true if overlap exists, false if no overlap
|
|
54446
54446
|
*/
|
|
54447
|
-
function aabb2_overlap_exists(
|
|
54447
|
+
function aabb2_overlap_exists(
|
|
54448
|
+
ax0, ay0, ax1, ay1,
|
|
54449
|
+
bx0, by0, bx1, by1
|
|
54450
|
+
) {
|
|
54448
54451
|
return overlap1D(ax0, ax1, bx0, bx1)
|
|
54449
54452
|
&& overlap1D(ay0, ay1, by0, by1);
|
|
54450
54453
|
}
|
|
@@ -59312,7 +59315,7 @@ function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
|
59312
59315
|
* @param {Sampler2D} sampler
|
|
59313
59316
|
* @returns {DataTexture}
|
|
59314
59317
|
*/
|
|
59315
|
-
function
|
|
59318
|
+
function sampler2d_to_float32_texture(sampler) {
|
|
59316
59319
|
|
|
59317
59320
|
const width = sampler.width;
|
|
59318
59321
|
const height = sampler.height;
|
|
@@ -59385,7 +59388,7 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
59385
59388
|
const width = sampler.width;
|
|
59386
59389
|
const height = sampler.height;
|
|
59387
59390
|
|
|
59388
|
-
const texture =
|
|
59391
|
+
const texture = sampler2d_to_float32_texture(sampler);
|
|
59389
59392
|
|
|
59390
59393
|
//construct shader
|
|
59391
59394
|
const shader = new NormalMapShader();
|
|
@@ -59688,9 +59691,9 @@ function normalMap2OcclusionMap(
|
|
|
59688
59691
|
const width = resultSize.x;
|
|
59689
59692
|
const height = resultSize.y;
|
|
59690
59693
|
//
|
|
59691
|
-
const normalTexture =
|
|
59694
|
+
const normalTexture = sampler2d_to_float32_texture(normalMap);
|
|
59692
59695
|
|
|
59693
|
-
const heightTexture =
|
|
59696
|
+
const heightTexture = sampler2d_to_float32_texture(heightMap);
|
|
59694
59697
|
|
|
59695
59698
|
|
|
59696
59699
|
//construct shader
|
|
@@ -87420,7 +87423,7 @@ class RingBuffer {
|
|
|
87420
87423
|
}
|
|
87421
87424
|
|
|
87422
87425
|
/**
|
|
87423
|
-
*
|
|
87426
|
+
* Removed first element that fulfills the criteria
|
|
87424
87427
|
* @param {function(V):boolean} condition
|
|
87425
87428
|
* @param {*} [thisArg]
|
|
87426
87429
|
* @returns {V|undefined}
|
|
@@ -99189,6 +99192,30 @@ function intersects1D(a0, a1, b0, b1) {
|
|
|
99189
99192
|
return a1 >= b0 && b1 >= a0;
|
|
99190
99193
|
}
|
|
99191
99194
|
|
|
99195
|
+
/**
|
|
99196
|
+
*
|
|
99197
|
+
* @param {number} bounds_x0
|
|
99198
|
+
* @param {number} bounds_y0
|
|
99199
|
+
* @param {number} bounds_x1
|
|
99200
|
+
* @param {number} bounds_y1
|
|
99201
|
+
* @param {number} x0
|
|
99202
|
+
* @param {number} y0
|
|
99203
|
+
* @param {number} x1
|
|
99204
|
+
* @param {number} y1
|
|
99205
|
+
* @return {boolean}
|
|
99206
|
+
*/
|
|
99207
|
+
function aabb2_contains(
|
|
99208
|
+
bounds_x0, bounds_y0, bounds_x1, bounds_y1,
|
|
99209
|
+
x0, y0, x1, y1
|
|
99210
|
+
) {
|
|
99211
|
+
|
|
99212
|
+
return x0 >= bounds_x0
|
|
99213
|
+
&& x1 <= bounds_x1
|
|
99214
|
+
&& y0 >= bounds_y0
|
|
99215
|
+
&& y1 <= bounds_y1
|
|
99216
|
+
;
|
|
99217
|
+
}
|
|
99218
|
+
|
|
99192
99219
|
class Rectangle {
|
|
99193
99220
|
/**
|
|
99194
99221
|
*
|
|
@@ -99325,8 +99352,13 @@ class Rectangle {
|
|
|
99325
99352
|
|
|
99326
99353
|
const _x0 = p.x;
|
|
99327
99354
|
const _y0 = p.y;
|
|
99355
|
+
const _x1 = s.x + _x0;
|
|
99356
|
+
const _y1 = _y0 + s.y;
|
|
99328
99357
|
|
|
99329
|
-
return
|
|
99358
|
+
return aabb2_overlap_exists(
|
|
99359
|
+
_x0, _y0, _x1, _y1,
|
|
99360
|
+
x0, y0, x1, y1
|
|
99361
|
+
);
|
|
99330
99362
|
}
|
|
99331
99363
|
|
|
99332
99364
|
/**
|
|
@@ -99339,6 +99371,7 @@ class Rectangle {
|
|
|
99339
99371
|
const y0 = other.position.y;
|
|
99340
99372
|
const y1 = other.size.y + y0;
|
|
99341
99373
|
const x1 = other.size.x + x0;
|
|
99374
|
+
|
|
99342
99375
|
return this._overlaps(x0, y0, x1, y1);
|
|
99343
99376
|
}
|
|
99344
99377
|
|
|
@@ -99398,13 +99431,18 @@ class Rectangle {
|
|
|
99398
99431
|
_contains(x0, y0, x1, y1) {
|
|
99399
99432
|
const size = this.size;
|
|
99400
99433
|
|
|
99401
|
-
const
|
|
99402
|
-
|
|
99434
|
+
const position = this.position;
|
|
99435
|
+
|
|
99436
|
+
const _x0 = position.x;
|
|
99437
|
+
const _y0 = position.y;
|
|
99403
99438
|
|
|
99404
99439
|
const _y1 = size.y + _y0;
|
|
99405
99440
|
const _x1 = size.x + _x0;
|
|
99406
99441
|
|
|
99407
|
-
return
|
|
99442
|
+
return aabb2_contains(
|
|
99443
|
+
_x0, _y0, _x1, _y1,
|
|
99444
|
+
x0, y0, x1, y1
|
|
99445
|
+
);
|
|
99408
99446
|
}
|
|
99409
99447
|
|
|
99410
99448
|
/**
|
|
@@ -99415,6 +99453,7 @@ class Rectangle {
|
|
|
99415
99453
|
contains(other) {
|
|
99416
99454
|
const x0 = other.position.x;
|
|
99417
99455
|
const y0 = other.position.y;
|
|
99456
|
+
|
|
99418
99457
|
const y1 = other.size.y + y0;
|
|
99419
99458
|
const x1 = other.size.x + x0;
|
|
99420
99459
|
|