@woosh/meep-engine 2.113.7 → 2.113.8

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": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.113.7",
8
+ "version": "2.113.8",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"frustum3_computeNearestPointToPoint.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js"],"names":[],"mappings":"AAyBA;;;;;;;;GAQG;AACH,4DAPW,OAAO,UACP,OAAO,YACP,MAAM,YACN,MAAM,YACN,MAAM,GACJ,OAAO,CA+EnB;oBA/GmB,kBAAkB"}
1
+ {"version":3,"file":"frustum3_computeNearestPointToPoint.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js"],"names":[],"mappings":"AAyBA;;;;;;;;GAQG;AACH,4DAPW,OAAO,UACP,OAAO,YACP,MAAM,YACN,MAAM,YACN,MAAM,GACJ,OAAO,CA+EnB;oBA9GmB,kBAAkB"}
@@ -1,11 +1,11 @@
1
- import Vector3 from "../../Vector3.js";
2
- import { plane3_projectPoint } from "../plane/plane3_projectPoint.js";
3
- import { ray_computeNearestPointToPoint } from "../ray/ray_computeNearestPointToPoint.js";
4
1
  import { v3_distance_above_plane } from "../../vec3/v3_distance_above_plane.js";
2
+ import Vector3 from "../../Vector3.js";
3
+ import { plane3_compute_plane_intersection } from "../plane/plane3_compute_plane_intersection.js";
4
+ import { plane3_project_point } from "../plane/plane3_project_point.js";
5
5
  import {
6
6
  plane3_three_compute_convex_3_plane_intersection
7
7
  } from "../plane/plane3_three_compute_convex_3_plane_intersection.js";
8
- import { plane3_compute_plane_intersection } from "../plane/plane3_compute_plane_intersection.js";
8
+ import { ray_computeNearestPointToPoint } from "../ray/ray_computeNearestPointToPoint.js";
9
9
 
10
10
  /**
11
11
  *
@@ -72,7 +72,7 @@ export function frustum3_computeNearestPointToPoint(result, planes, target_x, ta
72
72
  const plane_0_index = scratch_outer_planes[0];
73
73
  const plane_0 = planes[plane_0_index];
74
74
  // point lies outside exactly one plane
75
- plane3_projectPoint(result, target_x, target_y, target_z, plane_0.normal.z, plane_0.normal.y, plane_0.normal.z, plane_0.constant);
75
+ plane3_project_point(result, target_x, target_y, target_z, plane_0.normal.z, plane_0.normal.y, plane_0.normal.z, plane_0.constant);
76
76
  } else if (outside_plane_count === 2) {
77
77
  // outside two planes, nearest point lies on the intersection line of two planes
78
78
 
@@ -1,9 +1,10 @@
1
1
  /**
2
+ *
2
3
  * Set frustum from projection matrix
3
4
  * NOTE: uses Gribb/Hartmann method
4
5
  * @see "Fast Extraction of Viewing Frustum Planes from the WorldView-Projection Matrix", 2001 by Gribb & Hartmann
5
- * @param {number[]|Float32Array} frustum_planes
6
- * @param {number[]} m4
6
+ * @param {number[]|Float32Array} frustum_planes tuples of 4, where each tuple is a plane normal (x,y,z) followed by a planar offset constant [normal_x, normal_y, normal_z, constant]
7
+ * @param {number[]} m4 assumed to be view-projection matrix
7
8
  */
8
9
  export function frustum_from_projection_matrix_array(frustum_planes: number[] | Float32Array, m4: number[]): void;
9
10
  //# sourceMappingURL=frustum_from_projection_matrix_array.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frustum_from_projection_matrix_array.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,qEAHW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,QAkClB"}
1
+ {"version":3,"file":"frustum_from_projection_matrix_array.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qEAHW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,QAkClB"}
@@ -1,36 +1,12 @@
1
- import { v3_length } from "../../vec3/v3_length.js";
1
+ import { plane3_normalize } from "../plane/plane3_normalize.js";
2
2
 
3
3
  /**
4
4
  *
5
- * @param {number[]} destination
6
- * @param {number} destination_offset
7
- * @param {number} x
8
- * @param {number} y
9
- * @param {number} z
10
- * @param {number} w
11
- */
12
- function array_set_plane_normalized(
13
- destination, destination_offset,
14
- x, y, z, w
15
- ) {
16
- // compute vector length
17
- const length = v3_length(x, y, z);
18
-
19
- const inverse_length = 1.0 / length;
20
-
21
- // apply normalization
22
- destination[destination_offset] = x * inverse_length;
23
- destination[destination_offset + 1] = y * inverse_length;
24
- destination[destination_offset + 2] = z * inverse_length;
25
- destination[destination_offset + 3] = w * inverse_length;
26
- }
27
-
28
- /**
29
5
  * Set frustum from projection matrix
30
6
  * NOTE: uses Gribb/Hartmann method
31
7
  * @see "Fast Extraction of Viewing Frustum Planes from the WorldView-Projection Matrix", 2001 by Gribb & Hartmann
32
- * @param {number[]|Float32Array} frustum_planes
33
- * @param {number[]} m4
8
+ * @param {number[]|Float32Array} frustum_planes tuples of 4, where each tuple is a plane normal (x,y,z) followed by a planar offset constant [normal_x, normal_y, normal_z, constant]
9
+ * @param {number[]} m4 assumed to be view-projection matrix
34
10
  */
