mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-05 16:24:10 +02:00
wip
This commit is contained in:
@@ -133,6 +133,11 @@ export const laptopPc = defineObject({
|
|||||||
const angle = options.openAngle;
|
const angle = options.openAngle;
|
||||||
hutaNode.rotationQuaternion = null;
|
hutaNode.rotationQuaternion = null;
|
||||||
hutaNode.rotation.x = -angle;
|
hutaNode.rotation.x = -angle;
|
||||||
|
if (angle <= -Math.PI / 2) {
|
||||||
|
light.intensity = 0;
|
||||||
|
} else {
|
||||||
|
light.intensity = 20000 * options.screenBrightness;
|
||||||
|
}
|
||||||
model.updated();
|
model.updated();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,23 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
type: 'color',
|
type: 'color',
|
||||||
label: 'Body color',
|
label: 'Body color',
|
||||||
},
|
},
|
||||||
|
lightColor: {
|
||||||
|
type: 'color',
|
||||||
|
label: 'Light color',
|
||||||
|
},
|
||||||
|
lightBrightness: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Light brightness',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
shadeColor: [0.21, 0.04, 0],
|
shadeColor: [0.21, 0.04, 0],
|
||||||
bodyColor: [0.05, 0.05, 0.05],
|
bodyColor: [0.05, 0.05, 0.05],
|
||||||
|
lightColor: [1, 0.5, 0.2],
|
||||||
|
lightBrightness: 0.5,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'floor',
|
placement: 'floor',
|
||||||
@@ -46,19 +59,42 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
applyBodyColor();
|
applyBodyColor();
|
||||||
|
|
||||||
const lamps = model.findMeshes('__X_LAMP__');
|
const lamps = model.findMeshes('__X_LAMP__');
|
||||||
|
const lights: BABYLON.SpotLight[] = [];
|
||||||
for (const lamp of lamps) {
|
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);
|
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.parent = lamp;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
|
||||||
light.intensity = 5000;
|
|
||||||
light.range = 100/*cm*/;
|
light.range = 100/*cm*/;
|
||||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
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 {
|
return {
|
||||||
onOptionsUpdated: ([k, v]) => {
|
onOptionsUpdated: ([k, v]) => {
|
||||||
applyShadeColor();
|
applyShadeColor();
|
||||||
applyBodyColor();
|
applyBodyColor();
|
||||||
|
applyLightColor();
|
||||||
|
applyLightBrightness();
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user