1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 19:15:32 +02:00
This commit is contained in:
syuilo
2026-04-26 17:08:51 +09:00
parent a77987ab28
commit 17697ba6ec
5 changed files with 276 additions and 36 deletions

View File

@@ -16,6 +16,7 @@ import * as sound from '@/utility/sound.js';
type Options = {
workerMode?: boolean;
graphicsQuality: number;
useVirtualJoystick?: boolean;
};
// 抽象化レイヤー
@@ -59,7 +60,7 @@ 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, graphicsQuality: this.options.graphicsQuality }, [offscreen]);
this.worker.postMessage({ type: 'init', canvas: offscreen, roomState: this.roomState.value, graphicsQuality: this.options.graphicsQuality, useVirtualJoystick: this.options.useVirtualJoystick }, [offscreen]);
this.isReady.value = true;
} else {
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true });
@@ -67,7 +68,7 @@ export class RoomController {
babylonEngine.enableOfflineSupport = false;
await babylonEngine.initAsync();
this.engine = new RoomEngine(this.roomState.value, { canvas, engine: babylonEngine, graphicsQuality: this.options.graphicsQuality });
this.engine = new RoomEngine(this.roomState.value, { canvas, engine: babylonEngine, graphicsQuality: this.options.graphicsQuality, useVirtualJoystick: this.options.useVirtualJoystick });
this.engine.on('loadingProgress', ({ progress }) => {
this.initializeProgress.value = progress;
});
@@ -201,6 +202,22 @@ export class RoomController {
}
}
public setCameraJoystickMoveVector(vec: { x: number; y: number }) {
if (this.worker != null) {
this.worker.postMessage({ type: 'setCameraJoystickMoveVector', vec });
} else if (this.engine != null) {
this.engine.cameraJoystickMove(vec);
}
}
public setCameraJoystickRotateVector(vec: { x: number; y: number }) {
if (this.worker != null) {
this.worker.postMessage({ type: 'setCameraJoystickRotateVector', vec });
} else if (this.engine != null) {
this.engine.cameraJoystickRotate(vec);
}
}
public enterEditMode() {
if (this.worker != null) {
this.worker.postMessage({ type: 'enterEditMode' });