@woosh/meep-engine 2.119.114 → 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 +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +3 -5
- package/src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.d.ts +2 -1
- package/src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_nodes_sort_sah_local4.js +6 -5
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +1 -1
package/package.json
CHANGED
|
@@ -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,
|
|
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) & 3; // cycle between 0 and 2
|
|
48
|
-
|
|
49
46
|
const swap_count = ebvh_nodes_sort_sah_local4(
|
|
50
47
|
bvh,
|
|
51
48
|
unprocessed_nodes,
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
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
|
|
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 +=
|
|
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 +
|
|
20
|
-
const d = nodes[i +
|
|
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);
|