1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-11 20:34:02 +02:00
This commit is contained in:
syuilo
2026-05-09 14:06:07 +09:00
parent 3605ffdafc
commit 414a28fb19
18 changed files with 104 additions and 49 deletions

View File

@@ -48,18 +48,18 @@ export const allInOnePc = defineObject({
},
placement: 'top',
hasTexture: true,
createInstance: async ({ room, scene, options, model, graphicsQuality }) => {
createInstance: async ({ lc, scene, options, model, graphicsQuality }) => {
const matrix = model.root.getWorldMatrix(true);
const scale = new BABYLON.Vector3();
matrix.decompose(scale);
// TODO: graphicsQualityがLOWならそもそも追加しない
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, lc != null);
light.parent = model.root;
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
light.radius = cm(20);
if (room?.lightContainer != null) room.lightContainer.addLight(light);
if (lc != null) lc.addLight(light);
const screenMesh = model.findMesh('__X_SCREEN__');
@@ -142,6 +142,10 @@ export const allInOnePc = defineObject({
}
},
interactions: {},
dispose: () => {
light.dispose();
if (lc != null) lc.removeLight(light);
},
};
},
});