@woosh/meep-engine 2.119.115 → 2.119.116

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.119.115",
8
+ "version": "2.119.116",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,0CATW,GAAG,qBACH,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,aACN,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,2BACN,MAAM,0BACN,MAAM,GACJ,MAAM,CAsFlB"}
1
+ {"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,0CATW,GAAG,qBACH,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,aACN,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,2BACN,MAAM,0BACN,MAAM,GACJ,MAAM,CAoFlB"}
@@ -43,14 +43,12 @@ export function ebvh_build_hierarchy(
43
43
  for (let i = 0; i < sah_optimization_cycle_count; i++) {
44
44
 
45
45
  // sort intermediate nodes using small locality and SAH metric
46
-
47
- const offset = (i << 1) & 2; // cycle between 0 and 2
48
-
49
46
  const swap_count = ebvh_nodes_sort_sah_local4(
50
47
  bvh,
51
48
  unprocessed_nodes,
52
- offset,
53
- unprocessed_node_count - offset
49
+ 0,
50
+ (sah_optimization_cycle_count - i)*2,
51
+ unprocessed_node_count
54
52
  );
55
53
 
56
54
  if (swap_count === 0) {
@@ -4,7 +4,8 @@
4
4
  * @param {BVH} bvh
5
5
  * @param {number[]|Uint32Array} nodes
6
6
  * @param {number} offset
7
+ * @param {number} distance
7
8
  * @param {number} count
8
9
  */
9
- export function ebvh_nodes_sort_sah_local4(bvh: BVH, nodes: number[] | Uint32Array, offset: number, count: number): number;
10
+ export function ebvh_nodes_sort_sah_local4(bvh: BVH, nodes: number[] | Uint32Array, offset: number, distance: number, count: number): number;
10
11
  //# sourceMappingURL=ebvh_nodes_sort_sah_local4.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_nodes_sort_sah_local4.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,gDALW,GAAG,SACH,MAAM,EAAE,GAAC,WAAW,UACpB,MAAM,SACN,MAAM,UA6ChB"}
1
+ {"version":3,"file":"ebvh_nodes_sort_sah_local4.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,gDANW,GAAG,SACH,MAAM,EAAE,GAAC,WAAW,UACpB,MAAM,YACN,MAAM,SACN,MAAM,UA6ChB"}
@@ -4,20 +4,21 @@
4
4
  * @param {BVH} bvh
5
5
  * @param {number[]|Uint32Array} nodes
6
6
  * @param {number} offset
7
+ * @param {number} distance
7
8
  * @param {number} count
8
9
  */
9
- export function ebvh_nodes_sort_sah_local4(bvh, nodes, offset, count) {
10
+ export function ebvh_nodes_sort_sah_local4(bvh, nodes, offset, distance, count) {
10
11
 
11
12
  // the bit manipulation rounds count down to nearest value divisible by 4
12
- const end = offset + ((count >>> 2) << 2);
13
+ const end = offset + Math.floor((count - (distance + 2)) / 2) * 2;
13
14
 
14
15
  let swap_count = 0;
15
16
 
16
- for (let i = offset; i < end; i += 4) {
17
+ for (let i = offset; i < end; i += 2) {
17
18
  const a = nodes[i];
18
19
  const b = nodes[i + 1];
19
- const c = nodes[i + 2];
20
- const d = nodes[i + 3];
20
+ const c = nodes[i + distance];
21
+ const d = nodes[i + distance + 1];
21
22
 
22
23
  /*
23
24
  possible combinations:
@@ -170,7 +170,7 @@ export class PathTracedScene {
170
170
  bvh.node_set_height(node, 0);
171
171
 
172
172
  }
173
- ebvh_nodes_sort_sah_local4(bvh, nodes, 0, node_leaf_count);
173
+ ebvh_nodes_sort_sah_local4(bvh, nodes, 0, 2,node_leaf_count);
174
174
 
175
175
  // record newly generated nodes as "unprocessed"
176
176
  const unprocessed_nodes = new Uint32Array(node_leaf_count);