@woosh/meep-engine 2.131.41 → 2.131.43

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.131.41",
8
+ "version": "2.131.43",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param {number[]} result
4
+ * @param {number} result_offset
5
+ * @param {BVH} bvh
6
+ * @param {number[]|Float32Array|AABB3} aabb
7
+ */
8
+ export function bvh_query_user_data_overlaps_aabb(result: number[], result_offset: number, bvh: BVH, aabb: number[] | Float32Array | AABB3): number;
9
+ //# sourceMappingURL=bvh_query_user_data_overlaps_aabb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bvh_query_user_data_overlaps_aabb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,0DALW,MAAM,EAAE,iBACR,MAAM,kBAEN,MAAM,EAAE,GAAC,YAAY,QAAM,UAoErC"}
@@ -0,0 +1,83 @@
1
+ //
2
+ import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
3
+ import { aabb3_intersects_aabb3 } from "../../../geom/3d/aabb/aabb3_intersects_aabb3.js";
4
+ import { NULL_NODE } from "../BVH.js";
5
+
6
+ const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
7
+
8
+ const scratch_aabb = new Float32Array(6);
9
+
10
+ /**
11
+ *
12
+ * @param {number[]} result
13
+ * @param {number} result_offset
14
+ * @param {BVH} bvh
15
+ * @param {number[]|Float32Array|AABB3} aabb
16
+ */
17
+ export function bvh_query_user_data_overlaps_aabb(
18
+ result,
19
+ result_offset,
20
+ bvh,
21
+ aabb
22
+ ) {
23
+ const root = bvh.root;
24
+
25
+ if (root === NULL_NODE) {
26
+ return 0;
27
+ }
28
+
29
+ /**
30
+ *
31
+ * @type {number}
32
+ */
33
+ const stack_top = stack.pointer++;
34
+
35
+ stack[stack_top] = root;
36
+
37
+ let result_cursor = result_offset;
38
+
39
+ while (stack.pointer > stack_top) {
40
+ stack.pointer--;
41
+
42
+ /**
43
+ *
44
+ * @type {number}
45
+ */
46
+ const node = stack[stack.pointer];
47
+
48
+ // test node against the ray
49
+ bvh.node_get_aabb(node, scratch_aabb);
50
+
51
+ const intersection_exists = aabb3_intersects_aabb3(
52
+ scratch_aabb[0], scratch_aabb[1], scratch_aabb[2],
53
+ scratch_aabb[3], scratch_aabb[4], scratch_aabb[5],
54
+ aabb[0], aabb[1], aabb[2],
55
+ aabb[3], aabb[4], aabb[5]
56
+ )
57
+
58
+ if (!intersection_exists) {
59
+ // fully outside
60
+ continue;
61
+ }
62
+
63
+ const node_is_leaf = bvh.node_is_leaf(node);
64
+
65
+ if (node_is_leaf) {
66
+ // leaf node
67
+ result[result_cursor++] = bvh.node_get_user_data(node);
68
+
69
+ } else {
70
+ // read in-order
71
+ const child1 = bvh.node_get_child1(node);
72
+ const child2 = bvh.node_get_child2(node);
73
+
74
+ // write to stack in reverse order, so that fist child ends up being visited first
75
+ stack[stack.pointer++] = child1;
76
+ stack[stack.pointer++] = child2;
77
+ }
78
+ }
79
+
80
+ // drop stack frame
81
+
82
+ return result_cursor - result_offset;
83
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Constructs an orthographic frustum from an Axis-Aligned Bounding Box.
3
+ * The planes are stored as 4-tuples (nx, ny, nz, d).
4
+ * @param {Float32Array|number[]} output
5
+ * @param {number} output_offset
6
+ * @param {number} x0 - Minimum X
7
+ * @param {number} y0 - Minimum Y
8
+ * @param {number} z0 - Minimum Z
9
+ * @param {number} x1 - Maximum X
10
+ * @param {number} y1 - Maximum Y
11
+ * @param {number} z1 - Maximum Z
12
+ */
13
+ export function frustum_from_aabb(output: Float32Array | number[], output_offset: number, x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): void;
14
+ //# sourceMappingURL=frustum_from_aabb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frustum_from_aabb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_from_aabb.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,0CATW,YAAY,GAAC,MAAM,EAAE,iBACrB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QA4ChB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Constructs an orthographic frustum from an Axis-Aligned Bounding Box.
3
+ * The planes are stored as 4-tuples (nx, ny, nz, d).
4
+ * @param {Float32Array|number[]} output
5
+ * @param {number} output_offset
6
+ * @param {number} x0 - Minimum X
7
+ * @param {number} y0 - Minimum Y
8
+ * @param {number} z0 - Minimum Z
9
+ * @param {number} x1 - Maximum X
10
+ * @param {number} y1 - Maximum Y
11
+ * @param {number} z1 - Maximum Z
12
+ */
13
+ export function frustum_from_aabb(
14
+ output,
15
+ output_offset,
16
+ x0, y0, z0,
17
+ x1, y1, z1
18
+ ){
19
+
20
+ // Left plane (x = x0): Normal points +X
21
+ output[output_offset + 0] = 1;
22
+ output[output_offset + 1] = 0;
23
+ output[output_offset + 2] = 0;
24
+ output[output_offset + 3] = -x0;
25
+
26
+ // Right plane (x = x1): Normal points -X
27
+ output[output_offset + 4] = -1;
28
+ output[output_offset + 5] = 0;
29
+ output[output_offset + 6] = 0;
30
+ output[output_offset + 7] = x1;
31
+
32
+ // Bottom plane (y = y0): Normal points +Y
33
+ output[output_offset + 8] = 0;
34
+ output[output_offset + 9] = 1;
35
+ output[output_offset + 10] = 0;
36
+ output[output_offset + 11] = -y0;
37
+
38
+ // Top plane (y = y1): Normal points -Y
39
+ output[output_offset + 12] = 0;
40
+ output[output_offset + 13] = -1;
41
+ output[output_offset + 14] = 0;
42
+ output[output_offset + 15] = y1;
43
+
44
+ // Near plane (z = z0): Normal points +Z
45
+ output[output_offset + 16] = 0;
46
+ output[output_offset + 17] = 0;
47
+ output[output_offset + 18] = 1;
48
+ output[output_offset + 19] = -z0;
49
+
50
+ // Far plane (z = z1): Normal points -Z
51
+ output[output_offset + 20] = 0;
52
+ output[output_offset + 21] = 0;
53
+ output[output_offset + 22] = -1;
54
+ output[output_offset + 23] = z1;
55
+ }