-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42d8247
commit 1e6b192
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import "@google/model-viewer"; | ||
|
||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements { | ||
"model-viewer": ModelViewerJSX & | ||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; | ||
} | ||
} | ||
} | ||
|
||
interface ModelViewerJSX { | ||
src: string; | ||
poster?: string; | ||
// ... others | ||
} | ||
|
||
interface ModelViewerElement extends Element { | ||
model: { | ||
materials: Array<{ | ||
name: string; | ||
pbrMetallicRoughness: { | ||
setBaseColorFactor: (x: [number, number, number, number]) => void; | ||
setMetallicFactor: (x: number) => void; | ||
setRoughnessFactor: (x: number) => void; | ||
|
||
baseColorTexture: null | { | ||
texture: { | ||
source: { | ||
setURI: (x: string) => void; | ||
}; | ||
}; | ||
}; | ||
metallicRoughnessTexture: null | { | ||
texture: { | ||
source: { | ||
setURI: (x: string) => void; | ||
}; | ||
}; | ||
}; | ||
// ... others | ||
}; | ||
}>; | ||
}; | ||
} | ||
|
||
const Model = () => ( | ||
<div id="card" className="flex mx-auto h-screen"> | ||
<model-viewer | ||
src="/knight_gltf/scene.gltf" | ||
ios-src="" | ||
poster="https://cdn.glitch.com/36cb8393-65c6-408d-a538-055ada20431b%2Fposter-astronaut.png?v=1599079951717" | ||
alt="A 3D model of an astronaut" | ||
shadow-intensity="1" | ||
camera-controls | ||
auto-rotate | ||
ar | ||
style={{ | ||
width: "100%", | ||
height: "100%", | ||
}} | ||
></model-viewer> | ||
</div> | ||
); | ||
|
||
export default Model; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import dynamic from "next/dynamic"; | ||
|
||
const Model = dynamic(() => import("@components/models/mv-knight"), { | ||
ssr: false, | ||
}); | ||
|
||
export default function Home() { | ||
return <Model />; | ||
} |
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
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