diff --git a/packages/frontend/src/world/MultiplayerEngineControllerBase.ts b/packages/frontend/src/world/MultiplayerEngineControllerBase.ts index e2535c7a77..2676d7416b 100644 --- a/packages/frontend/src/world/MultiplayerEngineControllerBase.ts +++ b/packages/frontend/src/world/MultiplayerEngineControllerBase.ts @@ -5,18 +5,24 @@ import { shallowRef } from 'vue'; import { EngineControllerBase } from './EngineControllerBase.js'; +import type { EngineControllerBaseOptions } from './EngineControllerBase.js'; import type { PlayerProfile, PlayerState } from 'misskey-world-engine/src/PlayerContainer.js'; import type { MultiplayEngineBase, MultiplayEngineBaseEvents } from 'misskey-world-engine/src/MultiplayEngineBase.js'; +import type { Wasd } from './Wasd.js'; -export type MultiplayerEngineControllerBaseOptions = { - workerMode?: boolean; - graphicsQuality: number; - fps: number | null; - resolution: number; - antialias: boolean; +export type MultiplayerEngineControllerBaseOptions = EngineControllerBaseOptions & { + showUsernameOnAvatar: boolean; + show2dAvatarOnAvatar: boolean; }; export abstract class MultiplayerEngineControllerBase, E> extends EngineControllerBase { + protected options: MultiplayerEngineControllerBaseOptions; + + constructor(options: MultiplayerEngineControllerBaseOptions, wasd?: Wasd) { + super(options, wasd); + this.options = options; + } + public myPlayerState = shallowRef({ position: [0, 0, 0], rotation: [0, 0, 0], diff --git a/packages/frontend/src/world/controller.ts b/packages/frontend/src/world/controller.ts index 2c45d6a867..7484d63613 100644 --- a/packages/frontend/src/world/controller.ts +++ b/packages/frontend/src/world/controller.ts @@ -3,7 +3,6 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { shallowRef } from 'vue'; import { MultiplayerEngineControllerBase } from './MultiplayerEngineControllerBase.js'; import { Wasd } from './Wasd.js'; import type { WorldEngine } from 'misskey-world-engine/src/engine.js'; @@ -14,18 +13,25 @@ export type WorldEngineControllerOptions = { fps: number | null; resolution: number; antialias: boolean; + fov: number; + useVirtualJoystick?: boolean; + showUsernameOnAvatar: boolean; + show2dAvatarOnAvatar: boolean; }; // 抽象化レイヤー export class WorldEngineController extends MultiplayerEngineControllerBase { + protected options: WorldEngineControllerOptions; + constructor(options: WorldEngineControllerOptions) { super(options, new Wasd({ setCameraMoveVector: (vec, dash) => { this.call('cameraMove', [vec, dash]); }, })); + this.options = options; } public async init(canvas: HTMLCanvasElement) { diff --git a/packages/frontend/src/world/room/controller.ts b/packages/frontend/src/world/room/controller.ts index 09e3bfb62b..81e4cbec19 100644 --- a/packages/frontend/src/world/room/controller.ts +++ b/packages/frontend/src/world/room/controller.ts @@ -31,6 +31,7 @@ export type RoomControllerOptions = { export class RoomController extends MultiplayerEngineControllerBase { + protected options: RoomControllerOptions; public isSitting = ref(false); public isEditMode = ref(false); public isRoomLightOn = ref(true); @@ -53,6 +54,7 @@ export class RoomController extends MultiplayerEngineControllerBase