Rendering performace on F3
This commit is contained in:
+13
-6
@@ -9,6 +9,7 @@ import { Camera } from "./camera.ts";
|
||||
import { Options } from "./options.ts";
|
||||
import { MultiPlayerGameMode } from "./game_mode.ts";
|
||||
import { ClientPacketListener } from "./packet_listener.ts";
|
||||
import { profiler } from "./profiler.ts";
|
||||
import { GameRenderer } from "./rendering/game_renderer.ts";
|
||||
import { ChatComponent } from "./gui/chat_component.ts";
|
||||
import { GuiMenuScreen, GuiScreen } from "./gui/gui_screen.ts";
|
||||
@@ -148,13 +149,19 @@ export class Client {
|
||||
|
||||
this.#pending_time += delta;
|
||||
let ticks = 0;
|
||||
while (this.#pending_time >= TICK_DELTA && ticks < MAX_TICKS_PER_FRAME) {
|
||||
this.tick();
|
||||
if (this.#stopped) {
|
||||
return;
|
||||
const stopped = profiler.section("ticks", () => {
|
||||
while (this.#pending_time >= TICK_DELTA && ticks < MAX_TICKS_PER_FRAME) {
|
||||
this.tick();
|
||||
if (this.#stopped) {
|
||||
return true;
|
||||
}
|
||||
this.#pending_time -= TICK_DELTA;
|
||||
ticks += 1;
|
||||
}
|
||||
this.#pending_time -= TICK_DELTA;
|
||||
ticks += 1;
|
||||
return false;
|
||||
});
|
||||
if (stopped) {
|
||||
return;
|
||||
}
|
||||
if (ticks === MAX_TICKS_PER_FRAME) {
|
||||
this.#pending_time = Math.min(this.#pending_time, TICK_DELTA);
|
||||
|
||||
Reference in New Issue
Block a user