/*
Auto-generated by: https://github.com/pmndrs/gltfjsx
*/

import * as THREE from 'three'
import React, { useRef } from 'react'
import { useGLTF } from '@react-three/drei/useGLTF'

import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader'
import ObraAudio from '../../ObraAudio'

type GLTFResult = GLTF & {
  nodes: {
    Sphere: THREE.Mesh
  }
  materials: {
    Material: THREE.MeshStandardMaterial
  }
}

export default function Model(props: JSX.IntrinsicElements['group']) {
  const group = useRef<THREE.Group>()
  const { nodes, materials } = useGLTF('/model/obras/eduardo.glb') as GLTFResult
  return (
    <group ref={group} {...props} dispose={null}>
      <mesh material={materials.Material} geometry={nodes.Sphere.geometry} />
      <ObraAudio position={[0, 0, 0]} url="/audio/eduardo.ogg" loop distance={1} />
    </group>
  )
}

useGLTF.preload('/model/obras/eduardo.glb')
