@woosh/meep-engine 2.131.45 → 2.131.46

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.45",
8
+ "version": "2.131.46",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Perform affine transform on a given frustum
3
+ * @param {number[]|Float32Array|Float64Array} output
4
+ * @param {number} output_offset
5
+ * @param {number[]|Float32Array|Float64Array} input
6
+ * @param {number} input_offset
7
+ * @param {number} plane_count
8
+ * @param {number[]|Float32Array|Float64Array} matrix4
9
+ */
10
+ export function clipping_volume_matrix4_project(output: number[] | Float32Array | Float64Array, output_offset: number, input: number[] | Float32Array | Float64Array, input_offset: number, plane_count: number, matrix4: number[] | Float32Array | Float64Array): void;
11
+ //# sourceMappingURL=clipping_volume_matrix4_project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipping_volume_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/clipping_volume_matrix4_project.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wDAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,eACN,MAAM,WACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAkC5C"}
@@ -0,0 +1,45 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { plane3_matrix4_project } from "../plane/plane3_matrix4_project.js";
3
+
4
+ /**
5
+ * Perform affine transform on a given frustum
6
+ * @param {number[]|Float32Array|Float64Array} output
7
+ * @param {number} output_offset
8
+ * @param {number[]|Float32Array|Float64Array} input
9
+ * @param {number} input_offset
10
+ * @param {number} plane_count
11
+ * @param {number[]|Float32Array|Float64Array} matrix4
12
+ */
13
+ export function clipping_volume_matrix4_project(
14
+ output, output_offset,
15
+ input, input_offset,
16
+ plane_count,
17
+ matrix4
18
+ ) {
19
+ assert.isArrayLike(output, 'output');
20
+ assert.isNonNegativeInteger(output_offset, "output_offset");
21
+
22
+ assert.isArrayLike(input, 'input');
23
+ assert.greaterThanOrEqual(input.length, input_offset + plane_count*4, 'input too small');
24
+ assert.isNonNegativeInteger(input_offset, "input_offset");
25
+
26
+ assert.isArrayLike(matrix4, 'matrix4');
27
+
28
+ for (let plane_index = 0; plane_index < plane_count; plane_index++) {
29
+ const frustum_offset = plane_index * 4;
30
+
31
+ const i = input_offset + frustum_offset;
32
+ const o = output_offset + frustum_offset;
33
+
34
+ plane3_matrix4_project(
35
+ output, o,
36
+ matrix4,
37
+ input[i],
38
+ input[i + 1],
39
+ input[i + 2],
40
+ input[i + 3],
41
+ );
42
+
43
+ }
44
+
45
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"frustum_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_matrix4_project.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,gDANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,WACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAiC5C"}
1
+ {"version":3,"file":"frustum_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_matrix4_project.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,gDANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,WACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAQ5C"}
@@ -1,5 +1,5 @@
1
- import { assert } from "../../../assert.js";
2
- import { plane3_matrix4_project } from "../plane/plane3_matrix4_project.js";
1
+ import { clipping_volume_matrix4_project } from "./clipping_volume_matrix4_project.js";
2
+
3
3
 
4
4
  /**
5
5
  * Perform affine transform on a given frustum
@@ -13,31 +13,6 @@ export function frustum_matrix4_project(
13
13
  output, output_offset,
14
14
  input, input_offset,
15
15
  matrix4
16
- ) {
17
- assert.isArrayLike(output, 'output');
18
- assert.isNonNegativeInteger(output_offset, "output_offset");
19
-
20
- assert.isArrayLike(input, 'input');
21
- assert.greaterThanOrEqual(input.length, input_offset + 24, 'input too small');
22
- assert.isNonNegativeInteger(input_offset, "input_offset");
23
-
24
- assert.isArrayLike(matrix4, 'matrix4');
25
-
26
- for (let plane_index = 0; plane_index < 6; plane_index++) {
27
- const frustum_offset = plane_index * 4;
28
-
29
- const i = input_offset + frustum_offset;
30
- const o = output_offset + frustum_offset;
31
-
32
- plane3_matrix4_project(
33
- output, o,
34
- matrix4,
35
- input[i],
36
- input[i + 1],
37
- input[i + 2],
38
- input[i + 3],
39
- );
40
-
41
- }
42
-
16
+ ){
17
+ clipping_volume_matrix4_project(output, output_offset, input, input_offset, 6, matrix4);
43
18
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Constructs an orthographic hexahedron from an Axis-Aligned Bounding Box.
3
+ * The planes are stored as 4-tuples (nx, ny, nz, d).
4
+ *
5
+ * Normals are facing inwards, i.e., the volume of positive.
6
+ *
7
+ * This can also be used for an orthographic camera frustum.
8
+ *
9
+ * @param {Float32Array|number[]} output
10
+ * @param {number} output_offset
11
+ * @param {number} x0 - Minimum X
12
+ * @param {number} y0 - Minimum Y
13
+ * @param {number} z0 - Minimum Z
14
+ * @param {number} x1 - Maximum X
15
+ * @param {number} y1 - Maximum Y
16
+ * @param {number} z1 - Maximum Z
17
+ */
18
+ export function hexahedron_from_aabb(output: Float32Array | number[], output_offset: number, x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): void;
19
+ //# sourceMappingURL=hexahedron_from_aabb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexahedron_from_aabb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/hexahedron_from_aabb.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,6CATW,YAAY,GAAC,MAAM,EAAE,iBACrB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QA4ChB"}
@@ -1,6 +1,11 @@
1
1
  /**
2
- * Constructs an orthographic frustum from an Axis-Aligned Bounding Box.
2
+ * Constructs an orthographic hexahedron from an Axis-Aligned Bounding Box.
3
3
  * The planes are stored as 4-tuples (nx, ny, nz, d).
4
+ *
5
+ * Normals are facing inwards, i.e., the volume of positive.
6
+ *
7
+ * This can also be used for an orthographic camera frustum.
8
+ *
4
9
  * @param {Float32Array|number[]} output
5
10
  * @param {number} output_offset
6
11
  * @param {number} x0 - Minimum X
@@ -10,36 +15,36 @@
10
15
  * @param {number} y1 - Maximum Y
11
16
  * @param {number} z1 - Maximum Z
12
17
  */
