@woosh/meep-engine 2.119.116 → 2.119.117

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.117",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -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++;