@woosh/meep-engine 2.122.1 → 2.122.2

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.122.1",
8
+ "version": "2.122.2",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_optimize_treelet.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_optimize_treelet.js"],"names":[],"mappings":"AAoNA;;;;;;;GAOG;AACH,2CAJW,GAAG,SACH,MAAM,iBACN,MAAM,QA8IhB"}
1
+ {"version":3,"file":"ebvh_optimize_treelet.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_optimize_treelet.js"],"names":[],"mappings":"AAuNA;;;;;;;GAOG;AACH,2CAJW,GAAG,SACH,MAAM,iBACN,MAAM,QA8IhB"}
@@ -3,10 +3,13 @@ import { lsb_32 } from "../../binary/lsb_32.js";
3
3
  import { bitCount } from "../../binary/operations/bitCount.js";
4
4
  import { NULL_NODE } from "./BVH.js";
5
5
 
6
- const scratch_areas = new Float32Array(256);
7
- const scratch_cost = new Float32Array(256);
8
- const scratch_partitions = new Uint32Array(256);
9
- const scratch_treelet = new Uint32Array(16);
6
+ // Common continuous memory region for better cache performance
7
+ const scratch_memory = new ArrayBuffer((256 * 3 + 16) * 4);
8
+
9
+ const scratch_areas = new Float32Array(scratch_memory, 0, 256);
10
+ const scratch_cost = new Float32Array(scratch_memory, 1024, 256);
11
+ const scratch_partitions = new Uint32Array(scratch_memory, 2048, 256);
12
+ const scratch_treelet = new Uint32Array(scratch_memory, 3072, 16);
10
13
 
11
14
  /**
12
15
  *
@@ -87,7 +90,7 @@ function optimize_treelet(bvh, root, leaves, leaf_count) {
87
90
  for (let i = 0; i < leaf_count; i++) {
88
91
  const leaf = leaves[i];
89
92
 
90
- scratch_cost[1 << i] = SAH_COST_TRIANGLE * bvh.node_get_surface_area(leaf) ;
93
+ scratch_cost[1 << i] = SAH_COST_TRIANGLE * bvh.node_get_surface_area(leaf);
91
94
  }
92
95
 
93
96
  // Optimize every subset of leaves
@@ -136,7 +139,7 @@ function optimize_treelet(bvh, root, leaves, leaf_count) {
136
139
  * @param {number} treelet_max_size
137
140
  */
138
141
  function optimize_at_node(bvh, root, treelet_max_size) {
139
- if(root === NULL_NODE){
142
+ if (root === NULL_NODE) {
140
143
  return;
141
144
  }
142
145