Last active
February 8, 2022 04:27
-
-
Save yaeda/27a51bc95cfd41a0c33a25d28f72ddae to your computer and use it in GitHub Desktop.
useSTL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useSTL = (path) => { | |
return useLoader(STLLoader, path) | |
} | |
useSTL.preload = (path) => useLoader.preload(STLLoader, path) | |
useSTL.clear = (input) => useLoader.clear(STLLoader, input) | |
const ModelSTL = () => { | |
const stl = useSTL(stlPath) | |
return ( | |
<mesh> | |
<primitive object={stl} attach="geometry" /> | |
<meshStandardMaterial | |
attach="material" | |
color="#fff" | |
transparent | |
roughness={0} | |
metalness={0} | |
/> | |
</mesh> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment