1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-05 03:34:07 +02:00

Update engine.ts

This commit is contained in:
syuilo
2026-04-26 10:08:43 +09:00
parent 7e41d17c6a
commit 5c28ee0536

View File

@@ -195,7 +195,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
private gridMaterial: GridMaterial; private gridMaterial: GridMaterial;
private gridPlane: BABYLON.Mesh; private gridPlane: BABYLON.Mesh;
private gizmoManager: BABYLON.GizmoManager; private gizmoManager: BABYLON.GizmoManager;
private selectionOutlineLayer: BABYLON.SelectionOutlineLayer; private selectionOutlineLayer: BABYLON.SelectionOutlineLayer | null = null;
public sr: BABYLON.SnapshotRenderingHelper; public sr: BABYLON.SnapshotRenderingHelper;
private gl: BABYLON.GlowLayer | null = null; private gl: BABYLON.GlowLayer | null = null;
public timer: Timer = new Timer(); public timer: Timer = new Timer();
@@ -413,11 +413,13 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
this.gridPlane.isPickable = false; this.gridPlane.isPickable = false;
this.gridPlane.isVisible = false; this.gridPlane.isVisible = false;
if (options.graphicsQuality >= GRAPHICS_QUALITY_MEDIUM) {
this.selectionOutlineLayer = new BABYLON.SelectionOutlineLayer('outliner', this.scene); this.selectionOutlineLayer = new BABYLON.SelectionOutlineLayer('outliner', this.scene);
this.scene.setRenderingAutoClearDepthStencil(this.selectionOutlineLayer.renderingGroupId, false); this.scene.setRenderingAutoClearDepthStencil(this.selectionOutlineLayer.renderingGroupId, false);
if (SNAPSHOT_RENDERING) { if (SNAPSHOT_RENDERING) {
this.sr.updateMeshesForEffectLayer(this.selectionOutlineLayer); this.sr.updateMeshesForEffectLayer(this.selectionOutlineLayer);
} }
}
if (_DEV_) { if (_DEV_) {
// snapshot renderingかつglow layerが有効だとなんかクラッシュする // snapshot renderingかつglow layerが有効だとなんかクラッシュする
@@ -1176,6 +1178,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
} }
private highlightMeshes(meshes: BABYLON.AbstractMesh[]) { private highlightMeshes(meshes: BABYLON.AbstractMesh[]) {
if (this.selectionOutlineLayer == null) return;
//if (this.engine.snapshotRendering) return; // snapshot rendering内でそのままやろうとするとエラーになる 回避実装もめんどいので単に無視 //if (this.engine.snapshotRendering) return; // snapshot rendering内でそのままやろうとするとエラーになる 回避実装もめんどいので単に無視
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意 if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
this.clearHighlight(); this.clearHighlight();
@@ -1184,6 +1188,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
} }
private clearHighlight() { private clearHighlight() {
if (this.selectionOutlineLayer == null) return;
//if (this.engine.snapshotRendering) return; // snapshot rendering内でそのままやろうとするとエラーになる 回避実装もめんどいので単に無視 //if (this.engine.snapshotRendering) return; // snapshot rendering内でそのままやろうとするとエラーになる 回避実装もめんどいので単に無視
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意 if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
this.selectionOutlineLayer.clearSelection(); this.selectionOutlineLayer.clearSelection();