21 lines
577 B
TypeScript
21 lines
577 B
TypeScript
import type { ThreeElements } from '@react-three/fiber'
|
|
import { forwardRef } from 'react'
|
|
import type { Mesh } from 'three'
|
|
|
|
interface CursorSphereProps extends Omit<ThreeElements['mesh'], 'ref'> {
|
|
color?: string
|
|
depthWrite?: boolean
|
|
}
|
|
|
|
export const CursorSphere = forwardRef<Mesh, CursorSphereProps>(function CursorSphere(
|
|
{ color = '#f1c066', ...props },
|
|
ref,
|
|
) {
|
|
return (
|
|
<mesh ref={ref} {...props} renderOrder={2}>
|
|
<sphereGeometry args={[0.1, 16, 16]} />
|
|
<meshBasicMaterial color={color} depthTest={false} depthWrite={true} />
|
|
</mesh>
|
|
)
|
|
})
|