1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 15:15:45 +02:00
This commit is contained in:
syuilo
2026-05-06 19:17:46 +09:00
parent 3be075d281
commit 5cb9474494
5 changed files with 24 additions and 3 deletions

View File

@@ -10,14 +10,30 @@ export const ceilingFanLight = defineObject({
id: 'ceilingFanLight',
name: 'Ceiling Fan Light',
options: {
schema: {},
default: {},
schema: {
shadeColor: {
type: 'color',
label: 'Shade color',
},
},
default: {
shadeColor: [0.8, 0.19, 0],
},
},
placement: 'ceiling',
hasCollisions: false,
receiveShadows: false,
castShadows: false,
createInstance: ({ room, scene, model }) => {
createInstance: ({ options, room, scene, model }) => {
const shadeMaterial = model.findMaterial('__X_SHADE__');
const applyShadeColor = () => {
const [r, g, b] = options.shadeColor;
shadeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyShadeColor();
const rotor = model.findMesh('Rotor');
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
@@ -37,6 +53,11 @@ export const ceilingFanLight = defineObject({
});
scene.beginAnimation(rotor, 0, 100, true);
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'shadeColor': applyShadeColor(); break;
}
},
interactions: {},
dispose: () => {
if (animationObserver != null) {