1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-01 02:44:18 +02:00
This commit is contained in:
syuilo
2026-04-29 15:23:00 +09:00
parent fc97ba41af
commit 27578f2688
7 changed files with 23 additions and 5 deletions

View File

@@ -3566,3 +3566,4 @@ _room:
yourDeviceNotSupported_description: "MisskeyRoomを動作させるには、WebGPUをサポートするデバイスが必要です。" yourDeviceNotSupported_description: "MisskeyRoomを動作させるには、WebGPUをサポートするデバイスが必要です。"
failedToInitialize: "初期化に失敗しました" failedToInitialize: "初期化に失敗しました"
crushed_description: "バグ、またはデバイスのリソース不足の可能性が考えられます。" crushed_description: "バグ、またはデバイスのリソース不足の可能性が考えられます。"
antialiasing: "アンチエイリアス"

View File

@@ -212,6 +212,8 @@ const resolutionRaw = prefer.model('world.resolution');
const resolutionAutoValue = computed<number>(() => deviceKind !== 'desktop' ? 0.5 : 1); const resolutionAutoValue = computed<number>(() => deviceKind !== 'desktop' ? 0.5 : 1);
const resolution = computed<number>(() => resolutionRaw.value ?? resolutionAutoValue.value); const resolution = computed<number>(() => resolutionRaw.value ?? resolutionAutoValue.value);
const antialias = prefer.model('world.antialias');
const useVirtualJoystick = isTouchUsing && (deviceKind === 'smartphone' || deviceKind === 'tablet'); const useVirtualJoystick = isTouchUsing && (deviceKind === 'smartphone' || deviceKind === 'tablet');
//const useVirtualJoystick = true; //const useVirtualJoystick = true;
@@ -264,6 +266,7 @@ const roomControllerOptions = computed<RoomControllerOptions>(() => ({
graphicsQuality: graphicsQuality.value, graphicsQuality: graphicsQuality.value,
fps: fps.value, fps: fps.value,
resolution: resolution.value, resolution: resolution.value,
antialias: antialias.value,
useVirtualJoystick, useVirtualJoystick,
workerMode: true, workerMode: true,
})); }));
@@ -380,7 +383,7 @@ onMounted(async () => {
} }
}); });
watch([graphicsQuality, fps, resolution], () => { watch([graphicsQuality, fps, resolution, antialias], () => {
refresh(); refresh();
}); });
}); });
@@ -585,6 +588,10 @@ function showOtherMenu(ev: PointerEvent) {
value: 0.5, value: 0.5,
}], }],
ref: resolutionRaw, ref: resolutionRaw,
}, {
type: 'switch',
text: i18n.ts._room.antialiasing,
ref: antialias,
}, { }, {
type: 'divider', type: 'divider',
}, { }, {

View File

@@ -542,6 +542,9 @@ export const PREF_DEF = definePreferences({
'world.resolution': { 'world.resolution': {
default: null as 0.5 | 1 | 2 | null, default: null as 0.5 | 1 | 2 | null,
}, },
'world.antialias': {
default: true,
},
'experimental.stackingRouterView': { 'experimental.stackingRouterView': {
default: false, default: false,

View File

@@ -20,6 +20,7 @@ export type RoomControllerOptions = {
graphicsQuality: number; graphicsQuality: number;
fps: number | null; fps: number | null;
resolution: number; resolution: number;
antialias: boolean;
useVirtualJoystick?: boolean; useVirtualJoystick?: boolean;
}; };
@@ -84,7 +85,7 @@ export class RoomController {
} }
}; };
} else { } 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.compatibilityMode = false;
babylonEngine.enableOfflineSupport = false; babylonEngine.enableOfflineSupport = false;
babylonEngine.onContextLostObservable.add(() => { babylonEngine.onContextLostObservable.add(() => {

View File

@@ -226,6 +226,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
engine: BABYLON.WebGPUEngine; engine: BABYLON.WebGPUEngine;
graphicsQuality: number; graphicsQuality: number;
fps: number | null; fps: number | null;
antialias: boolean;
useVirtualJoystick?: boolean; useVirtualJoystick?: boolean;
}) { }) {
super(); super();
@@ -407,7 +408,9 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
if (options.graphicsQuality >= GRAPHICS_QUALITY_HIGH) { if (options.graphicsQuality >= GRAPHICS_QUALITY_HIGH) {
const pipeline = new BABYLON.DefaultRenderingPipeline('default', true, this.scene); const pipeline = new BABYLON.DefaultRenderingPipeline('default', true, this.scene);
pipeline.samples = 4; if (options.antialias) {
pipeline.samples = 4;
}
// snapshot renderingと相性が悪そう // snapshot renderingと相性が悪そう
//pipeline.depthOfFieldEnabled = true; //pipeline.depthOfFieldEnabled = true;
@@ -456,7 +459,6 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
}).then(() => { }).then(() => {
loadedCount++; loadedCount++;
this.emit('loadingProgress', { progress: loadedCount / objects.length }); this.emit('loadingProgress', { progress: loadedCount / objects.length });
console.log(`Loaded object ${o.id} (${o.type})`);
}))); })));
// 不具合のもと // 不具合のもと

View File

@@ -17,7 +17,7 @@ onmessage = async (event) => {
case 'init': { case 'init': {
const roomState = event.data.roomState as RoomState; const roomState = event.data.roomState as RoomState;
canvas = event.data.canvas as HTMLCanvasElement; 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.compatibilityMode = false;
babylonEngine.enableOfflineSupport = false; babylonEngine.enableOfflineSupport = false;
await babylonEngine.initAsync(); await babylonEngine.initAsync();

View File

@@ -13307,5 +13307,9 @@ export interface Locale extends ILocale {
* バグ、またはデバイスのリソース不足の可能性が考えられます。 * バグ、またはデバイスのリソース不足の可能性が考えられます。
*/ */
"crushed_description": string; "crushed_description": string;
/**
* アンチエイリアス
*/
"antialiasing": string;
}; };
} }