1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 06:25:42 +02:00
Files
misskey/packages/frontend/src/world/room/objects/beamLamp.ts
syuilo 015e6d1c81 wip
2026-05-04 09:14:58 +09:00

35 lines
1.0 KiB
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
import { cm, WORLD_SCALE } from '../../utility.js';
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
export const beamLamp = defineObject({
id: 'beamLamp',
name: 'Beam Lamp',
options: {
schema: {},
default: {},
},
placement: 'top',
hasCollisions: false,
canPreMeshesMerging: true,
createInstance: ({ room, root, scene, graphicsQuality }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, cm(10), 0), scene, room?.lightContainer != null);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 0.03 * WORLD_SCALE * WORLD_SCALE;
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
if (room?.lightContainer != null) room.lightContainer.addLight(light);
},
interactions: {},
};
},
});