refactor: move centering to 3mf gen
This commit is contained in:
@@ -51,14 +51,6 @@ export default function MdTokenViewer(props: TokenViewerProps) {
|
||||
|
||||
// 3MF 文件可能返回一个 Group,包含多个 Mesh
|
||||
group = object instanceof THREE.Group ? object : new THREE.Group().add(object);
|
||||
|
||||
// 计算边界框并居中
|
||||
const box = new THREE.Box3().setFromObject(group);
|
||||
const center = box.getCenter(new THREE.Vector3());
|
||||
group.position.x = -center.x;
|
||||
group.position.y = -center.y;
|
||||
group.position.z = -center.z;
|
||||
|
||||
group.rotateX(Math.PI);
|
||||
|
||||
// 为每个 mesh 启用原始颜色
|
||||
|
||||
Reference in New Issue
Block a user