@woosh/meep-engine 2.119.116 → 2.119.118

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.116",
8
+ "version": "2.119.118",
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,CAoFlB"}
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,CAkFlB"}
@@ -38,23 +38,21 @@ export function ebvh_build_hierarchy(
38
38
 
39
39
  while (unprocessed_node_count > 1) {
40
40
 
41
- const sah_optimization_cycle_count = sah_optimization_level + sah_optimization_bias * current_construction_depth;
41
+ const sah_optimization_cycle_count = Math.floor(sah_optimization_level + sah_optimization_bias * current_construction_depth);
42
42
 
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
- const swap_count = ebvh_nodes_sort_sah_local4(
46
+ const swap_distance = (sah_optimization_cycle_count - i) * 2;
47
+
48
+ ebvh_nodes_sort_sah_local4(
47
49
  bvh,
48
50
  unprocessed_nodes,
49
51
  0,
50
- (sah_optimization_cycle_count - i)*2,
52
+ swap_distance,
51
53
  unprocessed_node_count
52
54
  );
53
55
 
54
- if (swap_count === 0) {
55
- break;
56
- }
57
-
58
56
  }
59
57
 
60
58
  let added_nodes = 0;
@@ -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;;;;;;;;GAQG;AACH,gDANW,GAAG,SACH,MAAM,EAAE,GAAC,WAAW,UACpB,MAAM,YACN,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,UAgDhB"}
@@ -9,16 +9,19 @@
9
9
  */
10
10
  export function ebvh_nodes_sort_sah_local4(bvh, nodes, offset, distance, count) {
11
11
 
12
- // the bit manipulation rounds count down to nearest value divisible by 4
13
- const end = offset + Math.floor((count - (distance + 2)) / 2) * 2;
12
+ const swap_pair_limit = Math.floor((count - (distance + 2)) / 2);
13
+ const end = offset + swap_pair_limit * 2;
14
14
 
15
15
  let swap_count = 0;
16
16
 
17
17
  for (let i = offset; i < end; i += 2) {
18
+ const j = i + distance;
19
+
18
20
  const a = nodes[i];
19
21
  const b = nodes[i + 1];
20
- const c = nodes[i + distance];
21
- const d = nodes[i + distance + 1];
22
+
23
+ const c = nodes[j];
24
+ const d = nodes[j + 1];
22
25
 
23
26
  /*
24
27
  possible combinations:
@@ -38,12 +41,12 @@ export function ebvh_nodes_sort_sah_local4(bvh, nodes, offset, distance, count)
38
41
  } else if (cost1 <= cost2) {
39
42
  // swap C and B
40
43
  nodes[i + 1] = c;
41
- nodes[i + 2] = b;
44
+ nodes[j] = b;
42
45
 
43
46
  } else {
44
47
  // swap B and D
45
48
  nodes[i + 1] = d;
46
- nodes[i + 3] = b;
49
+ nodes[j + 1] = b;
47
50
  }
48
51
 
49
52
  swap_count++;