1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 20:25:36 +02:00
This commit is contained in:
syuilo
2026-04-04 20:23:24 +09:00
parent ba4d495b42
commit c454b8922b
6 changed files with 22 additions and 10 deletions

View File

@@ -14,14 +14,15 @@ export const beamLamp = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ root, scene }) => {
createInstance: ({ room, root, scene }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene);
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene, true);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 300;
light.range = 100/*cm*/;
room.lightContainer.addLight(light);
},
interactions: {},
};

View File

@@ -13,14 +13,15 @@ export const lavaLamp = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ scene, root }) => {
createInstance: ({ room, scene, root }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene);
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene, true);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 300;
light.range = 100/*cm*/;
room.lightContainer.addLight(light);
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
sphere.parent = root;

View File

@@ -26,7 +26,7 @@ export const woodRingFloorLamp = defineObject({
},
},
placement: 'floor',
createInstance: ({ options, model }) => {
createInstance: ({ room, scene, options, model }) => {
const shadeMaterial = model.findMaterial('__X_SHADE__');
const applyShadeColor = () => {
@@ -45,6 +45,16 @@ export const woodRingFloorLamp = defineObject({
applyBodyColor();
const lamps = model.findMeshes('__X_LAMP__');
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, true);
light.parent = lamp;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 5000;
light.range = 150/*cm*/;
room.lightContainer.addLight(light);
}
return {
onOptionsUpdated: ([k, v]) => {
applyShadeColor();