This commit is contained in:
@@ -13,6 +13,9 @@ class EventManager extends EventDispatcher{
|
|||||||
}
|
}
|
||||||
this.addEventListener(type, wrapper);
|
this.addEventListener(type, wrapper);
|
||||||
}
|
}
|
||||||
|
removeAllListenersOfType(type){
|
||||||
|
this._listeners?.[ type ]?.splice(0, this._listeners[ type ].length)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { EventManager }
|
export { EventManager }
|
||||||
@@ -71,7 +71,7 @@ class GameEngine extends EventManager{
|
|||||||
dirLight.castShadow = true;
|
dirLight.castShadow = true;
|
||||||
dirLight.shadow.mapSize.width = 1024;
|
dirLight.shadow.mapSize.width = 1024;
|
||||||
dirLight.shadow.mapSize.height = 1024;
|
dirLight.shadow.mapSize.height = 1024;
|
||||||
const d = 50;
|
const d = 10;
|
||||||
dirLight.shadow.camera.left = - d;
|
dirLight.shadow.camera.left = - d;
|
||||||
dirLight.shadow.camera.right = d;
|
dirLight.shadow.camera.right = d;
|
||||||
dirLight.shadow.camera.top = d;
|
dirLight.shadow.camera.top = d;
|
||||||
@@ -87,6 +87,7 @@ class GameEngine extends EventManager{
|
|||||||
alpha: false,
|
alpha: false,
|
||||||
preserveDrawingBuffer: true, //this is important for screenshots capturing
|
preserveDrawingBuffer: true, //this is important for screenshots capturing
|
||||||
powerPreference: "high-performance",
|
powerPreference: "high-performance",
|
||||||
|
//precision: 'mediump'
|
||||||
});
|
});
|
||||||
renderer.setPixelRatio(window.devicePixelRatio);
|
renderer.setPixelRatio(window.devicePixelRatio);
|
||||||
renderer.toneMapping = THREE.CineonToneMapping;
|
renderer.toneMapping = THREE.CineonToneMapping;
|
||||||
@@ -102,6 +103,7 @@ class GameEngine extends EventManager{
|
|||||||
renderer.autoClear = true;
|
renderer.autoClear = true;
|
||||||
//renderer.alpha = true
|
//renderer.alpha = true
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
|
this.pmremGenerator = new THREE.PMREMGenerator(renderer);
|
||||||
|
|
||||||
this.anaglyph = new AnaglyphEffect(renderer);
|
this.anaglyph = new AnaglyphEffect(renderer);
|
||||||
this.anaglyph.setSize(this.w, this.h);
|
this.anaglyph.setSize(this.w, this.h);
|
||||||
@@ -476,7 +478,8 @@ class GameEngine extends EventManager{
|
|||||||
let t = await GameEngine.loadTexture(url, path);
|
let t = await GameEngine.loadTexture(url, path);
|
||||||
t.mapping = THREE.EquirectangularReflectionMapping;
|
t.mapping = THREE.EquirectangularReflectionMapping;
|
||||||
this.scene.background = t;
|
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) {
|
async captureScreenshot(type = 'image/webp', quality = 80) {
|
||||||
@@ -642,6 +645,7 @@ class GameEngine extends EventManager{
|
|||||||
this.motionQueue.clearAll();
|
this.motionQueue.clearAll();
|
||||||
this.ambientSound.stop();
|
this.ambientSound.stop();
|
||||||
this.tm?.setScene(null);
|
this.tm?.setScene(null);
|
||||||
|
this.removeAllListenersOfType('beforeRender')
|
||||||
}
|
}
|
||||||
|
|
||||||
async playAmbientSound(source, path){
|
async playAmbientSound(source, path){
|
||||||
|
|||||||
Reference in New Issue
Block a user