mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-20 01:15:29 +02:00
wip
This commit is contained in:
@@ -228,15 +228,24 @@ class ModelManager {
|
|||||||
const toMerge = [] as BABYLON.Mesh[];
|
const toMerge = [] as BABYLON.Mesh[];
|
||||||
for (const mesh of _toMerge) {
|
for (const mesh of _toMerge) {
|
||||||
const newMesh = mesh.clone(mesh.name + '_bakeMerged');
|
const newMesh = mesh.clone(mesh.name + '_bakeMerged');
|
||||||
mesh.makeGeometryUnique();
|
newMesh.makeGeometryUnique();
|
||||||
applyMorphTargetsToMesh(newMesh);
|
applyMorphTargetsToMesh(newMesh);
|
||||||
|
if (newMesh.parent === this.root) {
|
||||||
|
newMesh.parent = null;
|
||||||
|
} else {
|
||||||
|
newMesh.setParent(this.root);
|
||||||
|
//newMesh.bakeCurrentTransformIntoVertices();
|
||||||
|
newMesh.parent = null;
|
||||||
|
}
|
||||||
//newMesh.bakeCurrentTransformIntoVertices();
|
//newMesh.bakeCurrentTransformIntoVertices();
|
||||||
toMerge.push(newMesh);
|
toMerge.push(newMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
const merged = BABYLON.Mesh.MergeMeshes(toMerge, true, true, undefined, false, true);
|
const merged = BABYLON.Mesh.MergeMeshes(toMerge, true, true, undefined, false, true);
|
||||||
|
|
||||||
merged.setParent(this.root);
|
//merged.bakeCurrentTransformIntoVertices();
|
||||||
|
|
||||||
|
merged.parent = this.root;
|
||||||
|
|
||||||
this.bakedMeshes = [merged];
|
this.bakedMeshes = [merged];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -532,12 +532,12 @@ export function applyMorphTargetsToMesh(mesh: BABYLON.Mesh) {
|
|||||||
// Update the mesh with the morphed positions
|
// Update the mesh with the morphed positions
|
||||||
mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, finalPositions);
|
mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, finalPositions);
|
||||||
|
|
||||||
// Update normals if available
|
//// Update normals if available
|
||||||
const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
|
//const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
|
||||||
if (normals) {
|
//if (normals) {
|
||||||
// For simplicity, we'll just recompute the normals
|
// // For simplicity, we'll just recompute the normals
|
||||||
mesh.createNormals(true);
|
// mesh.createNormals(true);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Refresh the mesh
|
// Refresh the mesh
|
||||||
mesh.refreshBoundingInfo();
|
mesh.refreshBoundingInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user