-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
74b7126
commit 9f20d9b
Showing
4 changed files
with
169 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { ComponentPropsWithoutRef } from 'react' | ||
import { Image } from './image.js' | ||
import { useLoader } from '@react-three/fiber' | ||
import { TextureLoader } from 'three' | ||
import { SRGBColorSpace, TextureLoader } from 'three' | ||
|
||
export function SuspendingImage({ | ||
src, | ||
...props | ||
}: Omit<ComponentPropsWithoutRef<typeof Image>, 'src'> & { src: string }) { | ||
const texture = useLoader(TextureLoader, src) | ||
texture.colorSpace = SRGBColorSpace | ||
texture.matrixAutoUpdate = false | ||
return <Image src={texture} {...props} /> | ||
} |
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
Oops, something went wrong.