mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 16:28:42 -06:00
xxx
This commit is contained in:
parent
932c2086f0
commit
09d08264d5
|
@ -59,19 +59,22 @@ impl World {
|
||||||
//State up/downgrades are handled here!
|
//State up/downgrades are handled here!
|
||||||
self.chunks.retain(|&position, chunk| {
|
self.chunks.retain(|&position, chunk| {
|
||||||
match chunk.desired {
|
match chunk.desired {
|
||||||
|
// Any => Unload downgrade
|
||||||
ChunkState::Unload => {
|
ChunkState::Unload => {
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
// Any => Nothing downgrade
|
||||||
ChunkState::Nothing => {
|
ChunkState::Nothing => {
|
||||||
chunk.block_data = None;
|
chunk.block_data = None;
|
||||||
chunk.vertex_buffer = None;
|
chunk.vertex_buffer = None;
|
||||||
chunk.state = ChunkState::Nothing;
|
chunk.state = ChunkState::Nothing;
|
||||||
},
|
},
|
||||||
|
// Nothing => Loading => Loaded upgrade
|
||||||
ChunkState::Loaded if matches!(chunk.state, ChunkState::Nothing) => {
|
ChunkState::Loaded if matches!(chunk.state, ChunkState::Nothing) => {
|
||||||
//FIXME this keeps loading!
|
|
||||||
self.thread.queue_load(position);
|
self.thread.queue_load(position);
|
||||||
},
|
},
|
||||||
ChunkState::Loaded if matches!(chunk.state, ChunkState::Rendered) => {
|
//Render => Loaded downgrade
|
||||||
|
ChunkState::Loaded if matches!(chunk.state, ChunkState::Rendering | ChunkState::Rendered) => {
|
||||||
chunk.vertex_buffer = None;
|
chunk.vertex_buffer = None;
|
||||||
chunk.state = ChunkState::Loaded;
|
chunk.state = ChunkState::Loaded;
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,9 @@ pub const CHUNK_HEIGHT: usize = 255;
|
||||||
pub enum ChunkState {
|
pub enum ChunkState {
|
||||||
Unload,
|
Unload,
|
||||||
Nothing,
|
Nothing,
|
||||||
|
Loading,
|
||||||
Loaded,
|
Loaded,
|
||||||
|
Rendering,
|
||||||
Rendered,
|
Rendered,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue