mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-21 00:35:25 +02:00
Update engine.ts
This commit is contained in:
@@ -488,6 +488,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
private yGridPreviewPlane: BABYLON.Mesh;
|
private yGridPreviewPlane: BABYLON.Mesh;
|
||||||
private zGridPreviewPlane: BABYLON.Mesh;
|
private zGridPreviewPlane: BABYLON.Mesh;
|
||||||
private selectionOutlineLayer: BABYLON.SelectionOutlineLayer;
|
private selectionOutlineLayer: BABYLON.SelectionOutlineLayer;
|
||||||
|
public sr: BABYLON.SnapshotRenderingHelper;
|
||||||
|
|
||||||
private _isEditMode = false;
|
private _isEditMode = false;
|
||||||
get isEditMode() {
|
get isEditMode() {
|
||||||
@@ -532,6 +533,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
//this.scene.autoClearDepthAndStencil = false;
|
//this.scene.autoClearDepthAndStencil = false;
|
||||||
this.scene.skipPointerMovePicking = true;
|
this.scene.skipPointerMovePicking = true;
|
||||||
|
|
||||||
|
this.sr = new BABYLON.SnapshotRenderingHelper(this.scene);
|
||||||
|
|
||||||
const skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: cm(100000) }, this.scene);
|
const skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: cm(100000) }, this.scene);
|
||||||
const skyboxMat = new BABYLON.StandardMaterial('skyboxMat', this.scene);
|
const skyboxMat = new BABYLON.StandardMaterial('skyboxMat', this.scene);
|
||||||
skyboxMat.backFaceCulling = false;
|
skyboxMat.backFaceCulling = false;
|
||||||
@@ -582,7 +585,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
this.roomLight.shadowMinZ = cm(10);
|
this.roomLight.shadowMinZ = cm(10);
|
||||||
this.roomLight.shadowMaxZ = cm(300);
|
this.roomLight.shadowMaxZ = cm(300);
|
||||||
|
|
||||||
this.shadowGeneratorForRoomLight = new BABYLON.ShadowGenerator(4096, this.roomLight);
|
this.shadowGeneratorForRoomLight = new BABYLON.ShadowGenerator(2048, this.roomLight);
|
||||||
this.shadowGeneratorForRoomLight.forceBackFacesOnly = true;
|
this.shadowGeneratorForRoomLight.forceBackFacesOnly = true;
|
||||||
this.shadowGeneratorForRoomLight.bias = 0.0001;
|
this.shadowGeneratorForRoomLight.bias = 0.0001;
|
||||||
this.shadowGeneratorForRoomLight.usePercentageCloserFiltering = true;
|
this.shadowGeneratorForRoomLight.usePercentageCloserFiltering = true;
|
||||||
@@ -597,7 +600,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
sunLight.shadowMinZ = cm(1000);
|
sunLight.shadowMinZ = cm(1000);
|
||||||
sunLight.shadowMaxZ = cm(2000);
|
sunLight.shadowMaxZ = cm(2000);
|
||||||
|
|
||||||
this.shadowGeneratorForSunLight = new BABYLON.ShadowGenerator(4096, sunLight);
|
this.shadowGeneratorForSunLight = new BABYLON.ShadowGenerator(2048, sunLight);
|
||||||
this.shadowGeneratorForSunLight.forceBackFacesOnly = true;
|
this.shadowGeneratorForSunLight.forceBackFacesOnly = true;
|
||||||
this.shadowGeneratorForSunLight.bias = 0.0001;
|
this.shadowGeneratorForSunLight.bias = 0.0001;
|
||||||
this.shadowGeneratorForSunLight.usePercentageCloserFiltering = true;
|
this.shadowGeneratorForSunLight.usePercentageCloserFiltering = true;
|
||||||
@@ -608,12 +611,16 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
|
|
||||||
this.turnOnRoomLight();
|
this.turnOnRoomLight();
|
||||||
|
|
||||||
if (USE_GLOW && !SNAPSHOT_RENDERING) {
|
if (USE_GLOW) {
|
||||||
const gl = new BABYLON.GlowLayer('glow', this.scene, {
|
const gl = new BABYLON.GlowLayer('glow', this.scene, {
|
||||||
//mainTextureFixedSize: 512,
|
//mainTextureFixedSize: 512,
|
||||||
blurKernelSize: 64,
|
blurKernelSize: 64,
|
||||||
});
|
});
|
||||||
gl.intensity = 0.5;
|
gl.intensity = 0.5;
|
||||||
|
|
||||||
|
if (SNAPSHOT_RENDERING) {
|
||||||
|
this.sr.updateMeshesForEffectLayer(gl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -762,20 +769,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SNAPSHOT_RENDERING) {
|
if (SNAPSHOT_RENDERING) {
|
||||||
const sr = new BABYLON.SnapshotRenderingHelper(this.scene);
|
|
||||||
|
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
sr.enableSnapshotRendering();
|
this.sr.enableSnapshotRendering();
|
||||||
|
|
||||||
if (USE_GLOW) {
|
|
||||||
const gl = new BABYLON.GlowLayer('glow', this.scene, {
|
|
||||||
//mainTextureFixedSize: 512,
|
|
||||||
blurKernelSize: 64,
|
|
||||||
});
|
|
||||||
gl.intensity = 0.5;
|
|
||||||
|
|
||||||
sr.updateMeshesForEffectLayer(gl);
|
|
||||||
}
|
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user