Rendering performace on F3

This commit is contained in:
2026-10-02 21:21:19 -03:00
parent 1511338a23
commit dcaf878254
9 changed files with 426 additions and 53 deletions
+5
View File
@@ -450,6 +450,9 @@ export class ClientLevel {
return true;
}
// meshes asked of the workers that haven't come back, for the f3 performance window
meshes_in_flight = 0;
// sends every dirty chunk that can be meshed to the workers
request_meshes(camera: Camera) {
for (const chunk of this.chunks.values()) {
@@ -468,6 +471,7 @@ export class ClientLevel {
biome_colors.push(neighbor?.biome_colors ?? null);
}
}
this.meshes_in_flight += 1;
this.workers.post({
type: "mesh",
chunk_x: chunk.x,
@@ -512,6 +516,7 @@ export class ClientLevel {
}
#on_meshed(message: Extract<FromChunkWorker, { type: "meshed" }>) {
this.meshes_in_flight -= 1;
const chunk = this.get_chunk(message.chunk_x, message.chunk_z);
// unloaded, or remeshed again since this was requested
if (!chunk || chunk.mesh_version !== message.version) {