@woosh/meep-engine 2.131.32 → 2.131.33

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": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.131.32",
8
+ "version": "2.131.33",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"bvh32_geometry_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;GAeG;AACH,8FAXW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,KACpC,MAAM,KACN,MAAM,KACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAuNnB"}
1
+ {"version":3,"file":"bvh32_geometry_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;GAeG;AACH,8FAXW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,KACpC,MAAM,KACN,MAAM,KACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAmOnB"}
@@ -63,6 +63,7 @@ export function bvh32_geometry_nearest(
63
63
  */
64
64
  const stack_top = stack.pointer++;
65
65
 
66
+
66
67
  /**
67
68
  * After performing empirical tests, stack-based depth-first traversal turns out faster than using a queue
68
69
  * @type {number}
@@ -130,7 +131,18 @@ export function bvh32_geometry_nearest(
130
131
 
131
132
  }
132
133
  } else if (left_index < last_valid_index) {
133
- stack[stack.pointer++] = left_index;
134
+
135
+ const child_1_address = bvh.getNodeAddress(left_index);
136
+
137
+ const distance_sqr_to_child1 = aabb3_unsigned_distance_sqr_to_point(
138
+ float32[child_1_address], float32[child_1_address + 1], float32[child_1_address + 2],
139
+ float32[child_1_address + 3], float32[child_1_address + 4], float32[child_1_address + 5],
140
+ x, y, z
141
+ );
142
+
143
+ if(distance_sqr_to_child1 < nearest_distance_sqr) {
144
+ stack[stack.pointer++] = left_index;
145
+ }
134
146
  }
135
147
 
136
148
 
@@ -207,7 +219,7 @@ export function bvh32_geometry_nearest(
207
219
 
208
220
  computeTriangleClosestPointToPointBarycentric(
209
221
  v3_scratch_0, 0,
210
- x, x, x,
222
+ x, y, z,
211
223
  ax, ay, az,
212
224
  bx, by, bz,
213
225
  cx, cy, cz