/*
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 ObraAudio from '../../ObraAudio'

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

type GLTFResult = GLTF & {
  nodes: {
    logs002: THREE.Mesh
  }
  materials: {
    gaston: THREE.MeshBasicMaterial
  }
}

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

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