@woosh/meep-engine 2.34.26 → 2.34.27
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { v3_dot } from "../../v3_dot.js";
|
|
2
|
+
|
|
3
|
+
export function ray_distance_to_point(origin_x, origin_y, origin_z, direction_x, direction_y, direction_z,ref_x, ref_y, ref_z){
|
|
4
|
+
// find closest point
|
|
5
|
+
const sp0_x = ref_x - origin_x;
|
|
6
|
+
const sp0_y = ref_y - origin_y;
|
|
7
|
+
const sp0_z = ref_z - origin_z;
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
const d2 = v3_dot(direction_x, direction_y, direction_z, direction_x, direction_y, direction_z);
|
|
11
|
+
const d3 = v3_dot(direction_x, direction_y, direction_z, sp0_x, sp0_y, sp0_z);
|
|
12
|
+
|
|
13
|
+
return d3 / d2;
|
|
14
|
+
}
|
|
@@ -3,7 +3,6 @@ import { assert } from "../../../../core/assert.js";
|
|
|
3
3
|
import { computeTriangleRayIntersection } from "../../../../core/geom/3d/triangle/computeTriangleRayIntersection.js";
|
|
4
4
|
import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
|
|
5
5
|
import { aabb3_array_intersects_ray } from "../../../../core/bvh2/aabb3/aabb3_array_intersects_ray.js";
|
|
6
|
-
import { sphere_array_intersects_ray } from "../../../../core/geom/3d/sphere/sphere_array_intersects_ray.js";
|
|
7
6
|
|
|
8
7
|
let id_counter = 0;
|
|
9
8
|
|
|
@@ -109,12 +108,14 @@ export class MicronGeometry {
|
|
|
109
108
|
// using group bounds because it's conservative, as we want to be able to hit LOD_0
|
|
110
109
|
|
|
111
110
|
// sphere test
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
|
|
112
|
+
// TODO check what's wrong with sphere tests and re-enable them
|
|
113
|
+
// if (!sphere_array_intersects_ray(patch.group_bounding_sphere,
|
|
114
|
+
// origin_x, origin_y, origin_z,
|
|
115
|
+
// direction_x, direction_y, direction_z
|
|
116
|
+
// )) {
|
|
117
|
+
// continue;
|
|
118
|
+
// }
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
// box test (more expensive, different volume)
|
|
@@ -133,12 +134,14 @@ export class MicronGeometry {
|
|
|
133
134
|
// cast against bounds
|
|
134
135
|
|
|
135
136
|
// sphere test
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
|
|
138
|
+
// TODO check what's wrong with sphere tests and re-enable them
|
|
139
|
+
// if (!sphere_array_intersects_ray(patch.bounding_sphere,
|
|
140
|
+
// origin_x, origin_y, origin_z,
|
|
141
|
+
// direction_x, direction_y, direction_z
|
|
142
|
+
// )) {
|
|
143
|
+
// continue;
|
|
144
|
+
// }
|
|
142
145
|
|
|
143
146
|
// box test
|
|
144
147
|
if (!aabb3_array_intersects_ray(
|
|
@@ -155,7 +158,7 @@ export class MicronGeometry {
|
|
|
155
158
|
|
|
156
159
|
const vertices = patch.vertex_attribute_arrays[position_attribute_index];
|
|
157
160
|
|
|
158
|
-
for (
|
|
161
|
+
for (i = 0; i < index_count;) {
|
|
159
162
|
const a = indices[i++];
|
|
160
163
|
const b = indices[i++];
|
|
161
164
|
const c = indices[i++];
|
|
@@ -202,7 +205,7 @@ export class MicronGeometry {
|
|
|
202
205
|
|
|
203
206
|
const child_count = children.length;
|
|
204
207
|
|
|
205
|
-
for (
|
|
208
|
+
for (i = 0; i < child_count; i++) {
|
|
206
209
|
const child = children[i];
|
|
207
210
|
|
|
208
211
|
// push to stack
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.34.
|
|
8
|
+
"version": "2.34.27",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|