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},
|
tasks::{ChunkTaskManager, ChunkTaskResponse, ChunkTask},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//todo limit task starts insted
|
||||||
|
const MAX_CHUNK_RECV: usize = 8;
|
||||||
|
|
||||||
pub fn update_loaded_world_around_player() -> Workload {
|
pub fn update_loaded_world_around_player() -> Workload {
|
||||||
(
|
(
|
||||||
update_chunks_if_player_moved,
|
update_chunks_if_player_moved,
|
||||||
|
@ -121,7 +124,7 @@ fn start_required_tasks(
|
||||||
DesiredChunkState::Loaded | DesiredChunkState::Rendered if chunk.current_state == CurrentChunkState::Nothing => {
|
DesiredChunkState::Loaded | DesiredChunkState::Rendered if chunk.current_state == CurrentChunkState::Nothing => {
|
||||||
//start load task
|
//start load task
|
||||||
task_manager.spawn_task(ChunkTask::LoadChunk {
|
task_manager.spawn_task(ChunkTask::LoadChunk {
|
||||||
seed: 0xdead_cafe,
|
seed: 0xbeef_face_dead_cafe,
|
||||||
position
|
position
|
||||||
});
|
});
|
||||||
//Update chunk state
|
//Update chunk state
|
||||||
|
@ -157,7 +160,8 @@ fn process_completed_tasks(
|
||||||
mut meshes: NonSendSync<UniqueViewMut<ChunkMeshStorage>>,
|
mut meshes: NonSendSync<UniqueViewMut<ChunkMeshStorage>>,
|
||||||
renderer: NonSendSync<UniqueView<Renderer>>
|
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 {
|
match res {
|
||||||
ChunkTaskResponse::LoadedChunk { position, chunk_data } => {
|
ChunkTaskResponse::LoadedChunk { position, chunk_data } => {
|
||||||
//check if chunk exists
|
//check if chunk exists
|
||||||
|
@ -209,3 +213,4 @@ fn process_completed_tasks(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue