@@ -317,14 +317,15 @@ const cloneControls = (value: ControlMap): ControlMap => {
317317
318318let appVersion = 'dev' ;
319319const loadVersion = async ( ) => {
320- const response = await fetch ( '/version.js' , { cache : 'no-store' } ) ;
320+ const versionUrl = new URL ( `${ import . meta. env . BASE_URL } version.js` , window . location . origin ) . toString ( ) ;
321+ const response = await fetch ( versionUrl , { cache : 'no-store' } ) ;
321322 if ( ! response . ok ) {
322- throw new Error ( `Failed to load /version.js (${ response . status } )` ) ;
323+ throw new Error ( `Failed to load ${ versionUrl } (${ response . status } )` ) ;
323324 }
324325 const source = await response . text ( ) ;
325326 const match = source . match ( / A P P _ V E R S I O N \s * = \s * [ ' \" ] ( [ ^ ' \" ] + ) [ ' \" ] / ) ;
326327 if ( ! match || typeof match [ 1 ] !== 'string' || match [ 1 ] . length === 0 ) {
327- throw new Error ( ' Failed to parse APP_VERSION from /version.js' ) ;
328+ throw new Error ( ` Failed to parse APP_VERSION from ${ versionUrl } ` ) ;
328329 }
329330 appVersion = match [ 1 ] ;
330331} ;
@@ -564,19 +565,29 @@ const getMaterial = (block: ModuleBlock): THREE.MeshStandardMaterial => {
564565 const texture = getTexture ( block . material . tileId ) ;
565566 const isWindow = block . role . includes ( 'window' ) ;
566567 const isCeilingLight = block . role . includes ( 'ceiling-light' ) ;
567- const material = new THREE . MeshStandardMaterial ( {
568+ const params : THREE . MeshStandardMaterialParameters = {
568569 color : roleColor ( block . role ) ,
569- map : texture ?? undefined ,
570- alphaMap : isWindow ? ( texture ?? undefined ) : undefined ,
571570 alphaTest : isWindow ? 0.08 : 0 ,
572571 metalness : isWindow ? 0.15 : 0.05 ,
573572 roughness : isWindow ? 0.25 : 0.85 ,
574573 transparent : isWindow ,
575574 opacity : 1 ,
576575 depthWrite : ! isWindow ,
577- emissive : isCeilingLight ? new THREE . Color ( 0xfff6b8 ) : undefined ,
578576 emissiveIntensity : isCeilingLight ? 1.5 : 0
579- } ) ;
577+ } ;
578+
579+ if ( texture ) {
580+ params . map = texture ;
581+ if ( isWindow ) {
582+ params . alphaMap = texture ;
583+ }
584+ }
585+
586+ if ( isCeilingLight ) {
587+ params . emissive = new THREE . Color ( 0xfff6b8 ) ;
588+ }
589+
590+ const material = new THREE . MeshStandardMaterial ( params ) ;
580591
581592 if ( texture && block . material . uvMode === 'repeat' && block . primitive === 'box' ) {
582593 const [ sizeX , , sizeZ ] = getVector3 ( block . size , `block size (${ block . id } )` ) ;
0 commit comments