viral-viewer-2 2.9.3 → 2.9.5
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.
|
@@ -33754,7 +33754,7 @@ function workerFunction() {
|
|
|
33754
33754
|
const a = index.getX(i);
|
|
33755
33755
|
const b = index.getX(i + 1);
|
|
33756
33756
|
const c = index.getX(i + 2);
|
|
33757
|
-
const triangle = new
|
|
33757
|
+
const triangle = new SimplierTriangle(vertices[a], vertices[b], vertices[c], a, b, c);
|
|
33758
33758
|
faces.push(triangle);
|
|
33759
33759
|
}
|
|
33760
33760
|
}
|
|
@@ -33763,7 +33763,7 @@ function workerFunction() {
|
|
|
33763
33763
|
const a = i;
|
|
33764
33764
|
const b = i + 1;
|
|
33765
33765
|
const c = i + 2;
|
|
33766
|
-
const triangle = new
|
|
33766
|
+
const triangle = new SimplierTriangle(vertices[a], vertices[b], vertices[c], a, b, c);
|
|
33767
33767
|
faces.push(triangle);
|
|
33768
33768
|
}
|
|
33769
33769
|
}
|
|
@@ -33954,7 +33954,7 @@ function workerFunction() {
|
|
|
33954
33954
|
return least;
|
|
33955
33955
|
}
|
|
33956
33956
|
// we use a triangle class to represent structure of face slightly differently
|
|
33957
|
-
class
|
|
33957
|
+
class SimplierTriangle {
|
|
33958
33958
|
constructor(v1, v2, v3, a, b, c) {
|
|
33959
33959
|
this.a = a;
|
|
33960
33960
|
this.b = b;
|
|
@@ -34037,7 +34037,7 @@ function workerFunction() {
|
|
|
34037
34037
|
}
|
|
34038
34038
|
}
|
|
34039
34039
|
//#endregion
|
|
34040
|
-
|
|
34040
|
+
//#regionMy code
|
|
34041
34041
|
//////////////////
|
|
34042
34042
|
const maxPolygonPerObject = 1000;
|
|
34043
34043
|
const maxPolygonForEdge = 1000;
|
|
@@ -34109,8 +34109,7 @@ function workerFunction() {
|
|
|
34109
34109
|
// In case number of polygon larger than expect, merge them to reduce polygon first, for optimize purpose
|
|
34110
34110
|
if (dummyGeometry.attributes.position.count > maxPolygonPerObject) {
|
|
34111
34111
|
const modifier = new SimplifyModifier();
|
|
34112
|
-
const ratio = maxPolygonPerObject /
|
|
34113
|
-
dummyGeometry.attributes.position.count;
|
|
34112
|
+
const ratio = maxPolygonPerObject / dummyGeometry.attributes.position.count;
|
|
34114
34113
|
const count = Math.floor(dummyGeometry.attributes.position.count * ratio); // number of polygon to remove
|
|
34115
34114
|
geometry = modifier.modify(dummyGeometry, count);
|
|
34116
34115
|
console.log(dummyGeometry.attributes.position.count, geometry.attributes.position.count);
|
|
@@ -34160,7 +34159,9 @@ function workerFunction() {
|
|
|
34160
34159
|
bufferGeometry.setIndex(indices);
|
|
34161
34160
|
const line = new LineSegments(bufferGeometry, new LineBasicMaterial({ color: "#666", linewidth: 0.5 }));
|
|
34162
34161
|
line.applyMatrix4(matrix4);
|
|
34162
|
+
line.updateMatrix();
|
|
34163
34163
|
childMesh.add(line);
|
|
34164
|
+
childMesh.updateMatrix();
|
|
34164
34165
|
}
|
|
34165
34166
|
}
|
|
34166
34167
|
let jsonData = childMesh.toJSON();
|
|
@@ -34197,6 +34198,7 @@ function workerFunction() {
|
|
|
34197
34198
|
this.Instances = [];
|
|
34198
34199
|
}
|
|
34199
34200
|
}
|
|
34201
|
+
//#endregion
|
|
34200
34202
|
}
|
|
34201
34203
|
exports.workerCode = workerFunction;
|
|
34202
34204
|
//# sourceMappingURL=threejs.types.js.map
|