1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-16 05:05:32 +02:00
This commit is contained in:
syuilo
2026-04-06 21:28:16 +09:00
parent 0d966d8ded
commit f6677aa02c
2 changed files with 43 additions and 2 deletions

View File

@@ -133,6 +133,11 @@ export const laptopPc = defineObject({
const angle = options.openAngle;
hutaNode.rotationQuaternion = null;
hutaNode.rotation.x = -angle;
if (angle <= -Math.PI / 2) {
light.intensity = 0;
} else {
light.intensity = 20000 * options.screenBrightness;
}
model.updated();
};

View File

@@ -19,10 +19,23 @@ export const woodRingFloorLamp = defineObject({
type: 'color',
label: 'Body color',
},
lightColor: {
type: 'color',
label: 'Light color',
},
lightBrightness: {
type: 'range',
label: 'Light brightness',
min: 0,
max: 1,
step: 0.01,
},
},
default: {
shadeColor: [0.21, 0.04, 0],
bodyColor: [0.05, 0.05, 0.05],
lightColor: [1, 0.5, 0.2],
lightBrightness: 0.5,
},
},
placement: 'floor',
@@ -46,19 +59,42 @@ export const woodRingFloorLamp = defineObject({
applyBodyColor();
const lamps = model.findMeshes('__X_LAMP__');
const lights: BABYLON.SpotLight[] = [];
for (const lamp of lamps) {
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 0/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
light.parent = lamp;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 5000;
light.range = 100/*cm*/;
if (room?.lightContainer != null) room.lightContainer.addLight(light);
lights.push(light);
}
const applyLightColor = () => {
const [r, g, b] = options.lightColor;
for (const light of lights) {
light.diffuse = new BABYLON.Color3(r, g, b);
}
};
applyLightColor();
const applyLightBrightness = () => {
for (const light of lights) {
light.intensity = 10000 * options.lightBrightness;
}
for (const lamp of lamps) {
const emissive = lamp.material as BABYLON.PBRMaterial;
emissive.emissiveIntensity = options.lightBrightness * 5;
}
};
applyLightBrightness();
return {
onOptionsUpdated: ([k, v]) => {
applyShadeColor();
applyBodyColor();
applyLightColor();
applyLightBrightness();
},
interactions: {},
};