fixed node texture shifting bugs
This commit is contained in:
+17
-17
@@ -80,28 +80,28 @@ impl Game {
|
||||
}
|
||||
|
||||
// Chunk position
|
||||
// if self.prev_chunk_pos == None || self.prev_chunk_pos != Some(chunk_pos) {
|
||||
// renderer.get_ui().set_text("World", 2, format!("Chunk: {}, {}, {}", chunk_pos.x, chunk_pos.y, chunk_pos.z));
|
||||
if self.prev_chunk_pos == None || self.prev_chunk_pos != Some(chunk_pos) {
|
||||
renderer.get_ui().set_text("World", 2, format!("Chunk: {}, {}, {}", chunk_pos.x, chunk_pos.y, chunk_pos.z));
|
||||
|
||||
|
||||
// let dir = chunk_pos - self.prev_chunk_pos.unwrap_or(chunk_pos); //TODO: clamp to -1,1
|
||||
// if dir.x != 0 || dir.y != 0 || dir.z != 0 {
|
||||
let dir = chunk_pos - self.prev_chunk_pos.unwrap_or(chunk_pos); //TODO: clamp to -1,1
|
||||
if dir.x != 0 || dir.y != 0 || dir.z != 0 {
|
||||
|
||||
// // Shift world
|
||||
// renderer.shift(dir * world::chunk::SIZE as i32);
|
||||
// Shift world
|
||||
renderer.shift(dir * world::chunk::SIZE as i32);
|
||||
|
||||
// // Load chunks at the edge
|
||||
// let center = chunk_pos.clone() + RENDER_DIST*dir;
|
||||
// let mask = Vector3{x: dir.x.abs(), y: dir.y.abs(), z: dir.z.abs()};
|
||||
// println!("Load at {:?}", center);
|
||||
// Load chunks at the edge
|
||||
let center = chunk_pos.clone() + RENDER_DIST*dir;
|
||||
let mask = Vector3{x: dir.x.abs(), y: dir.y.abs(), z: dir.z.abs()};
|
||||
println!("Load at {:?}", center);
|
||||
|
||||
// for a in -RENDER_DIST..RENDER_DIST+1 {
|
||||
// let pos = center + Vector3{x: mask.z*a, y: 0, z: mask.x*a};
|
||||
// self.world.load_chunk(pos);
|
||||
// }
|
||||
// }
|
||||
// self.prev_chunk_pos = Some(chunk_pos);
|
||||
// }
|
||||
for a in -RENDER_DIST..RENDER_DIST+1 {
|
||||
let pos = center + Vector3{x: mask.z*a, y: 0, z: mask.x*a};
|
||||
self.world.load_chunk(pos);
|
||||
}
|
||||
}
|
||||
self.prev_chunk_pos = Some(chunk_pos);
|
||||
}
|
||||
|
||||
// Send dirty chunks to renderer
|
||||
// TODO: Unload chunks above certain radius
|
||||
|
||||
Reference in New Issue
Block a user