13
- export function frustum_from_aabb(
18
+ export function hexahedron_from_aabb(
14
19
  output,
15
20
  output_offset,
16
21
  x0, y0, z0,
17
22
  x1, y1, z1
18
23
  ){
19
-
20
- // Left plane (x = x0): Normal points +X
21
- output[output_offset + 0] = 1;
24
+
25
+ // Right plane (x = x1): Normal points -X
26
+ output[output_offset + 0] = -1;
22
27
  output[output_offset + 1] = 0;
23
28
  output[output_offset + 2] = 0;
24
- output[output_offset + 3] = -x0;
29
+ output[output_offset + 3] = x1;
25
30
 
26
- // Right plane (x = x1): Normal points -X
27
- output[output_offset + 4] = -1;
31
+ // Left plane (x = x0): Normal points +X
32
+ output[output_offset + 4] = 1;
28
33
  output[output_offset + 5] = 0;
29
34
  output[output_offset + 6] = 0;
30
- output[output_offset + 7] = x1;
35
+ output[output_offset + 7] = -x0;
31
36
 
32
- // Bottom plane (y = y0): Normal points +Y
37
+ // Top plane (y = y1): Normal points -Y
33
38
  output[output_offset + 8] = 0;
34
- output[output_offset + 9] = 1;
39
+ output[output_offset + 9] = -1;
35
40
  output[output_offset + 10] = 0;
36
- output[output_offset + 11] = -y0;
41
+ output[output_offset + 11] = y1;
37
42
 
38
- // Top plane (y = y1): Normal points -Y
43
+ // Bottom plane (y = y0): Normal points +Y
39
44
  output[output_offset + 12] = 0;
40
- output[output_offset + 13] = -1;
45
+ output[output_offset + 13] = 1;
41
46
  output[output_offset + 14] = 0;
42
- output[output_offset + 15] = y1;
47
+ output[output_offset + 15] = -y0;
43
48
 
44
49
  // Near plane (z = z0): Normal points +Z
45
50
  output[output_offset + 16] = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"plane3_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_matrix4_project.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,oDARW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,sBAClC,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAuBhB"}
1
+ {"version":3,"file":"plane3_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_matrix4_project.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,oDARW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,sBAClC,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAyBhB"}
@@ -19,6 +19,8 @@ export function plane3_matrix4_project(
19
19
  x, y, z, w,
20
20
  ) {
21
21
 
22
+ // the formula is = vec4*T(-mat4)
23
+
22
24
  m4_invert(mat_inv, matrix);
23
25
 
24
26
  // multiply by transpose
@@ -1 +1 @@
1
- {"version":3,"file":"bvh32_geometry_overlap_clipping_volume.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;GAYG;AACH,uFAVW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,UACpC,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,eACN,MAAM,GACJ,OAAO,CAmFnB"}
1
+ {"version":3,"file":"bvh32_geometry_overlap_clipping_volume.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;GAYG;AACH,uFAVW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,UACpC,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,eACN,MAAM,GACJ,OAAO,CAuFnB"}
@@ -32,6 +32,10 @@ export function bvh32_geometry_overlap_clipping_volume(
32
32
  planes, planes_offset, plane_count
33
33
  ) {
34
34
 
35
+ assert.isBoolean(vertex_data_normalized, 'vertex_data_normalized');
36
+ assert.isNonNegativeInteger(planes_offset, 'planes_offset');
37
+ assert.isNonNegativeInteger(plane_count, 'plane_count');
38
+
35
39
  const hit_count = bvh32_query_user_data_overlaps_clipping_volume(
36
40
  scratch_array, 0,
37
41
  bvh,
@@ -79,7 +83,7 @@ export function bvh32_geometry_overlap_clipping_volume(
79
83
  let cz = vertices[c_address + 2];
80
84
 
81
85
  // denormalize if necessary
82
- if(vertex_data_normalized) {
86
+ if (vertex_data_normalized) {
83
87
  ax = typed_array_value_denormalize(ax, vertices);
84
88
  ay = typed_array_value_denormalize(ay, vertices);
85
89
  az = typed_array_value_denormalize(az, vertices);
@@ -1,14 +0,0 @@
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
@@ -1 +0,0 @@
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"}