https://www.youtube.com/watch?v=ZqEa8fTxypQ&t=7778s这是我正在学习的视频,我的问题出现在第 55 分钟
Shirt.jsx
似乎有些不对劲
这是我的代码 Shirt.jsx
import React from 'react'
import { easing } from 'maath';
import { useSnapshot } from 'valtio';
import { useFrame } from '@react-three/fiber';
import { Decal, useGLTF, useTexture } from '@react-three/drei';
import state from '../store';
const Shirt = () => {
const snap = useSnapshot(state);
const { nodes, materials } = useGLTF('./shirt_baked.glb');
const logoTexture = useTexture(snap.logoDecal);
const fullTexture = useTexture(snap.fullDecal);
return (
<group >
<mesh
castShadow
geometry={nodes.T_Shirt_male.geometry}
material={materials.lambert1}
material-roughness={1}
dispose={null}
>
</mesh>
</group>
)
}
export default Shirt
我在index.jsx中的代码:
import React from 'react'
import { easing } from 'maath';
import { useSnapshot } from 'valtio';
import { useFrame } from '@react-three/fiber';
import { Decal, useGLTF, useTexture } from '@react-three/drei';
import state from '../store';
const Shirt = () => {
const snap = useSnapshot(state);
const { nodes, materials } = useGLTF('./shirt_baked.glb');
const logoTexture = useTexture(snap.logoDecal);
const fullTexture = useTexture(snap.fullDecal);
return (
<group >
<mesh
castShadow
geometry={nodes.T_Shirt_male.geometry}
material={materials.lambert1}
material-roughness={1}
dispose={null}
>
</mesh>
</group>
)
}
export default Shirt[![enter image description here][1]][1]
我个人认为问题出在 Tag 的某个地方,但是我该如何解决呢? (我也在console.log和我的文件中放了一张错误图片)