mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 14:05:35 +02:00
wip
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user