fixed deprecation issues
This commit is contained in:
+14
-13
@@ -122,9 +122,9 @@ class GameEngine extends EventManager{
|
|||||||
scene.background = new THREE.Color(1, 1, 1);
|
scene.background = new THREE.Color(1, 1, 1);
|
||||||
|
|
||||||
const mixer = new THREE.AnimationMixer(this.scene);
|
const mixer = new THREE.AnimationMixer(this.scene);
|
||||||
const clock = new THREE.Clock();
|
const timer = new THREE.Timer();
|
||||||
|
|
||||||
this.clock = clock;
|
this.timer = timer;
|
||||||
this.mixers = [mixer];
|
this.mixers = [mixer];
|
||||||
|
|
||||||
await this.initPhysics();
|
await this.initPhysics();
|
||||||
@@ -162,7 +162,7 @@ class GameEngine extends EventManager{
|
|||||||
renderer.toneMapping = THREE.CineonToneMapping;
|
renderer.toneMapping = THREE.CineonToneMapping;
|
||||||
renderer.toneMappingExposure = 1.0;
|
renderer.toneMappingExposure = 1.0;
|
||||||
renderer.shadowMap.enabled = true;
|
renderer.shadowMap.enabled = true;
|
||||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
renderer.shadowMap.type = THREE.PCFShadowMap; // default THREE.PCFShadowMap
|
||||||
// renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
// renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||||
// renderer.toneMappingExposure = 1;
|
// renderer.toneMappingExposure = 1;
|
||||||
// renderer.shadowMap.enabled = true;
|
// renderer.shadowMap.enabled = true;
|
||||||
@@ -224,19 +224,20 @@ class GameEngine extends EventManager{
|
|||||||
|
|
||||||
await this.initScene();
|
await this.initScene();
|
||||||
|
|
||||||
function animate(time) {
|
function animate() {
|
||||||
let delta = gameEngine.clock.getDelta();
|
this.timer.update();
|
||||||
gameEngine.physics?.step();
|
let delta = this.timer.getDelta();
|
||||||
gameEngine.handleXrAction(gameEngine, delta);
|
this.physics?.step();
|
||||||
gameEngine.hero?.update(delta);
|
this.handleXrAction(this, delta);
|
||||||
gameEngine.mixers.forEach(m => m.update(delta));
|
this.hero?.update(delta);
|
||||||
gameEngine.dispatchEvent({type: 'beforeRender'})
|
this.mixers.forEach(m => m.update(delta));
|
||||||
gameEngine.processHideIfFar();
|
this.dispatchEvent({type: 'beforeRender'})
|
||||||
|
this.processHideIfFar();
|
||||||
this.motionQueue.update(delta);
|
this.motionQueue.update(delta);
|
||||||
|
|
||||||
gameEngine.render(gameEngine.scene, gameEngine.camera);
|
this.render(this.scene, this.camera);
|
||||||
if (!renderer.xr.isPresenting) {
|
if (!renderer.xr.isPresenting) {
|
||||||
gameEngine.gizmo?.render();
|
this.gizmo?.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderer.setAnimationLoop(animate.bind(this));
|
renderer.setAnimationLoop(animate.bind(this));
|
||||||
|
|||||||
Reference in New Issue
Block a user