@woosh/meep-engine 2.117.20 → 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 CHANGED
@@ -11,7 +11,7 @@ To help get you started, various samples are provided under `/samples` folder. F
11
11
 
12
12
  ## Documentation
13
13
 
14
- [Engine Documentation](http://meep-engine.company-named.com:8080/docs/api/)
14
+ [Engine Documentation](http://meep-engine.company-named.com:8080/docs/getting_started/Installation)
15
15
 
16
16
  ## Features
17
17
 
@@ -53,4 +53,4 @@ You're free to use it or not, the engine works just fine without it. The system
53
53
  For more information, please refer to the documentation
54
54
 
55
55
  ---
56
- Copyright © 2023 Company Named Limited, All Rights Reserved
56
+ Copyright © 2024 Company Named Limited, All Rights Reserved
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.20",
8
+ "version": "2.117.21",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -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,QA4Ff;sBA3GqB,6BAA6B"}
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 = new AABB3()
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
- build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, bounds.x0, bounds.y0, bounds.z0, bounds.x1, bounds.y1, bounds.z1);
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,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,SAC1B,YAAY,GAAC,MAAM,EAAE,OAAK,GACxB,OAAO,CA+DnB"}
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":"AA+CA;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,QAwC9B;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;sBA3oBqB,wCAAwC;8BAKhC,2CAA2C"}
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,