Skip to content

Commit

Permalink
Set pixel ratio to prevent blurring
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehorvat committed May 25, 2024
1 parent e105db8 commit 4a9d7af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/scene-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import * as ThreeUtils from './three-utils';
import { Synthesizer } from './synthesizer';

export class SceneManager {
private readonly renderer: THREE.Renderer;
private readonly renderer: THREE.WebGLRenderer;
private readonly camera: THREE.PerspectiveCamera;
private readonly scene: THREE.Scene;
private readonly clock: THREE.Clock;
private readonly synthesizer: Synthesizer;

constructor() {
this.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
this.renderer.setPixelRatio(window.devicePixelRatio);
this.camera = new THREE.PerspectiveCamera();
this.camera.fov = 20;
this.scene = new THREE.Scene();
Expand Down Expand Up @@ -39,14 +40,14 @@ export class SceneManager {
* Render the current frame.
*/
private animate(): void {
const delta = this.clock.getDelta();
requestAnimationFrame(this.animate.bind(this));

const delta = this.clock.getDelta();
this.syncRendererSize();
this.rotateSynthesizerUntilRest(delta);
this.maintainSafeCameraDistance();

this.renderer.render(this.scene, this.camera);
requestAnimationFrame(this.animate.bind(this));
}

/**
Expand Down

0 comments on commit 4a9d7af

Please sign in to comment.