From fcc36759f768b1523de2c898398b1f6bf0b6bb9c Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 21 Feb 2026 20:45:44 +0900 Subject: [PATCH] Update tabletopDigitalClock.ts --- .../room/objects/tabletopDigitalClock.ts | 80 +++++++++++-------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/packages/frontend/src/utility/room/objects/tabletopDigitalClock.ts b/packages/frontend/src/utility/room/objects/tabletopDigitalClock.ts index d75a920393..0db0bf96ac 100644 --- a/packages/frontend/src/utility/room/objects/tabletopDigitalClock.ts +++ b/packages/frontend/src/utility/room/objects/tabletopDigitalClock.ts @@ -21,14 +21,52 @@ export const tabletopDigitalClock = defineObject({ type: 'color', label: 'Body Color', }, + lcdColor: { + type: 'color', + label: 'LCD Color', + }, }, default: { bodyStyle: 'color', bodyColor: [0.45, 0.8, 0], + lcdColor: [1, 1, 1], }, }, placement: 'top', createInstance: ({ room, options, root }) => { + const segmentMeshes = { + '1a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1A__')), + '1b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1B__')), + '1c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1C__')), + '1d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1D__')), + '1e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1E__')), + '1f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1F__')), + '1g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1G__')), + '2a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2A__')), + '2b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2B__')), + '2c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2C__')), + '2d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2D__')), + '2e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2E__')), + '2f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2F__')), + '2g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2G__')), + '3a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3A__')), + '3b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3B__')), + '3c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3C__')), + '3d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3D__')), + '3e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3E__')), + '3f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3F__')), + '3g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3G__')), + '4a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4A__')), + '4b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4B__')), + '4c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4C__')), + '4d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4D__')), + '4e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4E__')), + '4f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4F__')), + '4g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4G__')), + }; + + const colonMeshes = root.getChildMeshes().filter(m => m.name.includes('__TIME_7SEG_COLON__')); + const applyBodyColor = () => { const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh; const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial; @@ -41,42 +79,16 @@ export const tabletopDigitalClock = defineObject({ } }; + const applyLcdColor = () => { + const mat = segmentMeshes['1a'].material as BABYLON.PBRMaterial; + const [r, g, b] = options.lcdColor; + mat.emissiveColor = new BABYLON.Color3(r, g, b); + }; + return { onInited: () => { applyBodyColor(); - - const segmentMeshes = { - '1a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1A__')), - '1b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1B__')), - '1c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1C__')), - '1d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1D__')), - '1e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1E__')), - '1f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1F__')), - '1g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1G__')), - '2a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2A__')), - '2b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2B__')), - '2c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2C__')), - '2d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2D__')), - '2e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2E__')), - '2f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2F__')), - '2g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_2G__')), - '3a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3A__')), - '3b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3B__')), - '3c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3C__')), - '3d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3D__')), - '3e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3E__')), - '3f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3F__')), - '3g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_3G__')), - '4a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4A__')), - '4b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4B__')), - '4c': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4C__')), - '4d': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4D__')), - '4e': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4E__')), - '4f': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4F__')), - '4g': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_4G__')), - }; - - const colonMeshes = root.getChildMeshes().filter(m => m.name.includes('__TIME_7SEG_COLON__')); + applyLcdColor(); room.intervalIds.push(window.setInterval(() => { const onMeshes = get7segMeshesOfCurrentTime(segmentMeshes); @@ -93,6 +105,8 @@ export const tabletopDigitalClock = defineObject({ onOptionsUpdated: ([k, v]) => { if (k === 'bodyColor') { applyBodyColor(); + } else if (k === 'lcdColor') { + applyLcdColor(); } }, interactions: {},