@woosh/meep-engine 2.117.19 → 2.117.21
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/README.md +2 -2
- package/build/meep.cjs +2 -0
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +2 -0
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +25 -5
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +2 -0
- package/src/core/geom/3d/mat4/m4_invert.d.ts +3 -3
- package/src/core/geom/3d/mat4/m4_invert.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_invert.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +3 -2
package/build/meep.module.js
CHANGED
|
@@ -60639,8 +60639,10 @@ class HashMap {
|
|
|
60639
60639
|
|
|
60640
60640
|
if (new_index !== existing_entry_index) {
|
|
60641
60641
|
// move entries to the new position, compacting holes
|
|
60642
|
+
const temp = entries[new_index];
|
|
60642
60643
|
|
|
60643
60644
|
entries[new_index] = entries[existing_entry_index];
|
|
60645
|
+
entries[existing_entry_index] = temp;
|
|
60644
60646
|
}
|
|
60645
60647
|
|
|
60646
60648
|
let bin_index = this.compute_bin_index(hash);
|
package/package.json
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashMap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/map/HashMap.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;GAYG;AACH,uFAIC;AA8FD;;;;;;;GAOG;AACH;IA+DI;;;;;;OAMG;IACH,4FALuB,MAAM,EAsC5B;IAtGD;;;;OAIG;IACH,QAFU,WAAW,CAED;IAEpB;;;OAGG;IACH,WAFU,MAAM,aAAa,CAAC,EAAC,CAAC,CAAC,CAAC,CAET;IAEzB;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX,oBAAgB;IAEhB;;;OAGG;IACH,2BAFU,MAAM,CAEc;IAE9B,iCAA6B;IAE7B,qCAAiC;IAEjC;;;OAGG;IACH,kBAFU,MAAM,CAEK;IAErB;;;;OAIG;IACH,sBAAoC;IAEpC;;;OAGG;IACH,WAFU,MAAM,CAEF;IAwBV;;;;;OAKG;IACH,iCAAsC;IACtC;;;;;OAKG;IACH,qCAA8C;IAOlD,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IA2CD;;;;;OAKG;IACH,0BAUC;IAsGD;;;;OAIG;IACH,SAHW,CAAC,SACD,CAAC,QA0EX;IAED;;;;OAIG;IACH,SAHW,CAAC,GACC,CAAC,GAAC,SAAS,CA+BvB;IAED;;;;;;;;OAQG;IACH,kBALW,CAAC,kBACQ,CAAC,KAAE,CAAC,0BAEZ,CAAC,CAgBZ;IAED;;;;;OAKG;IACH,cAJW,CAAC,SACD,CAAC,GACA,CAAC,CAYZ;IAwBD;;;;OAIG;IACH,YAHW,CAAC,GACC,OAAO,CA+CnB;IAED;;;;;OAKG;IACH,4CAFa,OAAO,CA+BnB;IAOD;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"HashMap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/map/HashMap.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;GAYG;AACH,uFAIC;AA8FD;;;;;;;GAOG;AACH;IA+DI;;;;;;OAMG;IACH,4FALuB,MAAM,EAsC5B;IAtGD;;;;OAIG;IACH,QAFU,WAAW,CAED;IAEpB;;;OA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G;IAEd;;;OAGG;IACH,OAFU,CAAC,CAEO;IAElB;;;OAGG;IACH,MAFU,MAAM,CAEA;CAGvB"}
|
|
@@ -715,8 +715,10 @@ export class HashMap {
|
|
|
715
715
|
|
|
716
716
|
if (new_index !== existing_entry_index) {
|
|
717
717
|
// move entries to the new position, compacting holes
|
|
718
|
+
const temp = entries[new_index];
|
|
718
719
|
|
|
719
720
|
entries[new_index] = entries[existing_entry_index];
|
|
721
|
+
entries[existing_entry_index] = temp;
|
|
720
722
|
}
|
|
721
723
|
|
|
722
724
|
let bin_index = this.compute_bin_index(hash);
|
|
@@ -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,
|
|
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":"
|
|
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,
|