mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-29 22:14:50 +02:00
wip
This commit is contained in:
@@ -7,7 +7,7 @@ import { reactive, ref, shallowRef, triggerRef, watch } from 'vue';
|
|||||||
import * as BABYLON from '@babylonjs/core';
|
import * as BABYLON from '@babylonjs/core';
|
||||||
import { cm } from '../utility.js';
|
import { cm } from '../utility.js';
|
||||||
import RoomWorker from './worker?worker';
|
import RoomWorker from './worker?worker';
|
||||||
import { RoomEngine } from './engine.js';
|
import { GRAPHICS_QUALITY_MEDIUM, RoomEngine } from './engine.js';
|
||||||
import type { ShallowRef } from 'vue';
|
import type { ShallowRef } from 'vue';
|
||||||
import type { RoomState } from './engine.js';
|
import type { RoomState } from './engine.js';
|
||||||
import type { ObjectDef, RoomStateObject } from './object.js';
|
import type { ObjectDef, RoomStateObject } from './object.js';
|
||||||
@@ -82,7 +82,7 @@ export class RoomController {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance' });
|
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: this.options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM });
|
||||||
babylonEngine.compatibilityMode = false;
|
babylonEngine.compatibilityMode = false;
|
||||||
babylonEngine.enableOfflineSupport = false;
|
babylonEngine.enableOfflineSupport = false;
|
||||||
babylonEngine.onContextLostObservable.add(() => {
|
babylonEngine.onContextLostObservable.add(() => {
|
||||||
@@ -99,7 +99,6 @@ export class RoomController {
|
|||||||
this.engine = new RoomEngine(this.roomState.value, {
|
this.engine = new RoomEngine(this.roomState.value, {
|
||||||
canvas,
|
canvas,
|
||||||
engine: babylonEngine,
|
engine: babylonEngine,
|
||||||
sharpen: this.options.resolution >= 1,
|
|
||||||
...this.options,
|
...this.options,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
engine: BABYLON.WebGPUEngine;
|
engine: BABYLON.WebGPUEngine;
|
||||||
graphicsQuality: number;
|
graphicsQuality: number;
|
||||||
fps: number | null;
|
fps: number | null;
|
||||||
sharpen: boolean;
|
|
||||||
useVirtualJoystick?: boolean;
|
useVirtualJoystick?: boolean;
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
@@ -429,30 +428,27 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM) {
|
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.graphicsQuality >= GRAPHICS_QUALITY_HIGH) {
|
// snapshot renderingと相性が悪そう
|
||||||
// snapshot renderingと相性が悪そう
|
//pipeline.depthOfFieldEnabled = true;
|
||||||
//pipeline.depthOfFieldEnabled = true;
|
//pipeline.depthOfField.focusDistance = 1500;
|
||||||
//pipeline.depthOfField.focusDistance = 1500;
|
//pipeline.depthOfField.focalLength = 20;
|
||||||
//pipeline.depthOfField.focalLength = 20;
|
//pipeline.depthOfField.fStop = 1.4;
|
||||||
//pipeline.depthOfField.fStop = 1.4;
|
|
||||||
|
|
||||||
pipeline.bloomEnabled = true;
|
pipeline.bloomEnabled = true;
|
||||||
pipeline.bloomThreshold = 0.95;
|
pipeline.bloomThreshold = 0.95;
|
||||||
pipeline.bloomWeight = 0.3;
|
pipeline.bloomWeight = 0.3;
|
||||||
pipeline.bloomKernel = 256;
|
pipeline.bloomKernel = 256;
|
||||||
pipeline.bloomScale = 2;
|
pipeline.bloomScale = 2;
|
||||||
|
|
||||||
//pipeline.chromaticAberrationEnabled = true;
|
//pipeline.chromaticAberrationEnabled = true;
|
||||||
//pipeline.chromaticAberration.radialIntensity = 2;
|
//pipeline.chromaticAberration.radialIntensity = 2;
|
||||||
}
|
|
||||||
|
|
||||||
if (options.sharpen) {
|
pipeline.sharpenEnabled = true;
|
||||||
pipeline.sharpenEnabled = true;
|
pipeline.sharpen.edgeAmount = 0.5;
|
||||||
pipeline.sharpen.edgeAmount = 0.5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as BABYLON from '@babylonjs/core';
|
import * as BABYLON from '@babylonjs/core';
|
||||||
import { RoomEngine } from './engine.js';
|
import { GRAPHICS_QUALITY_MEDIUM, RoomEngine } from './engine.js';
|
||||||
import type { RoomState } from './engine.js';
|
import type { RoomState } from './engine.js';
|
||||||
|
|
||||||
let engine: RoomEngine | null = null;
|
let engine: RoomEngine | null = null;
|
||||||
@@ -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' });
|
const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance', antialias: event.data.options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM });
|
||||||
babylonEngine.compatibilityMode = false;
|
babylonEngine.compatibilityMode = false;
|
||||||
babylonEngine.enableOfflineSupport = false;
|
babylonEngine.enableOfflineSupport = false;
|
||||||
await babylonEngine.initAsync();
|
await babylonEngine.initAsync();
|
||||||
@@ -27,7 +27,6 @@ onmessage = async (event) => {
|
|||||||
engine = new RoomEngine(roomState, {
|
engine = new RoomEngine(roomState, {
|
||||||
canvas,
|
canvas,
|
||||||
engine: babylonEngine,
|
engine: babylonEngine,
|
||||||
sharpen: event.data.options.resolution >= 1,
|
|
||||||
...event.data.options,
|
...event.data.options,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user