@@ -101,37 +101,49 @@ export default class Hybrid2D3DWorldScene extends Scene {
101101 const zRatio = ( point . z - this . worldBounds . minZ ) / Math . max ( 0.0001 , this . worldBounds . maxZ - this . worldBounds . minZ ) ;
102102 return {
103103 x : viewport . x + xRatio * viewport . width ,
104- y : viewport . y + zRatio * viewport . height ,
104+ y : viewport . y + ( 1 - zRatio ) * viewport . height ,
105105 } ;
106106 }
107107
108108 drawTopdown ( renderer ) {
109109 const map = this . topdownViewport ;
110- renderer . drawRect ( map . x , map . y , map . width , map . height , 'rgba(15, 23, 42, 0.86)' ) ;
111- renderer . strokeRect ( map . x , map . y , map . width , map . height , '#60a5fa' , 1.5 ) ;
110+ renderer . drawRect ( map . x - 6 , map . y - 28 , map . width + 12 , map . height + 34 , 'rgba(8, 42, 64, 0.54)' ) ;
111+ renderer . drawRect ( map . x , map . y , map . width , map . height , 'rgba(15, 23, 42, 0.92)' ) ;
112+ renderer . strokeRect ( map . x , map . y , map . width , map . height , '#22d3ee' , 2 ) ;
113+ renderer . drawRect ( map . x + 8 , map . y + 8 , 94 , 18 , 'rgba(8, 145, 178, 0.35)' ) ;
114+ renderer . drawText ( '2D Layer' , map . x + 15 , map . y + 21 , { color : '#67e8f9' , font : '12px monospace' } ) ;
112115
113116 this . props . forEach ( ( prop ) => {
114117 const topLeft = this . worldToMap ( { x : prop . transform3D . x , z : prop . transform3D . z } , map ) ;
115118 const bottomRight = this . worldToMap ( { x : prop . transform3D . x + prop . size3D . width , z : prop . transform3D . z + prop . size3D . depth } , map ) ;
119+ const left = Math . min ( topLeft . x , bottomRight . x ) ;
120+ const top = Math . min ( topLeft . y , bottomRight . y ) ;
121+ const width = Math . max ( 2 , Math . abs ( bottomRight . x - topLeft . x ) ) ;
122+ const height = Math . max ( 2 , Math . abs ( bottomRight . y - topLeft . y ) ) ;
116123 renderer . drawRect (
117- topLeft . x ,
118- topLeft . y ,
119- Math . max ( 2 , bottomRight . x - topLeft . x ) ,
120- Math . max ( 2 , bottomRight . y - topLeft . y ) ,
124+ left ,
125+ top ,
126+ width ,
127+ height ,
121128 prop . color
122129 ) ;
123130 } ) ;
124131
125132 const playerTopLeft = this . worldToMap ( { x : this . player . x , z : this . player . z } , map ) ;
126133 const playerBottomRight = this . worldToMap ( { x : this . player . x + this . player . width , z : this . player . z + this . player . depth } , map ) ;
134+ const playerLeft = Math . min ( playerTopLeft . x , playerBottomRight . x ) ;
135+ const playerTop = Math . min ( playerTopLeft . y , playerBottomRight . y ) ;
136+ const playerWidth = Math . max ( 3 , Math . abs ( playerBottomRight . x - playerTopLeft . x ) ) ;
137+ const playerHeight = Math . max ( 3 , Math . abs ( playerBottomRight . y - playerTopLeft . y ) ) ;
127138 renderer . drawRect (
128- playerTopLeft . x ,
129- playerTopLeft . y ,
130- Math . max ( 3 , playerBottomRight . x - playerTopLeft . x ) ,
131- Math . max ( 3 , playerBottomRight . y - playerTopLeft . y ) ,
132- '#f8fafc '
139+ playerLeft ,
140+ playerTop ,
141+ playerWidth ,
142+ playerHeight ,
143+ '#22d3ee '
133144 ) ;
134- renderer . drawText ( '2D Tactical View' , map . x + 10 , map . y + 18 , { color : '#cbd5e1' , font : '12px monospace' } ) ;
145+ renderer . strokeRect ( playerLeft - 1 , playerTop - 1 , playerWidth + 2 , playerHeight + 2 , '#ecfeff' , 1 ) ;
146+ renderer . drawText ( 'Forward ^' , map . x + map . width - 74 , map . y + 18 , { color : '#a5f3fc' , font : '12px monospace' } ) ;
135147 }
136148
137149 render ( renderer ) {
@@ -144,7 +156,10 @@ export default class Hybrid2D3DWorldScene extends Scene {
144156 this . drawTopdown ( renderer ) ;
145157
146158 const viewport = this . viewport3d ;
159+ renderer . drawRect ( viewport . x - 6 , viewport . y - 28 , viewport . width + 12 , viewport . height + 34 , 'rgba(56, 29, 92, 0.34)' ) ;
147160 renderer . strokeRect ( viewport . x , viewport . y , viewport . width , viewport . height , '#d8d5ff' , 2 ) ;
161+ renderer . drawRect ( viewport . x + 10 , viewport . y + 8 , 94 , 18 , 'rgba(109, 40, 217, 0.35)' ) ;
162+ renderer . drawText ( '3D World' , viewport . x + 17 , viewport . y + 21 , { color : '#ddd6fe' , font : '12px monospace' } ) ;
148163 drawDepthBackdrop ( renderer , viewport ) ;
149164
150165 const cameraState = this . camera3D ?. getState ?. ( ) ?? {
0 commit comments