@@ -8,7 +8,7 @@ export class SceneManager {
8
8
private readonly assetCache : AssetCache ;
9
9
private readonly spawnedModels : Set < THREE . Group > ;
10
10
private readonly spawnedSounds : Set < HTMLAudioElement > ;
11
- private readonly renderer : THREE . Renderer ;
11
+ private readonly renderer : THREE . WebGLRenderer ;
12
12
private readonly camera : THREE . PerspectiveCamera ;
13
13
private readonly scene : THREE . Scene ;
14
14
private readonly clock : THREE . Clock ;
@@ -23,6 +23,7 @@ export class SceneManager {
23
23
this . spawnedSounds = new Set ( ) ;
24
24
25
25
this . renderer = new THREE . WebGLRenderer ( { alpha : true , antialias : true } ) ;
26
+ this . renderer . setPixelRatio ( window . devicePixelRatio ) ;
26
27
this . camera = new THREE . PerspectiveCamera ( ) ;
27
28
this . camera . fov = 55 ;
28
29
this . camera . far = this . camera . position . z = 1000 ;
@@ -68,15 +69,15 @@ export class SceneManager {
68
69
* Render the current frame.
69
70
*/
70
71
private animate ( ) : void {
71
- const delta = this . clock . getDelta ( ) ;
72
+ requestAnimationFrame ( this . animate . bind ( this ) ) ;
72
73
74
+ const delta = this . clock . getDelta ( ) ;
73
75
this . syncRendererSize ( ) ;
74
76
this . moveGridsInfinitely ( delta ) ;
75
77
this . moveTitleUntilRest ( delta ) ;
76
78
this . moveSpawnedModels ( delta ) ;
77
79
78
80
this . renderer . render ( this . scene , this . camera ) ;
79
- requestAnimationFrame ( this . animate . bind ( this ) ) ;
80
81
}
81
82
82
83
/**
0 commit comments