-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance documentation and components for GLB asset handling
- Introduced a new `Glb` component for loading GLB assets, replacing the previous `GlbAsset` component. - Updated `mdx-components.js` to include the new `Glb` component in the default export. - Refactored `route.ts` to import additional utilities for file handling. - Modified `getting-started` documentation to reflect the changes in GLB asset usage. This update improves the asset loading process and enhances the clarity of the documentation.
- Loading branch information
1 parent
a5e7c8b
commit 1d9ccfe
Showing
4 changed files
with
27 additions
and
7 deletions.
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
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
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,17 @@ | ||
'use client' | ||
|
||
import { Container } from "@playcanvas/react"; | ||
import { useModel } from "./hooks/use-asset"; | ||
import { Asset } from "playcanvas"; | ||
|
||
export const Glb = ({ src, children }: { src: string, children?: React.ReactNode }) => { | ||
|
||
const { data: model, isLoading, error } = useModel(src); | ||
|
||
if (isLoading) return null; | ||
if (error) return null; | ||
|
||
return <Container asset={model as Asset}> | ||
{children} | ||
</Container> | ||
} |