1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-28 22:44:35 +02:00
This commit is contained in:
syuilo
2026-06-02 10:50:24 +09:00
parent 07e660df01
commit b025ce0ae6
9 changed files with 48 additions and 12 deletions

View File

@@ -3567,8 +3567,10 @@ _miWorld:
separateRenderingThread_description: "有効にするとパフォーマンスが向上します。不安定になる場合は無効すると改善する可能性があります。"
graphicsQuality: "グラフィックの品質"
graphicsSettings: "グラフィック設定"
frameRate: "フレームレート"
frameRateLimitation: "フレームレート制限"
higherValuePerformanceNote: "高くすると体験が向上しますが、消費電力が増加するなどパフォーマンスに影響を与えます。"
resolution: "解像度"
fov: "視野角"
failedToInitialize: "初期化に失敗しました"
crushed_description: "描画が継続できなくなりました。デバイスのリソース不足の可能性が考えられます。"
antialiasing: "アンチエイリアス"

View File

@@ -81,6 +81,7 @@ export class RoomEngine extends EngineBase<{
private useGlow: boolean;
public camera: BABYLON.UniversalCamera;
private cameraHeight = cm(130);
private fov: number;
private fixedCamera: BABYLON.FreeCamera;
public furnitureContainers: Map<string, FurnitureContainer> = new Map();
private envManager: EnvManager | null = null;
@@ -191,6 +192,7 @@ export class RoomEngine extends EngineBase<{
graphicsQuality: number;
fps: number | null;
antialias: boolean;
fov: number;
useVirtualJoystick?: boolean;
}) {
super({
@@ -208,6 +210,7 @@ export class RoomEngine extends EngineBase<{
this.roomAttachments = roomAttachments;
this.graphicsQuality = options.graphicsQuality;
this.useGlow = this.graphicsQuality >= GRAPHICS_QUALITY.MEDIUM;
this.fov = options.fov;
this.time = TIME_MAP[new Date().getHours() as keyof typeof TIME_MAP];
registerBuiltInLoaders();
@@ -227,7 +230,7 @@ export class RoomEngine extends EngineBase<{
this.camera = new BABYLON.FreeCamera('camera', new BABYLON.Vector3(0, this.cameraHeight, cm(0)), this.scene);
this.camera.minZ = cm(1);
this.camera.maxZ = cm(1000);
this.camera.fov = 1;
this.camera.fov = this.fov;
this.camera.ellipsoid = new BABYLON.Vector3(cm(15), cm(65), cm(15));
this.camera.checkCollisions = true;
this.camera.applyGravity = true;
@@ -434,10 +437,10 @@ export class RoomEngine extends EngineBase<{
} else {
if (this.scene.activeCamera === this.camera) {
this.camera.fov += ev.deltaY * 0.001;
this.camera.fov = Math.max(0.25, Math.min(1, this.camera.fov));
this.camera.fov = Math.max(0.25, Math.min(this.fov, this.camera.fov));
} else if (this.scene.activeCamera === this.fixedCamera) {
this.fixedCamera.fov += ev.deltaY * 0.001;
this.fixedCamera.fov = Math.max(0.25, Math.min(1, this.fixedCamera.fov));
this.fixedCamera.fov = Math.max(0.25, Math.min(this.fov, this.fixedCamera.fov));
}
}
});
@@ -447,7 +450,7 @@ export class RoomEngine extends EngineBase<{
this.changeGrabbingDistance(ev.delta * 0.1);
} else {
this.camera.fov += -ev.delta * 0.003;
this.camera.fov = Math.max(0.25, Math.min(1, this.camera.fov));
this.camera.fov = Math.max(0.25, Math.min(this.fov, this.camera.fov));
}
});

View File

@@ -12,7 +12,7 @@ import type { RoomState, RoomAttachments } from 'misskey-world/src/room/type.js'
//BABYLON.RegisterCollisionCoordinator();
export async function createRoomEngine(params: {
roomState: RoomState; roomAttachments: RoomAttachments; canvas: HTMLCanvasElement; options: { antialias: boolean; resolution: number };
roomState: RoomState; roomAttachments: RoomAttachments; canvas: HTMLCanvasElement; options: { antialias: boolean; resolution: number; fov: number; graphicsQuality: number; fps: number | null; useVirtualJoystick?: boolean; };
}) {
const babylonEngine = new BABYLON.WebGPUEngine(params.canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: params.options.antialias });
babylonEngine.compatibilityMode = false;

View File

@@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@close="cancel()"
@closed="emit('closed')"
>
<template #header><i class="ti ti-user"></i> Avatar</template>
<template #header><i class="ti ti-user"></i> {{ i18n.ts.worldAvatar }}</template>
<div :class="[$style.root, { [$style.isNarrow]: isNarrow, [$style.isWide]: !isNarrow }]">
<div v-if="!controller.isReady" :class="$style.loading">

View File

@@ -290,6 +290,7 @@ const roomControllerOptions = computed<RoomControllerOptions>(() => ({
resolution: resolution.value,
antialias: antialias.value,
useVirtualJoystick,
fov: prefer.s['world.fov'],
workerMode: prefer.s['world.separateRenderingThread'],
}));
@@ -649,7 +650,7 @@ ${url}/rooms/r/${props.room.id}`,
ref: graphicsQualityRaw,
}, {
type: 'radio',
text: i18n.ts._miWorld.frameRate,
text: i18n.ts._miWorld.frameRateLimitation,
caption: fpsRaw.value == null ? i18n.ts.auto : fpsRaw.value === 'max' ? 'Max' : `~${fpsRaw.value}fps`,
options: [{
label: `${i18n.ts.auto} (${fpsAutoValue.value}fps)`,

View File

@@ -764,6 +764,19 @@ SPDX-License-Identifier: AGPL-3.0-only
</SearchMarker>
</div>
<SearchMarker :keywords="['fov', 'fieldofview']">
<MkPreferenceContainer k="world.fov">
<MkRange
v-model="worldFov"
:min="2"
:max="0.5"
:step="0.1"
>
<template #label><SearchLabel>{{ i18n.ts._miWorld.fov }}</SearchLabel></template>
</MkRange>
</MkPreferenceContainer>
</SearchMarker>
<SearchMarker :keywords="['graphics', 'quality']">
<MkPreferenceContainer k="world.graphicsQuality">
<MkSelect
@@ -777,11 +790,12 @@ SPDX-License-Identifier: AGPL-3.0-only
]"
>
<template #label><SearchLabel>{{ i18n.ts._miWorld.graphicsQuality }}</SearchLabel></template>
<template #caption>{{ i18n.ts._miWorld.higherValuePerformanceNote }}</template>
</MkSelect>
</MkPreferenceContainer>
</SearchMarker>
<SearchMarker :keywords="['framerate', 'fps']">
<SearchMarker :keywords="['framerate', 'fps', 'limitation']">
<MkPreferenceContainer k="world.fps">
<MkSelect
v-model="worldFps"
@@ -794,7 +808,8 @@ SPDX-License-Identifier: AGPL-3.0-only
{ label: '~30fps', value: '30' },
]"
>
<template #label><SearchLabel>{{ i18n.ts._miWorld.frameRate }}</SearchLabel></template>
<template #label><SearchLabel>{{ i18n.ts._miWorld.frameRateLimitation }}</SearchLabel></template>
<template #caption>{{ i18n.ts._miWorld.higherValuePerformanceNote }}</template>
</MkSelect>
</MkPreferenceContainer>
</SearchMarker>
@@ -812,6 +827,7 @@ SPDX-License-Identifier: AGPL-3.0-only
]"
>
<template #label><SearchLabel>{{ i18n.ts._miWorld.resolution }}</SearchLabel></template>
<template #caption>{{ i18n.ts._miWorld.higherValuePerformanceNote }}</template>
</MkSelect>
</MkPreferenceContainer>
</SearchMarker>
@@ -1043,6 +1059,7 @@ const worldGraphicsQuality = prefer.model('world.graphicsQuality');
const worldFps = prefer.model('world.fps');
const worldResolution = prefer.model('world.resolution');
const worldAntialias = prefer.model('world.antialias');
const worldFov = prefer.model('world.fov');
const fontSize = ref(miLocalStorage.getItem('fontSize') as '1' | '2' | '3' | null);
const useSystemFont = ref(miLocalStorage.getItem('useSystemFont') != null);
@@ -1107,6 +1124,7 @@ watch([
worldFps,
worldResolution,
worldAntialias,
worldFov,
], () => {
suggestReload();
});

View File

@@ -545,6 +545,9 @@ export const PREF_DEF = definePreferences({
'world.antialias': {
default: true,
},
'world.fov': {
default: 1,
},
'world.separateRenderingThread': {
default: true,
},

View File

@@ -21,6 +21,7 @@ export type RoomControllerOptions = {
fps: number | null;
resolution: number;
antialias: boolean;
fov: number;
useVirtualJoystick?: boolean;
};

View File

@@ -13308,13 +13308,21 @@ export interface Locale extends ILocale {
*/
"graphicsSettings": string;
/**
* フレームレート
* フレームレート制限
*/
"frameRate": string;
"frameRateLimitation": string;
/**
* 高くすると体験が向上しますが、消費電力が増加するなどパフォーマンスに影響を与えます。
*/
"higherValuePerformanceNote": string;
/**
* 解像度
*/
"resolution": string;
/**
* 視野角
*/
"fov": string;
/**
* 初期化に失敗しました
*/