From 27578f268800af3efb5640fc838246bca5e31776 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 29 Apr 2026 15:23:00 +0900 Subject: [PATCH] wip --- locales/ja-JP.yml | 1 + packages/frontend/src/pages/room.vue | 9 ++++++++- packages/frontend/src/preferences/def.ts | 3 +++ packages/frontend/src/world/room/controller.ts | 3 ++- packages/frontend/src/world/room/engine.ts | 6 ++++-- packages/frontend/src/world/room/worker.ts | 2 +- packages/i18n/src/autogen/locale.ts | 4 ++++ 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 8c004a52d0..e97acd4df0 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -3566,3 +3566,4 @@ _room: yourDeviceNotSupported_description: "MisskeyRoomを動作させるには、WebGPUをサポートするデバイスが必要です。" failedToInitialize: "初期化に失敗しました" crushed_description: "バグ、またはデバイスのリソース不足の可能性が考えられます。" + antialiasing: "アンチエイリアス" diff --git a/packages/frontend/src/pages/room.vue b/packages/frontend/src/pages/room.vue index 530f7c687d..c25e544567 100644 --- a/packages/frontend/src/pages/room.vue +++ b/packages/frontend/src/pages/room.vue @@ -212,6 +212,8 @@ const resolutionRaw = prefer.model('world.resolution'); const resolutionAutoValue = computed(() => deviceKind !== 'desktop' ? 0.5 : 1); const resolution = computed(() => resolutionRaw.value ?? resolutionAutoValue.value); +const antialias = prefer.model('world.antialias'); + const useVirtualJoystick = isTouchUsing && (deviceKind === 'smartphone' || deviceKind === 'tablet'); //const useVirtualJoystick = true; @@ -264,6 +266,7 @@ const roomControllerOptions = computed(() => ({ graphicsQuality: graphicsQuality.value, fps: fps.value, resolution: resolution.value, + antialias: antialias.value, useVirtualJoystick, workerMode: true, })); @@ -380,7 +383,7 @@ onMounted(async () => { } }); - watch([graphicsQuality, fps, resolution], () => { + watch([graphicsQuality, fps, resolution, antialias], () => { refresh(); }); }); @@ -585,6 +588,10 @@ function showOtherMenu(ev: PointerEvent) { value: 0.5, }], ref: resolutionRaw, + }, { + type: 'switch', + text: i18n.ts._room.antialiasing, + ref: antialias, }, { type: 'divider', }, { diff --git a/packages/frontend/src/preferences/def.ts b/packages/frontend/src/preferences/def.ts index ac6154f14c..0186811cba 100644 --- a/packages/frontend/src/preferences/def.ts +++ b/packages/frontend/src/preferences/def.ts @@ -542,6 +542,9 @@ export const PREF_DEF = definePreferences({ 'world.resolution': { default: null as 0.5 | 1 | 2 | null, }, + 'world.antialias': { + default: true, + }, 'experimental.stackingRouterView': { default: false, diff --git a/packages/frontend/src/world/room/controller.ts b/packages/frontend/src/world/room/controller.ts index 05a1f6d0fd..9a52f93340 100644 --- a/packages/frontend/src/world/room/controller.ts +++ b/packages/frontend/src/world/room/controller.ts @@ -20,6 +20,7 @@ export type RoomControllerOptions = { graphicsQuality: number; fps: number | null; resolution: number; + antialias: boolean; useVirtualJoystick?: boolean; }; @@ -84,7 +85,7 @@ export class RoomController { } }; } else { - const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: this.options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM }); + const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: this.options.antialias }); babylonEngine.compatibilityMode = false; babylonEngine.enableOfflineSupport = false; babylonEngine.onContextLostObservable.add(() => { diff --git a/packages/frontend/src/world/room/engine.ts b/packages/frontend/src/world/room/engine.ts index 4fb66ed747..76a92f1750 100644 --- a/packages/frontend/src/world/room/engine.ts +++ b/packages/frontend/src/world/room/engine.ts @@ -226,6 +226,7 @@ export class RoomEngine extends EventEmitter { engine: BABYLON.WebGPUEngine; graphicsQuality: number; fps: number | null; + antialias: boolean; useVirtualJoystick?: boolean; }) { super(); @@ -407,7 +408,9 @@ export class RoomEngine extends EventEmitter { if (options.graphicsQuality >= GRAPHICS_QUALITY_HIGH) { const pipeline = new BABYLON.DefaultRenderingPipeline('default', true, this.scene); - pipeline.samples = 4; + if (options.antialias) { + pipeline.samples = 4; + } // snapshot renderingと相性が悪そう //pipeline.depthOfFieldEnabled = true; @@ -456,7 +459,6 @@ export class RoomEngine extends EventEmitter { }).then(() => { loadedCount++; this.emit('loadingProgress', { progress: loadedCount / objects.length }); - console.log(`Loaded object ${o.id} (${o.type})`); }))); // 不具合のもと diff --git a/packages/frontend/src/world/room/worker.ts b/packages/frontend/src/world/room/worker.ts index 2081eb24e9..b824d9161c 100644 --- a/packages/frontend/src/world/room/worker.ts +++ b/packages/frontend/src/world/room/worker.ts @@ -17,7 +17,7 @@ onmessage = async (event) => { case 'init': { const roomState = event.data.roomState as RoomState; canvas = event.data.canvas as HTMLCanvasElement; - const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: event.data.options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM }); + const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: event.data.options.antialias }); babylonEngine.compatibilityMode = false; babylonEngine.enableOfflineSupport = false; await babylonEngine.initAsync(); diff --git a/packages/i18n/src/autogen/locale.ts b/packages/i18n/src/autogen/locale.ts index eead62fdc5..11e2750179 100644 --- a/packages/i18n/src/autogen/locale.ts +++ b/packages/i18n/src/autogen/locale.ts @@ -13307,5 +13307,9 @@ export interface Locale extends ILocale { * バグ、またはデバイスのリソース不足の可能性が考えられます。 */ "crushed_description": string; + /** + * アンチエイリアス + */ + "antialiasing": string; }; }