@woosh/meep-engine 2.117.36 → 2.117.37

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.117.36",
8
+ "version": "2.117.37",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -2,9 +2,9 @@ import { assert } from "../../assert.js";
2
2
  import { array_copy } from "../../collection/array/array_copy.js";
3
3
  import { array_range_equal_strict } from "../../collection/array/array_range_equal_strict.js";
4
4
  import { computeHashFloatArray } from "../../math/hash/computeHashFloatArray.js";
5
+ import { v3_array_matrix4_rotate } from "../vec3/v3_array_matrix4_rotate.js";
5
6
  import { v3_array_normalize } from "../vec3/v3_array_normalize.js";
6
7
  import { v3_matrix4_multiply } from "../vec3/v3_matrix4_multiply.js";
7
- import { v3_matrix4_rotate } from "../vec3/v3_matrix4_rotate.js";
8
8
  import { ray3_interval_array_apply_matrix4 } from "./ray/ray3_interval_array_apply_matrix4.js";
9
9
 
10
10
  /**
@@ -175,7 +175,7 @@ export class Ray3 extends Float32Array {
175
175
 
176
176
  // special case
177
177
  v3_matrix4_multiply(this, 0, this, 0, m4);
178
- v3_matrix4_rotate(this, 3, this, 3, m4);
178
+ v3_array_matrix4_rotate(this, 3, this, 3, m4);
179
179
 
180
180
  }
181
181
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float64Array|Float32Array} destination
4
+ * @param {number} destination_offset
5
+ * @param {number[]|Float32Array|Float64Array} matrix
6
+ * @param {number} x
7
+ * @param {number} y
8
+ * @param {number} z
9
+ * @param {number} w
10
+ */
11
+ export function plane3_matrix4_project(destination: number[] | Float64Array | Float32Array, destination_offset: number, matrix: number[] | Float32Array | Float64Array, x: number, y: number, z: number, w: number): void;
12
+ //# sourceMappingURL=plane3_matrix4_project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane3_matrix4_project.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/plane/plane3_matrix4_project.js"],"names":[],"mappings":"AAOA;;;;;;;;;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,QAiBhB"}
@@ -0,0 +1,33 @@
1
+ import { v3_dot_array_array } from "../../vec3/v3_dot_array_array.js";
2
+ import { v3_matrix4_multiply } from "../../vec3/v3_matrix4_multiply.js";
3
+ import { v3_matrix4_rotate } from "../../vec3/v3_matrix4_rotate.js";
4
+ import { v3_multiply_scalar } from "../../vec3/v3_multiply_scalar.js";
5
+
6
+ const scratch_v3_0 = new Float32Array(3);
7
+
8
+ /**
9
+ *
10
+ * @param {number[]|Float64Array|Float32Array} destination
11
+ * @param {number} destination_offset
12
+ * @param {number[]|Float32Array|Float64Array} matrix
13
+ * @param {number} x
14
+ * @param {number} y
15
+ * @param {number} z
16
+ * @param {number} w
17
+ */
18
+ export function plane3_matrix4_project(
19
+ destination, destination_offset,
20
+ matrix,
21
+ x, y, z, w,
22
+ ) {
23
+
24
+ // build reference point in the new pane
25
+ v3_multiply_scalar(scratch_v3_0, 0, x, y, z, -w);
26
+ v3_matrix4_multiply(scratch_v3_0, 0, scratch_v3_0, 0, matrix);
27
+
28
+ // construct rotation matrix for the normal
29
+ v3_matrix4_rotate(destination, destination_offset, x, y, z, matrix);
30
+
31
+ // figure out new planar offset using new orientation and a reference point
32
+ destination[destination_offset + 3] = -v3_dot_array_array(scratch_v3_0, 0, destination, destination_offset);
33
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Perform rotation on a direction vector using 3x3 portion of a 4x4 matrix
3
+ * NOTE: produces a normalized vector
4
+ * @param {number[]|Float32Array} output
5
+ * @param {number} output_offset
6
+ * @param {number[]|Float32Array} input
7
+ * @param {number} input_offset
8
+ * @param {number[]|Float32Array} m4
9
+ */
10
+ export function v3_array_matrix4_rotate(output: number[] | Float32Array, output_offset: number, input: number[] | Float32Array, input_offset: number, m4: number[] | Float32Array): void;
11
+ //# sourceMappingURL=v3_array_matrix4_rotate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_array_matrix4_rotate.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_array_matrix4_rotate.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,gDANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAY/B"}
@@ -0,0 +1,22 @@
1
+ import { v3_matrix4_rotate } from "./v3_matrix4_rotate.js";
2
+
3
+ /**
4
+ * Perform rotation on a direction vector using 3x3 portion of a 4x4 matrix
5
+ * NOTE: produces a normalized vector
6
+ * @param {number[]|Float32Array} output
7
+ * @param {number} output_offset
8
+ * @param {number[]|Float32Array} input
9
+ * @param {number} input_offset
10
+ * @param {number[]|Float32Array} m4
11
+ */
12
+ export function v3_array_matrix4_rotate(
13
+ output, output_offset,
14
+ input, input_offset,
15
+ m4
16
+ ) {
17
+ const x = input[input_offset];
18
+ const y = input[input_offset + 1];
19
+ const z = input[input_offset + 2];
20
+
21
+ v3_matrix4_rotate(output,output_offset,x,y,z,m4);
22
+ }
@@ -2,9 +2,10 @@
2
2
  * Perform rotation on a direction vector using 3x3 portion of a 4x4 matrix
3
3
  * @param {number[]|Float32Array} output
4
4
  * @param {number} output_offset
5
- * @param {number[]|Float32Array} input
6
- * @param {number} input_offset
5
+ * @param {number} x
6
+ * @param {number} y
7
+ * @param {number} z
7
8
  * @param {number[]|Float32Array} m4
8
9
  */
9
- export function v3_matrix4_rotate(output: number[] | Float32Array, output_offset: number, input: number[] | Float32Array, input_offset: number, m4: number[] | Float32Array): void;
10
+ export function v3_matrix4_rotate(output: number[] | Float32Array, output_offset: number, x: number, y: number, z: number, m4: number[] | Float32Array): void;
10
11
  //# sourceMappingURL=v3_matrix4_rotate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v3_matrix4_rotate.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_matrix4_rotate.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0CANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAoB/B"}
1
+ {"version":3,"file":"v3_matrix4_rotate.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_matrix4_rotate.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,0CAPW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAkB/B"}
@@ -4,26 +4,25 @@ import { v3_length } from "./v3_length.js";
4
4
  * Perform rotation on a direction vector using 3x3 portion of a 4x4 matrix
5
5
  * @param {number[]|Float32Array} output
6
6
  * @param {number} output_offset
7
- * @param {number[]|Float32Array} input
8
- * @param {number} input_offset
7
+ * @param {number} x
8
+ * @param {number} y
9
+ * @param {number} z
9
10
  * @param {number[]|Float32Array} m4
10
11
  */
11
12
  export function v3_matrix4_rotate(
12
13
  output, output_offset,
13
- input, input_offset,
14
+ x, y, z,
14
15
  m4
15
16
  ) {
16
- const x = input[input_offset];
17
- const y = input[input_offset + 1];
18
- const z = input[input_offset + 2];
19
17
 
20
18
  const _x = m4[0] * x + m4[4] * y + m4[8] * z;
21
19
  const _y = m4[1] * x + m4[5] * y + m4[9] * z;
22
20
  const _z = m4[2] * x + m4[6] * y + m4[10] * z;
23
21
 
22
+ // perform normalization
24
23
  const norm = 1 / v3_length(_x, _y, _z);
25
24
 
26
25
  output[output_offset] = _x * norm;
27
26
  output[output_offset + 1] = _y * norm;
28
27
  output[output_offset + 2] = _z * norm;
29
- }
28
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float64Array|Float32Array} result
4
+ * @param {number} result_offset
5
+ * @param {number} x
6
+ * @param {number} y
7
+ * @param {number} z
8
+ * @param {number} scalar
9
+ */
10
+ export function v3_multiply_scalar(result: number[] | Float64Array | Float32Array, result_offset: number, x: number, y: number, z: number, scalar: number): void;
11
+ //# sourceMappingURL=v3_multiply_scalar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3_multiply_scalar.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_multiply_scalar.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,2CAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,QAWhB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float64Array|Float32Array} result
4
+ * @param {number} result_offset
5
+ * @param {number} x
6
+ * @param {number} y
7
+ * @param {number} z
8
+ * @param {number} scalar
9
+ */
10
+ export function v3_multiply_scalar(
11
+ result, result_offset,
12
+ x, y, z, scalar
13
+ ) {
14
+
15
+ result[result_offset] = x * scalar;
16
+ result[result_offset + 1] = y * scalar;
17
+ result[result_offset + 2] = z * scalar;
18
+
19
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"geometry_compute_vertex_normals_unindexed.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_unindexed.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,qEAJW,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,YAAY,gBAC3B,MAAM,QAgChB"}
1
+ {"version":3,"file":"geometry_compute_vertex_normals_unindexed.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_unindexed.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qEAJW,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,YAAY,gBAC3B,MAAM,QA8BhB"}
@@ -1,6 +1,5 @@
1
1
  import { array_copy } from "../../../../core/collection/array/array_copy.js";
