gltfjsx icon indicating copy to clipboard operation
gltfjsx copied to clipboard

How to rewrite gltfjsx generated jsx file to separate geometry and material

Open shunmian opened this issue 2 months ago • 1 comments

I have generated jsx file by gltfjsx with following result

export function Model(props) {
  const { nodes, materials } = useGLTF('./models/Common/Model.glb')
  return (
    <group {...props} dispose={null}>
      <mesh castShadow geometry={nodes.001.geometry} material={materials.001} />
    </group>
  )
}

Is it possible to rewrite above jsx into something like below?

export function Model(props) {
  const { nodes, materials } = useGLTF('./models/Common/Model.glb')
  return (
    <group {...props} dispose={null}>
      <mesh>
        <SomeGeometry buffer={nodes.001.geometry} />
        <SomeMaterial buffer={materials.001}
      </mesh>
    </group>
  )
}

Anyone can help?

shunmian avatar Apr 24 '24 18:04 shunmian