35
11
  export function frustum_from_projection_matrix_array(frustum_planes, m4) {
36
12
 
@@ -46,22 +22,22 @@ export function frustum_from_projection_matrix_array(frustum_planes, m4) {
46
22
  const me12 = m4[12];
47
23
  const me15 = m4[15];
48
24
 
49
- array_set_plane_normalized(frustum_planes, 0, me3 - me0, me7 - me4, me11 - me8, me15 - me12);
50
- array_set_plane_normalized(frustum_planes, 4, me3 + me0, me7 + me4, me11 + me8, me15 + me12);
25
+ plane3_normalize(frustum_planes, 0, me3 - me0, me7 - me4, me11 - me8, me15 - me12);
26
+ plane3_normalize(frustum_planes, 4, me3 + me0, me7 + me4, me11 + me8, me15 + me12);
51
27
 
52
28
  const me1 = m4[1];
53
29
  const me5 = m4[5];
54
30
  const me9 = m4[9];
55
31
  const me13 = m4[13];
56
32
 
57
- array_set_plane_normalized(frustum_planes, 8, me3 + me1, me7 + me5, me11 + me9, me15 + me13);
58
- array_set_plane_normalized(frustum_planes, 12, me3 - me1, me7 - me5, me11 - me9, me15 - me13);
33
+ plane3_normalize(frustum_planes, 8, me3 + me1, me7 + me5, me11 + me9, me15 + me13);
34
+ plane3_normalize(frustum_planes, 12, me3 - me1, me7 - me5, me11 - me9, me15 - me13);
59
35
 
60
36
  const me2 = m4[2];
61
37
  const me6 = m4[6];
62
38
  const me10 = m4[10];
63
39
  const me14 = m4[14];
64
40
 
65
- array_set_plane_normalized(frustum_planes, 16, me3 - me2, me7 - me6, me11 - me10, me15 - me14);
66
- array_set_plane_normalized(frustum_planes, 20, me3 + me2, me7 + me6, me11 + me10, me15 + me14);
41
+ plane3_normalize(frustum_planes, 16, me3 - me2, me7 - me6, me11 - me10, me15 - me14);
42
+ plane3_normalize(frustum_planes, 20, me3 + me2, me7 + me6, me11 + me10, me15 + me14);
67
43
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes plane representation
3
+ * @param {number[]} destination
4
+ * @param {number} destination_offset
5
+ * @param {number} x plane normal X
6
+ * @param {number} y plane normal Y
7
+ * @param {number} z plane normal Z
8
+ * @param {number} w planar offset constant
9
+ */
10
+ export function plane3_normalize(destination: number[], destination_offset: number, x: number, y: number, z: number, w: number): void;
11
+ //# sourceMappingURL=plane3_normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane3_normalize.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_normalize.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,8CAPW,MAAM,EAAE,sBACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB"}
@@ -0,0 +1,26 @@
1
+ import { v3_length } from "../../vec3/v3_length.js";
2
+
3
+ /**
4
+ * Normalizes plane representation
5
+ * @param {number[]} destination
6
+ * @param {number} destination_offset
7
+ * @param {number} x plane normal X
8
+ * @param {number} y plane normal Y
9
+ * @param {number} z plane normal Z
10
+ * @param {number} w planar offset constant
11
+ */
12
+ export function plane3_normalize(
13
+ destination, destination_offset,
14
+ x, y, z, w
15
+ ) {
16
+ // compute vector length
17
+ const length = v3_length(x, y, z);
18
+
19
+ const inverse_length = 1.0 / length;
20
+
21
+ // apply normalization
22
+ destination[destination_offset] = x * inverse_length;
23
+ destination[destination_offset + 1] = y * inverse_length;
24
+ destination[destination_offset + 2] = z * inverse_length;
25
+ destination[destination_offset + 3] = w * inverse_length;
26
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Project a point onto a plane
3
+ * @param {Vector3} result
4
+ * @param {number} point_x
5
+ * @param {number} point_y
6
+ * @param {number} point_z
7
+ * @param {number} normal_x
8
+ * @param {number} normal_y
9
+ * @param {number} normal_z
10
+ * @param {number} plane_offset
11
+ */
12
+ export function plane3_project_point(result: Vector3, point_x: number, point_y: number, point_z: number, normal_x: number, normal_y: number, normal_z: number, plane_offset: number): void;
13
+ //# sourceMappingURL=plane3_project_point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane3_project_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_project_point.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,+DARW,MAAM,WACN,MAAM,WACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,gBACN,MAAM,QAgBhB"}
@@ -1,7 +1,7 @@
1
1
  import { v3_distance_above_plane } from "../../vec3/v3_distance_above_plane.js";
2
2
 
3
3
  /**
4
- *
4
+ * Project a point onto a plane
5
5
  * @param {Vector3} result
6
6
  * @param {number} point_x
7
7
  * @param {number} point_y
@@ -11,7 +11,11 @@ import { v3_distance_above_plane } from "../../vec3/v3_distance_above_plane.js";
11
11
  * @param {number} normal_z
12
12
  * @param {number} plane_offset
13
13
  */
14
- export function plane3_projectPoint(result, point_x, point_y, point_z, normal_x, normal_y, normal_z, plane_offset) {
14
+ export function plane3_project_point(
15
+ result,
16
+ point_x, point_y, point_z,
17
+ normal_x, normal_y, normal_z, plane_offset
18
+ ) {
15
19
  const distance = v3_distance_above_plane(point_x, point_y, point_z, normal_x, normal_y, normal_z, plane_offset);
16
20
 
17
21
  const negative_distance = -distance;
@@ -1,15 +0,0 @@
1
- /**
2
- *
3
- * @param {number} x
4
- * @param {number} y
5
- * @param {number} z
6
- * @param {number} plane_mask
7
- * @param {number[]} planes
8
- * @param {number} plane_count
9
- * @param {function} callback
10
- * @param {*} [thisArg]
11
- * @return {boolean}
12
- * @private
13
- */
14
- export function __process_point_if_within_planes(x: number, y: number, z: number, plane_mask: number, planes: number[], plane_count: number, callback: Function, thisArg?: any): boolean;
15
- //# sourceMappingURL=__process_point_if_within_planes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__process_point_if_within_planes.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/traversal/__process_point_if_within_planes.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,oDAXW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,UACN,MAAM,EAAE,eACR,MAAM,sCAGL,OAAO,CAyClB"}
@@ -1,56 +0,0 @@
1
- import { v3_distance_above_plane } from "../../geom/vec3/v3_distance_above_plane.js";
2
- import { EPSILON } from "../../math/EPSILON.js";
3
-
4
- /**
5
- *
6
- * @param {number} x
7
- * @param {number} y
8
- * @param {number} z
9
- * @param {number} plane_mask
10
- * @param {number[]} planes
11
- * @param {number} plane_count
12
- * @param {function} callback
13
- * @param {*} [thisArg]
14
- * @return {boolean}
15
- * @private
16
- */
17
- export function __process_point_if_within_planes(
18
- x, y, z,
19
- plane_mask,
20
- planes,
21
- plane_count,
22
- callback,
23
- thisArg
24
- ) {
25
-
26
-
27
- for (let plane_index = 0; plane_index < plane_count; plane_index++) {
28
- const plane_bit_mask = 1 << plane_index;
29
-
30
- if ((plane_mask & plane_bit_mask) === 0) {
31
- // non-intersecting plane, ignore
32
- continue;
33
- }
34
-
35
- const plane_address = plane_index * 4;
36
-
37
- const nx = planes[plane_address];
38
- const ny = planes[plane_address + 1];
39
- const nz = planes[plane_address + 2];
40
- const c = planes[plane_address + 3];
41
-
42
- const distance_to_plane = v3_distance_above_plane(x, y, z, nx, ny, nz, c);
43
-
44
- if (distance_to_plane < -EPSILON) {
45
- // point is outside of one of the planes
46
- return false;
47
- }
48
- }
49
-
50
- callback.call(thisArg, x, y, z);
51
-
52
- // ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_1.send3(x, y, z);
53
-
54
- return true;
55
- }
56
-
@@ -1,13 +0,0 @@
1
- /**
2
- *
3
- * @param {Vector3} result
4
- * @param {number} point_x
5
- * @param {number} point_y
6
- * @param {number} point_z
7
- * @param {number} normal_x
8
- * @param {number} normal_y
9
- * @param {number} normal_z
10
- * @param {number} plane_offset
11
- */
12
- export function plane3_projectPoint(result: Vector3, point_x: number, point_y: number, point_z: number, normal_x: number, normal_y: number, normal_z: number, plane_offset: number): void;
13
- //# sourceMappingURL=plane3_projectPoint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plane3_projectPoint.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_projectPoint.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,8DARW,MAAM,WACN,MAAM,WACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,gBACN,MAAM,QAYhB"}