mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 20:08:20 -06:00
u
This commit is contained in:
parent
a512fffcc4
commit
294648b1b2
|
@ -13,6 +13,9 @@ use super::{
|
|||
tasks::{ChunkTaskManager, ChunkTaskResponse, ChunkTask},
|
||||
};
|
||||
|
||||
//todo limit task starts insted
|
||||
const MAX_CHUNK_RECV: usize = 8;
|
||||
|
||||
pub fn update_loaded_world_around_player() -> Workload {
|
||||
(
|
||||
update_chunks_if_player_moved,
|
||||
|
@ -121,7 +124,7 @@ fn start_required_tasks(
|
|||
DesiredChunkState::Loaded | DesiredChunkState::Rendered if chunk.current_state == CurrentChunkState::Nothing => {
|
||||
//start load task
|
||||
task_manager.spawn_task(ChunkTask::LoadChunk {
|
||||
seed: 0xdead_cafe,
|
||||
seed: 0xbeef_face_dead_cafe,
|
||||
position
|
||||
});
|
||||
//Update chunk state
|
||||
|
@ -157,7 +160,8 @@ fn process_completed_tasks(
|
|||
mut meshes: NonSendSync<UniqueViewMut<ChunkMeshStorage>>,
|
||||
renderer: NonSendSync<UniqueView<Renderer>>
|
||||
) {
|
||||
while let Some(res) = task_manager.receive() {
|
||||
for _ in 0..MAX_CHUNK_OPS {
|
||||
if let Some(res) = task_manager.receive() {
|
||||
match res {
|
||||
ChunkTaskResponse::LoadedChunk { position, chunk_data } => {
|
||||
//check if chunk exists
|
||||
|
@ -208,4 +212,5 @@ fn process_completed_tasks(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue