and when I use ai it corrected the code as below
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 * as THREE from 'three';
import state from '../store';
const Shirt = () => {
const snap = useSnapshot(state);
const { nodes, materials } = useGLTF('/shirt_baked.glb');
// Load textures
const logoTexture = useTexture(snap.logoDecal);
const fullTexture = useTexture(snap.fullDecal);
useFrame((state, delta) => {
if (logoTexture) {
logoTexture.anisotropy = state.gl.capabilities.getMaxAnisotropy();
logoTexture.needsUpdate = true; // Tell Three.js to update the texture
}
if (fullTexture) {
fullTexture.anisotropy = state.gl.capabilities.getMaxAnisotropy();
fullTexture.needsUpdate = true;
}
// Existing color damping
easing.dampC(materials.lambert1.color, snap.color, 0.25, delta);
});
const stateString = JSON.stringify(snap);
return (
<group key={stateString}>
<mesh
castShadow
geometry={nodes.T_Shirt_male.geometry}
material={materials.lambert1}
material-roughness={1}
dispose={null}
>
{snap.isFullTexture && fullTexture && (
<Decal
position={[0, 0, 0]}
rotation={[0, 0, 0]}
scale={1}
map={fullTexture}
depthTest={false}
depthWrite={true}
/>
)}
{snap.isLogoTexture && logoTexture && (
<Decal
position={[0, 0.04, 0.15]}
rotation={[0, 0, 0]}
scale={0.15}
map={logoTexture}
depthTest={false}
depthWrite={true}
/>
)}
</mesh>
</group>
);
};
export default Shirt;