-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Image component + add ktx support #99
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
export function KTX2(props: KTX2Props) { | ||
return ( | ||
<Suspense fallback={null}> | ||
<UnsuspensedKTX2 {...props} /> | ||
</Suspense> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the suspense is already being provided by the consuming component Image, no need to use it twice
export function JpegPng(props: JpegPngProps) { | ||
return ( | ||
<Suspense fallback={null}> | ||
<UnsuspensedImage {...props} /> | ||
<UnsuspensedJpegPng {...props} /> | ||
</Suspense> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the suspense is already being provided by the consuming component Image, no need to use it twice
src/ideas/physical/Image/index.tsx
Outdated
|
||
const modUrl = src.toLowerCase(); | ||
const IS_KTX2 = modUrl.endsWith(".ktx2"); | ||
const IS_JPEG_PNG = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK textureloader supports more than just these formats .. webp, bmp, tga ..? think it would be cleaner to have KTX component and then an "everything else" component
Removed |
export function Texture(props: TextureProps) { | ||
return <UnsuspensedTexture {...props} />; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant, just return the first component
export function KTX2(props: KTX2Props) { | ||
return <UnsuspensedKTX2 {...props} />; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant, just return the first component
type KTX2Props = { | ||
src: string; | ||
size?: number; | ||
framed?: boolean; | ||
frameMaterial?: Material; | ||
frameWidth?: number; | ||
innerFrameMaterial?: Material; | ||
transparent?: boolean; | ||
} & GroupProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would recommend exporting the ImageProps
from the parent and importing them here to keep them synchronized
import { useTexture } from "@react-three/drei"; | ||
import { GroupProps } from "@react-three/fiber"; | ||
|
||
type ImageProps = { | ||
type TextureProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would recommend exporting the ImageProps
from the parent and importing them here to keep them synchronized
* Refactor Image component + add ktx support (#99) * Refactor Image component + add ktx support * Make Texture Component more general * export index type & clean up syntax Co-authored-by: Alex Shortt <alexander.shortt@gmail.com> Co-authored-by: Muse <40903382+spacesvr@users.noreply.github.com> * Collidable Modifier + Refactors (#100) * add collidable modifier * replace bvh logic with geo simplifier * add optional raycaster prop to interactable modifier * slight refactors to image idea * fix up exports * clean up keyboard layout code, don't run check if in iframe * v2.1.0 Co-authored-by: stevenpaulhoward <40086690+stevenpaulhoward@users.noreply.github.com> Co-authored-by: Muse <40903382+spacesvr@users.noreply.github.com>
Refactored Image component to:
JpegPng
function if source file is.jpeg || .jpg || .png
KTX2
function if source file is.ktx2