Skip to content

Commit 2c763b3

Browse files
author
shijiashuai
committed
refactor: update CyberAvatarModel component
1 parent b14450e commit 2c763b3

1 file changed

Lines changed: 17 additions & 33 deletions

File tree

src/components/viewer/CyberAvatarModel.tsx

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ export default function CyberAvatarModel({ refs }: Props) {
181181
[],
182182
);
183183
const glowWhite = useMemo(() => <meshBasicMaterial color="#ffffff" />, []);
184+
const goldMat = useMemo(
185+
() => (
186+
<meshPhysicalMaterial
187+
color="#e8b84b"
188+
metalness={0.85}
189+
roughness={0.15}
190+
clearcoat={0.9}
191+
envMapIntensity={2.0}
192+
/>
193+
),
194+
[],
195+
);
184196

185197
return (
186198
<>
@@ -361,13 +373,7 @@ export default function CyberAvatarModel({ refs }: Props) {
361373
{/* 左侧发夹金色中心结 */}
362374
<mesh position={[-0.53, 0.28, 0.12]}>
363375
<sphereGeometry args={[0.022, 6, 6]} />
364-
<meshPhysicalMaterial
365-
color="#e8b84b"
366-
metalness={0.85}
367-
roughness={0.15}
368-
clearcoat={0.9}
369-
envMapIntensity={2.0}
370-
/>
376+
{goldMat}
371377
</mesh>
372378
{/* 右侧星星发夹 */}
373379
<mesh position={[0.53, 0.28, 0.1]} rotation={[0, -0.3, -0.3]}>
@@ -377,13 +383,7 @@ export default function CyberAvatarModel({ refs }: Props) {
377383
{/* 右侧发夹金色底座 */}
378384
<mesh position={[0.53, 0.25, 0.08]} rotation={[0, -0.3, 0]}>
379385
<capsuleGeometry args={[0.015, 0.06, 3, 6]} />
380-
<meshPhysicalMaterial
381-
color="#e8b84b"
382-
metalness={0.85}
383-
roughness={0.15}
384-
clearcoat={0.9}
385-
envMapIntensity={2.0}
386-
/>
386+
{goldMat}
387387
</mesh>
388388
{/* 蝴蝶结中心珠 */}
389389
<mesh position={[-0.53, 0.28, 0.14]}>
@@ -698,13 +698,7 @@ export default function CyberAvatarModel({ refs }: Props) {
698698
{/* 项链主链(金色) */}
699699
<mesh position={[0, -0.58, 0.05]} rotation={[Math.PI / 2, 0, 0]}>
700700
<torusGeometry args={[0.16, 0.006, 8, 32]} />
701-
<meshPhysicalMaterial
702-
color="#e8b84b"
703-
metalness={0.85}
704-
roughness={0.15}
705-
clearcoat={0.9}
706-
envMapIntensity={2.0}
707-
/>
701+
{goldMat}
708702
</mesh>
709703
{/* 项链内层装饰环 */}
710704
<mesh position={[0, -0.6, 0.06]} rotation={[Math.PI / 2, 0, 0]}>
@@ -714,11 +708,7 @@ export default function CyberAvatarModel({ refs }: Props) {
714708
{/* 吊坠底座(金色小环) */}
715709
<mesh position={[0, -0.66, 0.165]} rotation={[Math.PI / 2, 0, 0]}>
716710
<torusGeometry args={[0.012, 0.003, 6, 12]} />
717-
<meshPhysicalMaterial
718-
color="#e8b84b"
719-
metalness={0.85}
720-
roughness={0.15}
721-
/>
711+
{goldMat}
722712
</mesh>
723713
{/* 吊坠宝石 */}
724714
<mesh position={[0, -0.7, 0.165]}>
@@ -822,13 +812,7 @@ export default function CyberAvatarModel({ refs }: Props) {
822812
{/* 蝴蝶结金色中心结 */}
823813
<mesh position={[0, -1.02, 0.32]}>
824814
<sphereGeometry args={[0.018, 8, 8]} />
825-
<meshPhysicalMaterial
826-
color="#e8b84b"
827-
metalness={0.85}
828-
roughness={0.15}
829-
clearcoat={0.9}
830-
envMapIntensity={2.0}
831-
/>
815+
{goldMat}
832816
</mesh>
833817
{/* 腰线 */}
834818
<mesh position={[0, -1.62, 0]} rotation={[Math.PI / 2, 0, 0]}>

0 commit comments

Comments
 (0)