@woosh/meep-engine 2.48.21 → 2.48.22
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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { v3_distance_sqr } from "../../../v3_distance_sqr";
|
|
2
|
+
import { v3_dot } from "../../../v3_dot.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {TopoTriangle} f0
|
|
7
|
+
* @param {TopoTriangle} f1
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function compute_face_connection_weight(f0, f1) {
|
|
11
|
+
const vertices_0 = f0.vertices;
|
|
12
|
+
const vertices_1 = f1.vertices;
|
|
13
|
+
|
|
14
|
+
// compute center
|
|
15
|
+
const f0_center_x = (vertices_0[0].x + vertices_0[1].x + vertices_0[2].x) * 0.333;
|
|
16
|
+
const f0_center_y = (vertices_0[0].y + vertices_0[1].y + vertices_0[2].y) * 0.333;
|
|
17
|
+
const f0_center_z = (vertices_0[0].z + vertices_0[1].z + vertices_0[2].z) * 0.333;
|
|
18
|
+
|
|
19
|
+
const f1_center_x = (vertices_1[0].x + vertices_1[1].x + vertices_1[2].x) * 0.333;
|
|
20
|
+
const f1_center_y = (vertices_1[0].y + vertices_1[1].y + vertices_1[2].y) * 0.333;
|
|
21
|
+
const f1_center_z = (vertices_1[0].z + vertices_1[1].z + vertices_1[2].z) * 0.333;
|
|
22
|
+
|
|
23
|
+
const distance_sqr = v3_distance_sqr(
|
|
24
|
+
f0_center_x, f0_center_y, f0_center_z,
|
|
25
|
+
f1_center_x, f1_center_y, f1_center_z
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// compute normal dot
|
|
29
|
+
const n0 = f0.normal;
|
|
30
|
+
const n1 = f1.normal;
|
|
31
|
+
|
|
32
|
+
const dot = v3_dot(
|
|
33
|
+
n0[0], n0[1], n0[2],
|
|
34
|
+
n1[0], n1[1], n1[2],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const distance_weight = distance_sqr !== 0 ? 0.01 / distance_sqr : 10000;
|
|
38
|
+
|
|
39
|
+
return 2 + distance_weight + dot * 0.1;
|
|
40
|
+
}
|
|
@@ -2,7 +2,7 @@ import { Graph } from "./v2/Graph.js";
|
|
|
2
2
|
import { MultiNode } from "./MultiNode.js";
|
|
3
3
|
import {
|
|
4
4
|
compute_face_connection_weight
|
|
5
|
-
} from "
|
|
5
|
+
} from "../geom/3d/topology/util/compute_face_connection_weight.js";
|
|
6
6
|
import { WeightedEdge } from "./WeightedEdge.js";
|
|
7
7
|
import { graph_compute_disconnected_clusters } from "./graph_compute_disconnected_clusters.js";
|
|
8
8
|
|
|
@@ -6,7 +6,6 @@ import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
|
6
6
|
import { three_object_to_entity_composition } from "../three_object_to_entity_composition.js";
|
|
7
7
|
import { TransformAttachmentSystem } from "../../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
8
8
|
import { Camera } from "../../camera/Camera.js";
|
|
9
|
-
import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
|
|
10
9
|
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
11
10
|
import { MeshSystem } from "../../mesh/MeshSystem.js";
|
|
12
11
|
|
|
@@ -31,8 +30,6 @@ async function init(harness) {
|
|
|
31
30
|
config.addLoader(GameAssetType.ModelGLTF_JSON, gltfAssetLoader);
|
|
32
31
|
config.addLoader(GameAssetType.ModelGLTF, gltfAssetLoader);
|
|
33
32
|
|
|
34
|
-
config.addPlugin(MicronRenderPlugin);
|
|
35
|
-
|
|
36
33
|
await config.apply(engine);
|
|
37
34
|
|
|
38
35
|
enableEditor(engine);
|