don't count discarded ops

This commit is contained in:
griffi-gh 2023-02-05 01:22:43 +01:00
parent 816d2f6077
commit 1b85340d9c

View file

@ -170,8 +170,8 @@ fn process_completed_tasks(
mut meshes: NonSendSync<UniqueViewMut<ChunkMeshStorage>>,
renderer: NonSendSync<UniqueView<Renderer>>
) {
for _ in 0..MAX_CHUNK_OPS {
if let Some(res) = task_manager.receive() {
let mut ops: usize = 0;
while let Some(res) = task_manager.receive() {
match res {
ChunkTaskResponse::LoadedChunk { position, chunk_data } => {
//check if chunk exists
@ -193,6 +193,9 @@ fn process_completed_tasks(
//update chunk state
chunk.current_state = CurrentChunkState::Loaded;
//increase ops counter
ops += 1;
},
ChunkTaskResponse::GeneratedMesh { position, vertices, indexes } => {
//check if chunk exists
@ -223,8 +226,13 @@ fn process_completed_tasks(
//update chunk state
chunk.current_state = CurrentChunkState::Rendered;
//increase ops counter
ops += 1;
}
}
if ops >= MAX_CHUNK_OPS {
break
}
}
}