Skip to content

Commit

Permalink
impl google model viewer page
Browse files Browse the repository at this point in the history
  • Loading branch information
softmare committed Jun 28, 2022
1 parent 70e6d8b commit 65ecc96
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions components/models/knight.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "@google/model-viewer";
import { useHelper } from "@react-three/drei";
import { useLoader } from "@react-three/fiber";
import { useRef } from "react";
Expand All @@ -10,3 +11,19 @@ export const ThreeKnight = () => {
const gltf = useLoader(GLTFLoader, "/knight_gltf/scene.gltf");
return <primitive ref={mesh} object={gltf.scene} position={[0, 0, 0]} />;
};

export const GoogleKnight = () => {
return (
<model-viewer
style={{ height: "1200px", width: "1200px" }}
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
></model-viewer>
);
};
11 changes: 11 additions & 0 deletions pages/compare/model-viewer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { GoogleKnight } from "@components/models/knight";
import type { NextPage } from "next";

const Google_Demo: NextPage = () => {
return (
<div className="h-screen w-screen flex justify-center">
{<GoogleKnight /> ?? null}
</div>
);
};
export default Google_Demo;

0 comments on commit 65ecc96

Please sign in to comment.