mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-20 10:35:40 +02:00
wip
This commit is contained in:
@@ -16,6 +16,7 @@ import * as sound from '@/utility/sound.js';
|
||||
type Options = {
|
||||
workerMode?: boolean;
|
||||
graphicsQuality: number;
|
||||
fps: number | null;
|
||||
useVirtualJoystick?: boolean;
|
||||
};
|
||||
|
||||
@@ -24,7 +25,7 @@ export class RoomController {
|
||||
private worker: Worker | null = null;
|
||||
private engine: RoomEngine | null = null;
|
||||
private canvas: HTMLCanvasElement | null = null;
|
||||
private options: Options = {};
|
||||
private options: Options;
|
||||
private isCanvasDragging = false;
|
||||
public isReady = ref(false);
|
||||
public isSitting = ref(false);
|
||||
@@ -60,7 +61,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, useVirtualJoystick: this.options.useVirtualJoystick }, [offscreen]);
|
||||
this.worker.postMessage({ type: 'init', canvas: offscreen, roomState: this.roomState.value, ...this.options }, [offscreen]);
|
||||
this.isReady.value = true;
|
||||
} else {
|
||||
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true });
|
||||
@@ -68,7 +69,7 @@ export class RoomController {
|
||||
babylonEngine.enableOfflineSupport = false;
|
||||
await babylonEngine.initAsync();
|
||||
|
||||
this.engine = new RoomEngine(this.roomState.value, { canvas, engine: babylonEngine, graphicsQuality: this.options.graphicsQuality, useVirtualJoystick: this.options.useVirtualJoystick });
|
||||
this.engine = new RoomEngine(this.roomState.value, { canvas, engine: babylonEngine, ...this.options });
|
||||
this.engine.on('loadingProgress', ({ progress }) => {
|
||||
this.initializeProgress.value = progress;
|
||||
});
|
||||
|
||||
@@ -224,6 +224,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
||||
canvas: HTMLCanvasElement;
|
||||
engine: BABYLON.WebGPUEngine;
|
||||
graphicsQuality: number;
|
||||
fps: number | null;
|
||||
useVirtualJoystick?: boolean;
|
||||
}) {
|
||||
super();
|
||||
@@ -237,7 +238,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
||||
};
|
||||
this.canvas = options.canvas;
|
||||
|
||||
this.fps = options.graphicsQuality >= GRAPHICS_QUALITY_HIGH ? null : 30;
|
||||
this.fps = options.fps;
|
||||
this.useGlow = options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM;
|
||||
|
||||
registerBuiltInLoaders();
|
||||
|
||||
Reference in New Issue
Block a user