11import * as React from 'react'
22import * as THREE from 'three'
33import { Canvas , useFrame , useThree } from '@react-three/fiber'
4- import {
5- Decal ,
6- Environment ,
7- useGLTF ,
8- useTexture ,
9- } from '@react-three/drei'
4+ import { Decal , Environment , useGLTF , useTexture } from '@react-three/drei'
105import { easing } from 'maath'
116
127type ShopHero3DProps = {
@@ -32,19 +27,51 @@ export function ShopHero3D({ isDark = false }: ShopHero3DProps) {
3227 const images = isDark ? BRAND_IMAGES . dark : BRAND_IMAGES . light
3328
3429 // Debug overrides — these feed into the scene when DEBUG is on
35- const [ debugDecal , setDebugDecal ] = React . useState ( { x : 0.17 , y : 0.09 , z : 0.1 } )
36- const [ debugDecalRot , setDebugDecalRot ] = React . useState ( { x : 0 , y : 0.785 , z : 0 } ) // 0.785 ≈ π*0.25
30+ const [ debugDecal , setDebugDecal ] = React . useState ( {
31+ x : 0.17 ,
32+ y : 0.09 ,
33+ z : 0.1 ,
34+ } )
35+ const [ debugDecalRot , setDebugDecalRot ] = React . useState ( {
36+ x : 0 ,
37+ y : 0.785 ,
38+ z : 0 ,
39+ } ) // 0.785 ≈ π*0.25
3740 const [ debugScale , setDebugScale ] = React . useState ( 0.05 )
38- const [ debugShirtPos , setDebugShirtPos ] = React . useState ( { x : - 0.06 , y : - 0.05 , z : 0 } )
39- const [ debugShirtRot , setDebugShirtRot ] = React . useState ( { x : 0 , y : - 0.45 , z : 0.02 } )
41+ const [ debugShirtPos , setDebugShirtPos ] = React . useState ( {
42+ x : - 0.06 ,
43+ y : - 0.05 ,
44+ z : 0 ,
45+ } )
46+ const [ debugShirtRot , setDebugShirtRot ] = React . useState ( {
47+ x : 0 ,
48+ y : - 0.45 ,
49+ z : 0.02 ,
50+ } )
4051
4152 const debugValues = DEBUG
4253 ? {
43- decal : [ debugDecal . x , debugDecal . y , debugDecal . z ] as [ number , number , number ] ,
44- decalRotation : [ debugDecalRot . x , debugDecalRot . y , debugDecalRot . z ] as [ number , number , number ] ,
54+ decal : [ debugDecal . x , debugDecal . y , debugDecal . z ] as [
55+ number ,
56+ number ,
57+ number ,
58+ ] ,
59+ decalRotation : [ debugDecalRot . x , debugDecalRot . y , debugDecalRot . z ] as [
60+ number ,
61+ number ,
62+ number ,
63+ ] ,
4564 scale : debugScale ,
46- shirtPos : [ debugShirtPos . x , debugShirtPos . y , debugShirtPos . z ] as [ number , number , number ] ,
47- shirtRot : [ debugShirtRot . x , debugShirtRot . y , debugShirtRot . z ] as [ number , number , number ] ,
65+ shirtPos : [ debugShirtPos . x , debugShirtPos . y , debugShirtPos . z ] as [
66+ number ,
67+ number ,
68+ number ,
69+ ] ,
70+ shirtRot : [ debugShirtRot . x , debugShirtRot . y , debugShirtRot . z ] as [
71+ number ,
72+ number ,
73+ number ,
74+ ] ,
4875 }
4976 : null
5077
@@ -78,11 +105,46 @@ export function ShopHero3D({ isDark = false }: ShopHero3DProps) {
78105 < div className = "absolute top-2 right-2 z-50 bg-black/80 text-white text-[10px] p-3 rounded-lg flex flex-col gap-2 max-h-[95%] overflow-y-auto w-56 font-mono" >
79106 < div className = "font-bold text-xs mb-1" > Decal Editor</ div >
80107
81- < SliderGroup label = "Decal Pos" value = { debugDecal } onChange = { setDebugDecal } min = { - 0.3 } max = { 0.3 } step = { 0.005 } />
82- < SliderGroup label = "Decal Rot" value = { debugDecalRot } onChange = { setDebugDecalRot } min = { - 3.14 } max = { 3.14 } step = { 0.01 } />
83- < SliderRow label = "Scale" value = { debugScale } onChange = { setDebugScale } min = { 0.01 } max = { 0.4 } step = { 0.005 } />
84- < SliderGroup label = "Shirt Pos" value = { debugShirtPos } onChange = { setDebugShirtPos } min = { - 0.2 } max = { 0.2 } step = { 0.005 } />
85- < SliderGroup label = "Shirt Rot" value = { debugShirtRot } onChange = { setDebugShirtRot } min = { - 1.5 } max = { 1.5 } step = { 0.01 } />
108+ < SliderGroup
109+ label = "Decal Pos"
110+ value = { debugDecal }
111+ onChange = { setDebugDecal }
112+ min = { - 0.3 }
113+ max = { 0.3 }
114+ step = { 0.005 }
115+ />
116+ < SliderGroup
117+ label = "Decal Rot"
118+ value = { debugDecalRot }
119+ onChange = { setDebugDecalRot }
120+ min = { - 3.14 }
121+ max = { 3.14 }
122+ step = { 0.01 }
123+ />
124+ < SliderRow
125+ label = "Scale"
126+ value = { debugScale }
127+ onChange = { setDebugScale }
128+ min = { 0.01 }
129+ max = { 0.4 }
130+ step = { 0.005 }
131+ />
132+ < SliderGroup
133+ label = "Shirt Pos"
134+ value = { debugShirtPos }
135+ onChange = { setDebugShirtPos }
136+ min = { - 0.2 }
137+ max = { 0.2 }
138+ step = { 0.005 }
139+ />
140+ < SliderGroup
141+ label = "Shirt Rot"
142+ value = { debugShirtRot }
143+ onChange = { setDebugShirtRot }
144+ min = { - 1.5 }
145+ max = { 1.5 }
146+ step = { 0.01 }
147+ />
86148
87149 < button
88150 type = "button"
@@ -218,7 +280,11 @@ function Scene({
218280 color = "#e8e0f0"
219281 />
220282
221- < RotatingShirt images = { images } isDark = { isDark } debugOverride = { debugOverride } />
283+ < RotatingShirt
284+ images = { images }
285+ isDark = { isDark }
286+ debugOverride = { debugOverride }
287+ />
222288 </ >
223289 )
224290}
@@ -405,7 +471,8 @@ function RotatingShirt({
405471
406472 // In debug mode, use overrides directly; otherwise use placement presets
407473 const activeDecalPos = debugOverride ?. decal ?? [ ...placement . decal ]
408- const activeDecalRot = debugOverride ?. decalRotation ?? ( placement . decalRotation ?? [ 0 , 0 , 0 ] )
474+ const activeDecalRot =
475+ debugOverride ?. decalRotation ?? placement . decalRotation ?? [ 0 , 0 , 0 ]
409476 const activeScale = debugOverride ?. scale ?? placement . scale
410477 const activeShirtPos = debugOverride ?. shirtPos ?? placement . shirtPos
411478 const activeShirtRot = debugOverride ?. shirtRot ?? placement . shirtRot
0 commit comments