2
2
  import { geometry_construct_triangle_normal } from "../geometry_construct_triangle_normal.js";
3
- import { v3_array_normalize_many } from "./v3_array_normalize_many.js";
4
3
 
5
4
  const scratch_v3 = new Float64Array(3);
6
5
 
@@ -36,7 +35,5 @@ export function geometry_compute_vertex_normals_unindexed(
36
35
 
37
36
  }
38
37
 
39
- // ensure unit magnitude
40
-
41
- v3_array_normalize_many(normals);
38
+ // no need to normalize, that's already handled during normal construction for each triangle
42
39
  }
@@ -1,4 +1,4 @@
1
- import { v3_matrix4_rotate } from "../../../../core/geom/vec3/v3_matrix4_rotate.js";
1
+ import { v3_array_matrix4_rotate } from "../../../../core/geom/vec3/v3_array_matrix4_rotate.js";
2
2
 
3
3
 
4
4
  /**
@@ -26,6 +26,6 @@ export function ray_hit_apply_transform(output, hit, m) {
26
26
  output[2] = result_p_z;
27
27
 
28
28
  // transform normal
29
- v3_matrix4_rotate(output, 3, hit, 3, m);
29
+ v3_array_matrix4_rotate(output, 3, hit, 3, m);
30
30
 
31
31
  }
@@ -1,7 +1,7 @@
1
1
  import { vec3 } from "gl-matrix";
2
2
  import { dataTypeFromTypedArray } from "../../../../../core/binary/type/dataTypeFromTypedArray.js";
3
+ import { v3_array_matrix4_rotate } from "../../../../../core/geom/vec3/v3_array_matrix4_rotate.js";
3
4
  import { v3_distance_sqr } from "../../../../../core/geom/vec3/v3_distance_sqr.js";
4
- import { v3_matrix4_rotate } from "../../../../../core/geom/vec3/v3_matrix4_rotate.js";
5
5
  import { decode_attribute_value } from "../../../geometry/decode_attribute_value.js";
6
6
  import { geometry_construct_triangle_normal } from "../../../geometry/geometry_construct_triangle_normal.js";
7
7
  import { sample_triangle_attribute } from "../geometry/sample_triangle_attribute.js";
@@ -86,7 +86,7 @@ export function sample_material(
86
86
  }
87
87
 
88
88
  // apply transform
89
- v3_matrix4_rotate(out, 3, out, 3, mesh.transform);
89
+ v3_array_matrix4_rotate(out, 3, out, 3, mesh.transform);
90
90
 
91
91
  material.normal.sample(normal, texture_uv[0], texture_uv[1]);
92
92