fix: use new model format

This commit is contained in:
TrèsAbhi committed 2024-02-22 12:20:29 -06:00
1 parent 1c3e98678f
commit c68df74943
5 files changed
+108 -185

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import { MeshProps } from '@react-three/fiber';
import { Mesh, Object3D } from 'three';
export function jsxTree(node: Object3D, mesh?: MeshProps) {
if (node instanceof Mesh) {
return (
<mesh
geometry={node.geometry}
material={node.material}
position={node.position}
rotation={node.rotation}
scale={node.scale}
{...mesh}
/>
);
} else if (node instanceof Object3D) {
return (
<group
position={node.position}
rotation={node.rotation}
scale={node.scale}
>
{node.children.map((child) => jsxTree(child, mesh))}
</group>
);
}
return null;
}