This commit is contained in:
2026-03-11 21:59:44 +02:00
parent 4587042b10
commit 78705e276e
2 changed files with 9 additions and 2 deletions
+3
View File
@@ -13,6 +13,9 @@ class EventManager extends EventDispatcher{
}
this.addEventListener(type, wrapper);
}
removeAllListenersOfType(type){
this._listeners?.[ type ]?.splice(0, this._listeners[ type ].length)
}
}
export { EventManager }
+6 -2
View File
@@ -71,7 +71,7 @@ class GameEngine extends EventManager{
dirLight.castShadow = true;
dirLight.shadow.mapSize.width = 1024;
dirLight.shadow.mapSize.height = 1024;
const d = 50;
const d = 10;
dirLight.shadow.camera.left = - d;
dirLight.shadow.camera.right = d;
dirLight.shadow.camera.top = d;
@@ -87,6 +87,7 @@ class GameEngine extends EventManager{
alpha: false,
preserveDrawingBuffer: true, //this is important for screenshots capturing
powerPreference: "high-performance",
//precision: 'mediump'
});
renderer.setPixelRatio(window.devicePixelRatio);
renderer.toneMapping = THREE.CineonToneMapping;
@@ -102,6 +103,7 @@ class GameEngine extends EventManager{
renderer.autoClear = true;
//renderer.alpha = true
this.renderer = renderer;
this.pmremGenerator = new THREE.PMREMGenerator(renderer);
this.anaglyph = new AnaglyphEffect(renderer);
this.anaglyph.setSize(this.w, this.h);
@@ -476,7 +478,8 @@ class GameEngine extends EventManager{
let t = await GameEngine.loadTexture(url, path);
t.mapping = THREE.EquirectangularReflectionMapping;
this.scene.background = t;
this.scene.environment = t;
//this.scene.environment = t;
this.scene.environment = this.pmremGenerator.fromEquirectangular(t).texture;
}
async captureScreenshot(type = 'image/webp', quality = 80) {
@@ -642,6 +645,7 @@ class GameEngine extends EventManager{
this.motionQueue.clearAll();
this.ambientSound.stop();
this.tm?.setScene(null);
this.removeAllListenersOfType('beforeRender')
}
async playAmbientSound(source, path){