Skip to content

Commit 8900e8f

Browse files
committed
Set pixel ratio to prevent blurring
1 parent c70daca commit 8900e8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/scene-manager.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class SceneManager {
88
private readonly assetCache: AssetCache;
99
private readonly spawnedModels: Set<THREE.Group>;
1010
private readonly spawnedSounds: Set<HTMLAudioElement>;
11-
private readonly renderer: THREE.Renderer;
11+
private readonly renderer: THREE.WebGLRenderer;
1212
private readonly camera: THREE.PerspectiveCamera;
1313
private readonly scene: THREE.Scene;
1414
private readonly clock: THREE.Clock;
@@ -23,6 +23,7 @@ export class SceneManager {
2323
this.spawnedSounds = new Set();
2424

2525
this.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
26+
this.renderer.setPixelRatio(window.devicePixelRatio);
2627
this.camera = new THREE.PerspectiveCamera();
2728
this.camera.fov = 55;
2829
this.camera.far = this.camera.position.z = 1000;
@@ -68,15 +69,15 @@ export class SceneManager {
6869
* Render the current frame.
6970
*/
7071
private animate(): void {
71-
const delta = this.clock.getDelta();
72+
requestAnimationFrame(this.animate.bind(this));
7273

74+
const delta = this.clock.getDelta();
7375
this.syncRendererSize();
7476
this.moveGridsInfinitely(delta);
7577
this.moveTitleUntilRest(delta);
7678
this.moveSpawnedModels(delta);
7779

7880
this.renderer.render(this.scene, this.camera);
79-
requestAnimationFrame(this.animate.bind(this));
8081
}
8182

8283
/**

0 commit comments

Comments
 (0)