1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-20 14:06:05 +02:00
This commit is contained in:
syuilo
2026-02-19 21:38:44 +09:00
parent dadc5295fa
commit 17a3bdb5eb
5 changed files with 160 additions and 35 deletions

View File

@@ -29,16 +29,21 @@ export const tabletopDigitalClock = defineObject({
},
placement: 'top',
createInstance: ({ room, options, root }) => {
const applyBodyColor = () => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
if (options.bodyStyle === 'color') {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
} else {
bodyMaterial.albedoTexture = room.scene.getTextureByName('tabletop_digital_clock_wood');
}
};
return {
onInited: () => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
if (options.bodyStyle === 'color') {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
}
applyBodyColor();
const segmentMeshes = {
'1a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1A__')),
@@ -85,6 +90,11 @@ export const tabletopDigitalClock = defineObject({
}
}, 1000));
},
onOptionsUpdated: ([k, v]) => {
if (k === 'bodyColor') {
applyBodyColor();
}
},
interactions: {},
};
},