1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 08:45:44 +02:00
This commit is contained in:
syuilo
2026-04-27 09:02:49 +09:00
parent 3a5532211b
commit 88e7303779
6 changed files with 68 additions and 27 deletions

View File

@@ -62,8 +62,23 @@ export class RoomController {
if (this.options.workerMode) {
const offscreen = canvas.transferControlToOffscreen();
this.worker = new RoomWorker();
this.worker.postMessage({ type: 'init', canvas: offscreen, roomState: this.roomState.value, ...this.options }, [offscreen]);
this.isReady.value = true;
this.worker.postMessage({ type: 'init', canvas: offscreen, roomState: this.roomState.value, options: this.options }, [offscreen]);
this.worker.onmessage = (event) => {
switch (event.data?.type) {
case 'progress': {
this.initializeProgress.value = event.data.progress;
break;
}
case 'inited': {
this.initializeProgress.value = 1;
this.isReady.value = true;
break;
}
default: {
console.warn('Unrecognized message from worker:', event.data?.type);
}
}
};
} else {
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true });
babylonEngine.compatibilityMode = false;
@@ -104,6 +119,14 @@ export class RoomController {
this.engine.on('playSfxUrl', ({ url, options }) => {
sound.playUrl(url, options);
});
if (_DEV_) {
(window as any).showBabylonInspector = () => {
import('@babylonjs/inspector').then(({ ShowInspector }) => {
ShowInspector(this.engine.scene);
});
};
}
}
this.canvas.addEventListener('keydown', this.onCanvasKeydown);