diff --git a/packages/frontend/src/world/room/objects/allInOnePc.ts b/packages/frontend/src/world/room/objects/allInOnePc.ts index dddb7d3559..d3e8286e58 100644 --- a/packages/frontend/src/world/room/objects/allInOnePc.ts +++ b/packages/frontend/src/world/room/objects/allInOnePc.ts @@ -84,13 +84,21 @@ export const allInOnePc = defineObject({ applyFit(); + const applyScreenBrightness = () => { + const b = options.screenBrightness; + screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); + light.intensity = (5 * b) * WORLD_SCALE * WORLD_SCALE; + }; + + applyScreenBrightness(); + const applyCustomPicture = () => new Promise((resolve) => { if (options.customPicture != null) { screenMaterial.unfreeze(); const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => { - screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1); screenMaterial.emissiveTexture = tex; applyFit(); + applyScreenBrightness(); resolve(); }, (message, exception) => { console.warn('Failed to load texture:', message, exception); @@ -107,14 +115,6 @@ export const allInOnePc = defineObject({ await applyCustomPicture(); - const applyScreenBrightness = () => { - const b = options.screenBrightness; - screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); - light.intensity = (5 * b) * WORLD_SCALE * WORLD_SCALE; - }; - - applyScreenBrightness(); - const applyBodyColor = () => { const [r, g, b] = options.bodyColor; bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b); diff --git a/packages/frontend/src/world/room/objects/djPlayer.ts b/packages/frontend/src/world/room/objects/djPlayer.ts index f168e5f6cb..d5b9f0c42d 100644 --- a/packages/frontend/src/world/room/objects/djPlayer.ts +++ b/packages/frontend/src/world/room/objects/djPlayer.ts @@ -60,13 +60,20 @@ export const djPlayer = defineObject({ applyFit(); + const applyScreenBrightness = () => { + const b = options.screenBrightness; + screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); + }; + + applyScreenBrightness(); + const applyCustomPicture = () => new Promise((resolve) => { if (options.customPicture != null && options.customPicture !== '') { screenMaterial.unfreeze(); const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => { - screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1); screenMaterial.emissiveTexture = tex; applyFit(); + applyScreenBrightness(); resolve(); }, (message, exception) => { console.warn('Failed to load texture:', message, exception); @@ -84,13 +91,6 @@ export const djPlayer = defineObject({ await applyCustomPicture(); - const applyScreenBrightness = () => { - const b = options.screenBrightness; - screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); - }; - - applyScreenBrightness(); - return { onOptionsUpdated: ([k, v]) => { switch (k) { diff --git a/packages/frontend/src/world/room/objects/electronicDisplayBoard.ts b/packages/frontend/src/world/room/objects/electronicDisplayBoard.ts index 6903b10975..b258c5a5b8 100644 --- a/packages/frontend/src/world/room/objects/electronicDisplayBoard.ts +++ b/packages/frontend/src/world/room/objects/electronicDisplayBoard.ts @@ -45,6 +45,7 @@ export const electronicDisplayBoard = defineObject({ const tex = new BABYLON.Texture('/client-assets/room/textures/dot-matrix-chars.png', scene, false, false, undefined, () => { tex.level = 2; + textMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1); textMaterial.emissiveTexture = tex; textMaterial.albedoTexture = tex; textMaterial.disableLighting = true; diff --git a/packages/frontend/src/world/room/objects/laptopPc.ts b/packages/frontend/src/world/room/objects/laptopPc.ts index ed0291e6ed..ce05e50a00 100644 --- a/packages/frontend/src/world/room/objects/laptopPc.ts +++ b/packages/frontend/src/world/room/objects/laptopPc.ts @@ -94,13 +94,21 @@ export const laptopPc = defineObject({ applyFit(); + const applyScreenBrightness = () => { + const b = options.screenBrightness; + screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); + light.intensity = (2 * b) * WORLD_SCALE * WORLD_SCALE; + }; + + applyScreenBrightness(); + const applyCustomPicture = () => new Promise((resolve) => { if (options.customPicture != null) { screenMaterial.unfreeze(); const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => { - screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1); screenMaterial.emissiveTexture = tex; applyFit(); + applyScreenBrightness(); resolve(); }, (message, exception) => { console.warn('Failed to load texture:', message, exception); @@ -117,14 +125,6 @@ export const laptopPc = defineObject({ await applyCustomPicture(); - const applyScreenBrightness = () => { - const b = options.screenBrightness; - screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); - light.intensity = (2 * b) * WORLD_SCALE * WORLD_SCALE; - }; - - applyScreenBrightness(); - const applyBodyColor = () => { const [r, g, b] = options.bodyColor; bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b); diff --git a/packages/frontend/src/world/room/objects/monitor.ts b/packages/frontend/src/world/room/objects/monitor.ts index 03ab2fde3e..f46778ccb5 100644 --- a/packages/frontend/src/world/room/objects/monitor.ts +++ b/packages/frontend/src/world/room/objects/monitor.ts @@ -79,6 +79,14 @@ export const monitor = defineObject({ applyFit(); + const applyScreenBrightness = () => { + const b = options.screenBrightness; + screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); + light.intensity = (5 * b) * WORLD_SCALE * WORLD_SCALE; + }; + + applyScreenBrightness(); + const applyCustomPicture = () => new Promise((resolve) => { if (options.customPicture != null) { screenMaterial.unfreeze(); @@ -86,6 +94,7 @@ export const monitor = defineObject({ screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1); screenMaterial.emissiveTexture = tex; applyFit(); + applyScreenBrightness(); resolve(); }, (message, exception) => { console.warn('Failed to load texture:', message, exception); @@ -102,14 +111,6 @@ export const monitor = defineObject({ await applyCustomPicture(); - const applyScreenBrightness = () => { - const b = options.screenBrightness; - screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b); - light.intensity = (5 * b) * WORLD_SCALE * WORLD_SCALE; - }; - - applyScreenBrightness(); - const applyBodyColor = () => { const [r, g, b] = options.bodyColor; bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);