1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 14:05:35 +02:00
This commit is contained in:
syuilo
2026-04-02 17:06:09 +09:00
parent 7a939dc5b3
commit 913e35442c
2 changed files with 17 additions and 8 deletions

View File

@@ -228,15 +228,24 @@ class ModelManager {
const toMerge = [] as BABYLON.Mesh[];
for (const mesh of _toMerge) {
const newMesh = mesh.clone(mesh.name + '_bakeMerged');
mesh.makeGeometryUnique();
newMesh.makeGeometryUnique();
applyMorphTargetsToMesh(newMesh);
if (newMesh.parent === this.root) {
newMesh.parent = null;
} else {
newMesh.setParent(this.root);
//newMesh.bakeCurrentTransformIntoVertices();
newMesh.parent = null;
}
//newMesh.bakeCurrentTransformIntoVertices();
toMerge.push(newMesh);
}
const merged = BABYLON.Mesh.MergeMeshes(toMerge, true, true, undefined, false, true);
merged.setParent(this.root);
//merged.bakeCurrentTransformIntoVertices();
merged.parent = this.root;
this.bakedMeshes = [merged];
} catch (err) {

View File

@@ -532,12 +532,12 @@ export function applyMorphTargetsToMesh(mesh: BABYLON.Mesh) {
// Update the mesh with the morphed positions
mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, finalPositions);
// Update normals if available
const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
if (normals) {
// For simplicity, we'll just recompute the normals
mesh.createNormals(true);
}
//// Update normals if available
//const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
//if (normals) {
// // For simplicity, we'll just recompute the normals
// mesh.createNormals(true);
//}
// Refresh the mesh
mesh.refreshBoundingInfo();